use of org.neo4j.unsafe.impl.batchimport.store.BatchingTokenRepository.BatchingRelationshipTypeTokenRepository in project neo4j by neo4j.
the class RelationshipTypeCheckerStepTest method shouldReturnRelationshipTypesInDescendingOrder.
@Test
public void shouldReturnRelationshipTypesInDescendingOrder() throws Throwable {
// GIVEN
BatchingRelationshipTypeTokenRepository repository = mock(BatchingRelationshipTypeTokenRepository.class);
RelationshipTypeCheckerStep step = new RelationshipTypeCheckerStep(mock(StageControl.class), DEFAULT, repository);
Batch<InputRelationship, RelationshipRecord> relationships = batchOfRelationshipsWithRandomTypes(10, true);
step.process(relationships, mock(BatchSender.class));
// WHEN
step.done();
// THEN
TreeSet<Integer> expected = idsOf(relationships);
Object[] processed = step.getRelationshipTypes(100);
int i = 0;
for (Object expectedType : loop(expected.descendingIterator())) {
assertEquals(expectedType, processed[i++]);
}
}
use of org.neo4j.unsafe.impl.batchimport.store.BatchingTokenRepository.BatchingRelationshipTypeTokenRepository in project neo4j by neo4j.
the class RelationshipTypeCheckerStepTest method shouldReturnRelationshipTypeIdsInReverseOrderOfTokenCreation.
private void shouldReturnRelationshipTypeIdsInReverseOrderOfTokenCreation(boolean typeIds) throws Throwable {
// GIVEN
BatchingRelationshipTypeTokenRepository repository = mock(BatchingRelationshipTypeTokenRepository.class);
RelationshipTypeCheckerStep step = new RelationshipTypeCheckerStep(mock(StageControl.class), DEFAULT, repository);
// WHEN
Batch<InputRelationship, RelationshipRecord> relationships = batchOfRelationshipsWithRandomTypes(10, typeIds);
step.process(relationships, mock(BatchSender.class));
step.done();
// THEN
Object[] processed = step.getRelationshipTypes(100);
InOrder inOrder = inOrder(repository);
for (Object type : reversed(processed)) {
inOrder.verify(repository).getOrCreateId(type);
}
inOrder.verifyNoMoreInteractions();
}
Aggregations