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

The following examples show how to use org.apache.hadoop.yarn.webapp.Controller. 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: WebAppTests.java    From hadoop with Apache License 2.0 5 votes vote down vote up
public static <T> Injector testController(Class<? extends Controller> ctrlr,
    String methodName, Class<T> api, T impl, Module... modules) {
  try {
    Injector injector = createMockInjector(api, impl, modules);
    Method method = ctrlr.getMethod(methodName, (Class<?>[])null);
    method.invoke(injector.getInstance(ctrlr), (Object[])null);
    return injector;
  } catch (Exception e) {
    throw new WebAppException(e);
  }
}
 
Example #2
Source File: WebAppTests.java    From big-c with Apache License 2.0 5 votes vote down vote up
public static <T> Injector testController(Class<? extends Controller> ctrlr,
    String methodName, Class<T> api, T impl, Module... modules) {
  try {
    Injector injector = createMockInjector(api, impl, modules);
    Method method = ctrlr.getMethod(methodName, (Class<?>[])null);
    method.invoke(injector.getInstance(ctrlr), (Object[])null);
    return injector;
  } catch (Exception e) {
    throw new WebAppException(e);
  }
}
 
Example #3
Source File: TestAMWebController.java    From tez with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
  MockitoAnnotations.initMocks(this);

  mockAppContext = mock(AppContext.class);
  Configuration conf = new Configuration(false);
  conf.set(TezConfiguration.TEZ_HISTORY_URL_BASE, "http://uihost:9001/foo");
  when(mockAppContext.getAMConf()).thenReturn(conf);
  mockRequestContext = mock(Controller.RequestContext.class);
  mockResponse = mock(HttpServletResponse.class);
  mockRequest = mock(HttpServletRequest.class);
}
 
Example #4
Source File: WebAppTests.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public static <T> Injector testController(Class<? extends Controller> ctrlr,
    String methodName) {
  return testController(ctrlr, methodName, null, null);
}
 
Example #5
Source File: WebAppTests.java    From big-c with Apache License 2.0 4 votes vote down vote up
public static <T> Injector testController(Class<? extends Controller> ctrlr,
    String methodName) {
  return testController(ctrlr, methodName, null, null);
}