use of java.util.concurrent.atomic.AtomicIntegerArray in project MyPerf4J by ThinkpadNC5.
the class RecordMemSaveTest method initArr.
private static AtomicIntegerArray initArr() {
AtomicIntegerArray arr = new AtomicIntegerArray(7);
arr.set(0, 10);
arr.set(1, 11);
arr.set(2, 12);
arr.set(3, 13);
arr.set(4, 14);
arr.set(5, 0);
arr.set(6, 0);
return arr;
}
use of java.util.concurrent.atomic.AtomicIntegerArray in project iep by Netflix.
the class RxHttpTest method delete.
@Test
public void delete() throws Exception {
int code = 200;
statusCode.set(code);
AtomicIntegerArray expected = copy(statusCounts);
expected.addAndGet(code, 1);
rxHttp.delete(uri("/empty").toString()).toBlocking().toFuture().get();
assertEquals(expected, statusCounts);
}
use of java.util.concurrent.atomic.AtomicIntegerArray in project iep by Netflix.
the class RxHttpTest method head.
@Test
public void head() throws Exception {
int code = 200;
statusCode.set(code);
AtomicIntegerArray expected = copy(statusCounts);
expected.addAndGet(code, 1);
rxHttp.submit(HttpClientRequest.<ByteBuf>create(HttpMethod.HEAD, uri("/empty").toString())).toBlocking().toFuture().get();
assertEquals(expected, statusCounts);
}
use of java.util.concurrent.atomic.AtomicIntegerArray in project iep by Netflix.
the class RxHttpTest method codeTest.
private void codeTest(int code, int attempts) throws Exception {
statusCode.set(code);
AtomicIntegerArray expected = copy(statusCounts);
expected.addAndGet(code, attempts);
rxHttp.get(uri("/empty")).toBlocking().toFuture().get();
assertEquals(expected, statusCounts);
}
use of java.util.concurrent.atomic.AtomicIntegerArray in project iep by Netflix.
the class RxHttpTest method relativeRedirect.
@Test
public void relativeRedirect() throws Exception {
set(client + ".niws.client.FollowRedirects", "3");
int code = 200;
statusCode.set(code);
redirects.set(2);
AtomicIntegerArray expected = copy(statusCounts);
expected.addAndGet(302, 2);
expected.addAndGet(code, 1);
final CountDownLatch latch = new CountDownLatch(1);
final AtomicReference<Throwable> throwable = new AtomicReference<>();
rxHttp.get(uri("/relativeRedirect")).subscribe(Actions.empty(), t -> {
throwable.set(t);
latch.countDown();
}, latch::countDown);
latch.await();
Assert.assertNull(throwable.get());
assertEquals(expected, statusCounts);
}
Aggregations