[jboss-cvs] JBossAS SVN: r85391 - in projects/jboss-osgi/trunk: runtime/felix/src/main/java/org/jboss/osgi/felix/framework and 8 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Mar 6 07:42:56 EST 2009


Author: thomas.diesler at jboss.com
Date: 2009-03-06 07:42:56 -0500 (Fri, 06 Mar 2009)
New Revision: 85391

Added:
   projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/OSGI36TestCase.java
   projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/startlevel/
   projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/startlevel/StartLevelDeployerTestCase.java
   projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/startlevel/bundle/
   projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/startlevel/bundle/ServiceActivator.java
   projects/jboss-osgi/trunk/testsuite/src/test/resources/service/startlevel/
   projects/jboss-osgi/trunk/testsuite/src/test/resources/service/startlevel/startlevel-service.bnd
Removed:
   projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/junit/
Modified:
   projects/jboss-osgi/trunk/runtime/deployer/src/main/resources/osgi-deployers-jboss-beans.xml
   projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixLogger.java
   projects/jboss-osgi/trunk/service/logging/
   projects/jboss-osgi/trunk/testsuite/scripts/antrun-test-jars.xml
Log:
Add startlevel test

Modified: projects/jboss-osgi/trunk/runtime/deployer/src/main/resources/osgi-deployers-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/deployer/src/main/resources/osgi-deployers-jboss-beans.xml	2009-03-06 12:41:02 UTC (rev 85390)
+++ projects/jboss-osgi/trunk/runtime/deployer/src/main/resources/osgi-deployers-jboss-beans.xml	2009-03-06 12:42:56 UTC (rev 85391)
@@ -19,7 +19,6 @@
             org.jboss.osgi.service,
             org.jboss.osgi.spi.management,
             org.osgi.framework; version=1.4,
-            org.osgi.service.startlevel,
             org.xml.sax
           </value>
         </entry>
@@ -32,6 +31,7 @@
     </property>
     <property name="autoStart">
      <list elementClass="java.net.URI">
+      <value>${jboss.server.home.url}/deployers/osgi.deployer/org.osgi.core.jar</value>
       <value>${jboss.server.home.url}/deployers/osgi.deployer/org.osgi.compendium.jar</value>
       <value>${jboss.server.home.url}/deploy/osgi/jboss-osgi-service-logging.jar</value>
      </list>

Modified: projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixLogger.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixLogger.java	2009-03-06 12:41:02 UTC (rev 85390)
+++ projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixLogger.java	2009-03-06 12:42:56 UTC (rev 85391)
@@ -52,18 +52,25 @@
          msg = sref + ": " + msg;
 
       // An unresolved bundle causes a WARNING that comes with an exception
-      // Currently we only allow exceptions for ERRORs      
+      // Currently we log WARNING exceptions at DEBUG level      
       
       if (level == LOG_DEBUG)
-         log.debug(msg);
-      
+      {
+         log.debug(msg, throwable);
+      }
       else if (level == LOG_INFO)
-         log.info(msg);
-      
+      {
+         log.info(msg, throwable);
+      }
       else if (level == LOG_WARNING)
+      {
          log.warn(msg);
-
+         if (throwable != null)
+            log.debug(msg, throwable);
+      }
       else if (level == LOG_ERROR)
+      {
          log.error(msg, throwable);
+      }
    }
 }
\ No newline at end of file


Property changes on: projects/jboss-osgi/trunk/service/logging
___________________________________________________________________
Name: svn:ignore
   + target


Modified: projects/jboss-osgi/trunk/testsuite/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/scripts/antrun-test-jars.xml	2009-03-06 12:41:02 UTC (rev 85390)
+++ projects/jboss-osgi/trunk/testsuite/scripts/antrun-test-jars.xml	2009-03-06 12:42:56 UTC (rev 85391)
@@ -67,6 +67,9 @@
 
     <!-- microcontainer-service -->
     <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/microcontainer-service.jar" files="${tests.resources.dir}/service/microcontainer/microcontainer-service.bnd" />
+  	
+    <!-- startlevel-service -->
+    <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/startlevel-service.jar" files="${tests.resources.dir}/service/startlevel/startlevel-service.bnd" />
 
     <!-- Please add alphabetically -->
 

