Search in sources :

Example 1 with CoordinatorDynamicConfig

use of io.druid.server.coordinator.CoordinatorDynamicConfig in project druid by druid-io.

the class CoordinatorDynamicConfigTest method testEqualsAndHashCodeSanity.

@Test
public void testEqualsAndHashCodeSanity() {
    CoordinatorDynamicConfig config1 = new CoordinatorDynamicConfig(900000, 524288000, 100, 5, 15, 10, 1, false, null, false);
    CoordinatorDynamicConfig config2 = new CoordinatorDynamicConfig(900000, 524288000, 100, 5, 15, 10, 1, false, null, false);
    Assert.assertEquals(config1, config2);
    Assert.assertEquals(config1.hashCode(), config2.hashCode());
}
Also used : CoordinatorDynamicConfig(io.druid.server.coordinator.CoordinatorDynamicConfig) Test(org.junit.Test)

Example 2 with CoordinatorDynamicConfig

use of io.druid.server.coordinator.CoordinatorDynamicConfig in project druid by druid-io.

the class CoordinatorDynamicConfigTest method testSerdeWithKillAllDataSources.

@Test
public void testSerdeWithKillAllDataSources() throws Exception {
    String jsonStr = "{\n" + "  \"millisToWaitBeforeDeleting\": 1,\n" + "  \"mergeBytesLimit\": 1,\n" + "  \"mergeSegmentsLimit\" : 1,\n" + "  \"maxSegmentsToMove\": 1,\n" + "  \"replicantLifetime\": 1,\n" + "  \"replicationThrottleLimit\": 1,\n" + "  \"balancerComputeThreads\": 2, \n" + "  \"emitBalancingStats\": true,\n" + "  \"killAllDataSources\": true\n" + "}\n";
    ObjectMapper mapper = TestHelper.getObjectMapper();
    CoordinatorDynamicConfig actual = mapper.readValue(mapper.writeValueAsString(mapper.readValue(jsonStr, CoordinatorDynamicConfig.class)), CoordinatorDynamicConfig.class);
    Assert.assertEquals(new CoordinatorDynamicConfig(1, 1, 1, 1, 1, 1, 2, true, ImmutableSet.of(), true), actual);
    //ensure whitelist is empty when killAllDataSources is true
    try {
        jsonStr = "{\n" + "  \"killDataSourceWhitelist\": [\"test1\",\"test2\"],\n" + "  \"killAllDataSources\": true\n" + "}\n";
        mapper.readValue(jsonStr, CoordinatorDynamicConfig.class);
        Assert.fail("deserialization should fail.");
    } catch (JsonMappingException e) {
        Assert.assertTrue(e.getCause() instanceof IAE);
    }
}
Also used : CoordinatorDynamicConfig(io.druid.server.coordinator.CoordinatorDynamicConfig) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) IAE(io.druid.java.util.common.IAE) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Example 3 with CoordinatorDynamicConfig

use of io.druid.server.coordinator.CoordinatorDynamicConfig in project druid by druid-io.

the class CoordinatorDynamicConfigTest method testSerde.

@Test
public void testSerde() throws Exception {
    String jsonStr = "{\n" + "  \"millisToWaitBeforeDeleting\": 1,\n" + "  \"mergeBytesLimit\": 1,\n" + "  \"mergeSegmentsLimit\" : 1,\n" + "  \"maxSegmentsToMove\": 1,\n" + "  \"replicantLifetime\": 1,\n" + "  \"replicationThrottleLimit\": 1,\n" + "  \"balancerComputeThreads\": 2, \n" + "  \"emitBalancingStats\": true,\n" + "  \"killDataSourceWhitelist\": [\"test1\",\"test2\"]\n" + "}\n";
    ObjectMapper mapper = TestHelper.getObjectMapper();
    CoordinatorDynamicConfig actual = mapper.readValue(mapper.writeValueAsString(mapper.readValue(jsonStr, CoordinatorDynamicConfig.class)), CoordinatorDynamicConfig.class);
    Assert.assertEquals(new CoordinatorDynamicConfig(1, 1, 1, 1, 1, 1, 2, true, ImmutableSet.of("test1", "test2"), false), actual);
}
Also used : CoordinatorDynamicConfig(io.druid.server.coordinator.CoordinatorDynamicConfig) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Example 4 with CoordinatorDynamicConfig

use of io.druid.server.coordinator.CoordinatorDynamicConfig in project druid by druid-io.

the class CoordinatorDynamicConfigTest method testSerdeWithStringinKillDataSourceWhitelist.

@Test
public void testSerdeWithStringinKillDataSourceWhitelist() throws Exception {
    String jsonStr = "{\n" + "  \"millisToWaitBeforeDeleting\": 1,\n" + "  \"mergeBytesLimit\": 1,\n" + "  \"mergeSegmentsLimit\" : 1,\n" + "  \"maxSegmentsToMove\": 1,\n" + "  \"replicantLifetime\": 1,\n" + "  \"replicationThrottleLimit\": 1,\n" + "  \"balancerComputeThreads\": 2, \n" + "  \"emitBalancingStats\": true,\n" + "  \"killDataSourceWhitelist\": \" test1 ,test2 \"\n" + "}\n";
    ObjectMapper mapper = TestHelper.getObjectMapper();
    CoordinatorDynamicConfig actual = mapper.readValue(mapper.writeValueAsString(mapper.readValue(jsonStr, CoordinatorDynamicConfig.class)), CoordinatorDynamicConfig.class);
    Assert.assertEquals(new CoordinatorDynamicConfig(1, 1, 1, 1, 1, 1, 2, true, ImmutableSet.of("test1", "test2"), false), actual);
}
Also used : CoordinatorDynamicConfig(io.druid.server.coordinator.CoordinatorDynamicConfig) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Aggregations

CoordinatorDynamicConfig (io.druid.server.coordinator.CoordinatorDynamicConfig)4 Test (org.junit.Test)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)1 IAE (io.druid.java.util.common.IAE)1