use of org.neo4j.kernel.EmbeddedGraphDatabase in project graphdb by neo4j-attic.
the class TestTxSuspendResume method testMultipleTxSameThread.
@Test
public void testMultipleTxSameThread() throws Exception {
String storePath = getStorePath("test-neo2");
deleteFileOrDirectory(storePath);
EmbeddedGraphDatabase neo2 = new EmbeddedGraphDatabase(storePath);
TransactionManager tm = neo2.getConfig().getTxModule().getTxManager();
tm.begin();
Node refNode = neo2.getReferenceNode();
Transaction tx1 = tm.suspend();
tm.begin();
refNode.setProperty("test2", "test");
Transaction tx2 = tm.suspend();
tm.resume(tx1);
CommitThread thread = new CommitThread(tm, tx2);
thread.start();
// would wait for ever since tx2 has write lock but now we have other
// thread thread that will commit tx2
refNode.removeProperty("test2");
assertTrue(thread.success());
tm.commit();
neo2.shutdown();
}
use of org.neo4j.kernel.EmbeddedGraphDatabase in project graphdb by neo4j-attic.
the class AbstractTestBase method beforeSuite.
@BeforeClass
public static final void beforeSuite() {
deleteFileOrDirectory(new File(TARGET_NEODB));
graphdb = new EmbeddedGraphDatabase(TARGET_NEODB);
}
use of org.neo4j.kernel.EmbeddedGraphDatabase in project graphdb by neo4j-attic.
the class TestUpgradeStore method makeSureStoreWithTooBigStringBlockSizeCannotBeUpgraded.
@Test
public void makeSureStoreWithTooBigStringBlockSizeCannotBeUpgraded() throws Exception {
String path = path(6);
new EmbeddedGraphDatabase(path).shutdown();
setBlockSize(new File(path, "neostore.propertystore.db.strings"), 0x10000, "StringPropertyStore v0.9.5");
assertCannotStart(path, "Shouldn't be able to upgrade with block size that big");
}
use of org.neo4j.kernel.EmbeddedGraphDatabase in project graphdb by neo4j-attic.
the class TestUpgradeStore method assertCannotStart.
private void assertCannotStart(String path, String failMessage) {
GraphDatabaseService db = null;
try {
db = new EmbeddedGraphDatabase(path);
fail(failMessage);
} catch (TransactionFailureException e) {
if (!(e.getCause() instanceof IllegalStoreVersionException)) {
throw e;
}
// Good
} finally {
if (db != null) {
db.shutdown();
}
}
}
use of org.neo4j.kernel.EmbeddedGraphDatabase in project graphdb by neo4j-attic.
the class TestUpgradeStore method makeSureStoreWithTooManyRelationshipTypesCannotBeUpgraded.
@Test
public void makeSureStoreWithTooManyRelationshipTypesCannotBeUpgraded() throws Exception {
String path = path(0);
new EmbeddedGraphDatabase(path).shutdown();
createManyRelationshipTypes(path, 0x10000);
assertCannotStart(path, "Shouldn't be able to upgrade with that many types set");
}
Aggregations