1   package com.atlassian.pageobjects.elements.test;
2   
3   import com.atlassian.pageobjects.TestedProductFactory;
4   import com.atlassian.pageobjects.elements.test.pageobjects.SampleTestedProduct;
5   import com.atlassian.webdriver.AtlassianWebDriver;
6   import org.junit.AfterClass;
7   import org.junit.BeforeClass;
8   
9   public abstract class AbstractFileBasedServerTest 
10  {
11      public static FileBasedServer server;
12      public static String rootUrl;
13      public static AtlassianWebDriver driver;
14      public static SampleTestedProduct product;
15  
16      @BeforeClass
17      public static void startServer() throws Exception
18      {
19          server = new FileBasedServer();
20          server.startServer();
21          int port = server.getPort();
22  
23          rootUrl = "http://localhost:" + port;
24  
25          System.setProperty("baseurl.testapp", rootUrl);
26          System.setProperty("http.testapp.port", String.valueOf(port));
27          System.setProperty("context.testapp.path", "/");
28  
29          product = TestedProductFactory.create(SampleTestedProduct.class);
30          driver = product.getTester().getDriver();
31      }
32  
33      @AfterClass
34      public static void stopServer() throws Exception
35      {
36          server.stopServer();
37      }
38  }