osgi / bugzilla-archive

Archive of OSGi Alliance Specification Bugzilla bugs. The Specification Bugzilla system was decommissioned with the move to GitHub. The issues in this repository are imported from the Specification Bugzilla system for archival purposes.
0 stars 1 forks source link

InstallFixPack tests #105

Closed bjhargrave closed 18 years ago

bjhargrave commented 18 years ago

Original bug ID: BZ#110 From: Ivan Zahoranszky <ivan.zahoranszky@nokia.com> Reported version: R4

bjhargrave commented 18 years ago

Comment author: Ivan Zahoranszky <ivan.zahoranszky@nokia.com>

The mystic CODE_BUNDLE_NAME_ERROR (457) again. Anyway I have found the root of the problem. When the InstallFixPack.run begins

public void run() { prepare(); // HERE !!!!!!!!!!!!! testInstallFixPack001();
testInstallFixPack002();

there is an installed bundle in the framework. location: osgi-dp:bundles.tb1 Bundle-Version: 1.5 Maybe a former Dp is't uninstalled.

The testInstallFixPack001 tries to install a DP that contains a bundle. This bundle will have the same location than the mentioned one. But it's version is 1.0. When the DA calls the BundleContext.installBundle(location, stream) the framework correctly doesn't installs the new bundle but returns the old one with version 1.5. But the Dp manifest says that the version is 1.0. The two versions mismatch.

The same problem occurs other places (other test cases) as well.

from framework JavaDoc (BundleContext.installBundle(String location)): "If a bundle containing the same location string is already installed, the Bundle object for that bundle is returned."

bjhargrave commented 18 years ago

Comment author: Ivan Zahoranszky <ivan.zahoranszky@nokia.com>

THE PROBLEM COMES UP IN MANY-MANY PLACES. PLEASE REVIEW THE TESTS! I added an extra check in the DA so the thrown exception gives you detailed description about the problem.

bjhargrave commented 18 years ago

Comment author: Felipe Guimaraes <wlg018@motorola.com>

You're right. The problem is at DeploymentSessionImpl.java. When the processBundle method is called, it installs (or updates) the bundle and, after that, calls checkDpBundleConformity. This second method throws an exception if "the symbolic name or version in the deployment package manifest is not the same as the bundle's name and version" without removing the bundle. Thus, the bundle is still installed in the framework (therefore, further tests fail). I changed this method to uninstall this bundle and, after that, all testInstallFixPack methods pass. :)

Bu the way, RI throws DeploymentException.CODE_BUNDLE_NAME_ERROR if "The symbolic name or version in the deployment package manifest is not the same as the symbolic name and version in the bundle" however JavaDoc only says this exception is thrown if "Bundle symbolic name is not the same as defined by the deployment package manifest". Nothing is said about the version, if this behavior is correct, maybe a minor clarification is needed.