use of org.neo4j.collection.primitive.PrimitiveLongIterator in project neo4j by neo4j.
the class LabelScanStoreTest method assertNodesForLabel.
private void assertNodesForLabel(int labelId, long... expectedNodeIds) {
Set<Long> nodeSet = new HashSet<>();
PrimitiveLongIterator nodes = store.newReader().nodesWithLabel(labelId);
while (nodes.hasNext()) {
nodeSet.add(nodes.next());
}
for (long expectedNodeId : expectedNodeIds) {
assertTrue("Expected node " + expectedNodeId + " not found in scan store", nodeSet.remove(expectedNodeId));
}
assertTrue("Unexpected nodes in scan store " + nodeSet, nodeSet.isEmpty());
}
use of org.neo4j.collection.primitive.PrimitiveLongIterator in project neo4j by neo4j.
the class DataStatementArgumentVerificationTest method shouldReturnEmptyIdIteratorFromNodesGetForLabelForNoSuchLabelConstant.
@Test
public void shouldReturnEmptyIdIteratorFromNodesGetForLabelForNoSuchLabelConstant() throws Exception {
// given
ReadOperations statement = stubStatement();
// when
PrimitiveLongIterator nodes = statement.nodesGetForLabel(StatementConstants.NO_SUCH_LABEL);
// then
assertFalse("should not contain any ids", nodes.hasNext());
}
use of org.neo4j.collection.primitive.PrimitiveLongIterator 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));
}
use of org.neo4j.collection.primitive.PrimitiveLongIterator 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));
}
use of org.neo4j.collection.primitive.PrimitiveLongIterator in project neo4j by neo4j.
the class IndexQueryTransactionStateTest method shouldExcludeRemovedNodesFromIndexQuery.
@Test
public void shouldExcludeRemovedNodesFromIndexQuery() throws Exception {
// Given
long nodeId = 2L;
when(indexReader.query(withValue)).then(answerAsPrimitiveLongIteratorFrom(asList(1L, nodeId, 3L)));
when(statement.acquireSingleNodeCursor(nodeId)).thenReturn(asNodeCursor(nodeId));
txContext.nodeDelete(state, nodeId);
// When
PrimitiveLongIterator result = txContext.indexQuery(state, newIndexDescriptor, withValue);
// Then
assertThat(PrimitiveLongCollections.toSet(result), equalTo(asSet(1L, 3L)));
}
Aggregations