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()));
}
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());
}
use of com.hazelcast.osgi.impl.HazelcastInternalOSGiService in project hazelcast by hazelcast.
the class HazelcastOSGiServiceTest method clusterNameIsSetToDefaultClusterNameOfBundleWhenGroupingIsNotDisabled.
@Test
public void clusterNameIsSetToDefaultClusterNameOfBundleWhenGroupingIsNotDisabled() {
HazelcastInternalOSGiService service = getService();
HazelcastOSGiInstance osgiInstance = service.newHazelcastInstance();
assertEquals(HazelcastInternalOSGiService.DEFAULT_CLUSTER_NAME, osgiInstance.getConfig().getClusterName());
HazelcastInstance instance = osgiInstance.getDelegatedInstance();
assertEquals(HazelcastInternalOSGiService.DEFAULT_CLUSTER_NAME, instance.getConfig().getClusterName());
}
use of com.hazelcast.osgi.impl.HazelcastInternalOSGiService in project hazelcast by hazelcast.
the class HazelcastOSGiServiceTest method serviceDeactivatedAndThenActivatedSuccessfully.
@Test
public void serviceDeactivatedAndThenActivatedSuccessfully() throws BundleException {
HazelcastInternalOSGiService service = getService();
assertTrue(service.isActive());
bundle.stop();
assertFalse(service.isActive());
assertNull(getService());
bundle.start();
assertTrue(service.isActive());
assertNotNull(getService());
}
use of com.hazelcast.osgi.impl.HazelcastInternalOSGiService in project hazelcast by hazelcast.
the class HazelcastOSGiServiceTest method instanceShutdownSuccessfully.
@Test
public void instanceShutdownSuccessfully() {
final String INSTANCE_NAME = "test-osgi-instance";
HazelcastInternalOSGiService service = getService();
Config config = new Config(INSTANCE_NAME);
HazelcastOSGiInstance osgiInstance = service.newHazelcastInstance(config);
assertTrue(osgiInstance.getLifecycleService().isRunning());
HazelcastInstance instance = osgiInstance.getDelegatedInstance();
assertTrue(instance.getLifecycleService().isRunning());
service.shutdownHazelcastInstance(osgiInstance);
assertFalse(osgiInstance.getLifecycleService().isRunning());
assertFalse(instance.getLifecycleService().isRunning());
assertNull(service.getHazelcastInstanceByName(INSTANCE_NAME));
assertFalse(service.getAllHazelcastInstances().contains(osgiInstance));
}
Aggregations