[jboss-osgi-commits] JBoss-OSGI SVN: r102224 - in projects/jboss-osgi: projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/classloader and 7 other directories.

jboss-osgi-commits at lists.jboss.org jboss-osgi-commits at lists.jboss.org
Wed Mar 10 08:28:12 EST 2010


Author: thomas.diesler at jboss.com
Date: 2010-03-10 08:28:11 -0500 (Wed, 10 Mar 2010)
New Revision: 102224

Removed:
   projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/smoke/OSGiSmokeTestCase.java
   projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/smoke/support/a/A.java
   projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/smoke/support/a/b/
   projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/smoke/support/c/
Modified:
   projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/NativeFrameworkTest.java
   projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/classloader/RequireBundleUnitTestCase.java
   projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/compendium/PackageAdminTestCase.java
   projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/fragments/FragmentTestCase.java
   projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/service/GetServiceReferencesUnitTestCase.java
   projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/service/GetUnGetServiceUnitTestCase.java
   projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/service/RegisterServiceUnitTestCase.java
   projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/service/ServiceFactoryUnitTestCase.java
   projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/service/ServiceReferenceUnitTestCase.java
   projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/service/ServiceRegistrationUnitTestCase.java
   projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/OSGi142TestCase.java
Log:
Migrate more framework tests to OSGiTest 

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/NativeFrameworkTest.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/NativeFrameworkTest.java	2010-03-10 13:24:47 UTC (rev 102223)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/NativeFrameworkTest.java	2010-03-10 13:28:11 UTC (rev 102224)
@@ -23,11 +23,16 @@
 
 // $Id: $
 
+import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import java.util.Arrays;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 import java.util.concurrent.CopyOnWriteArrayList;
 
 import org.jboss.logging.Logger;
@@ -48,6 +53,7 @@
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.SynchronousBundleListener;
 import org.osgi.framework.launch.Framework;
+import org.osgi.service.packageadmin.PackageAdmin;
 
 /**
  * Parent for native framework tests.  
@@ -89,6 +95,73 @@
       }
    }
 
+   protected PackageAdmin getPackageAdmin()
+   {
+      ServiceReference sref = context.getServiceReference(PackageAdmin.class.getName());
+      return (PackageAdmin)context.getService(sref);
+   }
+
+   protected void assertLoadClass(Bundle bundle, String className, Bundle exporter)
+   {
+      Class<?> clazz = assertLoadClass(bundle, className);
+      Bundle actual = getPackageAdmin().getBundle(clazz);
+      assertEquals(exporter, actual);
+   }
+
+   @Override
+   public void frameworkEvent(FrameworkEvent event)
+   {
+      synchronized (frameworkEvents)
+      {
+         log.debug("FrameworkEvent type=" + ConstantsHelper.frameworkEvent(event.getType()) + " for " + event);
+         frameworkEvents.add(event);
+         frameworkEvents.notifyAll();
+      }
+   }
+
+   protected void assertNoFrameworkEvent() throws Exception
+   {
+      log.debug("frameworkEvents=" + frameworkEvents);
+      assertEquals(0, frameworkEvents.size());
+   }
+
+   protected void assertFrameworkEvent(int type, Bundle bundle, Class<? extends Throwable> expectedThrowable) throws Exception
+   {
+      waitForEvent(frameworkEvents, type);
+      log.debug("frameworkEvents=" + frameworkEvents);
+      int size = frameworkEvents.size();
+      assertTrue("" + size, size > 0);
+      FrameworkEvent event = frameworkEvents.remove(0);
+      assertEquals(ConstantsHelper.frameworkEvent(type), ConstantsHelper.frameworkEvent(event.getType()));
+      Throwable t = event.getThrowable();
+      if (expectedThrowable == null)
+      {
+         if (t != null)
+         {
+            log.error("Unexpected error in Framework event: ", t);
+            fail("Unexpected throwable: " + t);
+         }
+      }
+      else
+      {
+         String message = expectedThrowable.getSimpleName() + " is assignable from " + t.getClass().getSimpleName();
+         assertTrue(message, expectedThrowable.isAssignableFrom(t.getClass()));
+      }
+      assertEquals(bundle, event.getSource());
+      assertEquals(bundle, event.getBundle());
+   }
+
+   @Override
+   public void bundleChanged(BundleEvent event)
+   {
+      synchronized (bundleEvents)
+      {
+         log.debug("BundleChanged type=" + ConstantsHelper.bundleEvent(event.getType()) + " for " + event);
+         bundleEvents.add(event);
+         bundleEvents.notifyAll();
+      }
+   }
+
    protected void assertNoBundleEvent() throws Exception
    {
       log.debug("bundleEvents=" + bundleEvents);
@@ -126,28 +199,6 @@
    }
 
    @Override
-   public void frameworkEvent(FrameworkEvent event)
-   {
-      synchronized (frameworkEvents)
-      {
-         log.debug("FrameworkEvent type=" + ConstantsHelper.frameworkEvent(event.getType()) + " for " + event);
-         frameworkEvents.add(event);
-         frameworkEvents.notifyAll();
-      }
-   }
-
-   @Override
-   public void bundleChanged(BundleEvent event)
-   {
-      synchronized (bundleEvents)
-      {
-         log.debug("BundleChanged type=" + ConstantsHelper.bundleEvent(event.getType()) + " for " + event);
-         bundleEvents.add(event);
-         bundleEvents.notifyAll();
-      }
-   }
-
-   @Override
    public void serviceChanged(ServiceEvent event)
    {
       synchronized (serviceEvents)
@@ -176,6 +227,132 @@
       assertEquals(reference, event.getServiceReference());
    }
 
+   protected void assertNoAllReferences(BundleContext bundleContext, String clazz) throws Exception
+   {
+      assertNoAllReferences(bundleContext, clazz, null);
+   }
+
+   protected void assertNoAllReferences(BundleContext bundleContext, String clazz, String filter) throws Exception
+   {
+      ServiceReference[] actual = bundleContext.getAllServiceReferences(clazz, filter);
+      if (actual != null)
+         log.debug(bundleContext + " got " + Arrays.asList(actual) + " for clazz=" + clazz + " filter=" + filter);
+      else
+         log.debug(bundleContext + " got nothing for clazz=" + clazz + " filter=" + filter);
+      assertNull("Expected no references for clazz=" + clazz + " filter=" + filter, actual);
+   }
+
+   protected void assertAllReferences(BundleContext bundleContext, String clazz, ServiceReference... expected) throws Exception
+   {
+      assertAllReferences(bundleContext, clazz, null, expected);
+   }
+
+   protected void assertAllReferences(BundleContext bundleContext, String clazz, String filter, ServiceReference... expected) throws Exception
+   {
+      ServiceReference[] actual = bundleContext.getAllServiceReferences(clazz, filter);
+      if (actual != null)
+         log.debug(bundleContext + " got " + Arrays.asList(actual) + " for clazz=" + clazz + " filter=" + filter);
+      else
+         log.debug(bundleContext + " got nothing for clazz=" + clazz + " filter=" + filter);
+      assertArrayEquals(bundleContext + " with clazz=" + clazz + " filter=" + filter, expected, actual);
+   }
+
+   protected void assertNoReferences(BundleContext bundleContext, String clazz) throws Exception
+   {
+      assertNoReferences(bundleContext, clazz, null);
+   }
+
+   protected void assertNoReferences(BundleContext bundleContext, String clazz, String filter) throws Exception
+   {
+      ServiceReference[] actual = bundleContext.getServiceReferences(clazz, filter);
+      if (actual != null)
+         log.debug(bundleContext + " got " + Arrays.asList(actual) + " for clazz=" + clazz + " filter=" + filter);
+      else
+         log.debug(bundleContext + " got nothing for clazz=" + clazz + " filter=" + filter);
+      assertNull("Expected no references for clazz=" + clazz + " filter=" + filter, actual);
+   }
+
+   protected void assertReferences(BundleContext bundleContext, String clazz, ServiceReference... expected) throws Exception
+   {
+      assertReferences(bundleContext, clazz, null, expected);
+   }
+
+   protected void assertReferences(BundleContext bundleContext, String clazz, String filter, ServiceReference... expected) throws Exception
+   {
+      ServiceReference[] actual = bundleContext.getServiceReferences(clazz, filter);
+      if (actual != null)
+         log.debug(bundleContext + " got " + Arrays.asList(actual) + " for clazz=" + clazz + " filter=" + filter);
+      else
+         log.debug(bundleContext + " got nothing for clazz=" + clazz + " filter=" + filter);
+      assertArrayEquals(bundleContext + " with clazz=" + clazz + " filter=" + filter, expected, actual);
+   }
+
+   protected void assertNoGetReference(BundleContext bundleContext, String clazz) throws Exception
+   {
+      ServiceReference actual = bundleContext.getServiceReference(clazz);
+      if (actual != null)
+         log.debug(bundleContext + " got " + actual + " for clazz=" + clazz);
+      else
+         log.debug(bundleContext + " got nothing for clazz=" + clazz);
+      assertNull("Expected no references for clazz=" + clazz, actual);
+   }
+
+   protected void assertGetReference(BundleContext bundleContext, String clazz, ServiceReference expected) throws Exception
+   {
+      ServiceReference actual = bundleContext.getServiceReference(clazz);
+      if (actual != null)
+         log.debug(bundleContext + " got " + Arrays.asList(actual) + " for clazz=" + clazz);
+      else
+         log.debug(bundleContext + " got nothing for clazz=" + clazz);
+      assertEquals(bundleContext + " with clazz=" + clazz, expected, actual);
+   }
+
+   protected void assertUsingBundles(ServiceReference reference, Bundle... bundles)
+   {
+      Set<Bundle> actual = new HashSet<Bundle>();
+      Bundle[] users = reference.getUsingBundles();
+      if (users != null)
+         actual.addAll(Arrays.asList(users));
+
+      Set<Bundle> expected = new HashSet<Bundle>();
+      expected.addAll(Arrays.asList(bundles));
+
+      log.debug(reference + " users=" + actual);
+
+      // switch - check expected on actual, since actual might be proxy
+      assertEquals(actual, expected);
+   }
+   
+   protected <T> T assertInstanceOf(Object o, Class<T> expectedType)
+   {
+      return assertInstanceOf(o, expectedType, false);
+   }
+
+   protected <T> T assertInstanceOf(Object o, Class<T> expectedType, boolean allowNull)
+   {
+      if (expectedType == null)
+         fail("Null expectedType");
+
+      if (o == null)
+      {
+         if (allowNull == false)
+            fail("Null object not allowed.");
+         else
+            return null;
+      }
+
+      try
+      {
+         return expectedType.cast(o);
+      }
+      catch (ClassCastException e)
+      {
+         fail("Object " + o + " of class " + o.getClass().getName() + " is not an instanceof " + expectedType.getName());
+         // should not reach this
+         return null;
+      }
+   }
+   
    @SuppressWarnings("rawtypes")
    private void waitForEvent(List events, int type) throws InterruptedException
    {

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/classloader/RequireBundleUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/classloader/RequireBundleUnitTestCase.java	2010-03-10 13:24:47 UTC (rev 102223)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/classloader/RequireBundleUnitTestCase.java	2010-03-10 13:28:11 UTC (rev 102224)
@@ -21,11 +21,15 @@
 */
 package org.jboss.test.osgi.classloader;
 
-import junit.framework.Test;
+// $Id: $
 
