Package com.hazelcast.client

Examples of com.hazelcast.client.SimpleClient.receive()


    @Test
    public void testKeyListener() throws IOException {
        final SimpleClient client = getClient();
        client.send(new AddEntryListenerRequest(name, ss.toData("key2"), true));
        client.receive();

        final MultiMap<Object, Object> multiMap = getMultiMap();
        multiMap.put("key1", "value1");
        multiMap.put("key2", "value8");
View Full Code Here


        final MultiMap<Object, Object> multiMap = getMultiMap();
        multiMap.put("key1", "value1");
        multiMap.put("key2", "value8");

        PortableEntryEvent result = (PortableEntryEvent) client.receive();
        assertEquals("key2", ss.toObject(result.getKey()));
        assertEquals("value8", ss.toObject(result.getValue()));
    }

    private MultiMap<Object, Object> getMultiMap() {
View Full Code Here

    @Test
    public void testAwait() throws IOException {
        final SimpleClient client = getClient();
        client.send(new AwaitRequest(name, timeout));
        boolean result = (Boolean) client.receive();

        assertTrue(result);
    }

    @Test
View Full Code Here

    public void testCountDown() throws IOException {
        ICountDownLatch countDownLatch = getCountDownLatch();
        countDownLatch.trySetCount(1);
        final SimpleClient client = getClient();
        client.send(new CountDownRequest(name));
        client.receive();

        assertEquals(0, countDownLatch.getCount());
    }

View Full Code Here

    @Test
    public void testAddAndGet() throws Exception {
        final SimpleClient client = getClient();
        client.send(new AddAndGetRequest(name, 3));
        long result = (Long) client.receive();
        assertEquals(3, result);

        client.send(new AddAndGetRequest(name, 4));
        result = (Long) client.receive();
        assertEquals(7, result);
View Full Code Here

        client.send(new AddAndGetRequest(name, 3));
        long result = (Long) client.receive();
        assertEquals(3, result);

        client.send(new AddAndGetRequest(name, 4));
        result = (Long) client.receive();
        assertEquals(7, result);
    }

    @Test
    public void testCompareAndSet() throws Exception {
View Full Code Here

        IAtomicLong atomicLong = getAtomicLong();
        atomicLong.set(11);

        final SimpleClient client = getClient();
        client.send(new CompareAndSetRequest(name, 9, 5));
        boolean result = (Boolean) client.receive();
        assertFalse(result);
        assertEquals(11, atomicLong.get());

        client.send(new CompareAndSetRequest(name, 11, 5));
        result = (Boolean) client.receive();
View Full Code Here

        boolean result = (Boolean) client.receive();
        assertFalse(result);
        assertEquals(11, atomicLong.get());

        client.send(new CompareAndSetRequest(name, 11, 5));
        result = (Boolean) client.receive();
        assertTrue(result);
        assertEquals(5, atomicLong.get());
    }

    @Test
View Full Code Here

        IAtomicLong atomicLong = getAtomicLong();
        atomicLong.set(11);

        final SimpleClient client = getClient();
        client.send(new GetAndAddRequest(name, 4));
        long result = (Long) client.receive();
        assertEquals(11, result);
        assertEquals(15, atomicLong.get());
    }

    @Test
View Full Code Here

        IAtomicLong atomicLong = getAtomicLong();
        atomicLong.set(11);

        final SimpleClient client = getClient();
        client.send(new GetAndSetRequest(name, 9));
        long result = (Long) client.receive();
        assertEquals(11, result);
        assertEquals(9, atomicLong.get());
    }

    @Test
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.