syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject svn commit: r1551172 [7/7] - in /syncope/trunk: ./ client/ client/src/main/java/org/apache/syncope/client/ client/src/main/java/org/apache/syncope/client/rest/ common/ common/src/main/java/org/apache/syncope/common/ common/src/main/java/org/apache/sync...
Date Mon, 16 Dec 2013 11:04:57 GMT
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SearchTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SearchTestITCase.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SearchTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SearchTestITCase.java Mon Dec 16 11:04:52 2013
@@ -24,17 +24,13 @@ import static org.junit.Assert.assertNot
 import static org.junit.Assert.assertTrue;
 
 import java.util.HashSet;
-import java.util.List;
 import java.util.Set;
 
-import org.apache.syncope.common.search.AttributableCond;
-import org.apache.syncope.common.search.AttributeCond;
-import org.apache.syncope.common.search.EntitlementCond;
-import org.apache.syncope.common.search.NodeCond;
-import org.apache.syncope.common.search.ResourceCond;
-import org.apache.syncope.common.services.InvalidSearchConditionException;
+import org.apache.syncope.client.SyncopeClient;
+import org.apache.syncope.common.reqres.PagedResult;
 import org.apache.syncope.common.to.RoleTO;
 import org.apache.syncope.common.to.UserTO;
+
 import org.junit.FixMethodOrder;
 import org.junit.Test;
 import org.junit.runners.MethodSorters;
