AMQ-6301: Changed activemq-osgi so that it embeds the spring-dm bundles

so that we can avoid loading the spring-dm feature which causes Spring
version conflicts.
This commit is contained in:
Seth Leger 2016-05-22 17:49:44 -04:00 committed by Christopher L. Shannon (cshannon)
parent c9c05eb866
commit 927bef7345
3 changed files with 59 additions and 5 deletions

View File

@ -18,6 +18,7 @@ package org.apache.activemq.karaf.itest;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration; import org.ops4j.pax.exam.Configuration;
@ -25,6 +26,8 @@ import org.ops4j.pax.exam.CoreOptions;
import org.ops4j.pax.exam.MavenUtils; import org.ops4j.pax.exam.MavenUtils;
import org.ops4j.pax.exam.Option; import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam; import org.ops4j.pax.exam.junit.PaxExam;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceReference;
@RunWith(PaxExam.class) @RunWith(PaxExam.class)
@ -67,4 +70,56 @@ public class ObrFeatureTest extends AbstractFeatureTest {
executeCommand("feature:repo-add " + getCamelFeatureUrl()); executeCommand("feature:repo-add " + getCamelFeatureUrl());
installAndAssertFeature("activemq-camel"); installAndAssertFeature("activemq-camel");
} }
@Test(timeout=5 * 60 * 1000)
public void testClientWithSpring31() throws Throwable {
executeCommand("feature:install spring/3.1.4.RELEASE");
installAndAssertFeature("activemq-client");
verifyBundleInstalledAndRegisteredServices("activemq-osgi", 2);
}
@Test(timeout=5 * 60 * 1000)
public void testClientWithSpring32() throws Throwable {
executeCommand("feature:install spring/3.2.14.RELEASE_1");
installAndAssertFeature("activemq-client");
verifyBundleInstalledAndRegisteredServices("activemq-osgi", 2);
}
@Test(timeout=5 * 60 * 1000)
public void testClientWithSpring40() throws Throwable {
executeCommand("feature:install spring/4.0.7.RELEASE_3");
installAndAssertFeature("activemq-client");
verifyBundleInstalledAndRegisteredServices("activemq-osgi", 2);
}
@Test(timeout=5 * 60 * 1000)
public void testClientWithSpring41() throws Throwable {
executeCommand("feature:install spring/4.1.7.RELEASE_2");
installAndAssertFeature("activemq-client");
verifyBundleInstalledAndRegisteredServices("activemq-osgi", 2);
}
@Test(timeout=5 * 60 * 1000)
public void testClientWithSpring42() throws Throwable {
executeCommand("feature:install spring/4.2.2.RELEASE_1");
installAndAssertFeature("activemq-client");
verifyBundleInstalledAndRegisteredServices("activemq-osgi", 2);
}
public boolean verifyBundleInstalledAndRegisteredServices(final String bundleName, final int numberOfServices) throws Exception {
boolean found = false;
for (final Bundle bundle : bundleContext.getBundles()) {
LOG.debug("Checking: " + bundle.getSymbolicName());
if (bundle.getSymbolicName().contains(bundleName)) {
Assert.assertEquals(Bundle.ACTIVE, bundle.getState());
// Assert that the bundle has registered some services via blueprint
Assert.assertNotNull(bundle.getRegisteredServices());
// Assert that the bundle has registered the correct number of services
Assert.assertEquals(numberOfServices, bundle.getRegisteredServices().length);
found = true;
break;
}
}
return found;
}
} }

View File

@ -23,7 +23,6 @@
<!-- Bundles needed if only client will be deployed in the container --> <!-- Bundles needed if only client will be deployed in the container -->
<feature name="activemq-client" description="ActiveMQ client libraries" version="${project.version}" resolver="(obr)" start-level="50"> <feature name="activemq-client" description="ActiveMQ client libraries" version="${project.version}" resolver="(obr)" start-level="50">
<feature version="[3.2,4)">spring</feature> <feature version="[3.2,4)">spring</feature>
<feature>spring-dm</feature>
<bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-annotation_1.0_spec/1.1.1</bundle> <bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-annotation_1.0_spec/1.1.1</bundle>
<bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle> <bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
<bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jms_1.1_spec/1.1.1</bundle> <bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jms_1.1_spec/1.1.1</bundle>

View File

@ -57,7 +57,6 @@
org.fusesource.leveldbjni*;resolution:=optional, org.fusesource.leveldbjni*;resolution:=optional,
org.fusesource.hawtjni*;resolution:=optional, org.fusesource.hawtjni*;resolution:=optional,
org.springframework.jms*;version="[3,5)";resolution:=optional, org.springframework.jms*;version="[3,5)";resolution:=optional,
org.springframework.osgi*;version="[1,4]";resolution:=optional,
org.springframework.transaction*;version="[3,5)";resolution:=optional, org.springframework.transaction*;version="[3,5)";resolution:=optional,
org.springframework*;version="[3,5)";resolution:=optional, org.springframework*;version="[3,5)";resolution:=optional,
org.xmlpull*;resolution:=optional, org.xmlpull*;resolution:=optional,
@ -86,6 +85,7 @@
org.apache.activemq.web*;version=${project.version};-noimport:=true;-split-package:=merge-first, org.apache.activemq.web*;version=${project.version};-noimport:=true;-split-package:=merge-first,
</activemq.osgi.export> </activemq.osgi.export>
<activemq.osgi.private.pkg> <activemq.osgi.private.pkg>
org.springframework.osgi*,
org.fusesource.hawtdispatch*, org.fusesource.hawtdispatch*,
org.fusesource.mqtt*, org.fusesource.mqtt*,
org.fusesource.hawtbuf*, org.fusesource.hawtbuf*,
@ -303,9 +303,9 @@
<instructions> <instructions>
<Bundle-Activator>org.apache.activemq.util.osgi.Activator</Bundle-Activator> <Bundle-Activator>org.apache.activemq.util.osgi.Activator</Bundle-Activator>
<Embed-Dependency> <Embed-Dependency>
*; *;groupId=org.apache.activemq;inline=META-INF/services/*,
groupId=org.apache.activemq;inline=META-INF/services/*, *;groupId=org.apache.qpid;inline=META-INF/services/*,
groupId=org.apache.qpid;inline=META-INF/services/* *;groupId=org.springframework.osgi;inline=true
<!-- <!--
groupId=org.fusesource.leveldbjni;inline=META-INF/native/*, groupId=org.fusesource.leveldbjni;inline=META-INF/native/*,
groupId=org.xerial.snappy;inline=org/xerial/snappy/* groupId=org.xerial.snappy;inline=org/xerial/snappy/*