use of org.springframework.test.annotation.Repeat in project opennms by OpenNMS.
the class AsyncDetectorFileDescriptorLeakTest method testNoServerPresent.
@Test
@Repeat(10000)
public void testNoServerPresent() throws Exception {
AsyncAbstractDetector detector = getNewDetector(1999, ".*");
LOG.info("Starting testNoServerPresent with detector: {}\n", detector);
final DetectFuture future = detector.isServiceDetected(InetAddressUtils.getLocalHostAddress());
assertNotNull(future);
future.awaitFor();
assertFalse("False positive during detection!!", future.isServiceDetected());
assertNull(future.getException());
LOG.info("Finished testNoServerPresent with detector: {}\n", detector);
}
use of org.springframework.test.annotation.Repeat in project spring-integration by spring-projects.
the class FileReadingMessageSourceIntegrationTests method concurrentProcessing.
@Test
@Repeat(5)
public void concurrentProcessing() throws Exception {
CountDownLatch go = new CountDownLatch(1);
Runnable successfulConsumer = () -> {
Message<File> received = pollableFileSource.receive();
while (received == null) {
Thread.yield();
received = pollableFileSource.receive();
}
};
Runnable failingConsumer = () -> {
Message<File> received = pollableFileSource.receive();
if (received != null) {
pollableFileSource.onFailure(received);
}
};
CountDownLatch successfulDone = doConcurrently(3, successfulConsumer, go);
CountDownLatch failingDone = doConcurrently(10, failingConsumer, go);
go.countDown();
try {
successfulDone.await();
failingDone.await();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
// make sure three different files were taken
Message<File> received = pollableFileSource.receive();
assertNull(received);
}
Aggregations