@Test @Repeat( times = 100 ) public void shouldBeAbleToReadPropertiesFromNewNodeReturnedFromIndex() throws Exception { String propertyKey = UUID.randomUUID().toString(); String propertyValue = UUID.randomUUID().toString(); AtomicBoolean start = new AtomicBoolean( false ); int readerDelay = ThreadLocalRandom.current().nextInt( MAX_READER_DELAY_MS ); Writer writer = new Writer( db, propertyKey, propertyValue, start ); Reader reader = new Reader( db, propertyKey, propertyValue, start, readerDelay ); ExecutorService executor = Executors.newFixedThreadPool( 2 ); Future<?> readResult; Future<?> writeResult; try { writeResult = executor.submit( writer ); readResult = executor.submit( reader ); start.set( true ); } finally { executor.shutdown(); executor.awaitTermination( 20, TimeUnit.SECONDS ); } assertNull( writeResult.get() ); assertNull( readResult.get() ); }
@Test @RepeatRule.Repeat( times = 5 ) public void concurrentLabelTokenCreation() throws InterruptedException { int concurrentWorkers = 10; CountDownLatch latch = new CountDownLatch( concurrentWorkers ); for ( int i = 0; i < concurrentWorkers; i++ ) { new LabelCreator( databaseRule, latch ).start(); } LockSupport.parkNanos( TimeUnit.MILLISECONDS.toNanos( 500 ) ); stop = true; latch.await(); }
@Repeat( times = 100 ) @Test public void shouldKeepHighest() throws Throwable
@Repeat( times = 10 ) @Test public void shouldDeleteEverythingAboutTheDuplicatedNodes() throws Exception
@Test @RepeatRule.Repeat( times = 100 ) public void shouldVisitCreatedRelationshipsBeforeDeletedRelationships() throws Exception
@Test @RepeatRule.Repeat( times = 100 ) public void shouldVisitCreatedNodesBeforeDeletedNodes() throws Exception
@Test @RepeatRule.Repeat( times = 100 ) public void shouldVisitCreatedNodesBeforeCreatedRelationships() throws Exception
@Test @RepeatRule.Repeat( times = 100 ) public void shouldVisitDeletedNodesAfterDeletedRelationships() throws Exception
@Repeat( times = 10 ) @Test public void shouldCopeWithConcurrentIncrementOfProcessorsAndShutdown() throws Throwable { // GIVEN TaskExecutor<Void> executor = new DynamicTaskExecutor<>( 1, 2, 2, PARK, "test" ); Race race = new Race().withRandomStartDelays(); race.addContestant( executor::close ); race.addContestant( () -> executor.processors( 1 ) ); // WHEN race.go( 10, SECONDS ); // THEN we should be able to do so, there was a recent fix here and before that fix // shutdown() would hang, that's why we wait for 10 seconds here to cap it if there's an issue. }