-import org.jboss.test.osgi.FrameworkTest;
+import static org.junit.Assert.fail;
+
+import org.jboss.osgi.vfs.VirtualFile;
+import org.jboss.test.osgi.NativeFrameworkTest;
 import org.jboss.test.osgi.classloader.support.a.A;
 import org.jboss.test.osgi.classloader.support.b.B;
+import org.junit.Test;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleException;
 
@@ -34,56 +38,53 @@
  *
  * TODO test security
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author thomas.diesler at jboss.com
  * @version $Revision: 1.1 $
  */
-public class RequireBundleUnitTestCase extends FrameworkTest
+public class RequireBundleUnitTestCase extends NativeFrameworkTest
 {
-   public RequireBundleUnitTestCase(String name)
-   {
-      super(name);
-   }
-
-   public static Test suite()
-   {
-      return suite(RequireBundleUnitTestCase.class);
-   }
-
+   @Test
    public void testSimpleRequireBundle() throws Exception
    {
-      Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
+      VirtualFile assemblyA = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      Bundle bundleA = context.installBundle(assemblyA.toURL().toExternalForm());
       try
       {
-         bundle1.start();
-         assertLoadClass(bundle1, A.class);
-         Bundle bundle2 = installBundle(assembleBundle("simplerequirebundleA", "/bundles/classloader/simplerequirebundleA", B.class));
+         bundleA.start();
+         assertLoadClass(bundleA, A.class.getName());
+         VirtualFile assemblyB = assembleBundle("simplerequirebundleA", "/bundles/classloader/simplerequirebundleA", B.class);
+         Bundle bundleB = context.installBundle(assemblyB.toURL().toExternalForm());
          try
          {
-            bundle2.start();
-            assertLoadClass(bundle2, A.class, bundle1);
-            assertLoadClass(bundle2, B.class, bundle2);
+            bundleB.start();
+            assertLoadClass(bundleB, A.class.getName(), bundleA);
+            assertLoadClass(bundleB, B.class.getName(), bundleB);
          }
          finally
          {
-            uninstall(bundle2);
+            bundleB.uninstall();
          }
       }
       finally
       {
-         uninstall(bundle1);
+         bundleA.uninstall();
       }
    }
    
+   @Test
    public void testSimpleRequireBundleFails() throws Exception
    {
-      Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
+      VirtualFile assemblyA = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      Bundle bundleA = context.installBundle(assemblyA.toURL().toExternalForm());
       try
       {
-         bundle1.start();
-         assertLoadClass(bundle1, A.class);
-         Bundle bundle2 = installBundle(assembleBundle("simplerequirebundlefails", "/bundles/classloader/simplerequirebundlefails", B.class));
+         bundleA.start();
+         assertLoadClass(bundleA, A.class.getName());
+         VirtualFile assemblyB = assembleBundle("simplerequirebundlefails", "/bundles/classloader/simplerequirebundlefails", B.class);
+         Bundle bundleB = context.installBundle(assemblyB.toURL().toExternalForm());
          try
          {
-            bundle2.start();
+            bundleB.start();
             fail("Should not be here!");
          }
          catch (BundleException ex)
@@ -92,51 +93,57 @@
          }
          finally
          {
-            uninstall(bundle2);
+            bundleB.uninstall();
          }
       }
       finally
       {
-         uninstall(bundle1);
+         bundleA.uninstall();
       }
    }
    
+   @Test
    public void testVersionRequireBundle() throws Exception
    {
-      Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
+      VirtualFile assemblyA = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      Bundle bundleA = context.installBundle(assemblyA.toURL().toExternalForm());
       try
       {
-         bundle1.start();
-         assertLoadClass(bundle1, A.class);
-         Bundle bundle2 = installBundle(assembleBundle("versionrequirebundleA", "/bundles/classloader/versionrequirebundleA", B.class));
+         bundleA.start();
+         assertLoadClass(bundleA, A.class.getName());
+         VirtualFile assemblyB = assembleBundle("versionrequirebundleA", "/bundles/classloader/versionrequirebundleA", B.class);
+         Bundle bundleB = context.installBundle(assemblyB.toURL().toExternalForm());
          try
          {
-            bundle2.start();
-            assertLoadClass(bundle2, A.class, bundle1);
-            assertLoadClass(bundle2, B.class, bundle2);
+            bundleB.start();
+            assertLoadClass(bundleB, A.class.getName(), bundleA);
+            assertLoadClass(bundleB, B.class.getName(), bundleB);
          }
          finally
          {
-            uninstall(bundle2);
+            bundleB.uninstall();
          }
       }
       finally
       {
-         uninstall(bundle1);
+         bundleA.uninstall();
       }
    }
    
+   @Test
    public void testVersionRequireBundleFails() throws Exception
    {
-      Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
+      VirtualFile assemblyA = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      Bundle bundleA = context.installBundle(assemblyA.toURL().toExternalForm());
       try
       {
-         bundle1.start();
-         assertLoadClass(bundle1, A.class);
-         Bundle bundle2 = installBundle(assembleBundle("versionrequirebundlefails", "/bundles/classloader/versionrequirebundlefails", B.class));
+         bundleA.start();
+         assertLoadClass(bundleA, A.class.getName());
+         VirtualFile assemblyB = assembleBundle("versionrequirebundlefails", "/bundles/classloader/versionrequirebundlefails", B.class);
+         Bundle bundleB = context.installBundle(assemblyB.toURL().toExternalForm());
          try
          {
-            bundle2.start();
+            bundleB.start();
             fail("Should not be here!");
          }
          catch (BundleException rte)
@@ -145,193 +152,213 @@
          }
          finally
          {
-            uninstall(bundle2);
+            bundleB.uninstall();
          }
       }
       finally
       {
-         uninstall(bundle1);
+         bundleA.uninstall();
       }
    }
    
+   @Test
    public void testOptionalRequireBundle() throws Exception
    {
-      Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
+      VirtualFile assemblyA = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      Bundle bundleA = context.installBundle(assemblyA.toURL().toExternalForm());
       try
       {
-         bundle1.start();
-         assertLoadClass(bundle1, A.class);
-         Bundle bundle2 = installBundle(assembleBundle("optionalrequirebundleA", "/bundles/classloader/optionalrequirebundleA", B.class));
+         bundleA.start();
+         assertLoadClass(bundleA, A.class.getName());
+         VirtualFile assemblyB = assembleBundle("optionalrequirebundleA", "/bundles/classloader/optionalrequirebundleA", B.class);
+         Bundle bundleB = context.installBundle(assemblyB.toURL().toExternalForm());
          try
          {
-            bundle2.start();
-            assertLoadClass(bundle2, A.class, bundle1);
-            assertLoadClass(bundle2, B.class, bundle2);
+            bundleB.start();
+            assertLoadClass(bundleB, A.class.getName(), bundleA);
+            assertLoadClass(bundleB, B.class.getName(), bundleB);
          }
          finally
          {
-            uninstall(bundle2);
+            bundleB.uninstall();
          }
       }
       finally
       {
-         uninstall(bundle1);
+         bundleA.uninstall();
       }
    }
    
+   @Test
    public void testOptionalRequireBundleFails() throws Exception
    {
-      Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
+      VirtualFile assemblyA = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      Bundle bundleA = context.installBundle(assemblyA.toURL().toExternalForm());
       try
       {
-         bundle1.start();
-         assertLoadClass(bundle1, A.class);
-         Bundle bundle2 = installBundle(assembleBundle("optionalrequirebundlefails", "/bundles/classloader/optionalrequirebundlefails", B.class));
+         bundleA.start();
+         assertLoadClass(bundleA, A.class.getName());
+         VirtualFile assemblyB = assembleBundle("optionalrequirebundlefails", "/bundles/classloader/optionalrequirebundlefails", B.class);
+         Bundle bundleB = context.installBundle(assemblyB.toURL().toExternalForm());
          try
          {
-            bundle2.start();
-            assertLoadClassFail(bundle2, A.class);
-            assertLoadClass(bundle2, B.class);
+            bundleB.start();
+            assertLoadClassFail(bundleB, A.class.getName());
+            assertLoadClass(bundleB, B.class.getName());
          }
          finally
          {
-            uninstall(bundle2);
+            bundleB.uninstall();
          }
       }
       finally
       {
-         uninstall(bundle1);
+         bundleA.uninstall();
       }
    }
    
+   @Test
    public void testReExportRequireBundle() throws Exception
    {
       //Bundle-Name: BundleA
       //Bundle-Version: 1.0.0
       //Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleA;test=x
       //Export-Package: org.jboss.test.osgi.classloader.support.a;version=1.0.0;test=x
-      Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
+      VirtualFile assemblyA = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      Bundle bundleA = context.installBundle(assemblyA.toURL().toExternalForm());
       
       try
       {
-         bundle1.start();
-         assertLoadClass(bundle1, A.class);
+         bundleA.start();
+         assertLoadClass(bundleA, A.class.getName());
          
          //Bundle-Name: BundleB
          //Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
          //Require-Bundle: org.jboss.test.osgi.classloader.bundleA;visibility:=reexport
          //Export-Package: org.jboss.test.osgi.classloader.support.b
-         Bundle bundle2 = installBundle(assembleBundle("reexportrequirebundleA", "/bundles/classloader/reexportrequirebundleA", B.class));
+         VirtualFile assemblyB = assembleBundle("reexportrequirebundleA", "/bundles/classloader/reexportrequirebundleA", B.class);
+         Bundle bundleB = context.installBundle(assemblyB.toURL().toExternalForm());
          
          try
          {
-            bundle2.start();
-            assertLoadClass(bundle2, A.class, bundle1);
-            assertLoadClass(bundle2, B.class, bundle2);
+            bundleB.start();
+            assertLoadClass(bundleB, A.class.getName(), bundleA);
+            assertLoadClass(bundleB, B.class.getName(), bundleB);
             
             //Bundle-Name: BundleC
             //Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleC
             //Require-Bundle: org.jboss.test.osgi.classloader.bundleB
-            Bundle bundle3 = installBundle(assembleBundle("reexportrequirebundleB", "/bundles/classloader/reexportrequirebundleB"));
+            VirtualFile assemblyC = assembleBundle("reexportrequirebundleB", "/bundles/classloader/reexportrequirebundleB");
+            Bundle bundleC = context.installBundle(assemblyC.toURL().toExternalForm());
             
             try
             {
-               assertLoadClass(bundle3, A.class, bundle1);
-               assertLoadClass(bundle3, B.class, bundle2);
+               assertLoadClass(bundleC, A.class.getName(), bundleA);
+               assertLoadClass(bundleC, B.class.getName(), bundleB);
             }
             finally
             {
-               uninstall(bundle3);
+               bundleC.uninstall();
             }
          }
          finally
          {
-            uninstall(bundle2);
+            bundleB.uninstall();
          }
       }
       finally
       {
-         uninstall(bundle1);
+         bundleA.uninstall();
       }
    }
    
