Hi Cumhur,
indees the problem is Flash Player's single threaded engine. If you setup afor
or while loop after calling a remote method, the player "blocks" and is not
able to process responses that comes in from the remote method.
To process the result of a async method invokation, you'll have to use the
result/fault events of your service tag, i.e.
public function testEndToEnd() {
_root.logonWindow.username.text = "tcfeu";
_root.logonWindow.password.text = "1";
EventBroadcaster.getInstance().broadcastEvent("SomeCommand");
}
after the event has been broadcasted and SomeCommand executed, some time later
the defined onResult event handler will be invoked with the service results (if
SomeCommand implements Responder then SomeCommand.onResult() will be invoked).
If an error occured, the onFault method will be called.
Hope that helps,
Dirk.
-----Original Message-----
From: Cumhur Guzel [mailto:[EMAIL PROTECTED]
Sent: Friday, February 11, 2005 8:07 AM
To: [email protected]
Subject: [flexcoders] Asynchrony problem?
Hi folks,
We are using cairngorm 0.9 version and and flexunit.
We would like to create a testcase which initially setting the input valuesup
and then broadcasting an event
that is creating a web service call at back-end, processing it resulting output
from web service and updating the view.
Finally, we would like to test updated view object values against the expected
values we know before.
We have created the test case given below.
(1), (2) sets the input values for test view.
(3) submits the command
(4)(5) waits for asynchronous web service call to finish. (2000 millisecond)
(6) logger to localconnection
(7) assertion
This test is failing, however it is supposed to pass based on the Logs and
execution values supplied.
It seems although we force this test method to stay in idle loop for 2000
milliseconds, web service call is not finished off by the mean time.
(I increased the time, it did not work)
It seems problem is rooted to flash player single-threaded implementation,
So would you guys recommend any workaround to overcome this asynchrony problem
or something else?
Any help will be appreciated.
Code piece is given below.
public function testEndToEnd() {
_root.logonWindow.username.text = "tcfeu"; (1)
_root.logonWindow.password.text = "1"; (2)
EventBroadcaster.getInstance().broadcastEvent("SomeCommand");(3)
var timer:Timer = new Timer();(4)
while (!timer.wait(2000)); (5)
Log.debug("SystemTests testEndToEnd() method has been called"); (6)
assertEquals( "return value is different than expected " ,
"value" ,
valueReturningFromWebServiceCall ); (7)
}
Cumhur Guzel
Senior Developer
Infomedia Ltd.
Electronic Catalogues Division
Phone: +61 (0) 2 9454 1500
Direct: +61 (0) 2 9454 1709
Fax: +61 (0) 2 9454 1888
Mobile: +61 (0) 401 683 402
Website: www.infomedia.com.au
* This email transmission and any attachments may contain privileged and
confidential information. If you are not the intended recipient you are not
authorised to, read, distribute or reproduce any part of this transmission
(including any attachments) without the prior written consent of the sender.If
you have received this email in error, please notify the sender by email
immediately.
* Opinions expressed in this email and any attachment are those of the sender
and not necessarily the opinions of Infomedia.
* Please scan this email and any attachment for viruses. Infomedia takes all
reasonable precautions to ensure no viruses are present in this email or
accompanying attachments, but does not under any circumstance accept any
responsibility for loss or damage caused by viruses.
Yahoo! Groups Sponsor
ADVERTISEMENT
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.