diff --git a/hadoop-tools/hadoop-resourceestimator/src/main/java/org/apache/hadoop/resourceestimator/service/ResourceEstimatorService.java b/hadoop-tools/hadoop-resourceestimator/src/main/java/org/apache/hadoop/resourceestimator/service/ResourceEstimatorService.java index 0e0e094310..5d3aea4fdc 100644 --- a/hadoop-tools/hadoop-resourceestimator/src/main/java/org/apache/hadoop/resourceestimator/service/ResourceEstimatorService.java +++ b/hadoop-tools/hadoop-resourceestimator/src/main/java/org/apache/hadoop/resourceestimator/service/ResourceEstimatorService.java @@ -34,6 +34,7 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; +import com.sun.jersey.spi.resource.Singleton; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.resourceestimator.common.api.RecurrenceId; import org.apache.hadoop.resourceestimator.common.api.ResourceSkyline; @@ -56,13 +57,13 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; -import com.google.inject.Singleton; /** * Resource Estimator Service which provides a set of REST APIs for users to * use the estimation service. */ -@Singleton @Path("/resourceestimator") public class ResourceEstimatorService { +@Singleton +@Path("/resourceestimator") public class ResourceEstimatorService { private static final Logger LOGGER = LoggerFactory.getLogger(ResourceEstimatorService.class); private final SkylineStore skylineStore; diff --git a/hadoop-tools/hadoop-resourceestimator/src/test/java/org/apache/hadoop/resourceestimator/service/TestResourceEstimatorService.java b/hadoop-tools/hadoop-resourceestimator/src/test/java/org/apache/hadoop/resourceestimator/service/TestResourceEstimatorService.java index 91a486e4e5..785641cd60 100644 --- a/hadoop-tools/hadoop-resourceestimator/src/test/java/org/apache/hadoop/resourceestimator/service/TestResourceEstimatorService.java +++ b/hadoop-tools/hadoop-resourceestimator/src/test/java/org/apache/hadoop/resourceestimator/service/TestResourceEstimatorService.java @@ -37,18 +37,12 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; -import com.google.inject.Guice; -import com.google.inject.servlet.ServletModule; import com.sun.jersey.api.client.WebResource; -import com.sun.jersey.guice.spi.container.servlet.GuiceContainer; import com.sun.jersey.test.framework.JerseyTest; -import com.sun.jersey.test.framework.WebAppDescriptor; /** * Test ResourceEstimatorService. @@ -70,29 +64,12 @@ public class TestResourceEstimatorService extends JerseyTest { private long containerMemAlloc; private int containerCPUAlloc; - private static class WebServletModule extends ServletModule { - @Override protected void configureServlets() { - bind(ResourceEstimatorService.class); - serve("/*").with(GuiceContainer.class); - } - } - - static { - GuiceServletConfig - .setInjector(Guice.createInjector(new WebServletModule())); - } - public TestResourceEstimatorService() { - super(new WebAppDescriptor.Builder( - "org.apache.hadoop.resourceestimator.service") - .contextListenerClass(GuiceServletConfig.class) - .filterClass(com.google.inject.servlet.GuiceFilter.class).build()); + super("org.apache.hadoop.resourceestimator.service"); } @Before @Override public void setUp() throws Exception { super.setUp(); - GuiceServletConfig - .setInjector(Guice.createInjector(new WebServletModule())); containerMemAlloc = 1024; containerCPUAlloc = 1; containerSpec = Resource.newInstance(containerMemAlloc, containerCPUAlloc);