summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornash <nash@13f79535-47bb-0310-9956-ffa450edef68>2009-09-11 10:18:19 +0000
committernash <nash@13f79535-47bb-0310-9956-ffa450edef68>2009-09-11 10:18:19 +0000
commitbad088337e6eb019482c9b632106726eae0b1af2 (patch)
treec6160defba54f158092bd9dec4582c02e9ea0c62
parent7d34bf6b87e813d1c3699bd6244e9286fa360c37 (diff)
Modify test case to retry the get and delete up to 5 times (TUSCANY-3164)
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@813761 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleContactsServiceTestCase.java28
1 files changed, 25 insertions, 3 deletions
diff --git a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleContactsServiceTestCase.java b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleContactsServiceTestCase.java
index 11f39d184b..e365595ff0 100644
--- a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleContactsServiceTestCase.java
+++ b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleContactsServiceTestCase.java
@@ -117,11 +117,33 @@ public class GoogleContactsServiceTestCase {
//System.out.println("postedEntryID: " + postedEntryID );
//Before deletion
- Entry entry00 = testService.clientGetEntry(postedEntryID);
- //System.out.println("Before Deleteion: " + entry00.getId());
+ for (int i = 0; i < 5; i++) { // make 5 attempts because of timing issues
+ try {
+ Entry entry00 = testService.clientGetEntry(postedEntryID);
+ //System.out.println("Before Deletion: " + entry00.getId());
+ break; // get was successful
+ } catch (Exception e) {
+ if (i < 4) {
+ System.out.println("Get failed, retrying...");
+ } else {
+ throw e; // final attempt, give up
+ }
+ }
+ }
//Delete this entry
- testService.clientDelete(postedEntryID);
+ for (int i = 0; i < 5; i++) { // make 5 attempts because of timing issues
+ try {
+ testService.clientDelete(postedEntryID);
+ break; // delete was successful
+ } catch (Exception e) {
+ if (i < 4) {
+ System.out.println("Delete failed, retrying...");
+ } else {
+ throw e; // final attempt, give up
+ }
+ }
+ }
//Worked: this newly posted entry did not appear in the contact list
//But we need a Junit assertion here