Issue #1743 WIP tests

Signed-off-by: Jan Bartel <janb@webtide.com>
This commit is contained in:
Jan Bartel 2019-09-19 10:30:20 +10:00
parent 881f17c6be
commit 456e467bcb
7 changed files with 46 additions and 52 deletions

View File

@ -14,9 +14,11 @@
<name>Jetty :: Simple :: Webapp</name>
<properties>
<jetty.port.file>${project.build.directory}/jetty-start-war-distro-port.txt</jetty.port.file>
<jetty.port.file>${project.build.directory}/jetty-start-distro-port.txt</jetty.port.file>
<jetty.jvmArgs>@jetty.jvmArgs@</jetty.jvmArgs>
<jetty.runType>DISTRO</jetty.runType>
</properties>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.its.jetty-start-war-distro-mojo-it</groupId>
@ -106,14 +108,16 @@
</goals>
<configuration>
<webApp>
<war>${project.build.directory}/${project.artifactId}-${project.version}</war>
<!-- starts the assembled webapp by default -->
</webApp>
<jettyBase>${basedir}/src/base</jettyBase>
<javaPath>${java.home}/bin/java</javaPath>
<jettyProperties>
<jetty.port.file>${jetty.port.file}</jetty.port.file>
<jetty.server.dumpAfterStart>true</jetty.server.dumpAfterStart>
<jetty.port.file>${jetty.port.file}</jetty.port.file>
<jetty.http.port>0</jetty.http.port>
</jettyProperties>
<jettyXmls>
<jettyXml>${basedir}/src/config/jetty.xml</jettyXml>
</jettyXmls>
<modules>jsp,jstl,testmod</modules>
</configuration>
</execution>
</executions>

View File

@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_9_3.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Ref id="httpConnector">
<Call name="addLifeCycleListener">
<Arg>
<New class="org.eclipse.jetty.maven.plugin.ServerConnectorListener">
<Set name="fileName"><Property name="jetty.port.file" default="port.txt"/></Set>
</New>
</Arg>
</Call>
</Ref>
</Configure>

View File

@ -0,0 +1,12 @@
DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Enables test setup
[depend]
http
[xml]
etc/test-jetty.xml

View File

@ -1,40 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
<Set name="secureScheme">https</Set>
<Set name="securePort"><Property name="jetty.secure.port" default="8443" /></Set>
<Set name="outputBufferSize">32768</Set>
<Set name="requestHeaderSize">8192</Set>
<Set name="responseHeaderSize">8192</Set>
<Set name="headerCacheSize">4096</Set>
</New>
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.ServerConnector">
<Arg name="server"><Ref refid="Server" /></Arg>
<Arg name="factories">
<Array type="org.eclipse.jetty.server.ConnectionFactory">
<Item>
<New class="org.eclipse.jetty.server.HttpConnectionFactory">
<Arg name="config"><Ref refid="httpConfig" /></Arg>
</New>
</Item>
</Array>
</Arg>
<Call name="addLifeCycleListener">
<Arg>
<New class="org.eclipse.jetty.maven.plugin.ServerConnectorListener">
<Set name="fileName"><Property name="jetty.port.file" default="port.txt"/></Set>
</New>
</Arg>
</Call>
<Set name="host" property="jetty.host"/>
<Set name="port" property="jetty.port"/>
<Set name="idleTimeout">30000</Set>
</New>
</Arg>
</Call>
</Configure>

View File

@ -193,7 +193,7 @@ public abstract class AbstractWebAppMojo extends AbstractMojo
/**
* Root directory for all html/jsp etc files
*/
@Parameter (defaultValue="${maven.war.src}")
@Parameter (defaultValue="${project.baseDir}/src/main/webapp")
protected File webAppSourceDirectory;
/**
@ -219,8 +219,8 @@ public abstract class AbstractWebAppMojo extends AbstractMojo
* The default location of the web.xml file. Will be used
* if &lt;webApp&gt;&lt;descriptor&gt; is not set.
*/
@Parameter (defaultValue="${maven.war.webxml}", readonly=true)
protected String webXml;
@Parameter (defaultValue="${project.baseDir}/src/main/webapp/WEB-INF/web.xml")
protected File webXml;
/**
* The target directory
@ -871,7 +871,7 @@ public abstract class AbstractWebAppMojo extends AbstractMojo
*
*/
protected void verifyPomConfiguration () throws MojoExecutionException
{
{
// check the location of the static content/jsps etc
try
{
@ -1137,7 +1137,6 @@ public abstract class AbstractWebAppMojo extends AbstractMojo
//the former could be the location of a packed war, while the latter is the location
//after any unpacking. With this mojo, you are running an unpacked, unassembled webapp,
//so the two locations should be equal.
System.err.println("SRC WEBAPP: "+webAppSourceDirectory);
Resource webAppSourceDirectoryResource = Resource.newResource(webAppSourceDirectory.getCanonicalPath());
if (webApp.getWar() == null)
webApp.setWar(webAppSourceDirectoryResource.toString());

View File

@ -37,7 +37,7 @@ import org.apache.maven.plugins.annotations.ResolutionScope;
* </p>
*
*/
@Mojo( name = "newstart", requiresDependencyResolution = ResolutionScope.TEST)
@Mojo(name = "newstart", requiresDependencyResolution = ResolutionScope.TEST)
@Execute(phase = LifecyclePhase.VALIDATE)
public class NewJettyStartMojo extends AbstractWebAppMojo
{

View File

@ -19,6 +19,8 @@
package org.eclipse.jetty.maven.plugin;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Execute;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.eclipse.jetty.util.StringUtil;
@ -57,7 +59,10 @@ public class NewJettyStartWarMojo extends AbstractWebAppMojo
{
super.configureWebApp();
if (StringUtil.isBlank(webApp.getWar()))
{
super.verifyPomConfiguration();
configureUnassembledWebApp();
}
getLog().info("War = "+webApp.getWar());
}