use of com.orientechnologies.orient.core.index.OIndexDefinition in project orientdb by orientechnologies.
the class ClassIndexTest method testCreateOnePropertyLinkMapByValueIndex.
@Test
public void testCreateOnePropertyLinkMapByValueIndex() {
final OIndex result = oClass.createIndex("ClassIndexTestPropertyLinkedMapByValue", OClass.INDEX_TYPE.UNIQUE.toString(), null, new ODocument().fields("ignoreNullValues", true), new String[] { "fLinkMap by value" });
assertEquals(result.getName(), "ClassIndexTestPropertyLinkedMapByValue");
assertEquals(oClass.getClassIndex("ClassIndexTestPropertyLinkedMapByValue").getName(), result.getName());
assertEquals(database.getMetadata().getIndexManager().getClassIndex("ClassIndexTestClass", "ClassIndexTestPropertyLinkedMapByValue").getName(), result.getName());
final OIndexDefinition indexDefinition = result.getDefinition();
assertTrue(indexDefinition instanceof OPropertyMapIndexDefinition);
assertEquals(indexDefinition.getFields().get(0), "fLinkMap");
assertEquals(indexDefinition.getTypes()[0], OType.LINK);
assertEquals(((OPropertyMapIndexDefinition) indexDefinition).getIndexBy(), OPropertyMapIndexDefinition.INDEX_BY.VALUE);
}
use of com.orientechnologies.orient.core.index.OIndexDefinition in project orientdb by orientechnologies.
the class ClassIndexTest method testCreateCompositeLinkSetIndex.
@Test(dependsOnMethods = "testGetIndexes")
public void testCreateCompositeLinkSetIndex() {
final OIndex result = oClass.createIndex("ClassIndexTestCompositeLinkSet", OClass.INDEX_TYPE.UNIQUE.toString(), null, new ODocument().fields("ignoreNullValues", true), new String[] { "fTwelve", "fLinkSet" });
assertEquals(result.getName(), "ClassIndexTestCompositeLinkSet");
assertEquals(oClass.getClassIndex("ClassIndexTestCompositeLinkSet").getName(), result.getName());
assertEquals(database.getMetadata().getIndexManager().getClassIndex("ClassIndexTestClass", "ClassIndexTestCompositeLinkSet").getName(), result.getName());
final OIndexDefinition indexDefinition = result.getDefinition();
assertTrue(indexDefinition instanceof OCompositeIndexDefinition);
assertEquals(indexDefinition.getFields().toArray(), new String[] { "fTwelve", "fLinkSet" });
assertEquals(indexDefinition.getTypes(), new OType[] { OType.INTEGER, OType.LINK });
assertEquals(indexDefinition.getParamCount(), 2);
}
use of com.orientechnologies.orient.core.index.OIndexDefinition in project orientdb by orientechnologies.
the class ClassIndexTest method testCreateOnePropertyLinkedMapIndex.
@Test
public void testCreateOnePropertyLinkedMapIndex() {
final OIndex result = oClass.createIndex("ClassIndexTestPropertyLinkedMap", OClass.INDEX_TYPE.UNIQUE.toString(), null, new ODocument().fields("ignoreNullValues", true), new String[] { "fLinkMap" });
assertEquals(result.getName(), "ClassIndexTestPropertyLinkedMap");
assertEquals(oClass.getClassIndex("ClassIndexTestPropertyLinkedMap").getName(), result.getName());
assertEquals(database.getMetadata().getIndexManager().getClassIndex("ClassIndexTestClass", "ClassIndexTestPropertyLinkedMap").getName(), result.getName());
final OIndexDefinition indexDefinition = result.getDefinition();
assertTrue(indexDefinition instanceof OPropertyMapIndexDefinition);
assertEquals(indexDefinition.getFields().get(0), "fLinkMap");
assertEquals(indexDefinition.getTypes()[0], OType.STRING);
assertEquals(((OPropertyMapIndexDefinition) indexDefinition).getIndexBy(), OPropertyMapIndexDefinition.INDEX_BY.KEY);
}
use of com.orientechnologies.orient.core.index.OIndexDefinition in project orientdb by orientechnologies.
the class ClassIndexTest method testCreateCompositeEmbeddedMapByKeyIndex.
@Test
public void testCreateCompositeEmbeddedMapByKeyIndex() {
final OIndex result = oClass.createIndex("ClassIndexTestCompositeEmbeddedMapByKey", OClass.INDEX_TYPE.UNIQUE.toString(), null, new ODocument().fields("ignoreNullValues", true), new String[] { "fEight", "fEmbeddedMap" });
assertEquals(result.getName(), "ClassIndexTestCompositeEmbeddedMapByKey");
assertEquals(oClass.getClassIndex("ClassIndexTestCompositeEmbeddedMapByKey").getName(), result.getName());
assertEquals(database.getMetadata().getIndexManager().getClassIndex("ClassIndexTestClass", "ClassIndexTestCompositeEmbeddedMapByKey").getName(), result.getName());
final OIndexDefinition indexDefinition = result.getDefinition();
assertTrue(indexDefinition instanceof OCompositeIndexDefinition);
assertEquals(indexDefinition.getFields().toArray(), new String[] { "fEight", "fEmbeddedMap" });
assertEquals(indexDefinition.getTypes(), new OType[] { OType.INTEGER, OType.STRING });
assertEquals(indexDefinition.getParamCount(), 2);
}
use of com.orientechnologies.orient.core.index.OIndexDefinition in project orientdb by orientechnologies.
the class ClassIndexTest method testCreateCompositeRidBagIndex.
public void testCreateCompositeRidBagIndex() {
final OIndex result = oClass.createIndex("ClassIndexTestCompositeRidBag", OClass.INDEX_TYPE.UNIQUE.toString(), null, new ODocument().fields("ignoreNullValues", true), new String[] { "fFourteen", "fRidBag" });
assertEquals(result.getName(), "ClassIndexTestCompositeRidBag");
assertEquals(oClass.getClassIndex("ClassIndexTestCompositeRidBag").getName(), result.getName());
assertEquals(database.getMetadata().getIndexManager().getClassIndex("ClassIndexTestClass", "ClassIndexTestCompositeRidBag").getName(), result.getName());
final OIndexDefinition indexDefinition = result.getDefinition();
assertTrue(indexDefinition instanceof OCompositeIndexDefinition);
assertEquals(indexDefinition.getFields().toArray(), new String[] { "fFourteen", "fRidBag" });
assertEquals(indexDefinition.getTypes(), new OType[] { OType.INTEGER, OType.LINK });
assertEquals(indexDefinition.getParamCount(), 2);
}
Aggregations