@Test
public void testKryoDecoratorsConfig() throws Exception {
Map<String, Object> daemonConf = new HashMap<>();
daemonConf.put(Config.TOPOLOGY_SKIP_MISSING_KRYO_REGISTRATIONS, true);
daemonConf.put(Config.TOPOLOGY_KRYO_DECORATORS, "this-is-overridden");
try (LocalCluster cluster = new LocalCluster.Builder()
.withSimulatedTime()
.withDaemonConf(daemonConf)
.build()) {
TopologyBuilder topologyBuilder = new TopologyBuilder();
topologyBuilder.setSpout("1", new TestPlannerSpout(new Fields("conf")));
topologyBuilder.setBolt("2", new TestConfBolt(Collections.singletonMap(Config.TOPOLOGY_KRYO_DECORATORS, Arrays.asList("one", "two"))))
.shuffleGrouping("1");
List<FixedTuple> testTuples = Arrays.asList(new Values(Config.TOPOLOGY_KRYO_DECORATORS)).stream()
.map(value -> new FixedTuple(value))
.collect(Collectors.toList());
MockedSources mockedSources = new MockedSources(Collections.singletonMap("1", testTuples));
CompleteTopologyParam completeTopologyParams = new CompleteTopologyParam();
completeTopologyParams.setMockedSources(mockedSources);
completeTopologyParams.setStormConf(Collections.singletonMap(Config.TOPOLOGY_KRYO_DECORATORS, Arrays.asList("one", "three")));
Map<String, List<FixedTuple>> results = Testing.completeTopology(cluster, topologyBuilder.createTopology(), completeTopologyParams);
List<Object> concatValues = Testing.readTuples(results, "2").stream()
.flatMap(values -> values.stream())
.collect(Collectors.toList());
assertThat(concatValues.get(0), is(Config.TOPOLOGY_KRYO_DECORATORS));
assertThat(concatValues.get(1), is(Arrays.asList("one", "two", "three")));
}
}