+   @Test
    public void testNoReExportRequireBundle() throws Exception
    {
-      Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
+      VirtualFile assemblyA = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      Bundle bundleA = context.installBundle(assemblyA.toURL().toExternalForm());
       try
       {
-         bundle1.start();
-         assertLoadClass(bundle1, A.class);
-         Bundle bundle2 = installBundle(assembleBundle("noreexportrequirebundleA", "/bundles/classloader/noreexportrequirebundleA", B.class));
+         bundleA.start();
+         assertLoadClass(bundleA, A.class.getName());
+         VirtualFile assemblyB = assembleBundle("noreexportrequirebundleA", "/bundles/classloader/noreexportrequirebundleA", B.class);
+         Bundle bundleB = context.installBundle(assemblyB.toURL().toExternalForm());
          try
          {
-            bundle2.start();
-            assertLoadClass(bundle2, A.class, bundle1);
-            assertLoadClass(bundle2, B.class, bundle2);
-            Bundle bundle3 = installBundle(assembleBundle("reexportrequirebundleB", "/bundles/classloader/reexportrequirebundleB"));
+            bundleB.start();
+            assertLoadClass(bundleB, A.class.getName(), bundleA);
+            assertLoadClass(bundleB, B.class.getName(), bundleB);
+            VirtualFile assemblyC = assembleBundle("reexportrequirebundleB", "/bundles/classloader/reexportrequirebundleB");
+            Bundle bundleC = context.installBundle(assemblyC.toURL().toExternalForm());
             try
             {
-               assertLoadClassFail(bundle3, A.class);
-               assertLoadClass(bundle3, B.class, bundle2);
+               assertLoadClassFail(bundleC, A.class.getName());
+               assertLoadClass(bundleC, B.class.getName(), bundleB);
             }
             finally
             {
-               uninstall(bundle3);
+               bundleC.uninstall();
             }
          }
          finally
          {
-            uninstall(bundle2);
+            bundleB.uninstall();
          }
       }
       finally
       {
-         uninstall(bundle1);
+         bundleA.uninstall();
       }
    }
    
+   @Test
    public void testAttributeRequireBundle() throws Exception
    {
-      Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
+      VirtualFile assemblyA = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      Bundle bundleA = context.installBundle(assemblyA.toURL().toExternalForm());
       try
       {
-         bundle1.start();
-         assertLoadClass(bundle1, A.class);
-         Bundle bundle2 = installBundle(assembleBundle("attributerequirebundleA", "/bundles/classloader/attributerequirebundleA", B.class));
+         bundleA.start();
+         assertLoadClass(bundleA, A.class.getName());
+         VirtualFile assemblyB = assembleBundle("attributerequirebundleA", "/bundles/classloader/attributerequirebundleA", B.class);
+         Bundle bundleB = context.installBundle(assemblyB.toURL().toExternalForm());
          try
          {
-            bundle2.start();
-            assertLoadClass(bundle2, A.class, bundle1);
-            assertLoadClass(bundle2, B.class, bundle2);
+            bundleB.start();
+            assertLoadClass(bundleB, A.class.getName(), bundleA);
+            assertLoadClass(bundleB, B.class.getName(), bundleB);
          }
          finally
          {
-            uninstall(bundle2);
+            bundleB.uninstall();
          }
       }
       finally
       {
-         uninstall(bundle1);
+         bundleA.uninstall();
       }
    }
    
+   @Test
    public void testAttributeRequireBundleFails() throws Exception
    {
       // Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleA;test=x
       // Export-Package: org.jboss.test.osgi.classloader.support.a;version=1.0.0;test=x
       // Bundle-Version: 1.0.0
-      Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
+      VirtualFile assemblyA = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      Bundle bundleA = context.installBundle(assemblyA.toURL().toExternalForm());
       try
       {
-         bundle1.start();
-         assertLoadClass(bundle1, A.class);
+         bundleA.start();
+         assertLoadClass(bundleA, A.class.getName());
          
          // Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
          // Require-Bundle: org.jboss.test.osgi.classloader.bundleA;doesnotexist=true;test=y
-         Bundle bundle2 = installBundle(assembleBundle("attributerequirebundlefails", "/bundles/classloader/attributerequirebundlefails", B.class));
+         VirtualFile assemblyB = assembleBundle("attributerequirebundlefails", "/bundles/classloader/attributerequirebundlefails", B.class);
+         Bundle bundleB = context.installBundle(assemblyB.toURL().toExternalForm());
          try
          {
-            bundle2.start();
+            bundleB.start();
             fail("Should not be here!");
          }
          catch (BundleException rte)
@@ -340,12 +367,12 @@
          }
          finally
          {
-            uninstall(bundle2);
+            bundleB.uninstall();
          }
       }
       finally
       {
-         uninstall(bundle1);
+         bundleA.uninstall();
       }
    }
 }

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/compendium/PackageAdminTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/compendium/PackageAdminTestCase.java	2010-03-10 13:24:47 UTC (rev 102223)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/compendium/PackageAdminTestCase.java	2010-03-10 13:28:11 UTC (rev 102224)
@@ -21,12 +21,16 @@
  */
 package org.jboss.test.osgi.compendium;
 
-import junit.framework.Test;
+// $Id: $
 
-import org.jboss.osgi.framework.packageadmin.PackageAdminImpl;
-import org.jboss.test.osgi.FrameworkTest;
-import org.jboss.test.osgi.compendium.support.b.Other;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+
+import org.jboss.osgi.vfs.VirtualFile;
+import org.jboss.test.osgi.NativeFrameworkTest;
 import org.jboss.test.osgi.compendium.support.a.PA;
+import org.jboss.test.osgi.compendium.support.b.Other;
+import org.junit.Test;
 import org.osgi.framework.Bundle;
 import org.osgi.service.packageadmin.PackageAdmin;
 
@@ -34,57 +38,46 @@
  * Test PackageAdmin service.
  *
  * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ * @author thomas.diesler at jboss.com
  */
-public class PackageAdminTestCase extends FrameworkTest
+public class PackageAdminTestCase extends NativeFrameworkTest
 {
-   public PackageAdminTestCase(String name)
-   {
-      super(name);
-   }
-
-   public static Test suite()
-   {
-      return suite(PackageAdminTestCase.class);
-   }
-
-   protected PackageAdmin createPackageAdmin()
-   {
-      return new PackageAdminImpl(getBundleManager());
-   }
-
+   @Test
    public void testGetBudleFromClass() throws Exception
    {
-      Bundle bundle = installBundle(assembleBundle("smoke-assembled", "/bundles/smoke/smoke-assembled", PA.class));
+      VirtualFile assemblyA = assembleBundle("smoke-assembled", "/bundles/smoke/smoke-assembled", PA.class);
+      Bundle bundleA = context.installBundle(assemblyA.toURL().toExternalForm());
       try
       {
-         bundle.start();
-         Class<?> paClass = assertLoadClass(bundle, PA.class);
+         bundleA.start();
+         Class<?> paClass = assertLoadClass(bundleA, PA.class.getName());
 
-         PackageAdmin pa = createPackageAdmin();
+         PackageAdmin pa = getPackageAdmin();
 
          Bundle found = pa.getBundle(paClass);
-         assertSame(bundle, found);
+         assertSame(bundleA, found);
 
          Bundle notFound = pa.getBundle(getClass());
          assertNull(notFound);
 
-         Bundle other = installBundle(assembleBundle("simple", "/bundles/simple/simple-bundle1", Other.class));
+         VirtualFile assemblyB = assembleBundle("simple", "/bundles/simple/simple-bundle1", Other.class);
+         Bundle bundleB = context.installBundle(assemblyB.toURL().toExternalForm());
          try
          {
-            other.start();
-            Class<?> otherClass = assertLoadClass(other, Other.class);
+            bundleB.start();
+            Class<?> otherClass = assertLoadClass(bundleB, Other.class.getName());
 
             found = pa.getBundle(otherClass);
-            assertSame(other, found);
+            assertSame(bundleB, found);
          }
          finally
          {
-            other.uninstall();
+            bundleB.uninstall();
          }
       }
       finally
       {
-         bundle.uninstall();
+         bundleA.uninstall();
       }
    }
 }

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/fragments/FragmentTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/fragments/FragmentTestCase.java	2010-03-10 13:24:47 UTC (rev 102223)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/fragments/FragmentTestCase.java	2010-03-10 13:28:11 UTC (rev 102224)
@@ -31,7 +31,7 @@
 
 import org.jboss.osgi.spi.framework.OSGiBootstrap;
 import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
-import org.jboss.osgi.testing.OSGiTest;
+import org.jboss.test.osgi.NativeFrameworkTest;
 import org.jboss.test.osgi.fragments.fragA.FragBeanA;
 import org.jboss.test.osgi.fragments.subA.SubBeanA;
 import org.junit.After;
@@ -50,7 +50,7 @@
  * @author thomas.diesler at jboss.com
  * @since 07-Jan-2010
  */
-public class FragmentTestCase extends OSGiTest
+public class FragmentTestCase extends NativeFrameworkTest
 {
    private Framework framework;
    private BundleContext context;
@@ -93,7 +93,7 @@
       assertNull("Resource URL null", resourceURL);
 
       // Load a private class
-      assertBundleLoadClass(hostA, SubBeanA.class.getName(), true);
+      assertLoadClass(hostA, SubBeanA.class.getName());
 
       hostA.uninstall();
       assertBundleState(Bundle.UNINSTALLED, hostA.getState());
@@ -155,10 +155,10 @@
       assertNotNull("Resource URL not null", resourceURL);
 
       // Load class provided by the fragment
-      assertBundleLoadClass(hostA, FragBeanA.class.getName(), true);
+      assertLoadClass(hostA, FragBeanA.class.getName());
 
       // Load a private class
-      assertBundleLoadClass(hostA, SubBeanA.class.getName(), true);
+      assertLoadClass(hostA, SubBeanA.class.getName());
 
       hostA.uninstall();
       assertBundleState(Bundle.UNINSTALLED, hostA.getState());
@@ -200,7 +200,7 @@
 
       // The fragment contains an overwrites Private-Package with Import-Package
       // The SubBeanA is expected to come from HostB, which exports that package
-      assertBundleLoadClass(hostB, SubBeanA.class.getName(), true);
+      assertLoadClass(hostB, SubBeanA.class.getName());
 
       hostA.uninstall();
       assertBundleState(Bundle.UNINSTALLED, hostA.getState());

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/service/GetServiceReferencesUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/service/GetServiceReferencesUnitTestCase.java	2010-03-10 13:24:47 UTC (rev 102223)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/service/GetServiceReferencesUnitTestCase.java	2010-03-10 13:28:11 UTC (rev 102224)
@@ -21,14 +21,18 @@
 */
 package org.jboss.test.osgi.service;
 
+// $Id: $
+
+import static org.junit.Assert.*;
+
 import java.util.Dictionary;
 import java.util.Hashtable;
 
-import junit.framework.Test;
-
-import org.jboss.test.osgi.FrameworkTest;
+import org.jboss.osgi.vfs.VirtualFile;
+import org.jboss.test.osgi.NativeFrameworkTest;
 import org.jboss.test.osgi.service.support.a.A;
 import org.jboss.test.osgi.service.support.b.B;
+import org.junit.Test;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
@@ -41,27 +45,21 @@
  *
  * todo test service permissions
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author thomas.diesler at jboss.com
  * @version $Revision: 1.1 $
  */
-public class GetServiceReferencesUnitTestCase extends FrameworkTest
+public class GetServiceReferencesUnitTestCase extends NativeFrameworkTest
 {
-   public static Test suite()
-   {
-      return suite(GetServiceReferencesUnitTestCase.class);
-   }
 
-   public GetServiceReferencesUnitTestCase(String name)
-   {
-      super(name);
-   }
-
+   @Test
    public void testGetServiceReferences() throws Exception
    {
-      Bundle bundle1 = installBundle(assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class));
+      VirtualFile assembly = assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class);
+      Bundle bundle = context.installBundle(assembly.toURL().toExternalForm());
       try
       {
-         bundle1.start();
-         BundleContext bundleContext1 = bundle1.getBundleContext();
+         bundle.start();
+         BundleContext bundleContext1 = bundle.getBundleContext();
          assertNotNull(bundleContext1);
          
          assertNoGetReference(bundleContext1, A.class.getName());
@@ -71,7 +69,7 @@
          assertNoReferences(bundleContext1, B.class.getName());
          assertNoAllReferences(bundleContext1, B.class.getName());
 
-         Class<?> clazz = bundle1.loadClass(A.class.getName());
+         Class<?> clazz = bundle.loadClass(A.class.getName());
          Object service1 = clazz.newInstance();
          ServiceRegistration registration1 = bundleContext1.registerService(A.class.getName(), service1, null);
          assertNotNull(registration1);
@@ -99,9 +97,9 @@
             bundleContext1.getServiceReference(null);
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalArgumentException t)
          {
-            checkThrowable(IllegalArgumentException.class, t);
+            // expected
          }
          
          try
@@ -109,9 +107,9 @@
             bundleContext1.getServiceReferences(null, "invalid");
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (InvalidSyntaxException t)
          {
-            checkThrowable(InvalidSyntaxException.class, t);
+            // expected
          }
          
          try
@@ -119,21 +117,21 @@
             bundleContext1.getAllServiceReferences(null, "invalid");
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (InvalidSyntaxException t)
          {
-            checkThrowable(InvalidSyntaxException.class, t);
+            // expected
          }
          
-         bundle1.stop();
+         bundle.stop();
          
          try
          {
             bundleContext1.getServiceReference(A.class.getName());
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalStateException t)
          {
-            checkThrowable(IllegalStateException.class, t);
+            // expected
          }
          
          try
@@ -141,9 +139,9 @@
             bundleContext1.getServiceReferences(null, null);
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalStateException t)
          {
-            checkThrowable(IllegalStateException.class, t);
+            // expected
          }
          
          try
