use of com.hazelcast.core.ITopic in project hazelcast by hazelcast.
the class ClientReliableTopicTest method addMessageListener.
@Test
public void addMessageListener() {
ITopic topic = client.getReliableTopic(randomString());
String id = topic.addMessageListener(new ReliableMessageListenerMock());
assertNotNull(id);
}
use of com.hazelcast.core.ITopic in project hazelcast by hazelcast.
the class ClientReliableTopicTest method testGetLocalTopicStats.
@Test(expected = UnsupportedOperationException.class)
public void testGetLocalTopicStats() throws Exception {
ITopic topic = client.getReliableTopic(randomString());
topic.getLocalTopicStats();
}
use of com.hazelcast.core.ITopic in project hazelcast by hazelcast.
the class ClientReliableTopicTest method publishSingle.
// ============================================
@Test
public void publishSingle() throws InterruptedException {
ITopic topic = client.getReliableTopic(randomString());
final ReliableMessageListenerMock listener = new ReliableMessageListenerMock();
topic.addMessageListener(listener);
final String msg = "foobar";
topic.publish(msg);
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
assertContains(listener.objects, msg);
}
});
}
use of com.hazelcast.core.ITopic in project hazelcast by hazelcast.
the class ClientReliableTopicTest method publishMultiple.
@Test
public void publishMultiple() throws InterruptedException {
ITopic topic = client.getReliableTopic(randomString());
final ReliableMessageListenerMock listener = new ReliableMessageListenerMock();
topic.addMessageListener(listener);
final List<String> items = new ArrayList<String>();
for (int k = 0; k < 5; k++) {
items.add("" + k);
}
for (String item : items) {
topic.publish(item);
}
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
assertEquals(items, Arrays.asList(listener.objects.toArray()));
}
});
}
use of com.hazelcast.core.ITopic in project hazelcast by hazelcast.
the class ClientReliableTopicTest method removeMessageListener_whenNonExisting.
@Test
public void removeMessageListener_whenNonExisting() {
ITopic topic = client.getReliableTopic(randomString());
boolean result = topic.removeMessageListener(UUID.randomUUID().toString());
assertFalse(result);
}
Aggregations