[jboss-osgi-commits] JBoss-OSGI SVN: r97123 - in projects/jboss-osgi/trunk/testsuite: example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleA and 2 other directories.

jboss-osgi-commits at lists.jboss.org jboss-osgi-commits at lists.jboss.org
Sat Nov 28 06:32:05 EST 2009


Author: thomas.diesler at jboss.com
Date: 2009-11-28 06:32:05 -0500 (Sat, 28 Nov 2009)
New Revision: 97123

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/bundleA/SomeService.java
   projects/jboss-osgi/trunk/testsuite/functional/pom.xml
   projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi212/OSGI212TestCase.java
Log:
[JBOSG-212] Add a test to the mc bundle module

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-11-28 09:47:23 UTC (rev 97122)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java	2009-11-28 11:32:05 UTC (rev 97123)
@@ -45,6 +45,7 @@
 public class MicrocontainerTestCase
 {
    static OSGiRuntime runtime;
+   static OSGiBundle bundleA;
 
    @BeforeClass
    public static void setUpClass() throws Exception
@@ -52,7 +53,7 @@
       runtime = new OSGiTestHelper().getDefaultRuntime();
       runtime.addCapability(new MicrocontainerCapability());
 
-      OSGiBundle bundleA = runtime.installBundle("example-mcservice-bundleA.jar");
+      bundleA = runtime.installBundle("example-mcservice-bundleA.jar");
       bundleA.start();
    }
 
@@ -61,6 +62,7 @@
    {
       runtime.shutdown();
       runtime = null;
+      bundleA = null;
    }
 
    @Test
@@ -71,7 +73,7 @@
    }
 
    @Test
-   public void testServiceService() throws Exception
+   public void testServiceAccess() throws Exception
    {
       SomeBeanMBean someBean = MBeanProxy.get(SomeBeanMBean.class, MBEAN_NAME, runtime.getMBeanServer());
       assertEquals("hello", someBean.callSomeService("hello"));

Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleA/SomeService.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleA/SomeService.java	2009-11-28 09:47:23 UTC (rev 97122)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleA/SomeService.java	2009-11-28 11:32:05 UTC (rev 97123)
@@ -52,10 +52,9 @@
    private MicrocontainerService getMicrocontainerService()
    {
       ServiceReference sref = context.getServiceReference(MicrocontainerService.class.getName());
-      MicrocontainerService service = (MicrocontainerService)context.getService(sref);
-      if (service == null)
+      if (sref == null)
          throw new IllegalStateException("No MicrocontainerService");
       
-      return service;
+      return (MicrocontainerService)context.getService(sref);
    }
 }

Modified: projects/jboss-osgi/trunk/testsuite/functional/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/pom.xml	2009-11-28 09:47:23 UTC (rev 97122)
+++ projects/jboss-osgi/trunk/testsuite/functional/pom.xml	2009-11-28 11:32:05 UTC (rev 97123)
@@ -198,8 +198,6 @@
             <configuration>
               <excludes>
                 <exclude>${target.container.excludes}</exclude>
-                <!-- [JBOSGI-212] Cannot refresh Microcontainer service -->
-                <exclude>org/jboss/test/osgi/jbosgi212/**</exclude>
               </excludes>
             </configuration>
           </plugin>

Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi212/OSGI212TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi212/OSGI212TestCase.java	2009-11-28 09:47:23 UTC (rev 97122)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi212/OSGI212TestCase.java	2009-11-28 11:32:05 UTC (rev 97123)
@@ -46,9 +46,9 @@
 public class OSGI212TestCase extends OSGiTest
 {
    @Test
-   public void testLogging() throws Exception
+   public void testServiceRestart() throws Exception
    {
-      OSGiRuntime runtime = getEmbeddedRuntime();
+      OSGiRuntime runtime = getDefaultRuntime();
       try
       {
          runtime.addCapability(new MicrocontainerCapability());
@@ -61,7 +61,8 @@
             assertEquals("Bundle ACTIVE", Bundle.ACTIVE, bundle.getState());
             
             // Update the MC bundle
-            // bundle.update();
+            bundle.stop();
+            bundle.start();
          }
          
          OSGiServiceReference sref = runtime.getServiceReference(MicrocontainerService.class.getName());



More information about the jboss-osgi-commits mailing list