@Test public void testConfigureContentTypes() throws Exception { ServletContextHandler handler = EasyMock.createNiceMock(ServletContextHandler.class); FilterHolder filter = EasyMock.createNiceMock(FilterHolder.class); MimeTypes expectedMimeTypes = new MimeTypes(); EasyMock.expect(handler.getMimeTypes()).andReturn(expectedMimeTypes).anyTimes(); EasyMock.expect(handler.addFilter(isA(Class.class), anyString(), isA(EnumSet.class))).andReturn(filter).anyTimes(); replay(handler, filter); injector.getInstance(AmbariServer.class).configureRootHandler(handler); assertEquals("application/font-woff", expectedMimeTypes.getMimeByExtension("/file.woff").toString()); assertEquals("application/font-sfnt", expectedMimeTypes.getMimeByExtension("/file.ttf").toString()); EasyMock.verify(handler); }
protected void configureRootHandler(ServletContextHandler root) { configureHandlerCompression(root); configureAdditionalContentTypes(root); root.setContextPath(CONTEXT_PATH); root.setErrorHandler(injector.getInstance(AmbariErrorHandler.class)); root.setMaxFormContentSize(-1); root.setResourceBase(configs.getWebAppDir()); }
AmbariServer { protected void configureRootHandler(ServletContextHandler root) { configureHandlerCompression(root); configureAdditionalContentTypes(root); root.setContextPath(CONTEXT_PATH); root.setErrorHandler(injector.getInstance(AmbariErrorHandler.class)); root.setMaxFormContentSize(-1); root.setResourceBase(configs.getWebAppDir()); } }
AmbariServer { protected void configureRootHandler(ServletContextHandler root) { configureHandlerCompression(root); configureAdditionalContentTypes(root); root.setContextPath(CONTEXT_PATH); root.setErrorHandler(injector.getInstance(AmbariErrorHandler.class)); root.setMaxFormContentSize(-1); root.setResourceBase(configs.getWebAppDir()); }  }
AmbariServer { protected void configureRootHandler(ServletContextHandler root) { configureHandlerCompression(root); configureAdditionalContentTypes(root); root.setContextPath(CONTEXT_PATH); root.setErrorHandler(injector.getInstance(AmbariErrorHandler.class)); root.setMaxFormContentSize(-1); root.setResourceBase(configs.getWebAppDir()); }  String getServerOsType(); static AmbariManagementController getController(); @SuppressWarnings("deprecation") void run(); void stop(); @Deprecated void performStaticInjection(); void initViewRegistry(); static void setupProxyAuth(); static void enableLog4jMonitor(Map<String, String> configsMap); static void main(String[] args); }
AmbariServer { protected void configureRootHandler(ServletContextHandler root) { configureHandlerCompression(root); configureAdditionalContentTypes(root); root.setContextPath(CONTEXT_PATH); root.setErrorHandler(injector.getInstance(AmbariErrorHandler.class)); root.setMaxFormContentSize(-1); root.setResourceBase(configs.getWebAppDir()); }  String getServerOsType(); static AmbariManagementController getController(); @SuppressWarnings("deprecation") void run(); void stop(); @Deprecated void performStaticInjection(); void initViewRegistry(); static void setupProxyAuth(); static void enableLog4jMonitor(Map<String, String> configsMap); static void main(String[] args); static final String VIEWS_URL_PATTERN; static final EnumSet<DispatcherType> DISPATCHER_TYPES; volatile boolean running; }