Search in sources :

Example 1 with TestObjectMapper

use of io.druid.TestObjectMapper in project druid by druid-io.

the class NoneShardSpecTest method testPartitionFieldIgnored.

@Test
public void testPartitionFieldIgnored() throws IOException {
    final String jsonStr = "{\"type\": \"none\",\"partitionNum\": 2}";
    ObjectMapper mapper = new TestObjectMapper();
    final ShardSpec noneShardSpec = mapper.readValue(jsonStr, ShardSpec.class);
    noneShardSpec.equals(NoneShardSpec.instance());
}
Also used : ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) TestObjectMapper(io.druid.TestObjectMapper) TestObjectMapper(io.druid.TestObjectMapper) Test(org.junit.Test)

Example 2 with TestObjectMapper

use of io.druid.TestObjectMapper in project druid by druid-io.

the class NoneShardSpecTest method testSerde.

@Test
public void testSerde() throws Exception {
    final NoneShardSpec one = NoneShardSpec.instance();
    ObjectMapper mapper = new TestObjectMapper();
    NoneShardSpec serde1 = mapper.readValue(mapper.writeValueAsString(one), NoneShardSpec.class);
    NoneShardSpec serde2 = mapper.readValue(mapper.writeValueAsString(one), NoneShardSpec.class);
    // Serde should return same object instead of creating new one every time.
    Assert.assertTrue(serde1 == serde2);
    Assert.assertTrue(one == serde1);
}
Also used : ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) TestObjectMapper(io.druid.TestObjectMapper) TestObjectMapper(io.druid.TestObjectMapper) Test(org.junit.Test)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 TestObjectMapper (io.druid.TestObjectMapper)2 Test (org.junit.Test)2