[jboss-cvs] JBossAS SVN: r71236 - in trunk/testsuite: src/main/org/jboss/test/util and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Mar 25 05:30:14 EDT 2008


Author: dimitris at jboss.org
Date: 2008-03-25 05:30:13 -0400 (Tue, 25 Mar 2008)
New Revision: 71236

Added:
   trunk/testsuite/src/main/org/jboss/test/util/mbean/
   trunk/testsuite/src/main/org/jboss/test/util/mbean/SimpleService.java
   trunk/testsuite/src/main/org/jboss/test/util/mbean/SimpleServiceMBean.java
   trunk/testsuite/src/resources/util/twiddle/
   trunk/testsuite/src/resources/util/twiddle/jboss-service.xml
Modified:
   trunk/testsuite/imports/sections/util.xml
   trunk/testsuite/src/main/org/jboss/test/util/test/TwiddleUnitTestCase.java
Log:
JBAS-5108, print out 'invoke' results, even when no property editor is found.

Modified: trunk/testsuite/imports/sections/util.xml
===================================================================
--- trunk/testsuite/imports/sections/util.xml	2008-03-25 09:29:59 UTC (rev 71235)
+++ trunk/testsuite/imports/sections/util.xml	2008-03-25 09:30:13 UTC (rev 71236)
@@ -26,5 +26,14 @@
             <include name="scheduler.sar"/>
          </fileset>
       </ear>
+      <!-- The twiddle-test.sar -->
+      <jar destfile="${build.lib}/twiddle-test.sar">
+         <metainf dir="${build.resources}/util/twiddle">
+            <include name="jboss-service.xml"/>
+         </metainf>
+         <fileset dir="${build.classes}">
+            <include name="org/jboss/test/util/mbean/**"/>
+         </fileset>
+      </jar>      
    </target>
 </project>

Added: trunk/testsuite/src/main/org/jboss/test/util/mbean/SimpleService.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/util/mbean/SimpleService.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/util/mbean/SimpleService.java	2008-03-25 09:30:13 UTC (rev 71236)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.util.mbean;
+
+import java.util.HashMap;
+
+/**
+ * A simple mbean.
+ * 
+ * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
+ * @version $Revision: 57211 $
+ */
+public class SimpleService implements SimpleServiceMBean
+{
+   private HashMap hm = new HashMap();
+   
+   public SimpleService()
+   {
+      hm.put("key1", "value1");
+   }
+   
+   public HashMap getHashMapAttr()
+   {
+      return hm;
+   }
+   
+   public void setHashMapAttr(HashMap hm)
+   {
+      this.hm = hm;
+   }
+   
+   public HashMap showHashMapAttr()
+   {
+      return hm;
+   }
+}
\ No newline at end of file

Added: trunk/testsuite/src/main/org/jboss/test/util/mbean/SimpleServiceMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/util/mbean/SimpleServiceMBean.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/util/mbean/SimpleServiceMBean.java	2008-03-25 09:30:13 UTC (rev 71236)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.util.mbean;
+
+import java.util.HashMap;
+
+/**
+ * A simple mbean.
+ * 
+ * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
+ * @version $Revision: 57211 $
+ */
+public interface SimpleServiceMBean
+{
+   // Attributes ----------------------------------------------------
+   
+   /** A HashMap attribute */
+   HashMap getHashMapAttr();
+   void setHashMapAttr(HashMap hashMap);
+   
+   // Operations ----------------------------------------------------
+   
+   HashMap showHashMapAttr();
+}
\ No newline at end of file

Modified: trunk/testsuite/src/main/org/jboss/test/util/test/TwiddleUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/util/test/TwiddleUnitTestCase.java	2008-03-25 09:29:59 UTC (rev 71235)
+++ trunk/testsuite/src/main/org/jboss/test/util/test/TwiddleUnitTestCase.java	2008-03-25 09:30:13 UTC (rev 71236)
@@ -21,11 +21,9 @@
  */
 package org.jboss.test.util.test;
 
-import java.io.BufferedInputStream;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
-
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -38,7 +36,8 @@
 /**
  * Unit tests for the Twiddle command line utility.
  *
- * @author  <a href="mailto:stan at jboss.org">Stan Silvert</a>
+ * @author <a href="mailto:stan at jboss.org">Stan Silvert</a>
+ * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
  */
 public class TwiddleUnitTestCase extends JBossTestCase
 {
@@ -74,6 +73,25 @@
   }
 
   /**
+   * Test invoking an operation on an MBean
+   */
+  public void testInvoke() throws Exception
+  {
+     try
+     {
+        // JBAS-5108 - check also that returned objects without
+        // an available property editor are printed out 
+        deploy("twiddle-test.sar");
+        String result = runTwiddle("invoke", "\"test:service=SimpleService\"", "showHashMapAttr");
+        assertTrue(result.indexOf("Exec failed") == -1);
+     }
+     finally
+     {
+        undeploy("twiddle-test.sar");
+     }
+  }
+  
+  /**
    * Run twiddle with the given arguments. This method relies on finding the twiddle
    * bat or sh file using the jboss.dist system property. It will automatically pass
    * in the -s parameter for the host of the server being used for testing.

Added: trunk/testsuite/src/resources/util/twiddle/jboss-service.xml
===================================================================
--- trunk/testsuite/src/resources/util/twiddle/jboss-service.xml	                        (rev 0)
+++ trunk/testsuite/src/resources/util/twiddle/jboss-service.xml	2008-03-25 09:30:13 UTC (rev 71236)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<server>
+
+   <mbean code="org.jboss.test.util.mbean.SimpleService"
+      name="test:service=SimpleService">
+   </mbean>
+
+</server>




More information about the jboss-cvs-commits mailing list