[jboss-cvs] JBossAS SVN: r85218 - in projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi: jbosgi39 and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Mar 4 08:02:43 EST 2009


Author: thomas.diesler at jboss.com
Date: 2009-03-04 08:02:41 -0500 (Wed, 04 Mar 2009)
New Revision: 85218

Added:
   projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi39/
   projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java
Log:
[JBOSGI-39] Bundle undeploy does not clean up properly. Add OSGI39TestCase

Added: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java	2009-03-04 13:02:41 UTC (rev 85218)
@@ -0,0 +1,131 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.jbosgi39;
+
+//$Id$
+
+import org.jboss.osgi.spi.framework.OSGiBootstrap;
+import org.jboss.osgi.spi.framework.OSGiFramework;
+import org.jboss.osgi.spi.junit.IntegrationTest;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+/**
+ * [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 thomas.diesler at jboss.com
+ * @since 04-Mar-2009
+ */
+public class OSGI39TestCase extends IntegrationTest
+{
+   public void testInstallBWithoutX() throws Exception
+   {
+      OSGiFramework framework = OSGiBootstrap.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("BundleException expected");
+      }
+      catch (BundleException ex)
+      {
+         // expected
+      }
+      
+      bundleB.uninstall();
+   }
+
+   public void testInstallX() throws Exception
+   {
+      OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
+      BundleContext sysContext = framework.getSystemBundleContext();
+
+      Bundle bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
+      assertEquals("Bundle installed", Bundle.INSTALLED, bundleX.getState());
+
+      bundleX.start();
+      assertEquals("Bundle active", Bundle.ACTIVE, bundleX.getState());
+      
+      bundleX.uninstall();
+   }
+
+   public void testInstallBAfterX() throws Exception
+   {
+      OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
+      BundleContext sysContext = framework.getSystemBundleContext();
+
+      Bundle bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
+      assertEquals("Bundle installed", Bundle.INSTALLED, bundleX.getState());
+
+      bundleX.start();
+      assertEquals("Bundle active", Bundle.ACTIVE, bundleX.getState());
+      
+      Bundle bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleB.jar").toExternalForm());
+      assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
+      
+      bundleB.start();
+      assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
+      
+      bundleB.uninstall();
+      bundleX.uninstall();
+   }
+
+   public void testInstallBAfterUninstallX() throws Exception
+   {
+      OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
+      BundleContext sysContext = framework.getSystemBundleContext();
+
+      Bundle bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
+      assertEquals("Bundle installed", Bundle.INSTALLED, bundleX.getState());
+
+      bundleX.start();
+      assertEquals("Bundle active", Bundle.ACTIVE, bundleX.getState());
+      
+      bundleX.uninstall();
+      
+      Bundle bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleB.jar").toExternalForm());
+      assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
+      
+      try
+      {
+         bundleB.start();
+         fail("BundleException expected");
+      }
+      catch (BundleException ex)
+      {
+         // expected
+      }
+      
+      bundleB.uninstall();
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF




More information about the jboss-cvs-commits mailing list