[jboss-osgi-commits] JBoss-OSGI SVN: r93543 - projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal.

jboss-osgi-commits at lists.jboss.org jboss-osgi-commits at lists.jboss.org
Tue Sep 15 11:45:52 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-09-15 11:45:51 -0400 (Tue, 15 Sep 2009)
New Revision: 93543

Modified:
   projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteBundle.java
   projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java
Log:
Fix undeploy issue with remote runtime

Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteBundle.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteBundle.java	2009-09-15 15:38:40 UTC (rev 93542)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteBundle.java	2009-09-15 15:45:51 UTC (rev 93543)
@@ -132,7 +132,7 @@
       }
       catch (Exception ex)
       {
-         log.error("Cannot uninstall: " + location);
+         log.error("Cannot uninstall: " + location, ex);
       }
    }
 

Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java	2009-09-15 15:38:40 UTC (rev 93542)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java	2009-09-15 15:45:51 UTC (rev 93543)
@@ -72,7 +72,7 @@
          URL bundleURL = getTestHelper().getTestArchiveURL(location);
          BundleDeployment bundleDep = BundleDeploymentFactory.createBundleDeployment(bundleURL);
          
-         invokeDeployerService("deploy", bundleURL);
+         deployInternal(location, true);
          
          String symbolicName = bundleDep.getSymbolicName();
          String version = bundleDep.getVersion().toString();
@@ -98,20 +98,43 @@
       }
    }
    
-   @Override
    public void deploy(String location) throws Exception
    {
+      deployInternal(location, false);
+   }
+   
+   private void deployInternal(String location, boolean isBundle) throws Exception
+   {
       URL archiveURL = getTestHelper().getTestArchiveURL(location);
-      invokeMainDeployer("deploy", archiveURL);
+      if (isBundle)
+         invokeDeployerService("deploy", archiveURL);
+      else
+         invokeMainDeployer("deploy", archiveURL);
    }
-
-   @Override
+   
    public void undeploy(String location) throws Exception
    {
       URL archiveURL = getTestHelper().getTestArchiveURL(location);
-      invokeMainDeployer("undeploy", archiveURL);
+      if (isBundleArchive(location))
+         invokeDeployerService("undeploy", archiveURL);
+      else
+         invokeMainDeployer("undeploy", archiveURL);
    }
 
+   private boolean isBundleArchive(String location)
+   {
+      try
+      {
+         URL archiveURL = getTestHelper().getTestArchiveURL(location);
+         BundleDeploymentFactory.createBundleDeployment(archiveURL);
+         return true;
+      }
+      catch (BundleException ex)
+      {
+         return false;
+      }
+   }
+
    public OSGiBundle[] getBundles()
    {
       try



More information about the jboss-osgi-commits mailing list