[jboss-osgi-commits] JBoss-OSGI SVN: r89389 - in projects/jboss-osgi/trunk/testsuite: example/src/test/java/org/jboss/test/osgi/example/http and 10 other directories.

jboss-osgi-commits at lists.jboss.org jboss-osgi-commits at lists.jboss.org
Mon May 25 15:45:19 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-05-25 15:45:19 -0400 (Mon, 25 May 2009)
New Revision: 89389

Modified:
   projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java
   projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/JMXTestCase.java
   projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/JNDITestCase.java
   projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java
   projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java
   projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/BootstrapTestCase.java
   projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/BundleTestCase.java
   projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java
   projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java
   projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java
   projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGI36TestCase.java
   projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/startlevel/StartLevelTestCase.java
   projects/jboss-osgi/trunk/testsuite/pom.xml
Log:
Migrate to JUnit4

Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java	2009-05-25 19:42:57 UTC (rev 89388)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java	2009-05-25 19:45:19 UTC (rev 89389)
@@ -23,6 +23,8 @@
 
 //$Id: HttpServiceRemoteTestCase.java 87330 2009-04-15 10:57:57Z thomas.diesler at jboss.com $
 
+import static org.junit.Assert.assertEquals;
+
 import java.io.BufferedReader;
 import java.io.InputStreamReader;
 import java.net.URL;
@@ -32,13 +34,13 @@
 import org.jboss.osgi.spi.testing.HttpCapability;
 import org.jboss.osgi.spi.testing.OSGiRuntime;
 import org.jboss.osgi.spi.testing.OSGiTest;
-import org.jboss.osgi.spi.testing.OSGiTestSetup;
+import org.jboss.osgi.spi.testing.OSGiTestHelper;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
 
-import junit.framework.Test;
-
 /**
- * A test that deployes a bundle that containes a HttpServlet which 
- * is registered through the OSGi HttpService
+ * A test that deployes a bundle that containes a HttpServlet which is registered through the OSGi HttpService
  * 
  * @author thomas.diesler at jboss.com
  * @since 23-Jan-2009
@@ -47,36 +49,28 @@
 {
    private static OSGiRuntime runtime;
    private static AbstractBundle testBundle;
-   
-   public static Test suite()
+
+   @BeforeClass
+   public static void setUpClass() throws Exception
    {
-      OSGiTestSetup testSetup = new OSGiTestSetup(HttpServiceTestCase.class)
-      {
-         @Override
-         protected void setUp() throws Exception
-         {
-            super.setUp();
-            runtime = getDefaultRuntime();
-            runtime.addCapability(new ConfigAdminCapability());
-            runtime.addCapability(new HttpCapability());
-            
-            Thread.sleep(2000);
-            
-            testBundle = runtime.installBundle("example-http.jar");
-            testBundle.start();
-         }
+      runtime = new OSGiTestHelper().getDefaultRuntime();
+      runtime.addCapability(new ConfigAdminCapability());
+      runtime.addCapability(new HttpCapability());
 
-         @Override
-         protected void tearDown() throws Exception
-         {
-            testBundle.uninstall();
-            runtime.shutdown();
-            super.tearDown();
-         }
-      };
-      return testSetup;
+      Thread.sleep(2000);
+
+      testBundle = runtime.installBundle("example-http.jar");
+      testBundle.start();
    }
 
+   @AfterClass
+   public static void tearDownClass() throws Exception
+   {
+      testBundle.uninstall();
+      runtime.shutdown();
+   }
+
+   @Test
    public void testServletAccess() throws Exception
    {
       URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=plain");
@@ -84,6 +78,7 @@
       assertEquals("Hello from Servlet", br.readLine());
    }
 
+   @Test
    public void testServletInitProps() throws Exception
    {
       URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=initProp");
@@ -91,6 +86,7 @@
       assertEquals("initProp=SomeValue", br.readLine());
    }
 
+   @Test
    public void testServletBundleContext() throws Exception
    {
       URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=context");
@@ -98,6 +94,7 @@
       assertEquals("example-http", br.readLine());
    }
 
+   @Test
    public void testServletStartLevel() throws Exception
    {
       URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=startLevel");
@@ -105,6 +102,7 @@
       assertEquals("startLevel=1", br.readLine());
    }
 
+   @Test
    public void testResourceAccess() throws Exception
    {
       URL url = new URL("http://" + runtime.getServerHost() + ":8090/file/message.txt");

Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/JMXTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/JMXTestCase.java	2009-05-25 19:42:57 UTC (rev 89388)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/JMXTestCase.java	2009-05-25 19:45:19 UTC (rev 89389)
@@ -21,22 +21,25 @@
  */
 package org.jboss.test.osgi.example.jmx;
 
