Search in sources :

Example 6 with IndexPopulator

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

the class MultipleIndexPopulatorTest method testMultiplePopulatorUpdater.

@Test
public void testMultiplePopulatorUpdater() throws IOException, IndexEntryConflictException {
    IndexUpdater indexUpdater1 = mock(IndexUpdater.class);
    IndexPopulator indexPopulator1 = createIndexPopulator(indexUpdater1);
    IndexPopulator indexPopulator2 = createIndexPopulator();
    addPopulator(indexPopulator1, 1);
    addPopulator(indexPopulator2, 2);
    doThrow(getPopulatorException()).when(indexPopulator2).newPopulatingUpdater(any(PropertyAccessor.class));
    IndexUpdater multipleIndexUpdater = multipleIndexPopulator.newPopulatingUpdater(mock(PropertyAccessor.class));
    IndexEntryUpdate propertyUpdate = createIndexEntryUpdate(index1);
    multipleIndexUpdater.process(propertyUpdate);
    checkPopulatorFailure(indexPopulator2);
    verify(indexUpdater1).process(propertyUpdate);
}
Also used : IndexPopulator(org.neo4j.kernel.api.index.IndexPopulator) IndexEntryUpdate(org.neo4j.kernel.api.index.IndexEntryUpdate) PropertyAccessor(org.neo4j.kernel.api.index.PropertyAccessor) IndexUpdater(org.neo4j.kernel.api.index.IndexUpdater) Test(org.junit.Test)

Example 7 with IndexPopulator

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

the class MultipleIndexPopulatorTest method testIndexAllNodes.

@Test
public void testIndexAllNodes() {
    IndexPopulator indexPopulator1 = createIndexPopulator();
    IndexPopulator indexPopulator2 = createIndexPopulator();
    addPopulator(indexPopulator1, 1);
    addPopulator(indexPopulator2, 2);
    multipleIndexPopulator.create();
    multipleIndexPopulator.indexAllNodes();
    verify(indexStoreView).visitNodes(any(int[].class), any(IntPredicate.class), any(Visitor.class), any(Visitor.class), anyBoolean());
}
Also used : IndexPopulator(org.neo4j.kernel.api.index.IndexPopulator) Visitor(org.neo4j.helpers.collection.Visitor) IntPredicate(java.util.function.IntPredicate) Test(org.junit.Test)

Example 8 with IndexPopulator

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

the class MultipleIndexPopulatorTest method testFailPopulator.

@Test
public void testFailPopulator() throws IOException {
    IndexPopulator indexPopulator1 = createIndexPopulator();
    IndexPopulator indexPopulator2 = createIndexPopulator();
    addPopulator(indexPopulator1, 1);
    addPopulator(indexPopulator2, 2);
    multipleIndexPopulator.fail(getPopulatorException());
    checkPopulatorFailure(indexPopulator1);
    checkPopulatorFailure(indexPopulator2);
}
Also used : IndexPopulator(org.neo4j.kernel.api.index.IndexPopulator) Test(org.junit.Test)

Example 9 with IndexPopulator

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

the class MultipleIndexPopulatorTest method createIndexPopulator.

private IndexPopulator createIndexPopulator(IndexUpdater indexUpdater) throws IOException {
    IndexPopulator indexPopulator = createIndexPopulator();
    when(indexPopulator.newPopulatingUpdater(any(PropertyAccessor.class))).thenReturn(indexUpdater);
    return indexPopulator;
}
Also used : IndexPopulator(org.neo4j.kernel.api.index.IndexPopulator) PropertyAccessor(org.neo4j.kernel.api.index.PropertyAccessor)

Example 10 with IndexPopulator

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

the class MultipleIndexPopulatorTest method createIndexPopulator.

private IndexPopulator createIndexPopulator() {
    IndexPopulator populator = mock(IndexPopulator.class);
    when(populator.sampleResult()).thenReturn(new IndexSample());
    return populator;
}
Also used : IndexPopulator(org.neo4j.kernel.api.index.IndexPopulator) IndexSample(org.neo4j.storageengine.api.schema.IndexSample)

Aggregations

IndexPopulator (org.neo4j.kernel.api.index.IndexPopulator)45 Test (org.junit.Test)37 IndexEntryUpdate (org.neo4j.kernel.api.index.IndexEntryUpdate)11 PropertyAccessor (org.neo4j.kernel.api.index.PropertyAccessor)8 IndexUpdater (org.neo4j.kernel.api.index.IndexUpdater)7 IndexSamplingConfig (org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig)7 NeoStoreIndexStoreView (org.neo4j.kernel.impl.transaction.state.storeview.NeoStoreIndexStoreView)7 NodeUpdates (org.neo4j.kernel.api.index.NodeUpdates)6 SchemaIndexProvider (org.neo4j.kernel.api.index.SchemaIndexProvider)6 NewIndexDescriptor (org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor)6 BatchInserter (org.neo4j.unsafe.batchinsert.BatchInserter)5 ExecutorService (java.util.concurrent.ExecutorService)3 LabelSchemaDescriptor (org.neo4j.kernel.api.schema_new.LabelSchemaDescriptor)3 IndexPopulation (org.neo4j.kernel.impl.api.index.MultipleIndexPopulator.IndexPopulation)3 NeoStores (org.neo4j.kernel.impl.store.NeoStores)3 NodeStore (org.neo4j.kernel.impl.store.NodeStore)3 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)3 AssertableLogProvider (org.neo4j.logging.AssertableLogProvider)3 IntPredicate (java.util.function.IntPredicate)2 NodeLabelUpdate (org.neo4j.kernel.api.labelscan.NodeLabelUpdate)2