Search in sources :

Example 36 with TestGraphDatabaseFactory

use of org.neo4j.test.TestGraphDatabaseFactory in project neo4j by neo4j.

the class RollingUpgradeIT method startStandaloneDbToRunUpgrade.

private void startStandaloneDbToRunUpgrade(File storeDir, int dbIndex) {
    GraphDatabaseService tempDbForUpgrade = null;
    try {
        debug("Starting standalone db " + dbIndex + " to run upgrade");
        tempDbForUpgrade = new TestGraphDatabaseFactory().newEmbeddedDatabaseBuilder(storeDir).setConfig(GraphDatabaseSettings.allow_store_upgrade, "true").newGraphDatabase();
    } finally {
        if (tempDbForUpgrade != null) {
            tempDbForUpgrade.shutdown();
        }
    }
}
Also used : GraphDatabaseService(org.neo4j.graphdb.GraphDatabaseService) TestGraphDatabaseFactory(org.neo4j.test.TestGraphDatabaseFactory)

Example 37 with TestGraphDatabaseFactory

use of org.neo4j.test.TestGraphDatabaseFactory in project neo4j by neo4j.

the class PageCacheMetricsIT method setUp.

@Before
public void setUp() {
    metricsDirectory = testDirectory.directory("metrics");
    database = new TestGraphDatabaseFactory().newEmbeddedDatabaseBuilder(testDirectory.graphDbDir()).setConfig(MetricsSettings.neoPageCacheEnabled, Settings.TRUE).setConfig(MetricsSettings.csvEnabled, Settings.TRUE).setConfig(MetricsSettings.csvInterval, "100ms").setConfig(MetricsSettings.csvPath, metricsDirectory.getAbsolutePath()).newGraphDatabase();
}
Also used : TestGraphDatabaseFactory(org.neo4j.test.TestGraphDatabaseFactory) Before(org.junit.Before)

Example 38 with TestGraphDatabaseFactory

use of org.neo4j.test.TestGraphDatabaseFactory in project neo4j by neo4j.

the class StoreUpgraderInterruptionTestIT method startStopDatabase.

private void startStopDatabase(File workingDirectory) {
    GraphDatabaseService databaseService = new TestGraphDatabaseFactory().newEmbeddedDatabase(workingDirectory);
    databaseService.shutdown();
}
Also used : GraphDatabaseService(org.neo4j.graphdb.GraphDatabaseService) TestGraphDatabaseFactory(org.neo4j.test.TestGraphDatabaseFactory)

Example 39 with TestGraphDatabaseFactory

use of org.neo4j.test.TestGraphDatabaseFactory in project neo4j by neo4j.

the class LuceneIndexRecoveryIT method startDb.

private void startDb(KernelExtensionFactory<?> indexProviderFactory) {
    if (db != null) {
        db.shutdown();
    }
    TestGraphDatabaseFactory factory = new TestGraphDatabaseFactory();
    factory.setFileSystem(fs.get());
    factory.addKernelExtensions(Arrays.<KernelExtensionFactory<?>>asList(indexProviderFactory));
    db = (GraphDatabaseAPI) factory.newImpermanentDatabase();
}
Also used : TestGraphDatabaseFactory(org.neo4j.test.TestGraphDatabaseFactory)

Example 40 with TestGraphDatabaseFactory

use of org.neo4j.test.TestGraphDatabaseFactory in project neo4j by neo4j.

the class IndexSamplingIntegrationTest method fetchIndexSamplingValues.

private DoubleLongRegister fetchIndexSamplingValues(GraphDatabaseService db) throws IndexNotFoundKernelException {
    try {
        // Then
        db = new TestGraphDatabaseFactory().newEmbeddedDatabase(testDirectory.graphDbDir());
        @SuppressWarnings("deprecation") GraphDatabaseAPI api = (GraphDatabaseAPI) db;
        CountsTracker countsTracker = api.getDependencyResolver().resolveDependency(RecordStorageEngine.class).testAccessNeoStores().getCounts();
        IndexSampleKey key = CountsKeyFactory.indexSampleKey(indexId(api));
        return countsTracker.get(key, Registers.newDoubleLongRegister());
    } finally {
        if (db != null) {
            db.shutdown();
        }
    }
}
Also used : IndexSampleKey(org.neo4j.kernel.impl.store.counts.keys.IndexSampleKey) GraphDatabaseAPI(org.neo4j.kernel.internal.GraphDatabaseAPI) TestGraphDatabaseFactory(org.neo4j.test.TestGraphDatabaseFactory) CountsTracker(org.neo4j.kernel.impl.store.counts.CountsTracker)

Aggregations

TestGraphDatabaseFactory (org.neo4j.test.TestGraphDatabaseFactory)156 Test (org.junit.Test)70 Transaction (org.neo4j.graphdb.Transaction)62 GraphDatabaseService (org.neo4j.graphdb.GraphDatabaseService)61 File (java.io.File)34 Node (org.neo4j.graphdb.Node)28 GraphDatabaseAPI (org.neo4j.kernel.internal.GraphDatabaseAPI)26 BeforeClass (org.junit.BeforeClass)25 Before (org.junit.Before)22 EphemeralFileSystemAbstraction (org.neo4j.graphdb.mockfs.EphemeralFileSystemAbstraction)9 Relationship (org.neo4j.graphdb.Relationship)8 Result (org.neo4j.graphdb.Result)6 GraphDatabaseBuilder (org.neo4j.graphdb.factory.GraphDatabaseBuilder)6 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)6 GraphDatabaseShellServer (org.neo4j.shell.kernel.GraphDatabaseShellServer)6 HashMap (java.util.HashMap)5 DependencyResolver (org.neo4j.graphdb.DependencyResolver)5 PageCache (org.neo4j.io.pagecache.PageCache)5 WrappedDatabase (org.neo4j.server.database.WrappedDatabase)5 KernelTransaction (org.neo4j.kernel.api.KernelTransaction)4