use of org.neo4j.logging.AssertableLogProvider in project neo4j by neo4j.
the class NeoStoresDiagnosticsTest method setUp.
@BeforeEach
void setUp() {
logProvider = new AssertableLogProvider();
logger = logProvider.getLog(DiagnosticsManager.class);
}
use of org.neo4j.logging.AssertableLogProvider in project neo4j by neo4j.
the class IndexIT method shouldBeAbleToRemoveAConstraintIndexWithoutOwner.
@Test
void shouldBeAbleToRemoveAConstraintIndexWithoutOwner() throws Exception {
// given
AssertableLogProvider logProvider = new AssertableLogProvider();
ConstraintIndexCreator creator = new ConstraintIndexCreator(() -> kernel, indexingService, logProvider);
IndexProviderDescriptor provider = GenericNativeIndexProvider.DESCRIPTOR;
IndexPrototype prototype = uniqueForSchema(schema).withName("constraint name").withIndexProvider(provider);
IndexDescriptor constraintIndex = creator.createConstraintIndex(prototype);
// then
KernelTransaction transaction = newTransaction();
assertEquals(emptySet(), asSet(transaction.schemaRead().constraintsGetForLabel(labelId)));
commit();
// when
SchemaWrite schemaWrite = schemaWriteInNewTransaction();
schemaWrite.indexDrop(constraintIndex);
commit();
// then
transaction = newTransaction();
assertEquals(emptySet(), asSet(transaction.schemaRead().indexesGetForLabel(labelId)));
commit();
}
use of org.neo4j.logging.AssertableLogProvider in project neo4j by neo4j.
the class IndexPopulationJobTest method shouldLogJobProgress.
@Test
void shouldLogJobProgress() throws Exception {
// Given
createNode(map(name, "irrelephant"), FIRST);
AssertableLogProvider logProvider = new AssertableLogProvider();
FlippableIndexProxy index = mock(FlippableIndexProxy.class);
when(index.getState()).thenReturn(InternalIndexState.ONLINE);
IndexPopulator populator = indexPopulator(false);
try {
IndexPopulationJob job = newIndexPopulationJob(populator, index, indexStoreView, logProvider, EntityType.NODE, indexPrototype(FIRST, name, false));
// When
job.run();
// Then
var matcher = assertThat(logProvider).forClass(IndexPopulationJob.class).forLevel(INFO);
matcher.containsMessageWithArgumentsContaining("Index population started: [%s]", "type='GENERAL BTREE', schema=(:FIRST {name})").containsMessages("TIME/PHASE Final: SCAN[");
} finally {
populator.close(true, CursorContext.NULL);
}
}
use of org.neo4j.logging.AssertableLogProvider in project neo4j by neo4j.
the class StoreAssertions method assertConsistentStore.
public static void assertConsistentStore(DatabaseLayout databaseLayout) throws ConsistencyCheckIncompleteException {
Config configuration = Config.defaults(GraphDatabaseSettings.pagecache_memory, "8m");
AssertableLogProvider logger = new AssertableLogProvider();
ConsistencyCheckService.Result result = new ConsistencyCheckService().runFullConsistencyCheck(databaseLayout, configuration, ProgressMonitorFactory.NONE, logger, false);
assertTrue("Consistency check for " + databaseLayout + " found inconsistencies:\n\n" + logger.serialize(), result.isSuccessful());
}
use of org.neo4j.logging.AssertableLogProvider in project neo4j by neo4j.
the class LoggingMonitorTest method shouldIncludeStackTraceWhenDebugLevel.
@Test
void shouldIncludeStackTraceWhenDebugLevel() {
AssertableLogProvider logProvider = new AssertableLogProvider(true);
LoggingMonitor monitor = new LoggingMonitor(logProvider.getLog(LoggingMonitorTest.class));
IndexDescriptor index = forSchema(forLabel(1, 1)).withName("index").materialise(1);
monitor.failedToOpenIndex(index, "I'll do something about this.", new Exception("Dammit Leroy!"));
assertThat(logProvider).containsMessages("java.lang.Exception: Dammit Leroy!");
}
Aggregations