Author: joshcanfield Date: Sat Jun 25 11:09:14 2011 New Revision: 1139520 URL: http://svn.apache.org/viewvc?rev=1139520&view=rev Log: Refactored Jetty7Runner to allow for additional configuration before starting the server.
Modified: tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/Jetty7Runner.java Modified: tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/Jetty7Runner.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/Jetty7Runner.java?rev=1139520&r1=1139519&r2=1139520&view=diff ============================================================================== --- tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/Jetty7Runner.java (original) +++ tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/Jetty7Runner.java Sat Jun 25 11:09:14 2011 @@ -25,15 +25,23 @@ import org.eclipse.jetty.webapp.WebAppCo */ public class Jetty7Runner implements ServletContainerRunner { - private final Server jettyServer; + private Server jettyServer; - private final String description; + private String description; - private final int port; + private int port; - private final int sslPort; + private int sslPort; - public Jetty7Runner(String webappFolder, String contextPath, int port, int sslPort) throws Exception + public Jetty7Runner() { + // un-configured runner + } + + public Jetty7Runner(String webappFolder, String contextPath, int port, int sslPort) throws Exception { + configure(webappFolder, contextPath, port, sslPort).start(); + } + + public Jetty7Runner configure(String webappFolder, String contextPath, int port, int sslPort) throws Exception { this.port = port; @@ -68,7 +76,10 @@ public class Jetty7Runner implements Ser } jettyServer.setHandler(webapp); + return this; + } + public void start() throws Exception { jettyServer.start(); } @@ -90,6 +101,11 @@ public class Jetty7Runner implements Ser System.out.println("Jetty instance has stopped."); } + public Server getServer() + { + return jettyServer; + } + @Override public String toString() { @@ -100,7 +116,7 @@ public class Jetty7Runner implements Ser * Needed inside Maven multi-projects to expand a path relative to the module to a complete * path. If the path already is absolute and points to an existing directory, it will be used * unchanged. - * + * * @param moduleLocalPath * @return expanded path * @see TapestryTestConstants#MODULE_BASE_DIR