@@ -151,57 +149,61 @@
             bundleContext1.getAllServiceReferences(null, null);
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalStateException t)
          {
-            checkThrowable(IllegalStateException.class, t);
+            // expected
          }
       }
       finally
       {
-         uninstall(bundle1);
+         bundle.uninstall();
       }
    }
    
+   @Test
    public void testGetServiceReferencesNoClassNotAssignable() throws Exception
    {
       assertGetServiceReferencesNotAssignable(null);
    }
    
+   @Test
    public void testGetServiceReferencesNotAssignable() throws Exception
    {
       assertGetServiceReferencesNotAssignable(A.class.getName());
    }
    
-   public void assertGetServiceReferencesNotAssignable(String className) throws Exception
+   private void assertGetServiceReferencesNotAssignable(String className) throws Exception
    {
-      Bundle bundle1 = installBundle(assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class));
+      VirtualFile assemblyA = assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class);
+      Bundle bundleA = context.installBundle(assemblyA.toURL().toExternalForm());
       try
       {
-         bundle1.start();
-         BundleContext bundleContext1 = bundle1.getBundleContext();
+         bundleA.start();
+         BundleContext bundleContext1 = bundleA.getBundleContext();
          assertNotNull(bundleContext1);
          
          if (className != null)
             assertNoGetReference(bundleContext1, className);
 
-         Class<?> clazz = bundle1.loadClass(A.class.getName());
+         Class<?> clazz = bundleA.loadClass(A.class.getName());
          Object service1 = clazz.newInstance();
          ServiceRegistration registration1 = bundleContext1.registerService(A.class.getName(), service1, null);
          assertNotNull(registration1);
          ServiceReference reference1 = registration1.getReference();
          assertNotNull(reference1);
 
-         Bundle bundle2 = installBundle(assembleBundle("simple2", "/bundles/simple/simple-bundle2", A.class));
+         VirtualFile assemblyB = assembleBundle("simple2", "/bundles/simple/simple-bundle2", A.class);
+         Bundle bundleB = context.installBundle(assemblyB.toURL().toExternalForm());
          try
          {
-            bundle2.start();
-            BundleContext bundleContext2 = bundle2.getBundleContext();
+            bundleB.start();
+            BundleContext bundleContext2 = bundleB.getBundleContext();
             assertNotNull(bundleContext2);
 
             if (className != null)
                assertNoGetReference(bundleContext2, className);
 
-            clazz = bundle2.loadClass(A.class.getName());
+            clazz = bundleB.loadClass(A.class.getName());
             Object service2 = clazz.newInstance();
             ServiceRegistration registration2 = bundleContext2.registerService(A.class.getName(), service2, null);
             assertNotNull(registration2);
@@ -251,55 +253,59 @@
          }
          finally
          {
-            uninstall(bundle2);
+            bundleB.uninstall();
          }
       }
       finally
       {
-         uninstall(bundle1);
+         bundleA.uninstall();
       }
    }
 
+   @Test
    public void testGetServiceReferencesNoClassAssignable() throws Exception
    {
       assertGetServiceReferencesAssignable(null);
    }
 
+   @Test
    public void testGetServiceReferencesClassAssignable() throws Exception
    {
       assertGetServiceReferencesAssignable(A.class.getName());
    }
 
-   public void assertGetServiceReferencesAssignable(String className) throws Exception
+   private void assertGetServiceReferencesAssignable(String className) throws Exception
    {
-      Bundle bundle1 = installBundle(assembleBundle("service2", "/bundles/service/service-bundle2", A.class));
+      VirtualFile assemblyA = assembleBundle("service2", "/bundles/service/service-bundle2", A.class);
+      Bundle bundleA = context.installBundle(assemblyA.toURL().toExternalForm());
       try
       {
-         bundle1.start();
-         BundleContext bundleContext1 = bundle1.getBundleContext();
+         bundleA.start();
+         BundleContext bundleContext1 = bundleA.getBundleContext();
          assertNotNull(bundleContext1);
 
          if (className != null)
             assertNoGetReference(bundleContext1, className);
 
-         Class<?> clazz = bundle1.loadClass(A.class.getName());
+         Class<?> clazz = bundleA.loadClass(A.class.getName());
          Object service1 = clazz.newInstance();
          ServiceRegistration registration1 = bundleContext1.registerService(A.class.getName(), service1, null);
          assertNotNull(registration1);
          ServiceReference reference1 = registration1.getReference();
          assertNotNull(reference1);
 
-         Bundle bundle2 = installBundle(assembleBundle("service1", "/bundles/service/service-bundle1"));
+         VirtualFile assemblyB = assembleBundle("service1", "/bundles/service/service-bundle1");
+         Bundle bundleB = context.installBundle(assemblyB.toURL().toExternalForm());
          try
          {
-            bundle2.start();
-            BundleContext bundleContext2 = bundle2.getBundleContext();
+            bundleB.start();
+            BundleContext bundleContext2 = bundleB.getBundleContext();
             assertNotNull(bundleContext2);
 
             if (className != null)
                assertGetReference(bundleContext2, className, reference1);
 
-            clazz = bundle2.loadClass(A.class.getName());
+            clazz = bundleB.loadClass(A.class.getName());
             Object service2 = clazz.newInstance();
             ServiceRegistration registration2 = bundleContext2.registerService(A.class.getName(), service2, null);
             assertNotNull(registration2);
@@ -349,24 +355,26 @@
          }
          finally
          {
-            uninstall(bundle2);
+            bundleB.uninstall();
          }
       }
       finally
       {
-         uninstall(bundle1);
+         bundleA.uninstall();
       }
    }
 
+   @Test
    public void testGetServiceReferencesRankings() throws Exception
    {
       String className = A.class.getName();
       
-      Bundle bundle1 = installBundle(assembleBundle("service2", "/bundles/service/service-bundle2", A.class));
+      VirtualFile assemblyA = assembleBundle("service2", "/bundles/service/service-bundle2", A.class);
+      Bundle bundleA = context.installBundle(assemblyA.toURL().toExternalForm());
       try
       {
-         bundle1.start();
-         BundleContext bundleContext1 = bundle1.getBundleContext();
+         bundleA.start();
+         BundleContext bundleContext1 = bundleA.getBundleContext();
          assertNotNull(bundleContext1);
          
          assertNoGetReference(bundleContext1, className);
@@ -375,18 +383,19 @@
 
          Dictionary<String, Object> properties1 = new Hashtable<String, Object>();
          properties1.put(Constants.SERVICE_RANKING, 1);
-         Class<?> clazz = bundle1.loadClass(className);
+         Class<?> clazz = bundleA.loadClass(className);
          Object service1 = clazz.newInstance();
          ServiceRegistration registration1 = bundleContext1.registerService(className, service1, properties1);
          assertNotNull(registration1);
          ServiceReference reference1 = registration1.getReference();
          assertNotNull(reference1);
 
-         Bundle bundle2 = installBundle(assembleBundle("service1", "/bundles/service/service-bundle1"));
+         VirtualFile assemblyB = assembleBundle("service1", "/bundles/service/service-bundle1");
+         Bundle bundleB = context.installBundle(assemblyB.toURL().toExternalForm());
          try
          {
-            bundle2.start();
-            BundleContext bundleContext2 = bundle2.getBundleContext();
+            bundleB.start();
+            BundleContext bundleContext2 = bundleB.getBundleContext();
             assertNotNull(bundleContext2);
 
             assertGetReference(bundleContext2, className, reference1);
@@ -395,7 +404,7 @@
 
             Dictionary<String, Object> properties2 = new Hashtable<String, Object>();
             properties2.put(Constants.SERVICE_RANKING, 2);
-            clazz = bundle2.loadClass(className);
+            clazz = bundleB.loadClass(className);
             Object service2 = clazz.newInstance();
             ServiceRegistration registration2 = bundleContext2.registerService(className, service2, properties2);
             assertNotNull(registration2);
@@ -456,25 +465,27 @@
          }
          finally
          {
-            uninstall(bundle2);
+            bundleB.uninstall();
          }
       }
       finally
       {
-         uninstall(bundle1);
+         bundleA.uninstall();
       }
    }
    
+   @Test
    public void testGetServiceReferencesFilterted() throws Exception
    {
       String className = A.class.getName();
       String wrongClassName = B.class.getName();
       
-      Bundle bundle1 = installBundle(assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class));
+      VirtualFile assembly = assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class);
+      Bundle bundle = context.installBundle(assembly.toURL().toExternalForm());
       try
       {
-         bundle1.start();
-         BundleContext bundleContext1 = bundle1.getBundleContext();
+         bundle.start();
+         BundleContext bundleContext1 = bundle.getBundleContext();
          assertNotNull(bundleContext1);
          
          assertNoGetReference(bundleContext1, A.class.getName());
@@ -507,7 +518,7 @@
          properties.put("a", "b");
          properties.put("c", "d");
          
-         Class<?> clazz = bundle1.loadClass(A.class.getName());
+         Class<?> clazz = bundle.loadClass(A.class.getName());
          Object service1 = clazz.newInstance();
          ServiceRegistration registration1 = bundleContext1.registerService(A.class.getName(), service1, properties);
          assertNotNull(registration1);
@@ -570,7 +581,7 @@
       }
       finally
       {
-         uninstall(bundle1);
+         bundle.uninstall();
       }
    }
 }

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/service/GetUnGetServiceUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/service/GetUnGetServiceUnitTestCase.java	2010-03-10 13:24:47 UTC (rev 102223)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/service/GetUnGetServiceUnitTestCase.java	2010-03-10 13:28:11 UTC (rev 102224)
@@ -21,12 +21,15 @@
 */
 package org.jboss.test.osgi.service;
 
