[jboss-cvs] JBossAS SVN: r94482 - in projects/jboss-osgi/trunk/testsuite/functional/src/test: java/org/jboss/test/osgi/jbosgi161/bundle and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Oct 7 18:14:25 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-10-07 18:14:24 -0400 (Wed, 07 Oct 2009)
New Revision: 94482

Modified:
   projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi161/OSGI161TestCase.java
   projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi161/bundle/OSGI161Activator.java
   projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi161/jbosgi161-bundle.bnd
Log:
[JBOSGI-161] Cannot use commons-logging

Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi161/OSGI161TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi161/OSGI161TestCase.java	2009-10-07 22:05:44 UTC (rev 94481)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi161/OSGI161TestCase.java	2009-10-07 22:14:24 UTC (rev 94482)
@@ -21,7 +21,7 @@
  */
 package org.jboss.test.osgi.jbosgi161;
 
-//$Id: OSGI41RemoteTestCase.java 87182 2009-04-13 13:47:53Z thomas.diesler at jboss.com $
+//$Id:$
 
 import static org.junit.Assert.assertEquals;
 
@@ -54,7 +54,6 @@
          bundleA.start();
          
          assertEquals("Bundle active", Bundle.ACTIVE, bundleA.getState());
-         
          bundleA.uninstall();
       }
       finally

Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi161/bundle/OSGI161Activator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi161/bundle/OSGI161Activator.java	2009-10-07 22:05:44 UTC (rev 94481)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi161/bundle/OSGI161Activator.java	2009-10-07 22:14:24 UTC (rev 94482)
@@ -21,29 +21,51 @@
  */
 package org.jboss.test.osgi.jbosgi161.bundle;
 
-//$Id: $
+// $Id:$
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class OSGI161Activator implements BundleActivator
 {
    public void start(BundleContext context) throws Exception
    {
+      assertCommonsLogging(context);
+      
+      assertSL4J(context);
+   }
+
+   public void stop(BundleContext context) throws Exception
+   {
+   }
+
+   private void assertCommonsLogging(BundleContext context)
+   {
       Log log = LogFactory.getLog(OSGI161Activator.class);
 
       String loggerClass = log.getClass().getName();
-      if (loggerClass.toLowerCase().contains("log4j") == false)
+      if ("org.apache.commons.logging.impl.SLF4JLocationAwareLog".equals(loggerClass) == false)
          throw new IllegalStateException("Unexpected logger: " + loggerClass);
       
       log.info("*******************************************");
-      log.info("* start: " + context.getBundle());
+      log.info("* jcl: " + context.getBundle());
       log.info("*******************************************");
    }
 
-   public void stop(BundleContext context) throws Exception
+   private void assertSL4J(BundleContext context)
    {
+      Logger log = LoggerFactory.getLogger(OSGI161Activator.class);
+
+      String loggerClass = log.getClass().getName();
+      if ("org.slf4j.impl.Log4jLoggerAdapter".equals(loggerClass) == false)
+         throw new IllegalStateException("Unexpected logger: " + loggerClass);
+      
+      log.info("*******************************************");
+      log.info("* slf4j: " + context.getBundle());
+      log.info("*******************************************");
    }
 }
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi161/jbosgi161-bundle.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi161/jbosgi161-bundle.bnd	2009-10-07 22:05:44 UTC (rev 94481)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi161/jbosgi161-bundle.bnd	2009-10-07 22:14:24 UTC (rev 94482)
@@ -3,4 +3,4 @@
 Bundle-SymbolicName: jbosgi161-bundle
 Bundle-Activator: org.jboss.test.osgi.jbosgi161.bundle.OSGI161Activator
 Private-Package: org.jboss.test.osgi.jbosgi161.bundle
-Import-Package: org.apache.commons.logging, org.osgi.framework
+Import-Package: org.apache.commons.logging, org.slf4j, org.osgi.framework




More information about the jboss-cvs-commits mailing list