CAMEL-11851: upgrade camel-kura to newer osgi api
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/0469d2a7 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0469d2a7 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0469d2a7 Branch: refs/heads/master Commit: 0469d2a76ebba5078a3e53acfca62078e1e2b908 Parents: ff8c5cd Author: Claus Ibsen <davscl...@apache.org> Authored: Wed Sep 27 15:35:16 2017 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Wed Sep 27 15:36:40 2017 +0200 ---------------------------------------------------------------------- components/camel-kura/pom.xml | 143 ++++++++++--------- .../apache/camel/component/kura/KuraRouter.java | 4 +- .../camel/component/kura/KuraRouterTest.java | 4 +- parent/pom.xml | 3 +- 4 files changed, 85 insertions(+), 69 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/0469d2a7/components/camel-kura/pom.xml ---------------------------------------------------------------------- diff --git a/components/camel-kura/pom.xml b/components/camel-kura/pom.xml index 746448a..6dfa87b 100644 --- a/components/camel-kura/pom.xml +++ b/components/camel-kura/pom.xml @@ -17,77 +17,92 @@ limitations under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.camel</groupId> - <artifactId>components</artifactId> - <version>2.20.0-SNAPSHOT</version> - </parent> + <parent> + <groupId>org.apache.camel</groupId> + <artifactId>components</artifactId> + <version>2.20.0-SNAPSHOT</version> + </parent> - <artifactId>camel-kura</artifactId> - <packaging>jar</packaging> - <name>Camel :: Kura</name> - <description>Using Camel with Eclipse Kura (OSGi)</description> + <artifactId>camel-kura</artifactId> + <packaging>jar</packaging> + <name>Camel :: Kura</name> + <description>Using Camel with Eclipse Kura (OSGi)</description> - <properties> - <!-- use by camel-catalog --> - <firstVersion>2.15.0</firstVersion> - <label>iot,osgi</label> + <properties> + <!-- use by camel-catalog --> + <firstVersion>2.15.0</firstVersion> + <label>iot,osgi</label> - <camel.osgi.export.pkg>org.apache.camel.component.kura</camel.osgi.export.pkg> + <camel.osgi.export.pkg>org.apache.camel.component.kura</camel.osgi.export.pkg> + </properties> - <kura-slf4j.version>1.6.4</kura-slf4j.version> - </properties> + <dependencies> - <dependencies> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-core-osgi</artifactId> - </dependency> - <dependency> - <groupId>org.eclipse.birt.runtime</groupId> - <artifactId>org.eclipse.osgi</artifactId> - <version>${eclipse-birt-version}</version> - </dependency> - <dependency> - <groupId>org.eclipse.birt.runtime</groupId> - <artifactId>org.eclipse.osgi.services</artifactId> - <version>${eclipse-birt-services-version}</version> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-api</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-slf4j-impl</artifactId> - <scope>test</scope> - </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-core</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-core-osgi</artifactId> + </dependency> + <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.framework</artifactId> + <version>${felix-framework-version}</version> + </dependency> + <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.configadmin</artifactId> + <version>${felix-configadmin-version}</version> + </dependency> + <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.scr</artifactId> + <version>${felix-scr-version}</version> + </dependency> + <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.scr.annotations</artifactId> + <version>${felix-scr-annotations-version}</version> + </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <scope>test</scope> - </dependency> - </dependencies> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-api</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-slf4j-impl</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <scope>test</scope> + </dependency> + </dependencies> </project> http://git-wip-us.apache.org/repos/asf/camel/blob/0469d2a7/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java ---------------------------------------------------------------------- diff --git a/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java b/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java index fcb1dcd..38e9c09 100644 --- a/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java +++ b/components/camel-kura/src/main/java/org/apache/camel/component/kura/KuraRouter.java @@ -121,12 +121,12 @@ public abstract class KuraRouter extends RouteBuilder implements BundleActivator // API Helpers protected <T> T service(Class<T> serviceType) { - ServiceReference reference = bundleContext.getServiceReference(serviceType); + ServiceReference reference = bundleContext.getServiceReference(serviceType.getName()); return reference == null ? null : (T) bundleContext.getService(reference); } protected <T> T requiredService(Class<T> serviceType) { - ServiceReference reference = bundleContext.getServiceReference(serviceType); + ServiceReference reference = bundleContext.getServiceReference(serviceType.getName()); if (reference == null) { throw new IllegalStateException("Cannot find service: " + serviceType.getName()); } http://git-wip-us.apache.org/repos/asf/camel/blob/0469d2a7/components/camel-kura/src/test/java/org/apache/camel/component/kura/KuraRouterTest.java ---------------------------------------------------------------------- diff --git a/components/camel-kura/src/test/java/org/apache/camel/component/kura/KuraRouterTest.java b/components/camel-kura/src/test/java/org/apache/camel/component/kura/KuraRouterTest.java index b184af9..81ba135 100644 --- a/components/camel-kura/src/test/java/org/apache/camel/component/kura/KuraRouterTest.java +++ b/components/camel-kura/src/test/java/org/apache/camel/component/kura/KuraRouterTest.java @@ -93,7 +93,7 @@ public class KuraRouterTest extends Assert { @Test public void shouldReturnNoService() { - given(bundleContext.getServiceReference(any(Class.class))).willReturn(null); + given(bundleContext.getServiceReference(any(String.class))).willReturn(null); assertNull(router.service(ConfigurationAdmin.class)); } @@ -104,7 +104,7 @@ public class KuraRouterTest extends Assert { @Test(expected = IllegalStateException.class) public void shouldValidateLackOfService() { - given(bundleContext.getServiceReference(any(Class.class))).willReturn(null); + given(bundleContext.getServiceReference(any(String.class))).willReturn(null); router.requiredService(ConfigurationAdmin.class); } http://git-wip-us.apache.org/repos/asf/camel/blob/0469d2a7/parent/pom.xml ---------------------------------------------------------------------- diff --git a/parent/pom.xml b/parent/pom.xml index 22c1e3f..8db1a07 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -223,7 +223,8 @@ <felix-connect-version>0.1.0</felix-connect-version> <felix-fileinstall-version>3.5.2</felix-fileinstall-version> <felix-framework-version>3.2.2</felix-framework-version> - <felix-scr-annotations-version>1.9.12</felix-scr-annotations-version> + <felix-scr-annotations-version>1.12.0</felix-scr-annotations-version> + <felix-scr-version>2.0.12</felix-scr-version> <findbugs-maven-plugin-version>2.5.2</findbugs-maven-plugin-version> <flatpack-version>3.4.3</flatpack-version> <flink-version>1.3.2</flink-version>