Search in sources :

Example 91 with IndexUpdater

use of org.neo4j.kernel.api.index.IndexUpdater in project neo4j by neo4j.

the class TokenIndexPopulatorTest method updaterMustThrowIfProcessAfterClose.

@Test
void updaterMustThrowIfProcessAfterClose() throws Exception {
    // given
    populator.create();
    IndexUpdater updater = populator.newPopulatingUpdater(null_property_accessor, NULL);
    // when
    updater.close();
    IllegalStateException e = assertThrows(IllegalStateException.class, () -> updater.process(IndexEntryUpdate.change(random.nextInt(), null, EMPTY_LONG_ARRAY, TokenIndexUtility.generateRandomTokens(random))));
    assertThat(e).hasMessageContaining("Updater has been closed");
    populator.close(true, NULL);
}
Also used : IndexUpdater(org.neo4j.kernel.api.index.IndexUpdater) Test(org.junit.jupiter.api.Test)

Example 92 with IndexUpdater

use of org.neo4j.kernel.api.index.IndexUpdater in project neo4j by neo4j.

the class FusionIndexUpdaterTest method verifyAddWithCorrectUpdater.

private void verifyAddWithCorrectUpdater(IndexUpdater correctPopulator, Value... numberValues) throws IndexEntryConflictException {
    IndexEntryUpdate<LabelSchemaDescriptor> update = add(numberValues);
    fusionIndexUpdater.process(update);
    verify(correctPopulator).process(update);
    for (IndexUpdater populator : aliveUpdaters) {
        if (populator != correctPopulator) {
            verify(populator, never()).process(update);
        }
    }
}
Also used : LabelSchemaDescriptor(org.neo4j.internal.schema.LabelSchemaDescriptor) IndexUpdater(org.neo4j.kernel.api.index.IndexUpdater) SwallowingIndexUpdater(org.neo4j.kernel.impl.api.index.SwallowingIndexUpdater)

Example 93 with IndexUpdater

use of org.neo4j.kernel.api.index.IndexUpdater in project neo4j by neo4j.

the class FusionIndexUpdaterTest method verifyChangeWithCorrectUpdaterNotMixed.

private void verifyChangeWithCorrectUpdaterNotMixed(IndexUpdater correctPopulator, Value before, Value after) throws IndexEntryConflictException {
    IndexEntryUpdate<LabelSchemaDescriptor> update = FusionIndexTestHelp.change(before, after);
    fusionIndexUpdater.process(update);
    verify(correctPopulator).process(update);
    for (IndexUpdater populator : aliveUpdaters) {
        if (populator != correctPopulator) {
            verify(populator, never()).process(update);
        }
    }
}
Also used : LabelSchemaDescriptor(org.neo4j.internal.schema.LabelSchemaDescriptor) IndexUpdater(org.neo4j.kernel.api.index.IndexUpdater) SwallowingIndexUpdater(org.neo4j.kernel.impl.api.index.SwallowingIndexUpdater)

Example 94 with IndexUpdater

use of org.neo4j.kernel.api.index.IndexUpdater in project neo4j by neo4j.

the class FusionIndexUpdaterTest method verifyRemoveWithCorrectUpdater.

private void verifyRemoveWithCorrectUpdater(IndexUpdater correctPopulator, Value... numberValues) throws IndexEntryConflictException {
    IndexEntryUpdate<LabelSchemaDescriptor> update = FusionIndexTestHelp.remove(numberValues);
    fusionIndexUpdater.process(update);
    verify(correctPopulator).process(update);
    for (IndexUpdater populator : aliveUpdaters) {
        if (populator != correctPopulator) {
            verify(populator, never()).process(update);
        }
    }
}
Also used : LabelSchemaDescriptor(org.neo4j.internal.schema.LabelSchemaDescriptor) IndexUpdater(org.neo4j.kernel.api.index.IndexUpdater) SwallowingIndexUpdater(org.neo4j.kernel.impl.api.index.SwallowingIndexUpdater)

Aggregations

IndexUpdater (org.neo4j.kernel.api.index.IndexUpdater)94 Test (org.junit.jupiter.api.Test)61 IndexDescriptor (org.neo4j.internal.schema.IndexDescriptor)22 ValueIndexEntryUpdate (org.neo4j.storageengine.api.ValueIndexEntryUpdate)13 IndexAccessor (org.neo4j.kernel.api.index.IndexAccessor)12 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)11 IndexPopulator (org.neo4j.kernel.api.index.IndexPopulator)9 Value (org.neo4j.values.storable.Value)9 ConsistencySummaryStatistics (org.neo4j.consistency.report.ConsistencySummaryStatistics)7 CursorContext (org.neo4j.io.pagecache.context.CursorContext)7 IndexEntryUpdate (org.neo4j.storageengine.api.IndexEntryUpdate)6 SwallowingIndexUpdater (org.neo4j.kernel.impl.api.index.SwallowingIndexUpdater)5 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 Transaction (org.neo4j.graphdb.Transaction)4 IndexEntryConflictException (org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException)4 SchemaIndexTestHelper.mockIndexProxy (org.neo4j.kernel.impl.api.index.SchemaIndexTestHelper.mockIndexProxy)4 NodePropertyAccessor (org.neo4j.storageengine.api.NodePropertyAccessor)4 HashMap (java.util.HashMap)3 EnumSource (org.junit.jupiter.params.provider.EnumSource)3