Search in sources :

Example 1 with DynamicConfigurationAwareConfigConstructor

use of com.hazelcast.test.starter.constructor.DynamicConfigurationAwareConfigConstructor in project hazelcast by hazelcast.

the class DynamicConfigurationAwareConfigConstructorTest method testConstructor.

@Test
public void testConstructor() {
    Config config = new Config().setInstanceName("myInstanceName").addMapConfig(new MapConfig("myMap")).addListConfig(new ListConfig("myList")).addListenerConfig(new ListenerConfig("com.hazelcast.test.MyListenerConfig")).setProperties(buildPropertiesWithDefaults());
    HazelcastProperties properties = new HazelcastProperties(config);
    DynamicConfigurationAwareConfig dynamicConfig = new DynamicConfigurationAwareConfig(config, properties);
    DynamicConfigurationAwareConfigConstructor constructor = new DynamicConfigurationAwareConfigConstructor(DynamicConfigurationAwareConfig.class);
    DynamicConfigurationAwareConfig clonedDynamicConfig = (DynamicConfigurationAwareConfig) constructor.createNew(dynamicConfig);
    assertEquals(dynamicConfig.getInstanceName(), clonedDynamicConfig.getInstanceName());
    assertEquals(dynamicConfig.getMapConfigs().size(), clonedDynamicConfig.getMapConfigs().size());
    assertEquals(dynamicConfig.getListConfigs().size(), clonedDynamicConfig.getListConfigs().size());
    assertEquals(dynamicConfig.getListenerConfigs().size(), clonedDynamicConfig.getListenerConfigs().size());
    assertPropertiesEquals(dynamicConfig.getProperties(), clonedDynamicConfig.getProperties());
}
Also used : ListenerConfig(com.hazelcast.config.ListenerConfig) HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) Config(com.hazelcast.config.Config) ListConfig(com.hazelcast.config.ListConfig) ListenerConfig(com.hazelcast.config.ListenerConfig) DynamicConfigurationAwareConfig(com.hazelcast.internal.dynamicconfig.DynamicConfigurationAwareConfig) MapConfig(com.hazelcast.config.MapConfig) DynamicConfigurationAwareConfig(com.hazelcast.internal.dynamicconfig.DynamicConfigurationAwareConfig) DynamicConfigurationAwareConfigConstructor(com.hazelcast.test.starter.constructor.DynamicConfigurationAwareConfigConstructor) MapConfig(com.hazelcast.config.MapConfig) ListConfig(com.hazelcast.config.ListConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

Config (com.hazelcast.config.Config)1 ListConfig (com.hazelcast.config.ListConfig)1 ListenerConfig (com.hazelcast.config.ListenerConfig)1 MapConfig (com.hazelcast.config.MapConfig)1 DynamicConfigurationAwareConfig (com.hazelcast.internal.dynamicconfig.DynamicConfigurationAwareConfig)1 HazelcastProperties (com.hazelcast.spi.properties.HazelcastProperties)1 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 DynamicConfigurationAwareConfigConstructor (com.hazelcast.test.starter.constructor.DynamicConfigurationAwareConfigConstructor)1 Test (org.junit.Test)1