syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmarte...@apache.org
Subject syncope git commit: Fix for topology integration case about pull task execution
Date Mon, 30 May 2016 10:43:35 GMT
Repository: syncope
Updated Branches:
  refs/heads/master eb30ae0a2 -> 1c009cade


Fix for topology integration case about pull task execution


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/1c009cad
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/1c009cad
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/1c009cad

Branch: refs/heads/master
Commit: 1c009cadee30715e83824908d59836933ec210d8
Parents: eb30ae0
Author: fmartelli <fabio.martelli@gmail.com>
Authored: Mon May 30 12:43:22 2016 +0200
Committer: fmartelli <fabio.martelli@gmail.com>
Committed: Mon May 30 12:43:22 2016 +0200

----------------------------------------------------------------------
 .../fit/console/AbstractConsoleITCase.java      | 16 +++++++++
 .../syncope/fit/console/TopologyITCase.java     | 38 +++++++++-----------
 2 files changed, 32 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/1c009cad/fit/core-reference/src/test/java/org/apache/syncope/fit/console/AbstractConsoleITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/AbstractConsoleITCase.java
b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/AbstractConsoleITCase.java
index efb59e1..51c1517 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/AbstractConsoleITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/AbstractConsoleITCase.java
@@ -104,6 +104,22 @@ public abstract class AbstractConsoleITCase extends AbstractITCase {
                 });
     }
 
+    protected Component findComponentById(final String searchPath, final String id) {
+
+        final Component component = wicketTester.getComponentFromLastRenderedPage(searchPath);
+
+        return (component instanceof MarkupContainer ? MarkupContainer.class.cast(component)
: component.getPage())
+                .visitChildren(Component.class, new IVisitor<Component, Component>()
{
+
+                    @Override
+                    public void component(final Component object, final IVisit<Component>
visit) {
+                        if (object.getId().equals(id)) {
+                            visit.stop(object);
+                        }
+                    }
+                });
+    }
+
     protected void closeCallBack(final Component modal) {
         final List<? extends Behavior> behaviors = modal.getBehaviors();
         for (Behavior behavior : behaviors) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/1c009cad/fit/core-reference/src/test/java/org/apache/syncope/fit/console/TopologyITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/TopologyITCase.java
b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/TopologyITCase.java
index ce344c9..bd62785 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/TopologyITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/TopologyITCase.java
@@ -20,7 +20,6 @@ package org.apache.syncope.fit.console;
 
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
 
 import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
 import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
@@ -256,12 +255,6 @@ public class TopologyITCase extends AbstractConsoleITCase {
                 + "container:content:startAt:container:content:togglePanelContainer:startAtForm:startAt");
         wicketTester.assertInfoMessages("Operation executed successfully");
 
-        try {
-            // requires a short delay
-            Thread.sleep(5000);
-        } catch (Exception ignore) {
-        }
-
         component = findComponentByProp("name", "body:toggle:outerObjectsRepeater:2:outer:form:content:tasks:"
                 + "firstLevelContainer:first:container:content:searchContainer:resultTable:tablePanel:groupForm:"
                 + "checkgroup:dataTable", "TestDB Task");
@@ -273,30 +266,31 @@ public class TopologyITCase extends AbstractConsoleITCase {
                 "Executions of task &#039;TestDB Task&#039;");
 
         int iteration = 0;
-        try {
-            wicketTester.assertComponent(
-                    "body:toggle:outerObjectsRepeater:2:outer:form:content:tasks:secondLevelContainer:"
-                    + "second:executions:firstLevelContainer:first:container:content:searchContainer:resultTable:"
-                    + "tablePanel:groupForm:checkgroup:dataTable:body:rows:1:cells:6:cell:panelView:viewLink",
-                    AjaxLink.class);
-        } catch (Exception e) {
-            if (iteration < 10) {
+        do {
+            try {
+                wicketTester.assertComponent(
+                        "body:toggle:outerObjectsRepeater:2:outer:form:content:tasks:secondLevelContainer:"
+                        + "second:executions:firstLevelContainer:first:container:content:searchContainer:resultTable:"
+                        + "tablePanel:groupForm:checkgroup:dataTable:body:rows:1:cells:6:cell:panelView:viewLink",
+                        AjaxLink.class);
+                iteration = 10;
+            } catch (AssertionError e) {
                 try {
                     // requires a short delay
                     Thread.sleep(1000);
                 } catch (Exception ignore) {
                 }
-                
-                wicketTester.clickLink(
+
+                component = findComponentById(
                         "body:toggle:outerObjectsRepeater:2:outer:form:content:tasks:secondLevelContainer:second:"
                         + "executions:firstLevelContainer:first:container:content:searchContainer:resultTable:"
-                        + "tablePanel:groupForm:checkgroup:dataTable:topToolbars:toolbars:1:headers:24:header:label:"
-                        + "panelReload:reloadLink");
+                        + "tablePanel:groupForm:checkgroup:dataTable:topToolbars:toolbars:1:headers",
"panelReload");
+
+                wicketTester.executeAjaxEvent(component.getPageRelativePath() + ":reloadLink",
Constants.ON_CLICK);
                 iteration++;
-            } else {
-                fail();
             }
-        }
+        } while (iteration < 10);
+
         wicketTester.clickLink("body:toggle:outerObjectsRepeater:2:outer:form:content:tasks:secondLevelContainer:"
                 + "second:executions:firstLevelContainer:first:container:content:searchContainer:resultTable:"
                 + "tablePanel:groupForm:checkgroup:dataTable:body:rows:1:cells:6:cell:panelView:viewLink");


Mime
View raw message