[ 
https://issues.apache.org/jira/browse/HADOOP-15984?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17909862#comment-17909862
 ] 

ASF GitHub Bot commented on HADOOP-15984:
-----------------------------------------

slfan1989 commented on code in PR #7019:
URL: https://github.com/apache/hadoop/pull/7019#discussion_r1903240972


##########
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/webapp/TestAMWebServices.java:
##########
@@ -68,215 +68,212 @@
  */
 public class TestAMWebServices extends JerseyTestBase {
 
-  private static Configuration conf = new Configuration();
+  private static final Configuration CONF = new Configuration();
   private static MockAppContext appContext;
 
-  private static class WebServletModule extends ServletModule {
-    @Override
-    protected void configureServlets() {
+  @Override
+  protected Application configure() {
+    ResourceConfig config = new ResourceConfig();
+    config.register(new JerseyBinder());
+    config.register(AMWebServices.class);
+    config.register(GenericExceptionHandler.class);
+    config.register(new JettisonFeature()).register(JAXBContextResolver.class);
+    return config;
+  }
 
+  private static class JerseyBinder extends AbstractBinder {
+    @Override
+    protected void configure() {
       appContext = new MockAppContext(0, 1, 1, 1);
       appContext.setBlacklistedNodes(Sets.newHashSet("badnode1", "badnode2"));
-
-      bind(JAXBContextResolver.class);
-      bind(AMWebServices.class);
-      bind(GenericExceptionHandler.class);
-      bind(AppContext.class).toInstance(appContext);
-      bind(Configuration.class).toInstance(conf);
-
-      serve("/*").with(GuiceContainer.class);
+      App app = new App(appContext);
+      bind(appContext).to(AppContext.class).named("am");
+      bind(app).to(App.class).named("app");
+      bind(CONF).to(Configuration.class).named("conf");
+      final HttpServletResponse response = mock(HttpServletResponse.class);
+      bind(response).to(HttpServletResponse.class);
     }
   }
 
-  static {
-    GuiceServletConfig.setInjector(
-        Guice.createInjector(new WebServletModule()));
-  }
-
-  @Before
   @Override
   public void setUp() throws Exception {

Review Comment:
   I will prepare a comprehensive document to explain all my improvement ideas. 
The part you mentioned will be included in the document.





> Update jersey from 1.19 to 2.x
> ------------------------------
>
>                 Key: HADOOP-15984
>                 URL: https://issues.apache.org/jira/browse/HADOOP-15984
>             Project: Hadoop Common
>          Issue Type: Improvement
>            Reporter: Akira Ajisaka
>            Assignee: Shilun Fan
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> jersey-json 1.19 depends on Jackson 1.9.2. Let's upgrade.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to