[jboss-cvs] JBossAS SVN: r91218 - in projects/jboss-osgi/trunk: reactor/spi/src/main/java/org/jboss/osgi/spi/util and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jul 14 10:54:18 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-07-14 10:54:17 -0400 (Tue, 14 Jul 2009)
New Revision: 91218

Added:
   projects/jboss-osgi/trunk/reactor/spi/src/main/java/org/jboss/osgi/spi/util/OSGiConstantHelper.java
Removed:
   projects/jboss-osgi/trunk/reactor/spi/src/main/java/org/jboss/osgi/spi/logging/StringConstants.java
Modified:
   projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi112/OSGI112TestCase.java
Log:
[JBOSGI-112] Fail with bundlestate string

Deleted: projects/jboss-osgi/trunk/reactor/spi/src/main/java/org/jboss/osgi/spi/logging/StringConstants.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/spi/src/main/java/org/jboss/osgi/spi/logging/StringConstants.java	2009-07-14 14:31:55 UTC (rev 91217)
+++ projects/jboss-osgi/trunk/reactor/spi/src/main/java/org/jboss/osgi/spi/logging/StringConstants.java	2009-07-14 14:54:17 UTC (rev 91218)
@@ -1,113 +0,0 @@
-/*
- * 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.osgi.spi.logging;
-
-//$Id$
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleEvent;
-import org.osgi.service.log.LogService;
-
-/**
- * String representation for common OSGi Constants
- * 
- * @author thomas.diesler at jboss.com
- * @since 04-Mar-2009
- */
-public abstract class StringConstants 
-{
-   /**
-    * Return the string representation of a {@link Bundle} state
-    */
-   public static String bundleState(int bundleState)
-   {
-      String retState = "[" + bundleState + "]";
-      if (Bundle.UNINSTALLED == bundleState)
-         retState = "UNINSTALLED";
-      else if (Bundle.INSTALLED == bundleState)
-         retState = "INSTALLED";
-      else if (Bundle.RESOLVED == bundleState)
-         retState = "RESOLVED";
-      else if (Bundle.STARTING == bundleState)
-         retState = "STARTING";
-      else if (Bundle.STOPPING == bundleState)
-         retState = "STOPPING";
-      else if (Bundle.ACTIVE == bundleState)
-         retState = "ACTIVE";
-      return retState;
-   }
-   
-   /**
-    * Return the string representation of a {@link BundleEvent} type
-    */
-   public static String bundleEvent(int eventType)
-   {
-      String retType = "[" + eventType + "]";
-      if (BundleEvent.INSTALLED == eventType)
-         retType = "INSTALLED";
-      else if (BundleEvent.LAZY_ACTIVATION == eventType)
-         retType = "LAZY_ACTIVATION";
-      else if (BundleEvent.RESOLVED == eventType)
-         retType = "RESOLVED";
-      else if (BundleEvent.STARTING == eventType)
-         retType = "STARTING";
-      else if (BundleEvent.STARTED == eventType)
-         retType = "STARTED";
-      else if (BundleEvent.STOPPING == eventType)
-         retType = "STOPPING";
-      else if (BundleEvent.STOPPED == eventType)
-         retType = "STOPPED";
-      else if (BundleEvent.UNINSTALLED == eventType)
-         retType = "UNINSTALLED";
-      else if (BundleEvent.UNRESOLVED == eventType)
-         retType = "UNRESOLVED";
-      else if (BundleEvent.UPDATED == eventType)
-         retType = "UPDATED";
-      return retType;
-   }
-   
-   /**
-    * Return the string representation of a {@link LogService} level
-    */
-   public static String logLevel(int level)
-   {
-      String logLevel;
-      switch (level)
-      {
-         case LogService.LOG_DEBUG:
-            logLevel = "DEBUG";
-            break;
-         case LogService.LOG_INFO:
-            logLevel = "INFO";
-            break;
-         case LogService.LOG_WARNING:
-            logLevel = "WARN";
-            break;
-         case LogService.LOG_ERROR:
-            logLevel = "ERROR";
-            break;
-         default:
-            logLevel = "Level=" + level;
-      }
-      return logLevel;
-   }
-}

