use of io.druid.jackson.DefaultObjectMapper in project druid by druid-io.
the class ForeverLoadRuleTest method testSerdeNullTieredReplicants.
@Test
public void testSerdeNullTieredReplicants() throws Exception {
ForeverLoadRule rule = new ForeverLoadRule(null);
ObjectMapper jsonMapper = new DefaultObjectMapper();
Rule reread = jsonMapper.readValue(jsonMapper.writeValueAsString(rule), Rule.class);
Assert.assertEquals(rule.getTieredReplicants(), ((ForeverLoadRule) reread).getTieredReplicants());
Assert.assertEquals(ImmutableMap.of(DruidServer.DEFAULT_TIER, DruidServer.DEFAULT_NUM_REPLICANTS), rule.getTieredReplicants());
}
use of io.druid.jackson.DefaultObjectMapper in project druid by druid-io.
the class ForeverLoadRuleTest method testEmptyTieredReplicants.
@Test(expected = IAE.class)
public void testEmptyTieredReplicants() throws Exception {
ForeverLoadRule rule = new ForeverLoadRule(ImmutableMap.<String, Integer>of());
ObjectMapper jsonMapper = new DefaultObjectMapper();
Rule reread = jsonMapper.readValue(jsonMapper.writeValueAsString(rule), Rule.class);
}
use of io.druid.jackson.DefaultObjectMapper in project druid by druid-io.
the class IntervalLoadRuleTest method testSerde.
@Test
public void testSerde() throws Exception {
IntervalLoadRule rule = new IntervalLoadRule(new Interval("0/3000"), ImmutableMap.<String, Integer>of(DruidServer.DEFAULT_TIER, 2));
ObjectMapper jsonMapper = new DefaultObjectMapper();
Rule reread = jsonMapper.readValue(jsonMapper.writeValueAsString(rule), Rule.class);
Assert.assertEquals(rule, reread);
}
use of io.druid.jackson.DefaultObjectMapper in project druid by druid-io.
the class DruidJsonValidatorTest method testTaskValidator.
@Test
public void testTaskValidator() throws Exception {
final ObjectMapper jsonMapper = new DefaultObjectMapper();
for (final Module jacksonModule : new FirehoseModule().getJacksonModules()) {
jsonMapper.registerModule(jacksonModule);
}
final RealtimeIndexTask task = new RealtimeIndexTask(null, new TaskResource("rofl", 2), new FireDepartment(new DataSchema("foo", null, new AggregatorFactory[0], new UniformGranularitySpec(Granularities.HOUR, Granularities.NONE, null), jsonMapper), new RealtimeIOConfig(new LocalFirehoseFactory(new File("lol"), "rofl", null), new PlumberSchool() {
@Override
public Plumber findPlumber(DataSchema schema, RealtimeTuningConfig config, FireDepartmentMetrics metrics) {
return null;
}
}, null), new RealtimeTuningConfig(1, new Period("PT10M"), null, null, null, null, 1, NoneShardSpec.instance(), new IndexSpec(), null, 0, 0, true, null)), null);
File tmp = temporaryFolder.newFile("test_task.json");
jsonMapper.writeValue(tmp, task);
parseCommand("validator", "-f", tmp.getAbsolutePath(), "-t", "task").run();
}
use of io.druid.jackson.DefaultObjectMapper in project druid by druid-io.
the class JavaScriptTieredBrokerSelectorStrategyTest method testSerde.
@Test
public void testSerde() throws Exception {
ObjectMapper mapper = new DefaultObjectMapper();
mapper.setInjectableValues(new InjectableValues.Std().addValue(JavaScriptConfig.class, JavaScriptConfig.getEnabledInstance()));
Assert.assertEquals(STRATEGY, mapper.readValue(mapper.writeValueAsString(STRATEGY), JavaScriptTieredBrokerSelectorStrategy.class));
}
Aggregations