Author: chamikara
Date: Thu Mar 16 21:03:55 2006
New Revision: 386540

URL: http://svn.apache.org/viewcvs?rev=386540&view=rev
Log:
Updates to test cases

Modified:
    
webservices/sandesha/trunk/test/src/org/apache/sandesha2/AddressablePingTest.java
    
webservices/sandesha/trunk/test/src/org/apache/sandesha2/AnonymousPingTest.java

Modified: 
webservices/sandesha/trunk/test/src/org/apache/sandesha2/AddressablePingTest.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/test/src/org/apache/sandesha2/AddressablePingTest.java?rev=386540&r1=386539&r2=386540&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/test/src/org/apache/sandesha2/AddressablePingTest.java
 (original)
+++ 
webservices/sandesha/trunk/test/src/org/apache/sandesha2/AddressablePingTest.java
 Thu Mar 16 21:03:55 2006
@@ -110,21 +110,36 @@
                clientOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, 
"true");
                serviceClient.fireAndForget(getPingOMBlock("ping3"));
                
+               SequenceReport sequenceReport = null;
+               boolean complete = false;
+               while (!complete) {
+                       sequenceReport = 
Sandesha2ClientAPI.getOutgoingSequenceReport(to,sequenceKey,configContext);
+                       if (sequenceReport!=null && 
sequenceReport.getCompletedMessages().size()==3)
+                               complete = true;
+                       else {
+                               try {
+                                       Thread.sleep(1000);
+                               } catch (InterruptedException e) {
+                                       e.printStackTrace();
+                               }
+                       }
+               }
+
+               
Sandesha2ClientAPI.terminateSequence(to,sequenceKey,serviceClient,configContext);
+               serviceClient.finalizeInvoke();
+               
                try {
-                       //waiting till the messages exchange finishes.
-                       Thread.sleep(10000);
+                       Thread.sleep(1000);
                } catch (InterruptedException e) {
-                       throw new SandeshaException ("sleep interupted");
+                       e.printStackTrace();
                }
                
-               SequenceReport sequenceReport = 
Sandesha2ClientAPI.getOutgoingSequenceReport(to,sequenceKey,configContext);
+               sequenceReport = 
Sandesha2ClientAPI.getOutgoingSequenceReport(to,sequenceKey,configContext);
                assertTrue(sequenceReport.getCompletedMessages().contains(new 
Long(1)));
                assertTrue(sequenceReport.getCompletedMessages().contains(new 
Long(2)));
                assertTrue(sequenceReport.getCompletedMessages().contains(new 
Long(3)));
                
assertEquals(sequenceReport.getSequenceStatus(),SequenceReport.SEQUENCE_STATUS_TERMINATED);
                
assertEquals(sequenceReport.getSequenceDirection(),SequenceReport.SEQUENCE_DIRECTION_OUT);
-               
-               serviceClient.finalizeInvoke();
                
        }
        

Modified: 
webservices/sandesha/trunk/test/src/org/apache/sandesha2/AnonymousPingTest.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/test/src/org/apache/sandesha2/AnonymousPingTest.java?rev=386540&r1=386539&r2=386540&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/test/src/org/apache/sandesha2/AnonymousPingTest.java 
(original)
+++ 
webservices/sandesha/trunk/test/src/org/apache/sandesha2/AnonymousPingTest.java 
Thu Mar 16 21:03:55 2006
@@ -104,21 +104,37 @@
                clientOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, 
"true");
                serviceClient.fireAndForget(getPingOMBlock("ping3"));
                
+               SequenceReport sequenceReport = null;
+               boolean complete = false;
+               while (!complete) {
+                       sequenceReport = 
Sandesha2ClientAPI.getOutgoingSequenceReport(to,sequenceKey,configContext);
+                       if (sequenceReport!=null && 
sequenceReport.getCompletedMessages().size()==3)
+                               complete = true;
+                       else {
+                               try {
+                                       Thread.sleep(1000);
+                               } catch (InterruptedException e) {
+                                       e.printStackTrace();
+                               }
+                       }
+               }
+
+               
Sandesha2ClientAPI.terminateSequence(to,sequenceKey,serviceClient,configContext);
+               serviceClient.finalizeInvoke();
+               
                try {
-                       //waiting till the messages exchange finishes.
-                       Thread.sleep(5000);
+                       Thread.sleep(1000);
                } catch (InterruptedException e) {
-                       throw new SandeshaException ("sleep interupted");
+                       e.printStackTrace();
                }
                
-               SequenceReport sequenceReport = 
Sandesha2ClientAPI.getOutgoingSequenceReport(to,sequenceKey,configContext);
+               sequenceReport = 
Sandesha2ClientAPI.getOutgoingSequenceReport(to,sequenceKey,configContext);
                assertTrue(sequenceReport.getCompletedMessages().contains(new 
Long(1)));
                assertTrue(sequenceReport.getCompletedMessages().contains(new 
Long(2)));
                assertTrue(sequenceReport.getCompletedMessages().contains(new 
Long(3)));
                
assertEquals(sequenceReport.getSequenceStatus(),SequenceReport.SEQUENCE_STATUS_TERMINATED);
                
assertEquals(sequenceReport.getSequenceDirection(),SequenceReport.SEQUENCE_DIRECTION_OUT);
-               
-               serviceClient.finalizeInvoke();
+       
        }
        
        private OMElement getPingOMBlock(String text) {



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to