[jboss-osgi-commits] JBoss-OSGI SVN: r103562 - in projects/jboss-osgi/projects/bundles/jmx/trunk: api/src/main/java/org/jboss/osgi/jmx and 4 other directories.

jboss-osgi-commits at lists.jboss.org jboss-osgi-commits at lists.jboss.org
Tue Apr 6 06:25:17 EDT 2010


Author: thomas.diesler at jboss.com
Date: 2010-04-06 06:25:15 -0400 (Tue, 06 Apr 2010)
New Revision: 103562

Added:
   projects/jboss-osgi/projects/bundles/jmx/trunk/api/
   projects/jboss-osgi/projects/bundles/jmx/trunk/impl/
   projects/jboss-osgi/projects/bundles/jmx/trunk/impl/src/test/java/org/jboss/test/osgi/jmx/AbstractJMXTestCase.java
Removed:
   projects/jboss-osgi/projects/bundles/jmx/trunk/impl/scripts/antrun-test-jars.xml
   projects/jboss-osgi/projects/bundles/jmx/trunk/impl/src/test/java/org/jboss/test/osgi/jmx/AbstractTestCase.java
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-api/
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/
Modified:
   projects/jboss-osgi/projects/bundles/jmx/trunk/api/src/main/java/org/jboss/osgi/jmx/MBeanProxy.java
   projects/jboss-osgi/projects/bundles/jmx/trunk/api/src/main/java/org/jboss/osgi/jmx/ObjectNameFactory.java
   projects/jboss-osgi/projects/bundles/jmx/trunk/impl/pom.xml
   projects/jboss-osgi/projects/bundles/jmx/trunk/impl/src/test/java/org/jboss/test/osgi/jmx/BundleStateTestCase.java
   projects/jboss-osgi/projects/bundles/jmx/trunk/impl/src/test/java/org/jboss/test/osgi/jmx/FrameworkTestCase.java
   projects/jboss-osgi/projects/bundles/jmx/trunk/impl/src/test/java/org/jboss/test/osgi/jmx/ServiceStateTestCase.java
   projects/jboss-osgi/projects/bundles/jmx/trunk/impl/src/test/resources/jboss-osgi-framework.properties
   projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml
Log:
wip

Copied: projects/jboss-osgi/projects/bundles/jmx/trunk/api (from rev 103561, projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-api)

Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/api/src/main/java/org/jboss/osgi/jmx/MBeanProxy.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-api/src/main/java/org/jboss/osgi/jmx/MBeanProxy.java	2010-04-06 07:41:11 UTC (rev 103561)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/api/src/main/java/org/jboss/osgi/jmx/MBeanProxy.java	2010-04-06 10:25:15 UTC (rev 103562)
@@ -21,7 +21,7 @@
  */
 package org.jboss.osgi.jmx;
 
-// $Id: MBeanProxy.java 101072 2010-02-17 13:55:15Z thomas.diesler at jboss.com $
+// $Id$
 
 import javax.management.MBeanServerConnection;
 import javax.management.MBeanServerInvocationHandler;

Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/api/src/main/java/org/jboss/osgi/jmx/ObjectNameFactory.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-api/src/main/java/org/jboss/osgi/jmx/ObjectNameFactory.java	2010-04-06 07:41:11 UTC (rev 103561)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/api/src/main/java/org/jboss/osgi/jmx/ObjectNameFactory.java	2010-04-06 10:25:15 UTC (rev 103562)
@@ -21,7 +21,7 @@
  */
 package org.jboss.osgi.jmx;
 
-// $Id: ObjectNameFactory.java 101072 2010-02-17 13:55:15Z thomas.diesler at jboss.com $
+// $Id$
 
 import java.util.Hashtable;
 

Copied: projects/jboss-osgi/projects/bundles/jmx/trunk/impl (from rev 103561, projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle)

Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/impl/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/pom.xml	2010-04-06 07:41:11 UTC (rev 103561)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/impl/pom.xml	2010-04-06 10:25:15 UTC (rev 103562)
@@ -168,27 +168,6 @@
         </executions>
       </plugin>
       <plugin>
-        <artifactId>maven-antrun-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>build-test-jars</id>
-            <phase>integration-test</phase>
-            <goals>
-              <goal>run</goal>
-            </goals>
-            <configuration>
-              <tasks>
-                <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
-                <property name="artifactId" value="${artifactId}" />
-                <property name="tests.output.dir" value="${project.build.directory}" />
-                <property name="build.artifact" value="${project.build.finalName}" />
-                <ant antfile="scripts/antrun-test-jars.xml" />
-              </tasks>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
           <skip>true</skip>
