karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject svn commit: r1546595 - /karaf/trunk/itests/src/test/java/org/apache/karaf/itests/InstanceTest.java
Date Fri, 29 Nov 2013 16:08:00 GMT
Author: jbonofre
Date: Fri Nov 29 16:08:00 2013
New Revision: 1546595

URL: http://svn.apache.org/r1546595
Log:
Add an itest on instanceRename operation via InstanceMBean

Modified:
    karaf/trunk/itests/src/test/java/org/apache/karaf/itests/InstanceTest.java

Modified: karaf/trunk/itests/src/test/java/org/apache/karaf/itests/InstanceTest.java
URL: http://svn.apache.org/viewvc/karaf/trunk/itests/src/test/java/org/apache/karaf/itests/InstanceTest.java?rev=1546595&r1=1546594&r2=1546595&view=diff
==============================================================================
--- karaf/trunk/itests/src/test/java/org/apache/karaf/itests/InstanceTest.java (original)
+++ karaf/trunk/itests/src/test/java/org/apache/karaf/itests/InstanceTest.java Fri Nov 29
16:08:00 2013
@@ -53,7 +53,8 @@ public class InstanceTest extends KarafT
             connection.invoke(name, "destroyInstance", new Object[]{ "itest2" }, new String[]{
"java.lang.String" });
             Assert.assertEquals(oldNum, getInstancesNum(connection, name));
         } finally {
-        	close(connector);
+            if (connector != null)
+        	    close(connector);
         }
     }
 
@@ -94,4 +95,20 @@ public class InstanceTest extends KarafT
         assertTrue(instanceListOutput.contains("new_itest"));
     }
 
+    @Test
+    public void renameViaMBean() throws Exception {
+        JMXConnector connector = null;
+        try {
+            connector = this.getJMXConnector();
+            MBeanServerConnection connection = connector.getMBeanServerConnection();
+            ObjectName name = new ObjectName("org.apache.karaf:type=instance,name=root");
+            connection.invoke(name, "createInstance", new Object[]{ "itest5", 0, 0, 0, null,
null, null, null },
+                    new String[]{ "java.lang.String", "int", "int", "int", "java.lang.String",
"java.lang.String", "java.lang.String", "java.lang.String" });
+            connection.invoke(name, "renameInstance", new Object[]{ "itest5", "new_itest5"
}, new String[]{ "java.lang.String", "java.lang.String" });
+        } finally {
+            if (connector != null)
+                connector.close();
+        }
+    }
+
 }



Mime
View raw message