header
header
Main Menu
Home
Eviware Store
Downloads
Products
News
Forum
Eviware Blog
Search
FAQs
Customer Area
Support
Documentation
Tutorials
CookBook
Downloads
Forum
Login Form
Welcome, Guest. Please login or register.
November 22, 2008, 08:33:40 am
Username: Password:
Login with username, password and session length

Forgot your password?
 
GroovyDataSource and readLine issues
Welcome, Guest. Please login or register.
November 22, 2008, 08:33:40 am
Home Help Search Login Register
News: The Forums are up! Welcome to eviware.

+  Eviware Forum
|-+  soapUI
| |-+  soapUI
| | |-+  GroovyDataSource and readLine issues
« previous next »
Pages: [1] Print
Author Topic: GroovyDataSource and readLine issues  (Read 411 times)
Michael Eddington
Newbie
*
Posts: 13


« on: January 11, 2008, 05:29:26 am »

I have a Groovy DataSource with the following script.  The script does not perform as one would expect.  Instead each call to readLine() reads a line at some random spot way down the file (assuming the file is large enough).  The expected result would be the first line, then the second, etc.

Could this be an issue with Groovy?  Or something else?

The work around is to say "readLines()" and store the result in context.  However, for large files this uses alot of memory.


// Read values from a text file.

if(context["peach"] == null)
{
   context["peach"] = new File("c:/strings.txt").newInputStream()
}

result["value1"] = context["peach"].readLine()

// end
Logged
omatzura
Administrator
Hero Member
*****
Posts: 1,425


« Reply #1 on: January 11, 2008, 12:22:11 pm »

Hi,

hmm.. sounds strange.. soapUI 2.0.1 will upgrade to groovy 1.5.1. How are you checking that the order is no ok? Directly after the read or "somewhere else"?

regards,

/Ole
eviware.com
Logged
Michael Eddington
Newbie
*
Posts: 13


« Reply #2 on: January 11, 2008, 08:43:02 pm »

From the GroovyDataSource pane just hit the run button and say 10 iterations and look at the values produced.  The text file would have lines line:

string1
string2
string3
...

So one would expect the values displayed to be string1, string2, ... but instead you get string1 then string1000 or something.  Very strange.

mike
Logged
omatzura
Administrator
Hero Member
*****
Posts: 1,425


« Reply #3 on: January 12, 2008, 12:09:31 am »

Hi Michael,

I wonder if you could try the following initialization for peach instead:

context["peach"] = new java.io.BufferedReader( new java.io.FileReader( "c:/strings.txt"))

?

Does that help?

regards,

/Ole
eviware.com
Logged
Michael Eddington
Newbie
*
Posts: 13


« Reply #4 on: January 14, 2008, 10:19:23 pm »

Interesting, that did work.  Wonder why...

mike
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
header header
header
header