Examples of DefaultObjectMapper


Examples of io.druid.jackson.DefaultObjectMapper

        )
    );

    QueryRunner<Row> mergeRunner = new GroupByQueryQueryToolChest(
        configSupplier,
        new DefaultObjectMapper(),
        engine,
        TestQueryRunners.pool
    ).mergeResults(runner);
    Map<String, Object> context = Maps.newHashMap();
    TestHelper.assertExpectedObjects(expectedResults, mergeRunner.run(query, context), "no-limit");
View Full Code Here

Examples of io.druid.jackson.DefaultObjectMapper

        )
    );

    QueryRunner<Row> mergeRunner = new GroupByQueryQueryToolChest(
        configSupplier,
        new DefaultObjectMapper(),
        engine,
        TestQueryRunners.pool
    ).mergeResults(runner);
    TestHelper.assertExpectedObjects(expectedResults, mergeRunner.run(query, context), "no-limit");
  }
View Full Code Here

Examples of io.druid.jackson.DefaultObjectMapper

        )
    );

    QueryRunner<Row> mergeRunner = new GroupByQueryQueryToolChest(
        configSupplier,
        new DefaultObjectMapper(),
        engine,
        TestQueryRunners.pool
    ).mergeResults(runner);
    TestHelper.assertExpectedObjects(expectedResults, mergeRunner.run(query, context), "no-limit");
  }
View Full Code Here

Examples of io.druid.jackson.DefaultObjectMapper

  }

  @Test
  public void testSerdeBackwardsCompatible() throws Exception
  {
    DefaultObjectMapper mapper = new DefaultObjectMapper();
    ConstantPostAggregator aggregator = mapper.readValue(
        "{\"type\":\"constant\",\"name\":\"thistestbasicallydoesnothing unhappyface\",\"constantValue\":1}\n",
        ConstantPostAggregator.class
    );
    Assert.assertEquals(new Integer(1), aggregator.getConstantValue());
  }
View Full Code Here

Examples of io.druid.jackson.DefaultObjectMapper

  }

  @Test
  public void testSerde() throws Exception
  {
    DefaultObjectMapper mapper = new DefaultObjectMapper();
    ConstantPostAggregator aggregator = new ConstantPostAggregator("aggregator", 2, null);
    ConstantPostAggregator aggregator1 = mapper.readValue(
        mapper.writeValueAsString(aggregator),
        ConstantPostAggregator.class
    );
    Assert.assertEquals(aggregator, aggregator1);
  }
View Full Code Here

Examples of io.druid.jackson.DefaultObjectMapper

    Histogram h = new Histogram(breaks, bins, -1f, 1f);

    Double[] visualBreaks = {-1.0, -0.5, 0.0, 0.5, 1.0};
    Double[] visualCounts = { 123., 4., 56., 7. };

    ObjectMapper objectMapper = new DefaultObjectMapper();
    String json = objectMapper.writeValueAsString(h.asVisual());

    Map<String,Object> expectedObj = Maps.newLinkedHashMap();
    expectedObj.put("breaks", Arrays.asList(visualBreaks));
    expectedObj.put("counts", Arrays.asList(visualCounts));
    expectedObj.put("quantiles", Arrays.asList(new Double[]{-1.0, 1.0}));

    Map<String,Object> obj = (Map<String, Object>)objectMapper.readValue(json, Object.class);
    Assert.assertEquals(expectedObj, obj);
  }
View Full Code Here

Examples of io.druid.jackson.DefaultObjectMapper

         ImmutableMap.<String, Integer>of(DruidServer.DEFAULT_TIER, 2),
         null,
         null
     );
     ObjectMapper jsonMapper = new DefaultObjectMapper();
     Rule reread = jsonMapper.readValue(jsonMapper.writeValueAsString(rule), Rule.class);
     Assert.assertEquals(rule, reread);
   }
View Full Code Here

Examples of io.druid.jackson.DefaultObjectMapper

  }

  @Test
  public void testSerializePeriod() throws Exception
  {
    ObjectMapper mapper = new DefaultObjectMapper();

    String json = "{ \"type\": \"period\", \"period\": \"P1D\" }";
    QueryGranularity gran = mapper.readValue(json, QueryGranularity.class);
    Assert.assertEquals(new PeriodGranularity(new Period("P1D"), null, null), gran);

    json =   "{ \"type\": \"period\", \"period\": \"P1D\","
           + "\"timeZone\": \"America/Los_Angeles\", \"origin\": \"1970-01-01T00:00:00Z\"}";
    gran = mapper.readValue(json, QueryGranularity.class);
    Assert.assertEquals(new PeriodGranularity(new Period("P1D"), new DateTime(0l), DateTimeZone.forID("America/Los_Angeles")), gran);

    QueryGranularity expected = new PeriodGranularity(
        new Period("P1D"),
        new DateTime("2012-01-01"),
        DateTimeZone.forID("America/Los_Angeles")
    );

    String jsonOut = mapper.writeValueAsString(expected);
    Assert.assertEquals(expected, mapper.readValue(jsonOut, QueryGranularity.class));

  }
View Full Code Here

Examples of io.druid.jackson.DefaultObjectMapper

  }

  @Test
  public void testSerializeDuration() throws Exception
  {
    ObjectMapper mapper = new DefaultObjectMapper();

    String json = "{ \"type\": \"duration\", \"duration\": \"3600000\" }";
    QueryGranularity gran = mapper.readValue(json, QueryGranularity.class);
    Assert.assertEquals(new DurationGranularity(3600000, null), gran);

    json = "{ \"type\": \"duration\", \"duration\": \"5\", \"origin\": \"2012-09-01T00:00:00.002Z\" }";
    gran = mapper.readValue(json, QueryGranularity.class);
    Assert.assertEquals(new DurationGranularity(5, 2), gran);

    DurationGranularity expected = new DurationGranularity(5, 2);
    Assert.assertEquals(expected, mapper.readValue(mapper.writeValueAsString(expected), QueryGranularity.class));
  }
View Full Code Here

Examples of io.druid.jackson.DefaultObjectMapper

  }

  @Test
  public void testSerializeSimple() throws Exception
  {
    ObjectMapper mapper = new DefaultObjectMapper();

    Assert.assertEquals(
      QueryGranularity.ALL,
      mapper.readValue(
        mapper.writeValueAsString(QueryGranularity.ALL),
        QueryGranularity.class
      )
    );

    Assert.assertEquals(
      QueryGranularity.NONE,
      mapper.readValue(
        mapper.writeValueAsString(QueryGranularity.NONE),
        QueryGranularity.class
      )
    );
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.