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 2015/01/12 17:31:57 UTC

[18/52] [abbrv] [partial] syncope git commit: [SYNCOPE-620] Unit tests all in

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/RoleTest.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/RoleTest.java b/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/RoleTest.java
deleted file mode 100644
index b2cc641..0000000
--- a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/RoleTest.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * 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.persistence.jpa.entity;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.util.List;
-import org.apache.syncope.persistence.api.dao.PolicyDAO;
-import org.apache.syncope.persistence.api.dao.RoleDAO;
-import org.apache.syncope.persistence.api.entity.AccountPolicy;
-import org.apache.syncope.persistence.api.entity.PasswordPolicy;
-import org.apache.syncope.persistence.api.entity.role.Role;
-import org.apache.syncope.persistence.jpa.AbstractTest;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional
-public class RoleTest extends AbstractTest {
-
-    @Autowired
-    private RoleDAO roleDAO;
-
-    @Autowired
-    private PolicyDAO policyDAO;
-
-    @Test
-    public void findAll() {
-        List<Role> list = roleDAO.findAll();
-        assertEquals("did not get expected number of roles ", 14, list.size());
-    }
-
-    @Test
-    public void findChildren() {
-        assertEquals(3, roleDAO.findChildren(roleDAO.find(4L)).size());
-    }
-
-    @Test
-    public void find() {
-        Role role = roleDAO.find("root", null);
-        assertNotNull("did not find expected role", role);
-        role = roleDAO.find(null, null);
-        assertNull("found role but did not expect it", role);
-    }
-
-    @Test
-    public void inheritedAttributes() {
-        Role director = roleDAO.find(7L);
-
-        assertEquals(1, director.findLastInheritedAncestorPlainAttrs().size());
-    }
-
-    @Test
-    public void inheritedDerivedAttributes() {
-        Role director = roleDAO.find(7L);
-
-        assertEquals(1, director.findLastInheritedAncestorDerAttrs().size());
-    }
-
-    @Test
-    public void inheritedVirtualAttributes() {
-        Role director = roleDAO.find(7L);
-
-        assertEquals(1, director.findLastInheritedAncestorVirAttrs().size());
-    }
-
-    @Test
-    public void inheritedPolicy() {
-        Role role = roleDAO.find(7L);
-
-        assertNotNull(role);
-
-        assertNotNull(role.getAccountPolicy());
-        assertNotNull(role.getPasswordPolicy());
-
-        assertEquals(4, role.getPasswordPolicy().getKey(), 0);
-
-        role = roleDAO.find(5L);
-
-        assertNotNull(role);
-
-        assertNull(role.getAccountPolicy());
-        assertNull(role.getPasswordPolicy());
-    }
-
-    @Test
-    public void save() {
-        Role role = entityFactory.newEntity(Role.class);
-        role.setName("secondChild");
-
-        // verify inheritance password and account policies
-        role.setInheritAccountPolicy(false);
-        // not inherited so setter execution shouldn't be ignored
-        role.setAccountPolicy((AccountPolicy) policyDAO.find(6L));
-
-        role.setInheritPasswordPolicy(true);
-        // inherited so setter execution should be ignored
-        role.setPasswordPolicy((PasswordPolicy) policyDAO.find(4L));
-
-        Role rootRole = roleDAO.find("root", null);
-        role.setParent(rootRole);
-
-        role = roleDAO.save(role);
-
-        Role actual = roleDAO.find(role.getKey());
-        assertNotNull("expected save to work", actual);
-
-        assertNull(role.getPasswordPolicy());
-        assertNotNull(role.getAccountPolicy());
-        assertEquals(Long.valueOf(6), role.getAccountPolicy().getKey());
-    }
-
-    @Test
-    public void delete() {
-        Role role = roleDAO.find(4L);
-        roleDAO.delete(role.getKey());
-
-        Role actual = roleDAO.find(4L);
-        assertNull("delete did not work", actual);
-
-        Role children = roleDAO.find(7L);
-        assertNull("delete of successors did not work", children);
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/SecurityQuestionTest.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/SecurityQuestionTest.java b/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/SecurityQuestionTest.java
deleted file mode 100644
index 5c74bd3..0000000
--- a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/SecurityQuestionTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.persistence.jpa.entity;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.util.List;
-import org.apache.syncope.persistence.api.dao.SecurityQuestionDAO;
-import org.apache.syncope.persistence.api.entity.user.SecurityQuestion;
-import org.apache.syncope.persistence.jpa.AbstractTest;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional
-public class SecurityQuestionTest extends AbstractTest {
-
-    @Autowired
-    private SecurityQuestionDAO securityQuestionDAO;
-
-    @Test
-    public void find() {
-        SecurityQuestion securityQuestion = securityQuestionDAO.find(1L);
-        assertNotNull(securityQuestion);
-        assertNotNull(securityQuestion.getContent());
-    }
-
-    @Test
-    public void findAll() {
-        List<SecurityQuestion> securityQuestions = securityQuestionDAO.findAll();
-        assertNotNull(securityQuestions);
-        assertFalse(securityQuestions.isEmpty());
-    }
-
-    @Test
-    public void save() {
-        SecurityQuestion securityQuestion = entityFactory.newEntity(SecurityQuestion.class);
-        securityQuestion.setContent("What is your favorite pet's name?");
-
-        SecurityQuestion actual = securityQuestionDAO.save(securityQuestion);
-        assertNotNull(actual);
-        assertNotNull(actual.getKey());
-    }
-
-    @Test
-    public void delete() {
-        securityQuestionDAO.delete(1L);
-        assertNull(securityQuestionDAO.find(1L));
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/TaskExecTest.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/TaskExecTest.java b/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/TaskExecTest.java
deleted file mode 100644
index f3df4e2..0000000
--- a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/TaskExecTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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.persistence.jpa.entity;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Date;
-import java.util.List;
-import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
-import org.apache.syncope.common.lib.types.TaskType;
-import org.apache.syncope.persistence.api.dao.TaskDAO;
-import org.apache.syncope.persistence.api.dao.TaskExecDAO;
-import org.apache.syncope.persistence.api.entity.task.PropagationTask;
-import org.apache.syncope.persistence.api.entity.task.TaskExec;
-import org.apache.syncope.persistence.jpa.AbstractTest;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional
-public class TaskExecTest extends AbstractTest {
-
-    @Autowired
-    private TaskExecDAO taskExecDAO;
-
-    @Autowired
-    private TaskDAO taskDAO;
-
-    @Test
-    public void findAll() {
-        List<TaskExec> list = taskExecDAO.findAll(TaskType.PROPAGATION);
-        assertEquals(2, list.size());
-
-        list = taskExecDAO.findAll(TaskType.SCHEDULED);
-        assertTrue(list.isEmpty());
-
-        list = taskExecDAO.findAll(TaskType.SYNCHRONIZATION);
-        assertTrue(list.isEmpty());
-
-        list = taskExecDAO.findAll(TaskType.NOTIFICATION);
-        assertTrue(list.isEmpty());
-    }
-
-    @Test
-    public void findLatestStarted() {
-        PropagationTask task = taskDAO.find(1L);
-        assertNotNull(task);
-
-        TaskExec latestStarted = taskExecDAO.findLatestStarted(task);
-        assertNotNull(latestStarted);
-        assertEquals(Long.valueOf(1L), latestStarted.getKey());
-    }
-
-    @Test
-    public void issueSYNCOPE214() {
-        PropagationTask task = taskDAO.find(1L);
-        assertNotNull(task);
-
-        String faultyMessage = "A faulty message";
-        faultyMessage = faultyMessage.replace('a', '\0');
-
-        TaskExec exec = entityFactory.newEntity(TaskExec.class);
-        exec.setStartDate(new Date());
-        exec.setEndDate(new Date());
-        exec.setStatus(PropagationTaskExecStatus.SUCCESS.name());
-        exec.setMessage(faultyMessage);
-
-        task.addExec(exec);
-        exec.setTask(task);
-
-        exec = taskExecDAO.save(exec);
-        assertNotNull(exec);
-
-        assertEquals(faultyMessage.replace('\0', '\n'), exec.getMessage());
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/TaskTest.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/TaskTest.java b/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/TaskTest.java
deleted file mode 100644
index 75777aa..0000000
--- a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/TaskTest.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * 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.persistence.jpa.entity;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.apache.syncope.common.lib.types.AttributableType;
-import org.apache.syncope.common.lib.types.PropagationMode;
-import org.apache.syncope.common.lib.types.ResourceOperation;
-import org.apache.syncope.common.lib.types.TaskType;
-import org.apache.syncope.persistence.api.dao.ExternalResourceDAO;
-import org.apache.syncope.persistence.api.dao.TaskDAO;
-import org.apache.syncope.persistence.api.dao.UserDAO;
-import org.apache.syncope.persistence.api.entity.ExternalResource;
-import org.apache.syncope.persistence.api.entity.task.PropagationTask;
-import org.apache.syncope.persistence.api.entity.user.User;
-import org.apache.syncope.persistence.jpa.AbstractTest;
-import org.identityconnectors.framework.common.objects.Attribute;
-import org.identityconnectors.framework.common.objects.AttributeBuilder;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional
-public class TaskTest extends AbstractTest {
-
-    @Autowired
-    private TaskDAO taskDAO;
-
-    @Autowired
-    private ExternalResourceDAO resourceDAO;
-
-    @Autowired
-    private UserDAO userDAO;
-
-    @Test
-    public void findWithoutExecs() {
-        List<PropagationTask> tasks = taskDAO.findToExec(TaskType.PROPAGATION);
-        assertNotNull(tasks);
-        assertEquals(2, tasks.size());
-    }
-
-    @Test
-    public void findAll() {
-        assertEquals(4, taskDAO.findAll(TaskType.PROPAGATION).size());
-        assertEquals(1, taskDAO.findAll(TaskType.NOTIFICATION).size());
-        assertEquals(1, taskDAO.findAll(TaskType.SCHEDULED).size());
-        assertEquals(9, taskDAO.findAll(TaskType.SYNCHRONIZATION).size());
-        assertEquals(11, taskDAO.findAll(TaskType.PUSH).size());
-    }
-
-    @Test
-    public void savePropagationTask() {
-        ExternalResource resource = resourceDAO.find("ws-target-resource-1");
-        assertNotNull(resource);
-
-        User user = userDAO.find(2L);
-        assertNotNull(user);
-
-        PropagationTask task = entityFactory.newEntity(PropagationTask.class);
-        task.setResource(resource);
-        task.setSubjectType(AttributableType.USER);
-        task.setPropagationMode(PropagationMode.TWO_PHASES);
-        task.setPropagationOperation(ResourceOperation.CREATE);
-        task.setAccountId("one@two.com");
-
-        Set<Attribute> attributes = new HashSet<Attribute>();
-        attributes.add(AttributeBuilder.build("testAttribute", "testValue1", "testValue2"));
-        attributes.add(AttributeBuilder.buildPassword("password".toCharArray()));
-        task.setAttributes(attributes);
-
-        task = taskDAO.save(task);
-        assertNotNull(task);
-
-        PropagationTask actual = taskDAO.find(task.getKey());
-        assertEquals(task, actual);
-    }
-
-    @Test
-    public void delete() {
-        PropagationTask task = taskDAO.find(1L);
-        assertNotNull(task);
-
-        ExternalResource resource = task.getResource();
-        assertNotNull(resource);
-
-        taskDAO.delete(task);
-        task = taskDAO.find(1L);
-        assertNull(task);
-
-        resource = resourceDAO.find(resource.getKey());
-        assertNotNull(resource);
-        assertFalse(taskDAO.findAll(resource, TaskType.PROPAGATION).contains(task));
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/UserTest.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/UserTest.java b/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/UserTest.java
deleted file mode 100644
index 5ae3b06..0000000
--- a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/UserTest.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * 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.persistence.jpa.entity;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
-import org.apache.syncope.common.lib.types.CipherAlgorithm;
-import org.apache.syncope.persistence.api.RoleEntitlementUtil;
-import org.apache.syncope.persistence.api.attrvalue.validation.InvalidEntityException;
-import org.apache.syncope.persistence.api.dao.EntitlementDAO;
-import org.apache.syncope.persistence.api.dao.UserDAO;
-import org.apache.syncope.persistence.api.entity.user.UPlainAttrValue;
-import org.apache.syncope.persistence.api.entity.user.User;
-import org.apache.syncope.persistence.jpa.AbstractTest;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional
-public class UserTest extends AbstractTest {
-
-    @Autowired
-    private UserDAO userDAO;
-
-    @Autowired
-    private EntitlementDAO entitlementDAO;
-
-    @Test
-    public void findAll() {
-        List<User> list = userDAO.findAll(RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()), 1, 100);
-        assertEquals("did not get expected number of users ", 5, list.size());
-    }
-
-    @Test
-    public void count() {
-        Integer count = userDAO.count(RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()));
-        assertNotNull(count);
-        assertEquals(5, count.intValue());
-    }
-
-    @Test
-    public void findAllByPageAndSize() {
-        Set<Long> allRoleIds = RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll());
-
-        // get first page
-        List<User> list = userDAO.findAll(allRoleIds, 1, 2);
-        assertEquals("did not get expected number of users ", 2, list.size());
-
-        // get second page
-        list = userDAO.findAll(allRoleIds, 2, 2);
-        assertEquals("did not get expected number of users ", 2, list.size());
-
-        // get second page with uncomplete set
-        list = userDAO.findAll(allRoleIds, 2, 3);
-        assertEquals("did not get expected number of users ", 2, list.size());
-
-        // get unexistent page
-        list = userDAO.findAll(allRoleIds, 3, 2);
-        assertEquals("did not get expected number of users ", 1, list.size());
-    }
-
-    @Test
-    public void findByDerAttributeValue() {
-        final List<User> list = userDAO.findByDerAttrValue("cn", "Vivaldi, Antonio");
-        assertEquals("did not get expected number of users ", 1, list.size());
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void findByInvalidDerAttrValue() {
-        userDAO.findByDerAttrValue("cn", "Antonio, Maria, Rossi");
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void findByInvalidDerAttrExpression() {
-        userDAO.findByDerAttrValue("noschema", "Antonio, Maria");
-    }
-
-    @Test
-    public void findByAttributeValue() {
-        final UPlainAttrValue fullnameValue = entityFactory.newEntity(UPlainAttrValue.class);
-        fullnameValue.setStringValue("Gioacchino Rossini");
-
-        final List<User> list = userDAO.findByAttrValue("fullname", fullnameValue);
-        assertEquals("did not get expected number of users ", 1, list.size());
-    }
-
-    @Test
-    public void findByAttributeBooleanValue() {
-        final UPlainAttrValue coolValue = entityFactory.newEntity(UPlainAttrValue.class);
-        coolValue.setBooleanValue(true);
-
-        final List<User> list = userDAO.findByAttrValue("cool", coolValue);
-        assertEquals("did not get expected number of users ", 1, list.size());
-    }
-
-    @Test
-    public void findById() {
-        User user = userDAO.find(1L);
-        assertNotNull("did not find expected user", user);
-        user = userDAO.find(3L);
-        assertNotNull("did not find expected user", user);
-        user = userDAO.find(6L);
-        assertNull("found user but did not expect it", user);
-    }
-
-    @Test
-    public void findByUsername() {
-        User user = userDAO.find("rossini");
-        assertNotNull("did not find expected user", user);
-        user = userDAO.find("vivaldi");
-        assertNotNull("did not find expected user", user);
-        user = userDAO.find("user6");
-        assertNull("found user but did not expect it", user);
-    }
-
-    @Test
-    public void save() {
-        User user = entityFactory.newEntity(User.class);
-        user.setUsername("username");
-        user.setCreationDate(new Date());
-
-        user.setPassword("pass", CipherAlgorithm.SHA256);
-
-        Throwable t = null;
-        try {
-            userDAO.save(user);
-        } catch (InvalidEntityException e) {
-            t = e;
-        }
-        assertNotNull(t);
-
-        user.setPassword("password", CipherAlgorithm.SHA256);
-
-        user.setUsername("username!");
-
-        t = null;
-        try {
-            userDAO.save(user);
-        } catch (InvalidEntityException e) {
-            t = e;
-        }
-        assertNotNull(t);
-
-        user.setUsername("username");
-
-        User actual = userDAO.save(user);
-        assertNotNull("expected save to work", actual);
-        assertEquals(1, actual.getPasswordHistory().size());
-    }
-
-    @Test
-    public void delete() {
-        User user = userDAO.find(3L);
-
-        userDAO.delete(user.getKey());
-
-        User actual = userDAO.find(3L);
-        assertNull("delete did not work", actual);
-    }
-
-    @Test
-    public void issue237() {
-        User user = entityFactory.newEntity(User.class);
-        user.setUsername("username");
-        user.setCreationDate(new Date());
-
-        user.setPassword("password", CipherAlgorithm.AES);
-
-        User actual = userDAO.save(user);
-        assertNotNull(actual);
-    }
-
-    @Test
-    public void issueSYNCOPE391() {
-        User user = entityFactory.newEntity(User.class);
-        user.setUsername("username");
-        user.setPassword(null, CipherAlgorithm.AES);
-
-        User actual = null;
-        Throwable t = null;
-        try {
-            actual = userDAO.save(user);
-        } catch (InvalidEntityException e) {
-            t = e;
-        }
-        assertNull(t);
-        assertNull(user.getPassword());
-        assertNotNull(actual);
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/VirAttrTest.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/VirAttrTest.java b/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/VirAttrTest.java
deleted file mode 100644
index c63bf72..0000000
--- a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/VirAttrTest.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * 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.persistence.jpa.entity;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.util.List;
-import org.apache.syncope.persistence.api.dao.MembershipDAO;
-import org.apache.syncope.persistence.api.dao.RoleDAO;
-import org.apache.syncope.persistence.api.dao.UserDAO;
-import org.apache.syncope.persistence.api.dao.VirAttrDAO;
-import org.apache.syncope.persistence.api.dao.VirSchemaDAO;
-import org.apache.syncope.persistence.api.entity.membership.MVirAttr;
-import org.apache.syncope.persistence.api.entity.membership.MVirAttrTemplate;
-import org.apache.syncope.persistence.api.entity.membership.Membership;
-import org.apache.syncope.persistence.api.entity.role.RVirAttr;
-import org.apache.syncope.persistence.api.entity.role.RVirAttrTemplate;
-import org.apache.syncope.persistence.api.entity.role.Role;
-import org.apache.syncope.persistence.api.entity.user.UVirAttr;
-import org.apache.syncope.persistence.api.entity.user.UVirSchema;
-import org.apache.syncope.persistence.api.entity.user.User;
-import org.apache.syncope.persistence.jpa.AbstractTest;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional
-public class VirAttrTest extends AbstractTest {
-
-    @Autowired
-    private VirAttrDAO virAttrDAO;
-
-    @Autowired
-    private UserDAO userDAO;
-
-    @Autowired
-    private RoleDAO roleDAO;
-
-    @Autowired
-    private MembershipDAO membershipDAO;
-
-    @Autowired
-    private VirSchemaDAO virSchemaDAO;
-
-    @Test
-    public void findAll() {
-        List<UVirAttr> list = virAttrDAO.findAll(UVirAttr.class);
-        assertEquals("did not get expected number of derived attributes ", 1, list.size());
-    }
-
-    @Test
-    public void findById() {
-        UVirAttr attribute = virAttrDAO.find(1000L, UVirAttr.class);
-        assertNotNull("did not find expected attribute schema", attribute);
-    }
-
-    @Test
-    public void saveUVirAttribute() {
-        UVirSchema virSchema = virSchemaDAO.find("virtualdata", UVirSchema.class);
-        assertNotNull(virSchema);
-
-        User owner = userDAO.find(3L);
-        assertNotNull("did not get expected user", owner);
-
-        UVirAttr virAttr = entityFactory.newEntity(UVirAttr.class);
-        virAttr.setOwner(owner);
-        virAttr.setSchema(virSchema);
-
-        virAttr = virAttrDAO.save(virAttr);
-
-        UVirAttr actual = virAttrDAO.find(virAttr.getKey(), UVirAttr.class);
-        assertNotNull("expected save to work", actual);
-        assertEquals(virAttr, actual);
-    }
-
-    @Test
-    public void saveMVirAttribute() {
-        Membership owner = membershipDAO.find(3L);
-        assertNotNull("did not get expected membership", owner);
-
-        MVirAttr virAttr = entityFactory.newEntity(MVirAttr.class);
-        virAttr.setOwner(owner);
-        virAttr.setTemplate(owner.getRole().getAttrTemplate(MVirAttrTemplate.class, "mvirtualdata"));
-
-        virAttr = virAttrDAO.save(virAttr);
-        assertNotNull(virAttr.getTemplate());
-
-        MVirAttr actual = virAttrDAO.find(virAttr.getKey(), MVirAttr.class);
-        assertNotNull("expected save to work", actual);
-        assertEquals(virAttr, actual);
-    }
-
-    @Test
-    public void saveRVirAttribute() {
-        Role owner = roleDAO.find(3L);
-        assertNotNull("did not get expected membership", owner);
-
-        RVirAttr virAttr = entityFactory.newEntity(RVirAttr.class);
-        virAttr.setOwner(owner);
-        virAttr.setTemplate(owner.getAttrTemplate(RVirAttrTemplate.class, "rvirtualdata"));
-
-        virAttr = virAttrDAO.save(virAttr);
-        assertNotNull(virAttr.getTemplate());
-
-        RVirAttr actual = virAttrDAO.find(virAttr.getKey(), RVirAttr.class);
-        assertNotNull("expected save to work", actual);
-        assertEquals(virAttr, actual);
-    }
-
-    @Test
-    public void delete() {
-        UVirAttr attribute = virAttrDAO.find(1000L, UVirAttr.class);
-        String attributeSchemaName = attribute.getSchema().getKey();
-
-        virAttrDAO.delete(attribute.getKey(), UVirAttr.class);
-
-        UVirAttr actual = virAttrDAO.find(1000L, UVirAttr.class);
-        assertNull("delete did not work", actual);
-
-        UVirSchema attributeSchema = virSchemaDAO.find(attributeSchemaName, UVirSchema.class);
-
-        assertNotNull("user virtual attribute schema deleted " + "when deleting values", attributeSchema);
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/VirSchemaTest.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/VirSchemaTest.java b/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/VirSchemaTest.java
deleted file mode 100644
index df60909..0000000
--- a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/entity/VirSchemaTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * 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.persistence.jpa.entity;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.List;
-import org.apache.syncope.common.lib.types.AttributableType;
-import org.apache.syncope.common.lib.types.EntityViolationType;
-import org.apache.syncope.persistence.api.attrvalue.validation.InvalidEntityException;
-import org.apache.syncope.persistence.api.dao.VirSchemaDAO;
-import org.apache.syncope.persistence.api.entity.VirSchema;
-import org.apache.syncope.persistence.api.entity.role.RVirSchema;
-import org.apache.syncope.persistence.api.entity.user.UVirSchema;
-import org.apache.syncope.persistence.jpa.AbstractTest;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional
-public class VirSchemaTest extends AbstractTest {
-
-    @Autowired
-    private VirSchemaDAO virSchemaDAO;
-
-    @Test
-    public void findAll() {
-        List<UVirSchema> list = virSchemaDAO.findAll(UVirSchema.class);
-        assertEquals(2, list.size());
-    }
-
-    @Test
-    public void findByName() {
-        UVirSchema attributeSchema = virSchemaDAO.find("virtualdata", UVirSchema.class);
-        assertNotNull("did not find expected virtual attribute schema", attributeSchema);
-    }
-
-    @Test
-    public void save() {
-        UVirSchema virtualAttributeSchema = entityFactory.newEntity(UVirSchema.class);
-        virtualAttributeSchema.setKey("virtual");
-        virtualAttributeSchema.setReadonly(true);
-
-        virSchemaDAO.save(virtualAttributeSchema);
-
-        UVirSchema actual = virSchemaDAO.find("virtual", UVirSchema.class);
-        assertNotNull("expected save to work", actual);
-        assertTrue(actual.isReadonly());
-    }
-
-    @Test
-    public void delete() {
-        UVirSchema virtualdata = virSchemaDAO.find("virtualdata", UVirSchema.class);
-
-        virSchemaDAO.delete(virtualdata.getKey(), attrUtilFactory.getInstance(AttributableType.USER));
-
-        VirSchema actual = virSchemaDAO.find("virtualdata", UVirSchema.class);
-        assertNull("delete did not work", actual);
-
-        // ------------- //
-        RVirSchema rvirtualdata = virSchemaDAO.find("rvirtualdata", RVirSchema.class);
-        assertNotNull(rvirtualdata);
-
-        virSchemaDAO.delete(rvirtualdata.getKey(), attrUtilFactory.getInstance(AttributableType.ROLE));
-
-        actual = virSchemaDAO.find("rvirtualdata", RVirSchema.class);
-        assertNull("delete did not work", actual);
-    }
-
-    @Test
-    public void issueSYNCOPE418() {
-        UVirSchema schema = entityFactory.newEntity(UVirSchema.class);
-        schema.setKey("http://schemas.examples.org/security/authorization/organizationUnit");
-
-        try {
-            virSchemaDAO.save(schema);
-            fail();
-        } catch (InvalidEntityException e) {
-            assertTrue(e.hasViolation(EntityViolationType.InvalidName));
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/AttrTest.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/AttrTest.java b/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/AttrTest.java
deleted file mode 100644
index a74e3a1..0000000
--- a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/AttrTest.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * 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.persistence.jpa.relationship;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.syncope.common.lib.SyncopeConstants;
-import org.apache.syncope.common.lib.types.AttrSchemaType;
-import org.apache.syncope.common.lib.types.AttributableType;
-import org.apache.syncope.persistence.api.dao.DerAttrDAO;
-import org.apache.syncope.persistence.api.dao.DerSchemaDAO;
-import org.apache.syncope.persistence.api.dao.MembershipDAO;
-import org.apache.syncope.persistence.api.dao.PlainAttrDAO;
-import org.apache.syncope.persistence.api.dao.PlainAttrValueDAO;
-import org.apache.syncope.persistence.api.dao.PlainSchemaDAO;
-import org.apache.syncope.persistence.api.dao.RoleDAO;
-import org.apache.syncope.persistence.api.dao.UserDAO;
-import org.apache.syncope.persistence.api.entity.membership.MPlainAttr;
-import org.apache.syncope.persistence.api.entity.membership.MPlainAttrTemplate;
-import org.apache.syncope.persistence.api.entity.membership.MPlainSchema;
-import org.apache.syncope.persistence.api.entity.membership.Membership;
-import org.apache.syncope.persistence.api.entity.role.RPlainAttrTemplate;
-import org.apache.syncope.persistence.api.entity.role.Role;
-import org.apache.syncope.persistence.api.entity.user.UDerAttr;
-import org.apache.syncope.persistence.api.entity.user.UDerSchema;
-import org.apache.syncope.persistence.api.entity.user.UPlainAttr;
-import org.apache.syncope.persistence.api.entity.user.UPlainAttrValue;
-import org.apache.syncope.persistence.api.entity.user.User;
-import org.apache.syncope.persistence.jpa.AbstractTest;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional
-public class AttrTest extends AbstractTest {
-
-    @Autowired
-    private PlainAttrDAO plainAttrDAO;
-
-    @Autowired
-    private DerAttrDAO derAttrDAO;
-
-    @Autowired
-    private PlainAttrValueDAO plainAttrValueDAO;
-
-    @Autowired
-    private PlainSchemaDAO plainSchemaDAO;
-
-    @Autowired
-    private DerSchemaDAO derSchemaDAO;
-
-    @Autowired
-    private MembershipDAO membershipDAO;
-
-    @Autowired
-    private RoleDAO roleDAO;
-
-    @Autowired
-    private UserDAO userDAO;
-
-    @Test
-    public void deleteAttribute() {
-        plainAttrDAO.delete(117L, UPlainAttr.class);
-
-        plainAttrDAO.flush();
-
-        assertNull(plainAttrDAO.find(117L, UPlainAttr.class));
-        assertNull(plainAttrValueDAO.find(28L, UPlainAttrValue.class));
-    }
-
-    @Test
-    public void deleteAttributeValue() {
-        UPlainAttrValue value = plainAttrValueDAO.find(14L, UPlainAttrValue.class);
-        int attributeValueNumber = value.getAttr().getValues().size();
-
-        plainAttrValueDAO.delete(value.getKey(), UPlainAttrValue.class);
-
-        plainAttrValueDAO.flush();
-
-        assertNull(plainAttrValueDAO.find(value.getKey(), UPlainAttrValue.class));
-
-        UPlainAttr attribute = plainAttrDAO.find(104L, UPlainAttr.class);
-        assertEquals(attribute.getValues().size(), attributeValueNumber - 1);
-    }
-
-    @Test
-    public void checkForEnumType() {
-        User user = userDAO.find(1L);
-        Membership membership = user.getMembership(1L);
-        assertNotNull(membership);
-
-        MPlainSchema schema = entityFactory.newEntity(MPlainSchema.class);
-        schema.setType(AttrSchemaType.Enum);
-        schema.setKey("color");
-        schema.setEnumerationValues("red" + SyncopeConstants.ENUM_VALUES_SEPARATOR + "yellow");
-
-        MPlainSchema actualSchema = plainSchemaDAO.save(schema);
-        assertNotNull(actualSchema);
-
-        MPlainAttrTemplate template = entityFactory.newEntity(MPlainAttrTemplate.class);
-        template.setSchema(actualSchema);
-        membership.getRole().getAttrTemplates(MPlainAttrTemplate.class).add(template);
-
-        MPlainAttr attr = entityFactory.newEntity(MPlainAttr.class);
-        attr.setTemplate(template);
-        attr.setOwner(membership);
-        attr.addValue("yellow", attrUtilFactory.getInstance(AttributableType.MEMBERSHIP));
-        membership.addPlainAttr(attr);
-
-        MPlainAttr actualAttribute = userDAO.save(user).getMembership(1L).getPlainAttr("color");
-        assertNotNull(actualAttribute);
-
-        membership = membershipDAO.find(1L);
-        assertNotNull(membership);
-        assertNotNull(membership.getPlainAttr(schema.getKey()));
-        assertNotNull(membership.getPlainAttr(schema.getKey()).getValues());
-
-        assertEquals(membership.getPlainAttr(schema.getKey()).getValues().size(), 1);
-    }
-
-    @Test
-    public void derAttrFromSpecialAttrs() {
-        UDerSchema sderived = entityFactory.newEntity(UDerSchema.class);
-        sderived.setKey("sderived");
-        sderived.setExpression("username + ' - ' + creationDate + '[' + failedLogins + ']'");
-
-        sderived = derSchemaDAO.save(sderived);
-        derSchemaDAO.flush();
-
-        UDerSchema actual = derSchemaDAO.find("sderived", UDerSchema.class);
-        assertNotNull("expected save to work", actual);
-        assertEquals(sderived, actual);
-
-        User owner = userDAO.find(3L);
-        assertNotNull("did not get expected user", owner);
-
-        UDerAttr derAttr = entityFactory.newEntity(UDerAttr.class);
-        derAttr.setOwner(owner);
-        derAttr.setSchema(sderived);
-
-        derAttr = derAttrDAO.save(derAttr);
-        derAttrDAO.flush();
-
-        derAttr = derAttrDAO.find(derAttr.getKey(), UDerAttr.class);
-        assertNotNull("expected save to work", derAttr);
-
-        String value = derAttr.getValue(owner.getPlainAttrs());
-        assertNotNull(value);
-        assertFalse(value.isEmpty());
-        assertTrue(value.startsWith("vivaldi - 2010-10-20"));
-        assertTrue(value.endsWith("[0]"));
-    }
-
-    @Test
-    public void unmatchedRoleAttr() {
-        Role role = roleDAO.find(1L);
-        assertNotNull(role);
-
-        assertNotNull(role.getAttrTemplate(RPlainAttrTemplate.class, "icon"));
-        assertNotNull(role.getPlainAttr("icon"));
-
-        assertTrue(role.getAttrTemplates(RPlainAttrTemplate.class).
-                remove(role.getAttrTemplate(RPlainAttrTemplate.class, "icon")));
-
-        role = roleDAO.save(role);
-        roleDAO.flush();
-
-        assertNull(role.getAttrTemplate(RPlainAttrTemplate.class, "icon"));
-        assertNull(role.getPlainAttr("icon"));
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/AttributableSearchTest.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/AttributableSearchTest.java b/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/AttributableSearchTest.java
deleted file mode 100644
index 97b6042..0000000
--- a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/AttributableSearchTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.persistence.jpa.relationship;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.apache.syncope.common.lib.types.SubjectType;
-import org.apache.syncope.persistence.api.RoleEntitlementUtil;
-import org.apache.syncope.persistence.api.dao.EntitlementDAO;
-import org.apache.syncope.persistence.api.dao.RoleDAO;
-import org.apache.syncope.persistence.api.dao.SubjectSearchDAO;
-import org.apache.syncope.persistence.api.dao.search.AttributeCond;
-import org.apache.syncope.persistence.api.dao.search.SearchCond;
-import org.apache.syncope.persistence.api.entity.role.Role;
-import org.apache.syncope.persistence.api.entity.user.User;
-import org.apache.syncope.persistence.jpa.AbstractTest;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional
-public class AttributableSearchTest extends AbstractTest {
-
-    @Autowired
-    private RoleDAO roleDAO;
-
-    @Autowired
-    private SubjectSearchDAO searchDAO;
-
-    @Autowired
-    private EntitlementDAO entitlementDAO;
-
-    @Test
-    public void issueSYNCOPE95() {
-        Set<Role> roles = new HashSet<>(roleDAO.findAll());
-        for (Role role : roles) {
-            roleDAO.delete(role.getKey());
-        }
-        roleDAO.flush();
-
-        final AttributeCond coolLeafCond = new AttributeCond(AttributeCond.Type.EQ);
-        coolLeafCond.setSchema("cool");
-        coolLeafCond.setExpression("true");
-
-        final SearchCond cond = SearchCond.getLeafCond(coolLeafCond);
-        assertTrue(cond.isValid());
-
-        final List<User> users =
-                searchDAO.search(RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()), cond, SubjectType.USER);
-        assertNotNull(users);
-        assertEquals(1, users.size());
-
-        assertEquals(Long.valueOf(4L), users.get(0).getKey());
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/ConnInstanceTest.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/ConnInstanceTest.java b/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/ConnInstanceTest.java
deleted file mode 100644
index a0fa69d..0000000
--- a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/ConnInstanceTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.persistence.jpa.relationship;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-import org.apache.syncope.common.lib.types.ConnectorCapability;
-import org.apache.syncope.persistence.api.dao.ConnInstanceDAO;
-import org.apache.syncope.persistence.api.dao.ExternalResourceDAO;
-import org.apache.syncope.persistence.api.entity.ConnInstance;
-import org.apache.syncope.persistence.api.entity.ExternalResource;
-import org.apache.syncope.persistence.jpa.AbstractTest;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional
-public class ConnInstanceTest extends AbstractTest {
-
-    @Autowired
-    private ExternalResourceDAO resourceDAO;
-
-    @Autowired
-    private ConnInstanceDAO connInstanceDAO;
-
-    @Test
-    public void deleteCascade() {
-        ConnInstance connInstance = connInstanceDAO.find(103L);
-        assertNotNull(connInstance);
-
-        List<? extends ExternalResource> resources = connInstance.getResources();
-        assertNotNull(resources);
-        assertFalse(resources.isEmpty());
-
-        connInstanceDAO.delete(connInstance.getKey());
-
-        connInstanceDAO.flush();
-
-        ConnInstance actual = connInstanceDAO.find(103L);
-        assertNull(actual);
-
-        for (ExternalResource resource : resources) {
-            assertNull(resourceDAO.find(resource.getKey()));
-        }
-    }
-
-    /**
-     * Connector change used to miss connector bean registration.
-     *
-     * http://code.google.com/p/syncope/issues/detail?id=176
-     */
-    @Test
-    public void issue176() {
-        ConnInstance connInstance = connInstanceDAO.find(103L);
-        assertNotNull(connInstance);
-        assertTrue(connInstance.getCapabilities().isEmpty());
-
-        List<? extends ExternalResource> resources = connInstance.getResources();
-        assertNotNull(resources);
-        assertEquals(4, resources.size());
-        assertTrue(
-                "ws-target-resource-nopropagation".equalsIgnoreCase(resources.get(0).getKey())
-                || "ws-target-resource-nopropagation".equalsIgnoreCase(resources.get(1).getKey())
-                || "ws-target-resource-nopropagation".equalsIgnoreCase(resources.get(2).getKey())
-                || "ws-target-resource-nopropagation".equalsIgnoreCase(resources.get(3).getKey()));
-
-        connInstance.addCapability(ConnectorCapability.SEARCH);
-
-        connInstance = connInstanceDAO.save(connInstance);
-        assertNotNull(connInstance);
-        assertFalse(connInstance.getCapabilities().isEmpty());
-
-        resources = connInstance.getResources();
-        assertNotNull(resources);
-        assertEquals(4, resources.size());
-        assertTrue(
-                "ws-target-resource-nopropagation".equalsIgnoreCase(resources.get(0).getKey())
-                || "ws-target-resource-nopropagation".equalsIgnoreCase(resources.get(1).getKey())
-                || "ws-target-resource-nopropagation".equalsIgnoreCase(resources.get(2).getKey())
-                || "ws-target-resource-nopropagation".equalsIgnoreCase(resources.get(3).getKey()));
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/DerSchemaTest.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/DerSchemaTest.java b/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/DerSchemaTest.java
deleted file mode 100644
index 2982423..0000000
--- a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/DerSchemaTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.persistence.jpa.relationship;
-
-import static org.junit.Assert.assertNull;
-
-import org.apache.syncope.common.lib.types.AttributableType;
-import org.apache.syncope.persistence.api.dao.DerAttrDAO;
-import org.apache.syncope.persistence.api.dao.DerSchemaDAO;
-import org.apache.syncope.persistence.api.dao.UserDAO;
-import org.apache.syncope.persistence.api.entity.user.UDerAttr;
-import org.apache.syncope.persistence.api.entity.user.UDerSchema;
-import org.apache.syncope.persistence.jpa.AbstractTest;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional
-public class DerSchemaTest extends AbstractTest {
-
-    @Autowired
-    private UserDAO userDAO;
-
-    @Autowired
-    private DerSchemaDAO derSchemaDAO;
-
-    @Autowired
-    private DerAttrDAO derAttrDAO;
-
-    @Test
-    public void test() {
-        UDerSchema schema = derSchemaDAO.find("cn", UDerSchema.class);
-
-        derSchemaDAO.delete(schema.getKey(), attrUtilFactory.getInstance(AttributableType.USER));
-
-        derSchemaDAO.flush();
-
-        assertNull(derSchemaDAO.find(schema.getKey(), UDerSchema.class));
-        assertNull(derAttrDAO.find(100L, UDerAttr.class));
-        assertNull(userDAO.find(3L).getDerAttr(schema.getKey()));
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/EntitlementTest.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/EntitlementTest.java b/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/EntitlementTest.java
deleted file mode 100644
index 077a8e2..0000000
--- a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/EntitlementTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.persistence.jpa.relationship;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-import org.apache.syncope.persistence.api.dao.EntitlementDAO;
-import org.apache.syncope.persistence.api.dao.RoleDAO;
-import org.apache.syncope.persistence.api.entity.Entitlement;
-import org.apache.syncope.persistence.api.entity.role.Role;
-import org.apache.syncope.persistence.jpa.AbstractTest;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional
-public class EntitlementTest extends AbstractTest {
-
-    @Autowired
-    private EntitlementDAO entitlementDAO;
-
-    @Autowired
-    private RoleDAO roleDAO;
-
-    @Test
-    public void delete() {
-        Entitlement entitlement = entitlementDAO.find("base");
-        assertNotNull("did not find expected entitlement", entitlement);
-
-        List<Role> roles = roleDAO.findByEntitlement(entitlement);
-        assertEquals("expected two roles", 2, roles.size());
-
-        entitlementDAO.delete("base");
-
-        roles = roleDAO.findByEntitlement(entitlement);
-        assertTrue(roles.isEmpty());
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/MembershipTest.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/MembershipTest.java b/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/MembershipTest.java
deleted file mode 100644
index c391aaa..0000000
--- a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/MembershipTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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.persistence.jpa.relationship;
-
-import static org.junit.Assert.assertTrue;
-
-import org.apache.syncope.persistence.api.dao.MembershipDAO;
-import org.apache.syncope.persistence.api.dao.RoleDAO;
-import org.apache.syncope.persistence.api.entity.membership.Membership;
-import org.apache.syncope.persistence.api.entity.role.Role;
-import org.apache.syncope.persistence.api.entity.user.User;
-import org.apache.syncope.persistence.jpa.AbstractTest;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional
-public class MembershipTest extends AbstractTest {
-
-    @Autowired
-    private MembershipDAO membershipDAO;
-
-    @Autowired
-    private RoleDAO roleDAO;
-
-    @Test
-    public void delete() {
-        Membership membership = membershipDAO.find(4L);
-        User user = membership.getUser();
-        Role role = membership.getRole();
-
-        membershipDAO.delete(4L);
-
-        membershipDAO.flush();
-
-        for (Membership m : user.getMemberships()) {
-            assertTrue(m.getKey() != 4L);
-        }
-        for (Membership m : roleDAO.findMemberships(role)) {
-            assertTrue(m.getKey() != 4L);
-        }
-    }
-
-    @Test
-    public void deleteAndCreate() {
-        Membership membership = membershipDAO.find(3L);
-        User user = membership.getUser();
-        Role role = membership.getRole();
-
-        // 1. delete that membership
-        membershipDAO.delete(membership.getKey());
-
-        // if not flushing here, the INSERT below will be executed
-        // before the DELETE above
-        membershipDAO.flush();
-
-        // 2. (in the same transaction) create new membership with same user
-        // and role (in order to check the UNIQE constraint on Membership)
-        membership = entityFactory.newEntity(Membership.class);
-        membership.setUser(user);
-        membership.setRole(role);
-
-        membership = membershipDAO.save(membership);
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/PlainSchemaTest.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/PlainSchemaTest.java b/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/PlainSchemaTest.java
deleted file mode 100644
index 710444c..0000000
--- a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/PlainSchemaTest.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * 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.persistence.jpa.relationship;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.syncope.common.lib.types.AttributableType;
-import org.apache.syncope.persistence.api.dao.ExternalResourceDAO;
-import org.apache.syncope.persistence.api.dao.PlainAttrDAO;
-import org.apache.syncope.persistence.api.dao.PlainSchemaDAO;
-import org.apache.syncope.persistence.api.dao.UserDAO;
-import org.apache.syncope.persistence.api.entity.ExternalResource;
-import org.apache.syncope.persistence.api.entity.MappingItem;
-import org.apache.syncope.persistence.api.entity.user.UPlainAttr;
-import org.apache.syncope.persistence.api.entity.user.UPlainSchema;
-import org.apache.syncope.persistence.jpa.AbstractTest;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional
-public class PlainSchemaTest extends AbstractTest {
-
-    @Autowired
-    private UserDAO userDAO;
-
-    @Autowired
-    private PlainSchemaDAO plainSchemaDAO;
-
-    @Autowired
-    private PlainAttrDAO plainAttrDAO;
-
-    @Autowired
-    private ExternalResourceDAO resourceDAO;
-
-    @Test
-    public void deleteFullname() {
-        // fullname is mapped as AccountId for ws-target-resource-2, need to swap it otherwise validation errors 
-        // will be raised
-        for (MappingItem item : resourceDAO.find("ws-target-resource-2").getUmapping().getItems()) {
-            if ("fullname".equals(item.getIntAttrName())) {
-                item.setAccountid(false);
-            } else if ("surname".equals(item.getIntAttrName())) {
-                item.setAccountid(true);
-            }
-        }
-
-        // search for user schema fullname
-        UPlainSchema schema = plainSchemaDAO.find("fullname", UPlainSchema.class);
-        assertNotNull(schema);
-
-        // check for associated mappings
-        Set<MappingItem> mapItems = new HashSet<>();
-        for (ExternalResource resource : resourceDAO.findAll()) {
-            if (resource.getUmapping() != null) {
-                for (MappingItem mapItem : resource.getUmapping().getItems()) {
-                    if (schema.getKey().equals(mapItem.getIntAttrName())) {
-                        mapItems.add(mapItem);
-                    }
-                }
-            }
-        }
-        assertFalse(mapItems.isEmpty());
-
-        // delete user schema fullname
-        plainSchemaDAO.delete("fullname", attrUtilFactory.getInstance(AttributableType.USER));
-
-        plainSchemaDAO.flush();
-
-        // check for schema deletion
-        schema = plainSchemaDAO.find("fullname", UPlainSchema.class);
-        assertNull(schema);
-
-        plainSchemaDAO.clear();
-
-        // check for mappings deletion
-        mapItems = new HashSet<>();
-        for (ExternalResource resource : resourceDAO.findAll()) {
-            if (resource.getUmapping() != null) {
-                for (MappingItem mapItem : resource.getUmapping().getItems()) {
-                    if ("fullname".equals(mapItem.getIntAttrName())) {
-                        mapItems.add(mapItem);
-                    }
-                }
-            }
-        }
-        assertTrue(mapItems.isEmpty());
-
-        assertNull(plainAttrDAO.find(100L, UPlainAttr.class));
-        assertNull(plainAttrDAO.find(300L, UPlainAttr.class));
-        assertNull(userDAO.find(1L).getPlainAttr("fullname"));
-        assertNull(userDAO.find(3L).getPlainAttr("fullname"));
-    }
-
-    @Test
-    public void deleteSurname() {
-        // search for user schema fullname
-        UPlainSchema schema = plainSchemaDAO.find("surname", UPlainSchema.class);
-        assertNotNull(schema);
-
-        // check for associated mappings
-        Set<MappingItem> mappings = new HashSet<>();
-        for (ExternalResource resource : resourceDAO.findAll()) {
-            if (resource.getUmapping() != null) {
-                for (MappingItem mapItem : resource.getUmapping().getItems()) {
-                    if (schema.getKey().equals(mapItem.getIntAttrName())) {
-                        mappings.add(mapItem);
-                    }
-                }
-            }
-        }
-        assertFalse(mappings.isEmpty());
-
-        // delete user schema fullname
-        plainSchemaDAO.delete("surname", attrUtilFactory.getInstance(AttributableType.USER));
-
-        plainSchemaDAO.flush();
-
-        // check for schema deletion
-        schema = plainSchemaDAO.find("surname", UPlainSchema.class);
-        assertNull(schema);
-    }
-
-    @Test
-    public void deleteALong() {
-        assertEquals(6, resourceDAO.find("resource-db-sync").getUmapping().getItems().size());
-
-        plainSchemaDAO.delete("aLong", attrUtilFactory.getInstance(AttributableType.USER));
-        assertNull(plainSchemaDAO.find("aLong", UPlainSchema.class));
-
-        plainSchemaDAO.flush();
-
-        assertEquals(5, resourceDAO.find("resource-db-sync").getUmapping().getItems().size());
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/ReportTest.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/ReportTest.java b/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/ReportTest.java
deleted file mode 100644
index 1623a99..0000000
--- a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/ReportTest.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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.persistence.jpa.relationship;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.util.Date;
-import javax.persistence.EntityExistsException;
-import org.apache.syncope.common.lib.types.ReportExecStatus;
-import org.apache.syncope.persistence.api.dao.ReportDAO;
-import org.apache.syncope.persistence.api.dao.ReportExecDAO;
-import org.apache.syncope.persistence.api.entity.Report;
-import org.apache.syncope.persistence.api.entity.ReportExec;
-import org.apache.syncope.persistence.jpa.AbstractTest;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional
-public class ReportTest extends AbstractTest {
-
-    @Autowired
-    private ReportDAO reportDAO;
-
-    @Autowired
-    private ReportExecDAO reportExecDAO;
-
-    @Test
-    public void find() {
-        Report report = reportDAO.find(1L);
-        assertNotNull(report);
-
-        assertNotNull(report.getExecs());
-        assertFalse(report.getExecs().isEmpty());
-        assertEquals(1, report.getExecs().size());
-    }
-
-    @Test(expected = EntityExistsException.class)
-    public void saveWithExistingName() {
-        Report report = reportDAO.find(1L);
-        assertNotNull(report);
-
-        String name = report.getName();
-
-        report = entityFactory.newEntity(Report.class);
-        report.setName(name);
-
-        reportDAO.save(report);
-        reportDAO.flush();
-    }
-
-    @Test
-    public void save() {
-        Report report = reportDAO.find(1L);
-        assertNotNull(report);
-        assertEquals(1, report.getExecs().size());
-
-        ReportExec reportExec = entityFactory.newEntity(ReportExec.class);
-        reportExec.setReport(report);
-        reportExec.setStartDate(new Date());
-        reportExec.setEndDate(new Date());
-        reportExec.setStatus(ReportExecStatus.SUCCESS);
-
-        report.addExec(reportExec);
-
-        reportExec = reportExecDAO.save(reportExec);
-        assertNotNull(reportExec);
-        assertNotNull(reportExec.getKey());
-
-        reportExecDAO.flush();
-
-        report = reportDAO.find(1L);
-        assertNotNull(report);
-        assertEquals(2, report.getExecs().size());
-    }
-
-    @Test
-    public void deleteReport() {
-        reportDAO.delete(1L);
-
-        reportDAO.flush();
-
-        assertNull(reportDAO.find(1L));
-        assertNull(reportExecDAO.find(1L));
-    }
-
-    @Test
-    public void deleteReportExecution() {
-        ReportExec execution = reportExecDAO.find(1L);
-        int executionNumber = execution.getReport().getExecs().size();
-
-        reportExecDAO.delete(1L);
-
-        reportExecDAO.flush();
-
-        assertNull(reportExecDAO.find(1L));
-
-        Report report = reportDAO.find(1L);
-        assertEquals(report.getExecs().size(), executionNumber - 1);
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/ResourceTest.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/ResourceTest.java b/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/ResourceTest.java
deleted file mode 100644
index 6a5595c..0000000
--- a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/persistence/jpa/relationship/ResourceTest.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * 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.persistence.jpa.relationship;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import javax.persistence.EntityManager;
-import org.apache.syncope.common.lib.types.IntMappingType;
-import org.apache.syncope.common.lib.types.MappingPurpose;
-import org.apache.syncope.common.lib.types.TaskType;
-import org.apache.syncope.persistence.api.dao.ConnInstanceDAO;
-import org.apache.syncope.persistence.api.dao.ExternalResourceDAO;
-import org.apache.syncope.persistence.api.dao.PolicyDAO;
-import org.apache.syncope.persistence.api.dao.TaskDAO;
-import org.apache.syncope.persistence.api.dao.UserDAO;
-import org.apache.syncope.persistence.api.entity.ConnInstance;
-import org.apache.syncope.persistence.api.entity.ExternalResource;
-import org.apache.syncope.persistence.api.entity.PasswordPolicy;
-import org.apache.syncope.persistence.api.entity.role.RMappingItem;
-import org.apache.syncope.persistence.api.entity.task.PropagationTask;
-import org.apache.syncope.persistence.api.entity.user.UMapping;
-import org.apache.syncope.persistence.api.entity.user.UMappingItem;
-import org.apache.syncope.persistence.api.entity.user.User;
-import org.apache.syncope.persistence.jpa.AbstractTest;
-import org.apache.syncope.persistence.jpa.entity.role.JPARMappingItem;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional
-public class ResourceTest extends AbstractTest {
-
-    @Autowired
-    private EntityManager entityManager;
-
-    @Autowired
-    private ExternalResourceDAO resourceDAO;
-
-    @Autowired
-    private ConnInstanceDAO connInstanceDAO;
-
-    @Autowired
-    private UserDAO userDAO;
-
-    @Autowired
-    private TaskDAO taskDAO;
-
-    @Autowired
-    private PolicyDAO policyDAO;
-
-    @Test
-    public void createWithPasswordPolicy() {
-        final String resourceName = "resourceWithPasswordPolicy";
-
-        PasswordPolicy policy = (PasswordPolicy) policyDAO.find(4L);
-        ExternalResource resource = entityFactory.newEntity(ExternalResource.class);
-        resource.setKey(resourceName);
-        resource.setPasswordPolicy(policy);
-
-        ConnInstance connector = connInstanceDAO.find(100L);
-        assertNotNull("connector not found", connector);
-        resource.setConnector(connector);
-
-        ExternalResource actual = resourceDAO.save(resource);
-        assertNotNull(actual);
-
-        actual = resourceDAO.find(actual.getKey());
-        assertNotNull(actual);
-        assertNotNull(actual.getPasswordPolicy());
-
-        resourceDAO.delete(resourceName);
-        assertNull(resourceDAO.find(resourceName));
-
-        assertNotNull(policyDAO.find(4L));
-    }
-
-    @Test
-    public void save() {
-        ExternalResource resource = entityFactory.newEntity(ExternalResource.class);
-        resource.setKey("ws-target-resource-save");
-
-        // specify the connector
-        ConnInstance connector = connInstanceDAO.find(100L);
-        assertNotNull("connector not found", connector);
-
-        resource.setConnector(connector);
-
-        UMapping mapping = entityFactory.newEntity(UMapping.class);
-        mapping.setResource(resource);
-        resource.setUmapping(mapping);
-
-        // specify mappings
-        for (int i = 0; i < 3; i++) {
-            UMappingItem item = entityFactory.newEntity(UMappingItem.class);
-            item.setExtAttrName("test" + i);
-            item.setIntAttrName("nonexistent" + i);
-            item.setIntMappingType(IntMappingType.UserSchema);
-            item.setMandatoryCondition("false");
-            item.setPurpose(MappingPurpose.SYNCHRONIZATION);
-            mapping.addItem(item);
-            item.setMapping(mapping);
-        }
-        UMappingItem accountId = entityFactory.newEntity(UMappingItem.class);
-        accountId.setExtAttrName("username");
-        accountId.setIntAttrName("username");
-        accountId.setIntMappingType(IntMappingType.UserId);
-        accountId.setPurpose(MappingPurpose.PROPAGATION);
-        mapping.setAccountIdItem(accountId);
-        accountId.setMapping(mapping);
-
-        // map a derived attribute
-        UMappingItem derived = entityFactory.newEntity(UMappingItem.class);
-        derived.setAccountid(false);
-        derived.setExtAttrName("fullname");
-        derived.setIntAttrName("cn");
-        derived.setIntMappingType(IntMappingType.UserDerivedSchema);
-        derived.setPurpose(MappingPurpose.PROPAGATION);
-        mapping.addItem(derived);
-        derived.setMapping(mapping);
-
-        // save the resource
-        ExternalResource actual = resourceDAO.save(resource);
-        assertNotNull(actual);
-        assertNotNull(actual.getUmapping());
-
-        resourceDAO.flush();
-        resourceDAO.detach(actual);
-        connInstanceDAO.detach(connector);
-
-        // assign the new resource to an user
-        User user = userDAO.find(1L);
-        assertNotNull("user not found", user);
-
-        user.addResource(actual);
-
-        resourceDAO.flush();
-
-        // retrieve resource
-        resource = resourceDAO.find(actual.getKey());
-        assertNotNull(resource);
-
-        // check connector
-        connector = connInstanceDAO.find(100L);
-        assertNotNull(connector);
-
-        assertNotNull(connector.getResources());
-        assertTrue(connector.getResources().contains(resource));
-
-        assertNotNull(resource.getConnector());
-        assertTrue(resource.getConnector().equals(connector));
-
-        // check mappings
-        List<? extends UMappingItem> items = resource.getUmapping().getItems();
-        assertNotNull(items);
-        assertEquals(5, items.size());
-
-        // check user
-        user = userDAO.find(1L);
-        assertNotNull(user);
-        assertNotNull(user.getResources());
-        assertTrue(user.getResources().contains(actual));
-    }
-
-    @Test
-    public void delete() {
-        ExternalResource resource = resourceDAO.find("ws-target-resource-2");
-        assertNotNull("find to delete did not work", resource);
-
-        // -------------------------------------
-        // Get originally associated connector
-        // -------------------------------------
-        ConnInstance connector = resource.getConnector();
-        assertNotNull(connector);
-
-        Long connectorId = connector.getKey();
-        // -------------------------------------
-
-        // -------------------------------------
-        // Get originally associated users
-        // -------------------------------------
-        List<User> users = userDAO.findByResource(resource);
-        assertNotNull(users);
-
-        Set<Long> userIds = new HashSet<Long>();
-        for (User user : users) {
-            userIds.add(user.getKey());
-        }
-        // -------------------------------------
-
-        // Get tasks
-        List<PropagationTask> propagationTasks = taskDAO.findAll(resource, TaskType.PROPAGATION);
-        assertFalse(propagationTasks.isEmpty());
-
-        // delete resource
-        resourceDAO.delete(resource.getKey());
-
-        // close the transaction
-        resourceDAO.flush();
-
-        // resource must be removed
-        ExternalResource actual = resourceDAO.find("ws-target-resource-2");
-        assertNull("delete did not work", actual);
-
-        // resource must be not referenced any more from users
-        for (Long id : userIds) {
-            User actualUser = userDAO.find(id);
-            assertNotNull(actualUser);
-            for (ExternalResource res : actualUser.getResources()) {
-                assertFalse(res.getKey().equalsIgnoreCase(resource.getKey()));
-            }
-        }
-
-        // resource must be not referenced any more from the connector
-        ConnInstance actualConnector = connInstanceDAO.find(connectorId);
-        assertNotNull(actualConnector);
-        for (ExternalResource res : actualConnector.getResources()) {
-            assertFalse(res.getKey().equalsIgnoreCase(resource.getKey()));
-        }
-
-        // there must be no tasks
-        for (PropagationTask task : propagationTasks) {
-            assertNull(taskDAO.find(task.getKey()));
-        }
-    }
-
-    @Test
-    public void emptyMapping() {
-        ExternalResource ldap = resourceDAO.find("resource-ldap");
-        assertNotNull(ldap);
-        assertNotNull(ldap.getUmapping());
-        assertNotNull(ldap.getRmapping());
-
-        List<? extends RMappingItem> items = ldap.getRmapping().getItems();
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        List<Long> itemIds = new ArrayList<Long>(items.size());
-        for (RMappingItem item : items) {
-            itemIds.add(item.getKey());
-        }
-
-        ldap.setRmapping(null);
-
-        resourceDAO.save(ldap);
-        resourceDAO.flush();
-
-        for (Long itemId : itemIds) {
-            assertNull(entityManager.find(JPARMappingItem.class, itemId));
-        }
-    }
-
-    @Test
-    public void issue243() {
-        ExternalResource csv = resourceDAO.find("resource-csv");
-        assertNotNull(csv);
-
-        int origMapItems = csv.getUmapping().getItems().size();
-
-        UMappingItem newMapItem = entityFactory.newEntity(UMappingItem.class);
-        newMapItem.setIntMappingType(IntMappingType.Username);
-        newMapItem.setExtAttrName("TEST");
-        newMapItem.setPurpose(MappingPurpose.PROPAGATION);
-        csv.getUmapping().addItem(newMapItem);
-
-        resourceDAO.save(csv);
-        resourceDAO.flush();
-
-        csv = resourceDAO.find("resource-csv");
-        assertNotNull(csv);
-        assertEquals(origMapItems + 1, csv.getUmapping().getItems().size());
-    }
-}