use of org.neo4j.kernel.EmbeddedGraphDatabase in project neo4j-clean-remote-db-addon by jexp.
the class DeleteDatabaseTest method startServerWithACleanDb.
@BeforeClass
public static void startServerWithACleanDb() {
graphDatabase = new EmbeddedGraphDatabase("target/db1");
ServerConfigurator config = new ServerConfigurator(graphDatabase);
config.configuration().setProperty("org.neo4j.server.thirdparty.delete.key", "secret-key");
config.getThirdpartyJaxRsClasses().add(new ThirdPartyJaxRsPackage("org.neo4j.server.extension.test.delete", "/cleandb"));
WrappingNeoServerBootstrapper bootstrapper = new WrappingNeoServerBootstrapper(graphDatabase, config);
bootstrapper.start();
neoServer = bootstrapper.getServer();
}
use of org.neo4j.kernel.EmbeddedGraphDatabase in project graphdb by neo4j-attic.
the class MultiJvmTest method shutdownDbsAndVerify.
@After
public void shutdownDbsAndVerify() throws Exception {
shutdownDbs();
GraphDatabaseService masterDb = new EmbeddedGraphDatabase(dbPath(0).getAbsolutePath());
try {
for (int i = 1; i < jvms.size(); i++) {
GraphDatabaseService slaveDb = new EmbeddedGraphDatabase(dbPath(i).getAbsolutePath());
try {
verify(masterDb, slaveDb);
} finally {
slaveDb.shutdown();
}
}
} finally {
masterDb.shutdown();
}
}
use of org.neo4j.kernel.EmbeddedGraphDatabase in project graphdb by neo4j-attic.
the class SingleJvmTest method verifyAndShutdownDbs.
@After
public void verifyAndShutdownDbs() {
try {
verify(master.getGraphDb(), haDbs.toArray(new GraphDatabaseService[haDbs.size()]));
} finally {
shutdownDbs();
}
GraphDatabaseService masterOfflineDb = new EmbeddedGraphDatabase(dbPath(0).getAbsolutePath());
GraphDatabaseService[] slaveOfflineDbs = new GraphDatabaseService[haDbs.size()];
for (int i = 1; i <= haDbs.size(); i++) {
slaveOfflineDbs[i - 1] = new EmbeddedGraphDatabase(dbPath(i).getAbsolutePath());
}
try {
verify(masterOfflineDb, slaveOfflineDbs);
} finally {
masterOfflineDb.shutdown();
for (GraphDatabaseService db : slaveOfflineDbs) {
db.shutdown();
}
}
}
use of org.neo4j.kernel.EmbeddedGraphDatabase in project graphdb by neo4j-attic.
the class AbstractNeo4jTestCase method setUpDb.
@BeforeClass
public static void setUpDb() {
deleteFileOrDirectory(new File(getStorePath("neo-test")));
graphDb = new EmbeddedGraphDatabase(getStorePath("neo-test"));
}
use of org.neo4j.kernel.EmbeddedGraphDatabase in project graphdb by neo4j-attic.
the class TestBigStore method createAndVerifyGraphStartingWithId.
private void createAndVerifyGraphStartingWithId(long startId, int requiredHeapMb) throws Exception {
assumeTrue(machineIsOkToRunThisTest(testName.getMethodName(), requiredHeapMb));
/*
* Will create a layout like this:
*
* (refNode) --> (node) --> (highNode)
* ...
* ...
*
* Each node/relationship will have a bunch of different properties on them.
*/
setHighIds(startId - 1000);
byte[] bytes = new byte[45];
bytes[2] = 5;
bytes[10] = 42;
Map<String, Object> properties = map("number", 11, "short string", "test", "long string", "This is a long value, long enough", "array", bytes);
Transaction tx = db.beginTx();
int count = 10000;
for (int i = 0; i < count; i++) {
Node node = db.createNode();
setProperties(node, properties);
Relationship rel = db.getReferenceNode().createRelationshipTo(node, this);
setProperties(rel, properties);
Node highNode = db.createNode();
node.createRelationshipTo(highNode, OTHER_TYPE);
setProperties(highNode, properties);
if (i % 100 == 0 && i > 0) {
tx.success();
tx.finish();
tx = db.beginTx();
}
}
tx.success();
tx.finish();
db.shutdown();
db = new EmbeddedGraphDatabase(PATH);
// Verify the data
int verified = 0;
for (Relationship rel : db.getReferenceNode().getRelationships(Direction.OUTGOING)) {
Node node = rel.getEndNode();
assertProperties(properties, node);
assertProperties(properties, rel);
Node highNode = node.getSingleRelationship(OTHER_TYPE, Direction.OUTGOING).getEndNode();
assertProperties(properties, highNode);
verified++;
}
assertEquals(count, verified);
}
Aggregations