use of com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx in project orientdb by orientechnologies.
the class OEmbeddedRidBagBasicTest method embeddedRidBagSerializationTest.
@Test
public void embeddedRidBagSerializationTest() {
ODatabaseDocument db = new ODatabaseDocumentTx("memory:" + OEmbeddedRidBag.class.getSimpleName());
db.create();
try {
OEmbeddedRidBag bag = new OEmbeddedRidBag();
bag.add(new ORecordId(3, 1000));
bag.convertLinks2Records();
bag.convertRecords2Links();
byte[] bytes = new byte[1024];
UUID id = UUID.randomUUID();
bag.serialize(bytes, 0, id);
OEmbeddedRidBag bag1 = new OEmbeddedRidBag();
bag1.deserialize(bytes, 0);
assertEquals(bag.size(), 1);
assertEquals(null, bag1.iterator().next());
} finally {
db.drop();
}
}
use of com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx in project orientdb by orientechnologies.
the class OSchedulerTest method eventLifecycle.
@Test
public void eventLifecycle() throws Exception {
final ODatabaseDocumentTx db = initDatabase();
try {
createLogEvent(db);
Thread.sleep(2000);
db.getMetadata().getScheduler().removeEvent("test");
db.getMetadata().getScheduler().removeEvent("test");
Thread.sleep(3000);
db.getMetadata().getScheduler().removeEvent("test");
Long count = getLogCounter(db);
Assert.assertTrue(count >= 1 && count <= 3);
} finally {
db.drop();
}
}
use of com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx in project orientdb by orientechnologies.
the class OSchedulerTest method scheduleSQLFunction.
@Test
public void scheduleSQLFunction() throws Exception {
final ODatabaseDocumentTx db = initDatabase();
try {
createLogEvent(db);
Thread.sleep(5000);
Long count = getLogCounter(db);
Assert.assertTrue(count >= 4 && count <= 5);
} finally {
db.drop();
}
}
use of com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx in project orientdb by orientechnologies.
the class OSchedulerTest method scheduleWithDbClosed.
@Test
public void scheduleWithDbClosed() throws Exception {
ODatabaseDocumentTx db = initDatabase();
createLogEvent(db);
db.close();
Thread.sleep(5000);
db = openDatabase();
Long count = getLogCounter(db);
Assert.assertTrue(count >= 4);
openDatabase().drop();
}
use of com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx in project orientdb by orientechnologies.
the class OSchedulerTest method initDatabase.
private ODatabaseDocumentTx initDatabase() {
final ODatabaseDocumentTx db = new ODatabaseDocumentTx("memory:scheduler");
db.create();
return db;
}
Aggregations