From daadc39829466dfaa52acde8f9fc0c622202c405 Mon Sep 17 00:00:00 2001 From: "John D. Ament" Date: Wed, 3 Jun 2015 22:10:51 -0400 Subject: [PATCH 1/3] ARTEMIS-119 Upgraded to Jetty 9.2. --- .../activemq/artemis/component/WebServerComponent.java | 6 +++--- pom.xml | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java b/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java index e160d30be7e..8453c46335d 100644 --- a/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java +++ b/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java @@ -24,10 +24,10 @@ import org.apache.activemq.artemis.dto.WebServerDTO; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.handler.DefaultHandler; import org.eclipse.jetty.server.handler.HandlerList; import org.eclipse.jetty.server.handler.ResourceHandler; -import org.eclipse.jetty.server.nio.SelectChannelConnector; import org.eclipse.jetty.webapp.WebAppContext; public class WebServerComponent implements ExternalComponent @@ -44,7 +44,7 @@ public void configure(ComponentDTO config, String artemisInstance, String artemi String path = webServerConfig.path.startsWith("/") ? webServerConfig.path : "/" + webServerConfig.path; URI uri = new URI(webServerConfig.bind); server = new Server(); - org.eclipse.jetty.server.nio.SelectChannelConnector connector = new SelectChannelConnector(); + ServerConnector connector = new ServerConnector(server); connector.setPort(uri.getPort()); connector.setHost(uri.getHost()); @@ -92,7 +92,7 @@ public void stop() throws Exception public boolean isStarted() { - return false; + return server.isStarted(); } private void deployWar(String url, String warURL, String activeMQHome, String path) diff --git a/pom.xml b/pom.xml index e022695e6ea..4ef69f1a43d 100644 --- a/pom.xml +++ b/pom.xml @@ -54,6 +54,7 @@ scp://people.apache.org/x1/www/activemq.apache.org 4.0.28.Final + 9.2.11.v20150529 2.4 ${project.version} 1 @@ -437,7 +438,7 @@ org.eclipse.jetty.aggregate jetty-all - 8.1.16.v20140903 + ${jetty.version} @@ -757,9 +758,9 @@ 2.1 - org.mortbay.jetty - maven-jetty-plugin - 6.1.26 + org.eclipse.jetty + jetty-maven-plugin + ${jetty.version} org.apache.maven.plugins From 83e9ba418c8793b6475221fd5346b856a973cc57 Mon Sep 17 00:00:00 2001 From: "John D. Ament" Date: Thu, 4 Jun 2015 09:33:41 -0400 Subject: [PATCH 2/3] ARTEMIS-119 Changed dependency to use Tomcat Servlet API 3.1. --- artemis-distribution/pom.xml | 4 ++-- artemis-distribution/src/main/assembly/dep.xml | 2 +- pom.xml | 13 ++++++------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/artemis-distribution/pom.xml b/artemis-distribution/pom.xml index 273bb0b166e..ebde324cbc8 100644 --- a/artemis-distribution/pom.xml +++ b/artemis-distribution/pom.xml @@ -154,8 +154,8 @@ jetty-all - org.apache.geronimo.specs - geronimo-servlet_3.0_spec + org.apache.tomcat + tomcat-servlet-api org.jolokia diff --git a/artemis-distribution/src/main/assembly/dep.xml b/artemis-distribution/src/main/assembly/dep.xml index e2466c3de75..aa464a375a4 100644 --- a/artemis-distribution/src/main/assembly/dep.xml +++ b/artemis-distribution/src/main/assembly/dep.xml @@ -80,7 +80,7 @@ javax.inject:javax.inject org.eclipse.jetty.aggregate:jetty-all org.apache.geronimo.specs: - org.apache.geronimo.specs:geronimo-servlet_3.0_spec + org.apache.tomcat:tomcat-servlet-api commons-beanutils:commons-beanutils commons-logging:commons-logging org.fusesource.hawtbuf:hawtbuf diff --git a/pom.xml b/pom.xml index 4ef69f1a43d..2f7b61a8d60 100644 --- a/pom.xml +++ b/pom.xml @@ -204,7 +204,7 @@ + see https://issues.apache.org/jira/browse/MCOMPILER-203--> org.jboss.logging jboss-logging-processor @@ -441,12 +441,11 @@ ${jetty.version} - - org.apache.geronimo.specs - geronimo-servlet_3.0_spec - 1.0 - - + + org.apache.tomcat + tomcat-servlet-api + 8.0.23 + org.jolokia jolokia-war From 2f644bc42c7f54d60339c5039560a5b4ae43815a Mon Sep 17 00:00:00 2001 From: "John D. Ament" Date: Thu, 4 Jun 2015 09:53:49 -0400 Subject: [PATCH 3/3] ARTEMIS-119 Added proper tests for webserver component startup checks. --- .../apache/activemq/artemis/component/WebServerComponent.java | 2 +- .../apache/activemq/artemis/test/WebServerComponentTest.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java b/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java index 8453c46335d..7a1a42357fd 100644 --- a/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java +++ b/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java @@ -92,7 +92,7 @@ public void stop() throws Exception public boolean isStarted() { - return server.isStarted(); + return server != null && server.isStarted(); } private void deployWar(String url, String warURL, String activeMQHome, String path) diff --git a/artemis-web/src/test/java/org/apache/activemq/artemis/test/WebServerComponentTest.java b/artemis-web/src/test/java/org/apache/activemq/artemis/test/WebServerComponentTest.java index d432d5f2b87..dafd14ecdb2 100644 --- a/artemis-web/src/test/java/org/apache/activemq/artemis/test/WebServerComponentTest.java +++ b/artemis-web/src/test/java/org/apache/activemq/artemis/test/WebServerComponentTest.java @@ -64,6 +64,7 @@ public void simpleServer() throws Exception webServerDTO.bind = "http://localhost:8161"; webServerDTO.path = "webapps"; WebServerComponent webServerComponent = new WebServerComponent(); + Assert.assertFalse(webServerComponent.isStarted()); webServerComponent.configure(webServerDTO, "./src/test/resources/", "./src/test/resources/"); webServerComponent.start(); // Make the connection attempt. @@ -92,7 +93,9 @@ protected void initChannel(Channel ch) throws Exception assertEquals(clientHandler.body, "12345"); // Wait for the server to close the connection. ch.close(); + Assert.assertTrue(webServerComponent.isStarted()); webServerComponent.stop(); + Assert.assertFalse(webServerComponent.isStarted()); } class ClientHandler extends SimpleChannelInboundHandler