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);
}
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);
}
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);
}
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());
}
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);
}
Aggregations