-import junit.framework.Test;
+import static org.junit.Assert.*;
 
-import org.jboss.test.osgi.FrameworkTest;
+import org.jboss.osgi.vfs.VirtualFile;
+import org.jboss.test.osgi.NativeFrameworkTest;
 import org.jboss.test.osgi.service.support.BrokenServiceFactory;
+import org.junit.Test;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
 import org.osgi.framework.FrameworkEvent;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.ServiceRegistration;
@@ -38,23 +41,15 @@
  * @author <a href="ales.justin at jboss.org">Ales Justin</a>
  * @version $Revision: 1.1 $
  */
-public class GetUnGetServiceUnitTestCase extends FrameworkTest
+public class GetUnGetServiceUnitTestCase extends NativeFrameworkTest
 {
    static String OBJCLASS = BundleContext.class.getName();
 
-   public static Test suite()
-   {
-      return suite(GetUnGetServiceUnitTestCase.class);
-   }
-
-   public GetUnGetServiceUnitTestCase(String name)
-   {
-      super(name);
-   }
-
+   @Test
    public void testGetUnServiceErrors() throws Exception
    {
-      Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+      VirtualFile assembly = assembleBundle("simple-bundle1", "/bundles/simple/simple-bundle1", new Class[0]);
+      Bundle bundle = context.installBundle(assembly.toURL().toExternalForm());
       try
       {
          bundle.start();
@@ -68,9 +63,9 @@
             bundleContext.getService(null);
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalArgumentException t)
          {
-            checkThrowable(IllegalArgumentException.class, t);
+            // expected
          }
          
          try
@@ -78,20 +73,22 @@
             bundleContext.ungetService(null);
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalArgumentException t)
          {
-            checkThrowable(IllegalArgumentException.class, t);
+            // expected
          }
       }
       finally
       {
-         uninstall(bundle);
+         bundle.uninstall();
       }
    }
    
+   @Test
    public void testGetService() throws Exception
    {
-      Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+      VirtualFile assembly = assembleBundle("simple-bundle1", "/bundles/simple/simple-bundle1", new Class[0]);
+      Bundle bundle = context.installBundle(assembly.toURL().toExternalForm());
       try
       {
          bundle.start();
@@ -110,13 +107,15 @@
       }
       finally
       {
-         uninstall(bundle);
+         bundle.uninstall();
       }
    }
    
+   @Test
    public void testGetServiceAfterStop() throws Exception
    {
-      Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+      VirtualFile assembly = assembleBundle("simple-bundle1", "/bundles/simple/simple-bundle1", new Class[0]);
+      Bundle bundle = context.installBundle(assembly.toURL().toExternalForm());
       try
       {
          bundle.start();
@@ -135,20 +134,22 @@
             bundleContext.getService(reference);
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalStateException t)
          {
-            checkThrowable(IllegalStateException.class, t);
+            // expected
          }
       }
       finally
       {
-         uninstall(bundle);
+         bundle.uninstall();
       }
    }
    
+   @Test
    public void testErrorInGetService() throws Exception
    {
-      Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+      VirtualFile assembly = assembleBundle("simple-bundle1", "/bundles/simple/simple-bundle1", new Class[0]);
+      Bundle bundle = context.installBundle(assembly.toURL().toExternalForm());
       try
       {
          bundle.start();
@@ -162,17 +163,19 @@
          Object actual = bundleContext.getService(reference);
          assertNull("" + actual, actual);
          
-         assertFrameworkEvent(FrameworkEvent.ERROR, bundle, RuntimeException.class);
+         assertFrameworkEvent(FrameworkEvent.ERROR, bundle, BundleException.class);
       }
       finally
       {
-         uninstall(bundle);
+         bundle.uninstall();
       }
    }
    
+   @Test
    public void testErrorInUnGetService() throws Exception
    {
-      Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+      VirtualFile assembly = assembleBundle("simple-bundle1", "/bundles/simple/simple-bundle1", new Class[0]);
+      Bundle bundle = context.installBundle(assembly.toURL().toExternalForm());
       try
       {
          bundle.start();
@@ -189,21 +192,23 @@
 
          registration.unregister();
          
-         assertFrameworkEvent(FrameworkEvent.WARNING, bundle, RuntimeException.class);
+         assertFrameworkEvent(FrameworkEvent.WARNING, bundle, BundleException.class);
       }
       finally
       {
-         uninstall(bundle);
+         bundle.uninstall();
       }
    }
 
+   @Test
    public void testUnGetServiceResult() throws Exception
    {
-      Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+      VirtualFile assembly1 = assembleBundle("simple-bundle1", "/bundles/simple/simple-bundle1", new Class[0]);
+      Bundle bundle1 = context.installBundle(assembly1.toURL().toExternalForm());
       try
       {
-         bundle.start();
-         BundleContext bundleContext = bundle.getBundleContext();
+         bundle1.start();
+         BundleContext bundleContext = bundle1.getBundleContext();
          assertNotNull(bundleContext);
 
          ServiceRegistration registration = bundleContext.registerService(OBJCLASS, bundleContext, null);
@@ -217,7 +222,8 @@
          assertTrue(bundleContext.ungetService(reference));
          assertFalse(bundleContext.ungetService(reference));
 
-         Bundle bundle2 = addBundle("/bundles/simple/", "simple-bundle2");
+         VirtualFile assembly2 = assembleBundle("simple-bundle2", "/bundles/simple/simple-bundle2", new Class[0]);
+         Bundle bundle2 = context.installBundle(assembly2.toURL().toExternalForm());
          try
          {
             bundle2.start();
@@ -233,12 +239,12 @@
          }
          finally
          {
-            uninstall(bundle2);
+            bundle2.uninstall();
          }
       }
       finally
       {
-         uninstall(bundle);
+         bundle1.uninstall();
       }
    }
 }

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/service/RegisterServiceUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/service/RegisterServiceUnitTestCase.java	2010-03-10 13:24:47 UTC (rev 102223)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/service/RegisterServiceUnitTestCase.java	2010-03-10 13:28:11 UTC (rev 102224)
@@ -21,12 +21,14 @@
 */
 package org.jboss.test.osgi.service;
 
+import static org.junit.Assert.*;
+
 import java.util.Dictionary;
 import java.util.Hashtable;
 
-import junit.framework.Test;
-
-import org.jboss.test.osgi.FrameworkTest;
+import org.jboss.osgi.vfs.VirtualFile;
+import org.jboss.test.osgi.NativeFrameworkTest;
+import org.junit.Test;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
@@ -41,27 +43,19 @@
  * @author <a href="ales.justin at jboss.org">Ales Justin</a>
  * @version $Revision: 1.1 $
  */
-public class RegisterServiceUnitTestCase extends FrameworkTest
+public class RegisterServiceUnitTestCase extends NativeFrameworkTest
 {
    static String OBJCLASS = BundleContext.class.getName();
    static String[] OBJCLASSES = new String[] { OBJCLASS };
 
-   public static Test suite()
-   {
-      return suite(RegisterServiceUnitTestCase.class);
-   }
-
-   public RegisterServiceUnitTestCase(String name)
-   {
-      super(name);
-   }
-
+   @Test
    public void testRegisterServiceErrors() throws Exception
    {
       String OBJCLASS = BundleContext.class.getName();
       String[] OBJCLASSES = new String[] { OBJCLASS };
       
-      Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+      VirtualFile assembly = assembleBundle("simple-bundle1", "/bundles/simple/simple-bundle1", new Class[0]);
+      Bundle bundle = context.installBundle(assembly.toURL().toExternalForm());
       try
       {
          bundle.start();
@@ -73,9 +67,9 @@
             bundleContext.registerService((String) null, new Object(), null);
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalArgumentException t)
          {
-            checkThrowable(IllegalArgumentException.class, t);
+            // expected
          }
          
          try
@@ -83,9 +77,9 @@
             bundleContext.registerService((String[]) null, new Object(), null);
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalArgumentException t)
          {
-            checkThrowable(IllegalArgumentException.class, t);
+            // expected
          }
          
          try
@@ -93,9 +87,9 @@
             bundleContext.registerService(new String[0], new Object(), null);
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalArgumentException t)
          {
-            checkThrowable(IllegalArgumentException.class, t);
+            // expected
          }
          
          try
@@ -103,9 +97,9 @@
             bundleContext.registerService(OBJCLASS, null, null);
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalArgumentException t)
          {
-            checkThrowable(IllegalArgumentException.class, t);
+            // expected
          }
          
          try
@@ -113,9 +107,9 @@
             bundleContext.registerService(OBJCLASSES, null, null);
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalArgumentException t)
          {
-            checkThrowable(IllegalArgumentException.class, t);
+            // expected
          }
          
          try
@@ -123,9 +117,9 @@
             bundleContext.registerService(OBJCLASS, new Object(), null);
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalArgumentException t)
          {
-            checkThrowable(IllegalArgumentException.class, t);
+            // expected
          }
          
          try
@@ -133,9 +127,9 @@
             bundleContext.registerService(OBJCLASSES, new Object(), null);
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalArgumentException t)
          {
-            checkThrowable(IllegalArgumentException.class, t);
+            // expected
          }
 
          Dictionary<String, Object> properties = new Hashtable<String, Object>();
@@ -146,9 +140,9 @@
             bundleContext.registerService(OBJCLASS, bundleContext, properties);
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalArgumentException t)
          {
-            checkThrowable(IllegalArgumentException.class, t);
+            // expected
          }
          
          try
@@ -156,9 +150,9 @@
             bundleContext.registerService(OBJCLASSES, bundleContext, properties);
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalArgumentException t)
          {
-            checkThrowable(IllegalArgumentException.class, t);
+            // expected
          }
          
          bundle.stop();
@@ -168,9 +162,9 @@
             bundleContext.registerService(OBJCLASS, bundleContext, null);
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalStateException t)
          {
-            checkThrowable(IllegalStateException.class, t);
+            // expected
          }
          
          try
@@ -178,23 +172,25 @@
             bundleContext.registerService(OBJCLASSES, bundleContext, null);
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalStateException t)
          {
-            checkThrowable(IllegalStateException.class, t);
+            // expected
          }
       }
       finally
       {
-         uninstall(bundle);
+         bundle.uninstall();
       }
    }
    
+   @Test
    public void testRegisterServiceOBJCLASS() throws Exception
    {
       Dictionary<String, Object> properties = new Hashtable<String, Object>();
       properties.put(Constants.OBJECTCLASS, new String[] { "rubbish" });
 
-      Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+      VirtualFile assembly = assembleBundle("simple-bundle1", "/bundles/simple/simple-bundle1", new Class[0]);
+      Bundle bundle = context.installBundle(assembly.toURL().toExternalForm());
       try
       {
          bundle.start();
@@ -217,13 +213,15 @@
       }
       finally
       {
-         uninstall(bundle);
+         bundle.uninstall();
       }
    }
    
+   @Test
    public void testRegisterService() throws Exception
    {
-      Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+      VirtualFile assembly = assembleBundle("simple-bundle1", "/bundles/simple/simple-bundle1", new Class[0]);
+      Bundle bundle = context.installBundle(assembly.toURL().toExternalForm());
       try
       {
          bundle.start();
@@ -242,13 +240,15 @@
       }
       finally
       {
-         uninstall(bundle);
+         bundle.uninstall();
       }
    }
 
