syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmarte...@apache.org
Subject [1/2] syncope git commit: [SYNCOPE-1026] fix + group integration test improvement
Date Mon, 27 Feb 2017 16:48:06 GMT
Repository: syncope
Updated Branches:
  refs/heads/2_0_X 08702cc79 -> fe8fa4f46
  refs/heads/master 2fbe7fb20 -> 6d81b69ac


[SYNCOPE-1026] fix + group integration test improvement


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

Branch: refs/heads/2_0_X
Commit: fe8fa4f466fc0e4c167e722622469599bbf879db
Parents: 08702cc
Author: fmartelli <fabio.martelli@gmail.com>
Authored: Mon Feb 27 17:47:17 2017 +0100
Committer: fmartelli <fabio.martelli@gmail.com>
Committed: Mon Feb 27 17:47:17 2017 +0100

----------------------------------------------------------------------
 .../client/console/wizards/any/Ownership.java   |  3 +-
 .../syncope/fit/console/GroupsITCase.java       | 72 +++++++++++++++++---
 2 files changed, 64 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/fe8fa4f4/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Ownership.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Ownership.java
b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Ownership.java
index 9fe6a0f..494ac38 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Ownership.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Ownership.java
@@ -323,12 +323,11 @@ public class Ownership extends WizardStep implements WizardModel.ICondition
{
             } else if (sel instanceof UserTO) {
                 wrapper.getInnerObject().setUserOwner(sel.getKey());
                 wrapper.getInnerObject().setGroupOwner(null);
-                ((UserSelectionDirectoryPanel.ItemSelection) event.getPayload()).getTarget().add(ownerContainer);
             } else if (sel instanceof GroupTO) {
                 wrapper.getInnerObject().setGroupOwner(sel.getKey());
                 wrapper.getInnerObject().setUserOwner(null);
-                ((GroupSelectionDirectoryPanel.ItemSelection) event.getPayload()).getTarget().add(ownerContainer);
             }
+            ((AnySelectionDirectoryPanel.ItemSelection) event.getPayload()).getTarget().add(ownerContainer);
         } else {
             super.onEvent(event);
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/fe8fa4f4/fit/core-reference/src/test/java/org/apache/syncope/fit/console/GroupsITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/GroupsITCase.java
b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/GroupsITCase.java
index 9b0ff4f..1f95fcb 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/GroupsITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/GroupsITCase.java
@@ -18,8 +18,11 @@
  */
 package org.apache.syncope.fit.console;
 
+import static org.apache.syncope.fit.console.AbstractConsoleITCase.TESTER;
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
+import org.apache.commons.lang3.StringUtils;
 import org.apache.wicket.Component;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.form.TextField;
@@ -84,13 +87,12 @@ public class GroupsITCase extends AbstractConsoleITCase {
                 + "value:textField", TextField.class);
     }
 
