Search in sources :

Example 71 with OIndex

use of com.orientechnologies.orient.core.index.OIndex in project orientdb by orientechnologies.

the class IndexManagerTest method testCreateSimpleKeyIndexTest.

@Test
public void testCreateSimpleKeyIndexTest() {
    final OIndexManagerProxy indexManager = database.getMetadata().getIndexManager();
    final OIndex result = indexManager.createIndex("simplekey", OClass.INDEX_TYPE.UNIQUE.toString(), new OSimpleKeyIndexDefinition(-1, OType.INTEGER), null, null, null);
    assertEquals(result.getName(), "simplekey");
    indexManager.reload();
    assertNull(database.getMetadata().getIndexManager().getClassIndex(CLASS_NAME, "simplekey"));
    assertEquals(database.getMetadata().getIndexManager().getIndex("simplekey").getName(), result.getName());
}
Also used : OIndex(com.orientechnologies.orient.core.index.OIndex) OSimpleKeyIndexDefinition(com.orientechnologies.orient.core.index.OSimpleKeyIndexDefinition) OIndexManagerProxy(com.orientechnologies.orient.core.index.OIndexManagerProxy) Test(org.testng.annotations.Test)

Example 72 with OIndex

use of com.orientechnologies.orient.core.index.OIndex in project orientdb by orientechnologies.

the class IndexManagerTest method testGetClassInvolvedIndexesNotInvolvedProperties.

@Test(dependsOnMethods = { "createCompositeIndexTestWithListener", "createCompositeIndexTestWithoutListener", "testCreateOnePropertyIndexTest" })
public void testGetClassInvolvedIndexesNotInvolvedProperties() {
    final OIndexManager indexManager = database.getMetadata().getIndexManager();
    final Set<OIndex<?>> result = indexManager.getClassInvolvedIndexes(CLASS_NAME, Arrays.asList("fTwo", "fFour"));
    assertEquals(result.size(), 0);
}
Also used : OIndexManager(com.orientechnologies.orient.core.index.OIndexManager) OIndex(com.orientechnologies.orient.core.index.OIndex) Test(org.testng.annotations.Test)

Example 73 with OIndex

use of com.orientechnologies.orient.core.index.OIndex in project orientdb by orientechnologies.

the class IndexManagerTest method testGetClassInvolvedIndexesThreePropertiesBrokenFiledNameTest.

@Test(dependsOnMethods = { "createCompositeIndexTestWithListener", "createCompositeIndexTestWithoutListener", "testCreateOnePropertyIndexTest" })
public void testGetClassInvolvedIndexesThreePropertiesBrokenFiledNameTest() {
    final OIndexManager indexManager = database.getMetadata().getIndexManager();
    final Set<OIndex<?>> result = indexManager.getClassInvolvedIndexes(CLASS_NAME, Arrays.asList("ftwO", "foNe", "fThrEE"));
    assertEquals(result.size(), 1);
    assertEquals(result.iterator().next().getName(), "compositetwo");
}
Also used : OIndexManager(com.orientechnologies.orient.core.index.OIndexManager) OIndex(com.orientechnologies.orient.core.index.OIndex) Test(org.testng.annotations.Test)

Example 74 with OIndex

use of com.orientechnologies.orient.core.index.OIndex in project orientdb by orientechnologies.

the class IndexManagerTest method testGetClassInvolvedIndexesNotExistingClass.

@Test(dependsOnMethods = { "createCompositeIndexTestWithListener", "createCompositeIndexTestWithoutListener", "testCreateOnePropertyIndexTest" })
public void testGetClassInvolvedIndexesNotExistingClass() {
    final OIndexManager indexManager = database.getMetadata().getIndexManager();
    final Set<OIndex<?>> result = indexManager.getClassInvolvedIndexes("testlass", Arrays.asList("fOne"));
    assertTrue(result.isEmpty());
}
Also used : OIndexManager(com.orientechnologies.orient.core.index.OIndexManager) OIndex(com.orientechnologies.orient.core.index.OIndex) Test(org.testng.annotations.Test)

Example 75 with OIndex

use of com.orientechnologies.orient.core.index.OIndex in project orientdb by orientechnologies.

the class IndexManagerTest method testGetClassInvolvedIndexesPropertiesMorThanNeeded.

@Test(dependsOnMethods = { "createCompositeIndexTestWithListener", "createCompositeIndexTestWithoutListener", "testCreateOnePropertyIndexTest" })
public void testGetClassInvolvedIndexesPropertiesMorThanNeeded() {
    final OIndexManager indexManager = database.getMetadata().getIndexManager();
    final Set<OIndex<?>> result = indexManager.getClassInvolvedIndexes(CLASS_NAME, Arrays.asList("fTwo", "fOne", "fThee", "fFour"));
    assertEquals(result.size(), 0);
}
Also used : OIndexManager(com.orientechnologies.orient.core.index.OIndexManager) OIndex(com.orientechnologies.orient.core.index.OIndex) Test(org.testng.annotations.Test)

Aggregations

OIndex (com.orientechnologies.orient.core.index.OIndex)98 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)54 Test (org.testng.annotations.Test)50 OIndexDefinition (com.orientechnologies.orient.core.index.OIndexDefinition)26 OClass (com.orientechnologies.orient.core.metadata.schema.OClass)20 OIndexManager (com.orientechnologies.orient.core.index.OIndexManager)18 OCompositeIndexDefinition (com.orientechnologies.orient.core.index.OCompositeIndexDefinition)16 OSchema (com.orientechnologies.orient.core.metadata.schema.OSchema)16 Test (org.junit.Test)14 OIdentifiable (com.orientechnologies.orient.core.db.record.OIdentifiable)12 Collection (java.util.Collection)11 OPropertyIndexDefinition (com.orientechnologies.orient.core.index.OPropertyIndexDefinition)9 OPropertyMapIndexDefinition (com.orientechnologies.orient.core.index.OPropertyMapIndexDefinition)8 OProperty (com.orientechnologies.orient.core.metadata.schema.OProperty)8 HashSet (java.util.HashSet)6 OConfigurationException (com.orientechnologies.orient.core.exception.OConfigurationException)5 OIndexManagerProxy (com.orientechnologies.orient.core.index.OIndexManagerProxy)5 OIndexUnique (com.orientechnologies.orient.core.index.OIndexUnique)5 Map (java.util.Map)4 AtomicLong (java.util.concurrent.atomic.AtomicLong)4