You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2016/06/15 13:14:50 UTC

syncope git commit: [SYNCOPE-827] Fixing FIQL filter generation, which was causing test failure

Repository: syncope
Updated Branches:
  refs/heads/master bcc33d296 -> dbdd1bc21


[SYNCOPE-827] Fixing FIQL filter generation, which was causing test failure


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

Branch: refs/heads/master
Commit: dbdd1bc219c89c4666d98b0635041c76b11993d3
Parents: bcc33d2
Author: Francesco Chicchiricc� <il...@apache.org>
Authored: Wed Jun 15 14:16:24 2016 +0200
Committer: Francesco Chicchiricc� <il...@apache.org>
Committed: Wed Jun 15 14:16:24 2016 +0200

----------------------------------------------------------------------
 .../notifications/NotificationWrapper.java      | 15 ++++------
 .../client/console/tasks/PushTaskWrapper.java   | 30 +++++++++++++-------
 .../console/wizards/any/GroupWrapper.java       |  9 ++----
 .../console/wizards/role/RoleWrapper.java       |  7 +----
 .../apache/syncope/fit/core/PushTaskITCase.java |  7 -----
 5 files changed, 27 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/dbdd1bc2/client/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWrapper.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWrapper.java b/client/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWrapper.java
index 031ebb8..1d6ee77 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWrapper.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWrapper.java
@@ -80,23 +80,22 @@ public class NotificationWrapper implements Serializable {
         if (CollectionUtils.isEmpty(this.aboutClauses)) {
             return this.notificationTO.getAbouts();
         } else {
-
-            final Map<String, String> res = new HashMap<>();
+            Map<String, String> res = new HashMap<>();
             for (Pair<String, List<SearchClause>> pair : this.aboutClauses) {
                 AbstractFiqlSearchConditionBuilder builder;
                 switch (pair.getLeft()) {
                     case "USER":
                         builder = SyncopeClient.getUserSearchConditionBuilder();
                         break;
+
                     case "GROUP":
                         builder = SyncopeClient.getGroupSearchConditionBuilder();
                         break;
+
                     default:
                         builder = SyncopeClient.getAnyObjectSearchConditionBuilder(pair.getLeft());
-                        break;
-
                 }
-                res.put(pair.getLeft(), getFIQLString(pair.getRight(), builder));
+                res.put(pair.getLeft(), SearchUtils.buildFIQL(pair.getRight(), builder));
             }
             return res;
         }
@@ -106,14 +105,10 @@ public class NotificationWrapper implements Serializable {
         if (CollectionUtils.isEmpty(this.recipientClauses)) {
             return null;
         } else {
-            return getFIQLString(this.recipientClauses, SyncopeClient.getUserSearchConditionBuilder());
+            return SearchUtils.buildFIQL(this.recipientClauses, SyncopeClient.getUserSearchConditionBuilder());
         }
     }
 
-    private String getFIQLString(final List<SearchClause> clauses, final AbstractFiqlSearchConditionBuilder bld) {
-        return SearchUtils.buildFIQL(clauses, bld);
-    }
-
     public NotificationTO fillAboutConditions() {
         this.notificationTO.getAbouts().clear();
         this.notificationTO.getAbouts().putAll(this.getAboutFIQLs());

http://git-wip-us.apache.org/repos/asf/syncope/blob/dbdd1bc2/client/console/src/main/java/org/apache/syncope/client/console/tasks/PushTaskWrapper.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/tasks/PushTaskWrapper.java b/client/console/src/main/java/org/apache/syncope/client/console/tasks/PushTaskWrapper.java
index 9b55bb7..0b35971 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/tasks/PushTaskWrapper.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/tasks/PushTaskWrapper.java
@@ -54,21 +54,29 @@ public class PushTaskWrapper implements Serializable {
     }
 
     public Map<String, String> getFilters() {
-        final Map<String, String> res = new HashMap<>();
-        if (this.filterClauses != null && !this.filterClauses.isEmpty()) {
-            for (Map.Entry<String, List<SearchClause>> entry : this.filterClauses.entrySet()) {
-                if (CollectionUtils.isNotEmpty(entry.getValue())) {
-                    res.put(entry.getKey(), getFIQLString(entry.getValue(),
-                            SyncopeClient.getAnyObjectSearchConditionBuilder(entry.getKey())));
+        Map<String, String> filters = new HashMap<>();
+
+        for (Map.Entry<String, List<SearchClause>> entry : getFilterClauses().entrySet()) {
+            if (CollectionUtils.isNotEmpty(entry.getValue())) {
+                AbstractFiqlSearchConditionBuilder bld;
+                switch (entry.getKey()) {
+                    case "USER":
+                        bld = SyncopeClient.getUserSearchConditionBuilder();
+                        break;
+
+                    case "GROUP":
+                        bld = SyncopeClient.getGroupSearchConditionBuilder();
+                        break;
+
+                    default:
+                        bld = SyncopeClient.getAnyObjectSearchConditionBuilder(entry.getKey());
                 }
+
+                filters.put(entry.getKey(), SearchUtils.buildFIQL(entry.getValue(), bld));
             }
         }
 
-        return res;
-    }
-
-    private String getFIQLString(final List<SearchClause> clauses, final AbstractFiqlSearchConditionBuilder bld) {
-        return SearchUtils.buildFIQL(clauses, bld);
+        return filters;
     }
 
     public PushTaskTO fillFilterConditions() {

http://git-wip-us.apache.org/repos/asf/syncope/blob/dbdd1bc2/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/GroupWrapper.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/GroupWrapper.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/GroupWrapper.java
index da39fe4..97a3f6e 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/GroupWrapper.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/GroupWrapper.java
@@ -25,7 +25,6 @@ import org.apache.commons.collections4.CollectionUtils;
 import org.apache.syncope.client.console.panels.search.SearchClause;
 import org.apache.syncope.client.console.panels.search.SearchUtils;
 import org.apache.syncope.client.lib.SyncopeClient;
-import org.apache.syncope.common.lib.search.AbstractFiqlSearchConditionBuilder;
 import org.apache.syncope.common.lib.to.GroupTO;
 
 public class GroupWrapper extends AnyWrapper<GroupTO> {
@@ -68,7 +67,7 @@ public class GroupWrapper extends AnyWrapper<GroupTO> {
         if (CollectionUtils.isEmpty(this.uDynClauses)) {
             return null;
         } else {
-            return getFIQLString(this.uDynClauses, SyncopeClient.getUserSearchConditionBuilder());
+            return SearchUtils.buildFIQL(this.uDynClauses, SyncopeClient.getUserSearchConditionBuilder());
         }
     }
 
@@ -77,7 +76,7 @@ public class GroupWrapper extends AnyWrapper<GroupTO> {
         if (this.aDynClauses != null && !this.aDynClauses.isEmpty()) {
             for (Map.Entry<String, List<SearchClause>> entry : this.aDynClauses.entrySet()) {
                 if (CollectionUtils.isNotEmpty(entry.getValue())) {
-                    res.put(entry.getKey(), getFIQLString(entry.getValue(),
+                    res.put(entry.getKey(), SearchUtils.buildFIQL(entry.getValue(),
                             SyncopeClient.getAnyObjectSearchConditionBuilder(entry.getKey())));
                 }
             }
@@ -86,10 +85,6 @@ public class GroupWrapper extends AnyWrapper<GroupTO> {
         return res;
     }
 
-    private String getFIQLString(final List<SearchClause> clauses, final AbstractFiqlSearchConditionBuilder bld) {
-        return SearchUtils.buildFIQL(clauses, bld);
-    }
-
     public GroupTO fillDynamicConditions() {
         this.anyTO.setUDynMembershipCond(this.getUDynMembershipCond());
         this.anyTO.getADynMembershipConds().clear();

http://git-wip-us.apache.org/repos/asf/syncope/blob/dbdd1bc2/client/console/src/main/java/org/apache/syncope/client/console/wizards/role/RoleWrapper.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/role/RoleWrapper.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/role/RoleWrapper.java
index 462ffed..70cfb99 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/role/RoleWrapper.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/role/RoleWrapper.java
@@ -24,7 +24,6 @@ import org.apache.commons.collections4.CollectionUtils;
 import org.apache.syncope.client.console.panels.search.SearchClause;
 import org.apache.syncope.client.console.panels.search.SearchUtils;
 import org.apache.syncope.client.lib.SyncopeClient;
-import org.apache.syncope.common.lib.search.AbstractFiqlSearchConditionBuilder;
 import org.apache.syncope.common.lib.to.RoleTO;
 
 public class RoleWrapper implements Serializable {
@@ -55,14 +54,10 @@ public class RoleWrapper implements Serializable {
         if (CollectionUtils.isEmpty(this.dynClauses)) {
             return null;
         } else {
-            return getFIQLString(this.dynClauses, SyncopeClient.getUserSearchConditionBuilder());
+            return SearchUtils.buildFIQL(this.dynClauses, SyncopeClient.getUserSearchConditionBuilder());
         }
     }
 
-    private String getFIQLString(final List<SearchClause> clauses, final AbstractFiqlSearchConditionBuilder bld) {
-        return SearchUtils.buildFIQL(clauses, bld);
-    }
-
     public RoleTO fillDynamicConditions() {
         this.roleTO.setDynMembershipCond(this.getDynMembershipCond());
         return this.roleTO;

http://git-wip-us.apache.org/repos/asf/syncope/blob/dbdd1bc2/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PushTaskITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PushTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PushTaskITCase.java
index 243aff7..e5fa045 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PushTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PushTaskITCase.java
@@ -127,13 +127,6 @@ public class PushTaskITCase extends AbstractTaskITCase {
                 RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), "29f96485-729e-4d31-88a1-6fc60e4677f3"));
         assertTrue(groupService.read("29f96485-729e-4d31-88a1-6fc60e4677f3").
                 getResources().contains(RESOURCE_NAME_LDAP));
-
-        execProvisioningTask(taskService, "fd905ba5-9d56-4f51-83e2-859096a67b75", 50, false);
-
-        assertNotNull(resourceService.readConnObject(
-                RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), "29f96485-729e-4d31-88a1-6fc60e4677f3"));
-        assertFalse(groupService.read("29f96485-729e-4d31-88a1-6fc60e4677f3").
-                getResources().contains(RESOURCE_NAME_LDAP));
     }
 
     @Test