use of com.orientechnologies.orient.core.index.OIndexManager in project orientdb by orientechnologies.
the class IndexManagerTest method testAreIndexedPropertiesMoreThanNeeded.
@Test(dependsOnMethods = { "createCompositeIndexTestWithListener", "createCompositeIndexTestWithoutListener", "testCreateOnePropertyIndexTest" })
public void testAreIndexedPropertiesMoreThanNeeded() {
final OIndexManager indexManager = database.getMetadata().getIndexManager();
final boolean result = indexManager.areIndexed(CLASS_NAME, Arrays.asList("fTwo", "fOne", "fThee", "fFour"));
assertFalse(result);
}
use of com.orientechnologies.orient.core.index.OIndexManager in project orientdb by orientechnologies.
the class IndexManagerTest method testAreIndexedPropertiesNotFirstArrayParams.
@Test(dependsOnMethods = { "createCompositeIndexTestWithListener", "createCompositeIndexTestWithoutListener", "testCreateOnePropertyIndexTest" })
public void testAreIndexedPropertiesNotFirstArrayParams() {
final OIndexManager indexManager = database.getMetadata().getIndexManager();
final boolean result = indexManager.areIndexed(CLASS_NAME, "fTwo", "fTree");
assertFalse(result);
}
use of com.orientechnologies.orient.core.index.OIndexManager in project orientdb by orientechnologies.
the class IndexManagerTest method testGetClassInvolvedIndexesNotInvolvedPropertiesArrayParams.
@Test(dependsOnMethods = { "createCompositeIndexTestWithListener", "createCompositeIndexTestWithoutListener", "testCreateOnePropertyIndexTest" })
public void testGetClassInvolvedIndexesNotInvolvedPropertiesArrayParams() {
final OIndexManager indexManager = database.getMetadata().getIndexManager();
final Set<OIndex<?>> result = indexManager.getClassInvolvedIndexes(CLASS_NAME, "fTwo", "fFour");
assertEquals(result.size(), 0);
}
use of com.orientechnologies.orient.core.index.OIndexManager in project orientdb by orientechnologies.
the class IndexManagerTest method testGetClassIndexes.
@Test(dependsOnMethods = { "createCompositeIndexTestWithListener", "createCompositeIndexTestWithoutListener", "testCreateOnePropertyIndexTest" })
public void testGetClassIndexes() {
final OIndexManager indexManager = database.getMetadata().getIndexManager();
final Set<OIndex<?>> indexes = indexManager.getClassIndexes(CLASS_NAME);
final Set<OIndexDefinition> expectedIndexDefinitions = new HashSet<OIndexDefinition>();
final OCompositeIndexDefinition compositeIndexOne = new OCompositeIndexDefinition(CLASS_NAME);
compositeIndexOne.addIndex(new OPropertyIndexDefinition(CLASS_NAME, "fOne", OType.INTEGER));
compositeIndexOne.addIndex(new OPropertyIndexDefinition(CLASS_NAME, "fTwo", OType.STRING));
compositeIndexOne.setNullValuesIgnored(false);
expectedIndexDefinitions.add(compositeIndexOne);
final OCompositeIndexDefinition compositeIndexTwo = new OCompositeIndexDefinition(CLASS_NAME);
compositeIndexTwo.addIndex(new OPropertyIndexDefinition(CLASS_NAME, "fOne", OType.INTEGER));
compositeIndexTwo.addIndex(new OPropertyIndexDefinition(CLASS_NAME, "fTwo", OType.STRING));
compositeIndexTwo.addIndex(new OPropertyIndexDefinition(CLASS_NAME, "fThree", OType.BOOLEAN));
compositeIndexTwo.setNullValuesIgnored(false);
expectedIndexDefinitions.add(compositeIndexTwo);
final OPropertyIndexDefinition propertyIndex = new OPropertyIndexDefinition(CLASS_NAME, "fOne", OType.INTEGER);
propertyIndex.setNullValuesIgnored(false);
expectedIndexDefinitions.add(propertyIndex);
assertEquals(indexes.size(), 3);
for (final OIndex index : indexes) {
assertTrue(expectedIndexDefinitions.contains(index.getDefinition()));
}
}
use of com.orientechnologies.orient.core.index.OIndexManager in project orientdb by orientechnologies.
the class IndexManagerTest method testGetClassIndexesBrokenClassNameCase.
@Test(dependsOnMethods = { "createCompositeIndexTestWithListener", "createCompositeIndexTestWithoutListener", "testCreateOnePropertyIndexTest" })
public void testGetClassIndexesBrokenClassNameCase() {
final OIndexManager indexManager = database.getMetadata().getIndexManager();
final Set<OIndex<?>> indexes = indexManager.getClassIndexes("ClassforindeXMaNAgerTeST");
final Set<OIndexDefinition> expectedIndexDefinitions = new HashSet<OIndexDefinition>();
final OCompositeIndexDefinition compositeIndexOne = new OCompositeIndexDefinition(CLASS_NAME);
compositeIndexOne.addIndex(new OPropertyIndexDefinition(CLASS_NAME, "fOne", OType.INTEGER));
compositeIndexOne.addIndex(new OPropertyIndexDefinition(CLASS_NAME, "fTwo", OType.STRING));
compositeIndexOne.setNullValuesIgnored(false);
expectedIndexDefinitions.add(compositeIndexOne);
final OCompositeIndexDefinition compositeIndexTwo = new OCompositeIndexDefinition(CLASS_NAME);
compositeIndexTwo.addIndex(new OPropertyIndexDefinition(CLASS_NAME, "fOne", OType.INTEGER));
compositeIndexTwo.addIndex(new OPropertyIndexDefinition(CLASS_NAME, "fTwo", OType.STRING));
compositeIndexTwo.addIndex(new OPropertyIndexDefinition(CLASS_NAME, "fThree", OType.BOOLEAN));
compositeIndexTwo.setNullValuesIgnored(false);
expectedIndexDefinitions.add(compositeIndexTwo);
final OPropertyIndexDefinition propertyIndex = new OPropertyIndexDefinition(CLASS_NAME, "fOne", OType.INTEGER);
propertyIndex.setNullValuesIgnored(false);
expectedIndexDefinitions.add(propertyIndex);
assertEquals(indexes.size(), 3);
for (final OIndex index : indexes) {
assertTrue(expectedIndexDefinitions.contains(index.getDefinition()));
}
}
Aggregations