@@ -213,6 +192,10 @@
                   <value>${project.build.directory}</value>
                 </property>
                 <property>
+                  <name>project.build.finalName</name>
+                  <value>${project.build.finalName}</value>
+                </property>
+                <property>
                   <name>test.archive.directory</name>
                   <value>${project.build.directory}/test-libs</value>
                 </property>

Deleted: projects/jboss-osgi/projects/bundles/jmx/trunk/impl/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/scripts/antrun-test-jars.xml	2010-04-06 07:41:11 UTC (rev 103561)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/impl/scripts/antrun-test-jars.xml	2010-04-06 10:25:15 UTC (rev 103562)
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- ============================================================ -->
-<!--  JBoss, the OpenSource J2EE webOS                            -->
-<!--  Distributable under LGPL license.                           -->
-<!--  See terms of license at http://www.gnu.org.                 -->
-<!-- ============================================================ -->
-
-<!-- $Id$ -->
-
-<project default="build-test-jars">
-
-  <description>OSGi test archive builder</description>
-
-  <!-- ================================================================== -->
-  <!-- Init                                                               -->
-  <!-- ================================================================== -->
-
-  <target name="init">
-
-    <!-- Property override when not called from maven -->
-    <property name="maven.runtime.classpath" value="/usr/java/bnd.jar" />
-    <property name="tests.output.dir" value="${basedir}/../target" />
-
-    <mkdir dir="${tests.output.dir}/test-libs" />
-    <property name="tests.classes.dir" value="${tests.output.dir}/test-classes" />
-    <property name="tests.resources.dir" value="${tests.output.dir}/test-classes" />
-
-    <taskdef resource="aQute/bnd/ant/taskdef.properties">
-      <classpath>
-        <pathelement path="${maven.runtime.classpath}" />
-      </classpath>
-    </taskdef>
-  	
-  	<!-- Copy build artifact to test-libs/bundles -->
-  	<copy file="${tests.output.dir}/${build.artifact}.jar" tofile="${tests.output.dir}/test-libs/bundles/${artifactId}.jar" overwrite="true"/>
-
-  </target>
-
-  <!-- ================================================================== -->
-  <!-- Building                                                           -->
-  <!-- ================================================================== -->
-
-  <target name="build-test-jars" depends="init" description="Build the test deployments">
-
-    <!-- Please add alphabetically -->
-
-    <!-- Please add alphabetically -->
-
-  </target>
-
-</project>

Copied: projects/jboss-osgi/projects/bundles/jmx/trunk/impl/src/test/java/org/jboss/test/osgi/jmx/AbstractJMXTestCase.java (from rev 103561, projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/osgi/jmx/AbstractTestCase.java)
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/impl/src/test/java/org/jboss/test/osgi/jmx/AbstractJMXTestCase.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/impl/src/test/java/org/jboss/test/osgi/jmx/AbstractJMXTestCase.java	2010-04-06 10:25:15 UTC (rev 103562)
@@ -0,0 +1,95 @@
+/*
+ * 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.jmx;
+
+//$Id$
+
+import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
+
+import org.jboss.osgi.jmx.FrameworkMBeanExt;
+import org.jboss.osgi.jmx.MBeanProxy;
+import org.jboss.osgi.jmx.ObjectNameFactory;
+import org.jboss.osgi.jmx.ServiceStateMBeanExt;
+import org.jboss.osgi.testing.OSGiFrameworkTest;
+import org.jboss.osgi.testing.OSGiTestHelper;
+import org.junit.BeforeClass;
+import org.osgi.jmx.framework.BundleStateMBean;
+
+/**
+ * An abstract JMX test case.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 23-Feb-2010
+ */
+public abstract class AbstractJMXTestCase extends OSGiFrameworkTest
+{
+   private MBeanServer server;
+   
+   @BeforeClass
+   public static void setUpClass() throws Exception
+   {
+      String bundleName = System.getProperty("project.build.finalName");
+      URL bundleURL = new File("target/" + bundleName + ".jar").toURI().toURL();
+      systemContext.installBundle(bundleURL.toExternalForm());
+   }
+
+   protected FrameworkMBeanExt getFrameworkMBean() throws Exception
+   {
+      ObjectName oname = ObjectNameFactory.create(FrameworkMBeanExt.OBJECTNAME);
+      return MBeanProxy.get(getMBeanServer(), oname, FrameworkMBeanExt.class);
+   }
+   
+   protected BundleStateMBean getBundleStateMBean() throws Exception
+   {
+      ObjectName oname = ObjectNameFactory.create(BundleStateMBean.OBJECTNAME);
+      return MBeanProxy.get(getMBeanServer(), oname, BundleStateMBean.class);
+   }
+   
+   protected ServiceStateMBeanExt getServiceStateMBean() throws Exception
+   {
+      ObjectName oname = ObjectNameFactory.create(ServiceStateMBeanExt.OBJECTNAME);
+      return MBeanProxy.get(getMBeanServer(), oname, ServiceStateMBeanExt.class);
+   }
+   
+   protected MBeanServer getMBeanServer()
+   {
+      if (server == null)
+      {
+         ArrayList<MBeanServer> serverArr = MBeanServerFactory.findMBeanServer(null);
+         if (serverArr.size() > 1)
+            throw new IllegalStateException("Multiple MBeanServer instances not supported");
+
+         if (serverArr.size() == 1)
+            server = serverArr.get(0);
+
+         if (server == null)
+            server = MBeanServerFactory.createMBeanServer();
+      }
+      return server;
+   }
+}
\ No newline at end of file