-//$Id: JMXTestCase.java 88356 2009-05-07 13:13:26Z thomas.diesler at jboss.com $
+//$Id$
 
+import static org.junit.Assert.assertEquals;
+
 import javax.management.MBeanServerConnection;
 import javax.management.ObjectName;
 import javax.naming.InitialContext;
 
-import junit.framework.Test;
-
 import org.jboss.osgi.spi.management.MBeanProxy;
 import org.jboss.osgi.spi.testing.AbstractBundle;
-import org.jboss.osgi.spi.testing.OSGiRuntime;
 import org.jboss.osgi.spi.testing.JMXCapability;
 import org.jboss.osgi.spi.testing.JNDICapability;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
 import org.jboss.osgi.spi.testing.OSGiTest;
-import org.jboss.osgi.spi.testing.OSGiTestSetup;
+import org.jboss.osgi.spi.testing.OSGiTestHelper;
 import org.jboss.test.osgi.example.jmx.bundle.FooMBean;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
 
 /**
  * A test that deployes a bundle that registeres an MBean
@@ -49,33 +52,25 @@
    private static OSGiRuntime runtime;
    private static AbstractBundle bundle;
 
-   public static Test suite()
+   @BeforeClass
+   public static void setUpClass() throws Exception
    {
-      OSGiTestSetup setup = new OSGiTestSetup(JMXTestCase.class)
-      {
-         @Override
-         protected void setUp() throws Exception
-         {
-            super.setUp();
-            runtime = getDefaultRuntime();
-            runtime.addCapability(new JNDICapability());
-            runtime.addCapability(new JMXCapability());
+      runtime = new OSGiTestHelper().getDefaultRuntime();
+      runtime.addCapability(new JNDICapability());
+      runtime.addCapability(new JMXCapability());
 
-            bundle = runtime.installBundle("example-jmx.jar");
-            bundle.start();
-         }
+      bundle = runtime.installBundle("example-jmx.jar");
+      bundle.start();
+   }
 
-         @Override
-         protected void tearDown() throws Exception
-         {
-            bundle.uninstall();
-            runtime.shutdown();
-            super.tearDown();
-         }
-      };
-      return setup;
+   @AfterClass
+   public static void tearDownClass() throws Exception
+   {
+      bundle.uninstall();
+      runtime.shutdown();
    }
 
+   @Test
    public void testMBeanAccess() throws Exception
    {
       ObjectName oname = new ObjectName("jboss.osgi:service=mbean-test-service");
@@ -83,6 +78,7 @@
       assertEquals("hello", foo.echo("hello"));
    }
 
+   @Test
    public void testRMIAdaptor() throws Exception
    {
       // Lookup the MBeanServerConnection

Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/JNDITestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/JNDITestCase.java	2009-05-25 19:42:57 UTC (rev 89388)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/JNDITestCase.java	2009-05-25 19:45:19 UTC (rev 89389)
@@ -23,16 +23,20 @@
 
 //$Id: JNDITestCase.java 88356 2009-05-07 13:13:26Z thomas.diesler at jboss.com $
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
 import javax.naming.InitialContext;
 import javax.naming.NameNotFoundException;
 
-import junit.framework.Test;
-
 import org.jboss.osgi.spi.testing.AbstractBundle;
-import org.jboss.osgi.spi.testing.OSGiRuntime;
 import org.jboss.osgi.spi.testing.JNDICapability;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
 import org.jboss.osgi.spi.testing.OSGiTest;
-import org.jboss.osgi.spi.testing.OSGiTestSetup;
+import org.jboss.osgi.spi.testing.OSGiTestHelper;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
 import org.osgi.framework.Bundle;
 
 /**
@@ -45,33 +49,25 @@
 {
    private static OSGiRuntime runtime;
 
-   public static Test suite()
+   @BeforeClass
+   public static void setUpClass() throws Exception
    {
-      OSGiTestSetup setup = new OSGiTestSetup(JNDITestCase.class)
-      {
-         @Override
-         protected void setUp() throws Exception
-         {
-            super.setUp();
-            runtime = getDefaultRuntime();
-            runtime.addCapability(new JNDICapability());
-         }
+      runtime = new OSGiTestHelper().getDefaultRuntime();
+      runtime.addCapability(new JNDICapability());
+   }
 
-         @Override
-         protected void tearDown() throws Exception
-         {
-            runtime.shutdown();
-            super.tearDown();
-         }
-      };
-      return setup;
+   @AfterClass
+   public static void tearDownClass() throws Exception
+   {
+      runtime.shutdown();
    }
 
+   @Test
    public void testJNDIAccess() throws Exception
    {
       AbstractBundle bundle = runtime.installBundle("example-jndi.jar");
       bundle.start();
-      
+
       assertEquals("Test bundle ACTIVE", Bundle.ACTIVE, bundle.getState());
 
       InitialContext iniCtx = runtime.getInitialContext();

Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java	2009-05-25 19:42:57 UTC (rev 89388)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java	2009-05-25 19:45:19 UTC (rev 89389)
@@ -23,6 +23,8 @@
 
 //$Id: LogServiceTestCase.java 87330 2009-04-15 10:57:57Z thomas.diesler at jboss.com $
 
+import static org.junit.Assert.assertEquals;
+
 import java.util.List;
 
 import org.jboss.osgi.spi.logging.LogEntryCache;
@@ -30,6 +32,10 @@
 import org.jboss.osgi.spi.testing.AbstractBundle;
 import org.jboss.osgi.spi.testing.OSGiRuntime;
 import org.jboss.osgi.spi.testing.OSGiTest;
+import org.jboss.osgi.spi.testing.OSGiTestHelper;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
 import org.osgi.framework.Bundle;
 import org.osgi.service.log.LogEntry;
 import org.osgi.service.log.LogService;
@@ -42,27 +48,26 @@
  */
 public class LogServiceTestCase extends OSGiTest
 {
-   private LogEntryCache logEntryCache;
-   private OSGiRuntime runtime;
+   private static LogEntryCache logEntryCache;
+   private static OSGiRuntime runtime;
 
-   @Override
-   protected void setUp() throws Exception
+   @BeforeClass
+   public static void setUpClass() throws Exception
    {
-      super.setUp();
-
-      runtime = getDefaultRuntime();
+      runtime = new OSGiTestHelper().getDefaultRuntime();
       logEntryCache = new LogEntryCache(new LogEntryFilter("example-log(.*)", LogService.LOG_INFO, "\\[ServiceA\\](.*)"));
       runtime.startLogEntryTracking(logEntryCache);
    }
 
 
-   @Override
-   protected void tearDown() throws Exception
+   @AfterClass
+   public static void tearDownClass() throws Exception
    {
+      logEntryCache.clear();
       runtime.shutdown();
-      super.tearDown();
    }
 
+   @Test
    public void testLogEntryFilter() throws Exception
    {
       // Install and start the test bundle

Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java	2009-05-25 19:42:57 UTC (rev 89388)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java	2009-05-25 19:45:19 UTC (rev 89389)
@@ -28,14 +28,14 @@
 import static org.jboss.osgi.microcontainer.MicrocontainerService.BEAN_SYSTEM_BUNDLE_CONTEXT;
 import static org.jboss.osgi.microcontainer.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
 import static org.jboss.osgi.spi.management.ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 import java.util.List;
 import java.util.Set;
 
 import javax.management.ObjectName;
 
-import junit.framework.Test;
-
 import org.jboss.osgi.microcontainer.MicrocontainerServiceMBean;
 import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
 import org.jboss.osgi.spi.testing.JMXCapability;
@@ -43,7 +43,10 @@
 import org.jboss.osgi.spi.testing.MicrocontainerCapability;
 import org.jboss.osgi.spi.testing.OSGiRuntime;
 import org.jboss.osgi.spi.testing.OSGiTest;
-import org.jboss.osgi.spi.testing.OSGiTestSetup;
+import org.jboss.osgi.spi.testing.OSGiTestHelper;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
 
 /**
  * A test that checks whether the MicrocontainerService can be accessed
@@ -55,30 +58,22 @@
 {
    private static OSGiRuntime runtime;
 
-   public static Test suite()
+   @BeforeClass
+   public static void setUpClass() throws Exception
    {
-      OSGiTestSetup setup = new OSGiTestSetup(MicrocontainerTestCase.class)
-      {
-         @Override
-         protected void setUp() throws Exception
-         {
-            super.setUp();
-            runtime = getDefaultRuntime();
-            runtime.addCapability(new JNDICapability());
-            runtime.addCapability(new JMXCapability());
-            runtime.addCapability(new MicrocontainerCapability());
-         }
+      runtime = new OSGiTestHelper().getDefaultRuntime();
+      runtime.addCapability(new JNDICapability());
+      runtime.addCapability(new JMXCapability());
+      runtime.addCapability(new MicrocontainerCapability());
+   }
 
-         @Override
-         protected void tearDown() throws Exception
-         {
-            runtime.shutdown();
-            super.tearDown();
-         }
-      };
-      return setup;
+   @AfterClass
+   public static void tearDownClass() throws Exception
+   {
+      runtime.shutdown();
    }
-   
+
+   @Test
    public void testServiceAccess() throws Exception
    {
       MicrocontainerServiceMBean mcService = runtime.getMBeanProxy(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE);
@@ -89,20 +84,22 @@
    }
 
    /**
-    * Test whether the bundle can be deployed through the MicrocontainerServiceMBean 
+    * Test whether the bundle can be deployed through the MicrocontainerServiceMBean
     */
+   @Test
    public void testBundleDeployment() throws Exception
    {
       MicrocontainerServiceMBean mcService = runtime.getMBeanProxy(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE);
       mcService.deploy(getTestArchiveURL("example-mcservice-bundleA.jar"));
-      
+
       ManagedFrameworkMBean frameworkMBean = runtime.getMBeanProxy(ManagedFrameworkMBean.class, MBEAN_MANAGED_FRAMEWORK);
       Set<ObjectName> bundles = frameworkMBean.getBundles();
       assertTrue("Managed bundle registered", bundles.toString().indexOf("jboss.osgi:bundle=example-mcservice-bundleA") > 0);
 
       mcService.undeploy(getTestArchiveURL("example-mcservice-bundleA.jar"));
-}
+   }
 
+   @Test
    public void testBeansDeployment() throws Exception
    {
       MicrocontainerServiceMBean mcService = runtime.getMBeanProxy(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE);
@@ -115,7 +112,7 @@
       // Check whether the bean is registered
       List<String> registeredBeans = mcService.getRegisteredBeans();
       assertTrue("SomeBean registered", registeredBeans.contains("SomeBean"));
-      
+
       mcService.undeploy(getTestArchiveURL("example-mcservice-bundleB.jar"));
 
       // Check whether the bean is unregistered

Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/BootstrapTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/BootstrapTestCase.java	2009-05-25 19:42:57 UTC (rev 89388)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/BootstrapTestCase.java	2009-05-25 19:45:19 UTC (rev 89389)
@@ -23,10 +23,15 @@
 
 //$Id: BootstrapTestCase.java 86588 2009-04-01 13:39:25Z thomas.diesler at jboss.com $
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+
 import org.jboss.osgi.spi.framework.OSGiBootstrap;
 import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
 import org.jboss.osgi.spi.framework.OSGiFramework;
 import org.jboss.osgi.spi.testing.OSGiTest;
+import org.junit.Test;
 import org.osgi.framework.Bundle;
 
 /**
@@ -37,6 +42,7 @@
  */
 public class BootstrapTestCase extends OSGiTest
 {
+   @Test
    public void testFrameworkBootstrap() throws Exception
    {
       OSGiBootstrapProvider bootProvider = OSGiBootstrap.getBootstrapProvider();
@@ -49,6 +55,7 @@
       assertNotNull("SymbolicName not null", bundle.getSymbolicName());
    }
 
+   @Test
    public void testGetBootstrapProvider() throws Exception
    {
       OSGiBootstrapProvider bp1 = OSGiBootstrap.getBootstrapProvider();

Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/BundleTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/BundleTestCase.java	2009-05-25 19:42:57 UTC (rev 89388)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/BundleTestCase.java	2009-05-25 19:45:19 UTC (rev 89389)
@@ -24,9 +24,12 @@
 //$Id$
 package org.jboss.test.osgi.bootstrap;
 
+import static org.junit.Assert.*;
+
 import org.jboss.osgi.spi.testing.AbstractBundle;
 import org.jboss.osgi.spi.testing.OSGiRuntime;
 import org.jboss.osgi.spi.testing.OSGiTest;
+import org.junit.Test;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleException;
 
@@ -38,6 +41,7 @@
  */
 public class BundleTestCase extends OSGiTest
 {
+   @Test
    public void testApacheXercesBundle() throws BundleException
    {
       OSGiRuntime runtime = getEmbeddedRuntime();
@@ -54,6 +58,7 @@
       }
    }
    
+   @Test
    public void testJAXBBundle() throws BundleException
    {
       OSGiRuntime runtime = getEmbeddedRuntime();
@@ -70,6 +75,7 @@
       }
    }
    
+   @Test
    public void testJBossCommonCoreBundle() throws BundleException
    {
       OSGiRuntime runtime = getEmbeddedRuntime();
@@ -87,6 +93,7 @@
       }
    }
    
+   @Test
    public void testJBossXBBundle() throws BundleException
    {
       OSGiRuntime runtime = getEmbeddedRuntime();
@@ -106,6 +113,7 @@
       }
    }
    
+   @Test
    public void testJNDIBundle() throws BundleException
    {
       OSGiRuntime runtime = getEmbeddedRuntime();
@@ -123,6 +131,7 @@
       }
    }
    
