use of com.hazelcast.osgi.impl.HazelcastInternalOSGiService in project hazelcast by hazelcast.
the class HazelcastOSGiServiceTest method serviceRetrievedSuccessfully.
@Test
public void serviceRetrievedSuccessfully() {
HazelcastInternalOSGiService service = getService();
assertNotNull(service);
}
use of com.hazelcast.osgi.impl.HazelcastInternalOSGiService in project hazelcast by hazelcast.
the class HazelcastOSGiServiceTest method newInstanceNotRegisteredAsServiceWhenRegistrationIsDisabled.
@Test
public void newInstanceNotRegisteredAsServiceWhenRegistrationIsDisabled() throws BundleException {
String propValue = System.getProperty(HazelcastOSGiService.HAZELCAST_OSGI_REGISTER_DISABLED);
TestBundle testBundle = null;
try {
System.setProperty(HazelcastOSGiService.HAZELCAST_OSGI_REGISTER_DISABLED, "true");
testBundle = new TestBundle();
TestBundleContext testBundleContext = testBundle.getBundleContext();
testBundle.start();
HazelcastInternalOSGiService service = getService(testBundleContext);
assertNotNull(service);
service.newHazelcastInstance();
assertNull(testBundleContext.getServiceReference(HazelcastOSGiInstance.class.getName()));
} finally {
if (propValue != null) {
System.setProperty(HazelcastOSGiService.HAZELCAST_OSGI_REGISTER_DISABLED, propValue);
}
if (testBundle != null) {
testBundle.stop();
}
}
}
use of com.hazelcast.osgi.impl.HazelcastInternalOSGiService in project hazelcast by hazelcast.
the class HazelcastOSGiServiceTest method defaultInstanceNotExistWhenItIsNotSpecified.
@Test
public void defaultInstanceNotExistWhenItIsNotSpecified() {
HazelcastInternalOSGiService service = getService();
assertNull(service.getDefaultHazelcastInstance());
}
use of com.hazelcast.osgi.impl.HazelcastInternalOSGiService in project hazelcast by hazelcast.
the class HazelcastOSGiServiceTest method clusterNameIsSetToSpecifiedClusterNameWhenGroupingIsDisabled.
@Test
public void clusterNameIsSetToSpecifiedClusterNameWhenGroupingIsDisabled() throws BundleException {
final String CLUSTER_NAME = "my-osgi-cluster";
String propValue = System.getProperty(HazelcastOSGiService.HAZELCAST_OSGI_GROUPING_DISABLED);
TestBundle testBundle = null;
try {
System.setProperty(HazelcastOSGiService.HAZELCAST_OSGI_GROUPING_DISABLED, "true");
testBundle = new TestBundle();
TestBundleContext testBundleContext = testBundle.getBundleContext();
testBundle.start();
HazelcastInternalOSGiService service = getService(testBundleContext);
assertNotNull(service);
Config config = new Config();
config.setClusterName(CLUSTER_NAME);
HazelcastOSGiInstance osgiInstance = service.newHazelcastInstance(config);
assertEquals(CLUSTER_NAME, osgiInstance.getConfig().getClusterName());
HazelcastInstance instance = osgiInstance.getDelegatedInstance();
assertEquals(CLUSTER_NAME, instance.getConfig().getClusterName());
} finally {
if (propValue != null) {
System.setProperty(HazelcastOSGiService.HAZELCAST_OSGI_GROUPING_DISABLED, propValue);
}
if (testBundle != null) {
testBundle.stop();
}
}
}
Aggregations