syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmarte...@apache.org
Subject svn commit: r1297107 - in /incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest: ReportTestITCase.java TaskTestITCase.java
Date Mon, 05 Mar 2012 16:02:51 GMT
Author: fmartelli
Date: Mon Mar  5 16:02:50 2012
New Revision: 1297107

URL: http://svn.apache.org/viewvc?rev=1297107&view=rev
Log:
windows build failure recovered by extending wait time for report export

Modified:
    incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/ReportTestITCase.java
    incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/TaskTestITCase.java

Modified: incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/ReportTestITCase.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/ReportTestITCase.java?rev=1297107&r1=1297106&r2=1297107&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/ReportTestITCase.java
(original)
+++ incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/ReportTestITCase.java
Mon Mar  5 16:02:50 2012
@@ -177,18 +177,17 @@ public class ReportTestITCase extends Ab
 
         int i = 0;
         int maxit = 50;
+
         do {
             try {
                 Thread.sleep(1000);
             } catch (InterruptedException e) {
             }
 
-            reportTO = restTemplate.getForObject(
-                    BASE_URL + "report/read/{reportId}", ReportTO.class, 1);
+            reportTO = restTemplate.getForObject(BASE_URL + "report/read/{reportId}", ReportTO.class,
1);
 
             i++;
-        } while (preExecIds.size() == reportTO.getExecutions().size()
-                && i < maxit);
+        } while (preExecIds.size() == reportTO.getExecutions().size() && i < maxit);
 
         Set<Long> postExecIds = new HashSet<Long>();
         for (ReportExecTO exec : reportTO.getExecutions()) {
@@ -198,19 +197,29 @@ public class ReportTestITCase extends Ab
         postExecIds.removeAll(preExecIds);
         assertEquals(1, postExecIds.size());
 
-        // wait for report exec XML to be stored...
-        try {
-            Thread.sleep(3000);
-        } catch (InterruptedException e) {
-        }
-
         // Export
         // 1. XML (default)
-        HttpGet getMethod = new HttpGet(BASE_URL + "report/execution/export/"
-                + postExecIds.iterator().next());
-        HttpResponse response =
-                ((PreemptiveAuthHttpRequestFactory) restTemplate.
-                getRequestFactory()).getHttpClient().execute(getMethod);
+
+        HttpResponse response = null;
+        HttpGet getMethod = null;
+
+        i = 0;
+        maxit = 10;
+
+        do {
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException e) {
+            }
+
+            getMethod = new HttpGet(BASE_URL + "report/execution/export/" + postExecIds.iterator().next());
+
+            response = ((PreemptiveAuthHttpRequestFactory) restTemplate.getRequestFactory()).getHttpClient().
+                    execute(getMethod);
+
+            i++;
+        } while ((response == null || response.getStatusLine().getStatusCode() != 200) &&
i < maxit);
+
         assertEquals(200, response.getStatusLine().getStatusCode());
 
         String export = EntityUtils.toString(response.getEntity()).trim();
@@ -220,8 +229,8 @@ public class ReportTestITCase extends Ab
         // 2. HTML
         getMethod = new HttpGet(BASE_URL + "report/execution/export/"
                 + postExecIds.iterator().next() + "?fmt=HTML");
-        response = ((PreemptiveAuthHttpRequestFactory) restTemplate.
-                getRequestFactory()).getHttpClient().execute(getMethod);
+        response = ((PreemptiveAuthHttpRequestFactory) restTemplate.getRequestFactory()).getHttpClient().execute(
+                getMethod);
         assertEquals(200, response.getStatusLine().getStatusCode());
 
         export = EntityUtils.toString(response.getEntity()).trim();
@@ -231,8 +240,8 @@ public class ReportTestITCase extends Ab
         // 3. PDF
         getMethod = new HttpGet(BASE_URL + "report/execution/export/"
                 + postExecIds.iterator().next() + "?fmt=PDF");
-        response = ((PreemptiveAuthHttpRequestFactory) restTemplate.
-                getRequestFactory()).getHttpClient().execute(getMethod);
+        response = ((PreemptiveAuthHttpRequestFactory) restTemplate.getRequestFactory()).getHttpClient().execute(
+                getMethod);
         assertEquals(200, response.getStatusLine().getStatusCode());
 
         export = EntityUtils.toString(response.getEntity()).trim();
@@ -242,8 +251,8 @@ public class ReportTestITCase extends Ab
         // 4. RTF
         getMethod = new HttpGet(BASE_URL + "report/execution/export/"
                 + postExecIds.iterator().next() + "?fmt=RTF");
-        response = ((PreemptiveAuthHttpRequestFactory) restTemplate.
-                getRequestFactory()).getHttpClient().execute(getMethod);
+        response = ((PreemptiveAuthHttpRequestFactory) restTemplate.getRequestFactory()).getHttpClient().execute(
+                getMethod);
         assertEquals(200, response.getStatusLine().getStatusCode());
 
         export = EntityUtils.toString(response.getEntity()).trim();

Modified: incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/TaskTestITCase.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/TaskTestITCase.java?rev=1297107&r1=1297106&r2=1297107&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/TaskTestITCase.java (original)
+++ incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/TaskTestITCase.java Mon
Mar  5 16:02:50 2012
@@ -318,8 +318,7 @@ public class TaskTestITCase extends Abst
         int preSyncSize = taskTO.getExecutions().size();
 
         TaskExecTO execution = restTemplate.postForObject(
-                BASE_URL + "task/execute/{taskId}", null,
-                TaskExecTO.class, taskTO.getId());
+                BASE_URL + "task/execute/{taskId}", null, TaskExecTO.class, taskTO.getId());
         assertEquals("JOB_FIRED", execution.getStatus());
 
         int i = 0;
@@ -332,9 +331,7 @@ public class TaskTestITCase extends Abst
             } catch (InterruptedException e) {
             }
 
-            taskTO = restTemplate.getForObject(
-                    BASE_URL + "task/read/{taskId}",
-                    SyncTaskTO.class, taskTO.getId());
+            taskTO = restTemplate.getForObject(BASE_URL + "task/read/{taskId}", SyncTaskTO.class,
taskTO.getId());
 
             assertNotNull(taskTO);
             assertNotNull(taskTO.getExecutions());



Mime
View raw message