Re: problems generating Clojure scripts

Bill Smith <[email protected]> Sat, 24 Mar 2012 17:11:44 -0500
Newsgroups gmane.comp.java.grinder.devel
Message-ID <CAKyDFRyb2uHD0jVUWLEBR7mkO0HwGX8xVZU1-ezU_ob=QDcuLg@mail.gmail.com>
Attached is a patch for three problems with how the TCP proxy generates
Clojure scripts.  (I am trying to follow the process outlined at
http://grinder.sourceforge.net/development/contributing.html#How+to+give+back.
 This is my first time to use Git and to submit patches here.  I am
comfortable with the fix, but I apologize in advance if I am not submitting
the patch correctly.)

My employer (Tango Health) and I are happy for this work to be distributed
under the terms of The Grinder
license<http://grinder.sourceforge.net/license.html>
.

On Fri, Mar 23, 2012 at 1:10 PM, Bill Smith <[email protected]>wrote:

> I found a couple of problems with how the TCP proxy generates Clojure
> scripts.  First, it uses the wrong syntax for method calls.  For example,
> it does this:
>
>    (. valueFromHiddenInput httpUtilities "an Xpath")
>
> when it should do this:
>
>    (.valueFromHiddenInput httpUtilities "an Xpath")
>
> Second, it neglects to end a comment with a linefeed.  For example, it
> does this:
>
>    (set-token :token_cx (.valueFromHiddenInput httpUtilities
> "//g:token[@token-id=$token-id]/g:name")
> ;"012652707207066138651:zudjtuwe28q")
>
> when it should do this:
>
>    (set-token :token_cx (.valueFromHiddenInput httpUtilities
> "//g:token[@token-id=$token-id]/g:name"))
> ;"012652707207066138651:zudjtuwe28q"
>
> or alternatively this:
>
>    (set-token :token_cx (.valueFromHiddenInput httpUtilities
> "//g:token[@token-id=$token-id]/g:name")
> ;"012652707207066138651:zudjtuwe28q"
>     )
>
> Shall I submit a fix?

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure

_______________________________________________
Grinder-development mailing list
Grinder-development-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/grinder-development
0001-Fix-method-invocation-syntax-make-sure-comments-end-.patch (text/x-patch, 2 KB)
From 6992de6db9d8471f7a2b1684a57d6acb2acaaf8e Mon Sep 17 00:00:00 2001
From: Bill Smith <[email protected]>
Date: Sat, 24 Mar 2012 16:58:07 -0500
Subject: [PATCH] Fix method invocation syntax, make sure comments end in a
 newline, and fix a broken match expression.

---
 .../resources/httpToClojureScript.xsl              |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/grinder-http/src/main/resources/net/grinder/plugin/http/tcpproxyfilter/resources/httpToClojureScript.xsl b/grinder-http/src/main/resources/net/grinder/plugin/http/tcpproxyfilter/resources/httpToClojureScript.xsl
index 2653f3f..9b36ac4 100644
--- a/grinder-http/src/main/resources/net/grinder/plugin/http/tcpproxyfilter/resources/httpToClojureScript.xsl
+++ b/grinder-http/src/main/resources/net/grinder/plugin/http/tcpproxyfilter/resources/httpToClojureScript.xsl
@@ -434,7 +434,7 @@
     <xsl:apply-templates select=".//g:conflicting-value" mode="request"/>
 
     <xsl:variable name="token-id" select="@token-id"/>
-    <xsl:variable name="name" select="'//g:token[@token-id=$token-id]/g:name'"/>
+    <xsl:variable name="name" select="//g:token[@token-id=$token-id]/g:name"/>
 
     <xsl:value-of select="helper:newLineAndIndent()"/>
     <xsl:text>(set-token :</xsl:text>
@@ -449,10 +449,10 @@
             <xsl:text>(.valueFromLocationURI</xsl:text>
           </xsl:when>
           <xsl:when test="@source = 'RESPONSE_BODY_HIDDEN_INPUT'">
-            <xsl:text>(. valueFromHiddenInput</xsl:text>
+            <xsl:text>(.valueFromHiddenInput</xsl:text>
           </xsl:when>
           <xsl:otherwise>
-            <xsl:text>(. valueFromBodyURI</xsl:text>
+            <xsl:text>(.valueFromBodyURI</xsl:text>
           </xsl:otherwise>
         </xsl:choose>
 
@@ -463,6 +463,8 @@
 
         <xsl:text> ; </xsl:text>
         <xsl:value-of select="helper:quoteForClojure(helper:summariseAsLine(g:new-value, 40))"/>
+	<xsl:text>
+	</xsl:text>
       </xsl:when>
 
       <xsl:otherwise>
-- 
1.7.5.4