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 2017/06/30 11:31:41 UTC
[3/4] syncope git commit: Re-consolidating Core IT in a single
execution group
http://git-wip-us.apache.org/repos/asf/syncope/blob/152f18b8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskIssuesITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskIssuesITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskIssuesITCase.java
deleted file mode 100644
index 59110f6..0000000
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskIssuesITCase.java
+++ /dev/null
@@ -1,550 +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;
-
-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 static org.junit.Assert.fail;
-
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-import javax.sql.DataSource;
-import javax.ws.rs.core.Response;
-import org.apache.commons.lang3.tuple.Pair;
-import org.apache.syncope.common.lib.SyncopeConstants;
-import org.apache.syncope.common.lib.patch.PasswordPatch;
-import org.apache.syncope.common.lib.patch.UserPatch;
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
-import org.apache.syncope.common.lib.to.AttrTO;
-import org.apache.syncope.common.lib.to.ConnInstanceTO;
-import org.apache.syncope.common.lib.to.ConnObjectTO;
-import org.apache.syncope.common.lib.to.MembershipTO;
-import org.apache.syncope.common.lib.to.PagedResult;
-import org.apache.syncope.common.lib.to.ResourceTO;
-import org.apache.syncope.common.lib.to.GroupTO;
-import org.apache.syncope.common.lib.policy.PullPolicyTO;
-import org.apache.syncope.common.lib.to.ProvisioningResult;
-import org.apache.syncope.common.lib.to.PullTaskTO;
-import org.apache.syncope.common.lib.to.ExecTO;
-import org.apache.syncope.common.lib.to.UserTO;
-import org.apache.syncope.common.lib.types.AnyTypeKind;
-import org.apache.syncope.common.lib.types.CipherAlgorithm;
-import org.apache.syncope.common.lib.types.ConnConfProperty;
-import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
-import org.apache.syncope.common.lib.types.PullMode;
-import org.apache.syncope.common.lib.types.TaskType;
-import org.apache.syncope.common.rest.api.beans.TaskQuery;
-import org.apache.syncope.common.rest.api.service.TaskService;
-import org.apache.syncope.core.spring.security.Encryptor;
-import org.apache.syncope.core.provisioning.java.pushpull.DBPasswordPullActions;
-import org.apache.syncope.core.provisioning.java.pushpull.LDAPPasswordPullActions;
-import org.apache.syncope.fit.core.reference.TestPullRule;
-import org.identityconnectors.framework.common.objects.Name;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = { "classpath:testJDBCEnv.xml" })
-public class PullTaskIssuesITCase extends AbstractTaskITCase {
-
- @Autowired
- private DataSource testDataSource;
-
- @Test
- public void issueSYNCOPE68() {
- //-----------------------------
- // Create a new user ... it should be updated applying pull policy
- //-----------------------------
- UserTO userTO = new UserTO();
- userTO.setRealm(SyncopeConstants.ROOT_REALM);
- userTO.setPassword("password123");
- userTO.setUsername("testuser2");
-
- userTO.getPlainAttrs().add(attrTO("firstname", "testuser2"));
- userTO.getPlainAttrs().add(attrTO("surname", "testuser2"));
- userTO.getPlainAttrs().add(attrTO("ctype", "a type"));
- userTO.getPlainAttrs().add(attrTO("fullname", "a type"));
- userTO.getPlainAttrs().add(attrTO("userId", "testuser2@syncope.apache.org"));
- userTO.getPlainAttrs().add(attrTO("email", "testuser2@syncope.apache.org"));
-
- userTO.getResources().add(RESOURCE_NAME_NOPROPAGATION2);
- userTO.getResources().add(RESOURCE_NAME_NOPROPAGATION4);
-
- userTO.getMemberships().add(
- new MembershipTO.Builder().group("bf825fe1-7320-4a54-bd64-143b5c18ab97").build());
-
- userTO = createUser(userTO).getEntity();
- assertNotNull(userTO);
- assertEquals("testuser2", userTO.getUsername());
- assertEquals(1, userTO.getMemberships().size());
- assertEquals(3, userTO.getResources().size());
- //-----------------------------
-
- try {
- //-----------------------------
- // add user template
- //-----------------------------
- UserTO template = new UserTO();
-
- template.getMemberships().add(
- new MembershipTO.Builder().group("b8d38784-57e7-4595-859a-076222644b55").build());
-
- template.getResources().add(RESOURCE_NAME_NOPROPAGATION4);
- //-----------------------------
-
- // Update pull task
- PullTaskTO task = taskService.read("81d88f73-d474-4450-9031-605daa4e313f", true);
- assertNotNull(task);
-
- task.getTemplates().put(AnyTypeKind.USER.name(), template);
-
- taskService.update(task);
- PullTaskTO actual = taskService.read(task.getKey(), true);
- assertNotNull(actual);
- assertEquals(task.getKey(), actual.getKey());
- assertFalse(actual.getTemplates().get(AnyTypeKind.USER.name()).getResources().isEmpty());
- assertFalse(((UserTO) actual.getTemplates().get(AnyTypeKind.USER.name())).getMemberships().isEmpty());
-
- ExecTO execution = execProvisioningTask(taskService, actual.getKey(), 50, false);
- assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(execution.getStatus()));
-
- userTO = userService.read("testuser2");
- assertNotNull(userTO);
- assertEquals("testuser2@syncope.apache.org", userTO.getPlainAttr("userId").getValues().get(0));
- assertEquals(2, userTO.getMemberships().size());
- assertEquals(4, userTO.getResources().size());
- } finally {
- UserTO dUserTO = deleteUser(userTO.getKey()).getEntity();
- assertNotNull(dUserTO);
- }
- }
-
- @Test
- public void issueSYNCOPE230() {
- JdbcTemplate jdbcTemplate = new JdbcTemplate(testDataSource);
-
- // 1. populate the external table
- jdbcTemplate.execute("INSERT INTO testpull VALUES"
- + "('a54b3794-b231-47be-b24a-11e1a42949f6', 'issuesyncope230', 'Surname', 'syncope230@syncope.apache.org', NULL)");
-
- // 2. execute PullTask for resource-db-pull (table TESTPULL on external H2)
- execProvisioningTask(taskService, "7c2242f4-14af-4ab5-af31-cdae23783655", 50, false);
-
- // 3. read e-mail address for user created by the PullTask first execution
- UserTO userTO = userService.read("issuesyncope230");
- assertNotNull(userTO);
- String email = userTO.getPlainAttr("email").getValues().iterator().next();
- assertNotNull(email);
-
- // 4. update TESTPULL on external H2 by changing e-mail address
- jdbcTemplate.execute("UPDATE TESTPULL SET email='updatedSYNCOPE230@syncope.apache.org'");
-
- // 5. re-execute the PullTask
- execProvisioningTask(taskService, "7c2242f4-14af-4ab5-af31-cdae23783655", 50, false);
-
- // 6. verify that the e-mail was updated
- userTO = userService.read("issuesyncope230");
- assertNotNull(userTO);
- email = userTO.getPlainAttr("email").getValues().iterator().next();
- assertNotNull(email);
- assertEquals("updatedSYNCOPE230@syncope.apache.org", email);
- }
-
- @Test
- public void issueSYNCOPE258() {
- // -----------------------------
- // Add a custom correlation rule
- // -----------------------------
- PullPolicyTO policyTO = policyService.read("9454b0d7-2610-400a-be82-fc23cf553dd6");
- policyTO.getSpecification().getCorrelationRules().put(AnyTypeKind.USER.name(), TestPullRule.class.getName());
- policyService.update(policyTO);
- // -----------------------------
-
- PullTaskTO task = new PullTaskTO();
- task.setDestinationRealm(SyncopeConstants.ROOT_REALM);
- task.setName("Test Pull Rule");
- task.setActive(true);
- task.setResource(RESOURCE_NAME_WS2);
- task.setPullMode(PullMode.FULL_RECONCILIATION);
- task.setPerformCreate(true);
- task.setPerformDelete(true);
- task.setPerformUpdate(true);
-
- Response response = taskService.create(task);
- task = getObject(response.getLocation(), TaskService.class, PullTaskTO.class);
-
- UserTO userTO = UserITCase.getUniqueSampleTO("s258_1@apache.org");
- userTO.getResources().clear();
- userTO.getResources().add(RESOURCE_NAME_WS2);
-
- createUser(userTO);
-
- userTO = UserITCase.getUniqueSampleTO("s258_2@apache.org");
- userTO.getResources().clear();
- userTO.getResources().add(RESOURCE_NAME_WS2);
-
- userTO = createUser(userTO).getEntity();
-
- // change email in order to unmatch the second user
- UserPatch userPatch = new UserPatch();
- userPatch.setKey(userTO.getKey());
- userPatch.getPlainAttrs().add(attrAddReplacePatch("email", "s258@apache.org"));
-
- userService.update(userPatch);
-
- execProvisioningTask(taskService, task.getKey(), 50, false);
-
- PullTaskTO executed = taskService.read(task.getKey(), true);
- assertEquals(1, executed.getExecutions().size());
-
- // asser for just one match
- assertTrue(executed.getExecutions().get(0).getMessage().substring(0, 55) + "...",
- executed.getExecutions().get(0).getMessage().contains("[updated/failures]: 1/0"));
- }
-
- @Test
- public void issueSYNCOPE272() {
- removeTestUsers();
-
- // create user with testdb resource
- UserTO userTO = UserITCase.getUniqueSampleTO("syncope272@syncope.apache.org");
- userTO.getResources().add(RESOURCE_NAME_TESTDB);
-
- ProvisioningResult<UserTO> result = createUser(userTO);
- userTO = result.getEntity();
- try {
- assertNotNull(userTO);
- assertEquals(1, result.getPropagationStatuses().size());
- assertEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus());
-
- ExecTO taskExecTO = execProvisioningTask(
- taskService, "986867e2-993b-430e-8feb-aa9abb4c1dcd", 50, false);
-
- assertNotNull(taskExecTO.getStatus());
- assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(taskExecTO.getStatus()));
-
- userTO = userService.read(userTO.getKey());
- assertNotNull(userTO);
- assertNotNull(userTO.getPlainAttr("firstname").getValues().get(0));
- } finally {
- removeTestUsers();
- }
- }
-
- @Test
- public void issueSYNCOPE307() {
- UserTO userTO = UserITCase.getUniqueSampleTO("s307@apache.org");
- userTO.setUsername("test0");
- userTO.getPlainAttr("firstname").getValues().clear();
- userTO.getPlainAttr("firstname").getValues().add("nome0");
- userTO.getAuxClasses().add("csv");
-
- AttrTO csvuserid = new AttrTO();
- csvuserid.setSchema("csvuserid");
- userTO.getDerAttrs().add(csvuserid);
-
- userTO.getResources().clear();
- userTO.getResources().add(RESOURCE_NAME_WS2);
-
- userTO = createUser(userTO).getEntity();
- assertNotNull(userTO);
-
- userTO = userService.read(userTO.getKey());
- assertTrue(userTO.getVirAttrs().isEmpty());
-
- // Update pull task
- PullTaskTO task = taskService.read("38abbf9e-a1a3-40a1-a15f-7d0ac02f47f1", true);
- assertNotNull(task);
-
- UserTO template = new UserTO();
- template.setPassword("'password123'");
- template.getResources().add(RESOURCE_NAME_DBVIRATTR);
- template.getVirAttrs().add(attrTO("virtualdata", "'virtualvalue'"));
-
- task.getTemplates().put(AnyTypeKind.USER.name(), template);
-
- taskService.update(task);
-
- // exec task: one user from CSV will match the user created above and template will be applied
- execProvisioningTask(taskService, task.getKey(), 50, false);
-
- // check that template was successfully applied...
- userTO = userService.read(userTO.getKey());
- assertEquals("virtualvalue", userTO.getVirAttr("virtualdata").getValues().get(0));
-
- // ...and that propagation to db succeeded
- JdbcTemplate jdbcTemplate = new JdbcTemplate(testDataSource);
- String value = queryForObject(
- jdbcTemplate, 50, "SELECT USERNAME FROM testpull WHERE ID=?", String.class, userTO.getKey());
- assertEquals("virtualvalue", value);
- }
-
- @Test
- public void issueSYNCOPE313DB() throws Exception {
- // 1. create user in DB
- UserTO user = UserITCase.getUniqueSampleTO("syncope313-db@syncope.apache.org");
- user.setPassword("security123");
- user.getResources().add(RESOURCE_NAME_TESTDB);
- user = createUser(user).getEntity();
- assertNotNull(user);
- assertFalse(user.getResources().isEmpty());
-
- // 2. Check that the DB resource has the correct password
- JdbcTemplate jdbcTemplate = new JdbcTemplate(testDataSource);
- String value = queryForObject(
- jdbcTemplate, 50, "SELECT PASSWORD FROM test WHERE ID=?", String.class, user.getUsername());
- assertEquals(Encryptor.getInstance().encode("security123", CipherAlgorithm.SHA1), value.toUpperCase());
-
- // 3. Update the password in the DB
- String newCleanPassword = "new-security";
- String newPassword = Encryptor.getInstance().encode(newCleanPassword, CipherAlgorithm.SHA1);
- jdbcTemplate.execute("UPDATE test set PASSWORD='" + newPassword + "' where ID='" + user.getUsername() + "'");
-
- // 4. Pull the user from the resource
- PullTaskTO pullTask = new PullTaskTO();
- pullTask.setDestinationRealm(SyncopeConstants.ROOT_REALM);
- pullTask.setName("DB Pull Task");
- pullTask.setActive(true);
- pullTask.setPerformCreate(true);
- pullTask.setPerformUpdate(true);
- pullTask.setPullMode(PullMode.FULL_RECONCILIATION);
- pullTask.setResource(RESOURCE_NAME_TESTDB);
- pullTask.getActionsClassNames().add(DBPasswordPullActions.class.getName());
- Response taskResponse = taskService.create(pullTask);
-
- PullTaskTO actual = getObject(taskResponse.getLocation(), TaskService.class, PullTaskTO.class);
- assertNotNull(actual);
-
- pullTask = taskService.read(actual.getKey(), true);
- assertNotNull(pullTask);
- assertEquals(actual.getKey(), pullTask.getKey());
- assertEquals(actual.getJobDelegateClassName(), pullTask.getJobDelegateClassName());
-
- ExecTO execution = execProvisioningTask(taskService, pullTask.getKey(), 50, false);
- assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(execution.getStatus()));
-
- // 5. Test the pulled user
- Pair<Map<String, Set<String>>, UserTO> self = clientFactory.create(user.getUsername(), newCleanPassword).self();
- assertNotNull(self);
-
- // 6. Delete PullTask + user
- taskService.delete(pullTask.getKey());
- deleteUser(user.getKey());
- }
-
- @Test
- public void issueSYNCOPE313LDAP() throws Exception {
- // First of all, clear any potential conflict with existing user / group
- ldapCleanup();
-
- UserTO user = null;
- PullTaskTO pullTask = null;
- ConnInstanceTO resourceConnector = null;
- ConnConfProperty property = null;
- try {
- // 1. create user in LDAP
- String oldCleanPassword = "security123";
- user = UserITCase.getUniqueSampleTO("syncope313-ldap@syncope.apache.org");
- user.setPassword(oldCleanPassword);
- user.getResources().add(RESOURCE_NAME_LDAP);
- user = createUser(user).getEntity();
- assertNotNull(user);
- assertFalse(user.getResources().isEmpty());
-
- // 2. request to change password only on Syncope and not on LDAP
- String newCleanPassword = "new-security123";
- UserPatch userPatch = new UserPatch();
- userPatch.setKey(user.getKey());
- userPatch.setPassword(new PasswordPatch.Builder().value(newCleanPassword).build());
- user = updateUser(userPatch).getEntity();
-
- // 3. Check that the Syncope user now has the changed password
- Pair<Map<String, Set<String>>, UserTO> self =
- clientFactory.create(user.getUsername(), newCleanPassword).self();
- assertNotNull(self);
-
- // 4. Check that the LDAP resource has the old password
- ConnObjectTO connObject =
- resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.USER.name(), user.getKey());
- assertNotNull(getLdapRemoteObject(
- connObject.getAttr(Name.NAME).getValues().get(0),
- oldCleanPassword,
- connObject.getAttr(Name.NAME).getValues().get(0)));
-
- // 5. Update the LDAP Connector to retrieve passwords
- ResourceTO ldapResource = resourceService.read(RESOURCE_NAME_LDAP);
- resourceConnector = connectorService.read(
- ldapResource.getConnector(), Locale.ENGLISH.getLanguage());
- property = resourceConnector.getConfMap().get("retrievePasswordsWithSearch");
- property.getValues().clear();
- property.getValues().add(Boolean.TRUE);
- connectorService.update(resourceConnector);
-
- // 6. Pull the user from the resource
- pullTask = new PullTaskTO();
- pullTask.setDestinationRealm(SyncopeConstants.ROOT_REALM);
- pullTask.setName("LDAP Pull Task");
- pullTask.setActive(true);
- pullTask.setPerformCreate(true);
- pullTask.setPerformUpdate(true);
- pullTask.setPullMode(PullMode.FULL_RECONCILIATION);
- pullTask.setResource(RESOURCE_NAME_LDAP);
- pullTask.getActionsClassNames().add(LDAPPasswordPullActions.class.getName());
- Response taskResponse = taskService.create(pullTask);
-
- pullTask = getObject(taskResponse.getLocation(), TaskService.class, PullTaskTO.class);
- assertNotNull(pullTask);
-
- ExecTO execution = execProvisioningTask(taskService, pullTask.getKey(), 50, false);
- assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(execution.getStatus()));
-
- // 7. Test the pulled user
- self = clientFactory.create(user.getUsername(), oldCleanPassword).self();
- assertNotNull(self);
- } catch (Exception e) {
- fail(e.getMessage());
- } finally {
- // Delete PullTask + user + reset the connector
- if (pullTask != null) {
- taskService.delete(pullTask.getKey());
- }
-
- if (resourceConnector != null && property != null) {
- property.getValues().clear();
- property.getValues().add(Boolean.FALSE);
- connectorService.update(resourceConnector);
- }
-
- if (user != null) {
- deleteUser(user.getKey());
- }
- }
- }
-
- @Test
- public void issueSYNCOPE1062() {
- GroupTO propagationGroup = null;
- PullTaskTO pullTask = null;
- UserTO user = null;
- GroupTO group = null;
- try {
- // 1. create group with resource for propagation
- propagationGroup = GroupITCase.getBasicSampleTO("SYNCOPE1062");
- propagationGroup.getResources().add(RESOURCE_NAME_DBPULL);
- propagationGroup = createGroup(propagationGroup).getEntity();
-
- // 2. create pull task for another resource, with user template assigning the group above
- pullTask = new PullTaskTO();
- pullTask.setDestinationRealm(SyncopeConstants.ROOT_REALM);
- pullTask.setName("SYNCOPE1062");
- pullTask.setActive(true);
- pullTask.setPerformCreate(true);
- pullTask.setPerformUpdate(true);
- pullTask.setPullMode(PullMode.FULL_RECONCILIATION);
- pullTask.setResource(RESOURCE_NAME_LDAP);
-
- UserTO template = new UserTO();
- template.getAuxClasses().add("minimal group");
- template.getMemberships().add(new MembershipTO.Builder().group(propagationGroup.getKey()).build());
- template.getPlainAttrs().add(attrTO("firstname", "'fixed'"));
- pullTask.getTemplates().put(AnyTypeKind.USER.name(), template);
-
- Response taskResponse = taskService.create(pullTask);
- pullTask = getObject(taskResponse.getLocation(), TaskService.class, PullTaskTO.class);
- assertNotNull(pullTask);
- assertFalse(pullTask.getTemplates().isEmpty());
-
- // 3. exec the pull task
- ExecTO execution = execProvisioningTask(taskService, pullTask.getKey(), 50, false);
- assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(execution.getStatus()));
-
- // the user is successfully pulled...
- user = userService.read("pullFromLDAP");
- assertNotNull(user);
- assertEquals("pullFromLDAP@syncope.apache.org", user.getPlainAttr("email").getValues().get(0));
-
- group = groupService.read("testLDAPGroup");
- assertNotNull(group);
-
- ConnObjectTO connObject =
- resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.USER.name(), user.getKey());
- assertNotNull(connObject);
- assertEquals("pullFromLDAP@syncope.apache.org", connObject.getAttr("mail").getValues().get(0));
- AttrTO userDn = connObject.getAttr(Name.NAME);
- assertNotNull(userDn);
- assertEquals(1, userDn.getValues().size());
- assertNotNull(
- getLdapRemoteObject(RESOURCE_LDAP_ADMIN_DN, RESOURCE_LDAP_ADMIN_PWD, userDn.getValues().get(0)));
-
- // ...and propagated
- PagedResult<AbstractTaskTO> propagationTasks = taskService.list(new TaskQuery.Builder(TaskType.PROPAGATION).
- resource(RESOURCE_NAME_DBPULL).
- anyTypeKind(AnyTypeKind.USER).entityKey(user.getKey()).build());
- assertEquals(1, propagationTasks.getSize());
-
- // 4. update the user on the external resource
- updateLdapRemoteObject(RESOURCE_LDAP_ADMIN_DN, RESOURCE_LDAP_ADMIN_PWD,
- userDn.getValues().get(0), Pair.of("mail", "pullFromLDAP2@syncope.apache.org"));
-
- connObject = resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.USER.name(), user.getKey());
- assertNotNull(connObject);
- assertEquals("pullFromLDAP2@syncope.apache.org", connObject.getAttr("mail").getValues().get(0));
-
- // 5. exec the pull task again
- execution = execProvisioningTask(taskService, pullTask.getKey(), 50, false);
- assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(execution.getStatus()));
-
- // the internal is updated...
- user = userService.read("pullFromLDAP");
- assertNotNull(user);
- assertEquals("pullFromLDAP2@syncope.apache.org", user.getPlainAttr("email").getValues().get(0));
-
- // ...and propagated
- propagationTasks = taskService.list(new TaskQuery.Builder(TaskType.PROPAGATION).
- resource(RESOURCE_NAME_DBPULL).
- anyTypeKind(AnyTypeKind.USER).entityKey(user.getKey()).build());
- assertEquals(2, propagationTasks.getSize());
- } catch (Exception e) {
- LOG.error("Unexpected during issueSYNCOPE1062()", e);
- fail(e.getMessage());
- } finally {
- if (pullTask != null) {
- taskService.delete(pullTask.getKey());
- }
-
- if (propagationGroup != null) {
- groupService.delete(propagationGroup.getKey());
- }
-
- if (group != null) {
- groupService.delete(group.getKey());
- }
- if (user != null) {
- userService.delete(user.getKey());
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/152f18b8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PushTaskITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PushTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PushTaskITCase.java
index f1d1a22..eb35e65 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PushTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PushTaskITCase.java
@@ -31,16 +31,32 @@ import javax.sql.DataSource;
import javax.ws.rs.core.Response;
import org.apache.syncope.client.lib.SyncopeClient;
import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.AnyTypeClassTO;
import org.apache.syncope.common.lib.to.PagedResult;
import org.apache.syncope.common.lib.to.PushTaskTO;
import org.apache.syncope.common.lib.to.ExecTO;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.MappingItemTO;
+import org.apache.syncope.common.lib.to.MappingTO;
+import org.apache.syncope.common.lib.to.NotificationTO;
+import org.apache.syncope.common.lib.to.NotificationTaskTO;
+import org.apache.syncope.common.lib.to.PlainSchemaTO;
+import org.apache.syncope.common.lib.to.ProvisionTO;
+import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.syncope.common.lib.types.AnyTypeKind;
+import org.apache.syncope.common.lib.types.AttrSchemaType;
+import org.apache.syncope.common.lib.types.MappingPurpose;
import org.apache.syncope.common.lib.types.MatchingRule;
import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
+import org.apache.syncope.common.lib.types.SchemaType;
import org.apache.syncope.common.lib.types.TaskType;
+import org.apache.syncope.common.lib.types.TraceLevel;
import org.apache.syncope.common.lib.types.UnmatchingRule;
import org.apache.syncope.common.rest.api.beans.TaskQuery;
+import org.apache.syncope.common.rest.api.service.NotificationService;
+import org.apache.syncope.common.rest.api.service.ResourceService;
import org.apache.syncope.common.rest.api.service.TaskService;
+import org.identityconnectors.framework.common.objects.ObjectClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -281,4 +297,136 @@ public class PushTaskITCase extends AbstractTaskITCase {
assertNotNull(getLdapRemoteObject(RESOURCE_LDAP_ADMIN_DN, RESOURCE_LDAP_ADMIN_PWD, "ou=even,o=isp"));
assertNotNull(getLdapRemoteObject(RESOURCE_LDAP_ADMIN_DN, RESOURCE_LDAP_ADMIN_PWD, "ou=two,ou=even,o=isp"));
}
+
+ @Test
+ public void issueSYNCOPE598() {
+ // create a new group schema
+ PlainSchemaTO schemaTO = new PlainSchemaTO();
+ schemaTO.setKey("LDAPGroupName" + getUUIDString());
+ schemaTO.setType(AttrSchemaType.String);
+ schemaTO.setMandatoryCondition("true");
+
+ schemaTO = createSchema(SchemaType.PLAIN, schemaTO);
+ assertNotNull(schemaTO);
+
+ AnyTypeClassTO typeClass = new AnyTypeClassTO();
+ typeClass.setKey("SYNCOPE-598" + getUUIDString());
+ typeClass.getPlainSchemas().add(schemaTO.getKey());
+ anyTypeClassService.create(typeClass);
+
+ // create a new sample group
+ GroupTO groupTO = new GroupTO();
+ groupTO.setName("all" + getUUIDString());
+ groupTO.setRealm("/even");
+ groupTO.getAuxClasses().add(typeClass.getKey());
+
+ groupTO.getPlainAttrs().add(attrTO(schemaTO.getKey(), "all"));
+
+ groupTO = createGroup(groupTO).getEntity();
+ assertNotNull(groupTO);
+
+ String resourceName = "resource-ldap-grouponly";
+ ResourceTO newResourceTO = null;
+
+ try {
+ // Create resource ad-hoc
+ ResourceTO resourceTO = new ResourceTO();
+ resourceTO.setKey(resourceName);
+ resourceTO.setConnector("74141a3b-0762-4720-a4aa-fc3e374ef3ef");
+
+ ProvisionTO provisionTO = new ProvisionTO();
+ provisionTO.setAnyType(AnyTypeKind.GROUP.name());
+ provisionTO.setObjectClass(ObjectClass.GROUP_NAME);
+ provisionTO.getAuxClasses().add(typeClass.getKey());
+ resourceTO.getProvisions().add(provisionTO);
+
+ MappingTO mapping = new MappingTO();
+ provisionTO.setMapping(mapping);
+
+ MappingItemTO item = new MappingItemTO();
+ item.setExtAttrName("cn");
+ item.setIntAttrName(schemaTO.getKey());
+ item.setConnObjectKey(true);
+ item.setPurpose(MappingPurpose.BOTH);
+ mapping.setConnObjectKeyItem(item);
+
+ mapping.setConnObjectLink("'cn=' + " + schemaTO.getKey() + " + ',ou=groups,o=isp'");
+
+ Response response = resourceService.create(resourceTO);
+ newResourceTO = getObject(response.getLocation(), ResourceService.class, ResourceTO.class);
+ assertNotNull(newResourceTO);
+ assertNull(newResourceTO.getProvision(AnyTypeKind.USER.name()));
+ assertNotNull(newResourceTO.getProvision(AnyTypeKind.GROUP.name()).getMapping());
+
+ // create push task ad-hoc
+ PushTaskTO task = new PushTaskTO();
+ task.setName("issueSYNCOPE598");
+ task.setActive(true);
+ task.setResource(resourceName);
+ task.setPerformCreate(true);
+ task.setPerformDelete(true);
+ task.setPerformUpdate(true);
+ task.setUnmatchingRule(UnmatchingRule.ASSIGN);
+ task.setMatchingRule(MatchingRule.UPDATE);
+ task.getFilters().put(AnyTypeKind.GROUP.name(),
+ SyncopeClient.getGroupSearchConditionBuilder().is("name").equalTo(groupTO.getName()).query());
+
+ response = taskService.create(task);
+ PushTaskTO push = getObject(response.getLocation(), TaskService.class, PushTaskTO.class);
+ assertNotNull(push);
+
+ // execute the new task
+ ExecTO exec = execProvisioningTask(taskService, push.getKey(), 50, false);
+ assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(exec.getStatus()));
+ } finally {
+ groupService.delete(groupTO.getKey());
+ if (newResourceTO != null) {
+ resourceService.delete(resourceName);
+ }
+ }
+ }
+
+ @Test
+ public void issueSYNCOPE648() {
+ // 1. Create Push Task
+ PushTaskTO task = new PushTaskTO();
+ task.setName("Test create Push");
+ task.setActive(true);
+ task.setResource(RESOURCE_NAME_LDAP);
+ task.getFilters().put(AnyTypeKind.USER.name(),
+ SyncopeClient.getUserSearchConditionBuilder().is("username").equalTo("_NO_ONE_").query());
+ task.getFilters().put(AnyTypeKind.GROUP.name(),
+ SyncopeClient.getGroupSearchConditionBuilder().is("name").equalTo("citizen").query());
+ task.setMatchingRule(MatchingRule.IGNORE);
+ task.setUnmatchingRule(UnmatchingRule.IGNORE);
+
+ Response response = taskService.create(task);
+ PushTaskTO actual = getObject(response.getLocation(), TaskService.class, PushTaskTO.class);
+ assertNotNull(actual);
+
+ // 2. Create notification
+ NotificationTO notification = new NotificationTO();
+ notification.setTraceLevel(TraceLevel.FAILURES);
+ notification.getEvents().add("[PushTask]:[group]:[resource-ldap]:[matchingrule_ignore]:[SUCCESS]");
+ notification.getEvents().add("[PushTask]:[group]:[resource-ldap]:[unmatchingrule_ignore]:[SUCCESS]");
+
+ notification.getStaticRecipients().add("issueyncope648@syncope.apache.org");
+ notification.setSelfAsRecipient(false);
+ notification.setRecipientAttrName("email");
+
+ notification.setSender("syncope648@syncope.apache.org");
+ String subject = "Test notification";
+ notification.setSubject(subject);
+ notification.setTemplate("optin");
+ notification.setActive(true);
+
+ Response responseNotification = notificationService.create(notification);
+ notification = getObject(responseNotification.getLocation(), NotificationService.class, NotificationTO.class);
+ assertNotNull(notification);
+
+ execProvisioningTask(taskService, actual.getKey(), 50, false);
+
+ NotificationTaskTO taskTO = findNotificationTask(notification.getKey(), 50);
+ assertNotNull(taskTO);
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/152f18b8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PushTaskIssuesITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PushTaskIssuesITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PushTaskIssuesITCase.java
deleted file mode 100644
index 95d648e..0000000
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PushTaskIssuesITCase.java
+++ /dev/null
@@ -1,185 +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;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import javax.ws.rs.core.Response;
-import org.apache.syncope.client.lib.SyncopeClient;
-import org.apache.syncope.common.lib.to.AnyTypeClassTO;
-import org.apache.syncope.common.lib.to.MappingItemTO;
-import org.apache.syncope.common.lib.to.MappingTO;
-import org.apache.syncope.common.lib.to.NotificationTO;
-import org.apache.syncope.common.lib.to.NotificationTaskTO;
-import org.apache.syncope.common.lib.to.PlainSchemaTO;
-import org.apache.syncope.common.lib.to.PushTaskTO;
-import org.apache.syncope.common.lib.to.ResourceTO;
-import org.apache.syncope.common.lib.to.GroupTO;
-import org.apache.syncope.common.lib.to.ProvisionTO;
-import org.apache.syncope.common.lib.to.ExecTO;
-import org.apache.syncope.common.lib.types.AnyTypeKind;
-import org.apache.syncope.common.lib.types.AttrSchemaType;
-import org.apache.syncope.common.lib.types.MappingPurpose;
-import org.apache.syncope.common.lib.types.MatchingRule;
-import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
-import org.apache.syncope.common.lib.types.SchemaType;
-import org.apache.syncope.common.lib.types.TraceLevel;
-import org.apache.syncope.common.lib.types.UnmatchingRule;
-import org.apache.syncope.common.rest.api.service.NotificationService;
-import org.apache.syncope.common.rest.api.service.ResourceService;
-import org.apache.syncope.common.rest.api.service.TaskService;
-import org.identityconnectors.framework.common.objects.ObjectClass;
-import org.junit.Test;
-
-public class PushTaskIssuesITCase extends AbstractTaskITCase {
-
- @Test
- public void issueSYNCOPE598() {
- // create a new group schema
- PlainSchemaTO schemaTO = new PlainSchemaTO();
- schemaTO.setKey("LDAPGroupName" + getUUIDString());
- schemaTO.setType(AttrSchemaType.String);
- schemaTO.setMandatoryCondition("true");
-
- schemaTO = createSchema(SchemaType.PLAIN, schemaTO);
- assertNotNull(schemaTO);
-
- AnyTypeClassTO typeClass = new AnyTypeClassTO();
- typeClass.setKey("SYNCOPE-598" + getUUIDString());
- typeClass.getPlainSchemas().add(schemaTO.getKey());
- anyTypeClassService.create(typeClass);
-
- // create a new sample group
- GroupTO groupTO = new GroupTO();
- groupTO.setName("all" + getUUIDString());
- groupTO.setRealm("/even");
- groupTO.getAuxClasses().add(typeClass.getKey());
-
- groupTO.getPlainAttrs().add(attrTO(schemaTO.getKey(), "all"));
-
- groupTO = createGroup(groupTO).getEntity();
- assertNotNull(groupTO);
-
- String resourceName = "resource-ldap-grouponly";
- ResourceTO newResourceTO = null;
-
- try {
- // Create resource ad-hoc
- ResourceTO resourceTO = new ResourceTO();
- resourceTO.setKey(resourceName);
- resourceTO.setConnector("74141a3b-0762-4720-a4aa-fc3e374ef3ef");
-
- ProvisionTO provisionTO = new ProvisionTO();
- provisionTO.setAnyType(AnyTypeKind.GROUP.name());
- provisionTO.setObjectClass(ObjectClass.GROUP_NAME);
- provisionTO.getAuxClasses().add(typeClass.getKey());
- resourceTO.getProvisions().add(provisionTO);
-
- MappingTO mapping = new MappingTO();
- provisionTO.setMapping(mapping);
-
- MappingItemTO item = new MappingItemTO();
- item.setExtAttrName("cn");
- item.setIntAttrName(schemaTO.getKey());
- item.setConnObjectKey(true);
- item.setPurpose(MappingPurpose.BOTH);
- mapping.setConnObjectKeyItem(item);
-
- mapping.setConnObjectLink("'cn=' + " + schemaTO.getKey() + " + ',ou=groups,o=isp'");
-
- Response response = resourceService.create(resourceTO);
- newResourceTO = getObject(response.getLocation(), ResourceService.class, ResourceTO.class);
- assertNotNull(newResourceTO);
- assertNull(newResourceTO.getProvision(AnyTypeKind.USER.name()));
- assertNotNull(newResourceTO.getProvision(AnyTypeKind.GROUP.name()).getMapping());
-
- // create push task ad-hoc
- PushTaskTO task = new PushTaskTO();
- task.setName("issueSYNCOPE598");
- task.setActive(true);
- task.setResource(resourceName);
- task.setPerformCreate(true);
- task.setPerformDelete(true);
- task.setPerformUpdate(true);
- task.setUnmatchingRule(UnmatchingRule.ASSIGN);
- task.setMatchingRule(MatchingRule.UPDATE);
- task.getFilters().put(AnyTypeKind.GROUP.name(),
- SyncopeClient.getGroupSearchConditionBuilder().is("name").equalTo(groupTO.getName()).query());
-
- response = taskService.create(task);
- PushTaskTO push = getObject(response.getLocation(), TaskService.class, PushTaskTO.class);
- assertNotNull(push);
-
- // execute the new task
- ExecTO exec = execProvisioningTask(taskService, push.getKey(), 50, false);
- assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(exec.getStatus()));
- } finally {
- groupService.delete(groupTO.getKey());
- if (newResourceTO != null) {
- resourceService.delete(resourceName);
- }
- }
- }
-
- @Test
- public void issueSYNCOPE648() {
- // 1. Create Push Task
- PushTaskTO task = new PushTaskTO();
- task.setName("Test create Push");
- task.setActive(true);
- task.setResource(RESOURCE_NAME_LDAP);
- task.getFilters().put(AnyTypeKind.USER.name(),
- SyncopeClient.getUserSearchConditionBuilder().is("username").equalTo("_NO_ONE_").query());
- task.getFilters().put(AnyTypeKind.GROUP.name(),
- SyncopeClient.getGroupSearchConditionBuilder().is("name").equalTo("citizen").query());
- task.setMatchingRule(MatchingRule.IGNORE);
- task.setUnmatchingRule(UnmatchingRule.IGNORE);
-
- Response response = taskService.create(task);
- PushTaskTO actual = getObject(response.getLocation(), TaskService.class, PushTaskTO.class);
- assertNotNull(actual);
-
- // 2. Create notification
- NotificationTO notification = new NotificationTO();
- notification.setTraceLevel(TraceLevel.FAILURES);
- notification.getEvents().add("[PushTask]:[group]:[resource-ldap]:[matchingrule_ignore]:[SUCCESS]");
- notification.getEvents().add("[PushTask]:[group]:[resource-ldap]:[unmatchingrule_ignore]:[SUCCESS]");
-
- notification.getStaticRecipients().add("issueyncope648@syncope.apache.org");
- notification.setSelfAsRecipient(false);
- notification.setRecipientAttrName("email");
-
- notification.setSender("syncope648@syncope.apache.org");
- String subject = "Test notification";
- notification.setSubject(subject);
- notification.setTemplate("optin");
- notification.setActive(true);
-
- Response responseNotification = notificationService.create(notification);
- notification = getObject(responseNotification.getLocation(), NotificationService.class, NotificationTO.class);
- assertNotNull(notification);
-
- execProvisioningTask(taskService, actual.getKey(), 50, false);
-
- NotificationTaskTO taskTO = findNotificationTask(notification.getKey(), 50);
- assertNotNull(taskTO);
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/152f18b8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java
index abd746c..530a377 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java
@@ -275,4 +275,61 @@ public class ReportITCase extends AbstractITCase {
loggerService.delete(LoggerType.AUDIT, auditLoggerName.toLoggerName());
}
}
+
+ @Test
+ public void issueSYNCOPE43() {
+ ReportTO reportTO = new ReportTO();
+ reportTO.setName("issueSYNCOPE43" + getUUIDString());
+ reportTO.setActive(true);
+ reportTO.setTemplate("sample");
+ reportTO = createReport(reportTO);
+ assertNotNull(reportTO);
+
+ ExecTO execution = reportService.execute(new ExecuteQuery.Builder().key(reportTO.getKey()).build());
+ assertNotNull(execution);
+
+ int maxit = 50;
+ do {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ }
+
+ reportTO = reportService.read(reportTO.getKey());
+
+ maxit--;
+ } while (reportTO.getExecutions().isEmpty() && maxit > 0);
+
+ assertEquals(1, reportTO.getExecutions().size());
+ }
+
+ @Test
+ public void issueSYNCOPE102() throws IOException {
+ // Create
+ ReportTO reportTO = reportService.read("0062ea9c-924d-4ecf-9961-4492a8cc6d1b");
+ reportTO.setKey(null);
+ reportTO.setName("issueSYNCOPE102" + getUUIDString());
+ reportTO = createReport(reportTO);
+ assertNotNull(reportTO);
+
+ // Execute (multiple requests)
+ for (int i = 0; i < 10; i++) {
+ ExecTO execution = reportService.execute(new ExecuteQuery.Builder().key(reportTO.getKey()).build());
+ assertNotNull(execution);
+ }
+
+ // Wait for one execution
+ int maxit = 50;
+ do {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ }
+
+ reportTO = reportService.read(reportTO.getKey());
+
+ maxit--;
+ } while (reportTO.getExecutions().isEmpty() && maxit > 0);
+ assertFalse(reportTO.getExecutions().isEmpty());
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/152f18b8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportIssuesITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportIssuesITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportIssuesITCase.java
deleted file mode 100644
index fb0d845..0000000
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportIssuesITCase.java
+++ /dev/null
@@ -1,90 +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;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.IOException;
-import org.apache.syncope.common.lib.to.ExecTO;
-import org.apache.syncope.common.lib.to.ReportTO;
-import org.apache.syncope.common.rest.api.beans.ExecuteQuery;
-import org.apache.syncope.fit.AbstractITCase;
-import org.junit.Test;
-
-public class ReportIssuesITCase extends AbstractITCase {
-
- @Test
- public void issueSYNCOPE43() {
- ReportTO reportTO = new ReportTO();
- reportTO.setName("issueSYNCOPE43" + getUUIDString());
- reportTO.setActive(true);
- reportTO.setTemplate("sample");
- reportTO = createReport(reportTO);
- assertNotNull(reportTO);
-
- ExecTO execution = reportService.execute(new ExecuteQuery.Builder().key(reportTO.getKey()).build());
- assertNotNull(execution);
-
- int maxit = 50;
- do {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- }
-
- reportTO = reportService.read(reportTO.getKey());
-
- maxit--;
- } while (reportTO.getExecutions().isEmpty() && maxit > 0);
-
- assertEquals(1, reportTO.getExecutions().size());
- }
-
- @Test
- public void issueSYNCOPE102() throws IOException {
- // Create
- ReportTO reportTO = reportService.read("0062ea9c-924d-4ecf-9961-4492a8cc6d1b");
- reportTO.setKey(null);
- reportTO.setName("issueSYNCOPE102" + getUUIDString());
- reportTO = createReport(reportTO);
- assertNotNull(reportTO);
-
- // Execute (multiple requests)
- for (int i = 0; i < 10; i++) {
- ExecTO execution = reportService.execute(new ExecuteQuery.Builder().key(reportTO.getKey()).build());
- assertNotNull(execution);
- }
-
- // Wait for one execution
- int maxit = 50;
- do {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- }
-
- reportTO = reportService.read(reportTO.getKey());
-
- maxit--;
- } while (reportTO.getExecutions().isEmpty() && maxit > 0);
- assertFalse(reportTO.getExecutions().isEmpty());
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/152f18b8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java
index 3ba48e8..bab61df 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java
@@ -187,7 +187,6 @@ public class UserITCase extends AbstractITCase {
}
userTO.getAuxClasses().add("csv");
- userTO.getDerAttrs().add(new AttrTO.Builder().schema("csvuserid").build());
userTO = createUser(userTO).getEntity();
assertNotNull(userTO);
@@ -810,7 +809,6 @@ public class UserITCase extends AbstractITCase {
public void updateMultivalueAttribute() {
UserTO userTO = getUniqueSampleTO("multivalue@syncope.apache.org");
userTO.getResources().clear();
- userTO.getDerAttrs().clear();
userTO.getVirAttrs().clear();
userTO = createUser(userTO).getEntity();
@@ -893,11 +891,9 @@ public class UserITCase extends AbstractITCase {
UserTO userTO = getUniqueSampleTO("checkGroupAttrPropagation@syncope.apache.org");
userTO.getResources().clear();
userTO.getMemberships().clear();
- userTO.getDerAttrs().clear();
userTO.getVirAttrs().clear();
userTO.getAuxClasses().add("csv");
- userTO.getDerAttrs().add(attrTO("csvuserid", null));
userTO.getMemberships().add(new MembershipTO.Builder().
group("37d15e4c-cdc1-460b-a591-8505c8133806").build());
@@ -1027,10 +1023,8 @@ public class UserITCase extends AbstractITCase {
UserTO userTO = getUniqueSampleTO("unlink@syncope.apache.org");
userTO.getResources().clear();
userTO.getMemberships().clear();
- userTO.getDerAttrs().clear();
userTO.getVirAttrs().clear();
userTO.getAuxClasses().add("csv");
- userTO.getDerAttrs().add(attrTO("csvuserid", null));
userTO.getResources().add(RESOURCE_NAME_CSV);
UserTO actual = createUser(userTO).getEntity();
@@ -1056,10 +1050,8 @@ public class UserITCase extends AbstractITCase {
UserTO userTO = getUniqueSampleTO("link@syncope.apache.org");
userTO.getResources().clear();
userTO.getMemberships().clear();
- userTO.getDerAttrs().clear();
userTO.getVirAttrs().clear();
userTO.getAuxClasses().add("csv");
- userTO.getDerAttrs().add(attrTO("csvuserid", null));
UserTO actual = createUser(userTO).getEntity();
assertNotNull(actual);
@@ -1096,10 +1088,8 @@ public class UserITCase extends AbstractITCase {
UserTO userTO = getUniqueSampleTO("unassign@syncope.apache.org");
userTO.getResources().clear();
userTO.getMemberships().clear();
- userTO.getDerAttrs().clear();
userTO.getVirAttrs().clear();
userTO.getAuxClasses().add("csv");
- userTO.getDerAttrs().add(attrTO("csvuserid", null));
userTO.getResources().add(RESOURCE_NAME_CSV);
UserTO actual = createUser(userTO).getEntity();
@@ -1130,10 +1120,8 @@ public class UserITCase extends AbstractITCase {
UserTO userTO = getUniqueSampleTO("assign@syncope.apache.org");
userTO.getResources().clear();
userTO.getMemberships().clear();
- userTO.getDerAttrs().clear();
userTO.getVirAttrs().clear();
userTO.getAuxClasses().add("csv");
- userTO.getDerAttrs().add(attrTO("csvuserid", null));
UserTO actual = createUser(userTO).getEntity();
assertNotNull(actual);
@@ -1165,10 +1153,8 @@ public class UserITCase extends AbstractITCase {
UserTO userTO = getUniqueSampleTO("deprovision@syncope.apache.org");
userTO.getResources().clear();
userTO.getMemberships().clear();
- userTO.getDerAttrs().clear();
userTO.getVirAttrs().clear();
userTO.getAuxClasses().add("csv");
- userTO.getDerAttrs().add(attrTO("csvuserid", null));
userTO.getResources().add(RESOURCE_NAME_CSV);
UserTO actual = createUser(userTO).getEntity();
@@ -1199,10 +1185,8 @@ public class UserITCase extends AbstractITCase {
UserTO userTO = getUniqueSampleTO("provision@syncope.apache.org");
userTO.getResources().clear();
userTO.getMemberships().clear();
- userTO.getDerAttrs().clear();
userTO.getVirAttrs().clear();
userTO.getAuxClasses().add("csv");
- userTO.getDerAttrs().add(attrTO("csvuserid", null));
UserTO actual = createUser(userTO).getEntity();
assertNotNull(actual);
@@ -1234,10 +1218,8 @@ public class UserITCase extends AbstractITCase {
UserTO userTO = getUniqueSampleTO("provision@syncope.apache.org");
userTO.getResources().clear();
userTO.getMemberships().clear();
- userTO.getDerAttrs().clear();
userTO.getVirAttrs().clear();
userTO.getAuxClasses().add("csv");
- userTO.getDerAttrs().add(attrTO("csvuserid", null));
UserTO actual = createUser(userTO).getEntity();
assertNotNull(actual);
http://git-wip-us.apache.org/repos/asf/syncope/blob/152f18b8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserIssuesITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserIssuesITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserIssuesITCase.java
index 499b24c..a1ddb44 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserIssuesITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserIssuesITCase.java
@@ -194,7 +194,6 @@ public class UserIssuesITCase extends AbstractITCase {
UserTO userTO = UserITCase.getUniqueSampleTO("issue280@syncope.apache.org");
userTO.getResources().clear();
userTO.getMemberships().clear();
- userTO.getDerAttrs().clear();
userTO = createUser(userTO).getEntity();
assertNotNull(userTO);
@@ -224,7 +223,6 @@ public class UserIssuesITCase extends AbstractITCase {
UserTO userTO = UserITCase.getUniqueSampleTO("issue281@syncope.apache.org");
userTO.getResources().clear();
userTO.getMemberships().clear();
- userTO.getDerAttrs().clear();
userTO.getResources().add(RESOURCE_NAME_CSV);
ProvisioningResult<UserTO> result = createUser(userTO);
@@ -257,10 +255,8 @@ public class UserIssuesITCase extends AbstractITCase {
UserTO userTO = UserITCase.getUniqueSampleTO("syncope108@syncope.apache.org");
userTO.getResources().clear();
userTO.getMemberships().clear();
- userTO.getDerAttrs().clear();
userTO.getVirAttrs().clear();
userTO.getAuxClasses().add("csv");
- userTO.getDerAttrs().add(attrTO("csvuserid", null));
userTO.getMemberships().add(new MembershipTO.Builder().
group("0626100b-a4ba-4e00-9971-86fad52a6216").build());
@@ -1064,7 +1060,6 @@ public class UserIssuesITCase extends AbstractITCase {
userTO.getPlainAttrs().add(attrTO("surname", "cognome0"));
userTO.getPlainAttrs().add(attrTO("userId", "syncope391@syncope.apache.org"));
userTO.getPlainAttrs().add(attrTO("email", "syncope391@syncope.apache.org"));
- userTO.getDerAttrs().add(attrTO("csvuserid", null));
userTO.getAuxClasses().add("csv");
userTO.getResources().add(RESOURCE_NAME_CSV);
@@ -1083,10 +1078,8 @@ public class UserIssuesITCase extends AbstractITCase {
// Syncope local storage
userTO = UserITCase.getUniqueSampleTO("syncope391@syncope.apache.org");
userTO.setPassword("passwordTESTNULL1");
- userTO.getDerAttrs().clear();
userTO.getVirAttrs().clear();
userTO.getAuxClasses().add("csv");
- userTO.getDerAttrs().add(attrTO("csvuserid", null));
userTO.getResources().add(RESOURCE_NAME_CSV);
userTO = createUser(userTO, false).getEntity();
@@ -1103,10 +1096,8 @@ public class UserIssuesITCase extends AbstractITCase {
// 4. create user and propagate password on resource-csv and on Syncope local storage
userTO = UserITCase.getUniqueSampleTO("syncope391@syncope.apache.org");
userTO.setPassword("passwordTESTNULL1");
- userTO.getDerAttrs().clear();
userTO.getVirAttrs().clear();
userTO.getAuxClasses().add("csv");
- userTO.getDerAttrs().add(attrTO("csvuserid", null));
userTO.getResources().add(RESOURCE_NAME_CSV);
// storePassword true by default
@@ -1133,10 +1124,8 @@ public class UserIssuesITCase extends AbstractITCase {
userTO = UserITCase.getUniqueSampleTO("syncope391@syncope.apache.org");
userTO.setPassword(null);
- userTO.getDerAttrs().clear();
userTO.getVirAttrs().clear();
userTO.getAuxClasses().add("csv");
- userTO.getDerAttrs().add(attrTO("csvuserid", null));
userTO.getResources().add(RESOURCE_NAME_CSV);
createUser(userTO, false);
@@ -1156,10 +1145,8 @@ public class UserIssuesITCase extends AbstractITCase {
UserTO userTO = UserITCase.getUniqueSampleTO("syncope647@syncope.apache.org");
userTO.getResources().clear();
userTO.getMemberships().clear();
- userTO.getDerAttrs().clear();
userTO.getVirAttrs().clear();
userTO.getAuxClasses().add("csv");
- userTO.getDerAttrs().add(attrTO("csvuserid", null));
userTO.getAuxClasses().add("generic membership");
userTO.getPlainAttrs().add(attrTO("postalAddress", "postalAddress"));
http://git-wip-us.apache.org/repos/asf/syncope/blob/152f18b8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/VirAttrITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/VirAttrITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/VirAttrITCase.java
index e310181..933cc99 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/VirAttrITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/VirAttrITCase.java
@@ -310,11 +310,8 @@ public class VirAttrITCase extends AbstractITCase {
userTO.getAuxClasses().add(newClass.getKey());
userTO.getResources().clear();
userTO.getMemberships().clear();
- userTO.getDerAttrs().clear();
- userTO.getVirAttrs().clear();
- userTO.getDerAttrs().add(attrTO("csvuserid", null));
- userTO.getDerAttrs().add(attrTO("cn", null));
+ userTO.getVirAttrs().clear();
userTO.getVirAttrs().add(attrTO(virSchema.getKey(), "test@testone.org"));
// assign resource-csv to user
userTO.getResources().add(RESOURCE_NAME_CSV);
@@ -549,7 +546,6 @@ public class VirAttrITCase extends AbstractITCase {
userTO.getResources().clear();
userTO.getResources().add(resourceName);
userTO.getVirAttrs().clear();
- userTO.getDerAttrs().clear();
userTO.getMemberships().clear();
userTO.getMemberships().add(new MembershipTO.Builder().group(groupTO.getKey()).build());
@@ -673,7 +669,6 @@ public class VirAttrITCase extends AbstractITCase {
userTO.getAuxClasses().add(newClass.getKey());
userTO.getResources().clear();
userTO.getMemberships().clear();
- userTO.getDerAttrs().clear();
userTO.getVirAttrs().clear();
AttrTO emailTO = new AttrTO();