[jboss-svn-commits] JBL Code SVN: r27341 - in labs/jbosstm/workspace/adinn/byteman/trunk: tests and 4 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Jun 30 09:44:19 EDT 2009


Author: adinn
Date: 2009-06-30 09:44:18 -0400 (Tue, 30 Jun 2009)
New Revision: 27341

Added:
   labs/jbosstm/workspace/adinn/byteman/trunk/tests/dd/scripts/bugfixes/
   labs/jbosstm/workspace/adinn/byteman/trunk/tests/dd/scripts/bugfixes/TestEmptySignature.txt
   labs/jbosstm/workspace/adinn/byteman/trunk/tests/src/org/jboss/byteman/tests/bugfixes/
   labs/jbosstm/workspace/adinn/byteman/trunk/tests/src/org/jboss/byteman/tests/bugfixes/TestEmptySignature.java
Modified:
   labs/jbosstm/workspace/adinn/byteman/trunk/src/org/jboss/byteman/agent/Location.java
   labs/jbosstm/workspace/adinn/byteman/trunk/tests/build.xml
Log:
fixed problem processing empty signature in AT/AFTER CALL locations and added test case for it

Modified: labs/jbosstm/workspace/adinn/byteman/trunk/src/org/jboss/byteman/agent/Location.java
===================================================================
--- labs/jbosstm/workspace/adinn/byteman/trunk/src/org/jboss/byteman/agent/Location.java	2009-06-30 13:24:27 UTC (rev 27340)
+++ labs/jbosstm/workspace/adinn/byteman/trunk/src/org/jboss/byteman/agent/Location.java	2009-06-30 13:44:18 UTC (rev 27341)
@@ -411,19 +411,27 @@
             if (text.contains(")")) {
                 int tailIdx = text.lastIndexOf(")");
                 String countText = text.substring(tailIdx + 1).trim();
-                try {
-                    count = Integer.valueOf(countText);
-                } catch (NumberFormatException nfe) {
-                    return null;
+                if (!countText.equals("")) {
+                    try {
+                        count = Integer.valueOf(countText);
+                    } catch (NumberFormatException nfe) {
+                        return null;
+                    }
+                } else {
+                    count = 1;
                 }
                 text = text.substring(0, tailIdx).trim();
             } else if (text.contains(" ")) {
                 int tailIdx = text.lastIndexOf(" ");
                 String countText = text.substring(tailIdx + 1).trim();
-                try {
-                    count = Integer.valueOf(countText);
-                } catch (NumberFormatException nfe) {
-                    return null;
+                if (!countText.equals("")) {
+                    try {
+                        count = Integer.valueOf(countText);
+                    } catch (NumberFormatException nfe) {
+                        return null;
+                    }
+                } else {
+                    count = 1;
                 }
                 text = text.substring(0, tailIdx).trim();
             } else {

Modified: labs/jbosstm/workspace/adinn/byteman/trunk/tests/build.xml
===================================================================
--- labs/jbosstm/workspace/adinn/byteman/trunk/tests/build.xml	2009-06-30 13:24:27 UTC (rev 27340)
+++ labs/jbosstm/workspace/adinn/byteman/trunk/tests/build.xml	2009-06-30 13:44:18 UTC (rev 27341)
@@ -71,10 +71,7 @@
        <delete dir="${build.dir}"/>
     </target>
 
-    <!--
-    <target name="tests" depends="jar, tests.location, tests.location.compiled, tests.javaops, tests.javaops.compiled"/>
-    -->
-    <target name="tests" depends="jar, tests.location, tests.location.compiled, tests.javaops, tests.javaops.compiled"/>
+    <target name="tests" depends="jar, tests.location, tests.location.compiled, tests.javaops, tests.javaops.compiled, tests.bugfixes, tests.bugfixes.compiled"/>
 
     <target name="tests.location">
         <junit fork="true" showoutput="true">
@@ -367,4 +364,51 @@
         </junit>
     </target>
 
+    <target name="tests.bugfixes">
+          <junit fork="true" showoutput="true">
+            <classpath>
+                <pathelement location="${build.lib.dir}/byteman-tests.jar"/>
+                <pathelement location="${junit.home}/${junit.jar}"/>
+            </classpath>
+            <jvmarg value="-javaagent:${byteman.home}/${byteman.jar}=script:${scripts.dir}/bugfixes/TestEmptySignature.txt"/>
+            <!-- uncomment for verbose byteman output
+            <jvmarg value="-Dorg.jboss.byteman.verbose"/>
+            -->
+            <!-- uncomment to dump generated code
+            <jvmarg value="-Dorg.jboss.byteman.dump.generated.classes"/>
+            <jvmarg value="-Dorg.jboss.byteman.dump.generated.classes.directory=dump"/>
+            -->
+            <!-- uncomment to enable debug
+            <jvmarg value="-Xdebug"/>
+            <jvmarg  value="-Xnoagent"/>
+            <jvmarg  value="-Djava.compiler=NONE"/>
+            <jvmarg  value="-Xrunjdwp:transport=dt_socket,server=n,suspend=y,address=5005"/>
+            -->
+            <test name="org.jboss.byteman.tests.bugfixes.TestEmptySignature"/>
+        </junit>
+  </target>
+    <target name="tests.bugfixes.compiled">
+          <junit fork="true" showoutput="true">
+            <classpath>
+                <pathelement location="${build.lib.dir}/byteman-tests.jar"/>
+                <pathelement location="${junit.home}/${junit.jar}"/>
+            </classpath>
+            <jvmarg value="-javaagent:${byteman.home}/${byteman.jar}=script:${scripts.dir}/bugfixes/TestEmptySignature.txt"/>
+            <jvmarg value="-Dorg.jboss.byteman.compileToBytecode"/>
+            <!-- uncomment for verbose byteman output
+            <jvmarg value="-Dorg.jboss.byteman.verbose"/>
+            -->
+            <!-- uncomment to dump generated code
+            <jvmarg value="-Dorg.jboss.byteman.dump.generated.classes"/>
+            <jvmarg value="-Dorg.jboss.byteman.dump.generated.classes.directory=dump"/>
+            -->
+            <!-- uncomment to enable debug
+            <jvmarg value="-Xdebug"/>
+            <jvmarg  value="-Xnoagent"/>
+            <jvmarg  value="-Djava.compiler=NONE"/>
+            <jvmarg  value="-Xrunjdwp:transport=dt_socket,server=n,suspend=y,address=5005"/>
+            -->
+            <test name="org.jboss.byteman.tests.bugfixes.TestEmptySignature"/>
+        </junit>
+  </target>
 </project>

Copied: labs/jbosstm/workspace/adinn/byteman/trunk/tests/dd/scripts/bugfixes/TestEmptySignature.txt (from rev 27147, labs/jbosstm/workspace/adinn/byteman/trunk/tests/dd/scripts/javaops/TestArithmetic.txt)
===================================================================
--- labs/jbosstm/workspace/adinn/byteman/trunk/tests/dd/scripts/bugfixes/TestEmptySignature.txt	                        (rev 0)
+++ labs/jbosstm/workspace/adinn/byteman/trunk/tests/dd/scripts/bugfixes/TestEmptySignature.txt	2009-06-30 13:44:18 UTC (rev 27341)
@@ -0,0 +1,33 @@
+##############################################################################
+# JBoss, Home of Professional Open Source
+# Copyright 2009, Red Hat Middleware LLC, and individual contributors
+# 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.
+#
+# @authors Andrew Dinn
+#
+
+RULE test empty signature
+CLASS TestEmptySignature
+METHOD test
+HELPER org.jboss.byteman.tests.helpers.Default
+AFTER CALL emptySignature()
+BIND test : TestEmptySignature = $0
+IF TRUE
+DO test.log("AFTER CALL emptySignature()")
+ENDRULE

Copied: labs/jbosstm/workspace/adinn/byteman/trunk/tests/src/org/jboss/byteman/tests/bugfixes/TestEmptySignature.java (from rev 27147, labs/jbosstm/workspace/adinn/byteman/trunk/tests/src/org/jboss/byteman/tests/location/TestCall.java)
===================================================================
--- labs/jbosstm/workspace/adinn/byteman/trunk/tests/src/org/jboss/byteman/tests/bugfixes/TestEmptySignature.java	                        (rev 0)
+++ labs/jbosstm/workspace/adinn/byteman/trunk/tests/src/org/jboss/byteman/tests/bugfixes/TestEmptySignature.java	2009-06-30 13:44:18 UTC (rev 27341)
@@ -0,0 +1,68 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* 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.
+*
+* @authors Andrew Dinn
+*/
+package org.jboss.byteman.tests.bugfixes;
+
+import org.jboss.byteman.tests.Test;
+import org.jboss.byteman.tests.location.TestCall;
+import org.jboss.byteman.tests.auxiliary.TestCallThrowSynchAuxiliary;
+
+/**
+ * Test for bug reported by Kabir Khan pre-JIRA where the Transformer failed ot accept a trigger
+ * method specified with an empty argument list.
+ */
+public class TestEmptySignature extends Test
+{
+    public TestEmptySignature()
+    {
+        super(TestEmptySignature.class.getCanonicalName());
+    }
+
+    public void test()
+    {
+        try {
+            log("calling emptySignature()");
+            emptySignature();
+            log("called emptySignature()");
+        } catch (Exception e) {
+            log(e);
+        }
+
+        checkOutput();
+    }
+
+    public void emptySignature()
+    {
+        log("inside emptySignature()");
+    }
+
+    @Override
+    public String getExpected() {
+        logExpected("calling emptySignature()");
+        logExpected("inside emptySignature()");
+        logExpected("AFTER CALL emptySignature()");
+        logExpected("called emptySignature()");
+
+        return super.getExpected();
+    }
+}
\ No newline at end of file




More information about the jboss-svn-commits mailing list