FELIX-4184 Added a test case that shows the failure described in the issue. Did not yet commit a fix, so it will now fail.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1542351 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/BaseIntegrationTest.java b/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/BaseIntegrationTest.java
index dd25fe2..e149052 100644
--- a/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/BaseIntegrationTest.java
+++ b/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/BaseIntegrationTest.java
@@ -220,7 +220,17 @@
}
protected URL getTestBundle(String baseName) throws MalformedURLException {
- File f = new File(m_testBundleBasePath, String.format("%1$s/target/org.apache.felix.deploymentadmin.test.%1$s-1.0.0.jar", baseName));
+ return getTestBundle(baseName, "1.0.0");
+ }
+ protected URL getTestBundle(String baseName, String version) throws MalformedURLException {
+ return getTestBundle(baseName, baseName, version);
+ }
+
+ protected URL getTestBundle(String artifactName, String baseName, String version) throws MalformedURLException {
+ if (version == null) {
+ version = "0.0.0";
+ }
+ File f = new File(m_testBundleBasePath, String.format("%1$s/target/org.apache.felix.deploymentadmin.test.%2$s-%3$s.jar", artifactName, baseName, version));
assertTrue("No such bundle: " + f, f.exists() && f.isFile());
return f.toURI().toURL();
}
diff --git a/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/InstallFixPackageTest.java b/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/InstallFixPackageTest.java
index 1df2076..399d213 100644
--- a/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/InstallFixPackageTest.java
+++ b/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/InstallFixPackageTest.java
@@ -546,4 +546,38 @@
// The bundle installed in another deployment package should still remain...
assertBundleExists(getSymbolicName("bundle1"), "1.0.0");
}
+
+ @Test
+ public void testInstallAndUpdateImplementationBundleWithSeparateAPIBundle_FELIX4184() throws Exception {
+ String value = System.getProperty("org.apache.felix.deploymentadmin.stopunaffectedbundle");
+ System.setProperty("org.apache.felix.deploymentadmin.stopunaffectedbundle", "false");
+ // first, install a deployment package with implementation and api bundles in version 1.0.0
+
+ DeploymentPackageBuilder dpBuilder = createDeploymentPackageBuilder("a", "1.0.0");
+ dpBuilder.add(dpBuilder.createBundleResource().setUrl(getTestBundle("bundleimpl1", "bundleimpl", "1.0.0")));
+ dpBuilder.add(dpBuilder.createBundleResource().setUrl(getTestBundle("bundleapi1", "bundleapi", "1.0.0")));
+
+ DeploymentPackage dp1 = m_deploymentAdmin.installDeploymentPackage(dpBuilder.generate());
+ assertNotNull("No deployment package returned?!", dp1);
+
+ assertEquals("Expected a single deployment package?!", 1, m_deploymentAdmin.listDeploymentPackages().length);
+
+ // then, install a fix package with implementation and api bundles in version 2.0.0
+ dpBuilder = createDeploymentPackageBuilder("a", "2.0.0").setFixPackage("[1.0.0,2.0.0]");
+ dpBuilder.add(dpBuilder.createBundleResource().setUrl(getTestBundle("bundleimpl2", "bundleimpl", "2.0.0")));
+ dpBuilder.add(dpBuilder.createBundleResource().setUrl(getTestBundle("bundleapi2", "bundleapi", "2.0.0")));
+
+ DeploymentPackage dp2 = m_deploymentAdmin.installDeploymentPackage(dpBuilder.generate());
+ assertNotNull("No deployment package returned?!", dp2);
+
+ awaitRefreshPackagesEvent();
+
+ assertBundleExists(getSymbolicName("bundleimpl"), "2.0.0");
+ assertBundleExists(getSymbolicName("bundleapi"), "2.0.0");
+ assertBundleNotExists(getSymbolicName("bundleimpl"), "1.0.0");
+ assertBundleNotExists(getSymbolicName("bundleapi"), "1.0.0");
+ if (value != null) {
+ System.setProperty("org.apache.felix.deploymentadmin.stopunaffectedbundle", value);
+ }
+ }
}
diff --git a/deploymentadmin/testbundles/bundleapi1/bnd.bnd b/deploymentadmin/testbundles/bundleapi1/bnd.bnd
new file mode 100644
index 0000000..47e3925
--- /dev/null
+++ b/deploymentadmin/testbundles/bundleapi1/bnd.bnd
@@ -0,0 +1,3 @@
+Bundle-Version: 1.0.0
+Bundle-SymbolicName: testbundles.bundleapi
+Export-Package: org.apache.felix.deploymentadmin.test.bundleapi;version="1.0.0"
diff --git a/deploymentadmin/testbundles/bundleapi1/pom.xml b/deploymentadmin/testbundles/bundleapi1/pom.xml
new file mode 100644
index 0000000..094493c
--- /dev/null
+++ b/deploymentadmin/testbundles/bundleapi1/pom.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.deploymentadmin.testbundles</artifactId>
+ <version>1</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <name>Apache Felix DeploymentAdmin API Bundle 1</name>
+ <version>1.0.0</version>
+ <artifactId>org.apache.felix.deploymentadmin.test.bundleapi</artifactId>
+ <packaging>bundle</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>2.3.4</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <_include>bnd.bnd</_include>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/deploymentadmin/testbundles/bundleapi1/src/main/java/org/apache/felix/deploymentadmin/test/bundleapi/MyService.java b/deploymentadmin/testbundles/bundleapi1/src/main/java/org/apache/felix/deploymentadmin/test/bundleapi/MyService.java
new file mode 100644
index 0000000..e33e821
--- /dev/null
+++ b/deploymentadmin/testbundles/bundleapi1/src/main/java/org/apache/felix/deploymentadmin/test/bundleapi/MyService.java
@@ -0,0 +1,24 @@
+/*
+ * 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.felix.deploymentadmin.test.bundleapi;
+
+public interface MyService {
+ public void a();
+ public void b();
+}
\ No newline at end of file
diff --git a/deploymentadmin/testbundles/bundleapi2/bnd.bnd b/deploymentadmin/testbundles/bundleapi2/bnd.bnd
new file mode 100644
index 0000000..666f4ba
--- /dev/null
+++ b/deploymentadmin/testbundles/bundleapi2/bnd.bnd
@@ -0,0 +1,3 @@
+Bundle-Version: 2.0.0
+Bundle-SymbolicName: testbundles.bundleapi
+Export-Package: org.apache.felix.deploymentadmin.test.bundleapi;version="2.0.0"
diff --git a/deploymentadmin/testbundles/bundleapi2/pom.xml b/deploymentadmin/testbundles/bundleapi2/pom.xml
new file mode 100644
index 0000000..1bc9b07
--- /dev/null
+++ b/deploymentadmin/testbundles/bundleapi2/pom.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.deploymentadmin.testbundles</artifactId>
+ <version>1</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <name>Apache Felix DeploymentAdmin API Bundle 2</name>
+ <version>2.0.0</version>
+ <artifactId>org.apache.felix.deploymentadmin.test.bundleapi</artifactId>
+ <packaging>bundle</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>2.3.4</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <_include>bnd.bnd</_include>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/deploymentadmin/testbundles/bundleapi2/src/main/java/org/apache/felix/deploymentadmin/test/bundleapi/MyService.java b/deploymentadmin/testbundles/bundleapi2/src/main/java/org/apache/felix/deploymentadmin/test/bundleapi/MyService.java
new file mode 100644
index 0000000..9331422
--- /dev/null
+++ b/deploymentadmin/testbundles/bundleapi2/src/main/java/org/apache/felix/deploymentadmin/test/bundleapi/MyService.java
@@ -0,0 +1,24 @@
+/*
+ * 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.felix.deploymentadmin.test.bundleapi;
+
+public interface MyService {
+ public void a();
+ public void c();
+}
\ No newline at end of file
diff --git a/deploymentadmin/testbundles/bundleimpl1/bnd.bnd b/deploymentadmin/testbundles/bundleimpl1/bnd.bnd
new file mode 100644
index 0000000..b0d1d58
--- /dev/null
+++ b/deploymentadmin/testbundles/bundleimpl1/bnd.bnd
@@ -0,0 +1,4 @@
+Bundle-Version: 1.0.0
+Bundle-SymbolicName: testbundles.bundleimpl
+Import-Package: org.apache.felix.deploymentadmin.test.bundleapi;version="[1.0.0,2.0.0)"
+Private-Package: org.apache.felix.deploymentadmin.test.bundleimpl
diff --git a/deploymentadmin/testbundles/bundleimpl1/pom.xml b/deploymentadmin/testbundles/bundleimpl1/pom.xml
new file mode 100644
index 0000000..11f8d5e
--- /dev/null
+++ b/deploymentadmin/testbundles/bundleimpl1/pom.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.deploymentadmin.testbundles</artifactId>
+ <version>1</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <name>Apache Felix DeploymentAdmin Impl Bundle 1</name>
+ <version>1.0.0</version>
+ <artifactId>org.apache.felix.deploymentadmin.test.bundleimpl</artifactId>
+ <packaging>bundle</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.deploymentadmin.test.bundleapi</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>2.3.4</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <_include>bnd.bnd</_include>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/deploymentadmin/testbundles/bundleimpl1/src/main/java/org/apache/felix/deploymentadmin/test/bundleimpl/MyServiceImpl.java b/deploymentadmin/testbundles/bundleimpl1/src/main/java/org/apache/felix/deploymentadmin/test/bundleimpl/MyServiceImpl.java
new file mode 100644
index 0000000..979e53a
--- /dev/null
+++ b/deploymentadmin/testbundles/bundleimpl1/src/main/java/org/apache/felix/deploymentadmin/test/bundleimpl/MyServiceImpl.java
@@ -0,0 +1,26 @@
+/*
+ * 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.felix.deploymentadmin.test.bundleimpl;
+
+import org.apache.felix.deploymentadmin.test.bundleapi.MyService;
+
+public class MyServiceImpl implements MyService {
+ public void a() {};
+ public void b() {};
+}
\ No newline at end of file
diff --git a/deploymentadmin/testbundles/bundleimpl2/bnd.bnd b/deploymentadmin/testbundles/bundleimpl2/bnd.bnd
new file mode 100644
index 0000000..2f03376
--- /dev/null
+++ b/deploymentadmin/testbundles/bundleimpl2/bnd.bnd
@@ -0,0 +1,4 @@
+Bundle-Version: 2.0.0
+Bundle-SymbolicName: testbundles.bundleimpl
+Import-Package: org.apache.felix.deploymentadmin.test.bundleapi;version="[2.0.0,3.0.0)"
+Private-Package: org.apache.felix.deploymentadmin.test.bundleimpl
diff --git a/deploymentadmin/testbundles/bundleimpl2/pom.xml b/deploymentadmin/testbundles/bundleimpl2/pom.xml
new file mode 100644
index 0000000..25f4515
--- /dev/null
+++ b/deploymentadmin/testbundles/bundleimpl2/pom.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.deploymentadmin.testbundles</artifactId>
+ <version>1</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <name>Apache Felix DeploymentAdmin Impl Bundle 2</name>
+ <version>2.0.0</version>
+ <artifactId>org.apache.felix.deploymentadmin.test.bundleimpl</artifactId>
+ <packaging>bundle</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.deploymentadmin.test.bundleapi</artifactId>
+ <version>2.0.0</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>2.3.4</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <_include>bnd.bnd</_include>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/deploymentadmin/testbundles/bundleimpl2/src/main/java/org/apache/felix/deploymentadmin/test/bundleimpl/MyServiceImpl.java b/deploymentadmin/testbundles/bundleimpl2/src/main/java/org/apache/felix/deploymentadmin/test/bundleimpl/MyServiceImpl.java
new file mode 100644
index 0000000..a72926c
--- /dev/null
+++ b/deploymentadmin/testbundles/bundleimpl2/src/main/java/org/apache/felix/deploymentadmin/test/bundleimpl/MyServiceImpl.java
@@ -0,0 +1,26 @@
+/*
+ * 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.felix.deploymentadmin.test.bundleimpl;
+
+import org.apache.felix.deploymentadmin.test.bundleapi.MyService;
+
+public class MyServiceImpl implements MyService {
+ public void a() {};
+ public void c() {};
+}
\ No newline at end of file
diff --git a/deploymentadmin/testbundles/pom.xml b/deploymentadmin/testbundles/pom.xml
index e332d53..34467af 100644
--- a/deploymentadmin/testbundles/pom.xml
+++ b/deploymentadmin/testbundles/pom.xml
@@ -46,5 +46,9 @@
<module>fragment1</module>
<module>rp1</module>
<module>rp2</module>
+ <module>bundleapi1</module>
+ <module>bundleapi2</module>
+ <module>bundleimpl1</module>
+ <module>bundleimpl2</module>
</modules>
</project>