use of org.neo4j.common.Subject in project neo4j by neo4j.
the class IndexPopulationJobMonitoringTest method testPopulationOfMultipleIndexes.
@Test
void testPopulationOfMultipleIndexes() {
when(populator.createStoreScan(any())).thenReturn(scan);
when(populator.hasPopulators()).thenReturn(true);
when(scan.getProgress()).thenReturn(PopulationProgress.NONE, PopulationProgress.single(9, 1000), PopulationProgress.single(99, 1000), PopulationProgress.single(999, 1000), PopulationProgress.DONE);
var job = new IndexPopulationJob(populator, NO_MONITOR, false, NULL, memoryTracker, "Another Test DB", new Subject("Another Test User"), NODE, Config.defaults());
addIndex(job, "index 1");
addIndex(job, "index 2");
addIndex(job, "index 3");
var monitoringParams = job.getMonitoringParams();
assertThat(monitoringParams.getSubmitter().describe()).isEqualTo("Another Test User");
assertThat(monitoringParams.getTargetDatabaseName()).isEqualTo("Another Test DB");
assertThat(monitoringParams.getDescription()).isEqualTo("Population of 3 'NODE' indexes");
verifyCurrentState(monitoringParams, "Population of indexes 'index 1','index 2','index 3'; Total progress: 0.0%");
job.run();
verifyCurrentState(monitoringParams, "Population of indexes 'index 1','index 2','index 3'; Total progress: 0.0%");
verifyCurrentState(monitoringParams, "Population of indexes 'index 1','index 2','index 3'; Total progress: 0.9%");
verifyCurrentState(monitoringParams, "Population of indexes 'index 1','index 2','index 3'; Total progress: 9.9%");
verifyCurrentState(monitoringParams, "Population of indexes 'index 1','index 2','index 3'; Total progress: 99.9%");
verifyCurrentState(monitoringParams, "Population of indexes 'index 1','index 2','index 3'; Total progress: 100.0%");
}
use of org.neo4j.common.Subject in project neo4j by neo4j.
the class IndexPopulationJobMonitoringTest method testPopulationOfSingleIndex.
@Test
void testPopulationOfSingleIndex() {
when(populator.createStoreScan(any())).thenReturn(scan);
when(populator.hasPopulators()).thenReturn(true);
when(scan.getProgress()).thenReturn(PopulationProgress.NONE, PopulationProgress.single(9, 1000), PopulationProgress.single(99, 1000), PopulationProgress.single(999, 1000), PopulationProgress.DONE);
var job = new IndexPopulationJob(populator, NO_MONITOR, false, NULL, memoryTracker, "Test DB", new Subject("Test User"), NODE, Config.defaults());
addIndex(job, "the ONE");
var monitoringParams = job.getMonitoringParams();
assertThat(monitoringParams.getSubmitter().describe()).isEqualTo("Test User");
assertThat(monitoringParams.getTargetDatabaseName()).isEqualTo("Test DB");
assertThat(monitoringParams.getDescription()).isEqualTo("Population of index 'the ONE'");
verifyCurrentState(monitoringParams, "Total progress: 0.0%");
job.run();
verifyCurrentState(monitoringParams, "Total progress: 0.0%");
verifyCurrentState(monitoringParams, "Total progress: 0.9%");
verifyCurrentState(monitoringParams, "Total progress: 9.9%");
verifyCurrentState(monitoringParams, "Total progress: 99.9%");
verifyCurrentState(monitoringParams, "Total progress: 100.0%");
}