use of com.hazelcast.config.ServiceConfig in project hazelcast by hazelcast.
the class MapTransactionStressTest method createConfigWithDummyTxService.
private Config createConfigWithDummyTxService() {
Config config = getConfig();
ServicesConfig servicesConfig = config.getServicesConfig();
servicesConfig.addServiceConfig(new ServiceConfig().setName(DUMMY_TX_SERVICE).setEnabled(true).setImplementation(new DummyTransactionalService(DUMMY_TX_SERVICE)));
return config;
}
use of com.hazelcast.config.ServiceConfig in project hazelcast by hazelcast.
the class ServiceManagerImpl method registerUserServices.
private void registerUserServices(ServicesConfig servicesConfig, Map<String, Properties> serviceProps, Map<String, Object> serviceConfigObjects) {
logger.finest("Registering user defined services...");
Collection<ServiceConfig> serviceConfigs = servicesConfig.getServiceConfigs();
for (ServiceConfig serviceConfig : serviceConfigs) {
registerUserService(serviceProps, serviceConfigObjects, serviceConfig);
}
}
use of com.hazelcast.config.ServiceConfig in project hazelcast by hazelcast.
the class ProxyFactoryTest method setup.
@Before
public void setup() {
Config config = new Config();
ServiceConfig serviceConfig = new ServiceConfig();
serviceConfig.setEnabled(true).setName(SERVICE_NAME).setImplementation(new CustomService());
config.getServicesConfig().addServiceConfig(serviceConfig);
hazelcastFactory.newHazelcastInstance(config);
}
use of com.hazelcast.config.ServiceConfig in project hazelcast by hazelcast.
the class TestFullApplicationContext method testServiceConfig.
@Test
public void testServiceConfig() {
ServiceConfig serviceConfig = config.getServicesConfig().getServiceConfig("my-service");
assertEquals("com.hazelcast.spring.MyService", serviceConfig.getClassName());
assertEquals("prop1-value", serviceConfig.getProperties().getProperty("prop1"));
assertEquals("prop2-value", serviceConfig.getProperties().getProperty("prop2"));
MyServiceConfig configObject = (MyServiceConfig) serviceConfig.getConfigObject();
assertNotNull(configObject);
assertEquals("prop1", configObject.stringProp);
assertEquals(123, configObject.intProp);
assertTrue(configObject.boolProp);
Object impl = serviceConfig.getImplementation();
assertNotNull(impl);
assertTrue("expected service of class com.hazelcast.spring.MyService but it is " + impl.getClass().getName(), impl instanceof MyService);
}
use of com.hazelcast.config.ServiceConfig in project hazelcast by hazelcast.
the class DistributedObjectTest method testInitialization.
@Test
public void testInitialization() {
int nodeCount = 4;
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(nodeCount);
Config config = new Config();
config.getServicesConfig().addServiceConfig(new ServiceConfig().setImplementation(new TestInitializingObjectService()).setEnabled(true).setName(TestInitializingObjectService.NAME));
String serviceName = TestInitializingObjectService.NAME;
String objectName = "test-object";
HazelcastInstance[] instances = new HazelcastInstance[nodeCount];
for (int i = 0; i < instances.length; i++) {
instances[i] = factory.newHazelcastInstance(config);
TestInitializingObject obj2 = instances[i].getDistributedObject(serviceName, objectName);
assertTrue(obj2.init.get());
assertFalse(obj2.error);
}
}
Aggregations