use of org.infinispan.server.hotrod.test.HotRodClient in project infinispan by infinispan.
the class AbstractHotRodClusterEventsTest method testNoEventReplayAfterAddingListenerInCluster.
public void testNoEventReplayAfterAddingListenerInCluster(Method m) {
HotRodClient client1 = clients().get(0);
HotRodClient client2 = clients().get(1);
HotRodClient client3 = clients().get(2);
byte[] k1 = k(m, "k1-");
byte[] v1 = v(m, "v1-");
byte[] k2 = k(m, "k2-");
byte[] v2 = v(m, "v2-");
byte[] k3 = k(m, "k3-");
byte[] v3 = v(m, "v3-");
client1.put(k1, 0, 0, v1);
client2.put(k2, 0, 0, v2);
client3.put(k3, 0, 0, v3);
EventLogListener listener1 = new EventLogListener();
withClientListener(client1, listener1, Optional.empty(), Optional.empty(), false, true, () -> {
listener1.expectNoEvents(Optional.empty());
client1.remove(k1);
listener1.expectOnlyRemovedEvent(anyCache(), k1);
client2.remove(k2);
listener1.expectOnlyRemovedEvent(anyCache(), k2);
client3.remove(k3);
listener1.expectOnlyRemovedEvent(anyCache(), k3);
});
}
use of org.infinispan.server.hotrod.test.HotRodClient in project infinispan by infinispan.
the class AbstractHotRodClusterEventsTest method testEventReplayAfterAddingListenerInCluster.
public void testEventReplayAfterAddingListenerInCluster(Method m) {
HotRodClient client1 = clients().get(0);
HotRodClient client2 = clients().get(1);
HotRodClient client3 = clients().get(2);
byte[] k1 = k(m, "k1-");
byte[] v1 = v(m, "v1-");
byte[] k2 = k(m, "k2-");
byte[] v2 = v(m, "v2-");
byte[] k3 = k(m, "k3-");
byte[] v3 = v(m, "v3-");
client1.put(k1, 0, 0, v1);
client2.put(k2, 0, 0, v2);
client3.put(k3, 0, 0, v3);
EventLogListener listener1 = new EventLogListener();
withClientListener(client1, listener1, Optional.empty(), Optional.empty(), true, true, () -> {
List<byte[]> keys = Arrays.asList(k1, k2, k3);
listener1.expectUnorderedEvents(anyCache(), keys, Event.Type.CACHE_ENTRY_CREATED);
client1.remove(k1);
listener1.expectOnlyRemovedEvent(anyCache(), k1);
client2.remove(k2);
listener1.expectOnlyRemovedEvent(anyCache(), k2);
client3.remove(k3);
listener1.expectOnlyRemovedEvent(anyCache(), k3);
});
}
use of org.infinispan.server.hotrod.test.HotRodClient in project infinispan by infinispan.
the class AbstractHotRodClusterEventsTest method testFilteringInCluster.
public void testFilteringInCluster(Method m) {
HotRodClient client1 = clients().get(0);
HotRodClient client2 = clients().get(1);
EventLogListener listener1 = new EventLogListener();
Optional<KeyValuePair<String, List<byte[]>>> filterFactory = Optional.of(new KeyValuePair<String, List<byte[]>>("accepted-key-filter-factory", Collections.emptyList()));
byte[] key1 = k(m, "k1-");
withClusterClientListener(client1, listener1, filterFactory, Optional.empty(), key1, false, () -> {
client2.put(k(m, "k-99"), 0, 0, v(m));
listener1.expectNoEvents(Optional.empty());
client2.remove(k(m, "k-99"));
listener1.expectNoEvents(Optional.empty());
client2.put(key1, 0, 0, v(m));
listener1.expectOnlyCreatedEvent(anyCache(), key1);
client1.remove(key1);
listener1.expectOnlyRemovedEvent(anyCache(), key1);
});
}
use of org.infinispan.server.hotrod.test.HotRodClient in project infinispan by infinispan.
the class AbstractHotRodClusterEventsTest method testParameterBasedFilteringInCluster.
public void testParameterBasedFilteringInCluster(Method m) {
HotRodClient client1 = clients().get(0);
HotRodClient client2 = clients().get(1);
EventLogListener listener1 = new EventLogListener();
byte[] dynamicAcceptedKey = new byte[] { 4, 5, 6 };
Optional<KeyValuePair<String, List<byte[]>>> filterFactory = Optional.of(new KeyValuePair<>("accepted-key-filter-factory", Collections.singletonList(dynamicAcceptedKey)));
withClusterClientListener(client1, listener1, filterFactory, Optional.empty(), null, false, () -> {
byte[] key1 = k(m, "k1-");
client2.put(k(m, "k-99"), 0, 0, v(m));
listener1.expectNoEvents(Optional.empty());
client2.remove(k(m, "k-99"));
listener1.expectNoEvents(Optional.empty());
client2.put(key1, 0, 0, v(m));
listener1.expectNoEvents(Optional.empty());
client2.put(dynamicAcceptedKey, 0, 0, v(m));
listener1.expectOnlyCreatedEvent(anyCache(), dynamicAcceptedKey);
client1.remove(dynamicAcceptedKey);
listener1.expectOnlyRemovedEvent(anyCache(), dynamicAcceptedKey);
});
}
use of org.infinispan.server.hotrod.test.HotRodClient in project infinispan by infinispan.
the class AbstractHotRodClusterEventsTest method testEventForwarding.
public void testEventForwarding(Method m) {
// Registering listener in one node and executing operations against
// different nodes should still result in events received
HotRodClient client1 = clients().get(0);
HotRodClient client2 = clients().get(1);
HotRodClient client3 = clients().get(2);
EventLogListener listener1 = new EventLogListener();
withClientListener(client1, listener1, Optional.empty(), Optional.empty(), false, true, () -> {
byte[] key = k(m);
client2.put(key, 0, 0, v(m));
listener1.expectOnlyCreatedEvent(anyCache(), key);
client3.put(key, 0, 0, v(m, "v2-"));
listener1.expectOnlyModifiedEvent(anyCache(), key);
client2.remove(key);
listener1.expectOnlyRemovedEvent(anyCache(), key);
});
}
Aggregations