Search in sources :

Example 21 with TestGraphDatabaseFactory

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

the class StartClientIT method shouldNotStartBolt.

@Test
public void shouldNotStartBolt() throws IOException {
    // Given
    AssertableLogProvider log = new AssertableLogProvider();
    // When
    new StartClient(System.out, System.err) {

        @Override
        protected GraphDatabaseShellServer getGraphDatabaseShellServer(File path, boolean readOnly, String configFile) throws RemoteException {
            return new GraphDatabaseShellServer(new TestGraphDatabaseFactory().setUserLogProvider(log), path, readOnly, configFile);
        }
    }.start(new String[] { "-c", "RETURN 1;", "-path", db.getStoreDir(), "-config", getClass().getResource("/config-with-bolt-connector.conf").getFile() }, mock(CtrlCHandler.class));
    // Then
    log.assertNone(inLog(startsWith(WorkerFactory.class.getPackage().getName())).any());
}
Also used : GraphDatabaseShellServer(org.neo4j.shell.kernel.GraphDatabaseShellServer) TestGraphDatabaseFactory(org.neo4j.test.TestGraphDatabaseFactory) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) RemoteException(java.rmi.RemoteException) File(java.io.File) WorkerFactory(org.neo4j.bolt.v1.runtime.WorkerFactory) AssertableLogProvider(org.neo4j.logging.AssertableLogProvider) Test(org.junit.Test)

Example 22 with TestGraphDatabaseFactory

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

the class FakeShellServer method doBefore.

@Before
public void doBefore() throws Exception {
    db = (GraphDatabaseAPI) new TestGraphDatabaseFactory().newImpermanentDatabase();
    shellServer = new FakeShellServer(db);
    shellClient = new SameJvmClient(new HashMap<String, Serializable>(), shellServer, new CollectingOutput());
}
Also used : SameJvmClient(org.neo4j.shell.impl.SameJvmClient) HashMap(java.util.HashMap) TestGraphDatabaseFactory(org.neo4j.test.TestGraphDatabaseFactory) CollectingOutput(org.neo4j.shell.impl.CollectingOutput) Before(org.junit.Before)

Example 23 with TestGraphDatabaseFactory

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

the class ServerProcess method startup.

@Override
public void startup(Pair<File, String> config) throws Throwable {
    File storeDir = config.first();
    String backupConfigValue = config.other();
    if (backupConfigValue == null) {
        this.db = new TestGraphDatabaseFactory().newEmbeddedDatabase(storeDir);
    } else {
        // TODO This is using the old config style - is this class even used anywhere!?
        this.db = new TestGraphDatabaseFactory().newEmbeddedDatabaseBuilder(storeDir).setConfig("enable_online_backup", backupConfigValue).newGraphDatabase();
    }
}
Also used : TestGraphDatabaseFactory(org.neo4j.test.TestGraphDatabaseFactory) File(java.io.File)

Example 24 with TestGraphDatabaseFactory

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

the class SchemaIndexProviderApprovalTest method init.

@BeforeClass
public static void init() {
    GraphDatabaseService db = new TestGraphDatabaseFactory().newImpermanentDatabase();
    for (TestValue value : TestValue.values()) {
        createNode(db, PROPERTY_KEY, value.value);
    }
    noIndexRun = runFindByLabelAndProperty(db);
    createIndex(db, label(LABEL), PROPERTY_KEY);
    indexRun = runFindByLabelAndProperty(db);
    db.shutdown();
}
Also used : GraphDatabaseService(org.neo4j.graphdb.GraphDatabaseService) TestGraphDatabaseFactory(org.neo4j.test.TestGraphDatabaseFactory) BeforeClass(org.junit.BeforeClass)

Example 25 with TestGraphDatabaseFactory

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

the class StoreLockerTest method mustPreventMultipleInstancesFromStartingOnSameStore.

@Test
public void mustPreventMultipleInstancesFromStartingOnSameStore() {
    File storeDir = target.graphDbDir();
    GraphDatabaseService db = new TestGraphDatabaseFactory().newEmbeddedDatabase(storeDir);
    try (Transaction tx = db.beginTx()) {
        db.createNode();
        tx.success();
    }
    try {
        new TestGraphDatabaseFactory().newEmbeddedDatabase(storeDir);
        fail("Should not be able to start up another db in the same dir");
    } catch (Exception e) {
    // Good
    } finally {
        db.shutdown();
    }
}
Also used : GraphDatabaseService(org.neo4j.graphdb.GraphDatabaseService) Transaction(org.neo4j.graphdb.Transaction) TestGraphDatabaseFactory(org.neo4j.test.TestGraphDatabaseFactory) File(java.io.File) IOException(java.io.IOException) StoreLockException(org.neo4j.kernel.StoreLockException) Test(org.junit.Test)

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