syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [12/52] syncope git commit: [SYNCOPE-620] Console (JAR) in, now time for console-reference
Date Thu, 05 Feb 2015 16:00:43 GMT
http://git-wip-us.apache.org/repos/asf/syncope/blob/32707b3b/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/ResourceITCase.java
----------------------------------------------------------------------
diff --git a/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/ResourceITCase.java b/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/ResourceITCase.java
deleted file mode 100644
index 4b701c4..0000000
--- a/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/ResourceITCase.java
+++ /dev/null
@@ -1,578 +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.server.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.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import javax.ws.rs.core.Response;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.BulkAction;
-import org.apache.syncope.common.lib.to.MappingItemTO;
-import org.apache.syncope.common.lib.to.MappingTO;
-import org.apache.syncope.common.lib.to.ResourceTO;
-import org.apache.syncope.common.lib.types.ClientExceptionType;
-import org.apache.syncope.common.lib.types.ConnConfPropSchema;
-import org.apache.syncope.common.lib.types.ConnConfProperty;
-import org.apache.syncope.common.lib.types.EntityViolationType;
-import org.apache.syncope.common.lib.types.IntMappingType;
-import org.apache.syncope.common.lib.types.MappingPurpose;
-import org.apache.syncope.common.rest.api.service.ResourceService;
-import org.junit.FixMethodOrder;
-import org.junit.Test;
-import org.junit.runners.MethodSorters;
-
-@FixMethodOrder(MethodSorters.JVM)
-public class ResourceITCase extends AbstractITCase {
-
-    private ResourceTO buildResourceTO(final String resourceName) {
-        ResourceTO resourceTO = new ResourceTO();
-
-        resourceTO.setKey(resourceName);
-        resourceTO.setConnectorId(102L);
-
-        MappingTO mapping = new MappingTO();
-
-        MappingItemTO item = new MappingItemTO();
-        item.setExtAttrName("userId");
-        item.setIntAttrName("userId");
-        item.setIntMappingType(IntMappingType.UserPlainSchema);
-        item.setPurpose(MappingPurpose.BOTH);
-        mapping.addItem(item);
-
-        item = new MappingItemTO();
-        item.setExtAttrName("username");
-        item.setIntAttrName("fullname");
-        item.setIntMappingType(IntMappingType.UserId);
-        item.setPurpose(MappingPurpose.BOTH);
-        mapping.setAccountIdItem(item);
-
-        item = new MappingItemTO();
-        item.setExtAttrName("fullname");
-        item.setIntAttrName("cn");
-        item.setIntMappingType(IntMappingType.UserPlainSchema);
-        item.setAccountid(false);
-        item.setPurpose(MappingPurpose.BOTH);
-        mapping.addItem(item);
-
-        resourceTO.setUmapping(mapping);
-        return resourceTO;
-    }
-
-    @Test
-    public void getPropagationActionsClasses() {
-        List<String> actions = syncopeService.info().getPropagationActions();
-        assertNotNull(actions);
-        assertFalse(actions.isEmpty());
-    }
-
-    @Test
-    public void create() {
-        String resourceName = RESOURCE_NAME_CREATE;
-        ResourceTO resourceTO = buildResourceTO(resourceName);
-
-        Response response = resourceService.create(resourceTO);
-        ResourceTO actual = getObject(response.getLocation(), ResourceService.class, ResourceTO.class);
-        assertNotNull(actual);
-
-        // check for existence
-        actual = resourceService.read(resourceName);
-        assertNotNull(actual);
-    }
-
-    @Test
-    public void createOverridingProps() {
-        String resourceName = "overriding-conn-conf-target-resource-create";
-        ResourceTO resourceTO = new ResourceTO();
-
-        MappingTO mapping = new MappingTO();
-
-        MappingItemTO item = new MappingItemTO();
-        item.setExtAttrName("uid");
-        item.setIntAttrName("userId");
-        item.setIntMappingType(IntMappingType.UserPlainSchema);
-        item.setPurpose(MappingPurpose.BOTH);
-        mapping.addItem(item);
-
-        item = new MappingItemTO();
-        item.setExtAttrName("username");
-        item.setIntAttrName("fullname");
-        item.setIntMappingType(IntMappingType.UserId);
-        item.setAccountid(true);
-        item.setPurpose(MappingPurpose.BOTH);
-        mapping.setAccountIdItem(item);
-
-        item = new MappingItemTO();
-        item.setExtAttrName("fullname");
-        item.setIntAttrName("cn");
-        item.setIntMappingType(IntMappingType.UserPlainSchema);
-        item.setAccountid(false);
-        item.setPurpose(MappingPurpose.BOTH);
-        mapping.addItem(item);
-
-        resourceTO.setKey(resourceName);
-        resourceTO.setConnectorId(102L);
-
-        resourceTO.setUmapping(mapping);
-
-        ConnConfProperty p = new ConnConfProperty();
-        ConnConfPropSchema schema = new ConnConfPropSchema();
-        schema.setType("java.lang.String");
-        schema.setName("endpoint");
-        schema.setRequired(true);
-        p.setSchema(schema);
-        p.getValues().add("http://invalidurl/");
-
-        Set<ConnConfProperty> connectorConfigurationProperties = new HashSet<ConnConfProperty>(Arrays.asList(p));
-        resourceTO.getConnConfProperties().addAll(connectorConfigurationProperties);
-
-        Response response = resourceService.create(resourceTO);
-        ResourceTO actual = getObject(response.getLocation(), ResourceService.class, ResourceTO.class);
-        assertNotNull(actual);
-
-        // check the existence
-        actual = resourceService.read(resourceName);
-        assertNotNull(actual);
-    }
-
-    @Test
-    public void createWithSingleMappingItem() {
-        String resourceName = RESOURCE_NAME_CREATE_SINGLE;
-        ResourceTO resourceTO = new ResourceTO();
-        resourceTO.setKey(resourceName);
-        resourceTO.setConnectorId(102L);
-
-        MappingTO umapping = new MappingTO();
-
-        MappingItemTO item = new MappingItemTO();
-        item.setIntMappingType(IntMappingType.UserId);
-        item.setExtAttrName("userId");
-        item.setAccountid(true);
-        item.setPurpose(MappingPurpose.PROPAGATION);
-        umapping.setAccountIdItem(item);
-
-        resourceTO.setUmapping(umapping);
-
-        MappingTO rmapping = new MappingTO();
-
-        item = new MappingItemTO();
-        item.setIntMappingType(IntMappingType.RoleId);
-        item.setExtAttrName("roleId");
-        item.setAccountid(true);
-        item.setPurpose(MappingPurpose.SYNCHRONIZATION);
-        rmapping.setAccountIdItem(item);
-
-        resourceTO.setRmapping(rmapping);
-
-        Response response = resourceService.create(resourceTO);
-        ResourceTO actual = getObject(response.getLocation(), ResourceService.class, ResourceTO.class);
-
-        assertNotNull(actual);
-        assertNotNull(actual.getUmapping());
-        assertNotNull(actual.getUmapping().getItems());
-        assertNotNull(actual.getRmapping());
-        assertNotNull(actual.getRmapping().getItems());
-        assertEquals(MappingPurpose.SYNCHRONIZATION, actual.getRmapping().getAccountIdItem().getPurpose());
-        assertEquals(MappingPurpose.PROPAGATION, actual.getUmapping().getAccountIdItem().getPurpose());
-    }
-
-    @Test
-    public void createWithInvalidMapping() {
-        String resourceName = RESOURCE_NAME_CREATE_WRONG;
-        ResourceTO resourceTO = new ResourceTO();
-        resourceTO.setKey(resourceName);
-        resourceTO.setConnectorId(102L);
-
-        MappingTO mapping = new MappingTO();
-
-        MappingItemTO item = new MappingItemTO();
-        item.setIntMappingType(IntMappingType.UserId);
-        item.setExtAttrName("userId");
-        item.setAccountid(true);
-        mapping.setAccountIdItem(item);
-
-        item = new MappingItemTO();
-        item.setIntMappingType(IntMappingType.UserPlainSchema);
-        item.setExtAttrName("email");
-        // missing intAttrName ...
-        mapping.addItem(item);
-
-        resourceTO.setUmapping(mapping);
-
-        try {
-            createResource(resourceTO);
-            fail("Create should not have worked");
-        } catch (SyncopeClientException e) {
-            assertEquals(ClientExceptionType.RequiredValuesMissing, e.getType());
-            assertEquals("intAttrName", e.getElements().iterator().next());
-        }
-    }
-
-    @Test(expected = SyncopeClientException.class)
-    public void createWithoutExtAttr() {
-        String resourceName = RESOURCE_NAME_CREATE_WRONG;
-        ResourceTO resourceTO = new ResourceTO();
-        resourceTO.setKey(resourceName);
-        resourceTO.setConnectorId(102L);
-
-        MappingTO mapping = new MappingTO();
-
-        MappingItemTO item = new MappingItemTO();
-        item.setIntMappingType(IntMappingType.UserId);
-        item.setExtAttrName("userId");
-        item.setAccountid(true);
-        mapping.setAccountIdItem(item);
-
-        item = new MappingItemTO();
-        item.setIntMappingType(IntMappingType.UserPlainSchema);
-        item.setIntAttrName("usernane");
-        // missing extAttrName ...
-        mapping.addItem(item);
-
-        resourceTO.setUmapping(mapping);
-
-        createResource(resourceTO);
-    }
-
-    @Test
-    public void createWithPasswordPolicy() {
-        String resourceName = "res-with-password-policy";
-        ResourceTO resourceTO = new ResourceTO();
-        resourceTO.setKey(resourceName);
-        resourceTO.setConnectorId(102L);
-        resourceTO.setPasswordPolicy(4L);
-
-        MappingTO mapping = new MappingTO();
-
-        MappingItemTO item = new MappingItemTO();
-        item.setExtAttrName("userId");
-        item.setIntAttrName("userId");
-        item.setIntMappingType(IntMappingType.UserPlainSchema);
-        item.setAccountid(true);
-        item.setPurpose(MappingPurpose.BOTH);
-        mapping.setAccountIdItem(item);
-
-        resourceTO.setUmapping(mapping);
-
-        Response response = resourceService.create(resourceTO);
-        ResourceTO actual = getObject(response.getLocation(), ResourceService.class, ResourceTO.class);
-        assertNotNull(actual);
-
-        // check the existence
-        actual = resourceService.read(resourceName);
-        assertNotNull(actual);
-        assertNotNull(actual.getPasswordPolicy());
-        assertEquals(4L, (long) actual.getPasswordPolicy());
-    }
-
-    @Test
-    public void updateWithException() {
-        try {
-            ResourceTO resourceTO = new ResourceTO();
-            resourceTO.setKey("resourcenotfound");
-
-            resourceService.update(resourceTO.getKey(), resourceTO);
-        } catch (SyncopeClientException e) {
-            assertEquals(Response.Status.NOT_FOUND, e.getType().getResponseStatus());
-        }
-    }
-
-    @Test
-    public void update() {
-        String resourceName = RESOURCE_NAME_UPDATE;
-        ResourceTO resourceTO = new ResourceTO();
-        resourceTO.setKey(resourceName);
-        resourceTO.setConnectorId(101L);
-
-        MappingTO mapping = new MappingTO();
-
-        // Update with an existing and already assigned mapping
-        MappingItemTO item = new MappingItemTO();
-        item.setKey(112L);
-        item.setExtAttrName("test3");
-        item.setIntAttrName("fullname");
-        item.setIntMappingType(IntMappingType.UserPlainSchema);
-        item.setPurpose(MappingPurpose.BOTH);
-        mapping.addItem(item);
-
-        // Update defining new mappings
-        for (int i = 4; i < 6; i++) {
-            item = new MappingItemTO();
-            item.setExtAttrName("test" + i);
-            item.setIntAttrName("fullname");
-            item.setIntMappingType(IntMappingType.UserPlainSchema);
-            item.setPurpose(MappingPurpose.BOTH);
-            mapping.addItem(item);
-        }
-        item = new MappingItemTO();
-        item.setExtAttrName("username");
-        item.setIntAttrName("fullname");
-        item.setIntMappingType(IntMappingType.UserId);
-        item.setAccountid(true);
-        item.setPurpose(MappingPurpose.BOTH);
-        mapping.setAccountIdItem(item);
-
-        resourceTO.setUmapping(mapping);
-
-        resourceService.update(resourceTO.getKey(), resourceTO);
-        ResourceTO actual = resourceService.read(resourceTO.getKey());
-        assertNotNull(actual);
-
-        // check for existence
-        Collection<MappingItemTO> mapItems = actual.getUmapping().getItems();
-        assertNotNull(mapItems);
-        assertEquals(4, mapItems.size());
-    }
-
-    @Test
-    public void deleteWithException() {
-        try {
-            resourceService.delete("resourcenotfound");
-        } catch (SyncopeClientException e) {
-            assertEquals(Response.Status.NOT_FOUND, e.getType().getResponseStatus());
-        }
-    }
-
-    @Test
-    public void updateResetSyncToken() {
-        // create resource with sync token
-        String resourceName = RESOURCE_NAME_RESETSYNCTOKEN + getUUIDString();
-        ResourceTO pre = buildResourceTO(resourceName);
-        pre.setUsyncToken("test");
-        resourceService.create(pre);
-
-        pre.setUsyncToken(null);
-        resourceService.update(pre.getKey(), pre);
-        ResourceTO actual = resourceService.read(pre.getKey());
-        // check that the synctoken has been reset
-        assertNull(actual.getUsyncToken());
-    }
-
-    @Test
-    public void delete() {
-        String resourceName = "tobedeleted";
-
-        ResourceTO resource = buildResourceTO(resourceName);
-        Response response = resourceService.create(resource);
-        ResourceTO actual = getObject(response.getLocation(), ResourceService.class, ResourceTO.class);
-        assertNotNull(actual);
-
-        resourceService.delete(resourceName);
-
-        try {
-            resourceService.read(resourceName);
-        } catch (SyncopeClientException e) {
-            assertEquals(Response.Status.NOT_FOUND, e.getType().getResponseStatus());
-        }
-    }
-
-    @Test
-    public void list() {
-        List<ResourceTO> actuals = resourceService.list();
-        assertNotNull(actuals);
-        assertFalse(actuals.isEmpty());
-        for (ResourceTO resourceTO : actuals) {
-            assertNotNull(resourceTO);
-        }
-    }
-
-    @Test
-    public void read() {
-        ResourceTO actual = resourceService.read(RESOURCE_NAME_TESTDB);
-        assertNotNull(actual);
-    }
-
-    @Test
-    public void issueSYNCOPE323() {
-        ResourceTO actual = resourceService.read(RESOURCE_NAME_TESTDB);
-        assertNotNull(actual);
-
-        try {
-            createResource(actual);
-            fail();
-        } catch (SyncopeClientException e) {
-            assertEquals(Response.Status.CONFLICT, e.getType().getResponseStatus());
-            assertEquals(ClientExceptionType.EntityExists, e.getType());
-        }
-
-        actual.setKey(null);
-        try {
-            createResource(actual);
-            fail();
-        } catch (SyncopeClientException e) {
-            assertEquals(Response.Status.BAD_REQUEST, e.getType().getResponseStatus());
-            assertEquals(ClientExceptionType.RequiredValuesMissing, e.getType());
-        }
-    }
-
-    @Test
-    public void bulkAction() {
-        resourceService.create(buildResourceTO("forBulk1"));
-        resourceService.create(buildResourceTO("forBulk2"));
-
-        assertNotNull(resourceService.read("forBulk1"));
-        assertNotNull(resourceService.read("forBulk2"));
-
-        final BulkAction bulkAction = new BulkAction();
-        bulkAction.setOperation(BulkAction.Type.DELETE);
-
-        bulkAction.getTargets().add(String.valueOf("forBulk1"));
-        bulkAction.getTargets().add(String.valueOf("forBulk2"));
-
-        resourceService.bulk(bulkAction);
-
-        try {
-            resourceService.read("forBulk1");
-            fail();
-        } catch (SyncopeClientException e) {
-        }
-
-        try {
-            resourceService.read("forBulk2");
-            fail();
-        } catch (SyncopeClientException e) {
-        }
-    }
-
-    @Test
-    public void issueSYNCOPE360() {
-        final String name = "SYNCOPE360-" + getUUIDString();
-        resourceService.create(buildResourceTO(name));
-
-        ResourceTO resource = resourceService.read(name);
-        assertNotNull(resource);
-        assertNotNull(resource.getUmapping());
-
-        resource.setUmapping(new MappingTO());
-        resourceService.update(name, resource);
-
-        resource = resourceService.read(name);
-        assertNotNull(resource);
-        assertNull(resource.getUmapping());
-    }
-
-    @Test
-    public void issueSYNCOPE368() {
-        final String name = "SYNCOPE368-" + getUUIDString();
-
-        ResourceTO resourceTO = new ResourceTO();
-
-        resourceTO.setKey(name);
-        resourceTO.setConnectorId(105L);
-
-        MappingTO mapping = new MappingTO();
-
-        MappingItemTO item = new MappingItemTO();
-        item.setIntMappingType(IntMappingType.RoleName);
-        item.setExtAttrName("cn");
-        item.setPurpose(MappingPurpose.BOTH);
-        mapping.setAccountIdItem(item);
-
-        item = new MappingItemTO();
-        item.setIntMappingType(IntMappingType.RoleOwnerSchema);
-        item.setExtAttrName("owner");
-        item.setPurpose(MappingPurpose.BOTH);
-        mapping.addItem(item);
-
-        resourceTO.setRmapping(mapping);
-
-        resourceTO = createResource(resourceTO);
-        assertNotNull(resourceTO);
-        assertEquals(2, resourceTO.getRmapping().getItems().size());
-    }
-
-    @Test
-    public void issueSYNCOPE418() {
-        try {
-            resourceService.create(
-                    buildResourceTO("http://schemas.examples.org/security/authorization/organizationUnit"));
-            fail();
-        } catch (SyncopeClientException e) {
-            assertEquals(ClientExceptionType.InvalidExternalResource, e.getType());
-
-            assertTrue(e.getElements().iterator().next().toString().contains(EntityViolationType.InvalidName.name()));
-        }
-    }
-
-    @Test
-    public void anonymous() {
-        ResourceService unauthenticated = clientFactory.createAnonymous().getService(ResourceService.class);
-        try {
-            unauthenticated.list();
-            fail();
-        } catch (AccessControlException e) {
-            assertNotNull(e);
-        }
-
-        ResourceService anonymous = clientFactory.create(ANONYMOUS_UNAME, ANONYMOUS_KEY).
-                getService(ResourceService.class);
-        assertFalse(anonymous.list().isEmpty());
-    }
-
-    @Test
-    public void issueSYNCOPE493() {
-        // create resource with attribute mapping set to NONE and check its propagation
-        String resourceName = RESOURCE_NAME_CREATE_NONE;
-        ResourceTO resourceTO = new ResourceTO();
-        resourceTO.setKey(resourceName);
-        resourceTO.setConnectorId(102L);
-
-        MappingTO umapping = new MappingTO();
-
-        MappingItemTO item = new MappingItemTO();
-        item.setIntMappingType(IntMappingType.UserId);
-        item.setExtAttrName("userId");
-        item.setAccountid(true);
-        item.setPurpose(MappingPurpose.PROPAGATION);
-        umapping.setAccountIdItem(item);
-
-        MappingItemTO item2 = new MappingItemTO();
-        item2.setIntMappingType(IntMappingType.UserPlainSchema);
-        item2.setAccountid(false);
-        item2.setIntAttrName("gender");
-        item2.setExtAttrName("gender");
-        item2.setPurpose(MappingPurpose.NONE);
-        umapping.addItem(item2);
-
-        resourceTO.setUmapping(umapping);
-
-        Response response = resourceService.create(resourceTO);
-        ResourceTO actual = getObject(response.getLocation(), ResourceService.class, ResourceTO.class);
-
-        assertNotNull(actual);
-        assertNotNull(actual.getUmapping());
-        assertNotNull(actual.getUmapping().getItems());
-        assertEquals(MappingPurpose.PROPAGATION, actual.getUmapping().getAccountIdItem().getPurpose());
-        for (MappingItemTO itemTO : actual.getUmapping().getItems()) {
-            if ("gender".equals(itemTO.getIntAttrName())) {
-                assertEquals(MappingPurpose.NONE, itemTO.getPurpose());
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/32707b3b/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/RoleITCase.java
----------------------------------------------------------------------
diff --git a/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/RoleITCase.java b/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/RoleITCase.java
deleted file mode 100644
index 18646f5..0000000
--- a/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/RoleITCase.java
+++ /dev/null
@@ -1,889 +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.server.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.io.IOException;
-import java.io.InputStream;
-import java.security.AccessControlException;
-import java.util.List;
-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.Response;
-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.SyncopeClientException;
-import org.apache.syncope.common.lib.mod.ReferenceMod;
-import org.apache.syncope.common.lib.mod.RoleMod;
-import org.apache.syncope.common.lib.to.BulkActionResult;
-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.RoleTO;
-import org.apache.syncope.common.lib.to.UserTO;
-import org.apache.syncope.common.lib.types.AttributableType;
-import org.apache.syncope.common.lib.types.ClientExceptionType;
-import org.apache.syncope.common.lib.types.IntMappingType;
-import org.apache.syncope.common.lib.types.MappingPurpose;
-import org.apache.syncope.common.lib.types.ResourceAssociationActionType;
-import org.apache.syncope.common.lib.types.ResourceDeassociationActionType;
-import org.apache.syncope.common.lib.types.SchemaType;
-import org.apache.syncope.common.lib.types.SubjectType;
-import org.apache.syncope.common.lib.wrap.ResourceName;
-import org.apache.syncope.common.rest.api.CollectionWrapper;
-import org.apache.syncope.common.rest.api.Preference;
-import org.apache.syncope.common.rest.api.RESTHeaders;
-import org.apache.syncope.common.rest.api.service.RoleService;
-import org.identityconnectors.framework.common.objects.Name;
-import org.junit.FixMethodOrder;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runners.MethodSorters;
-
-@FixMethodOrder(MethodSorters.JVM)
-public class RoleITCase extends AbstractITCase {
-
-    private RoleTO buildBasicRoleTO(final String name) {
-        RoleTO roleTO = new RoleTO();
-        roleTO.setName(name + getUUIDString());
-        roleTO.setParent(8L);
-        return roleTO;
-    }
-
-    private RoleTO buildRoleTO(final String name) {
-        RoleTO roleTO = buildBasicRoleTO(name);
-
-        // verify inheritance password and account policies
-        roleTO.setInheritAccountPolicy(false);
-        // not inherited so setter execution shouldn't be ignored
-        roleTO.setAccountPolicy(6L);
-
-        roleTO.setInheritPasswordPolicy(true);
-        // inherited so setter execution should be ignored
-        roleTO.setPasswordPolicy(2L);
-
-        roleTO.getRAttrTemplates().add("icon");
-        roleTO.getPlainAttrs().add(attrTO("icon", "anIcon"));
-
-        roleTO.getResources().add(RESOURCE_NAME_LDAP);
-        return roleTO;
-    }
-
-    @Test
-    public void createWithException() {
-        RoleTO newRoleTO = new RoleTO();
-        newRoleTO.getPlainAttrs().add(attrTO("attr1", "value1"));
-
-        try {
-            createRole(newRoleTO);
-            fail();
-        } catch (SyncopeClientException e) {
-            assertEquals(ClientExceptionType.InvalidRole, e.getType());
-        }
-    }
-
-    @Test
-    @Ignore
-    public void create() {
-        RoleTO roleTO = buildRoleTO("lastRole");
-        roleTO.getRVirAttrTemplates().add("rvirtualdata");
-        roleTO.getVirAttrs().add(attrTO("rvirtualdata", "rvirtualvalue"));
-        roleTO.setRoleOwner(8L);
-
-        roleTO = createRole(roleTO);
-        assertNotNull(roleTO);
-
-        assertNotNull(roleTO.getVirAttrMap());
-        assertNotNull(roleTO.getVirAttrMap().get("rvirtualdata").getValues());
-        assertFalse(roleTO.getVirAttrMap().get("rvirtualdata").getValues().isEmpty());
-        assertEquals("rvirtualvalue", roleTO.getVirAttrMap().get("rvirtualdata").getValues().get(0));
-
-        assertNotNull(roleTO.getAccountPolicy());
-        assertEquals(6L, (long) roleTO.getAccountPolicy());
-
-        assertNotNull(roleTO.getPasswordPolicy());
-        assertEquals(4L, (long) roleTO.getPasswordPolicy());
-
-        assertTrue(roleTO.getResources().contains(RESOURCE_NAME_LDAP));
-
-        ConnObjectTO connObjectTO =
-                resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, roleTO.getKey());
-        assertNotNull(connObjectTO);
-        assertNotNull(connObjectTO.getPlainAttrMap().get("owner"));
-
-        // SYNCOPE-515: remove ownership
-        final RoleMod roleMod = new RoleMod();
-        roleMod.setKey(roleTO.getKey());
-        roleMod.setRoleOwner(new ReferenceMod());
-
-        assertNull(updateRole(roleMod).getRoleOwner());
-    }
-
-    @Test
-    public void createWithPasswordPolicy() {
-        RoleTO roleTO = new RoleTO();
-        roleTO.setName("roleWithPassword" + getUUIDString());
-        roleTO.setParent(8L);
-        roleTO.setPasswordPolicy(4L);
-
-        RoleTO actual = createRole(roleTO);
-        assertNotNull(actual);
-
-        actual = roleService.read(actual.getKey());
-        assertNotNull(actual);
-        assertNotNull(actual.getPasswordPolicy());
-        assertEquals(4L, (long) actual.getPasswordPolicy());
-    }
-
-    @Test
-    public void delete() {
-        try {
-            roleService.delete(0L);
-        } catch (SyncopeClientException e) {
-            assertEquals(Response.Status.NOT_FOUND, e.getType().getResponseStatus());
-        }
-
-        RoleTO roleTO = new RoleTO();
-        roleTO.setName("toBeDeleted" + getUUIDString());
-        roleTO.setParent(8L);
-
-        roleTO.getResources().add(RESOURCE_NAME_LDAP);
-
-        roleTO = createRole(roleTO);
-        assertNotNull(roleTO);
-
-        RoleTO deletedRole = deleteRole(roleTO.getKey());
-        assertNotNull(deletedRole);
-
-        try {
-            roleService.read(deletedRole.getKey());
-        } catch (SyncopeClientException e) {
-            assertEquals(Response.Status.NOT_FOUND, e.getType().getResponseStatus());
-        }
-    }
-
-    @Test
-    public void list() {
-        PagedResult<RoleTO> roleTOs = roleService.list();
-        assertNotNull(roleTOs);
-        assertTrue(roleTOs.getResult().size() >= 8);
-        for (RoleTO roleTO : roleTOs.getResult()) {
-            assertNotNull(roleTO);
-        }
-    }
-
-    @Test
-    public void parent() {
-        RoleTO roleTO = roleService.parent(7L);
-
-        assertNotNull(roleTO);
-        assertEquals(roleTO.getKey(), 6L);
-    }
-
-    @Test
-    public void read() {
-        RoleTO roleTO = roleService.read(1L);
-
-        assertNotNull(roleTO);
-        assertNotNull(roleTO.getPlainAttrs());
-        assertFalse(roleTO.getPlainAttrs().isEmpty());
-    }
-
-    @Test
-    public void selfRead() {
-        UserTO userTO = userService.read(1L);
-        assertNotNull(userTO);
-
-        assertTrue(userTO.getMembershipMap().containsKey(1L));
-        assertFalse(userTO.getMembershipMap().containsKey(3L));
-
-        RoleService roleService2 = clientFactory.create("rossini", ADMIN_PWD).getService(RoleService.class);
-
-        try {
-            roleService2.readSelf(3L);
-            fail();
-        } catch (SyncopeClientException e) {
-            assertEquals(ClientExceptionType.UnauthorizedRole, e.getType());
-        }
-
-        RoleTO roleTO = roleService2.readSelf(1L);
-        assertNotNull(roleTO);
-        assertNotNull(roleTO.getPlainAttrs());
-        assertFalse(roleTO.getPlainAttrs().isEmpty());
-    }
-
-    @Test
-    public void update() {
-        RoleTO roleTO = buildRoleTO("latestRole" + getUUIDString());
-        roleTO.getRAttrTemplates().add("show");
-        roleTO = createRole(roleTO);
-
-        assertEquals(1, roleTO.getPlainAttrs().size());
-
-        assertNotNull(roleTO.getAccountPolicy());
-        assertEquals(6L, (long) roleTO.getAccountPolicy());
-
-        assertNotNull(roleTO.getPasswordPolicy());
-        assertEquals(4L, (long) roleTO.getPasswordPolicy());
-
-        RoleMod roleMod = new RoleMod();
-        roleMod.setKey(roleTO.getKey());
-        String modName = "finalRole" + getUUIDString();
-        roleMod.setName(modName);
-        roleMod.getPlainAttrsToUpdate().add(attrMod("show", "FALSE"));
-
-        // change password policy inheritance
-        roleMod.setInheritPasswordPolicy(Boolean.FALSE);
-
-        roleTO = updateRole(roleMod);
-
-        assertEquals(modName, roleTO.getName());
-        assertEquals(2, roleTO.getPlainAttrs().size());
-
-        // changes ignored because not requested (null ReferenceMod)
-        assertNotNull(roleTO.getAccountPolicy());
-        assertEquals(6L, (long) roleTO.getAccountPolicy());
-
-        // password policy null because not inherited
-        assertNull(roleTO.getPasswordPolicy());
-    }
-
-    @Test
-    public void updateRemovingVirAttribute() {
-        RoleTO roleTO = buildBasicRoleTO("withvirtual" + getUUIDString());
-        roleTO.getRVirAttrTemplates().add("rvirtualdata");
-        roleTO.getVirAttrs().add(attrTO("rvirtualdata", null));
-
-        roleTO = createRole(roleTO);
-
-        assertNotNull(roleTO);
-        assertEquals(1, roleTO.getVirAttrs().size());
-
-        final RoleMod roleMod = new RoleMod();
-        roleMod.setKey(roleTO.getKey());
-        roleMod.getVirAttrsToRemove().add("rvirtualdata");
-
-        roleTO = updateRole(roleMod);
-        assertNotNull(roleTO);
-        assertTrue(roleTO.getVirAttrs().isEmpty());
-    }
-
-    @Test
-    public void updateRemovingDerAttribute() {
-        RoleTO roleTO = buildBasicRoleTO("withderived" + getUUIDString());
-        roleTO.getRDerAttrTemplates().add("rderivedschema");
-        roleTO.getDerAttrs().add(attrTO("rderivedschema", null));
-
-        roleTO = createRole(roleTO);
-
-        assertNotNull(roleTO);
-        assertEquals(1, roleTO.getDerAttrs().size());
-
-        final RoleMod roleMod = new RoleMod();
-        roleMod.setKey(roleTO.getKey());
-        roleMod.getDerAttrsToRemove().add("rderivedschema");
-
-        roleTO = updateRole(roleMod);
-        assertNotNull(roleTO);
-        assertTrue(roleTO.getDerAttrs().isEmpty());
-    }
-
-    @Test
-    public void updateAsRoleOwner() {
-        // 1. read role as admin
-        RoleTO roleTO = roleService.read(7L);
-
-        // issue SYNCOPE-15
-        assertNotNull(roleTO.getCreationDate());
-        assertNotNull(roleTO.getLastChangeDate());
-        assertEquals("admin", roleTO.getCreator());
-        assertEquals("admin", roleTO.getLastModifier());
-
-        // 2. prepare update
-        RoleMod roleMod = new RoleMod();
-        roleMod.setKey(roleTO.getKey());
-        roleMod.setName("Managing Director");
-
-        // 3. try to update as verdi, not owner of role 7 - fail
-        RoleService roleService2 = clientFactory.create("verdi", ADMIN_PWD).getService(RoleService.class);
-
-        try {
-            roleService2.update(roleMod.getKey(), roleMod);
-            fail();
-        } catch (SyncopeClientException e) {
-            assertEquals(Response.Status.UNAUTHORIZED, e.getType().getResponseStatus());
-        } catch (AccessControlException e) {
-            assertNotNull(e);
-        }
-
-        // 4. update as puccini, owner of role 7 because owner of role 6 with inheritance - success
-        RoleService roleService3 = clientFactory.create("puccini", ADMIN_PWD).getService(RoleService.class);
-
-        roleTO = roleService3.update(roleMod.getKey(), roleMod).readEntity(RoleTO.class);
-        assertEquals("Managing Director", roleTO.getName());
-
-        // issue SYNCOPE-15
-        assertNotNull(roleTO.getCreationDate());
-        assertNotNull(roleTO.getLastChangeDate());
-        assertEquals("admin", roleTO.getCreator());
-        assertEquals("puccini", roleTO.getLastModifier());
-        assertTrue(roleTO.getCreationDate().before(roleTO.getLastChangeDate()));
-    }
-
-    /**
-     * Role rename used to fail in case of parent null.
-     *
-     * http://code.google.com/p/syncope/issues/detail?id=178
-     */
-    @Test
-    public void issue178() {
-        RoleTO roleTO = new RoleTO();
-        String roleName = "torename" + getUUIDString();
-        roleTO.setName(roleName);
-
-        RoleTO actual = createRole(roleTO);
-
-        assertNotNull(actual);
-        assertEquals(roleName, actual.getName());
-        assertEquals(0L, actual.getParent());
-
-        RoleMod roleMod = new RoleMod();
-        roleMod.setKey(actual.getKey());
-        String renamedRole = "renamed" + getUUIDString();
-        roleMod.setName(renamedRole);
-
-        actual = updateRole(roleMod);
-        assertNotNull(actual);
-        assertEquals(renamedRole, actual.getName());
-        assertEquals(0L, actual.getParent());
-    }
-
-    @Test
-    public void issueSYNCOPE228() {
-        RoleTO roleTO = buildRoleTO("issueSYNCOPE228");
-        roleTO.getEntitlements().add("USER_READ");
-        roleTO.getEntitlements().add("SCHEMA_READ");
-
-        roleTO = createRole(roleTO);
-        assertNotNull(roleTO);
-        assertNotNull(roleTO.getEntitlements());
-        assertFalse(roleTO.getEntitlements().isEmpty());
-
-        List<String> entitlements = roleTO.getEntitlements();
-
-        RoleMod roleMod = new RoleMod();
-        roleMod.setKey(roleTO.getKey());
-        roleMod.setInheritDerAttrs(Boolean.TRUE);
-
-        roleTO = updateRole(roleMod);
-        assertNotNull(roleTO);
-        assertEquals(entitlements, roleTO.getEntitlements());
-
-        roleMod = new RoleMod();
-        roleMod.setKey(roleTO.getKey());
-        roleMod.setModEntitlements(true);
-        roleMod.getEntitlements().clear();
-
-        roleTO = updateRole(roleMod);
-        assertNotNull(roleTO);
-        assertTrue(roleTO.getEntitlements().isEmpty());
-    }
-
-    @Test
-    public void unlink() {
-        RoleTO actual = createRole(buildRoleTO("unlink"));
-        assertNotNull(actual);
-
-        assertNotNull(resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey()));
-
-        assertNotNull(roleService.bulkDeassociation(actual.getKey(),
-                ResourceDeassociationActionType.UNLINK,
-                CollectionWrapper.wrap(RESOURCE_NAME_LDAP, ResourceName.class)).
-                readEntity(BulkActionResult.class));
-
-        actual = roleService.read(actual.getKey());
-        assertNotNull(actual);
-        assertTrue(actual.getResources().isEmpty());
-
-        assertNotNull(resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey()));
-    }
-
-    @Test
-    public void link() {
-        RoleTO roleTO = buildRoleTO("link");
-        roleTO.getResources().clear();
-
-        RoleTO actual = createRole(roleTO);
-        assertNotNull(actual);
-
-        try {
-            resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey());
-            fail();
-        } catch (Exception e) {
-            assertNotNull(e);
-        }
-
-        assertNotNull(roleService.bulkAssociation(actual.getKey(),
-                ResourceAssociationActionType.LINK,
-                CollectionWrapper.wrap(RESOURCE_NAME_LDAP, ResourceName.class)).
-                readEntity(BulkActionResult.class));
-
-        actual = roleService.read(actual.getKey());
-        assertFalse(actual.getResources().isEmpty());
-
-        try {
-            resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey());
-            fail();
-        } catch (Exception e) {
-            assertNotNull(e);
-        }
-    }
-
-    @Test
-    public void unassign() {
-        RoleTO actual = createRole(buildRoleTO("unassign"));
-        assertNotNull(actual);
-
-        assertNotNull(resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey()));
-
-        assertNotNull(roleService.bulkDeassociation(actual.getKey(),
-                ResourceDeassociationActionType.UNASSIGN,
-                CollectionWrapper.wrap(RESOURCE_NAME_LDAP, ResourceName.class)).
-                readEntity(BulkActionResult.class));
-
-        actual = roleService.read(actual.getKey());
-        assertNotNull(actual);
-        assertTrue(actual.getResources().isEmpty());
-
-        try {
-            resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey());
-            fail();
-        } catch (Exception e) {
-            assertNotNull(e);
-        }
-    }
-
-    @Test
-    public void assign() {
-        RoleTO roleTO = buildRoleTO("assign");
-        roleTO.getResources().clear();
-
-        RoleTO actual = createRole(roleTO);
-        assertNotNull(actual);
-
-        try {
-            resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey());
-            fail();
-        } catch (Exception e) {
-            assertNotNull(e);
-        }
-
-        assertNotNull(roleService.bulkAssociation(actual.getKey(),
-                ResourceAssociationActionType.ASSIGN,
-                CollectionWrapper.wrap(RESOURCE_NAME_LDAP, ResourceName.class)).
-                readEntity(BulkActionResult.class));
-
-        actual = roleService.read(actual.getKey());
-        assertFalse(actual.getResources().isEmpty());
-        assertNotNull(resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey()));
-    }
-
-    @Test
-    public void deprovision() {
-        RoleTO actual = createRole(buildRoleTO("deprovision"));
-        assertNotNull(actual);
-
-        assertNotNull(resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey()));
-
-        assertNotNull(roleService.bulkDeassociation(actual.getKey(),
-                ResourceDeassociationActionType.DEPROVISION,
-                CollectionWrapper.wrap(RESOURCE_NAME_LDAP, ResourceName.class)).
-                readEntity(BulkActionResult.class));
-
-        actual = roleService.read(actual.getKey());
-        assertNotNull(actual);
-        assertFalse(actual.getResources().isEmpty());
-
-        try {
-            resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey());
-            fail();
-        } catch (Exception e) {
-            assertNotNull(e);
-        }
-    }
-
-    @Test
-    public void provision() {
-        RoleTO roleTO = buildRoleTO("assign");
-        roleTO.getResources().clear();
-
-        RoleTO actual = createRole(roleTO);
-        assertNotNull(actual);
-
-        try {
-            resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey());
-            fail();
-        } catch (Exception e) {
-            assertNotNull(e);
-        }
-
-        assertNotNull(roleService.bulkAssociation(actual.getKey(),
-                ResourceAssociationActionType.PROVISION,
-                CollectionWrapper.wrap(RESOURCE_NAME_LDAP, ResourceName.class)).
-                readEntity(BulkActionResult.class));
-
-        actual = roleService.read(actual.getKey());
-        assertTrue(actual.getResources().isEmpty());
-
-        assertNotNull(resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey()));
-    }
-
-    @Test
-    public void deprovisionUnlinked() {
-        RoleTO roleTO = buildRoleTO("assign");
-        roleTO.getResources().clear();
-
-        RoleTO actual = createRole(roleTO);
-        assertNotNull(actual);
-
-        try {
-            resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey());
-            fail();
-        } catch (Exception e) {
-            assertNotNull(e);
-        }
-
-        assertNotNull(roleService.bulkAssociation(actual.getKey(),
-                ResourceAssociationActionType.PROVISION,
-                CollectionWrapper.wrap("resource-ldap", ResourceName.class)).
-                readEntity(BulkActionResult.class));
-
-        actual = roleService.read(actual.getKey());
-        assertTrue(actual.getResources().isEmpty());
-
-        assertNotNull(resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey()));
-
-        assertNotNull(roleService.bulkDeassociation(actual.getKey(),
-                ResourceDeassociationActionType.DEPROVISION,
-                CollectionWrapper.wrap(RESOURCE_NAME_LDAP, ResourceName.class)).
-                readEntity(BulkActionResult.class));
-
-        actual = roleService.read(actual.getKey());
-        assertNotNull(actual);
-        assertTrue(actual.getResources().isEmpty());
-
-        try {
-            resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey());
-            fail();
-        } catch (Exception e) {
-            assertNotNull(e);
-        }
-    }
-
-    @Test
-    public void createWithMandatorySchemaNotTemplate() {
-        // 1. create a role mandatory schema
-        PlainSchemaTO badge = new PlainSchemaTO();
-        badge.setKey("badge");
-        badge.setMandatoryCondition("true");
-        schemaService.create(AttributableType.ROLE, SchemaType.PLAIN, badge);
-
-        // 2. create a role *without* an attribute for that schema: it works
-        RoleTO roleTO = buildRoleTO("lastRole");
-        assertFalse(roleTO.getPlainAttrMap().containsKey(badge.getKey()));
-        roleTO = createRole(roleTO);
-        assertNotNull(roleTO);
-        assertFalse(roleTO.getPlainAttrMap().containsKey(badge.getKey()));
-
-        // 3. add a template for badge to the role just created - 
-        // failure since no values are provided and it is mandatory
-        RoleMod roleMod = new RoleMod();
-        roleMod.setKey(roleTO.getKey());
-        roleMod.setModRAttrTemplates(true);
-        roleMod.getRPlainAttrTemplates().add("badge");
-
-        try {
-            updateRole(roleMod);
-            fail();
-        } catch (SyncopeClientException e) {
-            assertEquals(ClientExceptionType.RequiredValuesMissing, e.getType());
-        }
-
-        // 4. also add an actual attribute for badge - it will work        
-        roleMod.getPlainAttrsToUpdate().add(attrMod(badge.getKey(), "xxxxxxxxxx"));
-
-        roleTO = updateRole(roleMod);
-        assertNotNull(roleTO);
-        assertTrue(roleTO.getPlainAttrMap().containsKey(badge.getKey()));
-    }
-
-    @Test
-    public void anonymous() {
-        RoleService unauthenticated = clientFactory.createAnonymous().getService(RoleService.class);
-        try {
-            unauthenticated.list();
-            fail();
-        } catch (AccessControlException e) {
-            assertNotNull(e);
-        }
-
-        RoleService anonymous = clientFactory.create(ANONYMOUS_UNAME, ANONYMOUS_KEY).getService(RoleService.class);
-        assertFalse(anonymous.list().getResult().isEmpty());
-    }
-
-    @Test
-    public void noContent() throws IOException {
-        SyncopeClient noContentclient = clientFactory.create(ADMIN_UNAME, ADMIN_PWD);
-        RoleService noContentService = noContentclient.prefer(RoleService.class, Preference.RETURN_NO_CONTENT);
-
-        RoleTO role = buildRoleTO("noContent");
-
-        Response response = noContentService.create(role);
-        assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus());
-        assertEquals(Preference.RETURN_NO_CONTENT.toString(), response.getHeaderString(RESTHeaders.PREFERENCE_APPLIED));
-        assertEquals(StringUtils.EMPTY, IOUtils.toString((InputStream) response.getEntity()));
-
-        role = getObject(response.getLocation(), RoleService.class, RoleTO.class);
-        assertNotNull(role);
-
-        RoleMod roleMod = new RoleMod();
-        roleMod.getPlainAttrsToUpdate().add(attrMod("badge", "xxxxxxxxxx"));
-
-        response = noContentService.update(role.getKey(), roleMod);
-        assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
-        assertEquals(Preference.RETURN_NO_CONTENT.toString(), response.getHeaderString(RESTHeaders.PREFERENCE_APPLIED));
-        assertEquals(StringUtils.EMPTY, IOUtils.toString((InputStream) response.getEntity()));
-
-        response = noContentService.delete(role.getKey());
-        assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
-        assertEquals(Preference.RETURN_NO_CONTENT.toString(), response.getHeaderString(RESTHeaders.PREFERENCE_APPLIED));
-        assertEquals(StringUtils.EMPTY, IOUtils.toString((InputStream) response.getEntity()));
-    }
-
-    @Test
-    public void issueSYNCOPE455() {
-        final String parentName = "issueSYNCOPE455-PRole";
-        final String childName = "issueSYNCOPE455-CRole";
-
-        // 1. create parent role
-        RoleTO parent = buildBasicRoleTO(parentName);
-        parent.getResources().add(RESOURCE_NAME_LDAP);
-
-        parent = createRole(parent);
-        assertTrue(parent.getResources().contains(RESOURCE_NAME_LDAP));
-
-        final ConnObjectTO parentRemoteObject =
-                resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, parent.getKey());
-        assertNotNull(parentRemoteObject);
-        assertNotNull(getLdapRemoteObject(parentRemoteObject.getPlainAttrMap().get(Name.NAME).getValues().get(0)));
-
-        // 2. create child role
-        RoleTO child = buildBasicRoleTO(childName);
-        child.getResources().add(RESOURCE_NAME_LDAP);
-        child.setParent(parent.getKey());
-
-        child = createRole(child);
-        assertTrue(child.getResources().contains(RESOURCE_NAME_LDAP));
-
-        final ConnObjectTO childRemoteObject =
-                resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, child.getKey());
-        assertNotNull(childRemoteObject);
-        assertNotNull(getLdapRemoteObject(childRemoteObject.getPlainAttrMap().get(Name.NAME).getValues().get(0)));
-
-        // 3. remove parent role
-        roleService.delete(parent.getKey());
-
-        // 4. asserts for issue 455
-        try {
-            roleService.read(parent.getKey());
-            fail();
-        } catch (SyncopeClientException scce) {
-            assertNotNull(scce);
-        }
-
-        try {
-            roleService.read(child.getKey());
-            fail();
-        } catch (SyncopeClientException scce) {
-            assertNotNull(scce);
-        }
-
-        assertNull(getLdapRemoteObject(parentRemoteObject.getPlainAttrMap().get(Name.NAME).getValues().get(0)));
-        assertNull(getLdapRemoteObject(childRemoteObject.getPlainAttrMap().get(Name.NAME).getValues().get(0)));
-    }
-
-    @Test
-    public void issueSYNCOPE543() {
-        final String ancestorName = "issueSYNCOPE543-ARole";
-        final String parentName = "issueSYNCOPE543-PRole";
-        final String childName = "issueSYNCOPE543-CRole";
-
-        // 1. create ancestor role
-        RoleTO ancestor = buildBasicRoleTO(ancestorName);
-        ancestor.setParent(0L);
-        ancestor.getRAttrTemplates().add("icon");
-        ancestor.getPlainAttrs().add(attrTO("icon", "ancestorIcon"));
-        ancestor = createRole(ancestor);
-        assertEquals("ancestorIcon", ancestor.getPlainAttrMap().get("icon").getValues().get(0));
-
-        // 2. create parent role
-        RoleTO parent = buildBasicRoleTO(parentName);
-        parent.setParent(ancestor.getKey());
-        parent.getRAttrTemplates().add("icon");
-        parent.getPlainAttrs().add(attrTO("icon", "parentIcon"));
-        parent = createRole(parent);
-        assertEquals("parentIcon", parent.getPlainAttrMap().get("icon").getValues().get(0));
-
-        // 3. create child role
-        RoleTO child = buildBasicRoleTO(childName);
-        child.setParent(parent.getKey());
-        child.getRAttrTemplates().add("icon");
-        child.getPlainAttrs().add(attrTO("icon", "childIcon"));
-        child = createRole(child);
-        assertEquals("childIcon", child.getPlainAttrMap().get("icon").getValues().get(0));
-
-        final RoleMod roleChildMod = new RoleMod();
-        roleChildMod.setKey(child.getKey());
-        roleChildMod.setInheritPlainAttrs(Boolean.TRUE);
-        updateRole(roleChildMod);
-
-        child = roleService.read(child.getKey());
-        assertNotNull(child);
-        assertNotNull(child.getPlainAttrMap().get("icon").getValues());
-        assertEquals("parentIcon", child.getPlainAttrMap().get("icon").getValues().get(0));
-
-        final RoleMod roleParentMod = new RoleMod();
-        roleParentMod.setKey(parent.getKey());
-        roleParentMod.setInheritPlainAttrs(Boolean.TRUE);
-        updateRole(roleParentMod);
-
-        child = roleService.read(child.getKey());
-        assertNotNull(child);
-        assertNotNull(child.getPlainAttrMap().get("icon").getValues());
-        assertEquals("ancestorIcon", child.getPlainAttrMap().get("icon").getValues().get(0));
-
-        parent = roleService.read(parent.getKey());
-        assertNotNull(parent);
-        assertNotNull(parent.getPlainAttrMap().get("icon").getValues());
-        assertEquals("ancestorIcon", parent.getPlainAttrMap().get("icon").getValues().get(0));
-
-        roleParentMod.setInheritPlainAttrs(Boolean.FALSE);
-        updateRole(roleParentMod);
-
-        child = roleService.read(child.getKey());
-        assertNotNull(child);
-        assertNotNull(child.getPlainAttrMap().get("icon").getValues());
-        assertEquals("parentIcon", child.getPlainAttrMap().get("icon").getValues().get(0));
-    }
-
-    @Test
-    public void issueSYNCOPE632() {
-        RoleTO roleTO = null;
-        try {
-            // 1. create new LDAP resource having account id mapped to a derived attribute
-            ResourceTO newLDAP = resourceService.read(RESOURCE_NAME_LDAP);
-            newLDAP.setKey("new-ldap");
-            newLDAP.setPropagationPrimary(true);
-            MappingItemTO accountId = newLDAP.getRmapping().getAccountIdItem();
-            accountId.setIntMappingType(IntMappingType.RoleDerivedSchema);
-            accountId.setIntAttrName("displayProperty");
-            newLDAP.getRmapping().setAccountIdItem(accountId);
-            newLDAP.getRmapping().setAccountLink("'cn=' + displayProperty + ',ou=groups,o=isp'");
-
-            MappingItemTO description = new MappingItemTO();
-            description.setIntMappingType(IntMappingType.RoleId);
-            description.setExtAttrName("description");
-            description.setPurpose(MappingPurpose.BOTH);
-            newLDAP.getRmapping().addItem(description);
-
-            newLDAP = createResource(newLDAP);
-            assertNotNull(newLDAP);
-
-            // 2. create a role and give the resource created above
-            roleTO = buildRoleTO("lastRole");
-            roleTO.getRAttrTemplates().add("icon");
-            roleTO.getPlainAttrs().add(attrTO("icon", "anIcon"));
-            roleTO.getRAttrTemplates().add("show");
-            roleTO.getPlainAttrs().add(attrTO("show", "true"));
-            roleTO.getRDerAttrTemplates().add("displayProperty");
-            roleTO.getDerAttrs().add(attrTO("displayProperty", null));
-            roleTO.getResources().clear();
-            roleTO.getResources().add("new-ldap");
-
-            roleTO = createRole(roleTO);
-            assertNotNull(roleTO);
-
-            // 3. update the role
-            RoleMod roleMod = new RoleMod();
-            roleMod.setKey(roleTO.getKey());
-            roleMod.getPlainAttrsToRemove().add("icon");
-            roleMod.getPlainAttrsToUpdate().add(attrMod("icon", "anotherIcon"));
-
-            roleTO = updateRole(roleMod);
-            assertNotNull(roleTO);
-
-            // 4. check that a single group exists in LDAP for the role 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=" + roleTO.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 (roleTO != null) {
-                roleService.delete(roleTO.getKey());
-            }
-            resourceService.delete("new-ldap");
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/32707b3b/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/SchedTaskITCase.java
----------------------------------------------------------------------
diff --git a/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/SchedTaskITCase.java b/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/SchedTaskITCase.java
deleted file mode 100644
index 424ca08..0000000
--- a/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/SchedTaskITCase.java
+++ /dev/null
@@ -1,107 +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.server.reference;
-
-import static org.apache.syncope.fit.server.reference.AbstractITCase.taskService;
-import static org.apache.syncope.fit.server.reference.AbstractTaskITCase.SCHED_TASK_ID;
-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.fail;
-
-import java.util.List;
-import javax.ws.rs.core.Response;
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
-import org.apache.syncope.common.lib.to.PagedResult;
-import org.apache.syncope.common.lib.to.PushTaskTO;
-import org.apache.syncope.common.lib.to.SchedTaskTO;
-import org.apache.syncope.common.lib.to.SyncTaskTO;
-import org.apache.syncope.common.lib.types.TaskType;
-import org.apache.syncope.common.rest.api.service.TaskService;
-import org.apache.syncope.server.provisioning.api.job.SyncJob;
-import org.junit.FixMethodOrder;
-import org.junit.Test;
-import org.junit.runners.MethodSorters;
-
-@FixMethodOrder(MethodSorters.JVM)
-public class SchedTaskITCase extends AbstractTaskITCase {
-
-    @Test
-    public void getJobClasses() {
-        List<String> jobClasses = syncopeService.info().getTaskJobs();
-        assertNotNull(jobClasses);
-        assertFalse(jobClasses.isEmpty());
-    }
-
-    @Test
-    public void list() {
-        final PagedResult<SchedTaskTO> tasks = taskService.list(TaskType.SCHEDULED);
-        assertFalse(tasks.getResult().isEmpty());
-        for (AbstractTaskTO task : tasks.getResult()) {
-            if (!(task instanceof SchedTaskTO) || task instanceof SyncTaskTO || task instanceof PushTaskTO) {
-                fail();
-            }
-        }
-    }
-
-    @Test
-    public void update() {
-        SchedTaskTO task = taskService.read(SCHED_TASK_ID);
-        assertNotNull(task);
-
-        final SchedTaskTO taskMod = new SchedTaskTO();
-        taskMod.setKey(5);
-        taskMod.setCronExpression(null);
-
-        taskService.update(taskMod.getKey(), taskMod);
-        SchedTaskTO actual = taskService.read(taskMod.getKey());
-        assertNotNull(actual);
-        assertEquals(task.getKey(), actual.getKey());
-        assertNull(actual.getCronExpression());
-    }
-
-    @Test
-    public void issueSYNCOPE144() {
-        SchedTaskTO task = new SchedTaskTO();
-        task.setName("issueSYNCOPE144");
-        task.setDescription("issueSYNCOPE144 Description");
-        task.setJobClassName(SyncJob.class.getName());
-
-        Response response = taskService.create(task);
-        SchedTaskTO actual = getObject(response.getLocation(), TaskService.class, SchedTaskTO.class);
-        assertNotNull(actual);
-        assertEquals("issueSYNCOPE144", actual.getName());
-        assertEquals("issueSYNCOPE144 Description", actual.getDescription());
-
-        task = taskService.read(actual.getKey());
-        assertNotNull(task);
-        assertEquals("issueSYNCOPE144", task.getName());
-        assertEquals("issueSYNCOPE144 Description", task.getDescription());
-
-        task.setName("issueSYNCOPE144_2");
-        task.setDescription("issueSYNCOPE144 Description_2");
-
-        response = taskService.create(task);
-        actual = getObject(response.getLocation(), TaskService.class, SchedTaskTO.class);
-        assertNotNull(actual);
-        assertEquals("issueSYNCOPE144_2", actual.getName());
-        assertEquals("issueSYNCOPE144 Description_2", actual.getDescription());
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/32707b3b/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/SearchITCase.java
----------------------------------------------------------------------
diff --git a/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/SearchITCase.java b/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/SearchITCase.java
deleted file mode 100644
index 57dfbb0..0000000
--- a/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/SearchITCase.java
+++ /dev/null
@@ -1,182 +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.server.reference;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.syncope.client.lib.SyncopeClient;
-import org.apache.syncope.common.lib.to.PagedResult;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.syncope.common.lib.to.UserTO;
-import org.junit.FixMethodOrder;
-import org.junit.Test;
-import org.junit.runners.MethodSorters;
-
-@FixMethodOrder(MethodSorters.JVM)
-public class SearchITCase extends AbstractITCase {
-
-    @Test
-    public void searchUser() {
-        // LIKE
-        PagedResult<UserTO> matchedUsers = userService.search(
-                SyncopeClient.getUserSearchConditionBuilder().
-                is("fullname").equalTo("*o*").and("fullname").equalTo("*i*").query());
-        assertNotNull(matchedUsers);
-        assertFalse(matchedUsers.getResult().isEmpty());
-
-        for (UserTO user : matchedUsers.getResult()) {
-            assertNotNull(user);
-        }
-
-        // ISNULL
-        matchedUsers = userService.search(
-                SyncopeClient.getUserSearchConditionBuilder().isNull("loginDate").query());
-        assertNotNull(matchedUsers);
-        assertFalse(matchedUsers.getResult().isEmpty());
-
-        Set<Long> userIds = new HashSet<Long>(matchedUsers.getResult().size());
-        for (UserTO user : matchedUsers.getResult()) {
-            userIds.add(user.getKey());
-        }
-        assertTrue(userIds.contains(2L));
-        assertTrue(userIds.contains(3L));
-    }
-
-    @Test
-    public void searchByUsernameAndKey() {
-        final PagedResult<UserTO> matchingUsers = userService.search(
-                SyncopeClient.getUserSearchConditionBuilder().
-                is("username").equalTo("rossini").and("key").lessThan(2).query());
-
-        assertNotNull(matchingUsers);
-        assertEquals(1, matchingUsers.getResult().size());
-        assertEquals("rossini", matchingUsers.getResult().iterator().next().getUsername());
-        assertEquals(1L, matchingUsers.getResult().iterator().next().getKey());
-    }
-
-    @Test
-    public void searchByRolenameAndKey() {
-        final PagedResult<RoleTO> matchingRoles = roleService.search(
-                SyncopeClient.getRoleSearchConditionBuilder().
-                is("name").equalTo("root").and("key").lessThan(2).query());
-
-        assertNotNull(matchingRoles);
-        assertEquals(1, matchingRoles.getResult().size());
-        assertEquals("root", matchingRoles.getResult().iterator().next().getName());
-        assertEquals(1L, matchingRoles.getResult().iterator().next().getKey());
-    }
-
-    @Test
-    public void searchUserByResourceName() {
-        PagedResult<UserTO> matchedUsers = userService.search(
-                SyncopeClient.getUserSearchConditionBuilder().hasResources(RESOURCE_NAME_MAPPINGS2).query());
-        assertNotNull(matchedUsers);
-        assertFalse(matchedUsers.getResult().isEmpty());
-
-        Set<Long> userIds = new HashSet<Long>(matchedUsers.getResult().size());
-        for (UserTO user : matchedUsers.getResult()) {
-            userIds.add(user.getKey());
-        }
-
-        assertEquals(1, userIds.size());
-        assertTrue(userIds.contains(2L));
-    }
-
-    @Test
-    public void paginatedSearch() {
-        // LIKE
-        PagedResult<UserTO> matchingUsers = userService.search(
-                SyncopeClient.getUserSearchConditionBuilder().
-                is("fullname").equalTo("*o*").and("fullname").equalTo("*i*").query(), 1, 2);
-        assertNotNull(matchingUsers);
-
-        assertFalse(matchingUsers.getResult().isEmpty());
-        for (UserTO user : matchingUsers.getResult()) {
-            assertNotNull(user);
-        }
-
-        // ISNULL
-        matchingUsers = userService.search(
-                SyncopeClient.getUserSearchConditionBuilder().isNull("loginDate").query(), 1, 2);
-
-        assertNotNull(matchingUsers);
-        assertFalse(matchingUsers.getResult().isEmpty());
-        Set<Long> userIds = new HashSet<>(matchingUsers.getResult().size());
-        for (UserTO user : matchingUsers.getResult()) {
-            userIds.add(user.getKey());
-        }
-        assertEquals(2, userIds.size());
-    }
-
-    @Test
-    public void searchByBooleanSubjectCond() {
-        final PagedResult<RoleTO> matchingRoles = roleService.search(
-                SyncopeClient.getRoleSearchConditionBuilder().is("inheritPlainAttrs").equalTo("true").query());
-        assertNotNull(matchingRoles);
-        assertFalse(matchingRoles.getResult().isEmpty());
-    }
-
-    @Test
-    public void searchByEntitlement() {
-        final PagedResult<RoleTO> matchingRoles = roleService.search(
-                SyncopeClient.getRoleSearchConditionBuilder().hasEntitlements("USER_LIST", "USER_READ").query());
-        assertNotNull(matchingRoles);
-        assertFalse(matchingRoles.getResult().isEmpty());
-    }
-
-    @Test
-    public void searchByRelationshipSubjectCond() {
-        final PagedResult<RoleTO> matchingRoles = roleService.search(SyncopeClient.getRoleSearchConditionBuilder().
-                isNotNull("passwordPolicy").and("userOwner").equalTo(5).query());
-
-        assertNotNull(matchingRoles);
-        assertEquals(1, matchingRoles.getResult().size());
-        assertEquals("director", matchingRoles.getResult().iterator().next().getName());
-        assertEquals(6L, matchingRoles.getResult().iterator().next().getKey());
-    }
-
-    @Test
-    public void nested() {
-        PagedResult<UserTO> matchedUsers = userService.search(
-                "((fullname==*o*,fullname==*i*);$resources!=ws-target-resource-1)", 1, 2);
-        assertNotNull(matchedUsers);
-
-        assertFalse(matchedUsers.getResult().isEmpty());
-        for (UserTO user : matchedUsers.getResult()) {
-            assertNotNull(user);
-        }
-    }
-
-    @Test
-    public void orderBy() {
-        final PagedResult<UserTO> matchedUsers = userService.search(
-                SyncopeClient.getUserSearchConditionBuilder().is("userId").equalTo("*@apache.org").query(),
-                SyncopeClient.getOrderByClauseBuilder().asc("status").desc("firstname").build());
-
-        assertFalse(matchedUsers.getResult().isEmpty());
-        for (UserTO user : matchedUsers.getResult()) {
-            assertNotNull(user);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/32707b3b/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/SecurityQuestionITCase.java
----------------------------------------------------------------------
diff --git a/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/SecurityQuestionITCase.java b/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/SecurityQuestionITCase.java
deleted file mode 100644
index da65d29..0000000
--- a/syncope620/fit/reference/src/test/java/org/apache/syncope/fit/server/reference/SecurityQuestionITCase.java
+++ /dev/null
@@ -1,99 +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.server.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.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.SecurityQuestionTO;
-import org.apache.syncope.common.lib.types.ClientExceptionType;
-import org.apache.syncope.common.rest.api.service.SecurityQuestionService;
-import org.junit.FixMethodOrder;
-import org.junit.Test;
-import org.junit.runners.MethodSorters;
-
-@FixMethodOrder(MethodSorters.JVM)
-public class SecurityQuestionITCase extends AbstractITCase {
-
-    @Test
-    public void read() {
-        SecurityQuestionTO securityQuestionTO = securityQuestionService.read(1L);
-        assertNotNull(securityQuestionTO);
-    }
-
-    @Test
-    public void list() {
-        List<SecurityQuestionTO> securityQuestionTOs = securityQuestionService.list();
-        assertNotNull(securityQuestionTOs);
-        assertFalse(securityQuestionTOs.isEmpty());
-        for (SecurityQuestionTO instance : securityQuestionTOs) {
-            assertNotNull(instance);
-        }
-    }
-
-    @Test
-    public void create() {
-        SecurityQuestionTO securityQuestionTO = new SecurityQuestionTO();
-        securityQuestionTO.setContent("What is your favorite pet's name?");
-
-        Response response = securityQuestionService.create(securityQuestionTO);
-        SecurityQuestionTO actual = getObject(response.getLocation(), SecurityQuestionService.class,
-                SecurityQuestionTO.class);
-
-        assertNotNull(actual);
-        assertNotNull(actual.getKey());
-        securityQuestionTO.setKey(actual.getKey());
-        assertEquals(actual, securityQuestionTO);
-    }
-
-    @Test
-    public void update() {
-        SecurityQuestionTO securityQuestionTO = securityQuestionService.read(1L);
-        securityQuestionTO.setContent("What is your favorite color?");
-
-        securityQuestionService.update(securityQuestionTO.getKey(), securityQuestionTO);
-        SecurityQuestionTO actual = securityQuestionService.read(securityQuestionTO.getKey());
-        assertNotNull(actual);
-        assertEquals(actual, securityQuestionTO);
-    }
-
-    @Test
-    public void delete() {
-        SecurityQuestionTO securityQuestion = new SecurityQuestionTO();
-        securityQuestion.setContent("What is your first pet's name?");
-
-        Response response = securityQuestionService.create(securityQuestion);
-        securityQuestion = getObject(response.getLocation(), SecurityQuestionService.class, SecurityQuestionTO.class);
-
-        securityQuestionService.delete(securityQuestion.getKey());
-
-        try {
-            securityQuestionService.read(securityQuestion.getKey());
-            fail();
-        } catch (SyncopeClientException e) {
-            assertEquals(ClientExceptionType.NotFound, e.getType());
-        }
-    }
-
-}


Mime
View raw message