Copied: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/OSGI36TestCase.java (from rev 85382, projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/junit/OSGI36TestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/OSGI36TestCase.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/OSGI36TestCase.java	2009-03-06 12:42:56 UTC (rev 85391)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.jbosgi36;
+
+//$Id$
+
+import junit.framework.Test;
+
+import org.jboss.osgi.spi.framework.NamedInstanceProvider;
+import org.jboss.osgi.spi.framework.OSGiBootstrap;
+import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
+import org.jboss.osgi.spi.junit.IntegrationTest;
+import org.jboss.osgi.spi.junit.IntegrationTestSetup;
+import org.jboss.osgi.spi.management.MBeanProxy;
+import org.jboss.osgi.spi.management.MBeanProxyException;
+import org.jboss.test.osgi.jbosgi36.mbean.FooMBean;
+
+/**
+ * [JBOSGI-36] Bundle classes leak into system classloader
+ * 
+ * https://jira.jboss.org/jira/browse/JBOSGI-36
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 25-Feb-2009
+ */
+public class OSGI36TestCase extends IntegrationTest
+{
+   static IntegrationTestSetup setup;
+
+   public static Test suite()
+   {
+      setup = new IntegrationTestSetup(OSGI36TestCase.class, "jbosgi36-bundle.jar, jbosgi36-mbean.jar")
+      {
+         @Override
+         public OSGiBootstrapProvider createBootstrapProvider()
+         {
+            OSGiBootstrapProvider configProvider = null;
+            if (isRemoteIntegration() == false)
+            {
+               // Bootstrap the embedded framework
+               configProvider = OSGiBootstrap.getBootstrapProvider();
+               configProvider.getFramework();
+            }
+            return configProvider;
+         }
+      };
+      return setup;
+   }
+
+   public void testAccessMBean() throws Exception
+   {
+      assertEquals("hello", getFooMBean().echo("hello"));
+   }
+
+   public void testAccessSomeService() throws Exception
+   {
+      try
+      {
+         String loaderName = getFooMBean().accessSomeService();
+         fail("Unexpected classloader: " + loaderName);
+      }
+      catch (ClassNotFoundException ex)
+      {
+         // expected
+      }
+   }
+
+   public void testAccessSomeInternal() throws Exception
+   {
+      try
+      {
+         String loaderName = getFooMBean().accessSomeInternal();
+         fail("Unexpected classloader: " + loaderName);
+      }
+      catch (ClassNotFoundException ex)
+      {
+         // expected
+      }
+   }
+
+   private FooMBean getFooMBean() throws MBeanProxyException
+   {
+      FooMBean foo;
+      if (isRemoteIntegration() == false)
+      {
+         OSGiBootstrapProvider configProvider = setup.getBootstrapProvider();
+         NamedInstanceProvider attProvider = (NamedInstanceProvider)configProvider;
+         foo = attProvider.getInstance("Foo", FooMBean.class);
+      }
+      else
+      {
+         foo = (FooMBean)MBeanProxy.get(FooMBean.class, FooMBean.OBJECT_NAME, getServer());
+      }
+      return foo;
+   }
+}
\ No newline at end of file

Added: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/startlevel/StartLevelDeployerTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/startlevel/StartLevelDeployerTestCase.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/startlevel/StartLevelDeployerTestCase.java	2009-03-06 12:42:56 UTC (rev 85391)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.service.startlevel;
+
+//$Id$
+
+import org.jboss.osgi.spi.junit.IntegrationTest;
+import org.jboss.osgi.spi.management.ManagedBundleMBean;
+import org.osgi.framework.Bundle;
+
+/**
+ * Deploy a bundle that accesses the StartLevel service
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 04-Mar-2009
+ */
+public class StartLevelDeployerTestCase extends IntegrationTest
+{
+   public void testStartLevel() throws Exception
+   {
+      ManagedBundleMBean bundle = deployBundle("startlevel-service");
+      
+      assertEquals("Bundle active", Bundle.ACTIVE, bundle.getState());
+      
+      undeployBundle("startlevel-service");
+   }
+}
\ No newline at end of file


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

Added: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/startlevel/bundle/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/startlevel/bundle/ServiceActivator.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/startlevel/bundle/ServiceActivator.java	2009-03-06 12:42:56 UTC (rev 85391)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.service.startlevel.bundle;
+
+//$Id$
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.startlevel.StartLevel;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * Try to access the StartLevel service 
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 04-Feb-2009
+ */
+public class ServiceActivator implements BundleActivator
+{
+   /*
+    * Implements BundleActivator.start(). 
+    */
+   public void start(BundleContext context)
+   {
+      ServiceTracker tracker = new ServiceTracker(context, StartLevel.class.getName(), null);
+      tracker.open();
+      
+      StartLevel service = (StartLevel)tracker.getService();
+      int level = service.getStartLevel();
+      System.out.println("StartLevel: " + level);
+   }
+
+   /*
+    * Implements BundleActivator.stop().
+    */
+   public void stop(BundleContext context)
+   {
+   }
+}
\ No newline at end of file


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

Added: projects/jboss-osgi/trunk/testsuite/src/test/resources/service/startlevel/startlevel-service.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/resources/service/startlevel/startlevel-service.bnd	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/src/test/resources/service/startlevel/startlevel-service.bnd	2009-03-06 12:42:56 UTC (rev 85391)
@@ -0,0 +1,5 @@
+# bnd build -classpath target/test-classes -output target/test-libs/startlevel-service.jar src/test/resources/service/startlevel/startlevel-service.bnd
+
+Bundle-SymbolicName: startlevel-service
+Bundle-Activator: org.jboss.test.osgi.service.startlevel.bundle.ServiceActivator
+Export-Package: org.jboss.test.osgi.service.startlevel.bundle




More information about the jboss-cvs-commits mailing list