@Test public void testConfigureSessionManager() throws Exception { AmbariServer ambariServer = new AmbariServer(); Configuration configuration = createNiceMock(Configuration.class); SessionManager sessionManager = createNiceMock(SessionManager.class); SessionCookieConfig sessionCookieConfig = createNiceMock(SessionCookieConfig.class); ambariServer.configs = configuration; expect(sessionManager.getSessionCookieConfig()).andReturn(sessionCookieConfig).anyTimes(); expect(configuration.getApiSSLAuthentication()).andReturn(false); sessionCookieConfig.setHttpOnly(true); expect(configuration.getApiSSLAuthentication()).andReturn(true); sessionCookieConfig.setHttpOnly(true); sessionCookieConfig.setSecure(true); replay(configuration, sessionManager, sessionCookieConfig); ambariServer.configureSessionManager(sessionManager); ambariServer.configureSessionManager(sessionManager); verify(configuration, sessionManager, sessionCookieConfig); }
protected void configureSessionManager(SessionManager sessionManager) { sessionManager.getSessionCookieConfig().setName("AMBARISESSIONID"); sessionManager.getSessionCookieConfig().setHttpOnly(true); if (configs.getApiSSLAuthentication()) { sessionManager.getSessionCookieConfig().setSecure(true); } int sessionInactivityTimeout = configs.getHttpSessionInactiveTimeout(); sessionManager.setMaxInactiveInterval(sessionInactivityTimeout); }
AmbariServer { protected void configureSessionManager(SessionManager sessionManager) { sessionManager.getSessionCookieConfig().setName("AMBARISESSIONID"); sessionManager.getSessionCookieConfig().setHttpOnly(true); if (configs.getApiSSLAuthentication()) { sessionManager.getSessionCookieConfig().setSecure(true); } int sessionInactivityTimeout = configs.getHttpSessionInactiveTimeout(); sessionManager.setMaxInactiveInterval(sessionInactivityTimeout); } }
AmbariServer { protected void configureSessionManager(SessionManager sessionManager) { sessionManager.getSessionCookieConfig().setName("AMBARISESSIONID"); sessionManager.getSessionCookieConfig().setHttpOnly(true); if (configs.getApiSSLAuthentication()) { sessionManager.getSessionCookieConfig().setSecure(true); } int sessionInactivityTimeout = configs.getHttpSessionInactiveTimeout(); sessionManager.setMaxInactiveInterval(sessionInactivityTimeout); }  }
AmbariServer { protected void configureSessionManager(SessionManager sessionManager) { sessionManager.getSessionCookieConfig().setName("AMBARISESSIONID"); sessionManager.getSessionCookieConfig().setHttpOnly(true); if (configs.getApiSSLAuthentication()) { sessionManager.getSessionCookieConfig().setSecure(true); } int sessionInactivityTimeout = configs.getHttpSessionInactiveTimeout(); sessionManager.setMaxInactiveInterval(sessionInactivityTimeout); }  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 configureSessionManager(SessionManager sessionManager) { sessionManager.getSessionCookieConfig().setName("AMBARISESSIONID"); sessionManager.getSessionCookieConfig().setHttpOnly(true); if (configs.getApiSSLAuthentication()) { sessionManager.getSessionCookieConfig().setSecure(true); } int sessionInactivityTimeout = configs.getHttpSessionInactiveTimeout(); sessionManager.setMaxInactiveInterval(sessionInactivityTimeout); }  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; }