@@ -43,40 +39,26 @@ import org.junit.runners.MethodSorters;
 public class SearchTestITCase extends AbstractTest {
 
     @Test
-    public void searchUser() throws InvalidSearchConditionException {
+    public void searchUser() {
         // LIKE
-        AttributeCond fullnameLeafCond1 = new AttributeCond(AttributeCond.Type.LIKE);
-        fullnameLeafCond1.setSchema("fullname");
-        fullnameLeafCond1.setExpression("%o%");
-
-        AttributeCond fullnameLeafCond2 = new AttributeCond(AttributeCond.Type.LIKE);
-        fullnameLeafCond2.setSchema("fullname");
-        fullnameLeafCond2.setExpression("%i%");
-
-        NodeCond searchCondition = NodeCond.getAndCond(NodeCond.getLeafCond(fullnameLeafCond1), NodeCond.getLeafCond(
-                fullnameLeafCond2));
-
-        assertTrue(searchCondition.isValid());
-
-        List<UserTO> matchedUsers = userService.search(searchCondition);
-        
+        PagedResult<UserTO> matchedUsers = userService.search(
+                SyncopeClient.getSearchConditionBuilder().
+                is("fullname").equalTo("*o*").and("fullname").equalTo("*i*").query());
         assertNotNull(matchedUsers);
-        assertFalse(matchedUsers.isEmpty());
-        for (UserTO user : matchedUsers) {
+        assertFalse(matchedUsers.getResult().isEmpty());
+
+        for (UserTO user : matchedUsers.getResult()) {
             assertNotNull(user);
         }
 
         // ISNULL
-        AttributeCond isNullCond = new AttributeCond(AttributeCond.Type.ISNULL);
-        isNullCond.setSchema("loginDate");
-        searchCondition = NodeCond.getLeafCond(isNullCond);
-
-        matchedUsers = userService.search(searchCondition);
+        matchedUsers = userService.search(
+                SyncopeClient.getSearchConditionBuilder().isNull("loginDate").query());
         assertNotNull(matchedUsers);
-        assertFalse(matchedUsers.isEmpty());
+        assertFalse(matchedUsers.getResult().isEmpty());
 
-        Set<Long> userIds = new HashSet<Long>(matchedUsers.size());
-        for (UserTO user : matchedUsers) {
+        Set<Long> userIds = new HashSet<Long>(matchedUsers.getResult().size());
+        for (UserTO user : matchedUsers.getResult()) {
             userIds.add(user.getId());
         }
         assertTrue(userIds.contains(2L));
@@ -84,69 +66,38 @@ public class SearchTestITCase extends Ab
     }
 
     @Test
-    public void searchByUsernameAndId() throws InvalidSearchConditionException {
-        final AttributableCond usernameLeafCond = new AttributableCond(AttributableCond.Type.EQ);
-        usernameLeafCond.setSchema("username");
-        usernameLeafCond.setExpression("rossini");
-
-        final AttributableCond idRightCond = new AttributableCond(AttributableCond.Type.LT);
-        idRightCond.setSchema("id");
-        idRightCond.setExpression("2");
-
-        final NodeCond searchCondition = NodeCond.getAndCond(NodeCond.getLeafCond(usernameLeafCond), NodeCond.
-                getLeafCond(idRightCond));
-
-        assertTrue(searchCondition.isValid());
-
-        final List<UserTO> matchingUsers = userService.search(searchCondition);
+    public void searchByUsernameAndId() {
+        final PagedResult<UserTO> matchingUsers = userService.search(
+                SyncopeClient.getSearchConditionBuilder().
+                is("username").equalTo("rossini").and("id").lessThan(2).query());
 
         assertNotNull(matchingUsers);
-        assertEquals(1, matchingUsers.size());
-        assertEquals("rossini", matchingUsers.iterator().next().getUsername());
-        assertEquals(1L, matchingUsers.iterator().next().getId());
+        assertEquals(1, matchingUsers.getResult().size());
+        assertEquals("rossini", matchingUsers.getResult().iterator().next().getUsername());
+        assertEquals(1L, matchingUsers.getResult().iterator().next().getId());
     }
 
     @Test
-    public void searchByRolenameAndId() throws InvalidSearchConditionException {
-        final AttributableCond rolenameLeafCond = new AttributableCond(AttributableCond.Type.EQ);
-        rolenameLeafCond.setSchema("name");
-        rolenameLeafCond.setExpression("root");
-
-        final AttributableCond idRightCond = new AttributableCond(AttributableCond.Type.LT);
-        idRightCond.setSchema("id");
-        idRightCond.setExpression("2");
-
-        final NodeCond searchCondition = NodeCond.getAndCond(NodeCond.getLeafCond(rolenameLeafCond),
-                NodeCond.getLeafCond(idRightCond));
-
-        assertTrue(searchCondition.isValid());
-
-        final List<RoleTO> matchingRoles = roleService.search(searchCondition);
+    public void searchByRolenameAndId() {
+        final PagedResult<RoleTO> matchingRoles = roleService.search(
+                SyncopeClient.getSearchConditionBuilder().
+                is("name").equalTo("root").and("id").lessThan(2).query());
 
         assertNotNull(matchingRoles);
-        assertEquals(1, matchingRoles.size());
-        assertEquals("root", matchingRoles.iterator().next().getName());
-        assertEquals(1L, matchingRoles.iterator().next().getId());
+        assertEquals(1, matchingRoles.getResult().size());
+        assertEquals("root", matchingRoles.getResult().iterator().next().getName());
+        assertEquals(1L, matchingRoles.getResult().iterator().next().getId());
     }
 
     @Test
-    public void searchUserByResourceName() throws InvalidSearchConditionException {
-        ResourceCond ws2 = new ResourceCond();
-        ws2.setResourceName("ws-target-resource2");
-
-        ResourceCond ws1 = new ResourceCond();
-        ws1.setResourceName(RESOURCE_NAME_MAPPINGS2);
-
-        NodeCond searchCondition = NodeCond.getAndCond(NodeCond.getNotLeafCond(ws2), NodeCond.getLeafCond(ws1));
-
-        assertTrue(searchCondition.isValid());
-
-        List<UserTO> matchedUsers = userService.search(searchCondition);
+    public void searchUserByResourceName() {
+        PagedResult<UserTO> matchedUsers = userService.search(
+                SyncopeClient.getSearchConditionBuilder().hasResources(RESOURCE_NAME_MAPPINGS2).query());
         assertNotNull(matchedUsers);
-        assertFalse(matchedUsers.isEmpty());
+        assertFalse(matchedUsers.getResult().isEmpty());
 
-        Set<Long> userIds = new HashSet<Long>(matchedUsers.size());
-        for (UserTO user : matchedUsers) {
+        Set<Long> userIds = new HashSet<Long>(matchedUsers.getResult().size());
+        for (UserTO user : matchedUsers.getResult()) {
             userIds.add(user.getId());
         }
 
@@ -155,105 +106,67 @@ public class SearchTestITCase extends Ab
     }
 
     @Test
-    public void paginatedSearch() throws InvalidSearchConditionException {
+    public void paginatedSearch() {
         // LIKE
-        AttributeCond fullnameLeafCond1 = new AttributeCond(AttributeCond.Type.LIKE);
-        fullnameLeafCond1.setSchema("fullname");
-        fullnameLeafCond1.setExpression("%o%");
-
-        AttributeCond fullnameLeafCond2 = new AttributeCond(AttributeCond.Type.LIKE);
-        fullnameLeafCond2.setSchema("fullname");
-        fullnameLeafCond2.setExpression("%i%");
-
-        NodeCond searchCondition = NodeCond.getAndCond(NodeCond.getLeafCond(fullnameLeafCond1), NodeCond.getLeafCond(
-                fullnameLeafCond2));
-
-        assertTrue(searchCondition.isValid());
-
-        List<UserTO> matchedUsers = userService.search(searchCondition, 1, 2);
+        PagedResult<UserTO> matchedUsers = userService.search(
+                SyncopeClient.getSearchConditionBuilder().
+                is("fullname").equalTo("*o*").and("fullname").equalTo("*i*").query(), 1, 2);
         assertNotNull(matchedUsers);
 
-        assertFalse(matchedUsers.isEmpty());
-        for (UserTO user : matchedUsers) {
+        assertFalse(matchedUsers.getResult().isEmpty());
+        for (UserTO user : matchedUsers.getResult()) {
             assertNotNull(user);
         }
 
         // ISNULL
-        AttributeCond isNullCond = new AttributeCond(AttributeCond.Type.ISNULL);
-        isNullCond.setSchema("loginDate");
-        searchCondition = NodeCond.getLeafCond(isNullCond);
-
-        matchedUsers = userService.search(searchCondition, 1, 2);
+        matchedUsers = userService.search(
+                SyncopeClient.getSearchConditionBuilder().isNull("loginDate").query(), 1, 2);
 
         assertNotNull(matchedUsers);
-        assertFalse(matchedUsers.isEmpty());
-        Set<Long> userIds = new HashSet<Long>(matchedUsers.size());
-        for (UserTO user : matchedUsers) {
+        assertFalse(matchedUsers.getResult().isEmpty());
+        Set<Long> userIds = new HashSet<Long>(matchedUsers.getResult().size());
+        for (UserTO user : matchedUsers.getResult()) {
             userIds.add(user.getId());
         }
         assertEquals(2, userIds.size());
     }
 
     @Test
-    public void searchCount() throws InvalidSearchConditionException {
-        AttributeCond isNullCond = new AttributeCond(AttributeCond.Type.ISNULL);
-        isNullCond.setSchema("loginDate");
-        NodeCond searchCond = NodeCond.getLeafCond(isNullCond);
-
-        Integer count = userService.searchCount(searchCond);
-        assertNotNull(count);
-        assertTrue(count > 0);
+    public void searchByBooleanAttributableCond() {
+        final PagedResult<RoleTO> matchingRoles = roleService.search(
+                SyncopeClient.getSearchConditionBuilder().is("inheritAttrs").equalTo("true").query());
+        assertNotNull(matchingRoles);
+        assertFalse(matchingRoles.getResult().isEmpty());
     }
 
     @Test
-    public void searchByBooleanAttributableCond() throws InvalidSearchConditionException {
-        final AttributableCond cond = new AttributableCond(AttributableCond.Type.EQ);
-        cond.setSchema("inheritAttrs");
-        cond.setExpression("true");
-
-        final NodeCond searchCondition = NodeCond.getLeafCond(cond);
-
-        final List<RoleTO> matchingRoles = roleService.search(searchCondition);
+    public void searchByEntitlement() {
+        final PagedResult<RoleTO> matchingRoles = roleService.search(
+                SyncopeClient.getSearchConditionBuilder().hasEntitlements("USER_LIST", "USER_READ").query());
         assertNotNull(matchingRoles);
-        assertFalse(matchingRoles.isEmpty());
+        assertFalse(matchingRoles.getResult().isEmpty());
     }
 
     @Test
-    public void searchByEntitlement() throws InvalidSearchConditionException {
-        final EntitlementCond userListCond = new EntitlementCond();
-        userListCond.setExpression("USER_LIST");
-
-        final EntitlementCond userReadcond = new EntitlementCond();
-        userReadcond.setExpression("USER_READ");
+    public void searchByRelationshipAttributableCond() {
+        final PagedResult<RoleTO> matchingRoles = roleService.search(SyncopeClient.getSearchConditionBuilder().
+                isNotNull("passwordPolicy").and("userOwner").equalTo(5).query());
 
-        final NodeCond searchCondition = NodeCond.getAndCond(NodeCond.getLeafCond(userListCond),
-                NodeCond.getLeafCond(userReadcond));
-        assertTrue(searchCondition.isValid());
-
-        final List<RoleTO> matchingRoles = roleService.search(searchCondition);
         assertNotNull(matchingRoles);
-        assertFalse(matchingRoles.isEmpty());
+        assertEquals(1, matchingRoles.getResult().size());
+        assertEquals("director", matchingRoles.getResult().iterator().next().getName());
+        assertEquals(6L, matchingRoles.getResult().iterator().next().getId());
     }
 
     @Test
-    public void searchByRelationshipAttributableCond() throws InvalidSearchConditionException {
-        final AttributableCond userOwnerCond = new AttributableCond(AttributableCond.Type.EQ);
-        userOwnerCond.setSchema("userOwner");
-        userOwnerCond.setExpression("5");
-
-        final AttributableCond ppolicyCond = new AttributableCond(AttributableCond.Type.ISNOTNULL);
-        ppolicyCond.setSchema("passwordPolicy");
-
-        final NodeCond searchCondition = NodeCond.getAndCond(NodeCond.getLeafCond(userOwnerCond),
-                NodeCond.getLeafCond(ppolicyCond));
-
-        assertTrue(searchCondition.isValid());
-
-        final List<RoleTO> matchingRoles = roleService.search(searchCondition);
+    public void nested() {
+        PagedResult<UserTO> matchedUsers = userService.search(
+                "((fullname==*o*,fullname==*i*);$resources!=ws-target-resource-1)", 1, 2);
+        assertNotNull(matchedUsers);
 
-        assertNotNull(matchingRoles);
-        assertEquals(1, matchingRoles.size());
-        assertEquals("director", matchingRoles.iterator().next().getName());
-        assertEquals(6L, matchingRoles.iterator().next().getId());
+        assertFalse(matchedUsers.getResult().isEmpty());
+        for (UserTO user : matchedUsers.getResult()) {
+            assertNotNull(user);
+        }
     }
 }

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java Mon Dec 16 11:04:52 2013
@@ -28,17 +28,13 @@ import static org.junit.Assert.fail;
 import java.util.ArrayList;
 import java.util.List;
 import javax.ws.rs.core.Response;
+import org.apache.syncope.client.SyncopeClient;
 import org.apache.syncope.common.mod.UserMod;
-import org.apache.syncope.common.search.AttributableCond;
-import org.apache.syncope.common.search.AttributeCond;
-import org.apache.syncope.common.search.MembershipCond;
-import org.apache.syncope.common.search.NodeCond;
-import org.apache.syncope.common.services.InvalidSearchConditionException;
 import org.apache.syncope.common.services.NotificationService;
 import org.apache.syncope.common.services.TaskService;
 import org.apache.syncope.common.to.AttributeTO;
-import org.apache.syncope.common.to.BulkAction;
-import org.apache.syncope.common.to.JobClassTO;
+import org.apache.syncope.common.reqres.BulkAction;
+import org.apache.syncope.common.wrap.JobClass;
 import org.apache.syncope.common.to.MembershipTO;
 import org.apache.syncope.common.to.NotificationTO;
 import org.apache.syncope.common.to.NotificationTaskTO;
@@ -46,17 +42,18 @@ import org.apache.syncope.common.to.Prop
 import org.apache.syncope.common.to.ReportExecTO;
 import org.apache.syncope.common.to.RoleTO;
 import org.apache.syncope.common.to.SchedTaskTO;
-import org.apache.syncope.common.to.SyncActionClassTO;
+import org.apache.syncope.common.wrap.SyncActionClass;
 import org.apache.syncope.common.to.SyncPolicyTO;
 import org.apache.syncope.common.to.SyncTaskTO;
 import org.apache.syncope.common.to.TaskExecTO;
 import org.apache.syncope.common.to.AbstractTaskTO;
+import org.apache.syncope.common.reqres.PagedResult;
 import org.apache.syncope.common.to.UserTO;
 import org.apache.syncope.common.types.IntMappingType;
 import org.apache.syncope.common.types.PropagationTaskExecStatus;
 import org.apache.syncope.common.types.TaskType;
 import org.apache.syncope.common.types.TraceLevel;
-import org.apache.syncope.common.validation.SyncopeClientException;
+import org.apache.syncope.common.SyncopeClientException;
 import org.apache.syncope.core.sync.TestSyncActions;
 import org.apache.syncope.core.sync.TestSyncRule;
 import org.apache.syncope.core.sync.impl.SyncJob;
@@ -91,14 +88,14 @@ public class TaskTestITCase extends Abst
 
     @Test
     public void getJobClasses() {
-        List<JobClassTO> jobClasses = taskService.getJobClasses();
+        List<JobClass> jobClasses = taskService.getJobClasses();
         assertNotNull(jobClasses);
         assertFalse(jobClasses.isEmpty());
     }
 
     @Test
     public void getSyncActionsClasses() {
-        List<SyncActionClassTO> actions = taskService.getSyncActionsClasses();
+        List<SyncActionClass> actions = taskService.getSyncActionsClasses();
         assertNotNull(actions);
         assertFalse(actions.isEmpty());
     }
@@ -150,48 +147,41 @@ public class TaskTestITCase extends Abst
     }
 
     @Test
-    public void count() {
-        Integer count = taskService.count(TaskType.PROPAGATION);
-        assertNotNull(count);
-        assertTrue(count > 0);
-    }
-
-    @Test
     public void list() {
-        List<PropagationTaskTO> tasks = taskService.list(TaskType.PROPAGATION);
+        PagedResult<PropagationTaskTO> tasks = taskService.list(TaskType.PROPAGATION);
 
         assertNotNull(tasks);
-        assertFalse(tasks.isEmpty());
-        for (AbstractTaskTO task : tasks) {
+        assertFalse(tasks.getResult().isEmpty());
+        for (AbstractTaskTO task : tasks.getResult()) {
             assertNotNull(task);
         }
     }
 
     @Test
     public void paginatedList() {
-        List<PropagationTaskTO> tasks = taskService.list(TaskType.PROPAGATION, 1, 2);
+        PagedResult<PropagationTaskTO> tasks = taskService.list(TaskType.PROPAGATION, 1, 2);
 
         assertNotNull(tasks);
-        assertFalse(tasks.isEmpty());
-        assertEquals(2, tasks.size());
+        assertFalse(tasks.getResult().isEmpty());
+        assertEquals(2, tasks.getResult().size());
 
-        for (AbstractTaskTO task : tasks) {
+        for (AbstractTaskTO task : tasks.getResult()) {
             assertNotNull(task);
         }
 
         tasks = taskService.list(TaskType.PROPAGATION, 2, 2);
 
         assertNotNull(tasks);
-        assertFalse(tasks.isEmpty());
+        assertFalse(tasks.getResult().isEmpty());
 
-        for (AbstractTaskTO task : tasks) {
+        for (AbstractTaskTO task : tasks.getResult()) {
             assertNotNull(task);
         }
 
         tasks = taskService.list(TaskType.PROPAGATION, 1000, 2);
 
         assertNotNull(tasks);
-        assertTrue(tasks.isEmpty());
+        assertTrue(tasks.getResult().isEmpty());
     }
 
     @Test
@@ -261,7 +251,7 @@ public class TaskTestITCase extends Abst
 
         // -----------------------------
         try {
-            int usersPre = userService.count();
+            int usersPre = userService.list(1, 1).getTotalCount();
             assertNotNull(usersPre);
 
             // Update sync task
@@ -318,7 +308,7 @@ public class TaskTestITCase extends Abst
             assertEquals("TYPE_8", userTO.getAttrMap().get("type").getValues().get(0));
 
             // check for sync results
-            int usersPost = userService.count();
+            int usersPost = userService.list(1, 1).getTotalCount();
             assertNotNull(usersPost);
             assertEquals(usersPre + 9, usersPost);
 
@@ -386,9 +376,7 @@ public class TaskTestITCase extends Abst
     }
 
     @Test
-    public void reconcileFromLDAP()
-            throws InvalidSearchConditionException {
-
+    public void reconcileFromLDAP() {
         // Update sync task
         SyncTaskTO task = taskService.read(11L);
         assertNotNull(task);
@@ -423,37 +411,33 @@ public class TaskTestITCase extends Abst
         assertTrue(PropagationTaskExecStatus.valueOf(status).isSuccessful());
 
         // 2. verify that synchronized role is found, with expected attributes
-        final AttributableCond rolenameLeafCond = new AttributableCond(AttributableCond.Type.EQ);
-        rolenameLeafCond.setSchema("name");
-        rolenameLeafCond.setExpression("testLDAPGroup");
-        final List<RoleTO> matchingRoles = roleService.search(NodeCond.getLeafCond(rolenameLeafCond));
+        final PagedResult<RoleTO> matchingRoles = roleService.search(
+                SyncopeClient.getSearchConditionBuilder().is("name").equalTo("testLDAPGroup").query());
         assertNotNull(matchingRoles);
-        assertEquals(1, matchingRoles.size());
+        assertEquals(1, matchingRoles.getResult().size());
 
-        final AttributableCond usernameLeafCond = new AttributableCond(AttributeCond.Type.EQ);
-        usernameLeafCond.setSchema("username");
-        usernameLeafCond.setExpression("syncFromLDAP");
-        final List<UserTO> matchingUsers = userService.search(NodeCond.getLeafCond(usernameLeafCond));
+        final PagedResult<UserTO> matchingUsers = userService.search(
+                SyncopeClient.getSearchConditionBuilder().is("username").equalTo("syncFromLDAP").query());
         assertNotNull(matchingUsers);
-        assertEquals(1, matchingUsers.size());
+        assertEquals(1, matchingUsers.getResult().size());
 
         // Check for SYNCOPE-436
-        assertEquals("syncFromLDAP", matchingUsers.get(0).getVirAttrMap().get("virtualReadOnly").getValues().get(0));
+        assertEquals("syncFromLDAP", matchingUsers.getResult().get(0).getVirAttrMap().
+                get("virtualReadOnly").getValues().get(0));
 
-        final RoleTO roleTO = matchingRoles.iterator().next();
+        final RoleTO roleTO = matchingRoles.getResult().iterator().next();
         assertNotNull(roleTO);
         assertEquals("testLDAPGroup", roleTO.getName());
         assertEquals(8L, roleTO.getParent());
         assertEquals("true", roleTO.getAttrMap().get("show").getValues().get(0));
-        assertEquals(matchingUsers.iterator().next().getId(), (long) roleTO.getUserOwner());
+        assertEquals(matchingUsers.getResult().iterator().next().getId(), (long) roleTO.getUserOwner());
         assertNull(roleTO.getRoleOwner());
 
         // 3. verify that LDAP group membership is propagated as Syncope role membership
-        final MembershipCond membershipCond = new MembershipCond();
-        membershipCond.setRoleId(roleTO.getId());
-        final List<UserTO> members = userService.search(NodeCond.getLeafCond(membershipCond));
+        final PagedResult<UserTO> members = userService.search(
+                SyncopeClient.getSearchConditionBuilder().hasRoles(roleTO.getId()).query());
         assertNotNull(members);
-        assertEquals(1, members.size());
+        assertEquals(1, members.getResult().size());
     }
 
     @Test
@@ -535,11 +519,11 @@ public class TaskTestITCase extends Abst
     }
 
     private NotificationTaskTO findNotificationTaskBySender(final String sender) {
-        List<NotificationTaskTO> tasks = taskService.list(TaskType.NOTIFICATION);
+        PagedResult<NotificationTaskTO> tasks = taskService.list(TaskType.NOTIFICATION);
         assertNotNull(tasks);
-        assertFalse(tasks.isEmpty());
+        assertFalse(tasks.getResult().isEmpty());
         NotificationTaskTO taskTO = null;
-        for (NotificationTaskTO task : tasks) {
+        for (NotificationTaskTO task : tasks.getResult()) {
             if (sender.equals(task.getSender())) {
                 taskTO = task;
             }
@@ -553,13 +537,9 @@ public class TaskTestITCase extends Abst
         notification.setTraceLevel(TraceLevel.FAILURES);
         notification.getEvents().add("[REST]:[UserController]:[]:[create]:[SUCCESS]");
 
-        MembershipCond membCond = new MembershipCond();
-        membCond.setRoleId(7L);
-        notification.setAbout(NodeCond.getLeafCond(membCond));
-
-        membCond = new MembershipCond();
-        membCond.setRoleId(8L);
-        notification.setRecipients(NodeCond.getLeafCond(membCond));
+        notification.setAbout(SyncopeClient.getSearchConditionBuilder().hasRoles(7L).query());
+
+        notification.setRecipients(SyncopeClient.getSearchConditionBuilder().hasRoles(8L).query());
         notification.setSelfAsRecipient(true);
 
         notification.setRecipientAttrName("email");
@@ -905,7 +885,7 @@ public class TaskTestITCase extends Abst
 
     @Test
     public void bulkAction() {
-        final List<PropagationTaskTO> before = taskService.list(TaskType.PROPAGATION);
+        final PagedResult<PropagationTaskTO> before = taskService.list(TaskType.PROPAGATION);
 
         // create user with testdb resource
         final UserTO userTO = UserTestITCase.getUniqueSampleTO("taskBulk@apache.org");
@@ -913,9 +893,9 @@ public class TaskTestITCase extends Abst
         createUser(userTO);
 
         final List<PropagationTaskTO> after = new ArrayList<PropagationTaskTO>(
-                taskService.<PropagationTaskTO>list(TaskType.PROPAGATION));
+                taskService.<PropagationTaskTO>list(TaskType.PROPAGATION).getResult());
 
-        after.removeAll(before);
+        after.removeAll(before.getResult());
 
         assertFalse(after.isEmpty());
 
@@ -928,6 +908,6 @@ public class TaskTestITCase extends Abst
 
         taskService.bulk(bulkAction);
 
-        assertFalse(taskService.list(TaskType.PROPAGATION).containsAll(after));
+        assertFalse(taskService.list(TaskType.PROPAGATION).getResult().containsAll(after));
     }
 }

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserSelfTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserSelfTestITCase.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserSelfTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserSelfTestITCase.java Mon Dec 16 11:04:52 2013
@@ -47,7 +47,7 @@ import org.apache.syncope.common.types.A
 import org.apache.syncope.common.types.ClientExceptionType;
 import org.apache.syncope.common.types.Preference;
 import org.apache.syncope.common.types.RESTHeaders;
-import org.apache.syncope.common.validation.SyncopeClientException;
+import org.apache.syncope.common.SyncopeClientException;
 import org.apache.syncope.core.workflow.ActivitiDetector;
 import org.junit.Assume;
 import org.junit.FixMethodOrder;

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java Mon Dec 16 11:04:52 2013
@@ -43,17 +43,17 @@ import org.apache.syncope.common.service
 import org.apache.syncope.common.services.ResourceService;
 import org.apache.syncope.common.services.UserSelfService;
 import org.apache.syncope.common.to.AttributeTO;
-import org.apache.syncope.common.to.BulkAction;
-import org.apache.syncope.common.to.BulkActionRes;
-import org.apache.syncope.common.to.BulkActionRes.Status;
+import org.apache.syncope.common.reqres.BulkAction;
+import org.apache.syncope.common.reqres.BulkActionResult;
+import org.apache.syncope.common.reqres.BulkActionResult.Status;
 import org.apache.syncope.common.to.ConfigurationTO;
 import org.apache.syncope.common.to.ConnObjectTO;
 import org.apache.syncope.common.to.MappingItemTO;
 import org.apache.syncope.common.to.MembershipTO;
 import org.apache.syncope.common.to.PasswordPolicyTO;
-import org.apache.syncope.common.to.PropagationStatusTO;
+import org.apache.syncope.common.to.PropagationStatus;
 import org.apache.syncope.common.to.PropagationTaskTO;
-import org.apache.syncope.common.to.ResourceNameTO;
+import org.apache.syncope.common.wrap.ResourceName;
 import org.apache.syncope.common.to.ResourceTO;
 import org.apache.syncope.common.to.RoleTO;
 import org.apache.syncope.common.to.UserTO;
@@ -66,7 +66,7 @@ import org.apache.syncope.common.types.R
 import org.apache.syncope.common.types.TaskType;
 import org.apache.syncope.common.util.AttributableOperations;
 import org.apache.syncope.common.util.CollectionWrapper;
-import org.apache.syncope.common.validation.SyncopeClientException;
+import org.apache.syncope.common.SyncopeClientException;
 import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
 import org.apache.syncope.core.workflow.ActivitiDetector;
 import org.identityconnectors.framework.common.objects.OperationalAttributes;
@@ -80,6 +80,7 @@ import org.apache.commons.lang3.StringUt
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.syncope.client.SyncopeClient;
 import org.apache.syncope.common.services.UserService;
+import org.apache.syncope.common.reqres.PagedResult;
 import org.apache.syncope.common.types.Preference;
 import org.apache.syncope.common.types.RESTHeaders;
 import org.identityconnectors.framework.common.objects.Name;
@@ -138,12 +139,12 @@ public class UserTestITCase extends Abst
     @SuppressWarnings("unchecked")
     public void createUserWithNoPropagation() {
         // get task list
-        List<PropagationTaskTO> tasks = taskService.list(TaskType.PROPAGATION);
+        PagedResult<PropagationTaskTO> tasks = taskService.list(TaskType.PROPAGATION);
 
         assertNotNull(tasks);
-        assertFalse(tasks.isEmpty());
+        assertFalse(tasks.getResult().isEmpty());
 
-        long maxId = getMaxTaskId(tasks);
+        long maxId = getMaxTaskId(tasks.getResult());
 
         // create a new user
         UserTO userTO = getUniqueSampleTO("xxx@xxx.xxx");
@@ -156,9 +157,9 @@ public class UserTestITCase extends Abst
         // get the new task list
         tasks = taskService.list(TaskType.PROPAGATION);
         assertNotNull(tasks);
-        assertFalse(tasks.isEmpty());
+        assertFalse(tasks.getResult().isEmpty());
 
-        long newMaxId = getMaxTaskId(tasks);
+        long newMaxId = getMaxTaskId(tasks.getResult());
 
         assertTrue(newMaxId > maxId);
 
@@ -365,12 +366,12 @@ public class UserTestITCase extends Abst
     @SuppressWarnings("unchecked")
     public void create() {
         // get task list
-        List<PropagationTaskTO> tasks = taskService.list(TaskType.PROPAGATION);
+        PagedResult<PropagationTaskTO> tasks = taskService.list(TaskType.PROPAGATION);
 
         assertNotNull(tasks);
-        assertFalse(tasks.isEmpty());
+        assertFalse(tasks.getResult().isEmpty());
 
-        long maxId = getMaxTaskId(tasks);
+        long maxId = getMaxTaskId(tasks.getResult());
         PropagationTaskTO taskTO = taskService.read(maxId);
 
         assertNotNull(taskTO);
@@ -423,9 +424,9 @@ public class UserTestITCase extends Abst
         tasks = taskService.list(TaskType.PROPAGATION);
 
         assertNotNull(tasks);
-        assertFalse(tasks.isEmpty());
+        assertFalse(tasks.getResult().isEmpty());
 
-        long newMaxId = getMaxTaskId(tasks);
+        long newMaxId = getMaxTaskId(tasks.getResult());
 
         // default configuration for ws-target-resource2:
         // only failed executions have to be registered
@@ -567,44 +568,35 @@ public class UserTestITCase extends Abst
     }
 
     @Test
-    public void count() {
-        Integer count = userService.count();
-        assertNotNull(count);
-        assertTrue(count > 0);
-    }
-
-    @Test
     public void list() {
-        List<UserTO> users = userService.list();
+        PagedResult<UserTO> users = userService.list();
         assertNotNull(users);
-        assertFalse(users.isEmpty());
-        for (UserTO user : users) {
+        assertFalse(users.getResult().isEmpty());
+
+        for (UserTO user : users.getResult()) {
             assertNotNull(user);
         }
     }
 
     @Test
     public void paginatedList() {
-        List<UserTO> users = userService.list(1, 2);
-
+        PagedResult<UserTO> users = userService.list(1, 2);
         assertNotNull(users);
-        assertFalse(users.isEmpty());
-        assertEquals(2, users.size());
+        assertFalse(users.getResult().isEmpty());
+        assertEquals(2, users.getResult().size());
 
-        for (UserTO user : users) {
+        for (UserTO user : users.getResult()) {
             assertNotNull(user);
         }
 
         users = userService.list(2, 2);
-
         assertNotNull(users);
-        assertFalse(users.isEmpty());
-        assertEquals(2, users.size());
+        assertFalse(users.getResult().isEmpty());
+        assertEquals(2, users.getResult().size());
 
         users = userService.list(100, 2);
-
         assertNotNull(users);
-        assertTrue(users.isEmpty());
+        assertTrue(users.getResult().isEmpty());
     }
 
     @Test
@@ -730,11 +722,9 @@ public class UserTestITCase extends Abst
     }
 
     @Test
-    @SuppressWarnings("unchecked")
     public void updatePasswordOnly() {
-        List<PropagationTaskTO> beforeTasks = taskService.list(TaskType.PROPAGATION);
-        assertNotNull(beforeTasks);
-        assertFalse(beforeTasks.isEmpty());
+        int beforeTasks = taskService.list(TaskType.PROPAGATION, 1, 1).getTotalCount();
+        assertFalse(beforeTasks <= 0);
 
         UserTO userTO = getUniqueSampleTO("pwdonly@t.com");
         MembershipTO membershipTO = new MembershipTO();
@@ -753,27 +743,22 @@ public class UserTestITCase extends Abst
         // check for changePwdDate
         assertNotNull(userTO.getChangePwdDate());
 
-        SyncopeUser passwordTestUser = new SyncopeUser();
-        passwordTestUser.setPassword("newPassword123", CipherAlgorithm.SHA1, 0);
-        assertEquals(passwordTestUser.getPassword(), userTO.getPassword());
-
-        List<PropagationTaskTO> afterTasks = taskService.list(TaskType.PROPAGATION);
-        assertNotNull(afterTasks);
-        assertFalse(afterTasks.isEmpty());
+        int afterTasks = taskService.list(TaskType.PROPAGATION, 1, 1).getTotalCount();
+        assertFalse(beforeTasks <= 0);
 
-        assertTrue(beforeTasks.size() < afterTasks.size());
+        assertTrue(beforeTasks < afterTasks);
     }
 
     @SuppressWarnings("unchecked")
     @Test
     public void verifyTaskRegistration() {
         // get task list
-        List<PropagationTaskTO> tasks = taskService.list(TaskType.PROPAGATION);
+        PagedResult<PropagationTaskTO> tasks = taskService.list(TaskType.PROPAGATION);
 
         assertNotNull(tasks);
-        assertFalse(tasks.isEmpty());
+        assertFalse(tasks.getResult().isEmpty());
 
-        long maxId = getMaxTaskId(tasks);
+        long maxId = getMaxTaskId(tasks.getResult());
 
         // --------------------------------------
         // Create operation
@@ -793,9 +778,9 @@ public class UserTestITCase extends Abst
         tasks = taskService.list(TaskType.PROPAGATION);
 
         assertNotNull(tasks);
-        assertFalse(tasks.isEmpty());
+        assertFalse(tasks.getResult().isEmpty());
 
-        long newMaxId = getMaxTaskId(tasks);
+        long newMaxId = getMaxTaskId(tasks.getResult());
 
         // default configuration for ws-target-resource2:
         // only failed executions have to be registered
@@ -818,7 +803,7 @@ public class UserTestITCase extends Abst
         tasks = taskService.list(TaskType.PROPAGATION);
 
         maxId = newMaxId;
-        newMaxId = getMaxTaskId(tasks);
+        newMaxId = getMaxTaskId(tasks.getResult());
 
         // default configuration for ws-target-resource2:
         // all update executions have to be registered
@@ -838,7 +823,7 @@ public class UserTestITCase extends Abst
         tasks = taskService.list(TaskType.PROPAGATION);
 
         maxId = newMaxId;
-        newMaxId = getMaxTaskId(tasks);
+        newMaxId = getMaxTaskId(tasks.getResult());
 
         // default configuration for ws-target-resource2: no delete executions have to be registered
         // --> no more tasks/executions should be added
@@ -1091,7 +1076,7 @@ public class UserTestITCase extends Abst
         userTO = updateUser(userMod);
         assertNotNull(userTO);
 
-        final List<PropagationStatusTO> propagations = userTO.getPropagationStatusTOs();
+        final List<PropagationStatus> propagations = userTO.getPropagationStatusTOs();
 
         assertNotNull(propagations);
         assertEquals(1, propagations.size());
@@ -1115,7 +1100,7 @@ public class UserTestITCase extends Abst
         userTO = createUser(userTO);
         assertNotNull(userTO);
 
-        final List<PropagationStatusTO> propagations = userTO.getPropagationStatusTOs();
+        final List<PropagationStatus> propagations = userTO.getPropagationStatusTOs();
 
         assertNotNull(propagations);
         assertEquals(1, propagations.size());
@@ -1583,10 +1568,10 @@ public class UserTestITCase extends Abst
         assertNotNull(userTO);
 
         // 5. verify that propagation was successful
-        List<PropagationStatusTO> props = userTO.getPropagationStatusTOs();
+        List<PropagationStatus> props = userTO.getPropagationStatusTOs();
         assertNotNull(props);
         assertEquals(1, props.size());
-        PropagationStatusTO prop = props.iterator().next();
+        PropagationStatus prop = props.iterator().next();
         assertNotNull(prop);
         assertEquals(RESOURCE_NAME_WS1, prop.getResource());
         assertEquals(PropagationTaskExecStatus.SUBMITTED, prop.getStatus());
@@ -1614,10 +1599,10 @@ public class UserTestITCase extends Abst
         assertNotNull(userTO);
 
         // 3. verify that propagation was successful
-        List<PropagationStatusTO> props = userTO.getPropagationStatusTOs();
+        List<PropagationStatus> props = userTO.getPropagationStatusTOs();
         assertNotNull(props);
         assertEquals(1, props.size());
-        PropagationStatusTO prop = props.iterator().next();
+        PropagationStatus prop = props.iterator().next();
         assertNotNull(prop);
         assertEquals(RESOURCE_NAME_LDAP, prop.getResource());
         assertEquals(PropagationTaskExecStatus.SUCCESS, prop.getStatus());
@@ -1675,7 +1660,7 @@ public class UserTestITCase extends Abst
         assertEquals(11, bulkAction.getTargets().size());
 
         bulkAction.setOperation(BulkAction.Type.SUSPEND);
-        BulkActionRes res = userService.bulk(bulkAction);
+        BulkActionResult res = userService.bulk(bulkAction);
         assertEquals(10, res.getResultByStatus(Status.SUCCESS).size());
         assertEquals(1, res.getResultByStatus(Status.FAILURE).size());
         assertEquals("suspended", userService.read(
@@ -1870,7 +1855,7 @@ public class UserTestITCase extends Abst
 
         actual = userService.associate(actual.getId(),
                 ResourceAssociationActionType.UNLINK,
-                CollectionWrapper.wrap(RESOURCE_NAME_CSV, ResourceNameTO.class)).
+                CollectionWrapper.wrap(RESOURCE_NAME_CSV, ResourceName.class)).
                 readEntity(UserTO.class);
         assertNotNull(actual);
         assertTrue(actual.getResources().isEmpty());
@@ -1904,7 +1889,7 @@ public class UserTestITCase extends Abst
 
         actual = userService.associate(actual.getId(),
                 ResourceAssociationActionType.UNASSIGN,
-                CollectionWrapper.wrap(RESOURCE_NAME_CSV, ResourceNameTO.class)).
+                CollectionWrapper.wrap(RESOURCE_NAME_CSV, ResourceName.class)).
                 readEntity(UserTO.class);
         assertNotNull(actual);
         assertTrue(actual.getResources().isEmpty());
@@ -1940,7 +1925,7 @@ public class UserTestITCase extends Abst
 
         actual = userService.associate(actual.getId(),
                 ResourceAssociationActionType.DEPROVISION,
-                CollectionWrapper.wrap(RESOURCE_NAME_CSV, ResourceNameTO.class)).
+                CollectionWrapper.wrap(RESOURCE_NAME_CSV, ResourceName.class)).
                 readEntity(UserTO.class);
         assertNotNull(actual);
         assertFalse(actual.getResources().isEmpty());

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserWorkflowTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserWorkflowTestITCase.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserWorkflowTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserWorkflowTestITCase.java Mon Dec 16 11:04:52 2013
@@ -36,7 +36,7 @@ import org.apache.syncope.common.to.User
 import org.apache.syncope.common.to.WorkflowFormPropertyTO;
 import org.apache.syncope.common.to.WorkflowFormTO;
 import org.apache.syncope.common.types.ClientExceptionType;
-import org.apache.syncope.common.validation.SyncopeClientException;
+import org.apache.syncope.common.SyncopeClientException;
 import org.apache.syncope.core.workflow.ActivitiDetector;
 import org.junit.Assume;
 import org.junit.FixMethodOrder;

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/VirtualSchemaTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/VirtualSchemaTestITCase.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/VirtualSchemaTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/VirtualSchemaTestITCase.java Mon Dec 16 11:04:52 2013
@@ -32,7 +32,7 @@ import org.apache.syncope.common.types.A
 import org.apache.syncope.common.types.EntityViolationType;
 import org.apache.syncope.common.types.SchemaType;
 import org.apache.syncope.common.types.ClientExceptionType;
-import org.apache.syncope.common.validation.SyncopeClientException;
+import org.apache.syncope.common.SyncopeClientException;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
 import org.junit.runners.MethodSorters;

Added: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/data/SearchCondConverterTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/data/SearchCondConverterTest.java?rev=1551172&view=auto
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/data/SearchCondConverterTest.java (added)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/data/SearchCondConverterTest.java Mon Dec 16 11:04:52 2013
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.rest.data;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.syncope.client.SyncopeClient;
+import org.apache.syncope.common.search.SpecialAttr;
+import org.apache.syncope.core.AbstractNonDAOTest;
+import org.apache.syncope.core.persistence.dao.search.AttributableCond;
+import org.apache.syncope.core.persistence.dao.search.AttributeCond;
+import org.apache.syncope.core.persistence.dao.search.EntitlementCond;
+import org.apache.syncope.core.persistence.dao.search.MembershipCond;
+import org.apache.syncope.core.persistence.dao.search.ResourceCond;
+import org.apache.syncope.core.persistence.dao.search.SearchCond;
+import org.junit.Test;
+
+public class SearchCondConverterTest extends AbstractNonDAOTest {
+
+    @Test
+    public void eq() {
+        String fiqlExpression = SyncopeClient.getSearchConditionBuilder().is("username").equalTo("rossini").query();
+        assertEquals("username==rossini", fiqlExpression);
+
+        AttributableCond attrCond = new AttributableCond(AttributeCond.Type.EQ);
+        attrCond.setSchema("username");
+        attrCond.setExpression("rossini");
+        SearchCond simpleCond = SearchCond.getLeafCond(attrCond);
+
+        assertEquals(simpleCond, SearchCondConverter.convert(fiqlExpression));
+    }
+
+    @Test
+    public void like() {
+        String fiqlExpression = SyncopeClient.getSearchConditionBuilder().is("username").equalTo("ros*").query();
+        assertEquals("username==ros*", fiqlExpression);
+
+        AttributeCond attrCond = new AttributableCond(AttributeCond.Type.LIKE);
+        attrCond.setSchema("username");
+        attrCond.setExpression("ros%");
+        SearchCond simpleCond = SearchCond.getLeafCond(attrCond);
+
+        assertEquals(simpleCond, SearchCondConverter.convert(fiqlExpression));
+    }
+
+    @Test
+    public void isNull() {
+        String fiqlExpression = SyncopeClient.getSearchConditionBuilder().is("loginDate").nullValue().query();
+        assertEquals("loginDate==" + SpecialAttr.NULL, fiqlExpression);
+
+        AttributeCond attrCond = new AttributeCond(AttributeCond.Type.ISNULL);
+        attrCond.setSchema("loginDate");
+        SearchCond simpleCond = SearchCond.getLeafCond(attrCond);
+
+        assertEquals(simpleCond, SearchCondConverter.convert(fiqlExpression));
+    }
+
+    @Test
+    public void isNotNull() {
+        String fiqlExpression = SyncopeClient.getSearchConditionBuilder().is("loginDate").notNullValue().query();
+        assertEquals("loginDate!=" + SpecialAttr.NULL, fiqlExpression);
+
+        AttributeCond attrCond = new AttributeCond(AttributeCond.Type.ISNOTNULL);
+        attrCond.setSchema("loginDate");
+        SearchCond simpleCond = SearchCond.getLeafCond(attrCond);
+
+        assertEquals(simpleCond, SearchCondConverter.convert(fiqlExpression));
+    }
+
+    @Test
+    public void roles() {
+        String fiqlExpression = SyncopeClient.getSearchConditionBuilder().hasRoles(1L).query();
+        assertEquals(SpecialAttr.ROLES + "==1", fiqlExpression);
+
+        MembershipCond membCond = new MembershipCond();
+        membCond.setRoleId(1L);
+        SearchCond simpleCond = SearchCond.getLeafCond(membCond);
+
+        assertEquals(simpleCond, SearchCondConverter.convert(fiqlExpression));
+    }
+
+    @Test
+    public void resources() {
+        String fiqlExpression = SyncopeClient.getSearchConditionBuilder().hasResources("resource-ldap").query();
+        assertEquals(SpecialAttr.RESOURCES + "==resource-ldap", fiqlExpression);
+
+        ResourceCond resCond = new ResourceCond();
+        resCond.setResourceName("resource-ldap");
+        SearchCond simpleCond = SearchCond.getLeafCond(resCond);
+
+        assertEquals(simpleCond, SearchCondConverter.convert(fiqlExpression));
+    }
+
+    @Test
+    public void entitlements() {
+        String fiqlExpression = SyncopeClient.getSearchConditionBuilder().hasEntitlements("USER_LIST").query();
+        assertEquals(SpecialAttr.ENTITLEMENTS + "==USER_LIST", fiqlExpression);
+
+        EntitlementCond entCond = new EntitlementCond();
+        entCond.setExpression("USER_LIST");
+        SearchCond simpleCond = SearchCond.getLeafCond(entCond);
+
+        assertEquals(simpleCond, SearchCondConverter.convert(fiqlExpression));
+    }
+
+    @Test
+    public void and() {
+        String fiqlExpression = SyncopeClient.getSearchConditionBuilder().
+                is("fullname").equalTo("*o*").and("fullname").equalTo("*i*").query();
+        assertEquals("fullname==*o*;fullname==*i*", fiqlExpression);
+
+        AttributeCond fullnameLeafCond1 = new AttributeCond(AttributeCond.Type.LIKE);
+        fullnameLeafCond1.setSchema("fullname");
+        fullnameLeafCond1.setExpression("%o%");
+        AttributeCond fullnameLeafCond2 = new AttributeCond(AttributeCond.Type.LIKE);
+        fullnameLeafCond2.setSchema("fullname");
+        fullnameLeafCond2.setExpression("%i%");
+        SearchCond andCond = SearchCond.getAndCond(
+                SearchCond.getLeafCond(fullnameLeafCond1),
+                SearchCond.getLeafCond(fullnameLeafCond2));
+
+        assertEquals(andCond, SearchCondConverter.convert(fiqlExpression));
+    }
+
+    @Test
+    public void or() {
+        String fiqlExpression = SyncopeClient.getSearchConditionBuilder().
+                is("fullname").equalTo("*o*", "*i*", "*ini").query();
+        assertEquals("fullname==*o*,fullname==*i*,fullname==*ini", fiqlExpression);
+
+        AttributeCond fullnameLeafCond1 = new AttributeCond(AttributeCond.Type.LIKE);
+        fullnameLeafCond1.setSchema("fullname");
+        fullnameLeafCond1.setExpression("%o%");
+        AttributeCond fullnameLeafCond2 = new AttributeCond(AttributeCond.Type.LIKE);
+        fullnameLeafCond2.setSchema("fullname");
+        fullnameLeafCond2.setExpression("%i%");
+        AttributeCond fullnameLeafCond3 = new AttributeCond(AttributeCond.Type.LIKE);
+        fullnameLeafCond3.setSchema("fullname");
+        fullnameLeafCond3.setExpression("%ini");
+        SearchCond orCond = SearchCond.getOrCond(
+                SearchCond.getLeafCond(fullnameLeafCond1),
+                SearchCond.getOrCond(
+                        SearchCond.getLeafCond(fullnameLeafCond2),
+                        SearchCond.getLeafCond(fullnameLeafCond3)));
+
+        assertEquals(orCond, SearchCondConverter.convert(fiqlExpression));
+    }
+
+}

Propchange: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/data/SearchCondConverterTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/data/SearchCondConverterTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/data/SearchCondConverterTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/sync/TestSyncRule.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/sync/TestSyncRule.java?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/sync/TestSyncRule.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/sync/TestSyncRule.java Mon Dec 16 11:04:52 2013
@@ -18,19 +18,19 @@
  */
 package org.apache.syncope.core.sync;
 
-import org.apache.syncope.common.search.AttributeCond;
-import org.apache.syncope.common.search.NodeCond;
+import org.apache.syncope.core.persistence.dao.search.AttributeCond;
+import org.apache.syncope.core.persistence.dao.search.SearchCond;
 import org.identityconnectors.framework.common.objects.ConnectorObject;
 
 public class TestSyncRule implements SyncCorrelationRule {
 
     @Override
-    public NodeCond getSearchCond(ConnectorObject connObj) {
+    public SearchCond getSearchCond(ConnectorObject connObj) {
         AttributeCond cond = new AttributeCond();
         cond.setSchema("email");
         cond.setType(AttributeCond.Type.EQ);
         cond.setExpression(connObj.getName().getNameValue());
 
-        return NodeCond.getLeafCond(cond);
+        return SearchCond.getLeafCond(cond);
     }
 }

Modified: syncope/trunk/core/src/test/resources/content.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/resources/content.xml?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/core/src/test/resources/content.xml (original)
+++ syncope/trunk/core/src/test/resources/content.xml Mon Dec 16 11:04:52 2013
@@ -842,8 +842,8 @@ under the License.
         jobClassName="org.apache.syncope.core.sync.impl.SyncJob"/>        
       
   <Notification id="1" sender="test@syncope.apache.org" subject="Test subject" template="test" selfAsRecipient="0" traceLevel="ALL"
-                xmlAbout="%3Corg.apache.syncope.common.search.NodeCond%3E%0A++%3Ctype%3EAND%3C%2Ftype%3E%0A++%3CleftNodeCond%3E%0A++++%3Ctype%3ELEAF%3C%2Ftype%3E%0A++++%3CattributeCond%3E%0A++++++%3Ctype%3ELIKE%3C%2Ftype%3E%0A++++++%3Cschema%3Efullname%3C%2Fschema%3E%0A++++++%3Cexpression%3E%25o%25%3C%2Fexpression%3E%0A++++%3C%2FattributeCond%3E%0A++%3C%2FleftNodeCond%3E%0A++%3CrightNodeCond%3E%0A++++%3Ctype%3ELEAF%3C%2Ftype%3E%0A++++%3CattributeCond%3E%0A++++++%3Ctype%3ELIKE%3C%2Ftype%3E%0A++++++%3Cschema%3Efullname%3C%2Fschema%3E%0A++++++%3Cexpression%3E%25i%25%3C%2Fexpression%3E%0A++++%3C%2FattributeCond%3E%0A++%3C%2FrightNodeCond%3E%0A%3C%2Forg.apache.syncope.common.search.NodeCond%3E"
-                xmlRecipients="%3Corg.apache.syncope.common.search.NodeCond%3E%0A++%3Ctype%3ELEAF%3C%2Ftype%3E%0A++%3CmembershipCond%3E%0A++++%3CroleId%3E7%3C%2FroleId%3E%0A++%3C%2FmembershipCond%3E%0A%3C%2Forg.apache.syncope.common.search.NodeCond%3E"
+                about="fullname==*o*;fullname==*i*"
+                recipients="$roles==7"
                 recipientAttrType="UserSchema" recipientAttrName="email"/>
   <Notification_events Notification_id="1" events="[CUSTOM]:[]:[]:[unexisting1]:[FAILURE]"/>
   <Notification_events Notification_id="1" events="[CUSTOM]:[]:[]:[unexisting2]:[SUCCESS]"/>

Modified: syncope/trunk/pom.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/pom.xml?rev=1551172&r1=1551171&r2=1551172&view=diff
==============================================================================
--- syncope/trunk/pom.xml (original)
+++ syncope/trunk/pom.xml Mon Dec 16 11:04:52 2013
@@ -506,9 +506,9 @@ under the License.
       </dependency>
       
       <dependency>
-        <groupId>javax.validation</groupId>
-        <artifactId>validation-api</artifactId>
-        <version>1.0.0.GA</version>
+        <groupId>org.apache.geronimo.specs</groupId>
+        <artifactId>geronimo-validation_1.0_spec</artifactId>
+        <version>1.1</version>
       </dependency>
       <dependency>
         <groupId>org.apache.bval</groupId>
@@ -869,10 +869,6 @@ under the License.
   <repositories>
 
     <repository>
-      <id>activiti</id>
-      <url>https://artifacts.alfresco.com/nexus/content/groups/public/</url>
-    </repository>
-    <repository>
       <id>sonatype</id>
       <url>https://oss.sonatype.org/content/repositories/snapshots</url>
       <releases>



Mime
View raw message