Search in sources :

Example 6 with DiffSets

use of org.neo4j.kernel.impl.util.diffsets.DiffSets in project neo4j by neo4j.

the class LongDiffSetsTest method shouldContainAddedElementsForDiffSetsWithAddedElements.

@Test
public void shouldContainAddedElementsForDiffSetsWithAddedElements() throws Exception {
    // given
    DiffSets<Long> diffSets = new DiffSets<>();
    diffSets.add(19L);
    diffSets.add(20L);
    Iterator<Long> expected = diffSets.apply(iteratorSource(19L));
    // when
    PrimitiveLongIterator actual = diffSets.augment(iterator(19L));
    // then
    assertThat(expected, hasSamePrimitiveItems(actual));
}
Also used : PrimitiveLongIterator(org.neo4j.collection.primitive.PrimitiveLongIterator) DiffSets(org.neo4j.kernel.impl.util.diffsets.DiffSets) Test(org.junit.Test)

Example 7 with DiffSets

use of org.neo4j.kernel.impl.util.diffsets.DiffSets in project neo4j by neo4j.

the class LongDiffSetsTest method shouldContainFilteredSourceForDiffSetsWithRemovedElements.

@Test
public void shouldContainFilteredSourceForDiffSetsWithRemovedElements() throws Exception {
    // given
    DiffSets<Long> diffSets = new DiffSets<>();
    diffSets.remove(17L);
    diffSets.remove(18L);
    Iterator<Long> expected = diffSets.apply(iteratorSource(1L, 17L, 3L));
    // when
    PrimitiveLongIterator actual = diffSets.augment(iterator(1L, 17L, 3L));
    // then
    assertThat(expected, hasSamePrimitiveItems(actual));
}
Also used : PrimitiveLongIterator(org.neo4j.collection.primitive.PrimitiveLongIterator) DiffSets(org.neo4j.kernel.impl.util.diffsets.DiffSets) Test(org.junit.Test)

Aggregations

DiffSets (org.neo4j.kernel.impl.util.diffsets.DiffSets)7 Test (org.junit.Test)4 PrimitiveLongIterator (org.neo4j.collection.primitive.PrimitiveLongIterator)4 OrderedPropertyValues (org.neo4j.kernel.api.schema_new.OrderedPropertyValues)3 RelationshipDiffSets (org.neo4j.kernel.impl.util.diffsets.RelationshipDiffSets)3 ReadableDiffSets (org.neo4j.storageengine.api.txstate.ReadableDiffSets)3 ReadableRelationshipDiffSets (org.neo4j.storageengine.api.txstate.ReadableRelationshipDiffSets)3 HashMap (java.util.HashMap)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1