Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Becker2013-09-16 16:04:52 +0000
committerThomas Becker2013-09-16 16:05:31 +0000
commit257e1a9f2e81a3e09d60308ad84d008fbbc7311b (patch)
tree8df553115554ef6423a831dae2bdf20525128b3c
parentea22c2128106dd1590210ef44064a2bfa1514848 (diff)
downloadorg.eclipse.jetty.project-257e1a9f2e81a3e09d60308ad84d008fbbc7311b.tar.gz
org.eclipse.jetty.project-257e1a9f2e81a3e09d60308ad84d008fbbc7311b.tar.xz
org.eclipse.jetty.project-257e1a9f2e81a3e09d60308ad84d008fbbc7311b.zip
416674 run all jetty-ant tests on random ports
-rw-r--r--jetty-ant/src/test/java/org/eclipse/jetty/ant/JettyAntTaskTest.java26
-rw-r--r--jetty-ant/src/test/resources/webapp-test.xml2
2 files changed, 14 insertions, 14 deletions
diff --git a/jetty-ant/src/test/java/org/eclipse/jetty/ant/JettyAntTaskTest.java b/jetty-ant/src/test/java/org/eclipse/jetty/ant/JettyAntTaskTest.java
index ec70c7c80a..39960ce2c0 100644
--- a/jetty-ant/src/test/java/org/eclipse/jetty/ant/JettyAntTaskTest.java
+++ b/jetty-ant/src/test/java/org/eclipse/jetty/ant/JettyAntTaskTest.java
@@ -21,12 +21,12 @@ package org.eclipse.jetty.ant;
import java.net.HttpURLConnection;
import java.net.URI;
-import junit.framework.Assert;
-
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
-import org.junit.Ignore;
import org.junit.Test;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
public class JettyAntTaskTest
{
@@ -42,9 +42,9 @@ public class JettyAntTaskTest
HttpURLConnection connection = (HttpURLConnection)uri.toURL().openConnection();
connection.connect();
-
- Assert.assertEquals(404,connection.getResponseCode());
-
+
+ assertThat("response code is 404", connection.getResponseCode(), is(404));
+
build.stop();
}
@@ -53,17 +53,17 @@ public class JettyAntTaskTest
public void testWebApp () throws Exception
{
AntBuild build = new AntBuild(MavenTestingUtils.getTestResourceFile("webapp-test.xml").getAbsolutePath());
-
+
build.start();
-
+
URI uri = new URI("http://" + build.getJettyHost() + ":" + build.getJettyPort() + "/");
-
+
HttpURLConnection connection = (HttpURLConnection)uri.toURL().openConnection();
-
+
connection.connect();
-
- Assert.assertEquals(200,connection.getResponseCode());
-
+
+ assertThat("response code is 200", connection.getResponseCode(), is(200));
+
System.err.println("Stop build!");
build.stop();
}
diff --git a/jetty-ant/src/test/resources/webapp-test.xml b/jetty-ant/src/test/resources/webapp-test.xml
index dbc99ed881..259375993b 100644
--- a/jetty-ant/src/test/resources/webapp-test.xml
+++ b/jetty-ant/src/test/resources/webapp-test.xml
@@ -10,7 +10,7 @@
classpathref="jetty.plugin.classpath" loaderref="jetty.loader" />
<target name="jetty.run">
- <jetty.run daemon="true" scanIntervalSeconds="10">
+ <jetty.run daemon="true" scanIntervalSeconds="10" jettyPort="0">
<webapp war="${basedir}/src/test/resources/foo" contextpath="/" />
</jetty.run>
</target>

Back to the top