use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper in project druid by druid-io.
the class TaskLogAutoCleanerConfigTest method testSerde.
@Test
public void testSerde() throws Exception {
String json = "{\n" + " \"enabled\": true,\n" + " \"initialDelay\": 10,\n" + " \"delay\": 40,\n" + " \"durationToRetain\": 30\n" + "}";
ObjectMapper mapper = TestUtil.MAPPER;
TaskLogAutoCleanerConfig config = mapper.readValue(mapper.writeValueAsString(mapper.readValue(json, TaskLogAutoCleanerConfig.class)), TaskLogAutoCleanerConfig.class);
Assert.assertTrue(config.isEnabled());
Assert.assertEquals(10, config.getInitialDelay());
Assert.assertEquals(40, config.getDelay());
Assert.assertEquals(30, config.getDurationToRetain());
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper in project druid by druid-io.
the class TaskLogAutoCleanerConfigTest method testSerdeWithDefaults.
@Test
public void testSerdeWithDefaults() throws Exception {
String json = "{}";
ObjectMapper mapper = TestUtil.MAPPER;
TaskLogAutoCleanerConfig config = mapper.readValue(mapper.writeValueAsString(mapper.readValue(json, TaskLogAutoCleanerConfig.class)), TaskLogAutoCleanerConfig.class);
Assert.assertFalse(config.isEnabled());
Assert.assertTrue(config.getInitialDelay() >= 60000 && config.getInitialDelay() <= 300000);
Assert.assertEquals(6 * 60 * 60 * 1000, config.getDelay());
Assert.assertEquals(Long.MAX_VALUE, config.getDurationToRetain());
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper in project druid by druid-io.
the class JSONParserTest method testSimpleWithFields.
@Test
public void testSimpleWithFields() {
final Parser<String, Object> jsonParser = new JSONParser(new ObjectMapper(), Lists.newArrayList("two"));
final Map<String, Object> jsonMap = jsonParser.parse(json);
Assert.assertEquals("jsonMap", ImmutableMap.of("two", ImmutableList.of("bar", "baz")), jsonMap);
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper in project druid by druid-io.
the class QueryGranularityTest method testSerializeSimple.
@Test
public void testSerializeSimple() throws Exception {
ObjectMapper mapper = new DefaultObjectMapper();
Assert.assertEquals(Granularities.ALL, mapper.readValue(mapper.writeValueAsString(Granularities.ALL), Granularity.class));
Assert.assertEquals(Granularities.NONE, mapper.readValue(mapper.writeValueAsString(Granularities.NONE), Granularity.class));
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper in project druid by druid-io.
the class ExtensionsConfigTest method testSerdeWithNonDefaults.
@Test
public void testSerdeWithNonDefaults() throws Exception {
String json = "{\n" + " \"searchCurrentClassloader\": false,\n" + " \"directory\": \"testExtensions\",\n" + " \"hadoopDependenciesDir\": \"testHadoopDependenciesDir\",\n" + " \"hadoopContainerDruidClasspath\": \"testHadoopContainerClasspath\",\n" + " \"loadList\": [\"a\",\"b\"]\n" + "}";
ObjectMapper mapper = TestHelper.getObjectMapper();
ExtensionsConfig config = mapper.readValue(mapper.writeValueAsString(mapper.readValue(json, ExtensionsConfig.class)), ExtensionsConfig.class);
Assert.assertFalse(config.searchCurrentClassloader());
Assert.assertEquals("testExtensions", config.getDirectory());
Assert.assertEquals("testHadoopDependenciesDir", config.getHadoopDependenciesDir());
Assert.assertEquals("testHadoopContainerClasspath", config.getHadoopContainerDruidClasspath());
Assert.assertEquals(ImmutableList.of("a", "b"), config.getLoadList());
}
Aggregations