diff --git a/activemq-http/src/main/java/org/apache/activemq/transport/http/HttpTransportServer.java b/activemq-http/src/main/java/org/apache/activemq/transport/http/HttpTransportServer.java index f8d71d536b..464a37e3a8 100755 --- a/activemq-http/src/main/java/org/apache/activemq/transport/http/HttpTransportServer.java +++ b/activemq-http/src/main/java/org/apache/activemq/transport/http/HttpTransportServer.java @@ -31,6 +31,7 @@ import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; +import org.eclipse.jetty.servlets.gzip.GzipHandler; public class HttpTransportServer extends WebTransportServerSupport { @@ -118,12 +119,7 @@ public class HttpTransportServer extends WebTransportServerSupport { return (Integer)connector.getClass().getMethod("getLocalPort").invoke(connector); } private void addGzipHandler(ServletContextHandler contextHandler) throws Exception { - Handler handler = null; - try { - handler = (Handler)Class.forName("org.eclipse.jetty.server.handler.GzipHandler", true, Handler.class.getClassLoader()).newInstance(); - } catch (Throwable t) { - handler = (Handler)Class.forName("org.eclipse.jetty.servlets.gzip.GzipHandler", true, Handler.class.getClassLoader()).newInstance(); - } + Handler handler = new GzipHandler(); contextHandler.setHandler(handler); } diff --git a/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/AbstractFeatureTest.java b/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/AbstractFeatureTest.java index a544256fba..b1f2a72404 100644 --- a/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/AbstractFeatureTest.java +++ b/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/AbstractFeatureTest.java @@ -17,11 +17,14 @@ package org.apache.activemq.karaf.itest; import javax.security.auth.Subject; + import org.apache.felix.service.command.CommandProcessor; import org.apache.felix.service.command.CommandSession; import org.apache.karaf.features.FeaturesService; import org.apache.karaf.jaas.boot.principal.RolePrincipal; import org.apache.karaf.jaas.boot.principal.UserPrincipal; +import org.apache.karaf.shell.api.console.Session; +import org.apache.karaf.shell.api.console.SessionFactory; import org.junit.After; import org.junit.Before; import org.ops4j.pax.exam.Option; @@ -37,6 +40,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.inject.Inject; + import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; @@ -50,7 +54,6 @@ import java.util.concurrent.Executors; import java.util.concurrent.FutureTask; import java.util.concurrent.TimeUnit; - import static org.ops4j.pax.exam.CoreOptions.*; import static org.junit.Assert.assertTrue; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.*; @@ -96,18 +99,20 @@ public abstract class AbstractFeatureTest { } @Inject - CommandProcessor commandProcessor; + SessionFactory sessionFactory; + ExecutorService executor = Executors.newCachedThreadPool(); protected String executeCommand(final String command, final Long timeout, final Boolean silent) { String response; final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); final PrintStream printStream = new PrintStream(byteArrayOutputStream); - final CommandSession commandSession = commandProcessor.createSession(System.in, printStream, printStream); + final Session commandSession = sessionFactory.create(System.in, printStream, printStream); commandSession.put("APPLICATION", System.getProperty("karaf.name", "root")); commandSession.put("USER", USER); FutureTask commandFuture = new FutureTask( new Callable() { + @Override public String call() { Subject subject = new Subject(); @@ -154,13 +159,13 @@ public abstract class AbstractFeatureTest { * @throws Exception */ public void installAndAssertFeature(final String feature) throws Throwable { - executeCommand("osgi:list -t 0"); - executeCommand("features:install " + feature); + executeCommand("feature:list -i"); + executeCommand("feature:install " + feature); assertFeatureInstalled(feature); } public void assertFeatureInstalled(final String feature) throws Throwable { - executeCommand("osgi:list -t 0"); + executeCommand("feature:list -i"); withinReason(new Callable() { @Override public Boolean call() throws Exception { @@ -174,7 +179,7 @@ public abstract class AbstractFeatureTest { boolean found = false; for (Bundle bundle: bundleContext.getBundles()) { LOG.debug("Checking: " + bundle.getSymbolicName()); - if (bundle.getSymbolicName().equals(bundleName)) { + if (bundle.getSymbolicName().contains(bundleName)) { found = true; break; } @@ -251,6 +256,11 @@ public abstract class AbstractFeatureTest { editConfigurationFilePut("etc/config.properties", "karaf.startlevel.bundle", "50"), //debugConfiguration("5005", true), features(getActiveMQKarafFeatureUrl(), f.toArray(new String[f.size()]))}; + if (f.contains("activemq-camel")) { + options = append(features(maven().groupId("org.apache.camel.karaf").artifactId("apache-camel") + .versionAsInProject() + .type("xml/features")), options); + } return options; } diff --git a/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQAMQPBrokerFeatureTest.java b/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQAMQPBrokerFeatureTest.java index 59ce4db654..88c1d8589a 100644 --- a/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQAMQPBrokerFeatureTest.java +++ b/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQAMQPBrokerFeatureTest.java @@ -16,9 +16,14 @@ */ package org.apache.activemq.karaf.itest; +import static org.junit.Assert.assertTrue; + +import java.util.concurrent.Callable; + import javax.jms.Connection; import org.apache.qpid.jms.JmsConnectionFactory; +import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; @@ -27,31 +32,40 @@ import org.ops4j.pax.exam.CoreOptions; import org.ops4j.pax.exam.Option; import org.ops4j.pax.exam.junit.PaxExam; -import java.util.concurrent.Callable; - -import static org.junit.Assert.assertTrue; - @RunWith(PaxExam.class) public class ActiveMQAMQPBrokerFeatureTest extends ActiveMQBrokerFeatureTest { private static final Integer AMQP_PORT = 61636; @Configuration public static Option[] configure() { - Option[] activeMQOptions = configure("activemq"); - Option netty = CoreOptions.wrappedBundle(CoreOptions.mavenBundle("io.netty", "netty-all").versionAsInProject().getURL().toString() + "$Bundle-SymbolicName=netty-all"); - Option protonJ = CoreOptions.wrappedBundle(CoreOptions.mavenBundle("org.apache.qpid", "proton-j").versionAsInProject().getURL().toString() + "$Bundle-SymbolicName=proton-j"); - Option qpidClient = CoreOptions.wrappedBundle(CoreOptions.mavenBundle("org.apache.qpid", "qpid-jms-client").versionAsInProject().getURL().toString() + "$Bundle-SymbolicName=qpid-jms-client"); + Option[] configure = configure("activemq"); - Option[] options = append(protonJ, activeMQOptions); - options = append(netty, options); - options = append(qpidClient, options); + Option[] configuredOptions = configureBrokerStart(configure); - Option[] configuredOptions = configureBrokerStart(options); return configuredOptions; } + + + @Before + public void setUpBundle() { + + installWrappedBundle(CoreOptions.wrappedBundle(CoreOptions.mavenBundle( + "io.netty", "netty-all").version( + getArtifactVersion("io.netty", "netty-all")).getURL().toString() + + "$Bundle-SymbolicName=qpid-jms-client")); + installWrappedBundle(CoreOptions.wrappedBundle(CoreOptions.mavenBundle( + "org.apache.qpid", "proton-j").version( + getArtifactVersion("org.apache.qpid", "proton-j")).getURL())); + installWrappedBundle(CoreOptions.wrappedBundle(CoreOptions.mavenBundle( + "org.apache.qpid", "qpid-jms-client").version( + getArtifactVersion("org.apache.qpid", "qpid-jms-client")).getURL())); + } + + @Override protected Connection getConnection() throws Throwable { + setUpBundle(); withinReason(new Callable() { @Override diff --git a/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerFeatureTest.java b/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerFeatureTest.java index b6e75c9e44..2d71c0975a 100644 --- a/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerFeatureTest.java +++ b/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerFeatureTest.java @@ -16,13 +16,19 @@ */ package org.apache.activemq.karaf.itest; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Properties; import java.util.concurrent.Callable; import org.junit.Test; import org.junit.runner.RunWith; +import org.ops4j.pax.exam.CoreOptions; import org.ops4j.pax.exam.Option; import org.ops4j.pax.exam.Configuration; import org.ops4j.pax.exam.junit.PaxExam; +import org.ops4j.pax.exam.options.WrappedUrlProvisionOption; import javax.jms.Connection; import javax.jms.Message; @@ -41,6 +47,32 @@ public class ActiveMQBrokerFeatureTest extends AbstractJmsFeatureTest { return configureBrokerStart(configure("activemq")); } + protected final File file = new File("../../../classes/META-INF/maven/dependencies.properties"); + + public final String getArtifactVersion(final String groupId, final String artifactId) { + final Properties dependencies = new Properties(); + try (FileInputStream fis = new FileInputStream(file)){ + dependencies.load(fis); + final String version = dependencies + .getProperty(groupId + "/" + artifactId + "/version"); + if (version == null) { + throw new RuntimeException( + "Could not resolve version. Do you have a dependency for " + groupId + "/" + + artifactId + " in your maven project?"); + } + return version; + } + catch (IOException e) { + throw new RuntimeException("Could not resolve version for groupId:" + groupId + + " artifactId:" + artifactId + + " by reading the dependency information generated by maven.", e); + } + } + + protected String installWrappedBundle(WrappedUrlProvisionOption option) { + return executeCommand("bundle:install 'wrap:" + option.getURL() + "'"); + } + @Test(timeout=5 * 60 * 1000) public void test() throws Throwable { diff --git a/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdCamelFeatureTest.java b/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdCamelFeatureTest.java index 45993b5723..ce32dfc247 100644 --- a/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdCamelFeatureTest.java +++ b/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdCamelFeatureTest.java @@ -19,6 +19,8 @@ package org.apache.activemq.karaf.itest; import java.io.File; import java.util.Date; import java.util.concurrent.Callable; + +import org.apache.karaf.features.Feature; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; @@ -27,7 +29,6 @@ import org.ops4j.pax.exam.Option; import org.ops4j.pax.exam.Configuration; import org.ops4j.pax.exam.junit.PaxExam; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut; @@ -41,17 +42,16 @@ public class ActiveMQBrokerNdCamelFeatureTest extends AbstractJmsFeatureTest { public static Option[] configure() { return append( editConfigurationFilePut("etc/system.properties", "camel.version", MavenUtils.getArtifactVersion("org.apache.camel.karaf", "apache-camel")), - configure("activemq")); + configure("activemq", "activemq-camel")); } @Test(timeout = 2 * 60 * 1000) public void test() throws Throwable { - System.err.println(executeCommand("osgi:list").trim()); + System.err.println(executeCommand("feature:list").trim()); assertFeatureInstalled("activemq"); - executeCommand("features:addurl " + getCamelFeatureUrl()); - installAndAssertFeature("activemq-camel"); + assertTrue("activemq-camel bundle installed", verifyBundleInstalled("org.apache.activemq.activemq-camel")); withinReason(new Callable() { @Override diff --git a/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ObrFeatureTest.java b/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ObrFeatureTest.java index 93306bea36..9160e3bacc 100644 --- a/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ObrFeatureTest.java +++ b/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ObrFeatureTest.java @@ -85,7 +85,7 @@ public class ObrFeatureTest extends AbstractFeatureTest { @Test(timeout=5 * 60 * 1000) public void testCamel() throws Throwable { - executeCommand("features:addurl " + getCamelFeatureUrl()); + executeCommand("feature:repo-add " + getCamelFeatureUrl()); installAndAssertFeature("activemq-camel"); } } diff --git a/activemq-karaf/pom.xml b/activemq-karaf/pom.xml index a00aecf116..c56e77f1c8 100644 --- a/activemq-karaf/pom.xml +++ b/activemq-karaf/pom.xml @@ -43,12 +43,12 @@ org.ops4j.pax.logging pax-logging-api - 1.6.2 + 1.8.3 org.ops4j.pax.logging pax-logging-service - 1.6.2 + 1.8.3 org.slf4j @@ -59,16 +59,21 @@ org.slf4j slf4j-log4j12 test + + + org.apache.aries.blueprint + org.apache.aries.blueprint.core + 1.4.4 org.apache.felix org.apache.felix.framework - 1.0.0 + 5.0.1 org.apache.felix org.apache.felix.bundlerepository - 1.2.1 + 2.0.4 org.apache.karaf.shell diff --git a/activemq-osgi/pom.xml b/activemq-osgi/pom.xml index a583717965..0513c24aa8 100644 --- a/activemq-osgi/pom.xml +++ b/activemq-osgi/pom.xml @@ -206,7 +206,7 @@ org.osgi org.osgi.compendium - 4.3.1 + ${org.osgi.core-version} provided diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2174Test.java b/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2174Test.java index 411f8ee032..be838e385b 100644 --- a/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2174Test.java +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2174Test.java @@ -1,3 +1,19 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.activemq.bugs; import static org.junit.Assert.assertEquals; diff --git a/activemq-web-console/pom.xml b/activemq-web-console/pom.xml index fde16e4731..fd3f4f3bac 100755 --- a/activemq-web-console/pom.xml +++ b/activemq-web-console/pom.xml @@ -324,7 +324,7 @@ org.osgi org.osgi.compendium - 4.3.1 + ${org.osgi.core-version} provided diff --git a/assembly/src/main/descriptors/common-bin.xml b/assembly/src/main/descriptors/common-bin.xml index 8405b8badb..13f107878a 100644 --- a/assembly/src/main/descriptors/common-bin.xml +++ b/assembly/src/main/descriptors/common-bin.xml @@ -262,7 +262,7 @@ org.mortbay.jasper:apache-el org.apache.taglibs:taglibs-standard-impl - org.apache.geronimo.specs:geronimo-annotation_1.0_spec + org.apache.geronimo.specs:geronimo-annotation_1.0_spec org.ow2.asm:asm org.eclipse.jetty.orbit:org.eclipse.jdt.core diff --git a/pom.xml b/pom.xml index 6dfc9965ef..2d4715aead 100755 --- a/pom.xml +++ b/pom.xml @@ -88,7 +88,7 @@ 4.12 1.3 2.0 - 2.4.1 + 4.0.1 0.6 0.6 1.8 @@ -130,12 +130,12 @@ 0.6.4 1.19 - 4.3.0 + 4.6.0 1.0.0 1.6.1 - 2.3.0 + 2.4.1 1.8.0 - 4.4.1 + 5.0.1 scpexe://people.apache.org/www/activemq.apache.org/maven/ 1.7 @@ -537,11 +537,11 @@ geronimo-j2ee-connector_1.5_spec 2.0.0 - - org.ow2.asm - asm - 5.0.3 - + + org.ow2.asm + asm + 5.0.3 + @@ -944,26 +944,26 @@ ${jetty-version} - - org.eclipse.jetty.aggregate - jetty-all - ${jetty-version} - - - javax.servlet - javax.servlet-api - - - javax.websocket - javax.websocket-api - - - - - org.eclipse.jetty.websocket - websocket-server - ${jetty-version} - + + org.eclipse.jetty.aggregate + jetty-all + ${jetty-version} + + + javax.servlet + javax.servlet-api + + + javax.websocket + javax.websocket-api + + + + + org.eclipse.jetty.websocket + websocket-server + ${jetty-version} + org.apache.httpcomponents httpclient @@ -1086,16 +1086,6 @@ jcl-over-slf4j ${slf4j-version} - org.apache.geronimo.components