Search in sources :

Example 61 with DatabaseManagementService

use of org.neo4j.dbms.api.DatabaseManagementService in project neo4j by neo4j.

the class RecoveryIT method startStopDatabaseWithForcedRecovery.

private void startStopDatabaseWithForcedRecovery() {
    DatabaseManagementService forcedRecoveryManagementService = forcedRecoveryManagement();
    forcedRecoveryManagementService.shutdown();
}
Also used : DatabaseManagementService(org.neo4j.dbms.api.DatabaseManagementService)

Example 62 with DatabaseManagementService

use of org.neo4j.dbms.api.DatabaseManagementService in project neo4j by neo4j.

the class LogVersionUpgradeCheckerIT method startAsNormalWhenUpgradeIsNotAllowed.

@Test
void startAsNormalWhenUpgradeIsNotAllowed() {
    createGraphDbAndKillIt();
    // Try to start with upgrading disabled
    DatabaseManagementService managementService = startDatabaseService(false);
    managementService.database(DEFAULT_DATABASE_NAME);
    managementService.shutdown();
}
Also used : DatabaseManagementService(org.neo4j.dbms.api.DatabaseManagementService) Test(org.junit.jupiter.api.Test)

Example 63 with DatabaseManagementService

use of org.neo4j.dbms.api.DatabaseManagementService in project neo4j by neo4j.

the class TestRecoveryRelationshipTypes method recoverNeoAndHavingAllRelationshipTypesAfterRecovery.

@Test
void recoverNeoAndHavingAllRelationshipTypesAfterRecovery() throws Exception {
    // Given (create transactions and kill process, leaving it needing for recovery)
    Path storeDir = testDirectory.homePath();
    Process process = start(getClass().getName(), storeDir.toAbsolutePath().toString());
    assertEquals(0, process.waitFor());
    // When
    DatabaseManagementService managementService = new TestDatabaseManagementServiceBuilder(storeDir).build();
    GraphDatabaseService db = managementService.database(DEFAULT_DATABASE_NAME);
    // Then
    try (Transaction transaction = db.beginTx()) {
        Iterator<RelationshipType> typeResourceIterator = transaction.getAllRelationshipTypes().iterator();
        assertEquals(MyRelTypes.TEST.name(), typeResourceIterator.next().name());
    } finally {
        managementService.shutdown();
    }
}
Also used : Path(java.nio.file.Path) GraphDatabaseService(org.neo4j.graphdb.GraphDatabaseService) TestDatabaseManagementServiceBuilder(org.neo4j.test.TestDatabaseManagementServiceBuilder) Transaction(org.neo4j.graphdb.Transaction) RelationshipType(org.neo4j.graphdb.RelationshipType) DatabaseManagementService(org.neo4j.dbms.api.DatabaseManagementService) Test(org.junit.jupiter.api.Test)

Example 64 with DatabaseManagementService

use of org.neo4j.dbms.api.DatabaseManagementService in project neo4j by neo4j.

the class LockerLifecycleAdapterTest method shouldAllowDatabasesToUseFilesetsSequentially.

@Test
void shouldAllowDatabasesToUseFilesetsSequentially() {
    DatabaseManagementService managementService = newDb();
    managementService.shutdown();
    managementService = newDb();
    managementService.shutdown();
}
Also used : DatabaseManagementService(org.neo4j.dbms.api.DatabaseManagementService) Test(org.junit.jupiter.api.Test)

Example 65 with DatabaseManagementService

use of org.neo4j.dbms.api.DatabaseManagementService in project neo4j by neo4j.

the class FileLockerTest method mustPreventMultipleInstancesFromStartingOnSameStore.

@Test
void mustPreventMultipleInstancesFromStartingOnSameStore() {
    Path storeDir = testDirectory.homePath();
    DatabaseManagementService managementService = new TestDatabaseManagementServiceBuilder(storeDir).build();
    try {
        GraphDatabaseService db = managementService.database(DEFAULT_DATABASE_NAME);
        try (Transaction tx = db.beginTx()) {
            tx.createNode();
            tx.commit();
        }
        assertThrows(Exception.class, () -> {
            new TestDatabaseManagementServiceBuilder(storeDir).build();
        });
    } finally {
        managementService.shutdown();
    }
}
Also used : Path(java.nio.file.Path) GraphDatabaseService(org.neo4j.graphdb.GraphDatabaseService) TestDatabaseManagementServiceBuilder(org.neo4j.test.TestDatabaseManagementServiceBuilder) Transaction(org.neo4j.graphdb.Transaction) DatabaseManagementService(org.neo4j.dbms.api.DatabaseManagementService) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

DatabaseManagementService (org.neo4j.dbms.api.DatabaseManagementService)155 Test (org.junit.jupiter.api.Test)100 TestDatabaseManagementServiceBuilder (org.neo4j.test.TestDatabaseManagementServiceBuilder)79 GraphDatabaseAPI (org.neo4j.kernel.internal.GraphDatabaseAPI)61 Transaction (org.neo4j.graphdb.Transaction)60 GraphDatabaseService (org.neo4j.graphdb.GraphDatabaseService)56 Path (java.nio.file.Path)37 Node (org.neo4j.graphdb.Node)29 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)26 Label (org.neo4j.graphdb.Label)16 MethodSource (org.junit.jupiter.params.provider.MethodSource)10 EphemeralFileSystemAbstraction (org.neo4j.io.fs.EphemeralFileSystemAbstraction)9 DatabaseLayout (org.neo4j.io.layout.DatabaseLayout)9 DatabaseStateService (org.neo4j.dbms.DatabaseStateService)8 Config (org.neo4j.configuration.Config)7 DatabaseManagementServiceBuilder (org.neo4j.dbms.api.DatabaseManagementServiceBuilder)7 KernelTransaction (org.neo4j.kernel.api.KernelTransaction)7 GBPTreeCountsStore (org.neo4j.internal.counts.GBPTreeCountsStore)6 InternalTransaction (org.neo4j.kernel.impl.coreapi.InternalTransaction)6 Lifespan (org.neo4j.kernel.lifecycle.Lifespan)6