use of com.hazelcast.internal.management.events.Event in project hazelcast by hazelcast.
the class WanOpenSourceAntiEntropyMcEventsTest method testConsistencyCheckAPI.
@Test
public void testConsistencyCheckAPI() {
HazelcastInstance hz = createHazelcastInstance();
NodeEngineImpl nodeEngine = getNodeEngineImpl(hz);
WanReplicationService wanService = nodeEngine.getWanReplicationService();
ManagementCenterService mcService = nodeEngine.getManagementCenterService();
List<Event> events = new LinkedList<>();
CountDownLatch latch = new CountDownLatch(1);
mcService.setEventListener(event -> {
events.add(event);
latch.countDown();
});
assertThrows(UnsupportedOperationException.class, () -> wanService.consistencyCheck(WAN_REPLICATION_NAME, WAN_PUBLISHER_ID, MAP_NAME));
assertOpenEventually(latch);
Event event = events.get(0);
assertTrue(event instanceof WanConsistencyCheckIgnoredEvent);
WanConsistencyCheckIgnoredEvent checkIgnoredEvent = (WanConsistencyCheckIgnoredEvent) event;
assertNotNull(checkIgnoredEvent.getUuid());
assertEquals(MAP_NAME, checkIgnoredEvent.getMapName());
}
use of com.hazelcast.internal.management.events.Event in project hazelcast by hazelcast.
the class WanOpenSourceAntiEntropyMcEventsTest method testSyncAPI.
@Test
public void testSyncAPI() {
HazelcastInstance hz = createHazelcastInstance();
NodeEngineImpl nodeEngine = getNodeEngineImpl(hz);
WanReplicationService wanService = nodeEngine.getWanReplicationService();
ManagementCenterService mcService = nodeEngine.getManagementCenterService();
List<Event> events = new LinkedList<>();
CountDownLatch latch = new CountDownLatch(1);
mcService.setEventListener(event -> {
events.add(event);
latch.countDown();
});
assertThrows(UnsupportedOperationException.class, () -> wanService.syncMap(WAN_REPLICATION_NAME, WAN_PUBLISHER_ID, MAP_NAME));
assertOpenEventually(latch);
Event event = events.get(0);
assertTrue(event instanceof WanSyncIgnoredEvent);
WanSyncIgnoredEvent syncIgnoredEvent = (WanSyncIgnoredEvent) event;
assertNotNull(syncIgnoredEvent.getUuid());
assertEquals(MAP_NAME, syncIgnoredEvent.getMapName());
}
use of com.hazelcast.internal.management.events.Event in project hazelcast by hazelcast.
the class WanOpenSourceAntiEntropyMcEventsTest method testAllMapsSyncAPI.
@Test
public void testAllMapsSyncAPI() {
HazelcastInstance hz = createHazelcastInstance();
NodeEngineImpl nodeEngine = getNodeEngineImpl(hz);
WanReplicationService wanService = nodeEngine.getWanReplicationService();
ManagementCenterService mcService = nodeEngine.getManagementCenterService();
List<Event> events = new LinkedList<>();
CountDownLatch latch = new CountDownLatch(1);
mcService.setEventListener(event -> {
events.add(event);
latch.countDown();
});
assertThrows(UnsupportedOperationException.class, () -> wanService.syncAllMaps(WAN_REPLICATION_NAME, WAN_PUBLISHER_ID));
assertOpenEventually(latch);
Event event = events.get(0);
assertTrue(event instanceof WanSyncIgnoredEvent);
WanSyncIgnoredEvent syncIgnoredEvent = (WanSyncIgnoredEvent) event;
assertNotNull(syncIgnoredEvent.getUuid());
assertNull(syncIgnoredEvent.getMapName());
}
use of com.hazelcast.internal.management.events.Event in project hazelcast by hazelcast.
the class WanOpenSourceAntiEntropyMcEventsTest method testSyncAllREST.
@Test
public void testSyncAllREST() throws Exception {
System.setProperty(HAZELCAST_TEST_USE_NETWORK, "true");
HazelcastInstance hz = createHazelcastInstance(getConfigWithRest());
HTTPCommunicator communicator = new HTTPCommunicator(hz);
NodeEngineImpl nodeEngine = getNodeEngineImpl(hz);
ManagementCenterService mcService = nodeEngine.getManagementCenterService();
List<Event> events = new LinkedList<>();
CountDownLatch latch = new CountDownLatch(1);
mcService.setEventListener(event -> {
events.add(event);
latch.countDown();
});
String jsonResult = communicator.syncMapsOverWAN(hz.getConfig().getClusterName(), "", WAN_REPLICATION_NAME, WAN_PUBLISHER_ID);
assertOpenEventually(latch);
JsonObject result = Json.parse(jsonResult).asObject();
Event event = events.get(0);
assertTrue(event instanceof WanSyncIgnoredEvent);
WanSyncIgnoredEvent syncIgnoredEvent = (WanSyncIgnoredEvent) event;
assertNotNull(syncIgnoredEvent.getUuid());
assertNull(result.getString("uuid", null));
assertNull(syncIgnoredEvent.getMapName());
assertEquals(WAN_SYNC_IGNORED, syncIgnoredEvent.getType());
}
use of com.hazelcast.internal.management.events.Event in project hazelcast by hazelcast.
the class WanOpenSourceAntiEntropyMcEventsTest method testConsistencyCheckREST.
@Test
public void testConsistencyCheckREST() throws Exception {
System.setProperty(HAZELCAST_TEST_USE_NETWORK, "true");
HazelcastInstance hz = createHazelcastInstance(getConfigWithRest());
HTTPCommunicator communicator = new HTTPCommunicator(hz);
NodeEngineImpl nodeEngine = getNodeEngineImpl(hz);
ManagementCenterService mcService = nodeEngine.getManagementCenterService();
List<Event> events = new LinkedList<>();
CountDownLatch latch = new CountDownLatch(1);
mcService.setEventListener(event -> {
events.add(event);
latch.countDown();
});
String jsonResult = communicator.wanMapConsistencyCheck(hz.getConfig().getClusterName(), "", WAN_REPLICATION_NAME, WAN_PUBLISHER_ID, MAP_NAME);
assertOpenEventually(latch);
JsonObject result = Json.parse(jsonResult).asObject();
Event event = events.get(0);
assertTrue(event instanceof WanConsistencyCheckIgnoredEvent);
WanConsistencyCheckIgnoredEvent checkIgnoredEvent = (WanConsistencyCheckIgnoredEvent) event;
assertNotNull(checkIgnoredEvent.getUuid());
assertNull(result.getString("uuid", null));
assertEquals(MAP_NAME, checkIgnoredEvent.getMapName());
assertEquals(WAN_CONSISTENCY_CHECK_IGNORED, checkIgnoredEvent.getType());
}
Aggregations