use of java.util.concurrent.atomic.AtomicIntegerArray in project iep by Netflix.
the class RxHttpTest method notModified.
@Test
public void notModified() throws Exception {
int code = 304;
statusCode.set(code);
redirects.set(2);
AtomicIntegerArray expected = copy(statusCounts);
expected.addAndGet(code, 1);
final CountDownLatch latch = new CountDownLatch(1);
final AtomicReference<Throwable> throwable = new AtomicReference<>();
rxHttp.get(uri("/notModified")).subscribe(Actions.empty(), t -> {
throwable.set(t);
latch.countDown();
}, latch::countDown);
latch.await();
assertEquals(expected, statusCounts);
Assert.assertNull(throwable.get());
}
use of java.util.concurrent.atomic.AtomicIntegerArray in project iep by Netflix.
the class RxHttpTest method disablingRedirects.
@Test
public void disablingRedirects() throws Exception {
set(client + ".niws.client.FollowRedirects", "0");
set(client + ".niws.client.MaxAutoRetriesNextServer", "1");
int code = 302;
statusCode.set(code);
redirects.set(2);
AtomicIntegerArray expected = copy(statusCounts);
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);
t.printStackTrace();
latch.countDown();
}, latch::countDown);
latch.await();
Assert.assertNull(throwable.get());
assertEquals(expected, statusCounts);
}
use of java.util.concurrent.atomic.AtomicIntegerArray in project iep by Netflix.
the class RxHttpTest method postJsonString.
@Test
public void postJsonString() throws Exception {
int code = 200;
statusCode.set(code);
AtomicIntegerArray expected = copy(statusCounts);
expected.addAndGet(code, 1);
rxHttp.postJson(uri("/empty"), "{}").toBlocking().toFuture().get();
assertEquals(expected, statusCounts);
}
use of java.util.concurrent.atomic.AtomicIntegerArray in project iep by Netflix.
the class RxHttpTest method postForm.
@Test
public void postForm() throws Exception {
int code = 200;
statusCode.set(code);
AtomicIntegerArray expected = copy(statusCounts);
expected.addAndGet(code, 1);
final StringBuilder builder = new StringBuilder();
rxHttp.postForm(uri("/echo?foo=bar&name=John+Doe&pct=%2042%25")).flatMap(res -> {
Assert.assertEquals(200, res.getStatus().code());
return res.getContent();
}).toBlocking().forEach(byteBuf -> builder.append(byteBuf.toString(Charset.defaultCharset())));
assertEquals(expected, statusCounts);
Assert.assertEquals("foo=bar&name=John+Doe&pct=%2042%25", builder.toString());
}
use of java.util.concurrent.atomic.AtomicIntegerArray in project hazelcast-jet by hazelcast.
the class PostponedSnapshotTest method setup.
@Before
public void setup() {
instance = createJetMember();
latches = new AtomicIntegerArray(2);
}
Aggregations