Search in sources :

Example 6 with UncloseableDelegatingFileSystemAbstraction

use of org.neo4j.graphdb.mockfs.UncloseableDelegatingFileSystemAbstraction in project neo4j by neo4j.

the class RebuildCountsTest method restart.

private void restart(FileSystemAbstraction fs) throws IOException {
    if (db != null) {
        db.shutdown();
    }
    fs.mkdirs(storeDir);
    TestGraphDatabaseFactory dbFactory = new TestGraphDatabaseFactory();
    db = dbFactory.setUserLogProvider(userLogProvider).setInternalLogProvider(internalLogProvider).setFileSystem(new UncloseableDelegatingFileSystemAbstraction(fs)).addKernelExtension(new InMemoryIndexProviderFactory(indexProvider)).newImpermanentDatabaseBuilder(storeDir).setConfig(index_background_sampling_enabled, "false").newGraphDatabase();
}
Also used : InMemoryIndexProviderFactory(org.neo4j.kernel.impl.api.index.inmemory.InMemoryIndexProviderFactory) TestGraphDatabaseFactory(org.neo4j.test.TestGraphDatabaseFactory) UncloseableDelegatingFileSystemAbstraction(org.neo4j.graphdb.mockfs.UncloseableDelegatingFileSystemAbstraction)

Example 7 with UncloseableDelegatingFileSystemAbstraction

use of org.neo4j.graphdb.mockfs.UncloseableDelegatingFileSystemAbstraction in project neo4j by neo4j.

the class TestLogPruning method newDb.

private GraphDatabaseAPI newDb(String logPruning, int rotateEveryNTransactions) {
    this.rotateEveryNTransactions = rotateEveryNTransactions;
    fs = new EphemeralFileSystemAbstraction();
    TestGraphDatabaseFactory gdf = new TestGraphDatabaseFactory();
    gdf.setFileSystem(new UncloseableDelegatingFileSystemAbstraction(fs));
    GraphDatabaseBuilder builder = gdf.newImpermanentDatabaseBuilder();
    builder.setConfig(keep_logical_logs, logPruning);
    this.db = (GraphDatabaseAPI) builder.newGraphDatabase();
    files = new PhysicalLogFiles(new File(db.getStoreDir()), PhysicalLogFile.DEFAULT_NAME, fs);
    return db;
}
Also used : EphemeralFileSystemAbstraction(org.neo4j.graphdb.mockfs.EphemeralFileSystemAbstraction) TestGraphDatabaseFactory(org.neo4j.test.TestGraphDatabaseFactory) UncloseableDelegatingFileSystemAbstraction(org.neo4j.graphdb.mockfs.UncloseableDelegatingFileSystemAbstraction) File(java.io.File) PhysicalLogFile(org.neo4j.kernel.impl.transaction.log.PhysicalLogFile) GraphDatabaseBuilder(org.neo4j.graphdb.factory.GraphDatabaseBuilder) PhysicalLogFiles(org.neo4j.kernel.impl.transaction.log.PhysicalLogFiles)

Example 8 with UncloseableDelegatingFileSystemAbstraction

use of org.neo4j.graphdb.mockfs.UncloseableDelegatingFileSystemAbstraction in project neo4j by neo4j.

the class CheckPointerIntegrationTest method setup.

@Before
public void setup() throws IOException {
    fs = fsRule.get();
    fs.deleteRecursively(storeDir);
    builder = new TestGraphDatabaseFactory().setFileSystem(new UncloseableDelegatingFileSystemAbstraction(fs)).newImpermanentDatabaseBuilder(storeDir);
}
Also used : TestGraphDatabaseFactory(org.neo4j.test.TestGraphDatabaseFactory) UncloseableDelegatingFileSystemAbstraction(org.neo4j.graphdb.mockfs.UncloseableDelegatingFileSystemAbstraction) Before(org.junit.Before)

Example 9 with UncloseableDelegatingFileSystemAbstraction

use of org.neo4j.graphdb.mockfs.UncloseableDelegatingFileSystemAbstraction in project neo4j by neo4j.

the class IndexRestartIT method before.

@Before
public void before() throws Exception {
    factory = new TestGraphDatabaseFactory();
    factory.setFileSystem(new UncloseableDelegatingFileSystemAbstraction(fs.get()));
    factory.addKernelExtensions(Collections.singletonList(singleInstanceSchemaIndexProviderFactory("test", provider)));
}
Also used : TestGraphDatabaseFactory(org.neo4j.test.TestGraphDatabaseFactory) UncloseableDelegatingFileSystemAbstraction(org.neo4j.graphdb.mockfs.UncloseableDelegatingFileSystemAbstraction) Before(org.junit.Before)

Example 10 with UncloseableDelegatingFileSystemAbstraction

use of org.neo4j.graphdb.mockfs.UncloseableDelegatingFileSystemAbstraction in project neo4j by neo4j.

the class TestReadOnlyNeo4j method createSomeData.

private DbRepresentation createSomeData() {
    RelationshipType type = withName("KNOWS");
    GraphDatabaseService db = new TestGraphDatabaseFactory().setFileSystem(new UncloseableDelegatingFileSystemAbstraction(fs.get())).newImpermanentDatabase(PATH);
    try (Transaction tx = db.beginTx()) {
        Node prevNode = db.createNode();
        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();
    }
    DbRepresentation result = DbRepresentation.of(db);
    db.shutdown();
    return result;
}
Also used : GraphDatabaseService(org.neo4j.graphdb.GraphDatabaseService) Transaction(org.neo4j.graphdb.Transaction) Node(org.neo4j.graphdb.Node) Relationship(org.neo4j.graphdb.Relationship) RelationshipType(org.neo4j.graphdb.RelationshipType) TestGraphDatabaseFactory(org.neo4j.test.TestGraphDatabaseFactory) UncloseableDelegatingFileSystemAbstraction(org.neo4j.graphdb.mockfs.UncloseableDelegatingFileSystemAbstraction) DbRepresentation(org.neo4j.test.DbRepresentation)

Aggregations

UncloseableDelegatingFileSystemAbstraction (org.neo4j.graphdb.mockfs.UncloseableDelegatingFileSystemAbstraction)10 TestGraphDatabaseFactory (org.neo4j.test.TestGraphDatabaseFactory)9 Before (org.junit.Before)5 GraphDatabaseService (org.neo4j.graphdb.GraphDatabaseService)3 Transaction (org.neo4j.graphdb.Transaction)3 File (java.io.File)2 DbRepresentation (org.neo4j.test.DbRepresentation)2 Test (org.junit.Test)1 Node (org.neo4j.graphdb.Node)1 Relationship (org.neo4j.graphdb.Relationship)1 RelationshipType (org.neo4j.graphdb.RelationshipType)1 GraphDatabaseBuilder (org.neo4j.graphdb.factory.GraphDatabaseBuilder)1 EphemeralFileSystemAbstraction (org.neo4j.graphdb.mockfs.EphemeralFileSystemAbstraction)1 WriteOperationsNotAllowedException (org.neo4j.graphdb.security.WriteOperationsNotAllowedException)1 InMemoryIndexProviderFactory (org.neo4j.kernel.impl.api.index.inmemory.InMemoryIndexProviderFactory)1 PhysicalLogFile (org.neo4j.kernel.impl.transaction.log.PhysicalLogFile)1 PhysicalLogFiles (org.neo4j.kernel.impl.transaction.log.PhysicalLogFiles)1 AssertableLogProvider (org.neo4j.logging.AssertableLogProvider)1 TestEnterpriseGraphDatabaseFactory (org.neo4j.test.TestEnterpriseGraphDatabaseFactory)1