+   @Test
    public void testBundleUninstall() throws Exception
    {
-      Bundle bundle1 = addBundle("/bundles/simple/", "simple-bundle1");
+      VirtualFile assembly1 = assembleBundle("simple-bundle1", "/bundles/simple/simple-bundle1", new Class[0]);
+      Bundle bundle1 = context.installBundle(assembly1.toURL().toExternalForm());
       try
       {
          bundle1.start();
@@ -260,7 +260,8 @@
          Object actual = bundleContext.getService(reference);
          assertEquals(bundleContext, actual);
 
-         Bundle bundle2 = addBundle("/bundles/simple/", "simple-bundle2");
+         VirtualFile assembly2 = assembleBundle("simple-bundle2", "/bundles/simple/simple-bundle2", new Class[0]);
+         Bundle bundle2 = context.installBundle(assembly2.toURL().toExternalForm());
          try
          {
             bundle2.start();
@@ -272,7 +273,7 @@
          }
          finally
          {
-            uninstall(bundle2);
+            bundle2.uninstall();
          }
 
          actual = bundleContext.getService(reference);
@@ -280,13 +281,15 @@
       }
       finally
       {
-         uninstall(bundle1);
+         bundle1.uninstall();
       }
    }
 
+   @Test
    public void testRegisteredServices() throws Exception
    {
-      Bundle bundle1 = addBundle("/bundles/simple/", "simple-bundle1");
+      VirtualFile assembly1 = assembleBundle("simple-bundle1", "/bundles/simple/simple-bundle1", new Class[0]);
+      Bundle bundle1 = context.installBundle(assembly1.toURL().toExternalForm());
       try
       {
          bundle1.start();
@@ -298,7 +301,8 @@
          Object actual = bundleContext.getService(reference);
          assertEquals(bundleContext, actual);
 
-         Bundle bundle2 = addBundle("/bundles/simple/", "simple-bundle2");
+         VirtualFile assembly2 = assembleBundle("simple-bundle2", "/bundles/simple/simple-bundle2", new Class[0]);
+         Bundle bundle2 = context.installBundle(assembly2.toURL().toExternalForm());
          try
          {
             bundle2.start();
@@ -312,11 +316,11 @@
             assertNull(registered);
 
             registered = bundle1.getRegisteredServices();
-            assertEquals(new ServiceReference[]{reference}, registered);
+            assertArrayEquals(new ServiceReference[]{reference}, registered);
          }
          finally
          {
-            uninstall(bundle2);
+            bundle2.uninstall();
          }
 
          actual = bundleContext.getService(reference);
@@ -324,7 +328,22 @@
       }
       finally
       {
-         uninstall(bundle1);
+         bundle1.uninstall();
       }
    }
+
+   protected void assertObjectClass(String expected, ServiceReference reference)
+   {
+      assertObjectClass(new String[] { expected }, reference);
+   }
+
+   protected void assertObjectClass(String[] expected, ServiceReference reference)
+   {
+      Object actual = reference.getProperty(Constants.OBJECTCLASS);
+      if (actual == null)
+         fail("no object class???");
+      if (actual instanceof String[] == false)
+         fail(actual + " is not a string array??? " + actual.getClass().getName());
+      assertArrayEquals(expected, (String[])actual);
+   }
 }

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/service/ServiceFactoryUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/service/ServiceFactoryUnitTestCase.java	2010-03-10 13:24:47 UTC (rev 102223)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/service/ServiceFactoryUnitTestCase.java	2010-03-10 13:28:11 UTC (rev 102224)
@@ -21,11 +21,15 @@
 */
 package org.jboss.test.osgi.service;
 
-import junit.framework.Test;
 
+import static org.junit.Assert.*;
+
 import org.jboss.osgi.framework.bundle.OSGiBundleWrapper;
-import org.jboss.test.osgi.FrameworkTest;
+import org.jboss.osgi.vfs.VirtualFile;
+import org.jboss.test.osgi.NativeFrameworkTest;
 import org.jboss.test.osgi.service.support.SimpleServiceFactory;
+import org.jboss.test.osgi.service.support.a.A;
+import org.junit.Test;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.FrameworkEvent;
@@ -39,24 +43,17 @@
  * @author Thomas.Diesler at jboss.com
  * @version $Revision$
  */
-public class ServiceFactoryUnitTestCase extends FrameworkTest
+public class ServiceFactoryUnitTestCase extends NativeFrameworkTest
 {
    static String OBJCLASS = BundleContext.class.getName();
    static String[] OBJCLASSES = new String[] { OBJCLASS };
 
-   public static Test suite()
-   {
-      return suite(ServiceFactoryUnitTestCase.class);
-   }
 
-   public ServiceFactoryUnitTestCase(String name)
-   {
-      super(name);
-   }
-
+   @Test
    public void testRegisterServiceFactory() throws Exception
    {
-      Bundle bundleA = addBundle("/bundles/simple/", "simple-bundle1");
+      VirtualFile assemblyA = assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class);
+      Bundle bundleA = context.installBundle(assemblyA.toURL().toExternalForm());
       try
       {
          bundleA.start();
@@ -80,7 +77,8 @@
          assertEquals(bundleA.getSymbolicName(), serviceFactory.getBundle.getSymbolicName());
          assertEquals(1, serviceFactory.getCount);
 
-         Bundle bundleB = addBundle("/bundles/simple/", "simple-bundle2");
+         VirtualFile assemblyB = assembleBundle("simple2", "/bundles/simple/simple-bundle2");
+         Bundle bundleB = context.installBundle(assemblyB.toURL().toExternalForm());
          try
          {
             bundleB.start();
@@ -97,12 +95,12 @@
          }
          finally
          {
-            uninstall(bundleB);
+            bundleB.uninstall();
          }
       }
       finally
       {
-         uninstall(bundleA);
+         bundleA.uninstall();
       }
    }
    
@@ -110,7 +108,8 @@
    {
       String OBJCLASS = BundleContext.class.getName();
       
-      Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+      VirtualFile assembly = assembleBundle("simple1", "/bundles/simple/simple-bundle1");
+      Bundle bundle = context.installBundle(assembly.toURL().toExternalForm());
       try
       {
          bundle.start();
@@ -132,7 +131,7 @@
       }
       finally
       {
-         uninstall(bundle);
+         bundle.uninstall();
       }
    }
    
@@ -140,7 +139,8 @@
    {
       String OBJCLASS = BundleContext.class.getName();
       
-      Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+      VirtualFile assembly = assembleBundle("simple1", "/bundles/simple/simple-bundle1");
+      Bundle bundle = context.installBundle(assembly.toURL().toExternalForm());
       try
       {
          bundle.start();
@@ -159,14 +159,14 @@
             bundleContext.getService(reference);
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalStateException t)
          {
-            checkThrowable(IllegalStateException.class, t);
+            // expected
          }
       }
       finally
       {
-         uninstall(bundle);
+         bundle.uninstall();
       }
    }
    
@@ -174,7 +174,8 @@
    {
       String[] OBJCLASSES = {String.class.getName(), BundleContext.class.getName()};
       
-      Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+      VirtualFile assembly = assembleBundle("simple1", "/bundles/simple/simple-bundle1");
+      Bundle bundle = context.installBundle(assembly.toURL().toExternalForm());
       try
       {
          bundle.start();
@@ -199,7 +200,7 @@
       }
       finally
       {
-         uninstall(bundle);
+         bundle.uninstall();
       }
    }
 }

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/service/ServiceReferenceUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/service/ServiceReferenceUnitTestCase.java	2010-03-10 13:24:47 UTC (rev 102223)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/service/ServiceReferenceUnitTestCase.java	2010-03-10 13:28:11 UTC (rev 102224)
@@ -21,6 +21,8 @@
 */
 package org.jboss.test.osgi.service;
 
+import static org.junit.Assert.*;
+
 import java.util.Dictionary;
 import java.util.HashSet;
 import java.util.Hashtable;
@@ -28,10 +30,10 @@
 import java.util.Set;
 import java.util.TreeSet;
 
-import junit.framework.Test;
-
-import org.jboss.test.osgi.FrameworkTest;
+import org.jboss.osgi.vfs.VirtualFile;
+import org.jboss.test.osgi.NativeFrameworkTest;
 import org.jboss.test.osgi.service.support.a.A;
+import org.junit.Test;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
@@ -45,25 +47,17 @@
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @version $Revision: 1.1 $
  */
