Skip to content

Instantly share code, notes, and snippets.

@kinisoftware
Created May 19, 2013 10:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kinisoftware/5607277 to your computer and use it in GitHub Desktop.
Save kinisoftware/5607277 to your computer and use it in GitHub Desktop.
Booting Jetty from Java code
@RunWith(Suite.class)
@SuiteClasses({ MyTestClass.class })
public class JettyServerRESTTestSuite {
private static final String APP_NAME = "/context";
private static final int PORT = 4141;
public static final String APP_SERVER_ADDRESS = "http://localhost:" + PORT + APP_NAME + "/rest" + APP_NAME;
private static Server server;
@BeforeClass
public static void setUp() throws Exception {
WebAppContext webAppContext = new WebAppContext("src/main/webapp", APP_NAME);
System.setProperty("DEBUG", "true");
server = new Server(PORT);
...
server.start();
}
@AfterClass
public static void stop() throws Exception {
server.stop();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment