private void setMoreParams(RequestContext rc, String pathInfo, Dest dest) { checkState(pathInfo.startsWith(dest.prefix), "prefix should match"); if (dest.pathParams.size() == 0 || dest.prefix.length() == pathInfo.length()) { return; } String[] parts = Iterables.toArray(WebApp.pathSplitter.split( pathInfo.substring(dest.prefix.length())), String.class); LOG.debug("parts={}, params={}", parts, dest.pathParams); for (int i = 0; i < dest.pathParams.size() && i < parts.length; ++i) { String key = dest.pathParams.get(i); if (key.charAt(0) == ':') { rc.moreParams().put(key.substring(1), parts[i]); } } }
private void setMoreParams(RequestContext rc, String pathInfo, Dest dest) { checkState(pathInfo.startsWith(dest.prefix), "prefix should match"); if (dest.pathParams.size() == 0 || dest.prefix.length() == pathInfo.length()) { return; } String[] parts = Iterables.toArray(WebApp.pathSplitter.split( pathInfo.substring(dest.prefix.length())), String.class); LOG.debug("parts={}, params={}", parts, dest.pathParams); for (int i = 0; i < dest.pathParams.size() && i < parts.length; ++i) { String key = dest.pathParams.get(i); if (key.charAt(0) == ':') { rc.moreParams().put(key.substring(1), parts[i]); } } }
private void setMoreParams(RequestContext rc, String pathInfo, Dest dest) { checkState(pathInfo.startsWith(dest.prefix), "prefix should match"); if (dest.pathParams.size() == 0 || dest.prefix.length() == pathInfo.length()) { return; } String[] parts = Iterables.toArray(WebApp.pathSplitter.split( pathInfo.substring(dest.prefix.length())), String.class); LOG.debug("parts={}, params={}", parts, dest.pathParams); for (int i = 0; i < dest.pathParams.size() && i < parts.length; ++i) { String key = dest.pathParams.get(i); if (key.charAt(0) == ':') { rc.moreParams().put(key.substring(1), parts[i]); } } }
@Test public void testView() { Injector injector = WebAppTests.createMockInjector(RMContext.class, mockRMContext(15, 1, 2, 8*GiB), new Module() { @Override public void configure(Binder binder) { try { ResourceManager mockRm = mockRm(3, 1, 2, 8*GiB); binder.bind(ResourceManager.class).toInstance(mockRm); } catch (IOException e) { throw new IllegalStateException(e); } } }); RmView rmViewInstance = injector.getInstance(RmView.class); rmViewInstance.set(YarnWebParams.APP_STATE, YarnApplicationState.RUNNING.toString()); rmViewInstance.render(); WebAppTests.flushOutput(injector); rmViewInstance.set(YarnWebParams.APP_STATE, StringHelper.cjoin( YarnApplicationState.ACCEPTED.toString(), YarnApplicationState.RUNNING.toString())); rmViewInstance.render(); WebAppTests.flushOutput(injector); Map<String, String> moreParams = rmViewInstance.context().requestContext().moreParams(); String appsTableColumnsMeta = moreParams.get("ui.dataTables.apps.init"); Assert.assertTrue(appsTableColumnsMeta.indexOf("natural") != -1); }
WebAppTests.flushOutput(injector); Map<String, String> moreParams = rmViewInstance.context().requestContext().moreParams(); String appsTableColumnsMeta = moreParams.get("ui.dataTables.apps.init"); Assert.assertTrue(appsTableColumnsMeta.indexOf("natural") != -1);
public Map<String, String> moreParams() { return context().rc.moreParams(); }
public Map<String, String> moreParams() { return context().rc.moreParams(); }
@Test public void testAppAttemptPageNaturalSortType() throws Exception { Injector injector = WebAppTests.createMockInjector(ApplicationBaseProtocol.class, mockApplicationHistoryClientService(1, 1, 5)); AppAttemptPage appAttemptPageInstance = injector.getInstance(AppAttemptPage.class); appAttemptPageInstance.render(); WebAppTests.flushOutput(injector); Map<String, String> moreParams = appAttemptPageInstance.context().requestContext().moreParams(); String tableColumnsMeta = moreParams.get("ui.dataTables.containers.init"); Assert.assertTrue(tableColumnsMeta.indexOf("natural") != -1); }
public void set(String key, String value) { moreParams().put(key, value); }
public void set(String key, String value) { moreParams().put(key, value); }
@Test public void testAPPViewNaturalSortType() throws Exception { Injector injector = WebAppTests.createMockInjector(ApplicationBaseProtocol.class, mockApplicationHistoryClientService(5, 1, 1)); AHSView ahsViewInstance = injector.getInstance(AHSView.class); ahsViewInstance.render(); WebAppTests.flushOutput(injector); Map<String, String> moreParams = ahsViewInstance.context().requestContext().moreParams(); String appTableColumnsMeta = moreParams.get("ui.dataTables.apps.init"); Assert.assertTrue(appTableColumnsMeta.indexOf("natural") != -1); }
@Test public void testAppPageNaturalSortType() throws Exception { Injector injector = WebAppTests.createMockInjector(ApplicationBaseProtocol.class, mockApplicationHistoryClientService(1, 5, 1)); AppPage appPageInstance = injector.getInstance(AppPage.class); appPageInstance.render(); WebAppTests.flushOutput(injector); Map<String, String> moreParams = appPageInstance.context().requestContext().moreParams(); String attemptsTableColumnsMeta = moreParams.get("ui.dataTables.attempts.init"); Assert.assertTrue(attemptsTableColumnsMeta.indexOf("natural") != -1); }
public String get(String key, String defaultValue) { String value = moreParams().get(key); if (value == null) { value = request.getParameter(key); } return value == null ? defaultValue : value; }
public Map<String, String> moreParams() { return context().requestContext().moreParams(); }
public String get(String key, String defaultValue) { String value = moreParams().get(key); if (value == null) { value = request.getParameter(key); } return value == null ? defaultValue : value; }
public void set(String key, String value) { moreParams().put(key, value); }
public String get(String key, String defaultValue) { String value = moreParams().get(key); if (value == null) { value = request.getParameter(key); } return value == null ? defaultValue : value; }