Search in sources :

Example 1 with LogMatcherBuilder

use of org.neo4j.logging.AssertableLogProvider.LogMatcherBuilder in project neo4j by neo4j.

the class IndexPopulationJobTest method shouldLogJobProgress.

@Test
public void shouldLogJobProgress() throws Exception {
    // Given
    createNode(map(name, "irrelephant"), FIRST);
    AssertableLogProvider logProvider = new AssertableLogProvider();
    FlippableIndexProxy index = mock(FlippableIndexProxy.class);
    IndexPopulator populator = spy(inMemoryPopulator(false));
    IndexPopulationJob job = newIndexPopulationJob(populator, index, indexStoreView, logProvider, false);
    // When
    job.run();
    // Then
    LogMatcherBuilder match = inLog(IndexPopulationJob.class);
    logProvider.assertExactly(match.info("Index population started: [%s]", ":FIRST(name)"), match.info("Index population completed. Index is now online: [%s]", ":FIRST(name)"));
}
Also used : IndexPopulator(org.neo4j.kernel.api.index.IndexPopulator) LogMatcherBuilder(org.neo4j.logging.AssertableLogProvider.LogMatcherBuilder) AssertableLogProvider(org.neo4j.logging.AssertableLogProvider) Test(org.junit.Test)

Example 2 with LogMatcherBuilder

use of org.neo4j.logging.AssertableLogProvider.LogMatcherBuilder in project neo4j by neo4j.

the class SchemaLoggingIT method shouldLogUserReadableLabelAndPropertyNames.

@Test
public void shouldLogUserReadableLabelAndPropertyNames() throws Exception {
    //noinspection deprecation
    GraphDatabaseAPI db = dbRule.getGraphDatabaseAPI();
    String labelName = "User";
    String property = "name";
    // when
    createIndex(db, labelName, property);
    // then
    LogMatcherBuilder match = inLog(IndexPopulationJob.class);
    logProvider.assertAtLeastOnce(match.info("Index population started: [%s]", ":User(name) [provider: {key=in-memory-index, version=1.0}]"), match.info("Index population completed. Index is now online: [%s]", ":User(name) [provider: {key=in-memory-index, version=1.0}]"));
}
Also used : GraphDatabaseAPI(org.neo4j.kernel.internal.GraphDatabaseAPI) LogMatcherBuilder(org.neo4j.logging.AssertableLogProvider.LogMatcherBuilder) Test(org.junit.Test)

Example 3 with LogMatcherBuilder

use of org.neo4j.logging.AssertableLogProvider.LogMatcherBuilder in project neo4j by neo4j.

the class IndexPopulationJobTest method shouldLogJobFailure.

@Test
public void shouldLogJobFailure() throws Exception {
    // Given
    createNode(map(name, "irrelephant"), FIRST);
    AssertableLogProvider logProvider = new AssertableLogProvider();
    FlippableIndexProxy index = mock(FlippableIndexProxy.class);
    IndexPopulator populator = spy(inMemoryPopulator(false));
    IndexPopulationJob job = newIndexPopulationJob(populator, index, indexStoreView, logProvider, false);
    Throwable failure = new IllegalStateException("not successful");
    doThrow(failure).when(populator).create();
    // When
    job.run();
    // Then
    LogMatcherBuilder match = inLog(IndexPopulationJob.class);
    logProvider.assertAtLeastOnce(match.error(is("Failed to populate index: [:FIRST(name)]"), sameInstance(failure)));
}
Also used : IndexPopulator(org.neo4j.kernel.api.index.IndexPopulator) LogMatcherBuilder(org.neo4j.logging.AssertableLogProvider.LogMatcherBuilder) AssertableLogProvider(org.neo4j.logging.AssertableLogProvider) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 LogMatcherBuilder (org.neo4j.logging.AssertableLogProvider.LogMatcherBuilder)3 IndexPopulator (org.neo4j.kernel.api.index.IndexPopulator)2 AssertableLogProvider (org.neo4j.logging.AssertableLogProvider)2 GraphDatabaseAPI (org.neo4j.kernel.internal.GraphDatabaseAPI)1