use of org.neo4j.test.TestDatabaseManagementServiceBuilder in project neo4j by neo4j.
the class TestReadOnlyNeo4j method createSomeData.
private DbRepresentation createSomeData() {
RelationshipType type = withName("KNOWS");
DatabaseManagementService managementService = new TestDatabaseManagementServiceBuilder(testDirectory.homePath()).setFileSystem(new UncloseableDelegatingFileSystemAbstraction(fs)).impermanent().build();
GraphDatabaseService db = managementService.database(DEFAULT_DATABASE_NAME);
try (Transaction tx = db.beginTx()) {
Node prevNode = tx.createNode();
for (int i = 0; i < 100; i++) {
Node node = tx.createNode();
Relationship rel = prevNode.createRelationshipTo(node, type);
node.setProperty("someKey" + i % 10, i % 15);
rel.setProperty("since", System.currentTimeMillis());
}
tx.commit();
}
DbRepresentation result = DbRepresentation.of(db);
managementService.shutdown();
return result;
}
use of org.neo4j.test.TestDatabaseManagementServiceBuilder in project neo4j by neo4j.
the class ShutdownSequenceIT method getTestGraphDatabaseFactory.
private TestDatabaseManagementServiceBuilder getTestGraphDatabaseFactory() {
TestDatabaseManagementServiceBuilder factory = new TestDatabaseManagementServiceBuilder();
factory.setInternalLogProvider(internalLogProvider);
factory.setUserLogProvider(userLogProvider);
return factory;
}
use of org.neo4j.test.TestDatabaseManagementServiceBuilder in project neo4j by neo4j.
the class BatchInserterImplTest method shouldCorrectlyMarkHighIds.
@Test
void shouldCorrectlyMarkHighIds() throws Exception {
// given
DatabaseLayout layout = databaseLayout;
long[] nodeIds = new long[10];
try (var inserter = BatchInserters.inserter(layout, fileSystem, config)) {
Map<String, Object> properties = new HashMap<>();
properties.put("name", "Just some name");
properties.put("some_array", new String[] { "this", "is", "a", "string", "which", "really", "is", "an", "array" });
for (int i = 0; i < nodeIds.length; i++) {
nodeIds[i] = inserter.createNode(properties);
}
}
MutableLongSet nodeIdsSet = LongSets.mutable.of(nodeIds);
// when/then
DatabaseManagementService dbms = new TestDatabaseManagementServiceBuilder(layout.getNeo4jLayout().homeDirectory()).setFileSystem(fileSystem).build();
try {
GraphDatabaseService db = dbms.database(DEFAULT_DATABASE_NAME);
for (long nodeId : nodeIds) {
try (Transaction tx = db.beginTx()) {
tx.getNodeById(nodeId).addLabel(TestLabels.LABEL_ONE);
tx.commit();
}
}
for (int i = 0; i < 5; i++) {
try (Transaction tx = db.beginTx()) {
Node node = tx.createNode();
assertFalse(nodeIdsSet.contains(node.getId()));
tx.commit();
}
}
for (long nodeId : nodeIds) {
try (Transaction tx = db.beginTx()) {
tx.getNodeById(nodeId).delete();
tx.commit();
}
}
} finally {
dbms.shutdown();
}
}
use of org.neo4j.test.TestDatabaseManagementServiceBuilder in project neo4j by neo4j.
the class BoltChannelAutoReadLimiterIT method getTestGraphDatabaseFactory.
protected TestDatabaseManagementServiceBuilder getTestGraphDatabaseFactory() {
TestDatabaseManagementServiceBuilder factory = new TestDatabaseManagementServiceBuilder();
logProvider = new AssertableLogProvider();
factory.setInternalLogProvider(logProvider);
return factory;
}
use of org.neo4j.test.TestDatabaseManagementServiceBuilder in project neo4j by neo4j.
the class IndexProviderApprovalTest method init.
@BeforeAll
public static void init() {
DatabaseManagementService managementService = new TestDatabaseManagementServiceBuilder().impermanent().build();
GraphDatabaseService db = managementService.database(DEFAULT_DATABASE_NAME);
for (TestValue value : TestValue.values()) {
createNode(db, PROPERTY_KEY, value.value);
}
noIndexRun = runFindByLabelAndProperty(db);
createIndex(db, label(LABEL), PROPERTY_KEY);
indexRun = runFindByLabelAndProperty(db);
managementService.shutdown();
}
Aggregations