From 934a95b8eff40e028cdd40233d34411de14b04bf Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Wed, 23 Sep 2020 13:38:38 -0500 Subject: [PATCH] Issue #5264 - Updating embedded JettyDistro to JettyHome Signed-off-by: Joakim Erdfelt --- ...{JettyDistribution.java => JettyHome.java} | 20 +++++++++---------- .../eclipse/jetty/embedded/LikeJettyXml.java | 2 +- .../org/eclipse/jetty/embedded/OneWebApp.java | 2 +- .../jetty/embedded/OneWebAppWithJsp.java | 2 +- .../jetty/embedded/ServerWithAnnotations.java | 2 +- .../jetty/embedded/ServerWithJNDI.java | 2 +- .../jetty/embedded/LikeJettyXmlTest.java | 2 +- .../eclipse/jetty/embedded/OneWebAppTest.java | 2 +- .../jetty/embedded/OneWebAppWithJspTest.java | 2 +- .../embedded/ServerWithAnnotationsTest.java | 2 +- .../jetty/embedded/ServerWithJNDITest.java | 2 +- .../test/resources/jetty-logging.properties | 2 +- 12 files changed, 21 insertions(+), 21 deletions(-) rename examples/embedded/src/main/java/org/eclipse/jetty/embedded/{JettyDistribution.java => JettyHome.java} (86%) diff --git a/examples/embedded/src/main/java/org/eclipse/jetty/embedded/JettyDistribution.java b/examples/embedded/src/main/java/org/eclipse/jetty/embedded/JettyHome.java similarity index 86% rename from examples/embedded/src/main/java/org/eclipse/jetty/embedded/JettyDistribution.java rename to examples/embedded/src/main/java/org/eclipse/jetty/embedded/JettyHome.java index 731ece84aba..7229469ca06 100644 --- a/examples/embedded/src/main/java/org/eclipse/jetty/embedded/JettyDistribution.java +++ b/examples/embedded/src/main/java/org/eclipse/jetty/embedded/JettyHome.java @@ -31,22 +31,22 @@ import org.slf4j.LoggerFactory; * */ -public class JettyDistribution +public class JettyHome { - private static final Logger LOG = LoggerFactory.getLogger(JettyDistribution.class); + private static final Logger LOG = LoggerFactory.getLogger(JettyHome.class); public static final Path DISTRIBUTION; static { Path jettyHome = asDirectory(System.getProperty("jetty.home")); - LOG.debug("JettyDistribution(prop(jetty.home)) = {}", jettyHome); + LOG.debug("JettyHome(prop(jetty.home)) = {}", jettyHome); if (jettyHome == null) { jettyHome = asDirectory(System.getenv().get("JETTY_HOME")); - LOG.debug("JettyDistribution(env(JETTY_HOME)) = {}", jettyHome); + LOG.debug("JettyHome(env(JETTY_HOME)) = {}", jettyHome); } Path distro = null; @@ -66,10 +66,10 @@ public class JettyDistribution { Path working = Paths.get(System.getProperty("user.dir")); Path dir = null; - LOG.debug("JettyDistribution(prop(user.dir)) = {}", working); + LOG.debug("JettyHome(prop(user.dir)) = {}", working); while (dir == null && working != null) { - dir = asDirectory(working.resolve("jetty-distribution/target/distribution").toString()); + dir = asDirectory(working.resolve("jetty-home/target/jetty-home").toString()); if (dir != null && hasDemoBase(dir)) { distro = dir; @@ -78,7 +78,7 @@ public class JettyDistribution working = working.getParent(); } if (LOG.isDebugEnabled()) - LOG.debug("JettyDistribution(working.resolve(...)) = {}", distro); + LOG.debug("JettyHome(working.resolve(...)) = {}", distro); } catch (Throwable th) { @@ -88,12 +88,12 @@ public class JettyDistribution if (distro == null) { - LOG.info("JettyDistribution() FAILURE: NOT FOUND"); + LOG.info("JettyHome() FAILURE: NOT FOUND"); } else { if (LOG.isDebugEnabled()) - LOG.debug("JettyDistribution() FOUND = {}", distro); + LOG.debug("JettyHome() FOUND = {}", distro); } DISTRIBUTION = distro; } diff --git a/examples/embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java b/examples/embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java index a9d378c40b7..56422e917ea 100644 --- a/examples/embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java +++ b/examples/embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java @@ -66,7 +66,7 @@ public class LikeJettyXml public static Server createServer(int port, int securePort, boolean addDebugListener) throws Exception { // Path to as-built jetty-distribution directory - Path jettyDistro = JettyDistribution.get(); + Path jettyDistro = JettyHome.get(); // Find jetty home and base directories String homePath = System.getProperty("jetty.home", jettyDistro.resolve("jetty-home").toString()); diff --git a/examples/embedded/src/main/java/org/eclipse/jetty/embedded/OneWebApp.java b/examples/embedded/src/main/java/org/eclipse/jetty/embedded/OneWebApp.java index ff8b69ba7c6..e66ce305eb5 100644 --- a/examples/embedded/src/main/java/org/eclipse/jetty/embedded/OneWebApp.java +++ b/examples/embedded/src/main/java/org/eclipse/jetty/embedded/OneWebApp.java @@ -43,7 +43,7 @@ public class OneWebApp // PlusConfiguration) to choosing where the webapp will unpack itself. WebAppContext webapp = new WebAppContext(); webapp.setContextPath("/"); - File warFile = JettyDistribution.resolve("demo-base/webapps/async-rest.war").toFile(); + File warFile = JettyHome.resolve("demo-base/webapps/async-rest.war").toFile(); webapp.setWar(warFile.getAbsolutePath()); // A WebAppContext is a ContextHandler as well so it needs to be set to diff --git a/examples/embedded/src/main/java/org/eclipse/jetty/embedded/OneWebAppWithJsp.java b/examples/embedded/src/main/java/org/eclipse/jetty/embedded/OneWebAppWithJsp.java index 199946f6ed0..a8ddca0ac32 100644 --- a/examples/embedded/src/main/java/org/eclipse/jetty/embedded/OneWebAppWithJsp.java +++ b/examples/embedded/src/main/java/org/eclipse/jetty/embedded/OneWebAppWithJsp.java @@ -51,7 +51,7 @@ public class OneWebAppWithJsp // the webapp will unpack itself. WebAppContext webapp = new WebAppContext(); webapp.setContextPath("/"); - Path warFile = JettyDistribution.resolve("demo-base/webapps/test.war"); + Path warFile = JettyHome.resolve("demo-base/webapps/test.war"); if (!Files.exists(warFile)) { throw new FileNotFoundException(warFile.toString()); diff --git a/examples/embedded/src/main/java/org/eclipse/jetty/embedded/ServerWithAnnotations.java b/examples/embedded/src/main/java/org/eclipse/jetty/embedded/ServerWithAnnotations.java index 3675c3ed06e..ed82db6e8eb 100644 --- a/examples/embedded/src/main/java/org/eclipse/jetty/embedded/ServerWithAnnotations.java +++ b/examples/embedded/src/main/java/org/eclipse/jetty/embedded/ServerWithAnnotations.java @@ -51,7 +51,7 @@ public class ServerWithAnnotations webapp.addConfiguration(new EnvConfiguration(), new PlusConfiguration(), new AnnotationConfiguration()); webapp.setContextPath("/"); - File warFile = JettyDistribution.resolve("demo-base/webapps/test-spec.war").toFile(); + File warFile = JettyHome.resolve("demo-base/webapps/test-spec.war").toFile(); webapp.setWar(warFile.getAbsolutePath()); webapp.setAttribute( "org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern", diff --git a/examples/embedded/src/main/java/org/eclipse/jetty/embedded/ServerWithJNDI.java b/examples/embedded/src/main/java/org/eclipse/jetty/embedded/ServerWithJNDI.java index 1036eb82570..8b4e7cdda03 100644 --- a/examples/embedded/src/main/java/org/eclipse/jetty/embedded/ServerWithJNDI.java +++ b/examples/embedded/src/main/java/org/eclipse/jetty/embedded/ServerWithJNDI.java @@ -41,7 +41,7 @@ public class ServerWithJNDI // Create a WebApp WebAppContext webapp = new WebAppContext(); webapp.setContextPath("/"); - Path testJndiWar = JettyDistribution.resolve("demo-base/webapps/test-jndi.war"); + Path testJndiWar = JettyHome.resolve("demo-base/webapps/test-jndi.war"); webapp.setWarResource(new PathResource(testJndiWar)); server.setHandler(webapp); diff --git a/examples/embedded/src/test/java/org/eclipse/jetty/embedded/LikeJettyXmlTest.java b/examples/embedded/src/test/java/org/eclipse/jetty/embedded/LikeJettyXmlTest.java index c0cff77c179..36baf9e1c64 100644 --- a/examples/embedded/src/test/java/org/eclipse/jetty/embedded/LikeJettyXmlTest.java +++ b/examples/embedded/src/test/java/org/eclipse/jetty/embedded/LikeJettyXmlTest.java @@ -44,7 +44,7 @@ public class LikeJettyXmlTest extends AbstractEmbeddedTest @BeforeEach public void startServer() throws Exception { - assumeTrue(JettyDistribution.DISTRIBUTION != null, "jetty-distribution not found"); + assumeTrue(JettyHome.DISTRIBUTION != null, "jetty-distribution not found"); server = LikeJettyXml.createServer(0, 0, false); server.start(); diff --git a/examples/embedded/src/test/java/org/eclipse/jetty/embedded/OneWebAppTest.java b/examples/embedded/src/test/java/org/eclipse/jetty/embedded/OneWebAppTest.java index bdf2ec2efcf..3cddf3f5f7c 100644 --- a/examples/embedded/src/test/java/org/eclipse/jetty/embedded/OneWebAppTest.java +++ b/examples/embedded/src/test/java/org/eclipse/jetty/embedded/OneWebAppTest.java @@ -42,7 +42,7 @@ public class OneWebAppTest extends AbstractEmbeddedTest @BeforeEach public void startServer() throws Exception { - assumeTrue(JettyDistribution.DISTRIBUTION != null, "jetty-distribution not found"); + assumeTrue(JettyHome.DISTRIBUTION != null, "jetty-distribution not found"); server = OneWebApp.createServer(0); server.start(); diff --git a/examples/embedded/src/test/java/org/eclipse/jetty/embedded/OneWebAppWithJspTest.java b/examples/embedded/src/test/java/org/eclipse/jetty/embedded/OneWebAppWithJspTest.java index 87efb7aec95..cb4e2f9e0d5 100644 --- a/examples/embedded/src/test/java/org/eclipse/jetty/embedded/OneWebAppWithJspTest.java +++ b/examples/embedded/src/test/java/org/eclipse/jetty/embedded/OneWebAppWithJspTest.java @@ -42,7 +42,7 @@ public class OneWebAppWithJspTest extends AbstractEmbeddedTest @BeforeEach public void startServer() throws Exception { - assumeTrue(JettyDistribution.DISTRIBUTION != null, "jetty-distribution not found"); + assumeTrue(JettyHome.DISTRIBUTION != null, "jetty-distribution not found"); server = OneWebAppWithJsp.createServer(0); server.start(); diff --git a/examples/embedded/src/test/java/org/eclipse/jetty/embedded/ServerWithAnnotationsTest.java b/examples/embedded/src/test/java/org/eclipse/jetty/embedded/ServerWithAnnotationsTest.java index efd5a75a3aa..2b52ee13da0 100644 --- a/examples/embedded/src/test/java/org/eclipse/jetty/embedded/ServerWithAnnotationsTest.java +++ b/examples/embedded/src/test/java/org/eclipse/jetty/embedded/ServerWithAnnotationsTest.java @@ -41,7 +41,7 @@ public class ServerWithAnnotationsTest extends AbstractEmbeddedTest @BeforeEach public void startServer() throws Exception { - assumeTrue(JettyDistribution.DISTRIBUTION != null, "jetty-distribution not found"); + assumeTrue(JettyHome.DISTRIBUTION != null, "jetty-distribution not found"); server = ServerWithAnnotations.createServer(0); server.start(); diff --git a/examples/embedded/src/test/java/org/eclipse/jetty/embedded/ServerWithJNDITest.java b/examples/embedded/src/test/java/org/eclipse/jetty/embedded/ServerWithJNDITest.java index 8100158e65f..ebf1bc21814 100644 --- a/examples/embedded/src/test/java/org/eclipse/jetty/embedded/ServerWithJNDITest.java +++ b/examples/embedded/src/test/java/org/eclipse/jetty/embedded/ServerWithJNDITest.java @@ -42,7 +42,7 @@ public class ServerWithJNDITest extends AbstractEmbeddedTest @BeforeEach public void startServer() throws Exception { - assumeTrue(JettyDistribution.DISTRIBUTION != null, "jetty-distribution not found"); + assumeTrue(JettyHome.DISTRIBUTION != null, "jetty-distribution not found"); server = ServerWithJNDI.createServer(0); server.start(); diff --git a/examples/embedded/src/test/resources/jetty-logging.properties b/examples/embedded/src/test/resources/jetty-logging.properties index ce01e8bace1..36c6146e919 100644 --- a/examples/embedded/src/test/resources/jetty-logging.properties +++ b/examples/embedded/src/test/resources/jetty-logging.properties @@ -1,6 +1,6 @@ # Jetty Logging using jetty-slf4j-impl org.eclipse.jetty.LEVEL=INFO -org.eclipse.jetty.embedded.JettyDistribution.LEVEL=DEBUG +org.eclipse.jetty.embedded.JettyHome.LEVEL=DEBUG #org.eclipse.jetty.STACKS=true #org.eclipse.jetty.STACKS=false #org.eclipse.jetty.io.LEVEL=DEBUG