Search in sources :

Example 86 with OProperty

use of com.orientechnologies.orient.core.metadata.schema.OProperty in project orientdb by orientechnologies.

the class LocalCreateDocumentMultiThreadIndexedSpeedTest method init.

@Override
public void init() {
    database = new ODatabaseDocumentTx(System.getProperty("url"));
    database.setProperty("minPool", 2);
    database.setProperty("maxPool", 3);
    if (database.getURL().startsWith("remote:"))
        database.open("admin", "admin");
    else {
        if (database.exists())
            database.drop();
        database.create();
    }
    // database.countClusterElements("Account");
    foundObjects = 0;
    synchronized (LocalCreateDocumentMultiThreadIndexedSpeedTest.class) {
        // database.command(new OCommandSQL("truncate class account")).execute();
        OClass c = database.getMetadata().getSchema().getClass("Account");
        if (c == null)
            c = database.getMetadata().getSchema().createClass("Account");
        OProperty p = database.getMetadata().getSchema().getClass("Account").getProperty("id");
        if (p == null)
            p = database.getMetadata().getSchema().getClass("Account").createProperty("id", OType.INTEGER);
        if (!p.isIndexed())
            p.createIndex(OClass.INDEX_TYPE.NOTUNIQUE);
    }
    System.out.println("\nTotal objects in Animal cluster before the test: " + foundObjects);
}
Also used : OProperty(com.orientechnologies.orient.core.metadata.schema.OProperty) OClass(com.orientechnologies.orient.core.metadata.schema.OClass) ODatabaseDocumentTx(com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)

Example 87 with OProperty

use of com.orientechnologies.orient.core.metadata.schema.OProperty in project orientdb by orientechnologies.

the class CRUDObjectInheritanceTestSchemaFull method checkProperty.

protected void checkProperty(OClass iClass, String iPropertyName, OType iType, OType iLinkedType) {
    OProperty prop = iClass.getProperty(iPropertyName);
    Assert.assertNotNull(prop);
    Assert.assertEquals(prop.getType(), iType);
    Assert.assertEquals(prop.getLinkedType(), iLinkedType);
}
Also used : OProperty(com.orientechnologies.orient.core.metadata.schema.OProperty)

Aggregations

OProperty (com.orientechnologies.orient.core.metadata.schema.OProperty)87 OClass (com.orientechnologies.orient.core.metadata.schema.OClass)69 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)32 Test (org.testng.annotations.Test)30 ODatabaseDocumentTx (com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)25 OSchema (com.orientechnologies.orient.core.metadata.schema.OSchema)23 OType (com.orientechnologies.orient.core.metadata.schema.OType)14 OSQLSynchQuery (com.orientechnologies.orient.core.sql.query.OSQLSynchQuery)11 OIdentifiable (com.orientechnologies.orient.core.db.record.OIdentifiable)9 OIndex (com.orientechnologies.orient.core.index.OIndex)7 ODatabaseObject (com.orientechnologies.orient.core.db.object.ODatabaseObject)6 OCommandSQL (com.orientechnologies.orient.core.sql.OCommandSQL)6 Map (java.util.Map)6 Set (java.util.Set)6 OIndexDefinition (com.orientechnologies.orient.core.index.OIndexDefinition)5 Collection (java.util.Collection)5 ODatabaseDocument (com.orientechnologies.orient.core.db.document.ODatabaseDocument)4 Field (java.lang.reflect.Field)4 Test (org.junit.Test)4 OException (com.orientechnologies.common.exception.OException)3