Search in sources :

Example 6 with ServiceConfig

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;
}
Also used : ServiceConfig(com.hazelcast.config.ServiceConfig) ServicesConfig(com.hazelcast.config.ServicesConfig) Config(com.hazelcast.config.Config) ServiceConfig(com.hazelcast.config.ServiceConfig) ServicesConfig(com.hazelcast.config.ServicesConfig)

Example 7 with ServiceConfig

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);
    }
}
Also used : ServiceConfig(com.hazelcast.config.ServiceConfig)

Example 8 with 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);
}
Also used : ServiceConfig(com.hazelcast.config.ServiceConfig) Config(com.hazelcast.config.Config) ProxyFactoryConfig(com.hazelcast.client.config.ProxyFactoryConfig) ServiceConfig(com.hazelcast.config.ServiceConfig) ClientConfig(com.hazelcast.client.config.ClientConfig) Before(org.junit.Before)

Example 9 with ServiceConfig

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);
}
Also used : ServiceConfig(com.hazelcast.config.ServiceConfig) Test(org.junit.Test) QuickTest(com.hazelcast.test.annotation.QuickTest)

Example 10 with ServiceConfig

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);
    }
}
Also used : ServiceConfig(com.hazelcast.config.ServiceConfig) Config(com.hazelcast.config.Config) ServiceConfig(com.hazelcast.config.ServiceConfig) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

ServiceConfig (com.hazelcast.config.ServiceConfig)17 Config (com.hazelcast.config.Config)15 QuickTest (com.hazelcast.test.annotation.QuickTest)8 Test (org.junit.Test)8 ParallelTest (com.hazelcast.test.annotation.ParallelTest)7 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)6 HazelcastInstance (com.hazelcast.core.HazelcastInstance)4 Before (org.junit.Before)3 ServicesConfig (com.hazelcast.config.ServicesConfig)2 Operation (com.hazelcast.spi.Operation)2 AssertTask (com.hazelcast.test.AssertTask)2 ClientConfig (com.hazelcast.client.config.ClientConfig)1 ProxyFactoryConfig (com.hazelcast.client.config.ProxyFactoryConfig)1 Node (com.hazelcast.instance.Node)1 TestPutOperation (com.hazelcast.internal.partition.service.TestPutOperation)1 NodeEngine (com.hazelcast.spi.NodeEngine)1 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)1 ProxyServiceImpl (com.hazelcast.spi.impl.proxyservice.impl.ProxyServiceImpl)1 MigrationEndpoint (com.hazelcast.spi.partition.MigrationEndpoint)1 UnknownHostException (java.net.UnknownHostException)1