ServerWebApp extends Server implements ServletContextListener { static String getHomeDir(String name) { String homeDir = HOME_DIR_TL.get(); if (homeDir == null) { String sysProp = name + HOME_DIR; homeDir = System.getProperty(sysProp); if (homeDir == null) { throw new IllegalArgumentException( MessageFormat.format("System property [{0}] not defined", sysProp)); } } return homeDir; } protected  ServerWebApp(String name, String homeDir, String configDir,
      String logDir, String tempDir, Configuration config); protected  ServerWebApp(String name, String homeDir, Configuration config);  ServerWebApp(String name); static void setHomeDirForCurrentThread(String homeDir); @Override void contextInitialized(ServletContextEvent event); @Override void contextDestroyed(ServletContextEvent event); InetSocketAddress getAuthority(); @VisibleForTesting void setAuthority(InetSocketAddress authority); boolean isSslEnabled(); static final String SSL_ENABLED; }
@Test(expected = IllegalArgumentException.class) public void getHomeDirNotDef() { ServerWebApp.getHomeDir("TestServerWebApp00"); }
@Test public void getHomeDir() { System.setProperty("TestServerWebApp0.home.dir", "/tmp"); assertEquals(ServerWebApp.getHomeDir("TestServerWebApp0"), "/tmp"); assertEquals( ServerWebApp.getDir("TestServerWebApp0", ".log.dir", "/tmp/log"), "/tmp/log"); System.setProperty("TestServerWebApp0.log.dir", "/tmplog"); assertEquals( ServerWebApp.getDir("TestServerWebApp0", ".log.dir", "/tmp/log"), "/tmplog"); }