Search in sources :

Example 6 with ManagementCenterService

use of com.hazelcast.internal.management.ManagementCenterService 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());
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) Accessors.getNodeEngineImpl(com.hazelcast.test.Accessors.getNodeEngineImpl) HazelcastInstance(com.hazelcast.core.HazelcastInstance) ManagementCenterService(com.hazelcast.internal.management.ManagementCenterService) Event(com.hazelcast.internal.management.events.Event) WanConsistencyCheckIgnoredEvent(com.hazelcast.internal.management.events.WanConsistencyCheckIgnoredEvent) WanSyncIgnoredEvent(com.hazelcast.internal.management.events.WanSyncIgnoredEvent) WanSyncIgnoredEvent(com.hazelcast.internal.management.events.WanSyncIgnoredEvent) CountDownLatch(java.util.concurrent.CountDownLatch) LinkedList(java.util.LinkedList) Test(org.junit.Test)

Example 7 with ManagementCenterService

use of com.hazelcast.internal.management.ManagementCenterService 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());
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) Accessors.getNodeEngineImpl(com.hazelcast.test.Accessors.getNodeEngineImpl) HazelcastInstance(com.hazelcast.core.HazelcastInstance) ManagementCenterService(com.hazelcast.internal.management.ManagementCenterService) Event(com.hazelcast.internal.management.events.Event) WanConsistencyCheckIgnoredEvent(com.hazelcast.internal.management.events.WanConsistencyCheckIgnoredEvent) WanSyncIgnoredEvent(com.hazelcast.internal.management.events.WanSyncIgnoredEvent) WanSyncIgnoredEvent(com.hazelcast.internal.management.events.WanSyncIgnoredEvent) CountDownLatch(java.util.concurrent.CountDownLatch) LinkedList(java.util.LinkedList) Test(org.junit.Test)

Example 8 with ManagementCenterService

use of com.hazelcast.internal.management.ManagementCenterService 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());
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) Accessors.getNodeEngineImpl(com.hazelcast.test.Accessors.getNodeEngineImpl) HazelcastInstance(com.hazelcast.core.HazelcastInstance) ManagementCenterService(com.hazelcast.internal.management.ManagementCenterService) Event(com.hazelcast.internal.management.events.Event) WanConsistencyCheckIgnoredEvent(com.hazelcast.internal.management.events.WanConsistencyCheckIgnoredEvent) WanSyncIgnoredEvent(com.hazelcast.internal.management.events.WanSyncIgnoredEvent) JsonObject(com.hazelcast.internal.json.JsonObject) WanSyncIgnoredEvent(com.hazelcast.internal.management.events.WanSyncIgnoredEvent) CountDownLatch(java.util.concurrent.CountDownLatch) LinkedList(java.util.LinkedList) HTTPCommunicator(com.hazelcast.internal.ascii.HTTPCommunicator) Test(org.junit.Test)

Example 9 with ManagementCenterService

use of com.hazelcast.internal.management.ManagementCenterService in project hazelcast by hazelcast.

the class Node method start.

void start() {
    nodeEngine.start();
    initializeListeners(config);
    hazelcastInstance.lifecycleService.fireLifecycleEvent(LifecycleState.STARTING);
    clusterService.sendLocalMembershipEvent();
    connectionManager.start();
    if (config.getNetworkConfig().getJoin().getMulticastConfig().isEnabled()) {
        final Thread multicastServiceThread = new Thread(hazelcastThreadGroup.getInternalThreadGroup(), multicastService, hazelcastThreadGroup.getThreadNamePrefix("MulticastThread"));
        multicastServiceThread.start();
    }
    if (properties.getBoolean(DISCOVERY_SPI_ENABLED)) {
        discoveryService.start();
        // Discover local metadata from environment and merge into member attributes
        mergeEnvironmentProvidedMemberMetadata();
    }
    if (properties.getBoolean(SHUTDOWNHOOK_ENABLED)) {
        logger.finest("Adding ShutdownHook");
        Runtime.getRuntime().addShutdownHook(shutdownHookThread);
    }
    state = NodeState.ACTIVE;
    nodeExtension.beforeJoin();
    join();
    int clusterSize = clusterService.getSize();
    if (config.getNetworkConfig().isPortAutoIncrement() && address.getPort() >= config.getNetworkConfig().getPort() + clusterSize) {
        logger.warning("Config seed port is " + config.getNetworkConfig().getPort() + " and cluster size is " + clusterSize + ". Some of the ports seem occupied!");
    }
    try {
        managementCenterService = new ManagementCenterService(hazelcastInstance);
    } catch (Exception e) {
        logger.warning("ManagementCenterService could not be constructed!", e);
    }
    nodeExtension.afterStart();
    phoneHome.check(this, getBuildInfo().getVersion(), buildInfo.isEnterprise());
}
Also used : ManagementCenterService(com.hazelcast.internal.management.ManagementCenterService)

Example 10 with ManagementCenterService

use of com.hazelcast.internal.management.ManagementCenterService in project hazelcast by hazelcast.

the class UpdateManagementCenterUrlOperation method run.

@Override
public void run() throws Exception {
    ManagementCenterService service = ((NodeEngineImpl) getNodeEngine()).getManagementCenterService();
    int count = 0;
    while (service == null && count < REDO_COUNT) {
        Thread.sleep(SLEEP_MILLIS);
        count++;
        service = ((NodeEngineImpl) getNodeEngine()).getManagementCenterService();
    }
    if (service != null) {
        service.updateManagementCenterUrl(newUrl);
    }
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) ManagementCenterService(com.hazelcast.internal.management.ManagementCenterService)

Aggregations

ManagementCenterService (com.hazelcast.internal.management.ManagementCenterService)13 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)8 HazelcastInstance (com.hazelcast.core.HazelcastInstance)7 Test (org.junit.Test)7 Event (com.hazelcast.internal.management.events.Event)6 WanConsistencyCheckIgnoredEvent (com.hazelcast.internal.management.events.WanConsistencyCheckIgnoredEvent)6 WanSyncIgnoredEvent (com.hazelcast.internal.management.events.WanSyncIgnoredEvent)6 Accessors.getNodeEngineImpl (com.hazelcast.test.Accessors.getNodeEngineImpl)6 LinkedList (java.util.LinkedList)6 CountDownLatch (java.util.concurrent.CountDownLatch)6 HTTPCommunicator (com.hazelcast.internal.ascii.HTTPCommunicator)3 JsonObject (com.hazelcast.internal.json.JsonObject)3 HazelcastException (com.hazelcast.core.HazelcastException)2 Config (com.hazelcast.config.Config)1 JoinConfig (com.hazelcast.config.JoinConfig)1 ManagementCenterConfig (com.hazelcast.config.ManagementCenterConfig)1 ClientBwListDTO (com.hazelcast.internal.management.dto.ClientBwListDTO)1 CALLER_RUNS (com.hazelcast.internal.util.ConcurrencyUtil.CALLER_RUNS)1 ExceptionUtil.peel (com.hazelcast.internal.util.ExceptionUtil.peel)1 ExceptionUtil.withTryCatch (com.hazelcast.internal.util.ExceptionUtil.withTryCatch)1