use of com.orientechnologies.orient.core.index.OIndexDefinition in project wicket-orientdb by OrienteerBAP.
the class OIndexModel method handleObject.
@Override
protected void handleObject(OIndex<?> object) {
indexName = object.getName();
OIndexDefinition indexDefinition = object.getDefinition();
if (indexDefinition != null) {
String className = indexDefinition.getClassName();
if (className != null)
classModel = new OClassModel(className);
}
}
use of com.orientechnologies.orient.core.index.OIndexDefinition in project orientdb by orientechnologies.
the class OChainedIndexProxyFindBestIndexTest method mockUniqueCompositeHashIndexWithNullSupport.
private OIndexUnique mockUniqueCompositeHashIndexWithNullSupport() {
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());
when(uniqueIndex.getMetadata()).thenReturn(new ODocument().field("ignoreNullValues", false));
return uniqueIndex;
}
use of com.orientechnologies.orient.core.index.OIndexDefinition in project orientdb by orientechnologies.
the class OChainedIndexProxyFindBestIndexTest method mockUniqueIndex.
private OIndexUnique mockUniqueIndex() {
final OIndexUnique uniqueIndex = mock(OIndexUnique.class);
when(uniqueIndex.getInternal()).thenReturn(uniqueIndex);
final OIndexDefinition definition = mock(OIndexDefinition.class);
when(definition.getParamCount()).thenReturn(1);
when(uniqueIndex.getDefinition()).thenReturn(definition);
when(uniqueIndex.getType()).thenReturn(OClass.INDEX_TYPE.UNIQUE.toString());
return uniqueIndex;
}
use of com.orientechnologies.orient.core.index.OIndexDefinition in project orientdb by orientechnologies.
the class SQLIndexWithoutSchemaTest method testCreateIndex.
@Test
public void testCreateIndex() {
database.command(new OCommandSQL("CREATE INDEX indexWithoutSchema ON " + TEST_CLASS + " (prop2) NOTUNIQUE INTEGER")).execute();
database.getMetadata().getIndexManager().reload();
final OIndex<?> index = database.getMetadata().getSchema().getClass(TEST_CLASS).getClassIndex("indexWithoutSchema");
Assert.assertNotNull(index);
Assert.assertEquals(index.getType(), OClass.INDEX_TYPE.NOTUNIQUE.name());
final OIndexDefinition definition = index.getDefinition();
Assert.assertEquals(definition.getFields().size(), 1);
Assert.assertEquals(definition.getFields().get(0).toLowerCase(Locale.ENGLISH), "prop2");
Assert.assertEquals(definition.getTypes()[0], OType.INTEGER);
}
use of com.orientechnologies.orient.core.index.OIndexDefinition in project orientdb by orientechnologies.
the class SQLIndexWithoutSchemaTest method testCreateCompositeIndex.
@Test
public void testCreateCompositeIndex() {
database.command(new OCommandSQL("CREATE INDEX compositeIndexWithoutSchema ON " + TEST_CLASS + " (cp2, cp3) NOTUNIQUE INTEGER, INTEGER METADATA { ignoreNullValues: true }")).execute();
database.getMetadata().getIndexManager().reload();
final OIndex<?> index = database.getMetadata().getSchema().getClass(TEST_CLASS).getClassIndex("compositeIndexWithoutSchema");
Assert.assertNotNull(index);
Assert.assertEquals(index.getType(), OClass.INDEX_TYPE.NOTUNIQUE.name());
final OIndexDefinition definition = index.getDefinition();
Assert.assertEquals(definition.getFields().size(), 2);
Assert.assertEquals(definition.getFields().get(0).toLowerCase(Locale.ENGLISH), "cp2");
Assert.assertEquals(definition.getFields().get(1).toLowerCase(Locale.ENGLISH), "cp3");
Assert.assertEquals(definition.getTypes()[0], OType.INTEGER);
Assert.assertEquals(definition.getTypes()[1], OType.INTEGER);
}
Aggregations