RE: "continue" does not continue the while loop after an assertion fails

2016-01-11 Thread Deng, Lea
Hi John and Edinson, Thank you very much for the suggestion of using flag, and a list. They work well for the main Test Case Many thanks, lea From: John Wagenleitner [mailto:john.wagenleit...@gmail.com] Sent: Tuesday, 12 January 2016 3:04 p.m. To: users@groovy.apache.org Subject: Re: "continue" d

Re: "continue" does not continue the while loop after an assertion fails

2016-01-11 Thread John Wagenleitner
Could also put the text you were using in the asserts into a List instead and after the while loop assert list isEmpty(). On Jan 11, 2016 5:28 PM, "Edinson E. Padrón Urdaneta" < edinson.padron.urdan...@gmail.com> wrote: > ​​ > ​​ > I don't really know what are your intentions, so I gonna try to gu

Re: "continue" does not continue the while loop after an assertion fails

2016-01-11 Thread Edinson E . Padrón Urdaneta
​​ ​​ I don't really know what are your intentions, so I gonna try to guess and help you if I can: If you are trying to test every element in `exlusionList`, you don't want to stop the execution until the last one has been tested, and you want the test to fail if at least one element failed, you c

RE: "continue" does not continue the while loop after an assertion fails

2016-01-11 Thread Deng, Lea
Hi John and Edinson, You two are right. After the failed assertion, my code never reached "continue". After I added try and catch for the assertion, continue worked. (please see code below) However, the main Test Case appeared to be Passed after I catch this assertion error for this xml test step

Re: "continue" does not continue the while loop after an assertion fails

2016-01-11 Thread Edinson E . Padrón Urdaneta
I could be very wrong but I think that the problem is a logical one. If an assertion doesn't hold (if it fails), an exception will be thrown and the rest of the code won't be executed. On Mon, Jan 11, 2016 at 8:20 PM, Deng, Lea wrote: > I'm using Soap UI and Groovy Script to go through a xml res

Re: "continue" does not continue the while loop after an assertion fails

2016-01-11 Thread John Wagenleitner
The code never reaches the continue because the assert will throw an AssertionError since the expression in the if statement proves it will fail. If you remove the assert it should work. Also may want to remove the assert in your else branch, unless it is meant to abort the program if it's reache

"continue" does not continue the while loop after an assertion fails

2016-01-11 Thread Deng, Lea
I'm using Soap UI and Groovy Script to go through a xml response with many Decision elements. My Groovy Script refers to a DataSource 'Decision Exclusion List RMA/2010/33789' for a list of exlusion text to search for in the xml response. I search for each DecisionCode read from the DataSource, th

Re: Casting Double to BigDecimal

2016-01-11 Thread Schalk Cronjé
I did not know there was even a difference. I tend to prefer 'as TYPE' for IMO it reads better than '(TYPE)'. Maybe it is also left-over from my C++ days where the latetr style cast was inherited from C and frowned upon. Is this 'cheap & fast' casting only affecting native types or is it cast

Re: Casting Double to BigDecimal

2016-01-11 Thread Jochen Theodorou
Well, cheap and fast is of course relatively spoken ;) Anyway... the general path is ScriptBytecodeAdapter.castToType. But in many cases we do actually emit direct code for transformation, if we have enough information to do that. As of why asType uses the toString path... that would be htt

Re: Casting Double to BigDecimal

2016-01-11 Thread Alberto Vilches
Interesting! now I have more doubts about this: 1 Where is this cheap & fast implementation of the Java-like casting? Is it in GDK or it is implemented at low-level by the Groovy compiler? I only know the asType method in DefaultGroovyMethods. 2 Why the "asType" method use the expensive way new Bi

Re: @Log annotation inside Groovy Script

2016-01-11 Thread jerrywiltse
How does the child script or class get the name of the script which called it (or more importantly, the name of the logger). It has to be passed in, or retrieved via stacktrace. Correct? Gerald Wiltse GSI, Inc. | Full Service JD Edwards. Guaranteed. (d) 248.327.4661 (c) 248.893.9110 (iPhone) >

Re: Casting Double to BigDecimal

2016-01-11 Thread Jochen Theodorou
We tryied to have two different kinds of casts. The normal one, that is more in the style of Java, which tries the cheapest way. And the "as" version, which calls into asType is customizable and usually does more expensive operations. The fallback for asType is the normal cast. That's why we se

Re: Casting Double to BigDecimal

2016-01-11 Thread Alberto Vilches
No, we are parsing a json with decimal numbers using the JSON.parse Grails method. If we inspect these values with the IntelliJ IDEA debugger, the json object has doubles. Then we return the value of some of them with a method like this: BigDecimal getPeriodPrice(Integer period) { (pri

Re: Casting Double to BigDecimal

2016-01-11 Thread Alberto Vilches
Yes, I know the "1.9" literal in Groovy results in a BigDecimal. That's why I'm trying to force the double using the "d", but maybe is still a bigdecimal. So, let's try again: Double d = 1.9 println((BigDecimal)d) prints "1.899911182158029987476766109466552734375" and Do

Re: @Log annotation inside Groovy Script

2016-01-11 Thread Alessio Stalla
Hi, you don't have to pass the logger around. You can configure it once in the main script and ask for it in child scripts. Every time you invoke java.util.logging.Logger.getLogger('my-script-logger'), the same logger is returned. This is true also if you use log4j or logback (better) instead of ja

Re: Wanted: help with using jdbc grapes in groovy shell?

2016-01-11 Thread jim northrop
that's two of us as 'idiots' as i msde that same mistake as you, just earlier ;-D Parts of the learning curve me thinks LOL Have a GR8 Monday woncha ? k/r Jim On 11 January 2016 at 05:38, Richard Heintze wrote: > Sorry, I am idiot! > In previous versions of groovy console this "@Grab" syntax