use of com.hazelcast.config.WanCustomPublisherConfig in project hazelcast by hazelcast.
the class DynamicConfigXmlGenerator method wanReplicationXmlGenerator.
public static void wanReplicationXmlGenerator(ConfigXmlGenerator.XmlGenerator gen, Config config) {
for (WanReplicationConfig wan : config.getWanReplicationConfigs().values()) {
gen.open("wan-replication", "name", wan.getName());
for (WanBatchPublisherConfig p : wan.getBatchPublisherConfigs()) {
wanBatchReplicationPublisherXmlGenerator(gen, p);
}
for (WanCustomPublisherConfig p : wan.getCustomPublisherConfigs()) {
wanCustomPublisherXmlGenerator(gen, p);
}
WanConsumerConfig consumerConfig = wan.getConsumerConfig();
if (consumerConfig != null) {
wanReplicationConsumerGenerator(gen, consumerConfig);
}
gen.close();
}
}
use of com.hazelcast.config.WanCustomPublisherConfig in project hazelcast by hazelcast.
the class DynamicConfigYamlGenerator method getWanCustomPublisherConfigsAsMap.
private static Map<String, Object> getWanCustomPublisherConfigsAsMap(List<WanCustomPublisherConfig> wanCustomPublisherConfigs) {
if (wanCustomPublisherConfigs == null || wanCustomPublisherConfigs.isEmpty()) {
return null;
}
Map<String, Object> wanBatchPublisherConfigsAsMap = new LinkedHashMap<>();
for (WanCustomPublisherConfig wanCustomPublisherConfig : wanCustomPublisherConfigs) {
Map<String, Object> wanCustomPublisherConfigAsMap = new LinkedHashMap<>();
addNonNullToMap(wanCustomPublisherConfigAsMap, "class-name", wanCustomPublisherConfig.getClassName());
addNonNullToMap(wanCustomPublisherConfigAsMap, "properties", getPropertiesAsMap(wanCustomPublisherConfig.getProperties()));
wanBatchPublisherConfigsAsMap.put(wanCustomPublisherConfig.getPublisherId(), wanCustomPublisherConfigAsMap);
}
return wanBatchPublisherConfigsAsMap;
}
use of com.hazelcast.config.WanCustomPublisherConfig in project hazelcast by hazelcast.
the class WanReplicationConfigDTO method toJson.
@Override
public JsonObject toJson() {
JsonObject root = new JsonObject();
if (config.getName() != null) {
root.add("name", config.getName());
}
JsonArray batchPublishers = new JsonArray();
JsonArray customPublishers = new JsonArray();
for (WanBatchPublisherConfig publisherConfig : config.getBatchPublisherConfigs()) {
batchPublishers.add(new WanBatchPublisherConfigDTO(publisherConfig).toJson());
}
for (WanCustomPublisherConfig publisherConfig : config.getCustomPublisherConfigs()) {
customPublishers.add(new CustomWanPublisherConfigDTO(publisherConfig).toJson());
}
root.add("batchPublishers", batchPublishers);
root.add("customPublishers", customPublishers);
WanConsumerConfig consumerConfig = config.getConsumerConfig();
if (consumerConfig != null) {
root.add("consumer", new WanConsumerConfigDTO(consumerConfig).toJson());
}
return root;
}
use of com.hazelcast.config.WanCustomPublisherConfig in project hazelcast by hazelcast.
the class AbstractWanCustomPublisherMapTest method programmaticImplCreationTest.
@Test
public void programmaticImplCreationTest() {
Config config = getConfig();
WanCustomPublisherConfig publisherConfig = config.getWanReplicationConfig("dummyWan").getCustomPublisherConfigs().get(0);
WanDummyPublisher dummyWanReplication = new WanDummyPublisher();
publisherConfig.setImplementation(dummyWanReplication);
instance1 = factory.newHazelcastInstance(config);
assertEquals(dummyWanReplication, getWanReplicationImpl(instance1));
}
use of com.hazelcast.config.WanCustomPublisherConfig in project hazelcast by hazelcast.
the class WanPublisherMigrationTest method getConfig.
@Override
protected Config getConfig() {
WanCustomPublisherConfig publisherConfig = new WanCustomPublisherConfig().setPublisherId("dummyPublisherId").setClassName(MigrationCountingWanPublisher.class.getName());
publisherConfig.getProperties().put("failMigrations", failMigrations);
WanReplicationConfig wanReplicationConfig = new WanReplicationConfig().setName("dummyWan").addCustomPublisherConfig(publisherConfig);
WanReplicationRef wanRef = new WanReplicationRef().setName("dummyWan").setMergePolicyClassName(PassThroughMergePolicy.class.getName());
MapConfig mapConfig = new MapConfig("default").setWanReplicationRef(wanRef);
return smallInstanceConfig().addWanReplicationConfig(wanReplicationConfig).addMapConfig(mapConfig);
}
Aggregations