[jboss-osgi-commits] JBoss-OSGI SVN: r101930 - in projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi: capabilities and 1 other directories.

jboss-osgi-commits at lists.jboss.org jboss-osgi-commits at lists.jboss.org
Thu Mar 4 23:37:08 EST 2010


Author: thomas.diesler at jboss.com
Date: 2010-03-04 23:37:07 -0500 (Thu, 04 Mar 2010)
New Revision: 101930

Added:
   projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi298/
   projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi298/OSGi298TestCase.java
Modified:
   projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/capabilities/CapabilityTestCase.java
Log:
[JBOSGI-298] InstanceAlreadyExistsException: osgi.core:type=framework,version=1.5
Add test case

Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/capabilities/CapabilityTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/capabilities/CapabilityTestCase.java	2010-03-05 04:18:36 UTC (rev 101929)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/capabilities/CapabilityTestCase.java	2010-03-05 04:37:07 UTC (rev 101930)
@@ -39,6 +39,7 @@
 import org.jboss.osgi.jbossxb.XMLBindingCapability;
 import org.jboss.osgi.jmx.JMXCapability;
 import org.jboss.osgi.jndi.JNDICapability;
+import org.jboss.osgi.spi.capability.CompendiumCapability;
 import org.jboss.osgi.spi.capability.LogServiceCapability;
 import org.jboss.osgi.testing.OSGiBundle;
 import org.jboss.osgi.testing.OSGiRuntime;
@@ -106,8 +107,8 @@
          
          runtime.addCapability(new JAXBCapability());
          
-         OSGiServiceReference saxRef = runtime.getServiceReference(JAXBService.class.getName());
-         assertNotNull("JAXBService registered", saxRef);
+         OSGiServiceReference sref = runtime.getServiceReference(JAXBService.class.getName());
+         assertNotNull("JAXBService registered", sref);
       }
       finally
       {
@@ -128,8 +129,8 @@
          
          runtime.addCapability(new XMLBindingCapability());
          
-         OSGiServiceReference saxRef = runtime.getServiceReference(UnmarshallerService.class.getName());
-         assertNotNull("UnmarshallerService registered", saxRef);
+         OSGiServiceReference sref = runtime.getServiceReference(UnmarshallerService.class.getName());
+         assertNotNull("UnmarshallerService registered", sref);
       }
       finally
       {
@@ -150,8 +151,8 @@
          
          runtime.addCapability(new JNDICapability());
          
-         OSGiServiceReference saxRef = runtime.getServiceReference(InitialContext.class.getName());
-         assertNotNull("InitialContext registered", saxRef);
+         OSGiServiceReference sref = runtime.getServiceReference(InitialContext.class.getName());
+         assertNotNull("InitialContext registered", sref);
       }
       finally
       {
@@ -165,15 +166,15 @@
       OSGiRuntime runtime = getEmbeddedRuntime();
       try
       {
-         runtime.addCapability(new LogServiceCapability());
+         runtime.addCapability(new CompendiumCapability());
          
          OSGiBundle bundle = runtime.getBundle("jboss-osgi-jmx", null);
          assertNull("Test bundle null", bundle);
          
          runtime.addCapability(new JMXCapability());
          
-         OSGiServiceReference saxRef = runtime.getServiceReference(MBeanServer.class.getName());
-         assertNotNull("MBeanServer registered", saxRef);
+         OSGiServiceReference sref = runtime.getServiceReference(MBeanServer.class.getName());
+         assertNotNull("MBeanServer registered", sref);
       }
       finally
       {

Added: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi298/OSGi298TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi298/OSGi298TestCase.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi298/OSGi298TestCase.java	2010-03-05 04:37:07 UTC (rev 101930)
@@ -0,0 +1,97 @@
+/*
+ * 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.
+ */
+
+//$Id: CapabilityTestCase.java 97030 2009-11-26 14:42:11Z thomas.diesler at jboss.com $
+package org.jboss.test.osgi.jbosgi298;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.jboss.osgi.jmx.JMXCapability;
+import org.jboss.osgi.spi.capability.CompendiumCapability;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.jboss.osgi.testing.OSGiTest;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.osgi.jmx.framework.BundleStateMBean;
+import org.osgi.jmx.framework.FrameworkMBean;
+import org.osgi.jmx.framework.ServiceStateMBean;
+
+/**
+ * [JBOSGI-298] InstanceAlreadyExistsException: osgi.core:type=framework,version=1.5
+ * 
+ * https://jira.jboss.org/jira/browse/JBOSGI-298
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 05-Mar-2010
+ */
+ at Ignore
+public class OSGi298TestCase extends OSGiTest
+{
+   private OSGiRuntime runtime;
+
+   @Before
+   public void setUp() throws Exception
+   {
+      runtime = getEmbeddedRuntime();
+      runtime.addCapability(new CompendiumCapability());
+   }
+
+   @After
+   public void tearDown()
+   {
+      runtime.shutdown();
+   }
+
+   @Test
+   public void testJMXCapability() throws Exception
+   {
+      JMXCapability capability = new JMXCapability();
+
+      for (int i = 0; i < 10; i++)
+      {
+         runtime.addCapability(capability);
+
+         assertTrue("FrameworkMBean registered", isRegistered(FrameworkMBean.OBJECTNAME));
+         assertTrue("BundleStateMBean registered", isRegistered(BundleStateMBean.OBJECTNAME));
+         assertTrue("ServiceStateMBean registered", isRegistered(ServiceStateMBean.OBJECTNAME));
+
+         runtime.removeCapability(capability);
+
+         assertFalse("FrameworkMBean registered", isRegistered(FrameworkMBean.OBJECTNAME));
+         assertFalse("BundleStateMBean registered", isRegistered(BundleStateMBean.OBJECTNAME));
+         assertFalse("ServiceStateMBean registered", isRegistered(ServiceStateMBean.OBJECTNAME));
+      }
+   }
+
+   private boolean isRegistered(String oname) throws MalformedObjectNameException
+   {
+      MBeanServer server = (MBeanServer)runtime.getMBeanServer();
+      return server.isRegistered(ObjectName.getInstance(oname));
+   }
+}
\ No newline at end of file



More information about the jboss-osgi-commits mailing list