More testing of embedded examples

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2019-09-09 20:47:16 -05:00
parent 4f87da5f25
commit bec14ff870
6 changed files with 22 additions and 4 deletions

View File

@ -70,11 +70,12 @@ public class JettyDistribution
if (distro == null) if (distro == null)
{ {
LOG.info("JettyDistribution() = FAILURE"); LOG.info("JettyDistribution() FAILURE: NOT FOUND");
throw new RuntimeException("Unable to find built jetty-distribution, run the build and try again.");
} }
else
{
LOG.debug("JettyDistribution() FOUND = " + distro); LOG.debug("JettyDistribution() FOUND = " + distro);
}
DISTRIBUTION = distro; DISTRIBUTION = distro;
} }
@ -125,6 +126,8 @@ public class JettyDistribution
public static Path resolve(String path) public static Path resolve(String path)
{ {
if (DISTRIBUTION == null)
throw new RuntimeException("jetty-distribution not found");
return DISTRIBUTION.resolve(path); return DISTRIBUTION.resolve(path);
} }

View File

@ -32,6 +32,7 @@ import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
public class LikeJettyXmlTest extends AbstractEmbeddedTest public class LikeJettyXmlTest extends AbstractEmbeddedTest
{ {
@ -42,6 +43,8 @@ public class LikeJettyXmlTest extends AbstractEmbeddedTest
@BeforeEach @BeforeEach
public void startServer() throws Exception public void startServer() throws Exception
{ {
assumeTrue(JettyDistribution.DISTRIBUTION != null, "jetty-distribution not found");
server = LikeJettyXml.createServer(0, 0, false); server = LikeJettyXml.createServer(0, 0, false);
server.start(); server.start();

View File

@ -31,6 +31,7 @@ import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
public class OneWebAppTest extends AbstractEmbeddedTest public class OneWebAppTest extends AbstractEmbeddedTest
{ {
@ -39,6 +40,8 @@ public class OneWebAppTest extends AbstractEmbeddedTest
@BeforeEach @BeforeEach
public void startServer() throws Exception public void startServer() throws Exception
{ {
assumeTrue(JettyDistribution.DISTRIBUTION != null, "jetty-distribution not found");
server = OneWebApp.createServer(0); server = OneWebApp.createServer(0);
server.start(); server.start();
} }

View File

@ -31,6 +31,7 @@ import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
public class OneWebAppWithJspTest extends AbstractEmbeddedTest public class OneWebAppWithJspTest extends AbstractEmbeddedTest
{ {
@ -40,6 +41,8 @@ public class OneWebAppWithJspTest extends AbstractEmbeddedTest
@BeforeEach @BeforeEach
public void startServer() throws Exception public void startServer() throws Exception
{ {
assumeTrue(JettyDistribution.DISTRIBUTION != null, "jetty-distribution not found");
server = OneWebAppWithJsp.createServer(0); server = OneWebAppWithJsp.createServer(0);
server.start(); server.start();

View File

@ -31,6 +31,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not; import static org.hamcrest.Matchers.not;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
public class ServerWithAnnotationsTest extends AbstractEmbeddedTest public class ServerWithAnnotationsTest extends AbstractEmbeddedTest
{ {
@ -39,6 +40,8 @@ public class ServerWithAnnotationsTest extends AbstractEmbeddedTest
@BeforeEach @BeforeEach
public void startServer() throws Exception public void startServer() throws Exception
{ {
assumeTrue(JettyDistribution.DISTRIBUTION != null, "jetty-distribution not found");
server = ServerWithAnnotations.createServer(0); server = ServerWithAnnotations.createServer(0);
server.start(); server.start();
} }

View File

@ -32,6 +32,7 @@ import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not; import static org.hamcrest.Matchers.not;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
public class ServerWithJNDITest extends AbstractEmbeddedTest public class ServerWithJNDITest extends AbstractEmbeddedTest
{ {
@ -40,6 +41,8 @@ public class ServerWithJNDITest extends AbstractEmbeddedTest
@BeforeEach @BeforeEach
public void startServer() throws Exception public void startServer() throws Exception
{ {
assumeTrue(JettyDistribution.DISTRIBUTION != null, "jetty-distribution not found");
server = ServerWithJNDI.createServer(0); server = ServerWithJNDI.createServer(0);
server.start(); server.start();
} }