Search in sources :

Example 1 with StandaloneDatabaseContext

use of org.neo4j.dbms.database.StandaloneDatabaseContext in project neo4j by neo4j.

the class DbmsDiagnosticsManagerTest method dumpDiagnosticsInConciseForm.

@Test
void dumpDiagnosticsInConciseForm() {
    Map<NamedDatabaseId, StandaloneDatabaseContext> databaseMap = new HashMap<>();
    int numberOfDatabases = 1000;
    for (int i = 0; i < numberOfDatabases; i++) {
        Database database = mock(Database.class);
        NamedDatabaseId namedDatabaseId = TestDatabaseIdRepository.randomNamedDatabaseId();
        when(database.getNamedDatabaseId()).thenReturn(namedDatabaseId);
        databaseMap.put(namedDatabaseId, new StandaloneDatabaseContext(database));
    }
    when(databaseManager.registeredDatabases()).thenReturn(new TreeMap<>(databaseMap));
    diagnosticsManager.dumpAll();
    var logAssertions = assertThat(logProvider);
    var databaseNames = databaseMap.keySet().stream().map(NamedDatabaseId::name).toArray(String[]::new);
    logAssertions.containsMessagesOnce(databaseNames);
}
Also used : HashMap(java.util.HashMap) Database(org.neo4j.kernel.database.Database) NamedDatabaseId(org.neo4j.kernel.database.NamedDatabaseId) StandaloneDatabaseContext(org.neo4j.dbms.database.StandaloneDatabaseContext) Test(org.junit.jupiter.api.Test)

Aggregations

HashMap (java.util.HashMap)1 Test (org.junit.jupiter.api.Test)1 StandaloneDatabaseContext (org.neo4j.dbms.database.StandaloneDatabaseContext)1 Database (org.neo4j.kernel.database.Database)1 NamedDatabaseId (org.neo4j.kernel.database.NamedDatabaseId)1