@AfterClass public static void cleanup() { try { if (idpServer.getServer() != null && idpServer.getServer().getState() != LifecycleState.DESTROYED) { if (idpServer.getServer().getState() != LifecycleState.STOPPED) { idpServer.stop(); } idpServer.destroy(); } } catch (Exception e) { e.printStackTrace(); } try { if (rpServer.getServer() != null && rpServer.getServer().getState() != LifecycleState.DESTROYED) { if (rpServer.getServer().getState() != LifecycleState.STOPPED) { rpServer.stop(); } rpServer.destroy(); } } catch (Exception e) { e.printStackTrace(); } }
@After @Override public void tearDown() throws Exception { try { // Some tests may call tomcat.destroy(), some tests may just call // tomcat.stop(), some not call either method. Make sure that stop() // & destroy() are called as necessary. if (tomcat.server != null && tomcat.server.getState() != LifecycleState.DESTROYED) { if (tomcat.server.getState() != LifecycleState.STOPPED) { tomcat.stop(); } tomcat.destroy(); } } finally { super.tearDown(); } }
@AfterClass public static void shutdownTomcat() throws Exception { tomcat.stop(); tomcat.destroy(); }
public void stop() throws Exception { tomcat.stop(); tomcat.destroy(); FileUtil.deleteDir(webRoot); }