org.apache.hadoop.yarn.webapp.GenericExceptionHandler Java Examples

The following examples show how to use org.apache.hadoop.yarn.webapp.GenericExceptionHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StramWebServicesTest.java    From attic-apex-core with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets()
{
  LogicalPlan dag = new LogicalPlan();
  String workingDir = new File("target", StramWebServicesTest.class.getName()).getAbsolutePath();
  dag.setAttribute(LogicalPlan.APPLICATION_PATH, workingDir);
  dag.setAttribute(Context.OperatorContext.STORAGE_AGENT, new AsyncFSStorageAgent(workingDir, null));
  dag.setAttribute(LogicalPlan.METRICS_TRANSPORT, new AutoMetricBuiltInTransport("xyz"));
  final DummyStreamingContainerManager streamingContainerManager = new DummyStreamingContainerManager(dag);

  appContext = new TestAppContext(dag.getAttributes());
  bind(JAXBContextResolver.class);
  bind(StramWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(StramAppContext.class).toInstance(appContext);
  bind(StreamingContainerManager.class).toInstance(streamingContainerManager);
  bind(Configuration.class).toInstance(conf);
  serve("/*").with(GuiceContainer.class);
}
 
Example #2
Source File: RMWebApp.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
public void setup() {
  bind(JAXBContextResolver.class);
  bind(RMWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(RMWebApp.class).toInstance(this);

  if (rm != null) {
    bind(ResourceManager.class).toInstance(rm);
    bind(ApplicationBaseProtocol.class).toInstance(rm.getClientRMService());
  }
  route("/", RmController.class);
  route(pajoin("/nodes", NODE_STATE), RmController.class, "nodes");
  route(pajoin("/apps", APP_STATE), RmController.class);
  route("/cluster", RmController.class, "about");
  route(pajoin("/app", APPLICATION_ID), RmController.class, "app");
  route("/scheduler", RmController.class, "scheduler");
  route(pajoin("/queue", QUEUE_NAME), RmController.class, "queue");
  route("/nodelabels", RmController.class, "nodelabels");
  route(pajoin("/appattempt", APPLICATION_ATTEMPT_ID), RmController.class,
    "appattempt");
  route(pajoin("/container", CONTAINER_ID), RmController.class, "container");
}
 
Example #3
Source File: WebServer.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
public void setup() {
  bind(NMWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(JAXBContextResolver.class);
  bind(ResourceView.class).toInstance(this.resourceView);
  bind(ApplicationACLsManager.class).toInstance(this.aclsManager);
  bind(LocalDirsHandlerService.class).toInstance(dirsHandler);
  route("/", NMController.class, "info");
  route("/node", NMController.class, "node");
  route("/allApplications", NMController.class, "allApplications");
  route("/allContainers", NMController.class, "allContainers");
  route(pajoin("/application", APPLICATION_ID), NMController.class,
      "application");
  route(pajoin("/container", CONTAINER_ID), NMController.class,
      "container");
  route(
      pajoin("/containerlogs", CONTAINER_ID, APP_OWNER, CONTAINER_LOG_TYPE),
      NMController.class, "logs");
}
 
Example #4
Source File: TestRMWebServicesNodeLabels.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {
  bind(JAXBContextResolver.class);
  bind(RMWebServices.class);
  bind(GenericExceptionHandler.class);
  try {
    userName = UserGroupInformation.getCurrentUser().getShortUserName();
  } catch (IOException ioe) {
    throw new RuntimeException("Unable to get current user name "
        + ioe.getMessage(), ioe);
  }
  notUserName = userName + "abc123";
  conf = new YarnConfiguration();
  conf.set(YarnConfiguration.YARN_ADMIN_ACL, userName);
  rm = new MockRM(conf);
  bind(ResourceManager.class).toInstance(rm);
  filter("/*").through(
      TestRMWebServicesAppsModification.TestRMCustomAuthFilter.class);
  serve("/*").with(GuiceContainer.class);
}
 
Example #5
Source File: TestRMWebServicesDelegationTokens.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {
  bind(JAXBContextResolver.class);
  bind(RMWebServices.class);
  bind(GenericExceptionHandler.class);
  Configuration rmconf = new Configuration();
  rmconf.setInt(YarnConfiguration.RM_AM_MAX_ATTEMPTS,
    YarnConfiguration.DEFAULT_RM_AM_MAX_ATTEMPTS);
  rmconf.setClass(YarnConfiguration.RM_SCHEDULER, FifoScheduler.class,
    ResourceScheduler.class);
  rmconf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
  rm = new MockRM(rmconf);
  bind(ResourceManager.class).toInstance(rm);
  if (isKerberosAuth == true) {
    filter("/*").through(TestKerberosAuthFilter.class);
  } else {
    filter("/*").through(TestSimpleAuthFilter.class);
  }
  serve("/*").with(GuiceContainer.class);
}
 
Example #6
Source File: AHSWebApp.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
public void setup() {
  bind(YarnJacksonJaxbJsonProvider.class);
  bind(AHSWebServices.class);
  bind(TimelineWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(ApplicationBaseProtocol.class).toInstance(historyClientService);
  bind(TimelineDataManager.class).toInstance(timelineDataManager);
  route("/", AHSController.class);
  route(pajoin("/apps", APP_STATE), AHSController.class);
  route(pajoin("/app", APPLICATION_ID), AHSController.class, "app");
  route(pajoin("/appattempt", APPLICATION_ATTEMPT_ID), AHSController.class,
    "appattempt");
  route(pajoin("/container", CONTAINER_ID), AHSController.class, "container");
  route(
    pajoin("/logs", NM_NODENAME, CONTAINER_ID, ENTITY_STRING, APP_OWNER,
      CONTAINER_LOG_TYPE), AHSController.class, "logs");
}
 
Example #7
Source File: AMWebApp.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
public void setup() {
  bind(JAXBContextResolver.class);
  bind(GenericExceptionHandler.class);
  bind(AMWebServices.class);
  route("/", AppController.class);
  route("/app", AppController.class);
  route(pajoin("/job", JOB_ID), AppController.class, "job");
  route(pajoin("/conf", JOB_ID), AppController.class, "conf");
  route(pajoin("/jobcounters", JOB_ID), AppController.class, "jobCounters");
  route(pajoin("/singlejobcounter",JOB_ID, COUNTER_GROUP, COUNTER_NAME),
      AppController.class, "singleJobCounter");
  route(pajoin("/tasks", JOB_ID, TASK_TYPE, TASK_STATE), AppController.class, "tasks");
  route(pajoin("/attempts", JOB_ID, TASK_TYPE, ATTEMPT_STATE),
      AppController.class, "attempts");
  route(pajoin("/task", TASK_ID), AppController.class, "task");
  route(pajoin("/taskcounters", TASK_ID), AppController.class, "taskCounters");
  route(pajoin("/singletaskcounter",TASK_ID, COUNTER_GROUP, COUNTER_NAME),
      AppController.class, "singleTaskCounter");
}
 
Example #8
Source File: TestHsWebServicesAttempts.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(0, 1, 2, 1);
  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
Example #9
Source File: TestHsWebServices.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(0, 1, 1, 1);
  JobHistory jobHistoryService = new JobHistory();
  HistoryContext historyContext = (HistoryContext) jobHistoryService;
  webApp = new HsWebApp(historyContext);

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
Example #10
Source File: TestHsWebServicesJobs.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(0, 1, 2, 1, false);
  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
Example #11
Source File: TestHsWebServicesJobsQuery.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(3, 2, 1);
  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
Example #12
Source File: WebServer.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
public void setup() {
  bind(NMWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(JAXBContextResolver.class);
  bind(ResourceView.class).toInstance(this.resourceView);
  bind(ApplicationACLsManager.class).toInstance(this.aclsManager);
  bind(LocalDirsHandlerService.class).toInstance(dirsHandler);
  route("/", NMController.class, "info");
  route("/node", NMController.class, "node");
  route("/allApplications", NMController.class, "allApplications");
  route("/allContainers", NMController.class, "allContainers");
  route(pajoin("/application", APPLICATION_ID), NMController.class,
      "application");
  route(pajoin("/container", CONTAINER_ID), NMController.class,
      "container");
  route(
      pajoin("/containerlogs", CONTAINER_ID, APP_OWNER, CONTAINER_LOG_TYPE),
      NMController.class, "logs");
}
 
Example #13
Source File: TestRMWebServicesNodeLabels.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {
  bind(JAXBContextResolver.class);
  bind(RMWebServices.class);
  bind(GenericExceptionHandler.class);
  try {
    userName = UserGroupInformation.getCurrentUser().getShortUserName();
  } catch (IOException ioe) {
    throw new RuntimeException("Unable to get current user name "
        + ioe.getMessage(), ioe);
  }
  notUserName = userName + "abc123";
  conf = new YarnConfiguration();
  conf.set(YarnConfiguration.YARN_ADMIN_ACL, userName);
  rm = new MockRM(conf);
  bind(ResourceManager.class).toInstance(rm);
  filter("/*").through(
      TestRMWebServicesAppsModification.TestRMCustomAuthFilter.class);
  serve("/*").with(GuiceContainer.class);
}
 
Example #14
Source File: TestRMWebServicesDelegationTokens.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {
  bind(JAXBContextResolver.class);
  bind(RMWebServices.class);
  bind(GenericExceptionHandler.class);
  Configuration rmconf = new Configuration();
  rmconf.setInt(YarnConfiguration.RM_AM_MAX_ATTEMPTS,
    YarnConfiguration.DEFAULT_RM_AM_MAX_ATTEMPTS);
  rmconf.setClass(YarnConfiguration.RM_SCHEDULER, FifoScheduler.class,
    ResourceScheduler.class);
  rmconf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
  rm = new MockRM(rmconf);
  bind(ResourceManager.class).toInstance(rm);
  if (isKerberosAuth == true) {
    filter("/*").through(TestKerberosAuthFilter.class);
  } else {
    filter("/*").through(TestSimpleAuthFilter.class);
  }
  serve("/*").with(GuiceContainer.class);
}
 
Example #15
Source File: AHSWebApp.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
public void setup() {
  bind(YarnJacksonJaxbJsonProvider.class);
  bind(AHSWebServices.class);
  bind(TimelineWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(ApplicationBaseProtocol.class).toInstance(historyClientService);
  bind(TimelineDataManager.class).toInstance(timelineDataManager);
  route("/", AHSController.class);
  route(pajoin("/apps", APP_STATE), AHSController.class);
  route(pajoin("/app", APPLICATION_ID), AHSController.class, "app");
  route(pajoin("/appattempt", APPLICATION_ATTEMPT_ID), AHSController.class,
    "appattempt");
  route(pajoin("/container", CONTAINER_ID), AHSController.class, "container");
  route(
    pajoin("/logs", NM_NODENAME, CONTAINER_ID, ENTITY_STRING, APP_OWNER,
      CONTAINER_LOG_TYPE), AHSController.class, "logs");
}
 
Example #16
Source File: AMWebApp.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
public void setup() {
  bind(JAXBContextResolver.class);
  bind(GenericExceptionHandler.class);
  bind(AMWebServices.class);
  route("/", AppController.class);
  route("/app", AppController.class);
  route(pajoin("/job", JOB_ID), AppController.class, "job");
  route(pajoin("/conf", JOB_ID), AppController.class, "conf");
  route(pajoin("/jobcounters", JOB_ID), AppController.class, "jobCounters");
  route(pajoin("/singlejobcounter",JOB_ID, COUNTER_GROUP, COUNTER_NAME),
      AppController.class, "singleJobCounter");
  route(pajoin("/tasks", JOB_ID, TASK_TYPE, TASK_STATE), AppController.class, "tasks");
  route(pajoin("/attempts", JOB_ID, TASK_TYPE, ATTEMPT_STATE),
      AppController.class, "attempts");
  route(pajoin("/task", TASK_ID), AppController.class, "task");
  route(pajoin("/taskcounters", TASK_ID), AppController.class, "taskCounters");
  route(pajoin("/singletaskcounter",TASK_ID, COUNTER_GROUP, COUNTER_NAME),
      AppController.class, "singleTaskCounter");
}
 
Example #17
Source File: TestHsWebServicesAttempts.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(0, 1, 2, 1);
  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
Example #18
Source File: RMWebApp.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
public void setup() {
  bind(JAXBContextResolver.class);
  bind(RMWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(RMWebApp.class).toInstance(this);

  if (rm != null) {
    bind(ResourceManager.class).toInstance(rm);
    bind(ApplicationBaseProtocol.class).toInstance(rm.getClientRMService());
  }
  route("/", RmController.class);
  route(pajoin("/nodes", NODE_STATE), RmController.class, "nodes");
  route(pajoin("/apps", APP_STATE), RmController.class);
  route("/cluster", RmController.class, "about");
  route(pajoin("/app", APPLICATION_ID), RmController.class, "app");
  route("/scheduler", RmController.class, "scheduler");
  route(pajoin("/queue", QUEUE_NAME), RmController.class, "queue");
  route("/nodelabels", RmController.class, "nodelabels");
  route(pajoin("/appattempt", APPLICATION_ATTEMPT_ID), RmController.class,
    "appattempt");
  route(pajoin("/container", CONTAINER_ID), RmController.class, "container");
}
 
Example #19
Source File: TestHsWebServices.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(0, 1, 1, 1);
  JobHistory jobHistoryService = new JobHistory();
  HistoryContext historyContext = (HistoryContext) jobHistoryService;
  webApp = new HsWebApp(historyContext);

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
Example #20
Source File: TestHsWebServicesJobs.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(0, 1, 2, 1, false);
  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
Example #21
Source File: TestHsWebServicesJobsQuery.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(3, 2, 1);
  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
Example #22
Source File: TestHsWebServicesTasks.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(0, 1, 2, 1);
  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
Example #23
Source File: TestHsWebServicesTasks.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(0, 1, 2, 1);
  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
Example #24
Source File: TestRMWebServicesApps.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
protected void configureServlets() {
  bind(JAXBContextResolver.class);
  bind(RMWebServices.class);
  bind(GenericExceptionHandler.class);
  Configuration conf = new Configuration();
  conf.setInt(YarnConfiguration.RM_AM_MAX_ATTEMPTS,
      YarnConfiguration.DEFAULT_RM_AM_MAX_ATTEMPTS);
  conf.setClass(YarnConfiguration.RM_SCHEDULER, FifoScheduler.class,
      ResourceScheduler.class);
  rm = new MockRM(conf);
  bind(ResourceManager.class).toInstance(rm);
  serve("/*").with(GuiceContainer.class);
}
 
Example #25
Source File: AMSWebApp.java    From ambari-metrics with Apache License 2.0 5 votes vote down vote up
@Override
public void setup() {
  bind(YarnJacksonJaxbJsonProvider.class);
  bind(TimelineWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(TimelineMetricStore.class).toInstance(timelineMetricStore);
  route("/", AMSController.class);
}
 
Example #26
Source File: TestRMWebServicesNodes.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
protected void configureServlets() {
  bind(JAXBContextResolver.class);
  bind(RMWebServices.class);
  bind(GenericExceptionHandler.class);
  rm = new MockRM(new Configuration());
  rm.getRMContext().getContainerTokenSecretManager().rollMasterKey();
  rm.getRMContext().getNMTokenSecretManager().rollMasterKey();
  bind(ResourceManager.class).toInstance(rm);
  serve("/*").with(GuiceContainer.class);
}
 
Example #27
Source File: TestAHSWebServices.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
protected void configureServlets() {
  bind(JAXBContextResolver.class);
  bind(AHSWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(ApplicationBaseProtocol.class).toInstance(historyClientService);
  serve("/*").with(GuiceContainer.class);
  filter("/*").through(TestSimpleAuthFilter.class);
}
 
Example #28
Source File: TestAMWebServicesTasks.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
protected void configureServlets() {

  appContext = new MockAppContext(0, 1, 2, 1);
  bind(JAXBContextResolver.class);
  bind(AMWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(AppContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
Example #29
Source File: TestRMWebServicesCapacitySched.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
protected void configureServlets() {
  bind(JAXBContextResolver.class);
  bind(RMWebServices.class);
  bind(GenericExceptionHandler.class);
  csConf = new CapacitySchedulerConfiguration();
  setupQueueConfiguration(csConf);
  conf = new YarnConfiguration(csConf);
  conf.setClass(YarnConfiguration.RM_SCHEDULER, CapacityScheduler.class,
  ResourceScheduler.class);
  rm = new MockRM(conf);
  bind(ResourceManager.class).toInstance(rm);
  serve("/*").with(GuiceContainer.class);
}
 
Example #30
Source File: TestAMWebServicesJobConf.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
protected void configureServlets() {

  Path confPath = new Path(testConfDir.toString(),
      MRJobConfig.JOB_CONF_FILE);
  Configuration config = new Configuration();

  FileSystem localFs;
  try {
    localFs = FileSystem.getLocal(config);
    confPath = localFs.makeQualified(confPath);

    OutputStream out = localFs.create(confPath);
    try {
      conf.writeXml(out);
    } finally {
      out.close();
    }
    if (!localFs.exists(confPath)) {
      fail("error creating config file: " + confPath);
    }

  } catch (IOException e) {
    fail("error creating config file: " + e.getMessage());
  }

  appContext = new MockAppContext(0, 2, 1, confPath);

  bind(JAXBContextResolver.class);
  bind(AMWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(AppContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}