use of com.oath.cyclops.util.SimpleTimer in project cyclops by aol.
the class SyncBatchingTest method onePer.
@Test
public void onePer() {
SimpleTimer timer = new SimpleTimer();
System.out.println(of(1, 2, 3, 4, 5, 6).onePer(1000, TimeUnit.NANOSECONDS).collect(Collectors.toList()));
assertThat(of(1, 2, 3, 4, 5, 6).onePer(1000, TimeUnit.NANOSECONDS).collect(Collectors.toList()).size(), is(6));
assertThat(timer.getElapsedNanoseconds(), greaterThan(600l));
}
use of com.oath.cyclops.util.SimpleTimer in project cyclops by aol.
the class AsyncRSBatchingTest method onePer.
@Test
public void onePer() {
SimpleTimer timer = new SimpleTimer();
System.out.println(of(1, 2, 3, 4, 5, 6).onePer(1000, TimeUnit.NANOSECONDS).collect(Collectors.toList()));
assertThat(of(1, 2, 3, 4, 5, 6).onePer(1000, TimeUnit.NANOSECONDS).collect(Collectors.toList()).size(), is(6));
assertThat(timer.getElapsedNanoseconds(), greaterThan(600l));
}
use of com.oath.cyclops.util.SimpleTimer in project cyclops by aol.
the class AlgorithmCompareTest method testFastest.
@Test
public void testFastest() throws InterruptedException, ExecutionException {
ArrayList<Integer> arrayList = new ArrayList<>();
LinkedList<Integer> linkedList = new LinkedList<>();
for (int i = 0; i < 1001; i++) {
arrayList.add(i);
linkedList.add(i);
}
SimpleTimer timer = new SimpleTimer();
Result result = new SimpleReact().<Result>ofAsync(() -> Result.builder().name("approach1").result(retrieval(arrayList)).build(), () -> Result.builder().name("approach2").result(retrieval(linkedList)).build()).then(it -> it.withTime(timer.getElapsedNanoseconds())).filter(it -> it.getResult() == 1000).block().firstValue(null);
assertThat(result.getName(), is("approach1"));
}
use of com.oath.cyclops.util.SimpleTimer in project cyclops by aol.
the class BatchingTest method fixedDelay.
@Test
public void fixedDelay() {
SimpleTimer timer = new SimpleTimer();
assertThat(DuplicationTest.of(1, 2, 3, 4, 5, 6).fixedDelay(10000, TimeUnit.NANOSECONDS).collect(Collectors.toList()).size(), is(6));
assertThat(timer.getElapsedNanoseconds(), greaterThan(60000l));
}
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(DuplicationTest.of(1, 2, 3, 4, 5, 6).jitter(10000).collect(Collectors.toList()).size(), is(6));
assertThat(timer.getElapsedNanoseconds(), greaterThan(20000l));
}
Aggregations