aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r1222663 - in /aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework: BundleStateMBeanTest.java PackageStateMBeanTest.java ServiceStateMBeanTest.java wiring/BundleWiringStateMBeanTest.java
Date Fri, 23 Dec 2011 12:50:38 GMT
Author: davidb
Date: Fri Dec 23 12:50:37 2011
New Revision: 1222663

URL: http://svn.apache.org/viewvc?rev=1222663&view=rev
Log:
Added tests for object name structure.

Modified:
    aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/BundleStateMBeanTest.java
    aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/PackageStateMBeanTest.java
    aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/ServiceStateMBeanTest.java
    aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/wiring/BundleWiringStateMBeanTest.java

Modified: aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/BundleStateMBeanTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/BundleStateMBeanTest.java?rev=1222663&r1=1222662&r2=1222663&view=diff
==============================================================================
--- aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/BundleStateMBeanTest.java
(original)
+++ aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/BundleStateMBeanTest.java
Fri Dec 23 12:50:37 2011
@@ -35,9 +35,11 @@ import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
+import java.util.Set;
 
 import javax.management.Notification;
 import javax.management.NotificationListener;
@@ -145,6 +147,16 @@ public class BundleStateMBeanTest extend
     }
 
     @Test
+    public void testObjectName() throws Exception {
+        Set<ObjectName> names = mbeanServer.queryNames(new ObjectName(BundleStateMBean.OBJECTNAME
+ ",*"), null);
+        assertEquals(1, names.size());
+        ObjectName name = names.iterator().next();
+        Hashtable<String, String> props = name.getKeyPropertyList();
+        assertEquals(context().getProperty(Constants.FRAMEWORK_UUID), props.get("uuid"));
+        assertEquals(context().getBundle(0).getSymbolicName(), props.get("framework"));
+    }
+
+    @Test
     public void testMBeanInterface() throws Exception {
         ObjectName objectName = waitForMBean(new ObjectName(BundleStateMBean.OBJECTNAME));
 

Modified: aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/PackageStateMBeanTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/PackageStateMBeanTest.java?rev=1222663&r1=1222662&r2=1222663&view=diff
==============================================================================
--- aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/PackageStateMBeanTest.java
(original)
+++ aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/PackageStateMBeanTest.java
Fri Dec 23 12:50:37 2011
@@ -27,6 +27,8 @@ import static org.junit.Assert.assertTru
 
 import java.io.IOException;
 import java.util.Collection;
+import java.util.Hashtable;
+import java.util.Set;
 
 import javax.management.ObjectName;
 import javax.management.openmbean.TabularData;
@@ -37,6 +39,7 @@ import org.ops4j.pax.exam.CoreOptions;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.container.def.PaxRunnerOptions;
 import org.ops4j.pax.exam.junit.Configuration;
+import org.osgi.framework.Constants;
 import org.osgi.jmx.framework.PackageStateMBean;
 
 /**
@@ -64,6 +67,16 @@ public class PackageStateMBeanTest exten
     }
 
     @Test
+    public void testObjectName() throws Exception {
+        Set<ObjectName> names = mbeanServer.queryNames(new ObjectName(PackageStateMBean.OBJECTNAME
+ ",*"), null);
+        assertEquals(1, names.size());
+        ObjectName name = names.iterator().next();
+        Hashtable<String, String> props = name.getKeyPropertyList();
+        assertEquals(context().getProperty(Constants.FRAMEWORK_UUID), props.get("uuid"));
+        assertEquals(context().getBundle(0).getSymbolicName(), props.get("framework"));
+    }
+
+    @Test
     public void testMBeanInterface() throws IOException {
         PackageStateMBean packagaState = getMBean(PackageStateMBean.OBJECTNAME, PackageStateMBean.class);
         assertNotNull(packagaState);

Modified: aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/ServiceStateMBeanTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/ServiceStateMBeanTest.java?rev=1222663&r1=1222662&r2=1222663&view=diff
==============================================================================
--- aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/ServiceStateMBeanTest.java
(original)
+++ aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/ServiceStateMBeanTest.java
Fri Dec 23 12:50:37 2011
@@ -33,6 +33,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashSet;
+import java.util.Hashtable;
 import java.util.List;
 import java.util.Set;
 
@@ -127,6 +128,16 @@ public class ServiceStateMBeanTest exten
     }
 
     @Test
+    public void testObjectName() throws Exception {
+        Set<ObjectName> names = mbeanServer.queryNames(new ObjectName(ServiceStateMBean.OBJECTNAME
+ ",*"), null);
+        assertEquals(1, names.size());
+        ObjectName name = names.iterator().next();
+        Hashtable<String, String> props = name.getKeyPropertyList();
+        assertEquals(context().getProperty(Constants.FRAMEWORK_UUID), props.get("uuid"));
+        assertEquals(context().getBundle(0).getSymbolicName(), props.get("framework"));
+    }
+
+    @Test
     public void testMBeanInterface() throws Exception {
         ObjectName objectName = waitForMBean(new ObjectName(ServiceStateMBean.OBJECTNAME));
 

Modified: aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/wiring/BundleWiringStateMBeanTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/wiring/BundleWiringStateMBeanTest.java?rev=1222663&r1=1222662&r2=1222663&view=diff
==============================================================================
--- aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/wiring/BundleWiringStateMBeanTest.java
(original)
+++ aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/wiring/BundleWiringStateMBeanTest.java
Fri Dec 23 12:50:37 2011
@@ -19,6 +19,7 @@ package org.apache.aries.jmx.framework.w
 import static org.apache.aries.itest.ExtraOptions.mavenBundle;
 import static org.apache.aries.itest.ExtraOptions.paxLogging;
 import static org.apache.aries.itest.ExtraOptions.testOptions;
+import static org.junit.Assert.assertEquals;
 import static org.ops4j.pax.exam.CoreOptions.provision;
 import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.newBundle;
 import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.withBnd;
@@ -27,6 +28,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -117,6 +119,16 @@ public class BundleWiringStateMBeanTest 
     }
 
     @Test
+    public void testObjectName() throws Exception {
+        Set<ObjectName> names = mbeanServer.queryNames(new ObjectName(BundleWiringStateMBean.OBJECTNAME
+ ",*"), null);
+        assertEquals(1, names.size());
+        ObjectName name = names.iterator().next();
+        Hashtable<String, String> props = name.getKeyPropertyList();
+        assertEquals(context().getProperty(Constants.FRAMEWORK_UUID), props.get("uuid"));
+        assertEquals(context().getBundle(0).getSymbolicName(), props.get("framework"));
+    }
+
+    @Test
     public void testGetCurrentRevisionDeclaredRequirements() throws Exception {
         BundleWiringStateMBean brsMBean = getMBean(BundleWiringStateMBean.OBJECTNAME, BundleWiringStateMBean.class);
 



Mime
View raw message