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)"));
}
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}]"));
}
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)));
}
Aggregations