[ 
https://issues.apache.org/jira/browse/FELIX-972?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12679116#action_12679116
 ] 

Stuart McCulloch commented on FELIX-972:
----------------------------------------

At first glance this appears to follow the OSGi spec - see 4.3.11 Uninstalling 
Bundles:

  "Once this method returns, the state of the OSGi Service Platform must be the 
same as if the bundle had never been installed, unless:
   • The uninstalled bundle has exported any packages (via its Export-Package 
manifest header)
   • The uninstalled bundle was selected by the Framework as the exporter of 
these packages.

   If none of the old exports are used, then the old exports must be removed. 
Otherwise, all old exports must remain available
   for existing bundles and future resolves until the refreshPackages method is 
called or the Framework is restarted."

B uninstalled before X:

  B has no exports in use and uninstalls completely, X now has no exports in 
use so it also uninstalls completely

X uninstalled before B

  X has exported packages in use by B so these are kept available until a 
refresh, B has no exports in use and uninstalls completely

So according to the spec there will be a difference depending on the order you 
uninstall bundles UNTIL you call refresh.


> Bundle gets wired to an already uninstalled bundle
> --------------------------------------------------
>
>                 Key: FELIX-972
>                 URL: https://issues.apache.org/jira/browse/FELIX-972
>             Project: Felix
>          Issue Type: Bug
>    Affects Versions: felix-1.4.1
>            Reporter: Thomas Diesler
>
> It seems that the order on uninstall matters
> B, X - is ok
> X, B - fails 
> /**
>  * [JBOSGI-39] Bundle undeploy does not clean up properly
>  * 
>  * https://jira.jboss.org/jira/browse/JBOSGI-39
>  * 
>  * Bundle B depends on bundle X.
>  * 
>  * B ---> X 
>  * 
>  * @author [email protected]
>  * @since 04-Mar-2009
>  */
> public class OSGI39EmbeddedTestCase extends IntegrationTest
> {
>    static OSGiBootstrapProvider bootProvider;
>    
>    @Override
>    protected OSGiBootstrapProvider getBootstrapProvider()
>    {
>       if (bootProvider == null)
>          bootProvider = createBootstrapProvider();
>       
>       return bootProvider;
>    }
>    public void testFirstRun() throws Exception
>    {
>       installBBeforeX();
>    }
>    public void testSecondRun() throws Exception
>    {
>       installBBeforeX();
>    }
>    private void installBBeforeX() throws Exception
>    {
>       OSGiFramework framework = getBootstrapProvider().getFramework();
>       BundleContext sysContext = framework.getSystemBundleContext();
>       
>       Bundle bundleB = 
> sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleB.jar").toExternalForm());
>       assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
>       
>       try
>       {
>          bundleB.start();
>          fail("Unresolved constraint expected");
>       }
>       catch (BundleException ex)
>       {
>          // expected
>       }
>       
>       Bundle bundleX = 
> sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
>       
>       bundleB.start();
>       
>       assertEquals("Bundle resolved", Bundle.RESOLVED, bundleX.getState());
>       assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
>       // Uninstall X before B
>       bundleX.uninstall();
>       bundleB.uninstall();
>    }
> Test set: org.jboss.test.osgi.jbosgi39.OSGI39EmbeddedTestCase
> -------------------------------------------------------------------------------
> Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 3.989 sec <<< 
> FAILURE!
> testSecondRun(org.jboss.test.osgi.jbosgi39.OSGI39EmbeddedTestCase)  Time 
> elapsed: 0.015 sec  <<< FAILURE!
> junit.framework.AssertionFailedError: Unresolved constraint expected
>       at junit.framework.Assert.fail(Assert.java:47)
>       at 
> org.jboss.test.osgi.jbosgi39.OSGI39EmbeddedTestCase.installBBeforeX(OSGI39EmbeddedTestCase.java:79)
>       at 
> org.jboss.test.osgi.jbosgi39.OSGI39EmbeddedTestCase.testSecondRun(OSGI39EmbeddedTestCase.java:65)
> 2009-03-05 08:42:00,284 DEBUG [org.jboss.osgi.spi.junit.OSGiTest] ### START 
> org.jboss.test.osgi.jbosgi39.OSGI39EmbeddedTestCase.testFirstRun
> 2009-03-05 08:42:04,173 DEBUG [org.jboss.osgi.felix.framework.FelixLogger] 
> WIRE: 1.0 -> org.jboss.test.osgi.jbosgi38.bundleB -> 1.0
> 2009-03-05 08:42:04,173 DEBUG [org.jboss.osgi.felix.framework.FelixLogger] 
> WIRE: 1.0 -> org.jboss.test.osgi.jbosgi38.bundleX -> 2.0
> 2009-03-05 08:42:04,173 DEBUG [org.jboss.osgi.felix.framework.FelixLogger] 
> WIRE: 1.0 -> org.osgi.framework -> 0
> 2009-03-05 08:42:04,173 DEBUG [org.jboss.osgi.felix.framework.FelixLogger] 
> WIRE: 2.0 -> org.jboss.test.osgi.jbosgi38.bundleX -> 2.0
> 2009-03-05 08:42:04,187 DEBUG [org.jboss.osgi.spi.junit.OSGiTest] ### END 
> org.jboss.test.osgi.jbosgi39.OSGI39EmbeddedTestCase.testFirstRun
> 2009-03-05 08:42:04,194 DEBUG [org.jboss.osgi.spi.junit.OSGiTest] ### START 
> org.jboss.test.osgi.jbosgi39.OSGI39EmbeddedTestCase.testSecondRun
> 2009-03-05 08:42:04,200 DEBUG [org.jboss.osgi.felix.framework.FelixLogger] 
> WIRE: 3.0 -> org.jboss.test.osgi.jbosgi38.bundleB -> 3.0
> 2009-03-05 08:42:04,200 DEBUG [org.jboss.osgi.felix.framework.FelixLogger] 
> WIRE: 3.0 -> org.jboss.test.osgi.jbosgi38.bundleX -> 2.0
> 2009-03-05 08:42:04,200 DEBUG [org.jboss.osgi.felix.framework.FelixLogger] 
> WIRE: 3.0 -> org.osgi.framework -> 0
> 2009-03-05 08:42:04,203 DEBUG [org.jboss.osgi.spi.junit.OSGiTest] ### END 
> org.jboss.test.osgi.jbosgi39.OSGI39EmbeddedTestCase.testSecondRun

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to