Deleted: projects/jboss-osgi/projects/bundles/jmx/trunk/impl/src/test/java/org/jboss/test/osgi/jmx/AbstractTestCase.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/osgi/jmx/AbstractTestCase.java	2010-04-06 07:41:11 UTC (rev 103561)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/impl/src/test/java/org/jboss/test/osgi/jmx/AbstractTestCase.java	2010-04-06 10:25:15 UTC (rev 103562)
@@ -1,112 +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.test.osgi.jmx;
-
-//$Id$
-
-import java.util.ArrayList;
-
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-import javax.management.ObjectName;
-
-import org.jboss.osgi.jmx.FrameworkMBeanExt;
-import org.jboss.osgi.jmx.MBeanProxy;
-import org.jboss.osgi.jmx.ObjectNameFactory;
-import org.jboss.osgi.jmx.ServiceStateMBeanExt;
-import org.jboss.osgi.spi.framework.OSGiBootstrap;
-import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.launch.Framework;
-import org.osgi.jmx.framework.BundleStateMBean;
-
-/**
- * An abstract JMX test case.
- * 
- * @author thomas.diesler at jboss.com
- * @since 23-Feb-2010
- */
-public abstract class AbstractTestCase
-{
-   private static Framework framework;
-   private MBeanServer server;
-   
-   @BeforeClass
-   public static void setUpClass() throws Exception
-   {
-      OSGiBootstrapProvider bootProvider = OSGiBootstrap.getBootstrapProvider();
-      framework = bootProvider.getFramework();
-      framework.start();
-   }
-
-   @AfterClass
-   public static void tearDownClass() throws Exception
-   {
-      if (framework != null)
-      {
-         framework.stop();
-         framework.waitForStop(3000);
-      }
-   }
-
-   protected BundleContext getSystemContext()
-   {
-      return framework.getBundleContext();
-   }
-   
-   protected FrameworkMBeanExt getFrameworkMBean() throws Exception
-   {
-      ObjectName oname = ObjectNameFactory.create(FrameworkMBeanExt.OBJECTNAME);
-      return MBeanProxy.get(getMBeanServer(), oname, FrameworkMBeanExt.class);
-   }
-   
-   protected BundleStateMBean getBundleStateMBean() throws Exception
-   {
-      ObjectName oname = ObjectNameFactory.create(BundleStateMBean.OBJECTNAME);
-      return MBeanProxy.get(getMBeanServer(), oname, BundleStateMBean.class);
-   }
-   
-   protected ServiceStateMBeanExt getServiceStateMBean() throws Exception
-   {
-      ObjectName oname = ObjectNameFactory.create(ServiceStateMBeanExt.OBJECTNAME);
-      return MBeanProxy.get(getMBeanServer(), oname, ServiceStateMBeanExt.class);
-   }
-   
-   protected MBeanServer getMBeanServer()
-   {
-      if (server == null)
-      {
-         ArrayList<MBeanServer> serverArr = MBeanServerFactory.findMBeanServer(null);
-         if (serverArr.size() > 1)
-            throw new IllegalStateException("Multiple MBeanServer instances not supported");
-
-         if (serverArr.size() == 1)
-            server = serverArr.get(0);
-
-         if (server == null)
-            server = MBeanServerFactory.createMBeanServer();
-      }
-      return server;
-   }
-}
\ No newline at end of file

Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/impl/src/test/java/org/jboss/test/osgi/jmx/BundleStateTestCase.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/osgi/jmx/BundleStateTestCase.java	2010-04-06 07:41:11 UTC (rev 103561)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/impl/src/test/java/org/jboss/test/osgi/jmx/BundleStateTestCase.java	2010-04-06 10:25:15 UTC (rev 103562)
@@ -41,7 +41,7 @@
  * @author thomas.diesler at jboss.com
  * @since 23-Feb-2010
  */
