cannot get the value out of the feeder

I have a csv feeder file, which contains only one column, like:
name
tom
jerry

In my scenario, I use this feeder file in the following way:
var myfeeder = csv(“name.csv”)
val scn = scenario(“Name Create”)
.loop(
chain
.feed(myfeeder )
.exec(
myclass(“name create”)
.createName
.name("${name}")
//name(myfeeder.next.apply(“name”))
.check(status.is(200)))).times(2)

The problem is that the value cannot be retrieved from the feeder file. Actually the value passed to the function createName is always “${name}”.
But, if I use the line which has been comment out, I can get the feeder value.

It looks like the example in Gatling is using the EL to map the key/ value. While looking at the source code, I am sure which part is doing this mapping work.
Any hint would be great.

在 2012年7月31日星期二UTC+10下午1时40分59秒,fb写道:

Hi,

In HTTP DSL, methods that resolve a String with the Gatling EL actually take a Session => String function. There’s an implicit defined in core.Predef (stringToSessionFunction) for automatically converting String into Session => String (ie parsing the EL). Then, it’s up to the objects generated by the DSL to resolved this function. The feeder simply pushes data into the Session so it can be retrieved later.

I could be a better help if I knew what you’re trying to achieve exactly. Are your trying to implement your own protocol? Are you trying to write your own DSL on top of Gatling HTTP one?

Cheers,

Stéphane

2012/7/31 fb <au.nicholas.li@gmail.com>

Yes, I am implementing my own protocol.
I can see that the data has been loaded into session through feeder, but it looks like I need to make my own parser to retrieve the value out of session, using EL?

在 2012年7月31日星期二UTC+10下午4时29分48秒,Stéphane Landelle写道:

OK.

Yes, you can use the EL for this.
As I said, if your “name” method take a Session => String parameter, you can pass a String parameter that will be implicitly converted (as long as you import com.excilys.ebi.gatling.core.Predef._ of course). Then it’s your DSL’s job to resolve this function.

Cheers,

Stéphane

2012/7/31 fb <au.nicholas.li@gmail.com>

