ArcadeDB Version: 10.2021
JDK Version: 11
OS: win
The following testcase is failing if executed first time and pretty OK if executed second and etc.
@Test
public void testDocumentAfterCreation() {
DocumentType typeRoot = database.getSchema().getOrCreateDocumentType("TestRoot");
typeRoot.getOrCreateProperty("name", String.class);
typeRoot.getOrCreateTypeIndex(INDEX_TYPE.FULL_TEXT, true, "name");
database.command("sql", "delete from TestRoot");
DocumentType typeChild = database.getSchema().getOrCreateDocumentType("TestChild");
typeChild.setParentTypes(Arrays.asList(typeRoot));
MutableDocument doc = database.newDocument("TestChild");
doc.set("name", "Document Name");
assertEquals("Document Name", doc.get("name"));
doc.save();
assertEquals("Document Name", doc.get("name"));
try(ResultSet rs = database.query("sql", "select from TestChild where name = :name", CommonUtils.toMap("arg0", "Test2", "name", "Document Name"))) {
assertTrue(rs.hasNext());
Document docRetrieved = rs.next().getElement().orElse(null);
assertEquals("Document Name", docRetrieved.get("name"));
assertFalse(rs.hasNext());
}
}
Type of the index and uniqueness doesn't matter here.
Moreover, slight modification of indexes leads to the testcase which always fail: first, second and etc.
@Test
public void testDocumentAfterCreation2() {
DocumentType typeRoot = database.getSchema().getOrCreateDocumentType("TestRoot2");
typeRoot.getOrCreateProperty("name", String.class);
typeRoot.getOrCreateProperty("parent", Type.LINK);
typeRoot.getOrCreateTypeIndex(INDEX_TYPE.LSM_TREE, true, "name", "parent");
database.command("sql", "delete from TestRoot2");
DocumentType typeChild = database.getSchema().getOrCreateDocumentType("TestChild2");
typeChild.setParentTypes(Arrays.asList(typeRoot));
MutableDocument doc = database.newDocument("TestChild2");
doc.set("name", "Document Name");
assertEquals("Document Name", doc.get("name"));
doc.save();
assertEquals("Document Name", doc.get("name"));
try(ResultSet rs = database.query("sql", "select from TestChild2 where name = :name", CommonUtils.toMap("arg0", "Test2", "name", "Document Name"))) {
assertTrue(rs.hasNext());
Document docRetrieved = rs.next().getElement().orElse(null);
assertEquals("Document Name", docRetrieved.get("name"));
assertFalse(rs.hasNext());
}
}
Both test cases become successful if delete line with the creation of an index.
ArcadeDB Version: 10.2021
JDK Version: 11
OS: win
The following testcase is failing if executed first time and pretty OK if executed second and etc.
Type of the index and uniqueness doesn't matter here.
Moreover, slight modification of indexes leads to the testcase which always fail: first, second and etc.
Both test cases become successful if delete line with the creation of an index.