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

The following examples show how to use org.apache.hadoop.yarn.webapp.Controller. These examples are extracted from open source projects. 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 Project: hadoop   Source File: WebAppTests.java    License: 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 Project: big-c   Source File: WebAppTests.java    License: 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 Project: tez   Source File: TestAMWebController.java    License: 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 Project: hadoop   Source File: WebAppTests.java    License: 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 Project: big-c   Source File: WebAppTests.java    License: 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);
}