-    @Test
-    public void clickToCloneGroup() {
+    private void cloneGroup(final String group) {
         TESTER.clickLink("body:realmsLI:realms");
         TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:2:link");
 
         Component component = findComponentByProp("name", searchResultContainer
-                + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable",
"director");
+                + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable",
group);
         assertNotNull(component);
 
         TESTER.clickLink(component.getPageRelativePath() + ":cells:4:cell:panelClone:cloneLink");
@@ -100,17 +102,44 @@ public class GroupsITCase extends AbstractConsoleITCase {
 
         FormTester formTester = TESTER.newFormTester(tabPanel + "outerObjectsRepeater:0:outer:form:content:form");
         assertNotNull(formTester);
+        formTester.setValue("view:name:textField", group + "_clone");
+        formTester.submit("buttons:finish");
 
-        formTester.submit("buttons:cancel");
+        TESTER.assertInfoMessages("Operation executed successfully");
+        TESTER.cleanupFeedbackMessages();
+
+        TESTER.clickLink("body:content:body:container:content:tabbedPanel:panel:searchResult:outerObjectsRepeater:0:"
+                + "outer:form:content:action:panelClose:closeLink");
+
+        component = findComponentByProp("name", searchResultContainer
+                + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable",
group + "_clone");
+        assertNotNull(component);
+    }
+
+    @Test
+    public void clickToCloneGroup() {
+        cloneGroup("director");
+
+        Component component = findComponentByProp("name", searchResultContainer
+                + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable",
"director_clone");
+        assertNotNull(component);
+        TESTER.getRequest().addParameter("confirm", "true");
+        TESTER.clickLink(TESTER.getComponentFromLastRenderedPage(
+                component.getPageRelativePath() + ":cells:4:cell:panelDelete:deleteLink"));
+
+        TESTER.executeAjaxEvent(TESTER.getComponentFromLastRenderedPage(
+                component.getPageRelativePath() + ":cells:4:cell:panelDelete:deleteLink"),
Constants.ON_CLICK);
+
+        TESTER.assertInfoMessages("Operation executed successfully");
+        TESTER.cleanupFeedbackMessages();
     }
 
     @Test
     public void editGroup() {
-        TESTER.clickLink("body:realmsLI:realms");
-        TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:2:link");
+        cloneGroup("director");
 
         Component component = findComponentByProp("name", searchResultContainer
-                + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable",
"director");
+                + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable",
"director_clone");
         assertNotNull(component);
 
         TESTER.clickLink(component.getPageRelativePath() + ":cells:4:cell:panelEdit:editLink");
@@ -120,9 +149,23 @@ public class GroupsITCase extends AbstractConsoleITCase {
 
         FormTester formTester = TESTER.newFormTester(tabPanel + "outerObjectsRepeater:0:outer:form:content:form");
         assertNotNull(formTester);
-
         formTester.submit("buttons:next");
 
+        // -------------------------
+        // SYNCOPE-1026
+        // -------------------------
+        assertEquals(TESTER.getComponentFromLastRenderedPage("body:content:body:container:content:tabbedPanel:panel:"
+                + "searchResult:outerObjectsRepeater:0:outer:form:content:form:view:ownerContainer:search:userOwner:"
+                + "textField").getDefaultModelObjectAsString(), "[823074dc-d280-436d-a7dd-07399fae48ec]
puccini");
+
+        TESTER.clickLink("body:content:body:container:content:tabbedPanel:panel:searchResult:outerObjectsRepeater:0:"
+                + "outer:form:content:form:view:ownerContainer:search:userOwnerReset");
+
+        assertEquals(TESTER.getComponentFromLastRenderedPage("body:content:body:container:content:tabbedPanel:panel:"
+                + "searchResult:outerObjectsRepeater:0:outer:form:content:form:view:ownerContainer:search:userOwner:"
+                + "textField").getDefaultModelObjectAsString(), StringUtils.EMPTY);
+        // -------------------------
+
         formTester = TESTER.newFormTester(tabPanel + "outerObjectsRepeater:0:outer:form:content:form");
         assertNotNull(formTester);
         formTester.submit("buttons:next");
@@ -152,6 +195,7 @@ public class GroupsITCase extends AbstractConsoleITCase {
         formTester.submit("buttons:finish");
 
         TESTER.assertInfoMessages("Operation executed successfully");
+        TESTER.cleanupFeedbackMessages();
 
         TESTER.assertComponent(tabPanel
                 + "outerObjectsRepeater:0:outer:form:content:customResultBody:resources:firstLevelContainer:first:"
@@ -160,8 +204,18 @@ public class GroupsITCase extends AbstractConsoleITCase {
         TESTER.clickLink(tabPanel + "outerObjectsRepeater:0:outer:form:content:action:panelClose:closeLink");
 
         component = findComponentByProp("name", searchResultContainer
-                + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable",
"director");
+                + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable",
"director_clone");
         assertNotNull(component);
+
+        TESTER.getRequest().addParameter("confirm", "true");
+        TESTER.clickLink(TESTER.getComponentFromLastRenderedPage(
+                component.getPageRelativePath() + ":cells:4:cell:panelDelete:deleteLink"));
+
+        TESTER.executeAjaxEvent(TESTER.getComponentFromLastRenderedPage(
+                component.getPageRelativePath() + ":cells:4:cell:panelDelete:deleteLink"),
Constants.ON_CLICK);
+
+        TESTER.assertInfoMessages("Operation executed successfully");
+        TESTER.cleanupFeedbackMessages();
     }
 
     @Test


Mime
View raw message