summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornash <nash@13f79535-47bb-0310-9956-ffa450edef68>2009-09-11 10:23:40 +0000
committernash <nash@13f79535-47bb-0310-9956-ffa450edef68>2009-09-11 10:23:40 +0000
commita1f4382b18e0324fa720fa5e81224c740ee3b90d (patch)
tree65ff5ffa28622d417c08bb8e889b0ba922c37cd2
parentbad088337e6eb019482c9b632106726eae0b1af2 (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@813762 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--branches/sca-java-1.5.1/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.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleContactsServiceTestCase.java b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleContactsServiceTestCase.java
index 1eff8a1316..1f261dfc90 100644
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleContactsServiceTestCase.java
+++ b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleContactsServiceTestCase.java
@@ -116,11 +116,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