use of org.neo4j.kernel.EmbeddedGraphDatabase in project graphdb by neo4j-attic.
the class TestChangingOfLogFormat method inabilityToStartFromOldFormatFromNonCleanShutdown.
@Test
public void inabilityToStartFromOldFormatFromNonCleanShutdown() throws Exception {
String storeDir = "target/var/oldlog";
deleteFileOrDirectory(storeDir);
GraphDatabaseService db = new EmbeddedGraphDatabase(storeDir);
Transaction tx = db.beginTx();
db.createNode();
tx.success();
tx.finish();
Pair<Pair<File, File>, Pair<File, File>> copy = copyLogicalLog(storeDir);
decrementLogFormat(copy.other().other());
db.shutdown();
renameCopiedLogicalLog(storeDir);
try {
db = new EmbeddedGraphDatabase(storeDir);
fail("Shouldn't be able to do recovery (and upgrade log format version) on non-clean shutdown");
} catch (Exception e) {
// Good
e.printStackTrace();
}
}
use of org.neo4j.kernel.EmbeddedGraphDatabase in project graphdb by neo4j-attic.
the class TestExceptionTypeOnInvalidIds method createDatabase.
@BeforeClass
public static void createDatabase() {
String storeDir = "target/var/id_test";
AbstractNeo4jTestCase.deleteFileOrDirectory(new File(storeDir));
graphdb = new EmbeddedGraphDatabase(storeDir);
graphDbReadOnly = new EmbeddedReadOnlyGraphDatabase(storeDir);
}
use of org.neo4j.kernel.EmbeddedGraphDatabase in project graphdb by neo4j-attic.
the class TestReadOnlyNeo4j method createSomeData.
private DbRepresentation createSomeData() {
DynamicRelationshipType type = withName("KNOWS");
GraphDatabaseService db = new EmbeddedGraphDatabase(PATH);
Transaction tx = db.beginTx();
Node prevNode = db.getReferenceNode();
for (int i = 0; i < 100; i++) {
Node node = db.createNode();
Relationship rel = prevNode.createRelationshipTo(node, type);
node.setProperty("someKey" + i % 10, i % 15);
rel.setProperty("since", System.currentTimeMillis());
}
tx.success();
tx.finish();
DbRepresentation result = DbRepresentation.of(db);
db.shutdown();
return result;
}
use of org.neo4j.kernel.EmbeddedGraphDatabase in project graphdb by neo4j-attic.
the class TestShortString method doBefore.
@Before
public void doBefore() {
AbstractNeo4jTestCase.deleteFileOrDirectory(new File(PATH));
db = new EmbeddedGraphDatabase(PATH);
}
use of org.neo4j.kernel.EmbeddedGraphDatabase in project graphdb by neo4j-attic.
the class ManualTestPrepare method main.
public static void main(String[] args) throws Exception {
FileUtils.deleteDirectory(ManualTest1.PATH.getParentFile());
new EmbeddedGraphDatabase(ManualTest1.PATH.getAbsolutePath()).shutdown();
FileUtils.copyDirectory(ManualTest1.PATH, ManualTest2.PATH);
FileUtils.deleteDirectory(ManualZooKeepers.PATH);
}
Aggregations