use of com.orientechnologies.orient.core.index.OIndex in project orientdb by orientechnologies.
the class OChainedIndexProxyFindBestIndexTest method testPriorityHashOverNonHash.
@Test
public void testPriorityHashOverNonHash() throws Exception {
final OIndexUnique expectedResult = mockUniqueHashIndex();
final List<OIndex<?>> indexes = Arrays.<OIndex<?>>asList(mockUniqueIndex(), mockUniqueCompositeIndex(), expectedResult, mockUniqueIndex(), mockUniqueCompositeIndex());
final OIndex<?> result = OChainedIndexProxy.findBestIndex(indexes);
Assert.assertSame(result, expectedResult);
}
use of com.orientechnologies.orient.core.index.OIndex in project orientdb by orientechnologies.
the class OChainedIndexProxyFindBestIndexTest method testDoNotUseCompositeHashIndex.
@Test
public void testDoNotUseCompositeHashIndex() throws Exception {
final OIndexUnique expectedResult = mockUniqueIndex();
final List<OIndex<?>> indexes = Arrays.<OIndex<?>>asList(mockUniqueCompositeHashIndexWithNullSupport(), expectedResult, mockUniqueCompositeHashIndexWithNullSupport());
final OIndex<?> result = OChainedIndexProxy.findBestIndex(indexes);
Assert.assertSame(result, expectedResult);
}
use of com.orientechnologies.orient.core.index.OIndex in project orientdb by orientechnologies.
the class OChainedIndexProxyFindBestIndexTest method testPriorityNonCompositeOverComposite.
@Test
public void testPriorityNonCompositeOverComposite() throws Exception {
final OIndexUnique expectedResult = mockUniqueIndex();
final List<OIndex<?>> indexes = Arrays.<OIndex<?>>asList(mockUniqueCompositeIndexWithNullSupport(), mockUniqueCompositeHashIndexWithNullSupport(), expectedResult, mockUniqueCompositeIndexWithNullSupport(), mockUniqueCompositeHashIndexWithNullSupport());
final OIndex<?> result = OChainedIndexProxy.findBestIndex(indexes);
Assert.assertSame(result, expectedResult);
}
use of com.orientechnologies.orient.core.index.OIndex in project orientdb by orientechnologies.
the class IndexCustomKeyTest method testTransactionalUsageWorks.
public void testTransactionalUsageWorks() {
database.begin(OTransaction.TXTYPE.OPTIMISTIC);
// OIndex<?> index = getManualIndex();
ComparableBinary key3 = new ComparableBinary(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 3 });
ODocument doc1 = new ODocument().field("k", "key3");
final OIndex index = getIndex();
index.put(key3, doc1);
ComparableBinary key4 = new ComparableBinary(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 4 });
ODocument doc2 = new ODocument().field("k", "key4");
index.put(key4, doc2);
database.commit();
Assert.assertEquals(index.get(key3), doc1);
Assert.assertEquals(index.get(key4), doc2);
}
use of com.orientechnologies.orient.core.index.OIndex in project orientdb by orientechnologies.
the class IndexManagerTest method testGetClassInvolvedIndexesThreePropertiesArrayParams.
@Test(dependsOnMethods = { "createCompositeIndexTestWithListener", "createCompositeIndexTestWithoutListener", "testCreateOnePropertyIndexTest" })
public void testGetClassInvolvedIndexesThreePropertiesArrayParams() {
final OIndexManager indexManager = database.getMetadata().getIndexManager();
final Set<OIndex<?>> result = indexManager.getClassInvolvedIndexes(CLASS_NAME, "fTwo", "fOne", "fThree");
assertEquals(result.size(), 1);
assertEquals(result.iterator().next().getName(), "compositetwo");
}
Aggregations