-public class BundleStateTestCase extends AbstractTestCase
+public class BundleStateTestCase extends AbstractJMXTestCase
 {
    @Test
    public void testMBeanAccess() throws Exception
@@ -53,7 +53,7 @@
    @Test
    public void listBundles() throws Exception
    {
-      Bundle[] bundles = getSystemContext().getBundles();
+      Bundle[] bundles = systemContext.getBundles();
       BundleStateMBean bundleState = getBundleStateMBean();
       TabularData data = bundleState.listBundles();
       assertEquals("Number of bundles", bundles.length, data.size());

Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/impl/src/test/java/org/jboss/test/osgi/jmx/FrameworkTestCase.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/osgi/jmx/FrameworkTestCase.java	2010-04-06 07:41:11 UTC (rev 103561)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/impl/src/test/java/org/jboss/test/osgi/jmx/FrameworkTestCase.java	2010-04-06 10:25:15 UTC (rev 103562)
@@ -38,7 +38,7 @@
  * @author thomas.diesler at jboss.com
  * @since 23-Feb-2010
  */
-public class FrameworkTestCase extends AbstractTestCase
+public class FrameworkTestCase extends AbstractJMXTestCase
 {
    @Test
    public void testMBeanAccess() throws Exception

Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/impl/src/test/java/org/jboss/test/osgi/jmx/ServiceStateTestCase.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/osgi/jmx/ServiceStateTestCase.java	2010-04-06 07:41:11 UTC (rev 103561)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/impl/src/test/java/org/jboss/test/osgi/jmx/ServiceStateTestCase.java	2010-04-06 10:25:15 UTC (rev 103562)
@@ -43,12 +43,12 @@
  * @author thomas.diesler at jboss.com
  * @since 23-Feb-2010
  */
-public class ServiceStateTestCase extends AbstractTestCase
+public class ServiceStateTestCase extends AbstractJMXTestCase
 {
    @Test
    public void listServices() throws Exception
    {
-      ServiceReference[] srefs = getSystemContext().getServiceReferences(null, null);
+      ServiceReference[] srefs = systemContext.getServiceReferences(null, null);
       
       ServiceStateMBeanExt serviceState = getServiceStateMBean();
       TabularData data = serviceState.listServices();
@@ -75,7 +75,7 @@
    @Test
    public void getServices() throws Exception
    {
-      ServiceReference sref = getSystemContext().getServiceReference(MBeanServer.class.getName());
+      ServiceReference sref = systemContext.getServiceReference(MBeanServer.class.getName());
       Long serviceID = (Long)sref.getProperty(Constants.SERVICE_ID);
       
       ServiceStateMBeanExt serviceState = getServiceStateMBean();

Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/impl/src/test/resources/jboss-osgi-framework.properties
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/resources/jboss-osgi-framework.properties	2010-04-06 07:41:11 UTC (rev 103561)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/impl/src/test/resources/jboss-osgi-framework.properties	2010-04-06 10:25:15 UTC (rev 103562)
@@ -32,5 +32,4 @@
 org.jboss.osgi.spi.framework.autoStart=\
 	file://${test.archive.directory}/bundles/org.apache.felix.log.jar \
 	file://${test.archive.directory}/bundles/jboss-osgi-common.jar \
-	file://${test.archive.directory}/bundles/org.apache.aries.jmx.jar \
-	file://${test.archive.directory}/bundles/jboss-osgi-jmx.jar	
\ No newline at end of file
+	file://${test.archive.directory}/bundles/org.apache.aries.jmx.jar
\ No newline at end of file

Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml	2010-04-06 07:41:11 UTC (rev 103561)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml	2010-04-06 10:25:15 UTC (rev 103562)
@@ -48,8 +48,8 @@
   </properties>
   
   <modules>
-    <module>jmx-api</module>
-    <module>jmx-bundle</module>
+    <module>api</module>
+    <module>impl</module>
   </modules>
   
   <!-- Dependencies -->



More information about the jboss-osgi-commits mailing list