예제 #1
0
  @Test
  public void testSerdeWithNonDefaults() throws Exception {
    String jsonStr =
        "{\n"
            + "  \"type\": \"realtime\",\n"
            + "  \"maxRowsInMemory\": 100,\n"
            + "  \"intermediatePersistPeriod\": \"PT1H\",\n"
            + "  \"windowPeriod\": \"PT1H\",\n"
            + "  \"basePersistDirectory\": \"/tmp/xxx\",\n"
            + "  \"maxPendingPersists\": 100,\n"
            + "  \"buildV9Directly\": false,\n"
            + "  \"persistThreadPriority\": 100,\n"
            + "  \"mergeThreadPriority\": 100,\n"
            + "  \"reportParseExceptions\": true,\n"
            + "  \"handoffConditionTimeout\": 100\n"
            + "}";

    ObjectMapper mapper = TestHelper.getObjectMapper();
    RealtimeTuningConfig config =
        (RealtimeTuningConfig)
            mapper.readValue(
                mapper.writeValueAsString(mapper.readValue(jsonStr, TuningConfig.class)),
                TuningConfig.class);

    Assert.assertEquals("/tmp/xxx", config.getBasePersistDirectory().toString());
    Assert.assertEquals(false, config.getBuildV9Directly());
    Assert.assertEquals(100, config.getHandoffConditionTimeout());
    Assert.assertEquals(new IndexSpec(), config.getIndexSpec());
    Assert.assertEquals(new Period("PT1H"), config.getIntermediatePersistPeriod());
    Assert.assertEquals(NoneShardSpec.instance(), config.getShardSpec());
    Assert.assertEquals(100, config.getMaxPendingPersists());
    Assert.assertEquals(100, config.getMaxRowsInMemory());
    Assert.assertEquals(100, config.getMergeThreadPriority());
    Assert.assertEquals(100, config.getPersistThreadPriority());
    Assert.assertEquals(new Period("PT1H"), config.getWindowPeriod());
    Assert.assertEquals(true, config.isReportParseExceptions());
  }
예제 #2
0
  @Test
  public void testSerdeWithDefaults() throws Exception {
    String jsonStr = "{\"type\":\"realtime\"}";

    ObjectMapper mapper = TestHelper.getObjectMapper();
    RealtimeTuningConfig config =
        (RealtimeTuningConfig)
            mapper.readValue(
                mapper.writeValueAsString(mapper.readValue(jsonStr, TuningConfig.class)),
                TuningConfig.class);

    Assert.assertNotNull(config.getBasePersistDirectory());
    Assert.assertEquals(true, config.getBuildV9Directly());
    Assert.assertEquals(0, config.getHandoffConditionTimeout());
    Assert.assertEquals(new IndexSpec(), config.getIndexSpec());
    Assert.assertEquals(new Period("PT10M"), config.getIntermediatePersistPeriod());
    Assert.assertEquals(NoneShardSpec.instance(), config.getShardSpec());
    Assert.assertEquals(0, config.getMaxPendingPersists());
    Assert.assertEquals(75000, config.getMaxRowsInMemory());
    Assert.assertEquals(0, config.getMergeThreadPriority());
    Assert.assertEquals(0, config.getPersistThreadPriority());
    Assert.assertEquals(new Period("PT10M"), config.getWindowPeriod());
    Assert.assertEquals(false, config.isReportParseExceptions());
  }