Package com.hazelcast.client

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


    @Test
    public void testPoll() throws IOException {
        final IQueue q = getQueue();
        final SimpleClient client = getClient();
        client.send(new PollRequest(queueName));
        Object result = client.receive();
        assertNull(result);

        q.offer("item1");
        client.send(new PollRequest(queueName));
View Full Code Here


        client.send(new PollRequest(queueName));
        Object result = client.receive();
        assertNull(result);

        q.offer("item1");
        client.send(new PollRequest(queueName));
        result = client.receive();
        assertEquals("item1", result);
        assertEquals(0, q.size());

        new Thread() {
View Full Code Here

                    e.printStackTrace();
                }
                q.offer("item2");
            }
        }.start();
        client.send(new PollRequest(queueName, 10 * 1000));
        result = client.receive();
        assertEquals("item2", result);
        assertEquals(0, q.size());
    }

View Full Code Here

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

        final SimpleClient client = getClient();
        client.send(new RemoveRequest(queueName, ss.toData("item2")));
        Boolean result = (Boolean) client.receive();
        assertTrue(result);
        assertEquals(2, q.size());

        client.send(new RemoveRequest(queueName, ss.toData("item2")));
View Full Code Here

        client.send(new RemoveRequest(queueName, ss.toData("item2")));
        Boolean result = (Boolean) client.receive();
        assertTrue(result);
        assertEquals(2, q.size());

        client.send(new RemoveRequest(queueName, ss.toData("item2")));
        result = (Boolean) client.receive();
        assertFalse(result);
        assertEquals(2, q.size());
    }
View Full Code Here

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

        final SimpleClient client = getClient();
        client.send(new SizeRequest(queueName));
        int result = (Integer) client.receive();
        assertEquals(result, q.size());
    }

    @Test
View Full Code Here

    @Test
    public void testIsEmpty() throws IOException {
        final IQueue queue = getQueue();

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

        IQueue queue = getQueue();
        queue.offer("item1");
        queue.offer("item2");

        final SimpleClient client = getClient();
        client.send(new RemainingCapacityRequest(queueName));
        int result = (Integer) client.receive();
        assertEquals(4, result);
    }

    @Test
View Full Code Here

                assertEquals(2, addCounter.get());
            }
        });

        final SimpleClient client = getClient();
        client.send(new RemoveListenerRequest(queueName, registrationId));
        boolean result = (Boolean) client.receive();

        assertTrue(result);
        queue.offer("item3");
        assertSizeEventually(3, queue);
View Full Code Here

        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());
        client.send(new MapGetRequest(mapName, TestUtil.toData(1)));
        assertEquals(7, 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.