Contact Us
About Us
News
Home
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
.
December 05, 2008, 12:31:23 am
Username:
Password:
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Forgot your password?
Coding shared soapUI groovy scripts in Eclipse
Welcome,
Guest
. Please
login
or
register
.
December 05, 2008, 12:31:23 am
News:
The Forums are up! Welcome to eviware.
Eviware Forum
soapUI
soapUI
Coding shared soapUI groovy scripts in Eclipse
« previous
next »
Pages:
[
1
]
Author
Topic: Coding shared soapUI groovy scripts in Eclipse (Read 524 times)
John Overbaugh
Newbie
Posts: 16
Coding shared soapUI groovy scripts in Eclipse
«
on:
December 14, 2007, 09:45:19 pm »
Hopefully the last low-level question... I'm moving most of my Groovy scripts into a shared Groovy script. In the process, I decided to add another layer of complexity, and code these scripts in Eclipse. So I've installed Eclipse, added the Groovy plug in, and created a new Java project with Groovy scripts.
I was able to muddle through referencing the groovy.sql.Sql. I've also seen that, in order to log, I need to pass a reference to the log:
soapUI.lds.org.qa.tools.PersonInfoSharedScripts.CleanUpPerson('AccountID0002', log)
My script is erroring, though, when I try to call it with (text, log). The error is :
java.lang.VerifyError: (class: soapUI/lds/org/qa/tools/PersonInfoSharedScripts, method: CleanUpPerson signature: (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;) Incompatible type for getting or setting field
I've attached the .groovy file I'm using. What am I doing wrong, that I cannot reference it?
One general question: is there any easy way to debug shared scripts? I'm guessing which line is erroring, and why... I'm debugging blind. It'd be great to be able to debug and step through the code, or at least see what's happening and where the error is occuring.
Thinking forward, are there any other libraries/jars I should reference proactively (for things like accessing XML results, throwing exceptions on error, etc.)?
JTO
«
Last Edit: December 14, 2007, 11:14:22 pm by John Overbaugh
»
Logged
omatzura
Administrator
Hero Member
Posts: 1,506
Re: Coding shared soapUI groovy scripts in Eclipse
«
Reply #1 on:
December 15, 2007, 12:13:51 am »
Hi John,
I think you need to wrap your method in a class instead, something like
package john.overbaugh.utils
public class DBUtils
{
def static CleanUpPerson( AccountID, log )
{
...
}
}
which you can then call with
john.overbaugh.utils.DBUtils.CleanUpPerson( "123", log )
Hope this helps!
regards,
/Ole
eviware.com
Logged
John Overbaugh
Newbie
Posts: 16
Re: Coding shared soapUI groovy scripts in Eclipse
«
Reply #2 on:
December 17, 2007, 06:09:02 pm »
Hey Ole... Yeah, I actually have it wrapped up in a class (I neglected to copy/past that info my attachment) so that can't be the problem. Is there any way to 'debug' a script once it's been moved to a central location?
Here's my class:
class PersonInfoSharedScripts
{
def log
def AccountID
def static CleanUpPerson(AccountID, log)
{
def db = Sql.newInstance('jdbc:oracle:thin:@server:1234:db', 'username', 'password', 'oracle.jdbc.OracleDriver')
// If the AccountID exists, we need to delete it for cleanliness
// conditional if - on whether there's anything in the first cell of the first row'
def myString
this.AccountID = AccountID
// if (db.eachRow("SELECT AccountUserName FROM TABLE WHERE accountid = 'AccountID0002'"){ row -> log.info(row[0])}) {
db.eachRow("SELECT AccountUserName FROM TABLE WHERE accountid = 'AccountID0002'")
{ row -> (myString = row[0])}
if (myString)
{
// IF WE GOT HERE, WE FOUND AT LEAST ONE INSTANCE OF AccountID0002
log.info("AccountID found - will delete it now")
// first, delete all entries in sperson_sideaccountusername related to accoutID0002
// this is a complex query - nestling a query to get the fsperson.id value within the delete state
log.info(" deleting sidetable entries")
db.execute("DELETE FROM fsperson_sidetable WHERE sperson_id = (select id from sperson where AccountID = 'AccountID0002')")
// next, delete the row from auth_table where accountid = 'AccountID0002'
log.info(" deleting entries in auth_table")
db.execute("DELETE FROM auth_table where username = (select accountusername from person where accountid = 'AccountID0002')")
// next, delete the entire row in the SPERSON table
log.info(" deleting entries from person")
db.execute("DELETE FROM person WHERE accountid = 'AccountID0002'")
}
else
{
log.info("AccountID not found - proceed to next step")
}
}
}
Logged
John Overbaugh
Newbie
Posts: 16
Re: Coding shared soapUI groovy scripts in Eclipse
«
Reply #3 on:
December 17, 2007, 06:51:58 pm »
OK, after beating my head against a wall on this for four hours, I rewrote the method with a different name. It works now. ?? I don't get it, but I'm moving ahead.
Logged
omatzura
Administrator
Hero Member
Posts: 1,506
Re: Coding shared soapUI groovy scripts in Eclipse
«
Reply #4 on:
December 17, 2007, 07:05:20 pm »
Hi John,
sorry for not replying earlier, please let us know if you bump into this again!
regards,
/Ole
eviware.com
Logged
Pages:
[
1
]
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> eviware general
-----------------------------
soapUI
-----------------------------
=> soapUI
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Powered by SMF 1.1.2
|
SMF © 2006-2007, Simple Machines LLC
Loading...