Package com.hazelcast.client

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


        client.send(new CompareAndSetRequest(name, toData(null), toData("pipo")));
        assertEquals(Boolean.FALSE, client.receive());
        assertEquals("foo",reference.get());

        client.send(new CompareAndSetRequest(name, toData("bar"), toData("foo")));
        assertEquals(Boolean.FALSE, client.receive());
        assertEquals("foo",reference.get());

        client.send(new CompareAndSetRequest(name, toData("foo"), toData("bar")));
        assertEquals(Boolean.TRUE, client.receive());
View Full Code Here


        client.send(new CompareAndSetRequest(name, toData("bar"), toData("foo")));
        assertEquals(Boolean.FALSE, client.receive());
        assertEquals("foo",reference.get());

        client.send(new CompareAndSetRequest(name, toData("foo"), toData("bar")));
        assertEquals(Boolean.TRUE, client.receive());
        assertEquals("bar",reference.get());

        client.send(new CompareAndSetRequest(name, toData("bar"), toData(null)));
        assertEquals(Boolean.TRUE, client.receive());
View Full Code Here

        client.send(new CompareAndSetRequest(name, toData("foo"), toData("bar")));
        assertEquals(Boolean.TRUE, client.receive());
        assertEquals("bar",reference.get());

        client.send(new CompareAndSetRequest(name, toData("bar"), toData(null)));
        assertEquals(Boolean.TRUE, client.receive());
        assertEquals(null,reference.get());
    }

    public Data toData(Object o){
View Full Code Here

    }

    @Test
    public void testPutGetSet() throws IOException {
        final SimpleClient client = getClient();
        client.send(new MapPutRequest(mapName, TestUtil.toData(1), TestUtil.toData(3), ThreadUtil.getThreadId()));
        assertNull(client.receive());
        client.send(new MapPutRequest(mapName, TestUtil.toData(1), TestUtil.toData(5), ThreadUtil.getThreadId()));
        assertEquals(3, client.receive());
        client.send(new MapGetRequest(mapName, TestUtil.toData(1)));
        assertEquals(5, client.receive());
View Full Code Here

    @Test
    public void testPutGetSet() throws IOException {
        final SimpleClient client = getClient();
        client.send(new MapPutRequest(mapName, TestUtil.toData(1), TestUtil.toData(3), ThreadUtil.getThreadId()));
        assertNull(client.receive());
        client.send(new MapPutRequest(mapName, TestUtil.toData(1), TestUtil.toData(5), ThreadUtil.getThreadId()));
        assertEquals(3, client.receive());
        client.send(new MapGetRequest(mapName, TestUtil.toData(1)));
        assertEquals(5, client.receive());
        client.send(new MapGetRequest(mapName, TestUtil.toData(7)));
        assertNull(client.receive());
View Full Code Here

        final SimpleClient client = getClient();
        client.send(new MapPutRequest(mapName, TestUtil.toData(1), TestUtil.toData(3), ThreadUtil.getThreadId()));
        assertNull(client.receive());
        client.send(new MapPutRequest(mapName, TestUtil.toData(1), TestUtil.toData(5), ThreadUtil.getThreadId()));
        assertEquals(3, client.receive());
        client.send(new MapGetRequest(mapName, TestUtil.toData(1)));
        assertEquals(5, client.receive());
        client.send(new MapGetRequest(mapName, TestUtil.toData(7)));
        assertNull(client.receive());
        client.send(new MapSetRequest(mapName, TestUtil.toData(1), TestUtil.toData(7), ThreadUtil.getThreadId()));
        assertFalse((Boolean) client.receive());
View Full Code Here

        list.add(ss.toData("item1"));
        list.add(ss.toData("item2"));
        list.add(ss.toData("item3"));
        list.add(ss.toData("item4"));
        final SimpleClient client = getClient();
        client.send(new AddAllRequest(queueName, list));
        Object result = client.receive();
        assertTrue((Boolean) result);
        int size = getQueue().size();
        assertEquals(size, list.size());
    }
View Full Code Here

    }

    @Test
    public void testAddListener() throws IOException {
        final SimpleClient client = getClient();
        client.send(new AddListenerRequest(queueName, true));
        client.receive();
        getQueue().offer("item");

        PortableItemEvent result = (PortableItemEvent) client.receive();
        assertEquals("item", ss.toObject(result.getItem()));
View Full Code Here

        q.offer("item1");
        q.offer("item2");
        q.offer("item3");

        final SimpleClient client = getClient();
        client.send(new ClearRequest(queueName));
        Object result = client.receive();
        assertTrue((Boolean) result);
        assertEquals(0, q.size());
    }
View Full Code Here

        List<Data> list = new ArrayList<Data>();
        list.add(ss.toData("item1"));
        list.add(ss.toData("item2"));

        final SimpleClient client = getClient();
        client.send(new CompareAndRemoveRequest(queueName, list, true));
        Boolean result = (Boolean) client.receive();
        assertTrue(result);
        assertEquals(2, q.size());

        client.send(new CompareAndRemoveRequest(queueName, list, false));
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.