(ältere Archiveinträge vor 2007 nicht dargestellt, aber in der Suche enthalten)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [QF-Test] Jython question regarding referencing a java object...
Hello Derrik, use the 'global' statement to exchange objects between Server script nodes: Script 1: global myObject myObject = MyObject() Script 2: global myObject print myObject Best regards, Robert --On Mittwoch, November 21, 2007 13:37:32 -0800 Derrik Ammons <dammons@?.COM> wrote:
I'm getting a TypeError: method():2nd arg can't be coerced to pkg.MyClassName within a Server script node. I instantiate a MyClassName object, newObject=StaticClass.createNewObject(), in a Server script and call an rc.setLocal("ReferencName",newObject). I've also tried setGlobal as well with the same result. Later downstream from that node, in the same Test Case node, in another Server script, I call fetchObject=rc.lookup("ReferenceName"). In the same script, I use that reference in a function call, anotherObject= StaticClass.method(someString, fetchObject). I've compiled the java code into a jar file and placed it in the plugin directory like I normally do. I imported the classes in the Server script like I normally do. I tried both a setLocal and setGlobal methods of the run context. I understand that when I do, there is a String association to the object, so that when I call rc.lookup(), fetchObject is a String, but I need the object so I can pass it into method. How do I do this? Hope my example makes sense. I wanted to make it as generic as possible. Thanks, Derrik
-- Robert Lahmer Quality First Software GmbH http://www.qfs.de Tulpenstr. 41 Tel: +49 8171 919874 DE-82538 Geretsried Fax: +49 8171 919876 GF: Gregor Schmid, Karlheinz Kellerer HRB München 140833