Skip to content

Commit

Permalink
FELIX-4184 Added a test case that shows the failure described in the …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
m4rr5 committed Nov 15, 2013
1 parent 09f8f2f commit c671c66
Show file tree
Hide file tree
Showing 15 changed files with 357 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,17 @@ protected URL getTestResource(String resourceName) {
}

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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,4 +546,38 @@ public void testUninstallFixPackageOnlyRemovesOwnArtifactsOk() throws Exception
// 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);
}
}
}
3 changes: 3 additions & 0 deletions deploymentadmin/testbundles/bundleapi1/bnd.bnd
Original file line number Diff line number Diff line change
@@ -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"
46 changes: 46 additions & 0 deletions deploymentadmin/testbundles/bundleapi1/pom.xml
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
@@ -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();
}
3 changes: 3 additions & 0 deletions deploymentadmin/testbundles/bundleapi2/bnd.bnd
Original file line number Diff line number Diff line change
@@ -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"
46 changes: 46 additions & 0 deletions deploymentadmin/testbundles/bundleapi2/pom.xml
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
@@ -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();
}
4 changes: 4 additions & 0 deletions deploymentadmin/testbundles/bundleimpl1/bnd.bnd
Original file line number Diff line number Diff line change
@@ -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
51 changes: 51 additions & 0 deletions deploymentadmin/testbundles/bundleimpl1/pom.xml
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
@@ -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() {};
}
4 changes: 4 additions & 0 deletions deploymentadmin/testbundles/bundleimpl2/bnd.bnd
Original file line number Diff line number Diff line change
@@ -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
51 changes: 51 additions & 0 deletions deploymentadmin/testbundles/bundleimpl2/pom.xml
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
@@ -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() {};
}
4 changes: 4 additions & 0 deletions deploymentadmin/testbundles/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

0 comments on commit c671c66

Please sign in to comment.