Copied: projects/jboss-osgi/trunk/reactor/spi/src/main/java/org/jboss/osgi/spi/util/OSGiConstantHelper.java (from rev 91209, projects/jboss-osgi/trunk/reactor/spi/src/main/java/org/jboss/osgi/spi/logging/StringConstants.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/spi/src/main/java/org/jboss/osgi/spi/util/OSGiConstantHelper.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/spi/src/main/java/org/jboss/osgi/spi/util/OSGiConstantHelper.java	2009-07-14 14:54:17 UTC (rev 91218)
@@ -0,0 +1,111 @@
+/*
+ * 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.osgi.spi.util;
+
+//$Id$
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleEvent;
+import org.osgi.service.log.LogService;
+
+/**
+ * String representation for common OSGi Constants
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 04-Mar-2009
+ */
+public abstract class OSGiConstantHelper 
+{
+   /**
+    * Return the string representation of a {@link Bundle} state
+    */
+   public static String bundleState(int bundleState)
+   {
+      String retState = "[" + bundleState + "]";
+      if (Bundle.UNINSTALLED == bundleState)
+         retState = "UNINSTALLED";
+      else if (Bundle.INSTALLED == bundleState)
+         retState = "INSTALLED";
+      else if (Bundle.RESOLVED == bundleState)
+         retState = "RESOLVED";
+      else if (Bundle.STARTING == bundleState)
+         retState = "STARTING";
+      else if (Bundle.STOPPING == bundleState)
+         retState = "STOPPING";
+      else if (Bundle.ACTIVE == bundleState)
+         retState = "ACTIVE";
+      return retState;
+   }
+   
+   /**
+    * Return the string representation of a {@link BundleEvent} type
+    */
+   public static String bundleEvent(int eventType)
+   {
+      String retType = "[" + eventType + "]";
+      if (BundleEvent.INSTALLED == eventType)
+         retType = "INSTALLED";
+      else if (BundleEvent.LAZY_ACTIVATION == eventType)
+         retType = "LAZY_ACTIVATION";
+      else if (BundleEvent.RESOLVED == eventType)
+         retType = "RESOLVED";
+      else if (BundleEvent.STARTING == eventType)
+         retType = "STARTING";
+      else if (BundleEvent.STARTED == eventType)
+         retType = "STARTED";
+      else if (BundleEvent.STOPPING == eventType)
+         retType = "STOPPING";
+      else if (BundleEvent.STOPPED == eventType)
+         retType = "STOPPED";
+      else if (BundleEvent.UNINSTALLED == eventType)
+         retType = "UNINSTALLED";
+      else if (BundleEvent.UNRESOLVED == eventType)
+         retType = "UNRESOLVED";
+      else if (BundleEvent.UPDATED == eventType)
+         retType = "UPDATED";
+      return retType;
+   }
+   
+   /**
+    * Return the string representation of a {@link LogService} level
+    */
+   public static String logLevel(int level)
+   {
+      String logLevel = "[" + level + "]";
+      switch (level)
+      {
+         case LogService.LOG_DEBUG:
+            logLevel = "DEBUG";
+            break;
+         case LogService.LOG_INFO:
+            logLevel = "INFO";
+            break;
+         case LogService.LOG_WARNING:
+            logLevel = "WARN";
+            break;
+         case LogService.LOG_ERROR:
+            logLevel = "ERROR";
+            break;
+      }
+      return logLevel;
+   }
+}

Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi112/OSGI112TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi112/OSGI112TestCase.java	2009-07-14 14:31:55 UTC (rev 91217)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi112/OSGI112TestCase.java	2009-07-14 14:54:17 UTC (rev 91218)
@@ -28,6 +28,7 @@
 import org.jboss.osgi.spi.testing.OSGiBundle;
 import org.jboss.osgi.spi.testing.OSGiRuntime;
 import org.jboss.osgi.spi.testing.OSGiTestHelper;
+import org.jboss.osgi.spi.util.OSGiConstantHelper;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Ignore;
@@ -75,7 +76,8 @@
       try
       {
          bundleB.start();
-         fail("BundleException expected");
+         String bundleState = OSGiConstantHelper.bundleState(bundleB.getState());
+         fail("BundleException expected, but bundle state is: " + bundleState);
       }
       catch (BundleException ex)
       {




More information about the jboss-cvs-commits mailing list