use of com.oath.cyclops.util.SimpleTimer in project cyclops by aol.
the class ExponentialBackofWaitStrategyTest method testTakeable.
@Test
public void testTakeable() throws InterruptedException {
SimpleTimer timer = new SimpleTimer();
called = 0;
String result = new ExponentialBackofWaitStrategy<String>().take(takeable);
assertThat(result, equalTo("hello"));
assertThat(called, equalTo(150));
assertThat(timer.getElapsedNanoseconds(), greaterThan(10000000l));
}
use of com.oath.cyclops.util.SimpleTimer in project cyclops by aol.
the class ExponentialBackofWaitStrategyTest method testOfferable.
@Test
public void testOfferable() throws InterruptedException {
SimpleTimer timer = new SimpleTimer();
called = 0;
boolean result = new ExponentialBackofWaitStrategy<String>().offer(offerable);
assertThat(result, equalTo(true));
assertThat(called, equalTo(150));
assertThat(timer.getElapsedNanoseconds(), greaterThan(10000000l));
}
use of com.oath.cyclops.util.SimpleTimer in project cyclops by aol.
the class BaseSeqTest method judder.
@Test
public void judder() {
SimpleTimer timer = new SimpleTimer();
assertThat(of(1, 2, 3, 4, 5, 6).jitter(10000).collect(Collectors.toList()).size(), is(6));
assertThat(timer.getElapsedNanoseconds(), greaterThan(20000l));
}
use of com.oath.cyclops.util.SimpleTimer in project cyclops by aol.
the class BaseSeqTest method xPer.
@Test
public void xPer() {
System.out.println(of(1, 2, 3, 4, 5, 6).xPer(6, 1000, TimeUnit.NANOSECONDS).collect(Collectors.toList()));
SimpleTimer timer = new SimpleTimer();
assertThat(of(1, 2, 3, 4, 5, 6).xPer(6, 100000000, TimeUnit.NANOSECONDS).collect(Collectors.toList()).size(), is(6));
assertThat(timer.getElapsedNanoseconds(), lessThan(60000000l));
}
use of com.oath.cyclops.util.SimpleTimer in project cyclops by aol.
the class BatchingTest method judder.
@Test
public void judder() {
SimpleTimer timer = new SimpleTimer();
assertThat(of(1, 2, 3, 4, 5, 6).jitter(10000).collect(Collectors.toList()).size(), is(6));
assertThat(timer.getElapsedNanoseconds(), greaterThan(20000l));
}
Aggregations