use of org.neo4j.kernel.EmbeddedGraphDatabase in project graphdb by neo4j-attic.
the class TestCacheTypes method testDefaultCache.
@Test
public void testDefaultCache() {
GraphDatabaseService db = newDb(null);
assertEquals(CacheType.soft, ((EmbeddedGraphDatabase) db).getConfig().getGraphDbModule().getNodeManager().getCacheType());
db.shutdown();
}
use of org.neo4j.kernel.EmbeddedGraphDatabase in project graphdb by neo4j-attic.
the class TestShortString method getSizeOfStringStore.
private long getSizeOfStringStore() {
db.shutdown();
long size = new File(PATH, "neostore.propertystore.db.strings").length();
db = new EmbeddedGraphDatabase(PATH);
return size;
}
use of org.neo4j.kernel.EmbeddedGraphDatabase in project graphdb by neo4j-attic.
the class TestNeo4jCacheAndPersistence method testTxCacheLoadIsolation.
@Test
public void testTxCacheLoadIsolation() throws Exception {
Node node = getGraphDb().createNode();
node.setProperty("someproptest", "testing");
Node node1 = getGraphDb().createNode();
node1.setProperty("someotherproptest", 2);
commit();
EmbeddedGraphDatabase graphDb = (EmbeddedGraphDatabase) getGraphDb();
TransactionManager txManager = graphDb.getConfig().getTxModule().getTxManager();
NodeManager nodeManager = graphDb.getConfig().getGraphDbModule().getNodeManager();
txManager.begin();
node.setProperty("someotherproptest", "testing2");
Relationship rel = node.createRelationshipTo(node1, MyRelTypes.TEST);
javax.transaction.Transaction txA = txManager.suspend();
txManager.begin();
assertEquals("testing", node.getProperty("someproptest"));
assertTrue(!node.hasProperty("someotherproptest"));
assertTrue(!node.hasRelationship());
nodeManager.clearCache();
assertEquals("testing", node.getProperty("someproptest"));
assertTrue(!node.hasProperty("someotherproptest"));
javax.transaction.Transaction txB = txManager.suspend();
txManager.resume(txA);
assertEquals("testing", node.getProperty("someproptest"));
assertTrue(node.hasProperty("someotherproptest"));
assertTrue(node.hasRelationship());
nodeManager.clearCache();
assertEquals("testing", node.getProperty("someproptest"));
assertTrue(node.hasProperty("someotherproptest"));
assertTrue(node.hasRelationship());
txManager.suspend();
txManager.resume(txB);
assertEquals("testing", node.getProperty("someproptest"));
assertTrue(!node.hasProperty("someotherproptest"));
assertTrue(!node.hasRelationship());
txManager.rollback();
txManager.resume(txA);
node.delete();
node1.delete();
rel.delete();
txManager.commit();
newTransaction();
}
use of org.neo4j.kernel.EmbeddedGraphDatabase in project graphdb by neo4j-attic.
the class TestOsSpecificLocks method testDatabaseLocking.
@Test
public void testDatabaseLocking() {
assumeTrue(Config.osIsWindows());
EmbeddedGraphDatabase db = new EmbeddedGraphDatabase(path);
Transaction tx = db.beginTx();
db.createNode();
tx.success();
tx.finish();
assertTrue(new File(path + "\\lock").exists());
try {
new EmbeddedGraphDatabase(path);
fail("Should not be able to start up another db in the same dir");
} catch (Exception e) {
// Good
}
db.shutdown();
}
use of org.neo4j.kernel.EmbeddedGraphDatabase in project graphdb by neo4j-attic.
the class TestUpgradeStore method makeSureLogsAreMovedWhenUpgrading.
@Test
public void makeSureLogsAreMovedWhenUpgrading() throws Exception {
// Generate some logical logs
String path = path(10);
for (int i = 0; i < 3; i++) {
new EmbeddedGraphDatabase(path, stringMap(KEEP_LOGICAL_LOGS, "true")).shutdown();
}
setOlderNeoStoreVersion(path);
new EmbeddedGraphDatabase(path, stringMap(ALLOW_STORE_UPGRADE, "true")).shutdown();
File oldLogDir = new File(path, "1.2-logs");
assertTrue(oldLogDir.exists());
assertTrue(new File(oldLogDir, "nioneo_logical.log.v0").exists());
assertTrue(new File(oldLogDir, "nioneo_logical.log.v1").exists());
assertTrue(new File(oldLogDir, "nioneo_logical.log.v2").exists());
assertFalse(new File(path, "nioneo_logical.log.v0").exists());
assertFalse(new File(path, "nioneo_logical.log.v1").exists());
assertFalse(new File(path, "nioneo_logical.log.v2").exists());
}
Aggregations