+   @Test
    public void testJMXBundle() throws Exception
    {
       OSGiRuntime runtime = getEmbeddedRuntime();

Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java	2009-05-25 19:42:57 UTC (rev 89388)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java	2009-05-25 19:45:19 UTC (rev 89389)
@@ -23,12 +23,15 @@
 
 //$Id: OSGI37TestCase.java 87351 2009-04-15 14:25:32Z thomas.diesler at jboss.com $
 
+import static org.junit.Assert.assertEquals;
+
 import java.util.ArrayList;
 import java.util.List;
 
 import org.jboss.osgi.spi.testing.AbstractBundle;
 import org.jboss.osgi.spi.testing.OSGiRuntime;
 import org.jboss.osgi.spi.testing.OSGiTest;
+import org.junit.Test;
 import org.osgi.framework.Bundle;
 
 /**
@@ -41,6 +44,7 @@
  */
 public class OSGI37TestCase extends OSGiTest
 {
+   @Test
    public void testNestedBundle() throws Exception
    {
       OSGiRuntime runtime = getDefaultRuntime();

Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java	2009-05-25 19:42:57 UTC (rev 89388)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java	2009-05-25 19:45:19 UTC (rev 89389)
@@ -23,9 +23,13 @@
 
 //$Id: OSGI38TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler at jboss.com $
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
 import org.jboss.osgi.spi.testing.AbstractBundle;
 import org.jboss.osgi.spi.testing.OSGiRuntime;
 import org.jboss.osgi.spi.testing.OSGiTest;
+import org.junit.Test;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleException;
 
@@ -47,6 +51,7 @@
    /*
     * Install/Start the common bundle
     */
+   @Test
    public void testInstallStartX() throws Exception
    {
       OSGiRuntime runtime = getEmbeddedRuntime();
@@ -69,6 +74,7 @@
    /*
     * Install X, B
     */
+   @Test
    public void testInstallXBeforeB() throws Exception
    {
       OSGiRuntime runtime = getEmbeddedRuntime();
@@ -95,6 +101,7 @@
    /*
     * Install X, B, A
     */
+   @Test
    public void testInstallBBeforeA() throws Exception
    {
       OSGiRuntime runtime = getEmbeddedRuntime();
@@ -125,6 +132,7 @@
    /*
     * Install B, X
     */
+   @Test
    public void testInstallBBeforeX() throws Exception
    {
       OSGiRuntime runtime = getEmbeddedRuntime();
@@ -161,6 +169,7 @@
    /*
     * Install A, B, X
     */
+   @Test
    public void testInstallABeforeB() throws Exception
    {
       OSGiRuntime runtime = getEmbeddedRuntime();

Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java	2009-05-25 19:42:57 UTC (rev 89388)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java	2009-05-25 19:45:19 UTC (rev 89389)
@@ -23,10 +23,15 @@
 
 //$Id: OSGI39TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler at jboss.com $
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import org.jboss.osgi.spi.testing.AbstractBundle;
 import org.jboss.osgi.spi.testing.AbstractPackageAdmin;
 import org.jboss.osgi.spi.testing.OSGiRuntime;
 import org.jboss.osgi.spi.testing.OSGiTest;
+import org.junit.Test;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleException;
 
@@ -44,6 +49,7 @@
  */
 public class OSGI39TestCase extends OSGiTest
 {
+   @Test
    public void testVerifyUnresolved() throws Exception
    {
       OSGiRuntime runtime = getDefaultRuntime();
@@ -89,6 +95,7 @@
     * If none of the old exports are used, then the old exports must be removed. Otherwise, all old exports must remain available
     * for existing bundles and future resolves until the refreshPackages method is called or the Framework is restarted.
     */
+   @Test
    public void testWiringToUninstalled() throws Exception
    {
       OSGiRuntime runtime = getDefaultRuntime();
@@ -121,6 +128,7 @@
       }
    }
 
+   @Test
    public void testWiringToUninstalledPackageAdmin() throws Exception
    {
       OSGiRuntime runtime = getDefaultRuntime();

Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGI36TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGI36TestCase.java	2009-05-25 19:42:57 UTC (rev 89388)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGI36TestCase.java	2009-05-25 19:45:19 UTC (rev 89389)
@@ -23,8 +23,8 @@
 
 //$Id: OSGI36TestCase.java 86968 2009-04-08 15:51:12Z thomas.diesler at jboss.com $
 
-import junit.extensions.TestSetup;
-import junit.framework.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
 
 import org.jboss.osgi.spi.management.MBeanProxy;
 import org.jboss.osgi.spi.management.MBeanProxyException;
@@ -32,9 +32,12 @@
 import org.jboss.osgi.spi.testing.JNDICapability;
 import org.jboss.osgi.spi.testing.MicrocontainerCapability;
 import org.jboss.osgi.spi.testing.OSGiTest;
-import org.jboss.osgi.spi.testing.OSGiTestSetup;
+import org.jboss.osgi.spi.testing.OSGiTestHelper;
 import org.jboss.osgi.spi.testing.RemoteRuntime;
 import org.jboss.test.osgi.jbossas.jbosgi36.mbean.FooMBean;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
 
 /**
  * [JBOSGI-36] Bundle classes leak into system classloader
@@ -48,40 +51,33 @@
 {
    static RemoteRuntime runtime;
 
-   public static Test suite()
+   @BeforeClass
+   public static void setUpClass() throws Exception
    {
-      TestSetup setup = new OSGiTestSetup(OSGI36TestCase.class)
-      {
-         @Override
-         protected void setUp() throws Exception
-         {
-            super.setUp();
-            runtime = getRemoteRuntime();
-            runtime.addCapability(new JNDICapability());
-            runtime.addCapability(new JMXCapability());
-            runtime.addCapability(new MicrocontainerCapability());
-            
-            runtime.deploy("jbosgi36-bundle.jar");
-            runtime.deploy("jbosgi36-mbean.jar");
-         }
+      runtime = new OSGiTestHelper().getRemoteRuntime();
+      runtime.addCapability(new JNDICapability());
+      runtime.addCapability(new JMXCapability());
+      runtime.addCapability(new MicrocontainerCapability());
 
-         @Override
-         protected void tearDown() throws Exception
-         {
-            runtime.undeploy("jbosgi36-mbean.jar");
-            runtime.undeploy("jbosgi36-bundle.jar");
-            runtime.shutdown();
-            super.tearDown();
-         }
-      };
-      return setup;
+      runtime.deploy("jbosgi36-bundle.jar");
+      runtime.deploy("jbosgi36-mbean.jar");
    }
 
+   @AfterClass
+   public static void tearDownClass() throws Exception
+   {
+      runtime.undeploy("jbosgi36-mbean.jar");
+      runtime.undeploy("jbosgi36-bundle.jar");
+      runtime.shutdown();
+   }
+
+   @Test
    public void testAccessMBean() throws Exception
    {
       assertEquals("hello", getFooMBean().echo("hello"));
    }
 
+   @Test
    public void testAccessSomeService() throws Exception
    {
       try
@@ -95,6 +91,7 @@
       }
    }
 
+   @Test
    public void testAccessSomeInternal() throws Exception
    {
       try

Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/startlevel/StartLevelTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/startlevel/StartLevelTestCase.java	2009-05-25 19:42:57 UTC (rev 89388)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/startlevel/StartLevelTestCase.java	2009-05-25 19:45:19 UTC (rev 89389)
@@ -23,9 +23,12 @@
 
 //$Id: StartLevelRemoteTestCase.java 87336 2009-04-15 11:31:26Z thomas.diesler at jboss.com $
 
+import static org.junit.Assert.assertEquals;
+
 import org.jboss.osgi.spi.testing.AbstractBundle;
 import org.jboss.osgi.spi.testing.OSGiRuntime;
 import org.jboss.osgi.spi.testing.OSGiTest;
+import org.junit.Test;
 import org.osgi.framework.Bundle;
 
 /**
@@ -36,6 +39,7 @@
  */
 public class StartLevelTestCase extends OSGiTest
 {
+   @Test
    public void testStartLevel() throws Exception
    {
       OSGiRuntime runtime = getDefaultRuntime();

Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml	2009-05-25 19:42:57 UTC (rev 89388)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml	2009-05-25 19:45:19 UTC (rev 89389)
@@ -19,14 +19,14 @@
     <module>trailblazer</module>
     <module>functional</module>
   </modules>
-  
+
   <!-- Dependencies -->
   <dependencies>
     <dependency>
       <groupId>org.jboss.osgi</groupId>
       <artifactId>jboss-osgi-spi</artifactId>
     </dependency>
-    
+
     <dependency>
       <groupId>biz.aQute</groupId>
       <artifactId>bnd</artifactId>
@@ -35,7 +35,7 @@
       <groupId>javax.servlet</groupId>
       <artifactId>servlet-api</artifactId>
     </dependency>
-    
+
     <!-- Bundle Dependencies -->
     <dependency>
       <groupId>org.apache.felix</groupId>
@@ -102,7 +102,7 @@
       <artifactId>org.osgi.compendium</artifactId>
       <scope>provided</scope>
     </dependency>
-    
+
     <!-- Test Dependencies -->
     <dependency>
       <groupId>org.jboss.naming</groupId>
@@ -110,7 +110,7 @@
       <scope>test</scope>
     </dependency>
   </dependencies>
-  
+
   <!-- Build -->
   <build>
     <testResources>
@@ -120,7 +120,7 @@
       </testResource>
     </testResources>
   </build>
-  
+
   <!-- Profiles -->
   <profiles>
 
@@ -148,6 +148,18 @@
             <configuration>
               <systemProperties>
                 <property>
+                  <name>org.jboss.osgi.husky.Invoker</name>
+                  <value>org.jboss.osgi.husky.internal.OSGiInvoker</value>
+                </property>
+                <!--
+                  Implement URLStreamHandlerService
+                  https://jira.jboss.org/jira/browse/JBOSGI-75 
+                -->
+                <property>
+                  <name>java.protocol.handler.pkgs</name>
+                  <value>org.jboss.net.protocol|org.jboss.virtual.protocol</value>
+                </property>
+                <property>
                   <name>test.archive.directory</name>
                   <value>${project.build.directory}/test-libs</value>
                 </property>
@@ -191,6 +203,18 @@
             <configuration>
               <systemProperties>
                 <property>
+                  <name>org.jboss.osgi.husky.Invoker</name>
+                  <value>org.jboss.osgi.husky.internal.OSGiInvoker</value>
+                </property>
+                <!--
+                  Implement URLStreamHandlerService
+                  https://jira.jboss.org/jira/browse/JBOSGI-75 
+                -->
+                <property>
+                  <name>java.protocol.handler.pkgs</name>
+                  <value>org.jboss.net.protocol|org.jboss.virtual.protocol</value>
+                </property>
+                <property>
                   <name>test.archive.directory</name>
                   <value>${project.build.directory}/test-libs</value>
                 </property>
@@ -234,6 +258,18 @@
             <configuration>
               <systemProperties>
                 <property>
+                  <name>org.jboss.osgi.husky.Invoker</name>
+                  <value>org.jboss.osgi.husky.internal.OSGiInvoker</value>
+                </property>
+                <!--
+                  Implement URLStreamHandlerService
+                  https://jira.jboss.org/jira/browse/JBOSGI-75 
+                -->
+                <property>
+                  <name>java.protocol.handler.pkgs</name>
+                  <value>org.jboss.net.protocol|org.jboss.virtual.protocol</value>
+                </property>
+                <property>
                   <name>test.archive.directory</name>
                   <value>${project.build.directory}/test-libs</value>
                 </property>
@@ -359,5 +395,5 @@
     </profile>
 
   </profiles>
-  
+
 </project>




More information about the jboss-osgi-commits mailing list