diff --git a/api/src/main/java/io/druid/guice/JsonConfigurator.java b/api/src/main/java/io/druid/guice/JsonConfigurator.java index 366fad8b918..c0418eca8cf 100644 --- a/api/src/main/java/io/druid/guice/JsonConfigurator.java +++ b/api/src/main/java/io/druid/guice/JsonConfigurator.java @@ -24,6 +24,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.introspect.AnnotatedField; import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition; +import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Function; import com.google.common.base.Strings; import com.google.common.base.Throwables; @@ -33,7 +34,6 @@ import com.google.common.collect.Maps; import com.google.inject.Inject; import com.google.inject.ProvisionException; import com.google.inject.spi.Message; - import io.druid.java.util.common.logger.Logger; import javax.validation.ConstraintViolation; @@ -69,7 +69,7 @@ public class JsonConfigurator public T configurate(Properties props, String propertyPrefix, Class clazz) throws ProvisionException { - verifyClazzIsConfigurable(clazz); + verifyClazzIsConfigurable(jsonMapper, clazz); // Make it end with a period so we only include properties with sub-object thingies. final String propertyBase = propertyPrefix.endsWith(".") ? propertyPrefix : propertyPrefix + "."; @@ -165,11 +165,12 @@ public class JsonConfigurator return config; } - private void verifyClazzIsConfigurable(Class clazz) + @VisibleForTesting + public static void verifyClazzIsConfigurable(ObjectMapper mapper, Class clazz) { - final List beanDefs = jsonMapper.getSerializationConfig() - .introspect(jsonMapper.constructType(clazz)) - .findProperties(); + final List beanDefs = mapper.getSerializationConfig() + .introspect(mapper.constructType(clazz)) + .findProperties(); for (BeanPropertyDefinition beanDef : beanDefs) { final AnnotatedField field = beanDef.getField(); if (field == null || !field.hasAnnotation(JsonProperty.class)) { diff --git a/indexing-service/src/main/java/io/druid/indexing/overlord/config/RemoteTaskRunnerConfig.java b/indexing-service/src/main/java/io/druid/indexing/overlord/config/RemoteTaskRunnerConfig.java index e57c508c0bd..10d6760f976 100644 --- a/indexing-service/src/main/java/io/druid/indexing/overlord/config/RemoteTaskRunnerConfig.java +++ b/indexing-service/src/main/java/io/druid/indexing/overlord/config/RemoteTaskRunnerConfig.java @@ -72,7 +72,6 @@ public class RemoteTaskRunnerConfig extends WorkerTaskRunnerConfig return taskAssignmentTimeout; } - @JsonProperty public Period getTaskCleanupTimeout(){ return taskCleanupTimeout; } @@ -105,7 +104,7 @@ public class RemoteTaskRunnerConfig extends WorkerTaskRunnerConfig return workerBlackListBackoffTime; } - public void setTaskBlackListBackoffTimeMillis(Period taskBlackListBackoffTime) { + public void setWorkerBlackListBackoffTime(Period taskBlackListBackoffTime) { this.workerBlackListBackoffTime = taskBlackListBackoffTime; } diff --git a/indexing-service/src/test/java/io/druid/indexing/overlord/config/RemoteTaskRunnerConfigTest.java b/indexing-service/src/test/java/io/druid/indexing/overlord/config/RemoteTaskRunnerConfigTest.java index f3e67a266e1..ed082775021 100644 --- a/indexing-service/src/test/java/io/druid/indexing/overlord/config/RemoteTaskRunnerConfigTest.java +++ b/indexing-service/src/test/java/io/druid/indexing/overlord/config/RemoteTaskRunnerConfigTest.java @@ -20,6 +20,7 @@ package io.druid.indexing.overlord.config; import com.fasterxml.jackson.databind.ObjectMapper; +import io.druid.guice.JsonConfigurator; import io.druid.jackson.DefaultObjectMapper; import org.joda.time.Period; import org.junit.Assert; @@ -40,6 +41,12 @@ public class RemoteTaskRunnerConfigTest private static final Period DEFAULT_TASK_BACKOFF = new Period("PT10M"); private static final Period DEFAULT_BLACKLIST_CLEANUP_PERIOD = new Period("PT5M"); + @Test + public void testIsJsonConfiguratable() + { + JsonConfigurator.verifyClazzIsConfigurable(mapper, RemoteTaskRunnerConfig.class); + } + @Test public void testGetTaskAssignmentTimeout() throws Exception {