-public class ServiceReferenceUnitTestCase extends FrameworkTest
+public class ServiceReferenceUnitTestCase extends NativeFrameworkTest
 {
-   public ServiceReferenceUnitTestCase(String name)
-   {
-      super(name);
-   }
-
-   public static Test suite()
-   {
-      return suite(ServiceReferenceUnitTestCase.class);
-   }
-
+   @Test
    public void testGetProperty() throws Exception
    {
       ServiceReference reference = null;
       String[] clazzes = new String[] { BundleContext.class.getName() };
       Object serviceID = null;
 
-      Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+      VirtualFile assembly = assembleBundle("simple1", "/bundles/simple/simple-bundle1");
+      Bundle bundle = context.installBundle(assembly.toURL().toExternalForm());
       try
       {
          bundle.start();
@@ -84,9 +78,9 @@
          assertNotNull(serviceID);
          assertEquals(serviceID, reference.getProperty(Constants.SERVICE_ID.toLowerCase()));
          assertEquals(serviceID, reference.getProperty(Constants.SERVICE_ID.toUpperCase()));
-         assertEquals(clazzes, (String[]) reference.getProperty(Constants.OBJECTCLASS));
-         assertEquals(clazzes, (String[]) reference.getProperty(Constants.OBJECTCLASS.toLowerCase()));
-         assertEquals(clazzes, (String[]) reference.getProperty(Constants.OBJECTCLASS.toUpperCase()));
+         assertArrayEquals(clazzes, (String[]) reference.getProperty(Constants.OBJECTCLASS));
+         assertArrayEquals(clazzes, (String[]) reference.getProperty(Constants.OBJECTCLASS.toLowerCase()));
+         assertArrayEquals(clazzes, (String[]) reference.getProperty(Constants.OBJECTCLASS.toUpperCase()));
          assertEquals("a", reference.getProperty("testA"));
          assertEquals("b", reference.getProperty("testB"));
          assertEquals("Case", reference.getProperty("MiXeD"));
@@ -143,7 +137,7 @@
       }
       finally
       {
-         uninstall(bundle);
+         bundle.uninstall();
       }
       
       assertEquals(serviceID, reference.getProperty(Constants.SERVICE_ID));
@@ -156,11 +150,13 @@
       assertNull(reference.getProperty(null));
    }
    
+   @Test
    public void testGetPropertyKeys() throws Exception
    {
       ServiceReference reference = null;
       
-      Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+      VirtualFile assembly = assembleBundle("simple1", "/bundles/simple/simple-bundle1");
+      Bundle bundle = context.installBundle(assembly.toURL().toExternalForm());
       try
       {
          bundle.start();
@@ -196,12 +192,12 @@
       }
       finally
       {
-         uninstall(bundle);
+         bundle.uninstall();
       }
       assertPropertyKeys(reference, "testA", "testB", "testC", "MiXeD");
    }
 
-   protected void assertPropertyKeys(ServiceReference reference, String... expectedKeys)
+   private void assertPropertyKeys(ServiceReference reference, String... expectedKeys)
    {
       Set<String> expected = new HashSet<String>();
       expected.add(Constants.SERVICE_ID);
@@ -216,9 +212,11 @@
       assertEquals(expected, actual);
    }
    
+   @Test
    public void testGetBundle() throws Exception
    {
-      Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+      VirtualFile assembly = assembleBundle("simple1", "/bundles/simple/simple-bundle1");
+      Bundle bundle = context.installBundle(assembly.toURL().toExternalForm());
       try
       {
          bundle.start();
@@ -241,13 +239,15 @@
       }
       finally
       {
-         uninstall(bundle);
+         bundle.uninstall();
       }
    }
    
+   @Test
    public void testGetBundleAfterStop() throws Exception
    {
-      Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+      VirtualFile assembly = assembleBundle("simple1", "/bundles/simple/simple-bundle1");
+      Bundle bundle = context.installBundle(assembly.toURL().toExternalForm());
       try
       {
          bundle.start();
@@ -270,17 +270,19 @@
       }
       finally
       {
-         uninstall(bundle);
+         bundle.uninstall();
       }
    }
    
+   @Test
    public void testUsingBundles() throws Exception
    {
-      Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+      VirtualFile assembly1 = assembleBundle("simple1", "/bundles/simple/simple-bundle1");
+      Bundle bundle1 = context.installBundle(assembly1.toURL().toExternalForm());
       try
       {
-         bundle.start();
-         BundleContext bundleContext = bundle.getBundleContext();
+         bundle1.start();
+         BundleContext bundleContext = bundle1.getBundleContext();
          assertNotNull(bundleContext);
 
          ServiceRegistration registration = bundleContext.registerService(BundleContext.class.getName(), bundleContext, null);
@@ -291,7 +293,8 @@
          
          assertUsingBundles(reference);
          
-         Bundle bundle2 = addBundle("/bundles/simple/", "simple-bundle2");
+         VirtualFile assembly2 = assembleBundle("simple2", "/bundles/simple/simple-bundle2");
+         Bundle bundle2 = context.installBundle(assembly2.toURL().toExternalForm());
          try
          {
             bundle2.start();
@@ -314,29 +317,31 @@
 
             bundleContext.getService(reference);
             bundleContext2.getService(reference);
-            assertUsingBundles(reference, bundle, bundle2);
+            assertUsingBundles(reference, bundle1, bundle2);
             
             registration.unregister();
             assertUsingBundles(reference);
          }
          finally
          {
-            uninstall(bundle2);
+            bundle2.uninstall();
          }
       }
       finally
       {
-         uninstall(bundle);
+         bundle1.uninstall();
       }
    }
    
+   @Test
    public void testUsingBundlesAfterStop() throws Exception
    {
-      Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+      VirtualFile assembly1 = assembleBundle("simple1", "/bundles/simple/simple-bundle1");
+      Bundle bundle1 = context.installBundle(assembly1.toURL().toExternalForm());
       try
       {
-         bundle.start();
-         BundleContext bundleContext = bundle.getBundleContext();
+         bundle1.start();
+         BundleContext bundleContext = bundle1.getBundleContext();
          assertNotNull(bundleContext);
 
          ServiceRegistration registration = bundleContext.registerService(BundleContext.class.getName(), bundleContext, null);
@@ -347,7 +352,8 @@
          
          assertUsingBundles(reference);
          
-         Bundle bundle2 = addBundle("/bundles/simple/", "simple-bundle2");
+         VirtualFile assembly2 = assembleBundle("simple2", "/bundles/simple/simple-bundle2");
+         Bundle bundle2 = context.installBundle(assembly2.toURL().toExternalForm());
          try
          {
             bundle2.start();
@@ -356,25 +362,27 @@
 
             bundleContext.getService(reference);
             bundleContext2.getService(reference);
-            assertUsingBundles(reference, bundle, bundle2);
+            assertUsingBundles(reference, bundle1, bundle2);
             
-            bundle.stop();
+            bundle1.stop();
             assertUsingBundles(reference);
          }
          finally
          {
-            uninstall(bundle2);
+            bundle2.uninstall();
          }
       }
       finally
       {
-         uninstall(bundle);
+         bundle1.uninstall();
       }
    }
    
+   @Test
    public void testIsAssignableToErrors() throws Exception
    {
-      Bundle bundle = installBundle(assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class));
+      VirtualFile assembly = assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class);
+      Bundle bundle = context.installBundle(assembly.toURL().toExternalForm());
       try
       {
          bundle.start();
@@ -392,9 +400,9 @@
             reference.isAssignableTo(null, A.class.getName());
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalArgumentException t)
          {
-            checkThrowable(IllegalArgumentException.class, t);
+            // expected
          }
          
          try
@@ -402,24 +410,26 @@
             reference.isAssignableTo(bundle, null);
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalArgumentException t)
          {
-            checkThrowable(IllegalArgumentException.class, t);
+            // expected
          }
       }
       finally
       {
-         uninstall(bundle);
+         bundle.uninstall();
       }
    }   
 
+   @Test
    public void testNotAssignableTo() throws Exception
    {
-      Bundle bundle = installBundle(assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class));
+      VirtualFile assembly1 = assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class);
+      Bundle bundle1 = context.installBundle(assembly1.toURL().toExternalForm());
       try
       {
-         bundle.start();
-         BundleContext bundleContext = bundle.getBundleContext();
+         bundle1.start();
+         BundleContext bundleContext = bundle1.getBundleContext();
          assertNotNull(bundleContext);
 
          ServiceRegistration registration = bundleContext.registerService(BundleContext.class.getName(), bundleContext, null);
@@ -428,7 +438,8 @@
          ServiceReference reference = registration.getReference();
          assertNotNull(reference);
 
-         Bundle bundle2 = installBundle(assembleBundle("simple2", "/bundles/simple/simple-bundle2", A.class));
+         VirtualFile assembly2 = assembleBundle("simple2", "/bundles/simple/simple-bundle2", A.class);
+         Bundle bundle2 = context.installBundle(assembly2.toURL().toExternalForm());
          try
          {
             assertFalse(reference.isAssignableTo(bundle2, A.class.getName()));
@@ -440,21 +451,23 @@
          }
          finally
          {
-            uninstall(bundle2);
+            bundle2.uninstall();
          }
       }
       finally
       {
-         uninstall(bundle);
+         bundle1.uninstall();
       }
    }
    
+   @Test
    public void testIsAssignableTo() throws Exception
    {
       //Bundle-Name: Service2
       //Bundle-SymbolicName: org.jboss.test.osgi.service2
       //Export-Package: org.jboss.test.osgi.service.support.a
-      Bundle bundle2 = installBundle(assembleBundle("service2", "/bundles/service/service-bundle2", A.class));
+      VirtualFile assembly2 = assembleBundle("service2", "/bundles/service/service-bundle2", A.class);
+      Bundle bundle2 = context.installBundle(assembly2.toURL().toExternalForm());
       
       try
       {
@@ -465,7 +478,8 @@
          //Bundle-Name: Service1
          //Bundle-SymbolicName: org.jboss.test.osgi.service1
          //Import-Package: org.jboss.test.osgi.service.support.a
-         Bundle bundle1 = installBundle(assembleBundle("service1", "/bundles/service/service-bundle1"));
+         VirtualFile assembly1 = assembleBundle("service1", "/bundles/service/service-bundle1");
+         Bundle bundle1 = context.installBundle(assembly1.toURL().toExternalForm());
          
          try
          {
@@ -489,18 +503,20 @@
          }
          finally
          {
-            uninstall(bundle1);
+            bundle1.uninstall();
          }
       }
       finally
       {
-         uninstall(bundle2);
+         bundle2.uninstall();
       }
    }
    
+   @Test
    public void testCompareTo() throws Exception
    {
-      Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+      VirtualFile assembly = assembleBundle("simple1", "/bundles/simple/simple-bundle1");
+      Bundle bundle = context.installBundle(assembly.toURL().toExternalForm());
       try
       {
          bundle.start();
@@ -547,9 +563,9 @@
             reference1.compareTo(null);
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalArgumentException t)
          {
-            checkThrowable(IllegalArgumentException.class, t);
+            // expected
          }
          
          try
@@ -557,9 +573,9 @@
             reference1.compareTo(new Object());
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalArgumentException t)
          {
-            checkThrowable(IllegalArgumentException.class, t);
+            // expected
          }
 
          properties = new Hashtable<String, Object>();
@@ -600,7 +616,7 @@
       }
       finally
       {
-         uninstall(bundle);
+         bundle.uninstall();
       }
    }
    

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/service/ServiceRegistrationUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/service/ServiceRegistrationUnitTestCase.java	2010-03-10 13:24:47 UTC (rev 102223)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/service/ServiceRegistrationUnitTestCase.java	2010-03-10 13:28:11 UTC (rev 102224)
@@ -21,12 +21,19 @@
 */
 package org.jboss.test.osgi.service;
 
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
 import java.util.Hashtable;
 
-import junit.framework.Test;
-
-import org.jboss.test.osgi.FrameworkTest;
+import org.jboss.osgi.vfs.VirtualFile;
+import org.jboss.test.osgi.NativeFrameworkTest;
 import org.jboss.test.osgi.service.support.SimpleServiceFactory;
+import org.junit.Test;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
@@ -40,21 +47,14 @@
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @version $Revision: 1.1 $
  */
-public class ServiceRegistrationUnitTestCase extends FrameworkTest
+public class ServiceRegistrationUnitTestCase extends NativeFrameworkTest
 {
-   public ServiceRegistrationUnitTestCase(String name)
-   {
-      super(name);
-   }
 
-   public static Test suite()
-   {
-      return suite(ServiceRegistrationUnitTestCase.class);
-   }
-
+   @Test
    public void testGetReference() throws Exception
    {
-      Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+      VirtualFile assembly = assembleBundle("simple1", "/bundles/simple/simple-bundle1");
+      Bundle bundle = context.installBundle(assembly.toURL().toExternalForm());
       try
       {
          bundle.start();
@@ -82,9 +82,9 @@
             registration.getReference();
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalStateException t)
          {
-            checkThrowable(IllegalStateException.class, t);
+            // expected
          }
 
          ServiceRegistration registration2 = bundleContext.registerService(BundleContext.class.getName(), bundleContext, null);
@@ -101,20 +101,22 @@
             registration2.getReference();
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalStateException t)
          {
-            checkThrowable(IllegalStateException.class, t);
+            // expected
          }
       }
       finally
       {
-         uninstall(bundle);
+         bundle.uninstall();
       }
    }
    
+   @Test
    public void testSetProperties() throws Exception
    {
-      Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+      VirtualFile assembly = assembleBundle("simple1", "/bundles/simple/simple-bundle1");
+      Bundle bundle = context.installBundle(assembly.toURL().toExternalForm());
       try
       {
          bundle.start();
@@ -193,9 +195,9 @@
             registration.setProperties(properties);
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalArgumentException t)
          {
-            checkThrowable(IllegalArgumentException.class, t);
+            // expected
          }
          assertNoServiceEvent();
          
@@ -207,21 +209,23 @@
             registration.setProperties(new Hashtable<String, Object>());
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalStateException t)
          {
-            checkThrowable(IllegalStateException.class, t);
+            // expected
          }
          assertNoServiceEvent();
       }
       finally
       {
-         uninstall(bundle);
+         bundle.uninstall();
       }
    }
    
+   @Test
    public void testSetPropertiesAfterStop() throws Exception
    {
-      Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+      VirtualFile assembly = assembleBundle("simple1", "/bundles/simple/simple-bundle1");
+      Bundle bundle = context.installBundle(assembly.toURL().toExternalForm());
       try
       {
          bundle.start();
@@ -238,25 +242,27 @@
             registration.setProperties(new Hashtable<String, Object>());
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalStateException t)
          {
-            checkThrowable(IllegalStateException.class, t);
+            // expected
          }
          assertNoServiceEvent();
       }
       finally
       {
-         uninstall(bundle);
+         bundle.uninstall();
       }
    }
    
