Search in sources :

Example 16 with ListConfig

use of com.hazelcast.config.ListConfig in project hazelcast by hazelcast.

the class DynamicConfigYamlGenerator method listYamlGenerator.

public static void listYamlGenerator(Map<String, Object> parent, Config config) {
    if (config.getListConfigs().isEmpty()) {
        return;
    }
    Map<String, Object> child = new LinkedHashMap<>();
    for (ListConfig subConfigAsObject : config.getListConfigs().values()) {
        child.put(subConfigAsObject.getName(), getCollectionConfigAsMap(subConfigAsObject));
    }
    parent.put("list", child);
}
Also used : ListConfig(com.hazelcast.config.ListConfig) LinkedHashMap(java.util.LinkedHashMap)

Example 17 with ListConfig

use of com.hazelcast.config.ListConfig in project hazelcast by hazelcast.

the class ConfigSearchTest method testListConfig_Static.

@Test
public void testListConfig_Static() {
    TestCase<ListConfig> testCase = new TestCase<ListConfig>(new ListConfig().setName(STATIC_NAME), new ListConfig().setName(DYNAMIC_NAME), false) {

        @Override
        void addStaticConfig(Config config) {
            config.addListConfig(this.staticConfig);
        }

        @Override
        void addDynamicConfig(HazelcastInstance hazelcastInstance) {
            hazelcastInstance.getConfig().addListConfig(this.dynamicConfig);
        }

        @Override
        void asserts() {
            ListConfig dataConfig = hazelcastInstance.getConfig().findListConfig(DYNAMIC_NAME);
            assertThat(dataConfig.getName(), equalTo(STATIC_NAME));
        }
    };
    testTemplate(testCase);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) ListConfig(com.hazelcast.config.ListConfig) SetConfig(com.hazelcast.config.SetConfig) PNCounterConfig(com.hazelcast.config.PNCounterConfig) QueueConfig(com.hazelcast.config.QueueConfig) ReliableTopicConfig(com.hazelcast.config.ReliableTopicConfig) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) MapConfig(com.hazelcast.config.MapConfig) CardinalityEstimatorConfig(com.hazelcast.config.CardinalityEstimatorConfig) MultiMapConfig(com.hazelcast.config.MultiMapConfig) RingbufferConfig(com.hazelcast.config.RingbufferConfig) ExecutorConfig(com.hazelcast.config.ExecutorConfig) ScheduledExecutorConfig(com.hazelcast.config.ScheduledExecutorConfig) TopicConfig(com.hazelcast.config.TopicConfig) Config(com.hazelcast.config.Config) DurableExecutorConfig(com.hazelcast.config.DurableExecutorConfig) FlakeIdGeneratorConfig(com.hazelcast.config.FlakeIdGeneratorConfig) ReplicatedMapConfig(com.hazelcast.config.ReplicatedMapConfig) ListConfig(com.hazelcast.config.ListConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 18 with ListConfig

use of com.hazelcast.config.ListConfig in project hazelcast by hazelcast.

the class ListAbstractTest method setup.

@Before
public void setup() {
    Config config = smallInstanceConfig();
    config.addListConfig(new ListConfig("testAdd_whenCapacityReached_thenItemNotAdded*").setMaxSize(10));
    instances = newInstances(config);
    HazelcastInstance local = instances[0];
    HazelcastInstance target = instances[instances.length - 1];
    String methodName = getTestMethodName();
    String name = randomNameOwnedBy(target, methodName);
    list = local.getList(name);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) Config(com.hazelcast.config.Config) ListConfig(com.hazelcast.config.ListConfig) ListConfig(com.hazelcast.config.ListConfig) Before(org.junit.Before)

Example 19 with ListConfig

use of com.hazelcast.config.ListConfig in project hazelcast by hazelcast.

the class ClusterListTest method testMigration.

@Test
public void testMigration() {
    Config config = new Config();
    final String name = randomString();
    config.addListConfig(new ListConfig().setName(name).setBackupCount(1));
    final int insCount = 4;
    TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(insCount);
    HazelcastInstance instance1 = factory.newHazelcastInstance(config);
    IList<String> list = instance1.getList(name);
    for (int i = 0; i < 100; i++) {
        list.add("item" + i);
    }
    HazelcastInstance instance2 = factory.newHazelcastInstance(config);
    assertEquals(100, instance2.getList(name).size());
    HazelcastInstance instance3 = factory.newHazelcastInstance(config);
    assertEquals(100, instance3.getList(name).size());
    instance1.shutdown();
    assertEquals(100, instance3.getList(name).size());
    list = instance2.getList(name);
    for (int i = 0; i < 100; i++) {
        list.add("item-" + i);
    }
    instance2.shutdown();
    assertEquals(200, instance3.getList(name).size());
    instance1 = factory.newHazelcastInstance(config);
    assertEquals(200, instance1.getList(name).size());
    instance3.shutdown();
    assertEquals(200, instance1.getList(name).size());
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) Config(com.hazelcast.config.Config) ListConfig(com.hazelcast.config.ListConfig) ListConfig(com.hazelcast.config.ListConfig) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 20 with ListConfig

use of com.hazelcast.config.ListConfig in project hazelcast by hazelcast.

the class ConfigSearchTest method testListConfig_Dynamic.

@Test
public void testListConfig_Dynamic() {
    TestCase<ListConfig> testCase = new TestCase<ListConfig>(new ListConfig().setName(STATIC_NAME), new ListConfig().setName(DYNAMIC_NAME), true) {

        @Override
        void addStaticConfig(Config config) {
            config.addListConfig(this.staticConfig);
        }

        @Override
        void addDynamicConfig(HazelcastInstance hazelcastInstance) {
            hazelcastInstance.getConfig().addListConfig(this.dynamicConfig);
        }

        @Override
        void asserts() {
            ListConfig dataConfig = hazelcastInstance.getConfig().findListConfig(DYNAMIC_NAME);
            assertThat(dataConfig.getName(), equalTo(DYNAMIC_NAME));
        }
    };
    testTemplate(testCase);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) ListConfig(com.hazelcast.config.ListConfig) SetConfig(com.hazelcast.config.SetConfig) PNCounterConfig(com.hazelcast.config.PNCounterConfig) QueueConfig(com.hazelcast.config.QueueConfig) ReliableTopicConfig(com.hazelcast.config.ReliableTopicConfig) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) MapConfig(com.hazelcast.config.MapConfig) CardinalityEstimatorConfig(com.hazelcast.config.CardinalityEstimatorConfig) MultiMapConfig(com.hazelcast.config.MultiMapConfig) RingbufferConfig(com.hazelcast.config.RingbufferConfig) ExecutorConfig(com.hazelcast.config.ExecutorConfig) ScheduledExecutorConfig(com.hazelcast.config.ScheduledExecutorConfig) TopicConfig(com.hazelcast.config.TopicConfig) Config(com.hazelcast.config.Config) DurableExecutorConfig(com.hazelcast.config.DurableExecutorConfig) FlakeIdGeneratorConfig(com.hazelcast.config.FlakeIdGeneratorConfig) ReplicatedMapConfig(com.hazelcast.config.ReplicatedMapConfig) ListConfig(com.hazelcast.config.ListConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

ListConfig (com.hazelcast.config.ListConfig)21 Test (org.junit.Test)10 QuickTest (com.hazelcast.test.annotation.QuickTest)9 Config (com.hazelcast.config.Config)8 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)8 MapConfig (com.hazelcast.config.MapConfig)7 CacheSimpleConfig (com.hazelcast.config.CacheSimpleConfig)5 CardinalityEstimatorConfig (com.hazelcast.config.CardinalityEstimatorConfig)5 DurableExecutorConfig (com.hazelcast.config.DurableExecutorConfig)5 ExecutorConfig (com.hazelcast.config.ExecutorConfig)5 FlakeIdGeneratorConfig (com.hazelcast.config.FlakeIdGeneratorConfig)5 MultiMapConfig (com.hazelcast.config.MultiMapConfig)5 PNCounterConfig (com.hazelcast.config.PNCounterConfig)5 QueueConfig (com.hazelcast.config.QueueConfig)5 ReliableTopicConfig (com.hazelcast.config.ReliableTopicConfig)5 ReplicatedMapConfig (com.hazelcast.config.ReplicatedMapConfig)5 RingbufferConfig (com.hazelcast.config.RingbufferConfig)5 ScheduledExecutorConfig (com.hazelcast.config.ScheduledExecutorConfig)5 SetConfig (com.hazelcast.config.SetConfig)5 TopicConfig (com.hazelcast.config.TopicConfig)5