Package com.hazelcast.client

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


        mm.put("key2", "value1");
        mm.put("key2", "value2");

        final SimpleClient client = getClient();
        client.send(new GetAllRequest(name, ss.toData("key1")));
        PortableCollection result = (PortableCollection) client.receive();
        Collection<Data> coll = result.getCollection();
        assertEquals(1, coll.size());
        assertEquals("value1", ss.toObject(coll.iterator().next()));
View Full Code Here


        PortableCollection result = (PortableCollection) client.receive();
        Collection<Data> coll = result.getCollection();
        assertEquals(1, coll.size());
        assertEquals("value1", ss.toObject(coll.iterator().next()));

        client.send(new GetAllRequest(name, ss.toData("key2")));
        result = (PortableCollection) client.receive();
        coll = result.getCollection();
        assertEquals(2, coll.size());
    }
View Full Code Here

        mm.put("key2", "value1");
        mm.put("key2", "value2");

        final SimpleClient client = getClient();
        client.send(new KeySetRequest(name));
        PortableCollection result = (PortableCollection) client.receive();
        Collection<Data> keySet = result.getCollection();
        assertEquals(2, keySet.size());

        String s = (String) ss.toObject(keySet.iterator().next());
View Full Code Here

    @Test
    public void testPut() throws IOException {
        MultiMap<Object, Object> mm = getMultiMap();

        final SimpleClient client = getClient();
        client.send(new PutRequest(name, ss.toData("key1"), ss.toData("value1"), -1, getThreadId()));
        boolean result = (Boolean) client.receive();
        assertTrue(result);
        assertEquals("value1", mm.get("key1").iterator().next());

        client.send(new PutRequest(name, ss.toData("key1"), ss.toData("value1"), -1, getThreadId()));
View Full Code Here

        client.send(new PutRequest(name, ss.toData("key1"), ss.toData("value1"), -1, getThreadId()));
        boolean result = (Boolean) client.receive();
        assertTrue(result);
        assertEquals("value1", mm.get("key1").iterator().next());

        client.send(new PutRequest(name, ss.toData("key1"), ss.toData("value1"), -1, getThreadId()));
        result = (Boolean) client.receive();
        assertFalse(result);

        assertEquals(1, mm.size());
View Full Code Here

        mm.put("key2", "value1");
        mm.put("key2", "value2");

        final SimpleClient client = getClient();
        client.send(new RemoveAllRequest(name, ss.toData("key1"), getThreadId()));
        PortableCollection result = (PortableCollection) client.receive();
        Collection<Data> coll = result.getCollection();
        assertEquals(1, coll.size());
        assertEquals("value1", ss.toObject(coll.iterator().next()));
View Full Code Here

        PortableCollection result = (PortableCollection) client.receive();
        Collection<Data> coll = result.getCollection();
        assertEquals(1, coll.size());
        assertEquals("value1", ss.toObject(coll.iterator().next()));

        client.send(new RemoveAllRequest(name, ss.toData("key2"), getThreadId()));
        result = (PortableCollection) client.receive();
        coll = result.getCollection();
        assertEquals(2, coll.size());
        assertEquals(0, mm.size());
    }
View Full Code Here

        mm.put("key2", "value1");
        mm.put("key2", "value2");
        mm.put("key3", "value2");

        final SimpleClient client = getClient();
        client.send(new SizeRequest(name));
        int result = (Integer) client.receive();
        assertEquals(result, 4);
        assertEquals(result, mm.size());
    }
View Full Code Here

        mm.put("key2", "value1");
        mm.put("key2", "value2");
        mm.put("key3", "value2");

        final SimpleClient client = getClient();
        client.send(new ValuesRequest(name));
        PortableCollection result = (PortableCollection) client.receive();
        Collection<Data> coll = result.getCollection();
        assertEquals(4, coll.size());

        for (Data data : coll) {
View Full Code Here

    }

    @Test
    public void testListener() throws IOException {
        final SimpleClient client = getClient();
        client.send(new AddEntryListenerRequest(name, null, true));
        client.receive();

        getMultiMap().put("key1", "value1");

        PortableEntryEvent result = (PortableEntryEvent) client.receive();
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.