+   @Test
    public void testUnregister() throws Exception
    {
-      Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+      VirtualFile assembly1 = assembleBundle("simple1", "/bundles/simple/simple-bundle1");
+      Bundle bundle1 = context.installBundle(assembly1.toURL().toExternalForm());
       try
       {
-         bundle.start();
-         BundleContext bundleContext = bundle.getBundleContext();
+         bundle1.start();
+         BundleContext bundleContext = bundle1.getBundleContext();
          assertNotNull(bundleContext);
 
          SimpleServiceFactory factory = new SimpleServiceFactory(bundleContext);
@@ -269,14 +275,15 @@
          ServiceReference reference2 = bundleContext.getServiceReference(BundleContext.class.getName());
          assertEquals(reference, reference2);
 
-         ServiceReference[] inUse = bundle.getServicesInUse();
+         ServiceReference[] inUse = bundle1.getServicesInUse();
          assertNull(inUse);
          
          bundleContext.getService(reference);
-         inUse = bundle.getServicesInUse();
-         assertEquals(new ServiceReference[] { reference }, inUse);
+         inUse = bundle1.getServicesInUse();
+         assertArrayEquals(new ServiceReference[] { reference }, inUse);
 
-         Bundle bundle2 = addBundle("/bundles/simple/", "simple-bundle2");
+         VirtualFile assembly2 = assembleBundle("simple2", "/bundles/simple/simple-bundle2");
+         Bundle bundle2 = context.installBundle(assembly2.toURL().toExternalForm());
          try
          {
             bundle2.start();
@@ -284,7 +291,7 @@
             assertNotNull(bundleContext2);
             bundleContext2.getService(reference);
             inUse = bundle2.getServicesInUse();
-            assertEquals(new ServiceReference[] { reference }, inUse);
+            assertArrayEquals(new ServiceReference[] { reference }, inUse);
 
             assertNull(factory.ungetBundle);
             assertNull(factory.ungetRegistration);
@@ -301,7 +308,7 @@
             
             assertServiceEvent(ServiceEvent.UNREGISTERING, reference);
 
-            inUse = bundle.getServicesInUse();
+            inUse = bundle1.getServicesInUse();
             assertNull(inUse);
             inUse = bundle2.getServicesInUse();
             assertNull(inUse);
@@ -311,7 +318,7 @@
          }
          finally
          {
-            uninstall(bundle2);
+            bundle2.uninstall();
          }
          
          try
@@ -319,20 +326,22 @@
             registration.unregister();
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalStateException t)
          {
-            checkThrowable(IllegalStateException.class, t);
+            // expected
          }
       }
       finally
       {
-         uninstall(bundle);
+         bundle1.uninstall();
       }
    }
    
+   @Test
    public void testUnregisterAfterStop() throws Exception
    {
-      Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+      VirtualFile assembly = assembleBundle("simple1", "/bundles/simple/simple-bundle1");
+      Bundle bundle = context.installBundle(assembly.toURL().toExternalForm());
       try
       {
          bundle.start();
@@ -349,14 +358,14 @@
             registration.unregister();
             fail("Should not be here!");
          }
-         catch (Throwable t)
+         catch (IllegalStateException t)
          {
-            checkThrowable(IllegalStateException.class, t);
+            // expected
          }
       }
       finally
       {
-         uninstall(bundle);
+         bundle.uninstall();
       }
    }
 }

Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/smoke/OSGiSmokeTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/smoke/OSGiSmokeTestCase.java	2010-03-10 13:24:47 UTC (rev 102223)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/smoke/OSGiSmokeTestCase.java	2010-03-10 13:28:11 UTC (rev 102224)
@@ -1,193 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file 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.smoke;
-
-import java.io.InputStream;
-import java.net.URL;
-import java.util.jar.Attributes;
-import java.util.jar.Manifest;
-
-import junit.framework.Test;
-
-import org.jboss.osgi.framework.metadata.OSGiMetaData;
-import org.jboss.osgi.framework.metadata.internal.AbstractOSGiMetaData;
-import org.jboss.test.osgi.FrameworkTest;
-import org.jboss.test.osgi.smoke.support.a.A;
-import org.jboss.test.osgi.smoke.support.a.b.B;
-import org.jboss.test.osgi.smoke.support.c.C;
-import org.osgi.framework.Bundle;
-
-/**
- * OSGiSmokeTestCase.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class OSGiSmokeTestCase extends FrameworkTest
-{
-   public static Test suite()
-   {
-      return suite(OSGiSmokeTestCase.class);
-   }
-
-   public OSGiSmokeTestCase(String name)
-   {
-      super(name);
-   }
-
-   public void testNoManifest() throws Exception
-   {
-      System.out.println("FIXME [JBOSGI-203] Define non OSGi bundle handling by the Framework");
-      // testBundle("smoke-no-manifest", Bundle.ACTIVE);
-   }
-
-   public void testNonOSGiManifest() throws Exception
-   {
-      System.out.println("FIXME [JBOSGI-203] Define non OSGi bundle handling by the Framework");
-      // testBundle("smoke-non-osgi-manifest", Bundle.ACTIVE);
-   }
-
-   public void testOSGiManifest() throws Exception
-   {
-      testBundle("smoke-osgi-manifest", Bundle.INSTALLED);
-   }
-
-   public void testAssembled() throws Exception
-   {
-      Bundle bundle = installBundle(assembleBundle("smoke-assembled", "/bundles/smoke/smoke-assembled", A.class));
-      try
-      {
-         testBundle(bundle, "smoke-assembled", Bundle.INSTALLED);
-         bundle.start();
-         assertLoadClass(bundle, A.class);
-         assertLoadClassFail(bundle, B.class);
-         assertLoadClassFail(bundle, C.class);
-      }
-      finally
-      {
-         bundle.uninstall();
-      }
-   }
-
-   public void testDeployedNoManifest() throws Exception
-   {
-      System.out.println("FIXME [JBOSGI-203] Define non OSGi bundle handling by the Framework");
-      // testDeployedBundle("smoke-no-manifest", Bundle.ACTIVE);
-   }
-
-   public void testDeployedNonOSGiManifest() throws Exception
-   {
-      System.out.println("FIXME [JBOSGI-203] Define non OSGi bundle handling by the Framework");
-      // testDeployedBundle("smoke-non-osgi-manifest", Bundle.ACTIVE);
-   }
-
-   public void testDeployedOSGiManifest() throws Exception
-   {
-      testDeployedBundle("smoke-osgi-manifest", Bundle.INSTALLED);
-   }
-
-   public void testAssembledDeployment() throws Exception
-   {
-      Manifest manifest = new Manifest();
-      Attributes attributes = manifest.getMainAttributes();
-      attributes.putValue("Bundle-SymbolicName", "org.jboss.test.osgi.smoke.deployment");
-      OSGiMetaData metaData = new AbstractOSGiMetaData(manifest);
-      Bundle bundle = deployBundle("smoke-deployment", metaData, A.class);
-      try
-      {
-         assertEquals(Bundle.INSTALLED, bundle.getState());
-         bundle.start();
-         assertLoadClass(bundle, A.class);
-         assertLoadClassFail(bundle, B.class);
-         assertLoadClassFail(bundle, C.class);
-      }
-      finally
-      {
-         bundle.uninstall();
-      }
-   }
-
-   public void testAssembledNonOSGiDeployment() throws Exception
-   {
-      System.out.println("FIXME [JBOSGI-203] Define non OSGi bundle handling by the Framework");
-      /*
-      Bundle bundle = deployBundle("smoke-non-osgi-deployment", A.class);
-      try
-      {
-         assertEquals(Bundle.ACTIVE, bundle.getState());
-         assertLoadClass(bundle, A.class);
-         assertLoadClassFail(bundle, B.class);
-         assertLoadClassFail(bundle, C.class);
-      }
-      finally
-      {
-         bundle.uninstall();
-      }
-      */
-   }
-
-   protected void testBundle(String name, int expectedState) throws Exception
-   {
-      Bundle bundle = addBundle("/bundles/smoke/", name);
-      try
-      {
-         testBundle(bundle, name, expectedState);
-      }
-      finally
-      {
-         bundle.uninstall();
-      }
-   }
-
-   protected void testDeployedBundle(String name, int expectedState) throws Exception
-   {
-      Bundle bundle = deployBundle("/bundles/smoke/", name);
-      try
-      {
-         testBundle(bundle, name, expectedState);
-      }
-      finally
-      {
-         bundle.uninstall();
-      }
-   }
-
-   protected void testBundle(Bundle bundle, String name, int expectedState) throws Exception
-   {
-      assertEquals(expectedState, bundle.getState());
-      checkId(bundle, name);
-      bundle.start();
-      bundle.stop();
-   }
-
-   protected void checkId(Bundle bundle, String name) throws Exception
-   {
-      URL url = bundle.getEntry("id");
-      if (url == null)
-         fail("id entry not found for " + bundle);
-      InputStream is = url.openStream();
-      byte[] bytes = new byte[100];
-      is.read(bytes);
-      String value = new String(bytes);
-      assertTrue("Expected=" + name + " was " + value, value.startsWith(name));
-   }
-}

Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/smoke/support/a/A.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/smoke/support/a/A.java	2010-03-10 13:24:47 UTC (rev 102223)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/smoke/support/a/A.java	2010-03-10 13:28:11 UTC (rev 102224)
@@ -1,32 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file 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.smoke.support.a;
-
-/**
- * A.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class A
-{
-}

Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/OSGi142TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/OSGi142TestCase.java	2010-03-10 13:24:47 UTC (rev 102223)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/OSGi142TestCase.java	2010-03-10 13:28:11 UTC (rev 102224)
@@ -64,26 +64,26 @@
          Bundle bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi142-bundleX.jar").toExternalForm());
          bundleX.start();
          
-         assertBundleLoadClass(bundleX, BeanX.class.getName(), true);
+         assertLoadClass(bundleX, BeanX.class.getName());
          
          Bundle bundleA = sysContext.installBundle(getTestArchiveURL("jbosgi142-bundleA.jar").toExternalForm());
          bundleA.start();
          
-         assertBundleLoadClass(bundleA, BeanA.class.getName(), true);
+         assertLoadClass(bundleA, BeanA.class.getName());
          
          Bundle bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi142-bundleB.jar").toExternalForm());
          bundleB.start();
          
-         assertBundleLoadClass(bundleB, BeanB.class.getName(), true);
+         assertLoadClass(bundleB, BeanB.class.getName());
          
-         assertBundleLoadClass(bundleA, BeanX.class.getName(), true);
-         assertBundleLoadClass(bundleB, BeanX.class.getName(), true);
+         assertLoadClass(bundleA, BeanX.class.getName());
+         assertLoadClass(bundleB, BeanX.class.getName());
     
-         assertBundleLoadClass(bundleX, BeanA.class.getName(), false);
-         assertBundleLoadClass(bundleX, BeanB.class.getName(), false);
+         assertLoadClassFail(bundleX, BeanA.class.getName());
+         assertLoadClassFail(bundleX, BeanB.class.getName());
          
-         assertBundleLoadClass(bundleA, BeanB.class.getName(), false);
-         assertBundleLoadClass(bundleB, BeanA.class.getName(), false);
+         assertLoadClassFail(bundleA, BeanB.class.getName());
+         assertLoadClassFail(bundleB, BeanA.class.getName());
       }
       finally
       {



More information about the jboss-osgi-commits mailing list