Search in sources :

Example 1 with HazelcastInternalOSGiService

use of com.hazelcast.osgi.impl.HazelcastInternalOSGiService in project hazelcast by hazelcast.

the class HazelcastOSGiServiceTest method groupNameIsSetToDefaultGroupNameOfBundleWhenGroupingIsNotDisabled.

@Test
public void groupNameIsSetToDefaultGroupNameOfBundleWhenGroupingIsNotDisabled() {
    HazelcastInternalOSGiService service = getService();
    HazelcastOSGiInstance osgiInstance = service.newHazelcastInstance();
    assertEquals(HazelcastInternalOSGiService.DEFAULT_GROUP_NAME, osgiInstance.getConfig().getGroupConfig().getName());
    HazelcastInstance instance = osgiInstance.getDelegatedInstance();
    assertEquals(HazelcastInternalOSGiService.DEFAULT_GROUP_NAME, instance.getConfig().getGroupConfig().getName());
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) HazelcastInternalOSGiService(com.hazelcast.osgi.impl.HazelcastInternalOSGiService) Test(org.junit.Test) SlowTest(com.hazelcast.test.annotation.SlowTest)

Example 2 with HazelcastInternalOSGiService

use of com.hazelcast.osgi.impl.HazelcastInternalOSGiService in project hazelcast by hazelcast.

the class HazelcastOSGiServiceTest method newInstanceRegisteredAsServiceWhenRegistrationIsNotDisabled.

@Test
public void newInstanceRegisteredAsServiceWhenRegistrationIsNotDisabled() throws BundleException {
    HazelcastInternalOSGiService service = getService();
    service.newHazelcastInstance();
    assertNull(bundleContext.getServiceReference(HazelcastOSGiInstance.class.getName()));
}
Also used : HazelcastInternalOSGiService(com.hazelcast.osgi.impl.HazelcastInternalOSGiService) Test(org.junit.Test) SlowTest(com.hazelcast.test.annotation.SlowTest)

Example 3 with HazelcastInternalOSGiService

use of com.hazelcast.osgi.impl.HazelcastInternalOSGiService in project hazelcast by hazelcast.

the class HazelcastOSGiServiceTest method groupNameIsSetToSpecifiedGroupNameWhenGroupingIsNotDisabled.

@Test
public void groupNameIsSetToSpecifiedGroupNameWhenGroupingIsNotDisabled() {
    final String GROUP_NAME = "my-osgi-group";
    HazelcastInternalOSGiService service = getService();
    Config config = new Config();
    config.getGroupConfig().setName(GROUP_NAME);
    HazelcastOSGiInstance osgiInstance = service.newHazelcastInstance(config);
    assertEquals(GROUP_NAME, osgiInstance.getConfig().getGroupConfig().getName());
    HazelcastInstance instance = osgiInstance.getDelegatedInstance();
    assertEquals(GROUP_NAME, instance.getConfig().getGroupConfig().getName());
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) Config(com.hazelcast.config.Config) GroupConfig(com.hazelcast.config.GroupConfig) HazelcastInternalOSGiService(com.hazelcast.osgi.impl.HazelcastInternalOSGiService) Test(org.junit.Test) SlowTest(com.hazelcast.test.annotation.SlowTest)

Example 4 with HazelcastInternalOSGiService

use of com.hazelcast.osgi.impl.HazelcastInternalOSGiService in project hazelcast by hazelcast.

the class HazelcastOSGiServiceTest method allInstancesShutdownSuccessfully.

@Test
public void allInstancesShutdownSuccessfully() {
    Set<HazelcastOSGiInstance> osgiInstances = new HashSet<HazelcastOSGiInstance>();
    HazelcastInternalOSGiService service = getService();
    osgiInstances.add(service.newHazelcastInstance());
    osgiInstances.add(service.newHazelcastInstance(new Config("test-osgi-instance")));
    Set<HazelcastOSGiInstance> allOSGiInstances = service.getAllHazelcastInstances();
    for (HazelcastOSGiInstance osgiInstance : allOSGiInstances) {
        assertTrue(osgiInstance.getLifecycleService().isRunning());
        HazelcastInstance instance = osgiInstance.getDelegatedInstance();
        assertTrue(instance.getLifecycleService().isRunning());
    }
    service.shutdownAll();
    for (HazelcastOSGiInstance osgiInstance : osgiInstances) {
        assertFalse(osgiInstance.getLifecycleService().isRunning());
        HazelcastInstance instance = osgiInstance.getDelegatedInstance();
        assertFalse(instance.getLifecycleService().isRunning());
    }
    allOSGiInstances = service.getAllHazelcastInstances();
    assertEquals(0, allOSGiInstances.size());
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) Config(com.hazelcast.config.Config) GroupConfig(com.hazelcast.config.GroupConfig) HazelcastInternalOSGiService(com.hazelcast.osgi.impl.HazelcastInternalOSGiService) HashSet(java.util.HashSet) Test(org.junit.Test) SlowTest(com.hazelcast.test.annotation.SlowTest)

Example 5 with HazelcastInternalOSGiService

use of com.hazelcast.osgi.impl.HazelcastInternalOSGiService in project hazelcast by hazelcast.

the class HazelcastOSGiServiceTest method allInstancesRetrievedSuccessfully.

@Test
public void allInstancesRetrievedSuccessfully() {
    Set<HazelcastOSGiInstance> osgiInstances = new HashSet<HazelcastOSGiInstance>();
    HazelcastInternalOSGiService service = getService();
    osgiInstances.add(service.newHazelcastInstance());
    osgiInstances.add(service.newHazelcastInstance(new Config("test-osgi-instance")));
    Set<HazelcastOSGiInstance> allOSGiInstances = service.getAllHazelcastInstances();
    assertEquals(osgiInstances.size(), allOSGiInstances.size());
    assertContainsAll(allOSGiInstances, osgiInstances);
}
Also used : Config(com.hazelcast.config.Config) GroupConfig(com.hazelcast.config.GroupConfig) HazelcastInternalOSGiService(com.hazelcast.osgi.impl.HazelcastInternalOSGiService) HashSet(java.util.HashSet) Test(org.junit.Test) SlowTest(com.hazelcast.test.annotation.SlowTest)

Aggregations

HazelcastInternalOSGiService (com.hazelcast.osgi.impl.HazelcastInternalOSGiService)23 SlowTest (com.hazelcast.test.annotation.SlowTest)23 Test (org.junit.Test)23 HazelcastInstance (com.hazelcast.core.HazelcastInstance)13 Config (com.hazelcast.config.Config)11 GroupConfig (com.hazelcast.config.GroupConfig)11 HashSet (java.util.HashSet)3