use of com.orientechnologies.orient.core.index.OIndexUnique in project orientdb by orientechnologies.
the class OChainedIndexProxyFindBestIndexTest method testDoNotUseIndexesWithNoNullValueSupport.
@Test
public void testDoNotUseIndexesWithNoNullValueSupport() throws Exception {
final OIndexUnique expectedResult = mockUniqueIndex();
final List<OIndex<?>> indexes = Arrays.<OIndex<?>>asList(mockUniqueCompositeHashIndex(), mockUniqueCompositeIndex(), expectedResult);
final OIndex<?> result = OChainedIndexProxy.findBestIndex(indexes);
Assert.assertSame(result, expectedResult);
}
use of com.orientechnologies.orient.core.index.OIndexUnique in project orientdb by orientechnologies.
the class OChainedIndexProxyFindBestIndexTest method mockUniqueCompositeIndex.
private OIndexUnique mockUniqueCompositeIndex() {
final OIndexUnique uniqueIndex = mock(OIndexUnique.class);
when(uniqueIndex.getInternal()).thenReturn(uniqueIndex);
final OIndexDefinition definition = mock(OIndexDefinition.class);
when(definition.getParamCount()).thenReturn(2);
when(uniqueIndex.getDefinition()).thenReturn(definition);
when(uniqueIndex.getType()).thenReturn(OClass.INDEX_TYPE.UNIQUE.toString());
return uniqueIndex;
}
use of com.orientechnologies.orient.core.index.OIndexUnique in project orientdb by orientechnologies.
the class OChainedIndexProxyFindBestIndexTest method mockUniqueCompositeIndexWithNullSupport.
private OIndexUnique mockUniqueCompositeIndexWithNullSupport() {
final OIndexUnique uniqueIndex = mock(OIndexUnique.class);
when(uniqueIndex.getInternal()).thenReturn(uniqueIndex);
final OIndexDefinition definition = mock(OIndexDefinition.class);
when(definition.getParamCount()).thenReturn(2);
when(uniqueIndex.getDefinition()).thenReturn(definition);
when(uniqueIndex.getType()).thenReturn(OClass.INDEX_TYPE.UNIQUE.toString());
when(uniqueIndex.getMetadata()).thenReturn(new ODocument().field("ignoreNullValues", false));
return uniqueIndex;
}
use of com.orientechnologies.orient.core.index.OIndexUnique in project orientdb by orientechnologies.
the class OChainedIndexProxyFindBestIndexTest method testTheOnlyChoice.
@Test
public void testTheOnlyChoice() throws Exception {
final OIndexUnique expectedResult = mockUniqueIndex();
final List<OIndex<?>> indexes = Arrays.<OIndex<?>>asList(expectedResult);
final OIndex<?> result = OChainedIndexProxy.findBestIndex(indexes);
Assert.assertSame(result, expectedResult);
}
use of com.orientechnologies.orient.core.index.OIndexUnique in project orientdb by orientechnologies.
the class OChainedIndexProxyFindBestIndexTest method mockUniqueCompositeHashIndex.
private OIndexUnique mockUniqueCompositeHashIndex() {
final OIndexUnique uniqueIndex = mock(OIndexUnique.class);
when(uniqueIndex.getInternal()).thenReturn(uniqueIndex);
final OIndexDefinition definition = mock(OIndexDefinition.class);
when(definition.getParamCount()).thenReturn(2);
when(uniqueIndex.getDefinition()).thenReturn(definition);
when(uniqueIndex.getType()).thenReturn(OClass.INDEX_TYPE.UNIQUE_HASH_INDEX.toString());
return uniqueIndex;
}
Aggregations