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

[10/21] syncope git commit: [SYNCOPE-152] Moving console IT under fit/core-reference in order to speed-up the total build time

http://git-wip-us.apache.org/repos/asf/syncope/blob/17d5d892/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
deleted file mode 100644
index 0f80766..0000000
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
+++ /dev/null
@@ -1,938 +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.fit.core.reference;
-
-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 static org.junit.Assert.fail;
-
-import java.security.AccessControlException;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
-import javax.ws.rs.core.GenericType;
-import javax.ws.rs.core.Response;
-import org.apache.commons.collections4.IterableUtils;
-import org.apache.commons.collections4.Predicate;
-import org.apache.syncope.client.lib.SyncopeClient;
-import org.apache.syncope.common.lib.AnyOperations;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.SyncopeConstants;
-import org.apache.syncope.common.lib.patch.AnyObjectPatch;
-import org.apache.syncope.common.lib.patch.AssociationPatch;
-import org.apache.syncope.common.lib.patch.AttrPatch;
-import org.apache.syncope.common.lib.patch.DeassociationPatch;
-import org.apache.syncope.common.lib.patch.GroupPatch;
-import org.apache.syncope.common.lib.patch.LongReplacePatchItem;
-import org.apache.syncope.common.lib.patch.StringReplacePatchItem;
-import org.apache.syncope.common.lib.to.AnyObjectTO;
-import org.apache.syncope.common.lib.to.AnyTypeClassTO;
-import org.apache.syncope.common.lib.to.AnyTypeTO;
-import org.apache.syncope.common.lib.to.AttrTO;
-import org.apache.syncope.common.lib.to.BulkActionResult;
-import org.apache.syncope.common.lib.to.ConnInstanceTO;
-import org.apache.syncope.common.lib.to.ConnObjectTO;
-import org.apache.syncope.common.lib.to.MappingItemTO;
-import org.apache.syncope.common.lib.to.PagedResult;
-import org.apache.syncope.common.lib.to.PlainSchemaTO;
-import org.apache.syncope.common.lib.to.ResourceTO;
-import org.apache.syncope.common.lib.to.GroupTO;
-import org.apache.syncope.common.lib.to.MappingTO;
-import org.apache.syncope.common.lib.to.ProvisionTO;
-import org.apache.syncope.common.lib.to.ProvisioningResult;
-import org.apache.syncope.common.lib.to.TypeExtensionTO;
-import org.apache.syncope.common.lib.to.UserTO;
-import org.apache.syncope.common.lib.types.AnyTypeKind;
-import org.apache.syncope.common.lib.types.AttrSchemaType;
-import org.apache.syncope.common.lib.types.ClientExceptionType;
-import org.apache.syncope.common.lib.types.ConnectorCapability;
-import org.apache.syncope.common.lib.types.IntMappingType;
-import org.apache.syncope.common.lib.types.MappingPurpose;
-import org.apache.syncope.common.lib.types.PatchOperation;
-import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
-import org.apache.syncope.common.lib.types.ResourceAssociationAction;
-import org.apache.syncope.common.lib.types.ResourceDeassociationAction;
-import org.apache.syncope.common.lib.types.SchemaType;
-import org.apache.syncope.common.rest.api.beans.AnyListQuery;
-import org.apache.syncope.common.rest.api.beans.AnySearchQuery;
-import org.apache.syncope.common.rest.api.service.GroupService;
-import org.junit.FixMethodOrder;
-import org.junit.Test;
-import org.junit.runners.MethodSorters;
-
-@FixMethodOrder(MethodSorters.JVM)
-public class GroupITCase extends AbstractITCase {
-
-    public static GroupTO getBasicSampleTO(final String name) {
-        GroupTO groupTO = new GroupTO();
-        groupTO.setRealm(SyncopeConstants.ROOT_REALM);
-        groupTO.setName(name + getUUIDString());
-        return groupTO;
-    }
-
-    public static GroupTO getSampleTO(final String name) {
-        GroupTO groupTO = getBasicSampleTO(name);
-
-        groupTO.getPlainAttrs().add(attrTO("icon", "anIcon"));
-
-        groupTO.getResources().add(RESOURCE_NAME_LDAP);
-        return groupTO;
-    }
-
-    @Test
-    public void create() {
-        GroupTO groupTO = getSampleTO("lastGroup");
-        groupTO.getVirAttrs().add(attrTO("rvirtualdata", "rvirtualvalue"));
-        groupTO.setGroupOwner(8L);
-
-        groupTO = createGroup(groupTO).getAny();
-        assertNotNull(groupTO);
-
-        assertNotNull(groupTO.getVirAttrMap());
-        assertNotNull(groupTO.getVirAttrMap().get("rvirtualdata").getValues());
-        assertFalse(groupTO.getVirAttrMap().get("rvirtualdata").getValues().isEmpty());
-        assertEquals("rvirtualvalue", groupTO.getVirAttrMap().get("rvirtualdata").getValues().get(0));
-
-        assertTrue(groupTO.getResources().contains(RESOURCE_NAME_LDAP));
-
-        ConnObjectTO connObjectTO =
-                resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), groupTO.getKey());
-        assertNotNull(connObjectTO);
-        assertNotNull(connObjectTO.getPlainAttrMap().get("owner"));
-
-        // SYNCOPE-515: remove ownership
-        GroupPatch groupPatch = new GroupPatch();
-        groupPatch.setKey(groupTO.getKey());
-        groupPatch.setGroupOwner(new LongReplacePatchItem());
-
-        assertNull(updateGroup(groupPatch).getAny().getGroupOwner());
-    }
-
-    @Test
-    public void delete() {
-        try {
-            groupService.delete(0L);
-        } catch (SyncopeClientException e) {
-            assertEquals(Response.Status.NOT_FOUND, e.getType().getResponseStatus());
-        }
-
-        GroupTO groupTO = new GroupTO();
-        groupTO.setName("toBeDeleted" + getUUIDString());
-        groupTO.setRealm("/even");
-
-        groupTO.getResources().add(RESOURCE_NAME_LDAP);
-
-        groupTO = createGroup(groupTO).getAny();
-        assertNotNull(groupTO);
-
-        GroupTO deletedGroup = deleteGroup(groupTO.getKey()).getAny();
-        assertNotNull(deletedGroup);
-
-        try {
-            groupService.read(deletedGroup.getKey());
-        } catch (SyncopeClientException e) {
-            assertEquals(Response.Status.NOT_FOUND, e.getType().getResponseStatus());
-        }
-    }
-
-    @Test
-    public void list() {
-        PagedResult<GroupTO> groupTOs =
-                groupService.list(new AnyListQuery.Builder().realm(SyncopeConstants.ROOT_REALM).build());
-        assertNotNull(groupTOs);
-        assertTrue(groupTOs.getResult().size() >= 8);
-        for (GroupTO groupTO : groupTOs.getResult()) {
-            assertNotNull(groupTO);
-        }
-    }
-
-    @Test
-    public void read() {
-        GroupTO groupTO = groupService.read(1L);
-
-        assertNotNull(groupTO);
-        assertNotNull(groupTO.getPlainAttrs());
-        assertFalse(groupTO.getPlainAttrs().isEmpty());
-    }
-
-    @Test
-    public void selfRead() {
-        UserTO userTO = userService.read(1L);
-        assertNotNull(userTO);
-
-        assertTrue(userTO.getMembershipMap().containsKey(1L));
-        assertFalse(userTO.getMembershipMap().containsKey(3L));
-
-        GroupService groupService2 = clientFactory.create("rossini", ADMIN_PWD).getService(GroupService.class);
-
-        try {
-            groupService2.read(3L);
-            fail();
-        } catch (SyncopeClientException e) {
-            assertEquals(ClientExceptionType.DelegatedAdministration, e.getType());
-        }
-
-        List<GroupTO> groups = groupService2.own();
-        assertNotNull(groups);
-        assertTrue(IterableUtils.matchesAny(groups, new Predicate<GroupTO>() {
-
-            @Override
-            public boolean evaluate(final GroupTO group) {
-                return 1L == group.getKey();
-            }
-        }));
-    }
-
-    @Test
-    public void update() {
-        GroupTO groupTO = getSampleTO("latestGroup" + getUUIDString());
-        groupTO = createGroup(groupTO).getAny();
-
-        assertEquals(1, groupTO.getPlainAttrs().size());
-
-        GroupPatch groupPatch = new GroupPatch();
-        groupPatch.setKey(groupTO.getKey());
-        String modName = "finalGroup" + getUUIDString();
-        groupPatch.setName(new StringReplacePatchItem.Builder().value(modName).build());
-        groupPatch.getPlainAttrs().add(attrAddReplacePatch("show", "FALSE"));
-
-        groupTO = updateGroup(groupPatch).getAny();
-
-        assertEquals(modName, groupTO.getName());
-        assertEquals(2, groupTO.getPlainAttrs().size());
-
-        groupTO.getPlainAttrMap().get("show").getValues().clear();
-
-        groupTO = groupService.update(groupTO).readEntity(new GenericType<ProvisioningResult<GroupTO>>() {
-        }).getAny();
-
-        assertFalse(groupTO.getPlainAttrMap().containsKey("show"));
-    }
-
-    @Test
-    public void patch() {
-        GroupTO original = getBasicSampleTO("patch");
-        original.setUDynMembershipCond("(($groups==3;$resources!=ws-target-resource-1);aLong==1)");
-        original.getADynMembershipConds().put(
-                "PRINTER",
-                "(($groups==7;cool==ss);$resources==ws-target-resource-2);$type==PRINTER");
-
-        GroupTO updated = createGroup(original).getAny();
-
-        updated.getPlainAttrs().add(new AttrTO.Builder().schema("icon").build());
-        updated.getPlainAttrs().add(new AttrTO.Builder().schema("show").build());
-        updated.getPlainAttrs().add(new AttrTO.Builder().schema("rderived_sx").value("sx").build());
-        updated.getPlainAttrs().add(new AttrTO.Builder().schema("rderived_dx").value("dx").build());
-        updated.getPlainAttrs().add(new AttrTO.Builder().schema("title").value("mr").build());
-
-        original = groupService.read(updated.getKey());
-
-        GroupPatch patch = AnyOperations.diff(updated, original, true);
-        GroupTO group = updateGroup(patch).getAny();
-
-        Map<String, AttrTO> attrs = group.getPlainAttrMap();
-        assertFalse(attrs.containsKey("icon"));
-        assertFalse(attrs.containsKey("show"));
-        assertEquals(Collections.singletonList("sx"), attrs.get("rderived_sx").getValues());
-        assertEquals(Collections.singletonList("dx"), attrs.get("rderived_dx").getValues());
-        assertEquals(Collections.singletonList("mr"), attrs.get("title").getValues());
-    }
-
-    @Test
-    public void updateAsGroupOwner() {
-        // 1. read group as admin
-        GroupTO groupTO = groupService.read(6L);
-
-        // issue SYNCOPE-15
-        assertNotNull(groupTO.getCreationDate());
-        assertNotNull(groupTO.getLastChangeDate());
-        assertEquals("admin", groupTO.getCreator());
-        assertEquals("admin", groupTO.getLastModifier());
-
-        // 2. prepare update
-        GroupPatch groupPatch = new GroupPatch();
-        groupPatch.setKey(groupTO.getKey());
-        groupPatch.setName(new StringReplacePatchItem.Builder().value("Director").build());
-
-        // 3. try to update as verdi, not owner of group 6 - fail
-        GroupService groupService2 = clientFactory.create("verdi", ADMIN_PWD).getService(GroupService.class);
-
-        try {
-            groupService2.update(groupPatch);
-            fail();
-        } catch (SyncopeClientException e) {
-            assertEquals(Response.Status.UNAUTHORIZED, e.getType().getResponseStatus());
-        } catch (AccessControlException e) {
-            assertNotNull(e);
-        }
-
-        // 4. update as puccini, owner of group 6 - success
-        GroupService groupService3 = clientFactory.create("puccini", ADMIN_PWD).getService(GroupService.class);
-
-        groupTO = groupService3.update(groupPatch).readEntity(new GenericType<ProvisioningResult<GroupTO>>() {
-        }).getAny();
-        assertEquals("Director", groupTO.getName());
-
-        // issue SYNCOPE-15
-        assertNotNull(groupTO.getCreationDate());
-        assertNotNull(groupTO.getLastChangeDate());
-        assertEquals("admin", groupTO.getCreator());
-        assertEquals("puccini", groupTO.getLastModifier());
-        assertTrue(groupTO.getCreationDate().before(groupTO.getLastChangeDate()));
-    }
-
-    @Test
-    public void unlink() {
-        GroupTO actual = createGroup(getSampleTO("unlink")).getAny();
-        assertNotNull(actual);
-
-        assertNotNull(resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey()));
-
-        DeassociationPatch deassociationPatch = new DeassociationPatch();
-        deassociationPatch.setKey(actual.getKey());
-        deassociationPatch.setAction(ResourceDeassociationAction.UNLINK);
-        deassociationPatch.getResources().add(RESOURCE_NAME_LDAP);
-
-        assertNotNull(groupService.deassociate(deassociationPatch).readEntity(BulkActionResult.class));
-
-        actual = groupService.read(actual.getKey());
-        assertNotNull(actual);
-        assertTrue(actual.getResources().isEmpty());
-
-        assertNotNull(resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey()));
-    }
-
-    @Test
-    public void link() {
-        GroupTO groupTO = getSampleTO("link");
-        groupTO.getResources().clear();
-
-        GroupTO actual = createGroup(groupTO).getAny();
-        assertNotNull(actual);
-
-        try {
-            resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey());
-            fail();
-        } catch (Exception e) {
-            assertNotNull(e);
-        }
-
-        AssociationPatch associationPatch = new AssociationPatch();
-        associationPatch.setKey(actual.getKey());
-        associationPatch.setAction(ResourceAssociationAction.LINK);
-        associationPatch.getResources().add(RESOURCE_NAME_LDAP);
-
-        assertNotNull(groupService.associate(associationPatch).readEntity(BulkActionResult.class));
-
-        actual = groupService.read(actual.getKey());
-        assertFalse(actual.getResources().isEmpty());
-
-        try {
-            resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey());
-            fail();
-        } catch (Exception e) {
-            assertNotNull(e);
-        }
-    }
-
-    @Test
-    public void unassign() {
-        GroupTO actual = createGroup(getSampleTO("unassign")).getAny();
-        assertNotNull(actual);
-
-        assertNotNull(resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey()));
-
-        DeassociationPatch deassociationPatch = new DeassociationPatch();
-        deassociationPatch.setKey(actual.getKey());
-        deassociationPatch.setAction(ResourceDeassociationAction.UNASSIGN);
-        deassociationPatch.getResources().add(RESOURCE_NAME_LDAP);
-
-        assertNotNull(groupService.deassociate(deassociationPatch).readEntity(BulkActionResult.class));
-
-        actual = groupService.read(actual.getKey());
-        assertNotNull(actual);
-        assertTrue(actual.getResources().isEmpty());
-
-        try {
-            resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey());
-            fail();
-        } catch (Exception e) {
-            assertNotNull(e);
-        }
-    }
-
-    @Test
-    public void assign() {
-        GroupTO groupTO = getSampleTO("assign");
-        groupTO.getResources().clear();
-
-        GroupTO actual = createGroup(groupTO).getAny();
-        assertNotNull(actual);
-
-        try {
-            resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey());
-            fail();
-        } catch (Exception e) {
-            assertNotNull(e);
-        }
-
-        AssociationPatch associationPatch = new AssociationPatch();
-        associationPatch.setKey(actual.getKey());
-        associationPatch.setAction(ResourceAssociationAction.ASSIGN);
-        associationPatch.getResources().add(RESOURCE_NAME_LDAP);
-
-        assertNotNull(groupService.associate(associationPatch).readEntity(BulkActionResult.class));
-
-        actual = groupService.read(actual.getKey());
-        assertFalse(actual.getResources().isEmpty());
-        assertNotNull(resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey()));
-    }
-
-    @Test
-    public void deprovision() {
-        GroupTO actual = createGroup(getSampleTO("deprovision")).getAny();
-        assertNotNull(actual);
-        assertNotNull(actual.getKey());
-
-        assertNotNull(resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey()));
-
-        DeassociationPatch deassociationPatch = new DeassociationPatch();
-        deassociationPatch.setKey(actual.getKey());
-        deassociationPatch.setAction(ResourceDeassociationAction.DEPROVISION);
-        deassociationPatch.getResources().add(RESOURCE_NAME_LDAP);
-
-        assertNotNull(groupService.deassociate(deassociationPatch).readEntity(BulkActionResult.class));
-
-        actual = groupService.read(actual.getKey());
-        assertNotNull(actual);
-        assertFalse(actual.getResources().isEmpty());
-
-        try {
-            resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey());
-            fail();
-        } catch (Exception e) {
-            assertNotNull(e);
-        }
-    }
-
-    @Test
-    public void provision() {
-        GroupTO groupTO = getSampleTO("assign" + getUUIDString());
-        groupTO.getResources().clear();
-
-        GroupTO actual = createGroup(groupTO).getAny();
-        assertNotNull(actual);
-
-        try {
-            resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey());
-            fail();
-        } catch (Exception e) {
-            assertNotNull(e);
-        }
-
-        AssociationPatch associationPatch = new AssociationPatch();
-        associationPatch.setKey(actual.getKey());
-        associationPatch.setAction(ResourceAssociationAction.PROVISION);
-        associationPatch.getResources().add(RESOURCE_NAME_LDAP);
-
-        assertNotNull(groupService.associate(associationPatch).readEntity(BulkActionResult.class));
-
-        actual = groupService.read(actual.getKey());
-        assertTrue(actual.getResources().isEmpty());
-
-        assertNotNull(resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey()));
-    }
-
-    @Test
-    public void deprovisionUnlinked() {
-        GroupTO groupTO = getSampleTO("assign" + getUUIDString());
-        groupTO.getResources().clear();
-
-        GroupTO actual = createGroup(groupTO).getAny();
-        assertNotNull(actual);
-
-        try {
-            resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey());
-            fail();
-        } catch (Exception e) {
-            assertNotNull(e);
-        }
-
-        AssociationPatch associationPatch = new AssociationPatch();
-        associationPatch.setKey(actual.getKey());
-        associationPatch.setAction(ResourceAssociationAction.PROVISION);
-        associationPatch.getResources().add(RESOURCE_NAME_LDAP);
-
-        assertNotNull(groupService.associate(associationPatch).readEntity(BulkActionResult.class));
-
-        actual = groupService.read(actual.getKey());
-        assertTrue(actual.getResources().isEmpty());
-
-        assertNotNull(resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey()));
-
-        DeassociationPatch deassociationPatch = new DeassociationPatch();
-        deassociationPatch.setKey(actual.getKey());
-        deassociationPatch.setAction(ResourceDeassociationAction.DEPROVISION);
-        deassociationPatch.getResources().add(RESOURCE_NAME_LDAP);
-
-        assertNotNull(groupService.deassociate(deassociationPatch).readEntity(BulkActionResult.class));
-
-        actual = groupService.read(actual.getKey());
-        assertNotNull(actual);
-        assertTrue(actual.getResources().isEmpty());
-
-        try {
-            resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey());
-            fail();
-        } catch (Exception e) {
-            assertNotNull(e);
-        }
-    }
-
-    @Test
-    public void createWithMandatorySchema() {
-        // 1. create a mandatory schema
-        PlainSchemaTO badge = new PlainSchemaTO();
-        badge.setKey("badge" + getUUIDString());
-        badge.setMandatoryCondition("true");
-        schemaService.create(SchemaType.PLAIN, badge);
-
-        // 2. create a group *without* an attribute for that schema: it works
-        GroupTO groupTO = getSampleTO("lastGroup");
-        assertFalse(groupTO.getPlainAttrMap().containsKey(badge.getKey()));
-        groupTO = createGroup(groupTO).getAny();
-        assertNotNull(groupTO);
-        assertFalse(groupTO.getPlainAttrMap().containsKey(badge.getKey()));
-
-        // 3. add the new mandatory schema to the default group type
-        AnyTypeTO type = anyTypeService.read(AnyTypeKind.GROUP.name());
-        String typeClassName = type.getClasses().get(0);
-        AnyTypeClassTO typeClass = anyTypeClassService.read(typeClassName);
-        typeClass.getPlainSchemas().add(badge.getKey());
-        anyTypeClassService.update(typeClass);
-        typeClass = anyTypeClassService.read(typeClassName);
-        assertTrue(typeClass.getPlainSchemas().contains(badge.getKey()));
-
-        try {
-            // 4. update group: failure since no values are provided and it is mandatory
-            GroupPatch groupPatch = new GroupPatch();
-            groupPatch.setKey(groupTO.getKey());
-
-            try {
-                updateGroup(groupPatch);
-                fail();
-            } catch (SyncopeClientException e) {
-                assertEquals(ClientExceptionType.RequiredValuesMissing, e.getType());
-            }
-
-            // 5. also add an actual attribute for badge - it will work        
-            groupPatch.getPlainAttrs().add(attrAddReplacePatch(badge.getKey(), "xxxxxxxxxx"));
-
-            groupTO = updateGroup(groupPatch).getAny();
-            assertNotNull(groupTO);
-            assertTrue(groupTO.getPlainAttrMap().containsKey(badge.getKey()));
-        } finally {
-            // restore the original group class
-            typeClass.getPlainSchemas().remove(badge.getKey());
-            anyTypeClassService.update(typeClass);
-            typeClass = anyTypeClassService.read(typeClassName);
-            assertFalse(typeClass.getPlainSchemas().contains(badge.getKey()));
-        }
-    }
-
-    @Test
-    public void anonymous() {
-        GroupService unauthenticated = clientFactory.create().getService(GroupService.class);
-        try {
-            unauthenticated.list(new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).build());
-            fail();
-        } catch (AccessControlException e) {
-            assertNotNull(e);
-        }
-
-        GroupService anonymous = clientFactory.create(ANONYMOUS_UNAME, ANONYMOUS_KEY).getService(GroupService.class);
-        assertFalse(anonymous.list(new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).build()).
-                getResult().isEmpty());
-    }
-
-    @Test
-    public void uDynMembership() {
-        assertTrue(userService.read(4L).getDynGroups().isEmpty());
-
-        GroupTO group = getBasicSampleTO("uDynMembership");
-        group.setUDynMembershipCond("cool==true");
-        group = createGroup(group).getAny();
-        assertNotNull(group);
-
-        assertTrue(userService.read(4L).getDynGroups().contains(group.getKey()));
-
-        GroupPatch patch = new GroupPatch();
-        patch.setKey(group.getKey());
-        patch.setUDynMembershipCond("cool==false");
-        groupService.update(patch);
-
-        assertTrue(userService.read(4L).getDynGroups().isEmpty());
-    }
-
-    @Test
-    public void aDynMembership() {
-        String fiql = SyncopeClient.getAnyObjectSearchConditionBuilder("PRINTER").is("location").notNullValue().query();
-
-        // 1. create group with a given aDynMembership condition
-        GroupTO group = getBasicSampleTO("aDynMembership");
-        group.getADynMembershipConds().put("PRINTER", fiql);
-        group = createGroup(group).getAny();
-        assertEquals(fiql, group.getADynMembershipConds().get("PRINTER"));
-
-        group = groupService.read(group.getKey());
-        assertEquals(fiql, group.getADynMembershipConds().get("PRINTER"));
-
-        // verify that the condition is dynamically applied
-        AnyObjectTO newAny = AnyObjectITCase.getSampleTO("aDynMembership");
-        newAny.getResources().clear();
-        newAny = createAnyObject(newAny).getAny();
-        assertNotNull(newAny.getPlainAttrMap().get("location"));
-        assertTrue(anyObjectService.read(1L).getDynGroups().contains(group.getKey()));
-        assertTrue(anyObjectService.read(2L).getDynGroups().contains(group.getKey()));
-        assertTrue(anyObjectService.read(newAny.getKey()).getDynGroups().contains(group.getKey()));
-
-        // 2. update group and change aDynMembership condition
-        fiql = SyncopeClient.getAnyObjectSearchConditionBuilder("PRINTER").is("location").nullValue().query();
-
-        GroupPatch patch = new GroupPatch();
-        patch.setKey(group.getKey());
-        patch.getADynMembershipConds().put("PRINTER", fiql);
-
-        group = updateGroup(patch).getAny();
-        assertEquals(fiql, group.getADynMembershipConds().get("PRINTER"));
-
-        group = groupService.read(group.getKey());
-        assertEquals(fiql, group.getADynMembershipConds().get("PRINTER"));
-
-        // verify that the condition is dynamically applied
-        AnyObjectPatch anyPatch = new AnyObjectPatch();
-        anyPatch.setKey(newAny.getKey());
-        anyPatch.getPlainAttrs().add(new AttrPatch.Builder().
-                operation(PatchOperation.DELETE).
-                attrTO(new AttrTO.Builder().schema("location").build()).
-                build());
-        newAny = updateAnyObject(anyPatch).getAny();
-        assertNull(newAny.getPlainAttrMap().get("location"));
-        assertFalse(anyObjectService.read(1L).getDynGroups().contains(group.getKey()));
-        assertFalse(anyObjectService.read(2L).getDynGroups().contains(group.getKey()));
-        assertTrue(anyObjectService.read(newAny.getKey()).getDynGroups().contains(group.getKey()));
-    }
-
-    @Test
-    public void capabilitiesOverride() {
-        // resource with no capability override
-        ResourceTO ldap = resourceService.read(RESOURCE_NAME_LDAP);
-        assertNotNull(ldap);
-        assertFalse(ldap.isOverrideCapabilities());
-        assertTrue(ldap.getCapabilitiesOverride().isEmpty());
-
-        // connector with all required for create and update
-        ConnInstanceTO conn = connectorService.read(ldap.getConnector(), null);
-        assertNotNull(conn);
-        assertTrue(conn.getCapabilities().contains(ConnectorCapability.CREATE));
-        assertTrue(conn.getCapabilities().contains(ConnectorCapability.UPDATE));
-
-        try {
-            // 1. create succeeds
-            GroupTO group = getSampleTO("syncope714");
-            group.getPlainAttrs().add(attrTO("title", "first"));
-            group.getResources().add(RESOURCE_NAME_LDAP);
-
-            ProvisioningResult<GroupTO> result = createGroup(group);
-            assertNotNull(result);
-            assertEquals(1, result.getPropagationStatuses().size());
-            assertEquals(RESOURCE_NAME_LDAP, result.getPropagationStatuses().get(0).getResource());
-            assertEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus());
-            group = result.getAny();
-
-            // 2. update succeeds
-            GroupPatch patch = new GroupPatch();
-            patch.setKey(group.getKey());
-            patch.getPlainAttrs().add(new AttrPatch.Builder().
-                    operation(PatchOperation.ADD_REPLACE).attrTO(attrTO("title", "second")).build());
-
-            result = updateGroup(patch);
-            assertNotNull(result);
-            assertEquals(1, result.getPropagationStatuses().size());
-            assertEquals(RESOURCE_NAME_LDAP, result.getPropagationStatuses().get(0).getResource());
-            assertEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus());
-            group = result.getAny();
-
-            // 3. set capability override with only search allowed, but not enable
-            ldap.getCapabilitiesOverride().add(ConnectorCapability.SEARCH);
-            resourceService.update(ldap);
-            ldap = resourceService.read(RESOURCE_NAME_LDAP);
-            assertNotNull(ldap);
-            assertFalse(ldap.isOverrideCapabilities());
-            assertEquals(1, ldap.getCapabilitiesOverride().size());
-            assertTrue(ldap.getCapabilitiesOverride().contains(ConnectorCapability.SEARCH));
-
-            // 4. update succeeds again
-            patch = new GroupPatch();
-            patch.setKey(group.getKey());
-            patch.getPlainAttrs().add(new AttrPatch.Builder().
-                    operation(PatchOperation.ADD_REPLACE).attrTO(attrTO("title", "third")).build());
-
-            result = updateGroup(patch);
-            assertNotNull(result);
-            assertEquals(1, result.getPropagationStatuses().size());
-            assertEquals(RESOURCE_NAME_LDAP, result.getPropagationStatuses().get(0).getResource());
-            assertEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus());
-            group = result.getAny();
-
-            // 5. enable capability override
-            ldap.setOverrideCapabilities(true);
-            resourceService.update(ldap);
-            ldap = resourceService.read(RESOURCE_NAME_LDAP);
-            assertNotNull(ldap);
-            assertTrue(ldap.isOverrideCapabilities());
-            assertEquals(1, ldap.getCapabilitiesOverride().size());
-            assertTrue(ldap.getCapabilitiesOverride().contains(ConnectorCapability.SEARCH));
-
-            // 6. update now fails
-            patch = new GroupPatch();
-            patch.setKey(group.getKey());
-            patch.getPlainAttrs().add(new AttrPatch.Builder().
-                    operation(PatchOperation.ADD_REPLACE).attrTO(attrTO("title", "fourth")).build());
-
-            result = updateGroup(patch);
-            assertNotNull(result);
-            assertEquals(1, result.getPropagationStatuses().size());
-            assertEquals(RESOURCE_NAME_LDAP, result.getPropagationStatuses().get(0).getResource());
-            assertEquals(PropagationTaskExecStatus.NOT_ATTEMPTED, result.getPropagationStatuses().get(0).getStatus());
-        } finally {
-            ldap.getCapabilitiesOverride().clear();
-            ldap.setOverrideCapabilities(false);
-            resourceService.update(ldap);
-        }
-    }
-
-    @Test
-    public void typeExtensions() {
-        TypeExtensionTO typeExtension = new TypeExtensionTO();
-        typeExtension.setAnyType(AnyTypeKind.USER.name());
-        typeExtension.getAuxClasses().add("csv");
-
-        GroupTO groupTO = getBasicSampleTO("typeExtensions");
-        groupTO.getTypeExtensions().add(typeExtension);
-
-        groupTO = createGroup(groupTO).getAny();
-        assertNotNull(groupTO);
-        assertEquals(1, groupTO.getTypeExtensions().size());
-        assertEquals(1, groupTO.getTypeExtension(AnyTypeKind.USER.name()).getAuxClasses().size());
-        assertTrue(groupTO.getTypeExtension(AnyTypeKind.USER.name()).getAuxClasses().contains("csv"));
-
-        typeExtension = new TypeExtensionTO();
-        typeExtension.setAnyType(AnyTypeKind.USER.name());
-        typeExtension.getAuxClasses().add("csv");
-        typeExtension.getAuxClasses().add("other");
-
-        GroupPatch groupPatch = new GroupPatch();
-        groupPatch.setKey(groupTO.getKey());
-        groupPatch.getTypeExtensions().add(typeExtension);
-
-        groupTO = updateGroup(groupPatch).getAny();
-        assertNotNull(groupTO);
-        assertEquals(1, groupTO.getTypeExtensions().size());
-        assertEquals(2, groupTO.getTypeExtension(AnyTypeKind.USER.name()).getAuxClasses().size());
-        assertTrue(groupTO.getTypeExtension(AnyTypeKind.USER.name()).getAuxClasses().contains("csv"));
-        assertTrue(groupTO.getTypeExtension(AnyTypeKind.USER.name()).getAuxClasses().contains("other"));
-    }
-
-    @Test
-    public void issue178() {
-        GroupTO groupTO = new GroupTO();
-        String groupName = "torename" + getUUIDString();
-        groupTO.setName(groupName);
-        groupTO.setRealm("/");
-
-        GroupTO actual = createGroup(groupTO).getAny();
-
-        assertNotNull(actual);
-        assertEquals(groupName, actual.getName());
-
-        GroupPatch groupPatch = new GroupPatch();
-        groupPatch.setKey(actual.getKey());
-        String renamedGroup = "renamed" + getUUIDString();
-        groupPatch.setName(new StringReplacePatchItem.Builder().value(renamedGroup).build());
-
-        actual = updateGroup(groupPatch).getAny();
-        assertNotNull(actual);
-        assertEquals(renamedGroup, actual.getName());
-    }
-
-    @Test
-    public void issueSYNCOPE632() {
-        GroupTO groupTO = null;
-        try {
-            // 1. create new LDAP resource having ConnObjectKey mapped to a derived attribute
-            ResourceTO newLDAP = resourceService.read(RESOURCE_NAME_LDAP);
-            newLDAP.setKey("new-ldap");
-            newLDAP.setPropagationPriority(0);
-
-            for (ProvisionTO provision : newLDAP.getProvisions()) {
-                provision.getVirSchemas().clear();
-            }
-
-            MappingTO mapping = newLDAP.getProvision(AnyTypeKind.GROUP.name()).getMapping();
-
-            MappingItemTO connObjectKey = mapping.getConnObjectKeyItem();
-            connObjectKey.setIntMappingType(IntMappingType.GroupDerivedSchema);
-            connObjectKey.setIntAttrName("displayProperty");
-            connObjectKey.setPurpose(MappingPurpose.PROPAGATION);
-            mapping.setConnObjectKeyItem(connObjectKey);
-            mapping.setConnObjectLink("'cn=' + displayProperty + ',ou=groups,o=isp'");
-
-            MappingItemTO description = new MappingItemTO();
-            description.setIntMappingType(IntMappingType.GroupKey);
-            description.setExtAttrName("description");
-            description.setPurpose(MappingPurpose.BOTH);
-            mapping.add(description);
-
-            newLDAP = createResource(newLDAP);
-            assertNotNull(newLDAP);
-
-            // 2. create a group and give the resource created above
-            groupTO = getSampleTO("lastGroup" + getUUIDString());
-            groupTO.getPlainAttrs().add(attrTO("icon", "anIcon"));
-            groupTO.getPlainAttrs().add(attrTO("show", "true"));
-            groupTO.getDerAttrs().add(attrTO("displayProperty", null));
-            groupTO.getResources().clear();
-            groupTO.getResources().add("new-ldap");
-
-            groupTO = createGroup(groupTO).getAny();
-            assertNotNull(groupTO);
-
-            // 3. update the group
-            GroupPatch groupPatch = new GroupPatch();
-            groupPatch.setKey(groupTO.getKey());
-            groupPatch.getPlainAttrs().add(attrAddReplacePatch("icon", "anotherIcon"));
-
-            groupTO = updateGroup(groupPatch).getAny();
-            assertNotNull(groupTO);
-
-            // 4. check that a single group exists in LDAP for the group created and updated above
-            int entries = 0;
-            DirContext ctx = null;
-            try {
-                ctx = getLdapResourceDirContext(null, null);
-
-                SearchControls ctls = new SearchControls();
-                ctls.setReturningAttributes(new String[] { "*", "+" });
-                ctls.setSearchScope(SearchControls.SUBTREE_SCOPE);
-
-                NamingEnumeration<SearchResult> result =
-                        ctx.search("ou=groups,o=isp", "(description=" + groupTO.getKey() + ")", ctls);
-                while (result.hasMore()) {
-                    result.next();
-                    entries++;
-                }
-            } catch (Exception e) {
-                // ignore
-            } finally {
-                if (ctx != null) {
-                    try {
-                        ctx.close();
-                    } catch (NamingException e) {
-                        // ignore
-                    }
-                }
-            }
-
-            assertEquals(1, entries);
-        } finally {
-            if (groupTO != null) {
-                groupService.delete(groupTO.getKey());
-            }
-            resourceService.delete("new-ldap");
-        }
-    }
-
-    @Test
-    public void issueSYNCOPE717() {
-        String doubleSchemaName = "double" + getUUIDString();
-
-        // 1. create double schema without conversion pattern
-        PlainSchemaTO schema = new PlainSchemaTO();
-        schema.setKey(doubleSchemaName);
-        schema.setType(AttrSchemaType.Double);
-
-        schema = createSchema(SchemaType.PLAIN, schema);
-        assertNotNull(schema);
-        assertNull(schema.getConversionPattern());
-
-        AnyTypeClassTO minimalGroup = anyTypeClassService.read("minimal group");
-        assertNotNull(minimalGroup);
-        minimalGroup.getPlainSchemas().add(doubleSchemaName);
-        anyTypeClassService.update(minimalGroup);
-
-        // 2. create group, provide valid input value
-        GroupTO groupTO = getBasicSampleTO("syncope717");
-        groupTO.getPlainAttrs().add(attrTO(doubleSchemaName, "11.23"));
-
-        groupTO = createGroup(groupTO).getAny();
-        assertNotNull(groupTO);
-        assertEquals("11.23", groupTO.getPlainAttrMap().get(doubleSchemaName).getValues().get(0));
-
-        // 3. update schema, set conversion pattern
-        schema.setConversionPattern("0.000");
-        schemaService.update(SchemaType.PLAIN, schema);
-
-        // 4. re-read group, verify that pattern was applied
-        groupTO = groupService.read(groupTO.getKey());
-        assertNotNull(groupTO);
-        assertEquals("11.230", groupTO.getPlainAttrMap().get(doubleSchemaName).getValues().get(0));
-
-        // 5. modify group with new double value
-        GroupPatch patch = new GroupPatch();
-        patch.setKey(groupTO.getKey());
-        patch.getPlainAttrs().add(new AttrPatch.Builder().attrTO(attrTO(doubleSchemaName, "11.257")).build());
-
-        groupTO = updateGroup(patch).getAny();
-        assertNotNull(groupTO);
-        assertEquals("11.257", groupTO.getPlainAttrMap().get(doubleSchemaName).getValues().get(0));
-
-        // 6. update schema, unset conversion pattern
-        schema.setConversionPattern(null);
-        schemaService.update(SchemaType.PLAIN, schema);
-
-        // 7. modify group with new double value, verify that no pattern is applied
-        patch = new GroupPatch();
-        patch.setKey(groupTO.getKey());
-        patch.getPlainAttrs().add(new AttrPatch.Builder().attrTO(attrTO(doubleSchemaName, "11.23")).build());
-
-        groupTO = updateGroup(patch).getAny();
-        assertNotNull(groupTO);
-        assertEquals("11.23", groupTO.getPlainAttrMap().get(doubleSchemaName).getValues().get(0));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/17d5d892/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/LoggerITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/LoggerITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/LoggerITCase.java
deleted file mode 100644
index 236d169..0000000
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/LoggerITCase.java
+++ /dev/null
@@ -1,230 +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.fit.core.reference;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
-import java.text.ParseException;
-import java.util.List;
-import javax.ws.rs.core.Response;
-import javax.xml.ws.WebServiceException;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.EventCategoryTO;
-import org.apache.syncope.common.lib.to.LoggerTO;
-import org.apache.syncope.common.lib.types.AnyTypeKind;
-import org.apache.syncope.common.lib.types.AuditElements;
-import org.apache.syncope.common.lib.types.AuditElements.EventCategoryType;
-import org.apache.syncope.common.lib.types.AuditLoggerName;
-import org.apache.syncope.common.lib.types.LoggerLevel;
-import org.apache.syncope.common.lib.types.LoggerType;
-import org.apache.syncope.common.lib.types.ResourceOperation;
-import org.apache.syncope.common.rest.api.LoggerWrapper;
-import org.apache.syncope.core.logic.ReportLogic;
-import org.apache.syncope.core.logic.ResourceLogic;
-import org.apache.syncope.core.logic.GroupLogic;
-import org.apache.syncope.core.logic.UserLogic;
-import org.junit.FixMethodOrder;
-import org.junit.Test;
-import org.junit.runners.MethodSorters;
-
-@FixMethodOrder(MethodSorters.JVM)
-public class LoggerITCase extends AbstractITCase {
-
-    @Test
-    public void listLogs() {
-        List<LoggerTO> loggers = loggerService.list(LoggerType.LOG);
-        assertNotNull(loggers);
-        assertFalse(loggers.isEmpty());
-        for (LoggerTO logger : loggers) {
-            assertNotNull(logger);
-        }
-    }
-
-    @Test
-    public void listAudits() throws ParseException {
-        List<LoggerTO> audits = loggerService.list(LoggerType.AUDIT);
-
-        assertNotNull(audits);
-        assertFalse(audits.isEmpty());
-        for (LoggerTO audit : audits) {
-            assertNotNull(AuditLoggerName.fromLoggerName(audit.getKey()));
-        }
-    }
-
-    @Test
-    public void setLevel() {
-        List<LoggerTO> loggers = loggerService.list(LoggerType.LOG);
-        assertNotNull(loggers);
-        int startSize = loggers.size();
-
-        LoggerTO logger = new LoggerTO();
-        logger.setKey("TEST");
-        logger.setLevel(LoggerLevel.INFO);
-        loggerService.update(LoggerType.LOG, logger);
-        logger = loggerService.read(LoggerType.LOG, logger.getKey());
-        assertNotNull(logger);
-        assertEquals(LoggerLevel.INFO, logger.getLevel());
-
-        loggers = loggerService.list(LoggerType.LOG);
-        assertNotNull(loggers);
-        assertEquals(startSize + 1, loggers.size());
-
-        // TEST Delete
-        loggerService.delete(LoggerType.LOG, "TEST");
-        loggers = loggerService.list(LoggerType.LOG);
-        assertNotNull(loggers);
-        assertEquals(startSize, loggers.size());
-    }
-
-    @Test
-    public void enableDisableAudit() {
-        AuditLoggerName auditLoggerName = new AuditLoggerName(
-                EventCategoryType.REST,
-                ReportLogic.class.getSimpleName(),
-                null,
-                "deleteExecution",
-                AuditElements.Result.FAILURE);
-
-        List<AuditLoggerName> audits = LoggerWrapper.wrap(loggerService.list(LoggerType.AUDIT));
-        assertNotNull(audits);
-        assertFalse(audits.contains(auditLoggerName));
-
-        LoggerTO loggerTO = new LoggerTO();
-        loggerTO.setKey(auditLoggerName.toLoggerName());
-        loggerTO.setLevel(LoggerLevel.DEBUG);
-        loggerService.update(LoggerType.AUDIT, loggerTO);
-
-        audits = LoggerWrapper.wrap(loggerService.list(LoggerType.AUDIT));
-        assertNotNull(audits);
-        assertTrue(audits.contains(auditLoggerName));
-
-        loggerService.delete(LoggerType.AUDIT, auditLoggerName.toLoggerName());
-
-        audits = LoggerWrapper.wrap(loggerService.list(LoggerType.AUDIT));
-        assertNotNull(audits);
-        assertFalse(audits.contains(auditLoggerName));
-    }
-
-    @Test
-    public void listAuditEvents() {
-        final List<EventCategoryTO> events = loggerService.events();
-
-        boolean found = false;
-
-        for (EventCategoryTO eventCategoryTO : events) {
-            if (UserLogic.class.getSimpleName().equals(eventCategoryTO.getCategory())) {
-                assertEquals(EventCategoryType.REST, eventCategoryTO.getType());
-                assertTrue(eventCategoryTO.getEvents().contains("create"));
-                assertTrue(eventCategoryTO.getEvents().contains("list"));
-                assertFalse(eventCategoryTO.getEvents().contains("doCreate"));
-                assertFalse(eventCategoryTO.getEvents().contains("setStatusOnWfAdapter"));
-                assertFalse(eventCategoryTO.getEvents().contains("resolveReference"));
-                found = true;
-            }
-        }
-        assertTrue(found);
-
-        found = false;
-        for (EventCategoryTO eventCategoryTO : events) {
-            if (GroupLogic.class.getSimpleName().equals(eventCategoryTO.getCategory())) {
-                assertEquals(EventCategoryType.REST, eventCategoryTO.getType());
-                assertTrue(eventCategoryTO.getEvents().contains("create"));
-                assertTrue(eventCategoryTO.getEvents().contains("list"));
-                assertFalse(eventCategoryTO.getEvents().contains("resolveReference"));
-                found = true;
-            }
-        }
-        assertTrue(found);
-
-        found = false;
-        for (EventCategoryTO eventCategoryTO : events) {
-            if (ResourceLogic.class.getSimpleName().equals(eventCategoryTO.getCategory())) {
-                assertEquals(EventCategoryType.REST, eventCategoryTO.getType());
-                assertTrue(eventCategoryTO.getEvents().contains("create"));
-                assertTrue(eventCategoryTO.getEvents().contains("read"));
-                assertTrue(eventCategoryTO.getEvents().contains("delete"));
-                assertFalse(eventCategoryTO.getEvents().contains("resolveReference"));
-                found = true;
-            }
-        }
-        assertTrue(found);
-
-        found = false;
-        for (EventCategoryTO eventCategoryTO : events) {
-            if (AnyTypeKind.USER.name().toLowerCase().equals(eventCategoryTO.getCategory())) {
-                if (RESOURCE_NAME_LDAP.equals(eventCategoryTO.getSubcategory())
-                        && EventCategoryType.SYNCHRONIZATION == eventCategoryTO.getType()) {
-                    assertTrue(eventCategoryTO.getEvents().contains(ResourceOperation.CREATE.name().toLowerCase()));
-                    assertTrue(eventCategoryTO.getEvents().contains(ResourceOperation.UPDATE.name().toLowerCase()));
-                    assertTrue(eventCategoryTO.getEvents().contains(ResourceOperation.DELETE.name().toLowerCase()));
-                    found = true;
-                }
-            }
-        }
-        assertTrue(found);
-
-        found = false;
-        for (EventCategoryTO eventCategoryTO : events) {
-            if (AnyTypeKind.USER.name().toLowerCase().equals(eventCategoryTO.getCategory())) {
-                if (RESOURCE_NAME_CSV.equals(eventCategoryTO.getSubcategory())
-                        && EventCategoryType.PROPAGATION == eventCategoryTO.getType()) {
-                    assertTrue(eventCategoryTO.getEvents().contains(ResourceOperation.CREATE.name().toLowerCase()));
-                    assertTrue(eventCategoryTO.getEvents().contains(ResourceOperation.UPDATE.name().toLowerCase()));
-                    assertTrue(eventCategoryTO.getEvents().contains(ResourceOperation.DELETE.name().toLowerCase()));
-                    found = true;
-                }
-            }
-        }
-        assertTrue(found);
-
-        found = false;
-        for (EventCategoryTO eventCategoryTO : events) {
-            if (EventCategoryType.TASK == eventCategoryTO.getType()
-                    && "TestSampleJobDelegate".equals(eventCategoryTO.getCategory())) {
-                found = true;
-            }
-        }
-        assertTrue(found);
-
-        found = false;
-        for (EventCategoryTO eventCategoryTO : events) {
-            if (EventCategoryType.TASK == eventCategoryTO.getType()
-                    && "SyncJobDelegate".equals(eventCategoryTO.getCategory())) {
-                found = true;
-            }
-        }
-        assertTrue(found);
-    }
-
-    @Test
-    public void issueSYNCOPE708() {
-        try {
-            loggerService.read(LoggerType.LOG, "notExists");
-            fail("Reading non-existing logger, it should go in exception");
-        } catch (final WebServiceException ex) {
-            fail("Exception is WebServiceException but it should be SyncopeClientException");
-        } catch (final SyncopeClientException ex) {
-            assertEquals(Response.Status.NOT_FOUND, ex.getType().getResponseStatus());
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/17d5d892/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/MultitenancyITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/MultitenancyITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/MultitenancyITCase.java
deleted file mode 100644
index 8458181..0000000
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/MultitenancyITCase.java
+++ /dev/null
@@ -1,222 +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.fit.core.reference;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
-
-import java.security.AccessControlException;
-import java.util.List;
-import java.util.Locale;
-import javax.ws.rs.core.GenericType;
-import javax.ws.rs.core.Response;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.client.lib.SyncopeClient;
-import org.apache.syncope.client.lib.SyncopeClientFactoryBean;
-import org.apache.syncope.common.lib.SyncopeConstants;
-import org.apache.syncope.common.lib.to.ConnInstanceTO;
-import org.apache.syncope.common.lib.to.MappingItemTO;
-import org.apache.syncope.common.lib.to.MappingTO;
-import org.apache.syncope.common.lib.to.PagedResult;
-import org.apache.syncope.common.lib.to.ProvisionTO;
-import org.apache.syncope.common.lib.to.ProvisioningResult;
-import org.apache.syncope.common.lib.to.RealmTO;
-import org.apache.syncope.common.lib.to.ResourceTO;
-import org.apache.syncope.common.lib.to.SyncTaskTO;
-import org.apache.syncope.common.lib.to.TaskExecTO;
-import org.apache.syncope.common.lib.to.UserTO;
-import org.apache.syncope.common.lib.types.AnyTypeKind;
-import org.apache.syncope.common.lib.types.IntMappingType;
-import org.apache.syncope.common.lib.types.LoggerType;
-import org.apache.syncope.common.lib.types.MappingPurpose;
-import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
-import org.apache.syncope.common.lib.types.SchemaType;
-import org.apache.syncope.common.lib.types.SyncMode;
-import org.apache.syncope.common.rest.api.beans.AnySearchQuery;
-import org.apache.syncope.common.rest.api.beans.SchemaQuery;
-import org.apache.syncope.common.rest.api.service.ConnectorService;
-import org.apache.syncope.common.rest.api.service.DomainService;
-import org.apache.syncope.common.rest.api.service.LoggerService;
-import org.apache.syncope.common.rest.api.service.RealmService;
-import org.apache.syncope.common.rest.api.service.ResourceService;
-import org.apache.syncope.common.rest.api.service.SchemaService;
-import org.apache.syncope.common.rest.api.service.TaskService;
-import org.apache.syncope.common.rest.api.service.UserService;
-import org.identityconnectors.framework.common.objects.ObjectClass;
-import org.junit.BeforeClass;
-import org.junit.FixMethodOrder;
-import org.junit.Test;
-import org.junit.runners.MethodSorters;
-
-@FixMethodOrder(MethodSorters.JVM)
-public class MultitenancyITCase extends AbstractITCase {
-
-    @BeforeClass
-    public static void restSetup() {
-        clientFactory = new SyncopeClientFactoryBean().setAddress(ADDRESS).setDomain("Two");
-
-        String envContentType = System.getProperty(ENV_KEY_CONTENT_TYPE);
-        if (StringUtils.isNotBlank(envContentType)) {
-            clientFactory.setContentType(envContentType);
-        }
-        LOG.info("Performing IT with content type {}", clientFactory.getContentType().getMediaType());
-
-        adminClient = clientFactory.create(ADMIN_UNAME, "password2");
-    }
-
-    @Test
-    public void masterOnly() {
-        try {
-            adminClient.getService(DomainService.class).read("Two");
-            fail();
-        } catch (AccessControlException e) {
-            assertNotNull(e);
-        }
-
-        try {
-            adminClient.getService(LoggerService.class).list(LoggerType.LOG);
-            fail();
-        } catch (AccessControlException e) {
-            assertNotNull(e);
-        }
-
-        adminClient.getService(LoggerService.class).list(LoggerType.AUDIT);
-    }
-
-    @Test
-    public void readPlainSchemas() {
-        assertEquals(17, adminClient.getService(SchemaService.class).
-                list(new SchemaQuery.Builder().type(SchemaType.PLAIN).build()).size());
-    }
-
-    @Test
-    public void readRealm() {
-        List<RealmTO> realms = adminClient.getService(RealmService.class).list();
-        assertEquals(1, realms.size());
-        assertEquals(SyncopeConstants.ROOT_REALM, realms.get(0).getName());
-    }
-
-    @Test
-    public void createUser() {
-        assertNull(adminClient.getService(RealmService.class).list().get(0).getPasswordPolicy());
-
-        UserTO user = new UserTO();
-        user.setRealm(SyncopeConstants.ROOT_REALM);
-        user.setUsername(getUUIDString());
-        user.setPassword("password");
-
-        Response response = adminClient.getService(UserService.class).create(user);
-        assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus());
-
-        user = response.readEntity(new GenericType<ProvisioningResult<UserTO>>() {
-        }).getAny();
-        assertNotNull(user);
-    }
-
-    @Test
-    public void createResourceAndSync() {
-        // read connector
-        ConnInstanceTO conn = adminClient.getService(ConnectorService.class).read(100L, Locale.ENGLISH.getLanguage());
-        assertNotNull(conn);
-        assertEquals("LDAP", conn.getDisplayName());
-
-        // prepare resource
-        ResourceTO resource = new ResourceTO();
-        resource.setKey("new-ldap-resource");
-        resource.setConnector(conn.getKey());
-
-        ProvisionTO provisionTO = new ProvisionTO();
-        provisionTO.setAnyType(AnyTypeKind.USER.name());
-        provisionTO.setObjectClass(ObjectClass.ACCOUNT_NAME);
-        resource.getProvisions().add(provisionTO);
-
-        MappingTO mapping = new MappingTO();
-        mapping.setConnObjectLink("'uid=' + username + ',ou=people,o=isp'");
-        provisionTO.setMapping(mapping);
-
-        MappingItemTO item = new MappingItemTO();
-        item.setIntAttrName("username");
-        item.setIntMappingType(IntMappingType.Username);
-        item.setExtAttrName("cn");
-        item.setPurpose(MappingPurpose.BOTH);
-        mapping.setConnObjectKeyItem(item);
-
-        item = new MappingItemTO();
-        item.setPassword(true);
-        item.setIntMappingType(IntMappingType.Password);
-        item.setExtAttrName("userPassword");
-        item.setPurpose(MappingPurpose.BOTH);
-        item.setMandatoryCondition("true");
-        mapping.add(item);
-
-        item = new MappingItemTO();
-        item.setIntMappingType(IntMappingType.UserKey);
-        item.setPurpose(MappingPurpose.BOTH);
-        item.setExtAttrName("sn");
-        item.setMandatoryCondition("true");
-        mapping.add(item);
-
-        item = new MappingItemTO();
-        item.setIntAttrName("email");
-        item.setIntMappingType(IntMappingType.UserPlainSchema);
-        item.setPurpose(MappingPurpose.BOTH);
-        item.setExtAttrName("mail");
-        mapping.add(item);
-
-        // create resource
-        Response response = adminClient.getService(ResourceService.class).create(resource);
-        assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus());
-        resource = adminClient.getService(ResourceService.class).read(resource.getKey());
-        assertNotNull(resource);
-
-        // create sync task
-        SyncTaskTO task = new SyncTaskTO();
-        task.setName("LDAP Sync Task");
-        task.setActive(true);
-        task.setDestinationRealm(SyncopeConstants.ROOT_REALM);
-        task.setResource(resource.getKey());
-        task.setSyncMode(SyncMode.FULL_RECONCILIATION);
-        task.setPerformCreate(true);
-
-        response = adminClient.getService(TaskService.class).create(task);
-        assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus());
-        task = adminClient.getService(TaskService.class).read(
-                Long.valueOf(StringUtils.substringAfterLast(response.getLocation().toASCIIString(), "/")), true);
-        assertNotNull(resource);
-
-        // synchronize
-        TaskExecTO execution = AbstractTaskITCase.execProvisioningTask(
-                adminClient.getService(TaskService.class), task.getKey(), 50, false);
-
-        // verify execution status
-        String status = execution.getStatus();
-        assertNotNull(status);
-        assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(status));
-
-        // verify that synchronized user is found
-        PagedResult<UserTO> matchingUsers = adminClient.getService(UserService.class).search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
-                fiql(SyncopeClient.getUserSearchConditionBuilder().is("username").equalTo("syncFromLDAP").query()).
-                build());
-        assertNotNull(matchingUsers);
-        assertEquals(1, matchingUsers.getResult().size());
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/17d5d892/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationITCase.java
deleted file mode 100644
index f1c4c89..0000000
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationITCase.java
+++ /dev/null
@@ -1,174 +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.fit.core.reference;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
-import java.util.List;
-import javax.ws.rs.core.Response;
-import org.apache.syncope.client.lib.SyncopeClient;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.NotificationTO;
-import org.apache.syncope.common.lib.types.AnyTypeKind;
-import org.apache.syncope.common.lib.types.ClientExceptionType;
-import org.apache.syncope.common.lib.types.IntMappingType;
-import org.apache.syncope.common.lib.types.TraceLevel;
-import org.apache.syncope.common.rest.api.service.NotificationService;
-import org.junit.FixMethodOrder;
-import org.junit.Test;
-import org.junit.runners.MethodSorters;
-
-@FixMethodOrder(MethodSorters.JVM)
-public class NotificationITCase extends AbstractITCase {
-
-    private NotificationTO buildNotificationTO() {
-        NotificationTO notificationTO = new NotificationTO();
-        notificationTO.setTraceLevel(TraceLevel.SUMMARY);
-        notificationTO.getEvents().add("create");
-
-        notificationTO.getAbouts().put(AnyTypeKind.USER.name(),
-                SyncopeClient.getUserSearchConditionBuilder().
-                is("fullname").equalTo("*o*").and("fullname").equalTo("*i*").query());
-
-        notificationTO.setRecipientAttrName("email");
-        notificationTO.setRecipientAttrType(IntMappingType.UserPlainSchema);
-
-        notificationTO.setSender("syncope@syncope.apache.org");
-        notificationTO.setSubject("Test notification");
-        notificationTO.setTemplate("test");
-        return notificationTO;
-    }
-
-    @Test
-    public void read() {
-        NotificationTO notificationTO = notificationService.read(10L);
-        assertNotNull(notificationTO);
-    }
-
-    @Test
-    public void list() {
-        List<NotificationTO> notificationTOs = notificationService.list();
-        assertNotNull(notificationTOs);
-        assertFalse(notificationTOs.isEmpty());
-        for (NotificationTO instance : notificationTOs) {
-            assertNotNull(instance);
-        }
-    }
-
-    @Test
-    public void create() {
-        NotificationTO notificationTO = buildNotificationTO();
-        notificationTO.setRecipientsFIQL(SyncopeClient.getUserSearchConditionBuilder().inGroups(7L).query());
-
-        Response response = notificationService.create(notificationTO);
-        NotificationTO actual = getObject(response.getLocation(), NotificationService.class, NotificationTO.class);
-
-        assertNotNull(actual);
-        assertNotNull(actual.getKey());
-        notificationTO.setKey(actual.getKey());
-        assertEquals(actual, notificationTO);
-    }
-
-    @Test
-    public void update() {
-        NotificationTO notificationTO = notificationService.read(10L);
-        notificationTO.setRecipientsFIQL(SyncopeClient.getUserSearchConditionBuilder().inGroups(7L).query());
-
-        notificationService.update(notificationTO);
-        NotificationTO actual = notificationService.read(notificationTO.getKey());
-        assertNotNull(actual);
-        assertEquals(actual, notificationTO);
-    }
-
-    @Test
-    public void delete() {
-        NotificationTO notification = buildNotificationTO();
-        notification.setSelfAsRecipient(true);
-        Response response = notificationService.create(notification);
-        notification = getObject(response.getLocation(), NotificationService.class, NotificationTO.class);
-
-        notificationService.delete(notification.getKey());
-
-        try {
-            notificationService.read(notification.getKey());
-            fail();
-        } catch (SyncopeClientException e) {
-            assertEquals(ClientExceptionType.NotFound, e.getType());
-        }
-    }
-
-    @Test
-    public void issueSYNCOPE83() {
-        NotificationTO notificationTO = buildNotificationTO();
-        notificationTO.setSelfAsRecipient(true);
-
-        NotificationTO actual = null;
-        try {
-            Response response = notificationService.create(notificationTO);
-            actual = getObject(response.getLocation(), NotificationService.class, NotificationTO.class);
-        } catch (SyncopeClientException e) {
-            assertNotNull(e);
-        }
-        assertNotNull(actual);
-        assertNotNull(actual.getKey());
-        notificationTO.setKey(actual.getKey());
-        assertEquals(actual, notificationTO);
-    }
-
-    @Test
-    public void issueSYNCOPE445() {
-        NotificationTO notificationTO = buildNotificationTO();
-        notificationTO.getStaticRecipients().add("syncope445@syncope.apache.org");
-
-        NotificationTO actual = null;
-        try {
-            Response response = notificationService.create(notificationTO);
-            actual = getObject(response.getLocation(), NotificationService.class, NotificationTO.class);
-        } catch (SyncopeClientException e) {
-            assertNotNull(e);
-        }
-        assertNotNull(actual);
-        assertNotNull(actual.getKey());
-        notificationTO.setKey(actual.getKey());
-        assertEquals(actual, notificationTO);
-    }
-
-    @Test
-    public void issueSYNCOPE446() {
-        NotificationTO notificationTO = buildNotificationTO();
-        notificationTO.getStaticRecipients().add("syncope446@syncope.apache.org");
-        notificationTO.getAbouts().put(AnyTypeKind.GROUP.name(),
-                SyncopeClient.getGroupSearchConditionBuilder().is("name").equalTo("citizen").query());
-
-        NotificationTO actual = null;
-        try {
-            Response response = notificationService.create(notificationTO);
-            actual = getObject(response.getLocation(), NotificationService.class, NotificationTO.class);
-        } catch (SyncopeClientException e) {
-            assertNotNull(e);
-        }
-        assertNotNull(actual);
-        assertNotNull(actual.getKey());
-        notificationTO.setKey(actual.getKey());
-        assertEquals(actual, notificationTO);
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/17d5d892/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationTaskITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationTaskITCase.java
deleted file mode 100644
index 43de365..0000000
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationTaskITCase.java
+++ /dev/null
@@ -1,398 +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.fit.core.reference;
-
-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 com.icegreen.greenmail.util.GreenMail;
-import com.icegreen.greenmail.util.ServerSetup;
-import java.io.InputStream;
-import java.util.Properties;
-import javax.mail.Flags;
-import javax.mail.Folder;
-import javax.mail.Message;
-import javax.mail.Session;
-import javax.mail.Store;
-import javax.ws.rs.core.Response;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.client.lib.SyncopeClient;
-import org.apache.syncope.common.lib.to.AttrTO;
-import org.apache.syncope.common.lib.to.GroupTO;
-import org.apache.syncope.common.lib.to.MembershipTO;
-import org.apache.syncope.common.lib.to.NotificationTO;
-import org.apache.syncope.common.lib.to.NotificationTaskTO;
-import org.apache.syncope.common.lib.to.TaskExecTO;
-import org.apache.syncope.common.lib.to.UserTO;
-import org.apache.syncope.common.lib.types.AnyTypeKind;
-import org.apache.syncope.common.lib.types.IntMappingType;
-import org.apache.syncope.common.lib.types.TraceLevel;
-import org.apache.syncope.common.rest.api.beans.ExecuteQuery;
-import org.apache.syncope.common.rest.api.service.NotificationService;
-import org.apache.syncope.core.logic.notification.NotificationJob;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.FixMethodOrder;
-import org.junit.Test;
-import org.junit.runners.MethodSorters;
-
-@FixMethodOrder(MethodSorters.JVM)
-public class NotificationTaskITCase extends AbstractTaskITCase {
-
-    private static final String MAIL_ADDRESS = "notificationtest@syncope.apache.org";
-
-    private static final String POP3_HOST = "localhost";
-
-    private static final int POP3_PORT = 1110;
-
-    private static String SMTP_HOST;
-
-    private static int SMTP_PORT;
-
-    private static GreenMail greenMail;
-
-    @BeforeClass
-    public static void startGreenMail() {
-        Properties props = new Properties();
-        InputStream propStream = null;
-        try {
-            propStream = ExceptionMapperITCase.class.getResourceAsStream("/mail.properties");
-            props.load(propStream);
-        } catch (Exception e) {
-            LOG.error("Could not load /mail.properties", e);
-        } finally {
-            IOUtils.closeQuietly(propStream);
-        }
-
-        SMTP_HOST = props.getProperty("smtpHost");
-        assertNotNull(SMTP_HOST);
-        SMTP_PORT = Integer.parseInt(props.getProperty("smtpPort"));
-        assertNotNull(SMTP_PORT);
-
-        ServerSetup[] config = new ServerSetup[2];
-        config[0] = new ServerSetup(SMTP_PORT, SMTP_HOST, ServerSetup.PROTOCOL_SMTP);
-        config[1] = new ServerSetup(POP3_PORT, POP3_HOST, ServerSetup.PROTOCOL_POP3);
-        greenMail = new GreenMail(config);
-        greenMail.start();
-    }
-
-    @AfterClass
-    public static void stopGreenMail() {
-        if (greenMail != null) {
-            greenMail.stop();
-        }
-    }
-
-    private boolean verifyMail(final String sender, final String subject, final String mailAddress) throws Exception {
-        LOG.info("Waiting for notification to be sent...");
-        greenMail.waitForIncomingEmail(1);
-
-        boolean found = false;
-        Session session = Session.getDefaultInstance(System.getProperties());
-        session.setDebug(true);
-        Store store = session.getStore("pop3");
-        store.connect(POP3_HOST, POP3_PORT, mailAddress, mailAddress);
-
-        Folder inbox = store.getFolder("INBOX");
-        assertNotNull(inbox);
-        inbox.open(Folder.READ_WRITE);
-
-        Message[] messages = inbox.getMessages();
-        for (Message message : messages) {
-            if (sender.equals(message.getFrom()[0].toString()) && subject.equals(message.getSubject())) {
-                found = true;
-                message.setFlag(Flags.Flag.DELETED, true);
-            }
-        }
-
-        inbox.close(true);
-        store.close();
-        return found;
-    }
-
-    @Test
-    public void notifyByMail() throws Exception {
-        String sender = "syncopetest-" + getUUIDString() + "@syncope.apache.org";
-        String subject = "Test notification " + getUUIDString();
-        String recipient = createNotificationTask(true, true, TraceLevel.ALL, sender, subject);
-        NotificationTaskTO taskTO = findNotificationTaskBySender(sender);
-        assertNotNull(taskTO);
-        assertTrue(taskTO.getExecutions().isEmpty());
-
-        execNotificationTask(taskService, taskTO.getKey(), 50);
-
-        assertTrue(verifyMail(sender, subject, recipient));
-
-        // verify message body
-        taskTO = taskService.read(taskTO.getKey(), true);
-        assertNotNull(taskTO);
-        assertTrue(taskTO.isExecuted());
-        assertNotNull(taskTO.getTextBody());
-        assertTrue("Notification mail text doesn't contain expected content.",
-                taskTO.getTextBody().contains("Your email address is " + recipient + "."));
-        assertTrue("Notification mail text doesn't contain expected content.",
-                taskTO.getTextBody().contains("Your email address inside a link: "
-                        + "http://localhost/?email=" + recipient.replaceAll("@", "%40") + " ."));
-    }
-
-    @Test
-    public void notifyByMailEmptyAbout() throws Exception {
-        String sender = "syncopetest-" + getUUIDString() + "@syncope.apache.org";
-        String subject = "Test notification " + getUUIDString();
-        String recipient = createNotificationTask(true, false, TraceLevel.ALL, sender, subject);
-        NotificationTaskTO taskTO = findNotificationTaskBySender(sender);
-        assertNotNull(taskTO);
-        assertTrue(taskTO.getExecutions().isEmpty());
-
-        execNotificationTask(taskService, taskTO.getKey(), 50);
-
-        assertTrue(verifyMail(sender, subject, recipient));
-    }
-
-    @Test
-    public void notifyByMailWithRetry() throws Exception {
-        // 1. Set higher number of retries
-        AttrTO origMaxRetries = configurationService.get("notification.maxRetries");
-
-        configurationService.set(attrTO(origMaxRetries.getSchema(), "10"));
-
-        // 2. Stop mail server to force errors while sending out e-mails
-        stopGreenMail();
-
-        try {
-            // 3. create notification and user
-            String sender = "syncopetest-" + getUUIDString() + "@syncope.apache.org";
-            String subject = "Test notification " + getUUIDString();
-            createNotificationTask(true, true, TraceLevel.ALL, sender, subject);
-            NotificationTaskTO taskTO = findNotificationTaskBySender(sender);
-            assertNotNull(taskTO);
-            assertTrue(taskTO.getExecutions().isEmpty());
-
-            // 4. verify notification could not be delivered
-            execTask(taskService, taskTO.getKey(), NotificationJob.Status.NOT_SENT.name(), 5, false);
-
-            taskTO = taskService.read(taskTO.getKey(), true);
-            assertNotNull(taskTO);
-            assertFalse(taskTO.isExecuted());
-            assertFalse(taskTO.getExecutions().isEmpty());
-            for (TaskExecTO exec : taskTO.getExecutions()) {
-                assertEquals(NotificationJob.Status.NOT_SENT.name(), exec.getStatus());
-            }
-        } finally {
-            // start mail server again
-            startGreenMail();
-            // reset number of retries
-            configurationService.set(origMaxRetries);
-        }
-    }
-
-    @Test
-    public void issueSYNCOPE81() {
-        String sender = "syncope81@syncope.apache.org";
-        createNotificationTask(true, true, TraceLevel.ALL, sender, "Test notification");
-        NotificationTaskTO taskTO = findNotificationTaskBySender(sender);
-        assertNotNull(taskTO);
-        assertTrue(taskTO.getExecutions().isEmpty());
-
-        // generate an execution in order to verify the deletion of a notification task with one or more executions
-        execNotificationTask(taskService, taskTO.getKey(), 50);
-
-        taskTO = taskService.read(taskTO.getKey(), true);
-        assertTrue(taskTO.isExecuted());
-        assertFalse(taskTO.getExecutions().isEmpty());
-
-        taskService.delete(taskTO.getKey());
-    }
-
-    @Test
-    public void issueSYNCOPE86() {
-        // 1. create notification task
-        String sender = "syncope86@syncope.apache.org";
-        createNotificationTask(true, true, TraceLevel.ALL, sender, "Test notification");
-
-        // 2. get NotificationTaskTO for user just created
-        NotificationTaskTO taskTO = findNotificationTaskBySender(sender);
-        assertNotNull(taskTO);
-        assertTrue(taskTO.getExecutions().isEmpty());
-
-        try {
-            // 3. execute the generated NotificationTask
-            execNotificationTask(taskService, taskTO.getKey(), 50);
-
-            // 4. verify
-            taskTO = taskService.read(taskTO.getKey(), true);
-            assertNotNull(taskTO);
-            assertTrue(taskTO.isExecuted());
-            assertEquals(1, taskTO.getExecutions().size());
-        } finally {
-            // Remove execution to make test re-runnable
-            taskService.deleteExecution(taskTO.getExecutions().get(0).getKey());
-        }
-    }
-
-    @Test
-    public void issueSYNCOPE192() throws Exception {
-        String sender = "syncopetest-" + getUUIDString() + "@syncope.apache.org";
-        String subject = "Test notification " + getUUIDString();
-        String recipient = createNotificationTask(true, true, TraceLevel.NONE, sender, subject);
-        NotificationTaskTO taskTO = findNotificationTaskBySender(sender);
-        assertNotNull(taskTO);
-        assertTrue(taskTO.getExecutions().isEmpty());
-
-        taskService.execute(new ExecuteQuery.Builder().key(taskTO.getKey()).build());
-
-        try {
-            Thread.sleep(5);
-        } catch (InterruptedException e) {
-        }
-
-        assertTrue(verifyMail(sender, subject, recipient));
-
-        // verify that last exec status was updated
-        taskTO = taskService.read(taskTO.getKey(), true);
-        assertNotNull(taskTO);
-        assertTrue(taskTO.isExecuted());
-        assertTrue(taskTO.getExecutions().isEmpty());
-        assertTrue(StringUtils.isNotBlank(taskTO.getLatestExecStatus()));
-    }
-
-    @Test
-    public void issueSYNCOPE445() throws Exception {
-        String sender = "syncopetest-" + getUUIDString() + "@syncope.apache.org";
-        String subject = "Test notification " + getUUIDString();
-        String recipient = createNotificationTask(
-                true, true, TraceLevel.ALL, sender, subject, "syncope445@syncope.apache.org");
-        NotificationTaskTO taskTO = findNotificationTaskBySender(sender);
-        assertNotNull(taskTO);
-        assertTrue(taskTO.getExecutions().isEmpty());
-
-        execNotificationTask(taskService, taskTO.getKey(), 50);
-
-        assertTrue(verifyMail(sender, subject, recipient));
-
-        // verify task
-        taskTO = taskService.read(taskTO.getKey(), true);
-        assertTrue(taskTO.isExecuted());
-        assertNotNull(taskTO);
-        assertTrue(taskTO.getRecipients().contains("syncope445@syncope.apache.org"));
-    }
-
-    @Test
-    public void issueSYNCOPE446() throws Exception {
-        // 1. Create notification
-        NotificationTO notification = new NotificationTO();
-        notification.setTraceLevel(TraceLevel.ALL);
-        notification.getEvents().add("[REST]:[GroupLogic]:[]:[create]:[SUCCESS]");
-
-        String groupName = "group" + getUUIDString();
-        notification.getAbouts().put(AnyTypeKind.GROUP.name(),
-                SyncopeClient.getGroupSearchConditionBuilder().is("name").equalTo(groupName).query());
-
-        notification.setRecipientsFIQL(SyncopeClient.getUserSearchConditionBuilder().inGroups(8L).query());
-        notification.setSelfAsRecipient(false);
-        notification.setRecipientAttrName("email");
-        notification.setRecipientAttrType(IntMappingType.UserPlainSchema);
-        notification.getStaticRecipients().add(MAIL_ADDRESS);
-        notification.setRecipientsProviderClassName(TestNotificationRecipientsProvider.class.getName());
-
-        String sender = "syncopetest-" + getUUIDString() + "@syncope.apache.org";
-        notification.setSender(sender);
-        String subject = "Test notification " + getUUIDString();
-        notification.setSubject(subject);
-        notification.setTemplate("optin");
-        notification.setActive(true);
-
-        Response response = notificationService.create(notification);
-        notification = getObject(response.getLocation(), NotificationService.class, NotificationTO.class);
-        assertNotNull(notification);
-        assertEquals(TestNotificationRecipientsProvider.class.getName(), notification.getRecipientsProviderClassName());
-
-        // 2. create group
-        GroupTO groupTO = new GroupTO();
-        groupTO.setName(groupName);
-        groupTO.setRealm("/even/two");
-        groupTO = createGroup(groupTO).getAny();
-        assertNotNull(groupTO);
-
-        // 3. verify
-        NotificationTaskTO taskTO = findNotificationTaskBySender(sender);
-        assertNotNull(taskTO);
-        assertTrue(taskTO.getRecipients().containsAll(
-                new TestNotificationRecipientsProvider().provideRecipients(null)));
-
-        execNotificationTask(taskService, taskTO.getKey(), 50);
-
-        assertTrue(verifyMail(sender, subject, MAIL_ADDRESS));
-    }
-
-    @Test
-    public void issueSYNCOPE492() throws Exception {
-        String sender = "syncopetest-" + getUUIDString() + "@syncope.apache.org";
-        String subject = "Test notification " + getUUIDString();
-        createNotificationTask(false, true, TraceLevel.NONE, sender, subject, "syncope445@syncope.apache.org");
-
-        // verify that no task was created for disabled notification
-        assertNull(findNotificationTaskBySender(sender));
-    }
-
-    private String createNotificationTask(final boolean active, final boolean includeAbout, final TraceLevel traceLevel,
-            final String sender, final String subject, final String... staticRecipients) {
-
-        // 1. Create notification
-        NotificationTO notification = new NotificationTO();
-        notification.setTraceLevel(traceLevel);
-        notification.getEvents().add("[REST]:[UserLogic]:[]:[create]:[SUCCESS]");
-
-        if (includeAbout) {
-            notification.getAbouts().put(AnyTypeKind.USER.name(),
-                    SyncopeClient.getUserSearchConditionBuilder().inGroups(7L).query());
-        }
-
-        notification.setRecipientsFIQL(SyncopeClient.getUserSearchConditionBuilder().inGroups(8L).query());
-        notification.setSelfAsRecipient(true);
-        notification.setRecipientAttrName("email");
-        notification.setRecipientAttrType(IntMappingType.UserPlainSchema);
-        if (staticRecipients != null) {
-            CollectionUtils.addAll(notification.getStaticRecipients(), staticRecipients);
-        }
-
-        notification.setSender(sender);
-        notification.setSubject(subject);
-        notification.setTemplate("optin");
-        notification.setActive(active);
-
-        Response response = notificationService.create(notification);
-        notification = getObject(response.getLocation(), NotificationService.class, NotificationTO.class);
-        assertNotNull(notification);
-
-        // 2. create user
-        UserTO userTO = UserITCase.getUniqueSampleTO(MAIL_ADDRESS);
-        userTO.getMemberships().add(new MembershipTO.Builder().group(7L).build());
-
-        userTO = createUser(userTO).getAny();
-        assertNotNull(userTO);
-        return userTO.getUsername();
-    }
-
-}