private String randomToken() { return random.among( TOKENS ); }
private String randomKey() { return random.among( TOKENS ); }
private Label randomLabel() { return Label.label( random.among( TOKENS ) ); }
private RelationshipType randomRelationshipType() { return RelationshipType.withName( random.among( TOKENS ) ); }
private Object[] generatePropertyValues( String[] propKeys, int keySizeLimitPerSlot, int wiggleRoomPerSlot ) { Object[] propValues = new Object[propKeys.length]; for ( int propKey = 0; propKey < propKeys.length; propKey++ ) { NamedDynamicValueGenerator among = random.among( NamedDynamicValueGenerator.values() ); propValues[propKey] = among.dynamicValue( keySizeLimitPerSlot, wiggleRoomPerSlot ); } return propValues; }
private long[] randomNodes( Ids[] ids ) { long[] nodeIds = new long[ids.length]; int cursor = 0; for ( Ids id : ids ) { if ( random.nextBoolean() ) { nodeIds[cursor++] = id.node.getId(); } } // If none was selected, then pick just one if ( cursor == 0 ) { nodeIds[cursor++] = random.among( ids ).node.getId(); } return Arrays.copyOf( nodeIds, cursor ); }
@Test public void allEntriesReaderMustCombineResultFromAllAccessors() { // given List<Long>[] parts = new List[aliveAccessors.length]; for ( int i = 0; i < parts.length; i++ ) { parts[i] = new ArrayList<>(); } for ( long i = 0; i < 10; i++ ) { random.among( parts ).add( i ); } mockAllEntriesReaders( parts ); // when Set<Long> result = Iterables.asSet( fusionIndexAccessor.newAllEntriesReader() ); // then for ( List<Long> part : parts ) { assertResultContainsAll( result, part ); } }
private GenericKey genericKeyStateWithSomePreviousState( ValueGenerator valueGenerator ) { GenericKey to = newKeyState(); if ( random.nextBoolean() ) { // Previous value NativeIndexKey.Inclusion inclusion = random.among( NativeIndexKey.Inclusion.values() ); Value value = valueGenerator.next(); to.writeValue( value, inclusion ); } // No previous state return to; }
Value value = random.among( allValues ); ValueGroup valueGroup = value.valueGroup();
cache.setCount( i, count, random.nextInt( numberOfTypes ), random.among( directions ) );
ValueGroup valueGroup = random.among( allValues ).valueGroup(); IndexQuery.RangePredicate<?> supportedQuery = IndexQuery.range( 0, valueGroup );
Relationship relationship = random.among( nodes ) .createRelationshipTo( random.among( nodes ), randomRelationshipType() ); if ( random.nextBoolean() ) random.among( nodes, node -> node.addLabel( randomLabel() ) ); random.among( nodes, node -> node.removeLabel( randomLabel() ) ); random.among( nodes, node -> node.setProperty( randomKey(), random.nextValueAsObject() ) ); random.among( nodes, node -> node.removeProperty( randomKey() ) ); random.among( nodes, node ->
ValueType type = random.among( types ); Value from = random.randomValues().nextValueOfType( type ); Value to = random.randomValues().nextValueOfType( type );
ValueType type = random.among( types ); Value from = random.randomValues().nextValueOfType( type ); Value to = random.randomValues().nextValueOfType( type );