[jboss-cvs] JBossAS SVN: r75368 - in branches/JBPAPP_4_2_0_GA_CP: testsuite/imports/sections and 5 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jul 4 01:34:57 EDT 2008


Author: jiwils
Date: 2008-07-04 01:34:57 -0400 (Fri, 04 Jul 2008)
New Revision: 75368

Added:
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/mbean/
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/mbean/SimpleService.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/mbean/SimpleServiceMBean.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/util/twiddle/
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/util/twiddle/jboss-service.xml
Removed:
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/mbean/SimpleService.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/mbean/SimpleServiceMBean.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/util/twiddle/jboss-service.xml
Modified:
   branches/JBPAPP_4_2_0_GA_CP/console/src/main/org/jboss/console/twiddle/command/InvokeCommand.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/util.xml
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/util/test/TwiddleUnitTestCase.java
Log:
JBPAPP-891: print out 'invoke' results, even when no property editor is found.

Modified: branches/JBPAPP_4_2_0_GA_CP/console/src/main/org/jboss/console/twiddle/command/InvokeCommand.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/console/src/main/org/jboss/console/twiddle/command/InvokeCommand.java	2008-07-04 05:26:27 UTC (rev 75367)
+++ branches/JBPAPP_4_2_0_GA_CP/console/src/main/org/jboss/console/twiddle/command/InvokeCommand.java	2008-07-04 05:34:57 UTC (rev 75368)
@@ -40,7 +40,8 @@
  * Invoke an operation on an MBean.
  *
  * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @author Scott.Stark at jboss.org
+ * @author <a href="mailto:scott.stark at jboss.org">Scott Stark</a>
+ * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
  * @version <tt>$Revision$</tt>
  */
 public class InvokeCommand
@@ -241,10 +242,18 @@
 
          if (result != null)
          {
-            PropertyEditor editor = PropertyEditors.getEditor(result.getClass());
-            editor.setValue(result);
-            resultText = editor.getAsText();
-            log.debug("Converted result: " + resultText);
+            try
+            {
+               PropertyEditor editor = PropertyEditors.getEditor(result.getClass());
+               editor.setValue(result);
+               resultText = editor.getAsText();
+               log.debug("Converted result: " + resultText);
+            }
+            catch (RuntimeException e)
+            {
+               // No property editor found or some conversion problem
+               resultText = result.toString();
+            }
          }
          else
          {

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/util.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/util.xml	2008-07-04 05:26:27 UTC (rev 75367)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/util.xml	2008-07-04 05:34:57 UTC (rev 75368)
@@ -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>

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/mbean (from rev 71233, branches/Branch_4_2/testsuite/src/main/org/jboss/test/util/mbean)

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/mbean/SimpleService.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/util/mbean/SimpleService.java	2008-03-25 09:01:23 UTC (rev 71233)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/mbean/SimpleService.java	2008-07-04 05:34:57 UTC (rev 75368)
@@ -1,55 +0,0 @@
-/*
- * 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

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/mbean/SimpleService.java (from rev 71233, branches/Branch_4_2/testsuite/src/main/org/jboss/test/util/mbean/SimpleService.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/mbean/SimpleService.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/mbean/SimpleService.java	2008-07-04 05:34:57 UTC (rev 75368)
@@ -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

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/mbean/SimpleServiceMBean.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/util/mbean/SimpleServiceMBean.java	2008-03-25 09:01:23 UTC (rev 71233)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/mbean/SimpleServiceMBean.java	2008-07-04 05:34:57 UTC (rev 75368)
@@ -1,43 +0,0 @@
-/*
- * 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

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/mbean/SimpleServiceMBean.java (from rev 71233, branches/Branch_4_2/testsuite/src/main/org/jboss/test/util/mbean/SimpleServiceMBean.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/mbean/SimpleServiceMBean.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/mbean/SimpleServiceMBean.java	2008-07-04 05:34:57 UTC (rev 75368)
@@ -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: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/util/test/TwiddleUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/util/test/TwiddleUnitTestCase.java	2008-07-04 05:26:27 UTC (rev 75367)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/util/test/TwiddleUnitTestCase.java	2008-07-04 05:34:57 UTC (rev 75368)
@@ -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.

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/util/twiddle (from rev 71233, branches/Branch_4_2/testsuite/src/resources/util/twiddle)

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/util/twiddle/jboss-service.xml
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/util/twiddle/jboss-service.xml	2008-03-25 09:01:23 UTC (rev 71233)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/util/twiddle/jboss-service.xml	2008-07-04 05:34:57 UTC (rev 75368)
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<server>
-
-   <mbean code="org.jboss.test.util.mbean.SimpleService"
-      name="test:service=SimpleService">
-   </mbean>
-
-</server>

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/util/twiddle/jboss-service.xml (from rev 71233, branches/Branch_4_2/testsuite/src/resources/util/twiddle/jboss-service.xml)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/util/twiddle/jboss-service.xml	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/util/twiddle/jboss-service.xml	2008-07-04 05:34:57 UTC (rev 75368)
@@ -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