Global Groovy scripts usage question
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2007
12:52 PM
07-11-2007
12:52 PM
Global Groovy scripts usage question
Hello,
I am trying to understand how the global groovy feature works but am having some problem. I tried the example and it worked fine. I then modified your Greet.groovy to the following.
package soapui.demo
class Greet
{
def salute()
{
log.info("testing")
}
}
I then create a groovy script containing
def greet = new soapui.demo.Greet( "Ole", log )
greet.salute()
and the response has
'Hello Ole'
Shouldnt response have 'testing'
Also if i define greet as
def greet = new soapui.demo.Greet( )
I get groovy.lang.GroovyRuntimeException: Could not find matching constructor for: soapui.demo.Greet()
Shouldn't this be ok (based on my java knowledge)
THanks
Ali
I am trying to understand how the global groovy feature works but am having some problem. I tried the example and it worked fine. I then modified your Greet.groovy to the following.
package soapui.demo
class Greet
{
def salute()
{
log.info("testing")
}
}
I then create a groovy script containing
def greet = new soapui.demo.Greet( "Ole", log )
greet.salute()
and the response has
'Hello Ole'
Shouldnt response have 'testing'
Also if i define greet as
def greet = new soapui.demo.Greet( )
I get groovy.lang.GroovyRuntimeException: Could not find matching constructor for: soapui.demo.Greet()
Shouldn't this be ok (based on my java knowledge)
THanks
Ali
8 REPLIES 8
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2007
12:55 PM
07-11-2007
12:55 PM
Hi,
hmm.. when you save the updated Greet.groovy file, do you get a message in the soapui log that it has found the updated file and reloaded it?
regards,
/Ole
eviware.com
hmm.. when you save the updated Greet.groovy file, do you get a message in the soapui log that it has found the updated file and reloaded it?
regards,
/Ole
eviware.com
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2007
01:09 PM
07-11-2007
01:09 PM
Hi again,
you probably got an error when soapUI tries to reload the file, since the log variable has not been defined/initialized for the class.. right?
regards,
/Ole
eviware.com
you probably got an error when soapUI tries to reload the file, since the log variable has not been defined/initialized for the class.. right?
regards,
/Ole
eviware.com
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2007
01:11 PM
07-11-2007
01:11 PM
So I am editing Greet.groovy through notepad. I do notice that when I changed the file in notepad to
package soapui.demo
class Greet
{
def salute()
{
log.info("testing")
}
}
and save the file, soapUI log shows
"Wed Jul 11 13:07:39 PDT 2007:INFO:C:\Program Files\eviware\soapUI-Pro-1.7.5-beta2\bin\scripts\Greet.groovy is new or has changed, reloading...
"
This is the last entry in the soapUI log. Nothing about 'found the updated file and reloaded it"
package soapui.demo
class Greet
{
def salute()
{
log.info("testing")
}
}
and save the file, soapUI log shows
"Wed Jul 11 13:07:39 PDT 2007:INFO:C:\Program Files\eviware\soapUI-Pro-1.7.5-beta2\bin\scripts\Greet.groovy is new or has changed, reloading...
"
This is the last entry in the soapUI log. Nothing about 'found the updated file and reloaded it"
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2007
01:13 PM
07-11-2007
01:13 PM
ok.. you should at least have gotten an error message.. let me see if I can reproduce..
regards,
/Ole
eviware.com
regards,
/Ole
eviware.com
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2007
01:16 PM
07-11-2007
01:16 PM
I changed the greet.groovy code to
package soapui.demo
class Greet
{
def log;
Greet(log)
{this.log = log;}
def salute()
{
log.info("testing")
}
}
and still same thing in soapUI log. There is nothing in the 'error log'
package soapui.demo
class Greet
{
def log;
Greet(log)
{this.log = log;}
def salute()
{
log.info("testing")
}
}
and still same thing in soapUI log. There is nothing in the 'error log'
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2007
01:19 PM
07-11-2007
01:19 PM
Hi,
ok.. please check that soapUI is loading scripts from the correct path in the soapUI Pro Preferences Tab (it could be pointing at the the beta1 installation scripts..)
regards,
/Ole
eviware.com
ok.. please check that soapUI is loading scripts from the correct path in the soapUI Pro Preferences Tab (it could be pointing at the the beta1 installation scripts..)
regards,
/Ole
eviware.com
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2007
01:31 PM
07-11-2007
01:31 PM
I already checked that. It is
C:\Program Files\eviware\soapUI-Pro-1.7.5-beta2\bin\scripts
C:\Program Files\eviware\soapUI-Pro-1.7.5-beta2\bin\scripts
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2007
01:42 PM
07-11-2007
01:42 PM
ok.. and you changed your groovy script that calls the Greet class to
def greet = new soapui.demo.Greet( log )
greet.salute()
?
/Ole
eviware.com
def greet = new soapui.demo.Greet( log )
greet.salute()
?
/Ole
eviware.com
