use of com.hazelcast.topic.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.topic.ITopic in project hazelcast by hazelcast.
the class ClientReliableTopicTest method testRemoveListener.
@Test
public void testRemoveListener() {
ITopic topic = client.getReliableTopic(randomString());
MessageListener listener = new MessageListener() {
public void onMessage(Message message) {
}
};
UUID id = topic.addMessageListener(listener);
assertTrue(topic.removeMessageListener(id));
}
use of com.hazelcast.topic.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.topic.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());
assertFalse(result);
}
use of com.hazelcast.topic.ITopic in project hazelcast by hazelcast.
the class ClientReliableTopicTest method addMessageListener.
// ============== addMessageListener ==============================
@Test
public void addMessageListener() {
ITopic topic = client.getReliableTopic(randomString());
UUID id = topic.addMessageListener(new ReliableMessageListenerMock());
assertNotNull(id);
}
Aggregations