Пример #1
0
 @Override
 protected void setUp() throws Exception {
   try {
     WebAppContext fakeSteam = new WebAppContext();
     fakeSteam.setWar("src/test/webapp");
     fakeSteam.setContextPath("/");
     statsServlet = new StatsServlet();
     ServletHolder statsHolder = new ServletHolder(statsServlet);
     statsHolder.setInitOrder(1);
     fakeSteam.addServlet(statsHolder, "/*");
     server = new Server(port);
     server.setStopAtShutdown(false);
     server.setHandler(fakeSteam);
     server.start();
     Steamer.steamcommunity = "localhost:" + port;
   } catch (Exception e) {
     server = null;
     fail("Failing while stating server");
   }
   super.setUp();
 }
Пример #2
0
 @Override
 protected void tearDown() throws Exception {
   super.tearDown();
   if (server != null) server.stop();
   statsServlet = null;
 }