Search in sources :

Example 16 with OPartitionedDatabasePool

use of com.orientechnologies.orient.core.db.OPartitionedDatabasePool in project orientdb by orientechnologies.

the class LuceneDropTest method testDeleteLuceneIndex.

@Test
public void testDeleteLuceneIndex() {
    OPartitionedDatabasePool dbPool = new OPartitionedDatabasePool(dbName, "admin", "admin");
    ODatabaseDocumentTx db = dbPool.acquire();
    fillDb(db, insertcount);
    db.close();
    db = dbPool.acquire();
    // @maggiolo00 Remove the next three lines and the test will not fail anymore
    OSQLSynchQuery<ODocument> query = new OSQLSynchQuery<ODocument>("select from test ");
    List<ODocument> result = db.command(query).execute();
    Assert.assertEquals(insertcount, result.size());
    db.close();
    dbPool.close();
    //reopen to drop
    db = new ODatabaseDocumentTx(dbName).open("admin", "admin");
    db.drop();
    File dbFolder = new File("./target/databases/" + this.getClass().getSimpleName());
    Assert.assertEquals(false, dbFolder.exists());
}
Also used : OPartitionedDatabasePool(com.orientechnologies.orient.core.db.OPartitionedDatabasePool) OSQLSynchQuery(com.orientechnologies.orient.core.sql.query.OSQLSynchQuery) ODatabaseDocumentTx(com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx) File(java.io.File) ODocument(com.orientechnologies.orient.core.record.impl.ODocument) Test(org.junit.Test)

Example 17 with OPartitionedDatabasePool

use of com.orientechnologies.orient.core.db.OPartitionedDatabasePool in project orientdb by orientechnologies.

the class OPersistentEmbeddedMapTest method setup.

@BeforeMethod
public void setup() {
    final String url = "memory:tmpdb";
    new OObjectDatabaseTx(url).create().close();
    pool = new OPartitionedDatabasePool(url, "admin", "admin");
    OObjectDatabaseTx db = new OObjectDatabaseTx(pool.acquire());
    try {
        db.setAutomaticSchemaGeneration(true);
        OEntityManager entityManager = db.getEntityManager();
        entityManager.registerEntityClass(Car.class);
        entityManager.registerEntityClass(Person.class);
        db.getMetadata().getSchema().synchronizeSchema();
    } finally {
        db.close();
    }
}
Also used : OEntityManager(com.orientechnologies.orient.core.entity.OEntityManager) OPartitionedDatabasePool(com.orientechnologies.orient.core.db.OPartitionedDatabasePool) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

OPartitionedDatabasePool (com.orientechnologies.orient.core.db.OPartitionedDatabasePool)17 ODatabaseDocumentTx (com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)11 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)5 Test (org.testng.annotations.Test)5 ORecord (com.orientechnologies.orient.core.record.ORecord)3 ODatabaseDocument (com.orientechnologies.orient.core.db.document.ODatabaseDocument)2 OClass (com.orientechnologies.orient.core.metadata.schema.OClass)2 OSchema (com.orientechnologies.orient.core.metadata.schema.OSchema)2 ByteIterator (com.yahoo.ycsb.ByteIterator)2 StringByteIterator (com.yahoo.ycsb.StringByteIterator)2 File (java.io.File)2 Test (org.junit.Test)2 OServerAdmin (com.orientechnologies.orient.client.remote.OServerAdmin)1 OCommandOutputListener (com.orientechnologies.orient.core.command.OCommandOutputListener)1 ODatabaseCompare (com.orientechnologies.orient.core.db.tool.ODatabaseCompare)1 OEntityManager (com.orientechnologies.orient.core.entity.OEntityManager)1 OConcurrentModificationException (com.orientechnologies.orient.core.exception.OConcurrentModificationException)1 ODatabaseException (com.orientechnologies.orient.core.exception.ODatabaseException)1 OCommandSQL (com.orientechnologies.orient.core.sql.OCommandSQL)1 OSQLSynchQuery (com.orientechnologies.orient.core.sql.query.OSQLSynchQuery)1