Search in sources :

Example 46 with AtomicIntegerArray

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;
}
Also used : AtomicIntegerArray(java.util.concurrent.atomic.AtomicIntegerArray)

Example 47 with AtomicIntegerArray

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);
}
Also used : AtomicIntegerArray(java.util.concurrent.atomic.AtomicIntegerArray) Test(org.junit.Test)

Example 48 with AtomicIntegerArray

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);
}
Also used : AtomicIntegerArray(java.util.concurrent.atomic.AtomicIntegerArray) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 49 with AtomicIntegerArray

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);
}
Also used : AtomicIntegerArray(java.util.concurrent.atomic.AtomicIntegerArray)

Example 50 with AtomicIntegerArray

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);
}
Also used : AtomicIntegerArray(java.util.concurrent.atomic.AtomicIntegerArray) AtomicReference(java.util.concurrent.atomic.AtomicReference) CountDownLatch(java.util.concurrent.CountDownLatch) Test(org.junit.Test)

Aggregations

AtomicIntegerArray (java.util.concurrent.atomic.AtomicIntegerArray)74 Test (org.junit.Test)28 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)11 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)10 AtomicReference (java.util.concurrent.atomic.AtomicReference)8 CountDownLatch (java.util.concurrent.CountDownLatch)7 List (java.util.List)5 AtomicLongArray (java.util.concurrent.atomic.AtomicLongArray)4 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)4 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)4 ArrayList (java.util.ArrayList)3 Random (java.util.Random)3 AtomicLong (java.util.concurrent.atomic.AtomicLong)3 CacheException (javax.cache.CacheException)3 SqlFieldsQuery (org.apache.ignite.cache.query.SqlFieldsQuery)3 IgniteEx (org.apache.ignite.internal.IgniteEx)3 GridRandom (org.apache.ignite.internal.util.GridRandom)3 CAX (org.apache.ignite.internal.util.typedef.CAX)3 AtomicIntegerArrayAssertBaseTest (org.assertj.core.api.AtomicIntegerArrayAssertBaseTest)3 JSONArray (com.alibaba.fastjson.JSONArray)2