.exec(
http(“Contact Create”)
.post("/create")
.headers(headers_1)
.body("${contact_create_command}")

But this doesn’t get the feeder value out either.
I am a bit new to Gatling.

在 2012年7月31日星期二UTC+10下午5时37分38秒,fb写道:

Are you really sure? Because it should.
With what you have written, assuming you have a feeder that populates the “contact_create_command” attribute in the Session, Gatling would send a request with the value of this attribute.

2012/7/31 fb <au.nicholas.li@gmail.com>

Hi there,

Did you manage to get it running?

Cheers,

Steph

2012/7/31 Stéphane Landelle <slandelle@excilys.com>

Hi Stéphane,

I have a similar problem with el wich is not resolve with v1.3.4 of Gatling as it used to be with v1.2.5

for exemple code below does not work anymore

regex(""","([0-9 a-z]+-[0-9 a-z]+-[0-9 a-z]+-[0-9 a-z]+-[0-9 a-z]+)","${templateName}",""")

Because templateName is not resolve as el expression despite I can print the value correctly

exec((session: Session) => {
println("templateName : " + session.getAttribute(“templateName”))
session
}
)

the regex is fine if I use the value directly instead of the el expression.

It seems that something is broken somewhere

Hi Stéphane,

I don't think that the problem is the EL not being properly resolved.
I just added the following test to ELParserSpec and it runs perfectly fine:

"jahia test" in {

val session = new Session("scenario", 1, Map("templateName" -> "foo"))

parseEL(""","([0-9 a-z]+\-[0-9 a-z]+\-[0-9 a-z]+\-[0-9 a-z]+\-[0-9
a-z]+)","${templateName}",""")(session) must beEqualTo(""","([0-9
a-z]+\-[0-9 a-z]+\-[0-9 a-z]+\-[0-9 a-z]+\-[0-9 a-z]+)","foo",""")

}

Could you provide more info, please:

   - what does emplateName content look like?
   - what does the reponse body look like?

Cheers,

Stéphane

Hi Stéphane,

the templateName is juste a string with value is “simple” and the response body is a gwt payload :

//OK[1,9,118,162,7,117,161,7,116,-69,115,0,9,114,0,113,6,37,1,0,3,50,165,7,164,7,1,6,14,161,163,0,162,0,0,162,161,107,0,0,10,0,0,0,0,0,3,0,0,106,1,3,0,3,105,1,9,118,158,7,117,157,7,116,-69,115,0,9,114,0,113,6,37,1,0,3,50,0,6,1,157,160,0,159,0,0,158,157,156,0,0,1,1,0,0,0,0,3,0,0,106,1,3,0,3,105,1,9,118,155,7,117,154,7,116,-69,115,0,9,114,0,113,6,37,1,0,3,0,3,0,3,105,1,9,118,137,7,117,136,7,116,-69,115,0,9,114,0,113,6,37,1,0,3,50,0,6,14,136,153,0,152,0,0,137,136,135,1,151,150,149,148,147,141,146,145,144,143,142,11,134,133,1,0,0,0,0,0,1,0,0,3,141,1,0,0,132,1,3,0,1,106,50,-69,140,7,1,6,14,136,139,0,138,0,0,137,136,135,1,66,64,62,60,58,56,6,134,133,1,0,0,0,0,0,1,0,0,3,62,1,0,0,132,1,3,0,1,106,2,3,0,3,105,1,9,118,129,7,117,128,7,116,-69,115,0,9,114,0,113,6,37,1,0,3,50,125,7,124,7,1,6,13,128,131,0,130,0,0,129,128,119,0,0,10,1,0,0,0,0,3,0,0,106,1,3,0,3,105,1,9,118,121,7,117,120,7,116,-69,115,0,9,114,0,113,6,37,1,0,3,50,0,6,1,120,127,0,126,0,1,121,120,119,0,0,1,0,0,0,0,0,3,0,0,106,50,125,7,124,7,1,6,13,120,123,0,122,0,0,121,120,119,0,0,10,1,0,0,0,0,3,0,0,106,2,3,0,3,105,1,9,118,109,7,117,108,7,116,-69,115,0,9,114,0,113,6,37,1,0,3,50,-69,112,7,1,6,14,108,111,1,110,0,0,109,108,107,0,0,10,1,0,0,0,0,3,0,0,106,1,3,0,3,105,7,3,104,7,42,103,7,40,102,7,38,-7,98,-11,97,-11,96,6,37,1,36,101,7,42,100,7,40,99,7,38,-7,98,-11,97,-11,96,6,37,1,36,43,7,42,41,7,40,39,7,38,-7,98,-7,97,-11,96,6,37,1,36,3,3,95,7,51,-69,38,94,7,48,3,37,0,47,93,7,51,-69,38,92,7,48,3,37,0,47,91,7,51,-69,38,90,7,48,3,37,0,47,89,7,51,-69,38,88,7,48,3,37,0,47,87,7,51,-69,38,86,7,48,3,37,0,47,85,7,51,-69,38,84,7,48,3,37,0,47,83,7,51,-69,38,82,7,48,3,37,0,47,81,7,51,-69,38,80,7,48,3,37,0,47,79,7,51,-69,38,78,7,48,3,37,0,47,77,7,51,-69,38,76,7,48,3,37,0,47,75,7,51,-69,38,74,7,48,3,37,0,47,11,3,0,0,46,73,7,72,7,51,-69,38,71,7,48,3,37,0,47,70,7,51,-69,38,69,7,48,3,37,0,47,2,3,0,0,46,68,7,67,7,51,-69,38,66,7,48,3,37,0,47,65,7,51,-69,38,64,7,48,3,37,0,47,63,7,51,-69,38,62,7,48,3,37,0,47,61,7,51,-69,38,60,7,48,3,37,0,47,59,7,51,-69,38,58,7,48,3,37,0,47,57,7,51,-69,38,56,7,48,3,37,0,47,6,3,0,0,46,55,7,54,7,51,-69,38,53,7,48,3,37,0,47,52,7,51,50,7,38,49,7,48,3,37,0,47,2,3,0,0,46,45,7,4,6,44,41,43,7,42,41,7,40,39,7,38,3,37,1,36,0,3,-24,0,3,-6,0,3,-35,0,3,-16,0,3,-23,0,3,-36,0,3,-40,0,3,-22,0,3,-15,0,3,-21,0,3,-37,0,3,-20,12,6,0,6,-24,-24,-6,-6,-35,-35,-16,-16,-23,-23,32,7,-36,-40,-40,-22,-22,-15,-15,-21,-21,-37,-37,-20,-20,12,6,0,35,7,-20,-15,3,3,34,7,33,7,32,7,-24,-23,31,7,-16,-21,-22,-6,9,3,30,7,2,6,117,29,28,27,0,6,1,-7,-15,1,6,26,0,4,103,25,24,24,0,6,1,-7,-15,-7,-20,2,6,5,0,4,117,23,22,22,0,6,1,-7,21,7,-7,20,7,-7,19,7,-7,-15,-7,18,7,-7,17,7,6,6,5,0,4,117,16,15,15,0,6,1,-7,14,7,-7,13,7,2,6,5,0,4,103,12,8,8,0,6,1,0,9,-6,1,6,5,1,4,103,11,10,10,0,6,1,1,9,8,7,1,6,5,0,4,6,3,2,1,[“org.jahia.ajax.gwt.client.data.GWTJahiaCreateEngineInitBean/339348539”,“org.jahia.ajax.gwt.client.data.acl.GWTJahiaNodeACL/65499619”,“java.util.ArrayList/3821976829”,“org.jahia.ajax.gwt.client.data.acl.GWTJahiaNodeACE/2325491209”,"/sites/ACME",“java.util.HashMap/962170901”,“java.lang.String/2004016611”,“privileged”,“java.lang.Boolean/476441737”,“site-privileged”,“site-privileged:4”,“privileged:0”,“reader”,“reviewer”,“jenifer”,"{jcr}jenifer",“jahiapp-user”,“editor”,“contributor”,“translator-en”,“translator-fr”,“john”,"{jcr}john",“users”,“users:0”,"/",“guest”,“Anonyme”,"{jcr}guest",“edit-role”,“editor-in-chief”,“contributor-advance”,“translator-es”,“live-role”,“owner”,“org.jahia.ajax.gwt.client.data.GWTJahiaLanguage/2570574484”,“com.extjs.gxt.ui.client.data.RpcMap/3441186752”,“image”,"/css/images/flags/en_on.png",“language”,“en”,“displayName”,“English”,“page”,“jmix:navMenu.j:displayInMenu”,“org.jahia.ajax.gwt.client.data.GWTJahiaFieldInitializer/3645589140”,“org.jahia.ajax.gwt.client.data.GWTJahiaValueDisplayBean/3299436324”,“value”,“b5ecc1ec-a20c-4da7-a2f7-84feb8e76555”,"",“display”,“navMenu”,“dfc8b6c5-fcf3-4df6-aa20-2fa47ab728a9”,“side-menu”,“jmix:sitemap.changefreq”,“always”,“toujours”,“hourly”,“toutes les heures”,“daily”,“quotidienne”,“monthly”,“mensuelle”,“yearly”,“annuelle”,“never”,“jamais”,“jmix:theme.j:theme”,“e5b32944-632b-4453-bf16-71fe838b1e14”,“default”,“6a2c8149-deea-4eed-888c-c10976ebf4e4”,“theme-orange”,“jnt:page.j:templateNode”,“b290ccd6-03fa-496c-9d98-67e61a3d3d40”,“blog”,“cc8b0769-b27f-493f-8892-7b490a20732e”,“blog-home”,“f29b4b06-77df-46c9-a805-c648e9476876”,“events”,“9133c3c6-3336-4729-9807-3d643f10f482”,“forum”,“3af9245e-f422-4a69-a6c9-f3c9a9d7b23a”,“forum-home”,“a75ef627-6b74-45ac-b114-327c7fd3d7a5”,“forum-room”,“3a927e33-a50e-499f-80bc-5ff39580765e”,“full-page”,“f6e96516-4fe7-4907-a6de-18280e4c21ec”,“home”,“2952c6f4-3c58-426c-b79b-2d05ef4fdc47”,“news”,“2d7392b4-6ac2-4893-bb43-e091510d42dd”,“publications”,“2d2544ba-bd5c-4ef9-a6e0-d8e048a1a8c8”,“simple”,“mandatory”,“current”,“active”,"/css/images/flags/es_on.png",“es”,“Español”,"/css/images/flags/fr_on.png",“fr”,“Français”,“org.jahia.ajax.gwt.client.data.definition.GWTJahiaNodeType/872566806”,“org.jahia.ajax.gwt.client.data.definition.GWTJahiaPropertyDefinition/506217201”,“content”,“jmix:navMenu”,“Sélectionnez cette option pour choisir le menu dans lequel cet élément doit apparaître (si plusieurs menus dans la page)”,“Sélectionner un ou plusieurs menus”,“j:displayInMenu”,“menus”,“icon”,“isAbstract”,“description”,“name”,“label”,“isMixin”,“classification”,“jmix:tagged”,“tagged”,“Tags”,“j:tags”,“autoSelectParent”,“false”,“j_newTag”,“j:newTag”,“jmix:categorized”,“categorized”,“Catégories”,“j:defaultCategory”,“org.jahia.ajax.gwt.client.data.definition.GWTJahiaNodePropertyValue/2699023724”,“java.util.Arrays$ArrayList/1243019747”,"[Ljava.lang.String;/2600011424",“options”,“jmix:sitemap”,“Sitemap”,“Fréquence de rafraîchissement”,“changefreq”,“resourceBundle”,“0.5”,“0.0”,“0.1”,“0.2”,“0.3”,“0.4”,“0.6”,“0.7”,“0.8”,“0.9”,“1.0”,“priorité”,“priority”,“jmix:sendAsNewsletter”,“sendAsNewsletter”,“metadata”,“jmix:keywords”,“Mots clés”,“Mots-clés”,“j:keywords”,“jmix:theme”,“Thème”,“j:theme”,“nodes”,"$currentSite/templates/files/themes;jnt:folder"],0,7]

I tested your example with 1.3.5 and it works fine.

When you write “Because templateName is not resolve as el expression despite I can print the value correctly”, is this something you’re sure about, or just a guess?

Could you try with 1.3.5?
Also, what encoding do you use? Gatling uses UTF-8 by default.

Stéphane

I mean that templateName is not an empty string because it is printing fine with the value “simple” so when using :
regex(""","([0-9 a-z]+-[0-9 a-z]+-[0-9 a-z]+-[0-9 a-z]+-[0-9 a-z]+)","${templateName}",""")
It should resolve with
regex(""","([0-9 a-z]+-[0-9 a-z]+-[0-9 a-z]+-[0-9 a-z]+-[0-9 a-z]+)",“simple”,""")
am I right ?

I have already try with 1.3.5 and yes I am using UTF-8 encoding.

Can you post your test because I am a little bit lost now and don’t know what to do anymore.

Here’s my simulation and the file I placed in a tomcat (not sure if I can attach files on the ML, I’ll email them to you otherwise).

It ran perfectly fine on 1.3.5:

Simulation basic.BasicExampleSimulation started…

jahia-gwt.html (5.9 KB)

JahiaGWTSimulation.scala (1009 Bytes)