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 2013/01/30 17:44:25 UTC

svn commit: r1440512 - in /syncope/branches/1_0_X/core/src: main/java/org/apache/syncope/core/persistence/beans/ main/java/org/apache/syncope/core/persistence/beans/user/ main/java/org/apache/syncope/core/policy/ main/java/org/apache/syncope/core/sched...

Author: ilgrosso
Date: Wed Jan 30 16:44:24 2013
New Revision: 1440512

URL: http://svn.apache.org/viewvc?rev=1440512&view=rev
Log:
[SYNCOPE-301] Fix for branch 1_0_X

Modified:
    syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/persistence/beans/AbstractBaseBean.java
    syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/persistence/beans/user/SyncopeUser.java
    syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/policy/AccountPolicyEnforcer.java
    syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/scheduling/SyncJob.java
    syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/security/SyncopeAuthenticationProvider.java
    syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/workflow/AbstractUserWorkflowAdapter.java
    syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/workflow/NoOpUserWorkflowAdapter.java
    syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/workflow/WorkflowResult.java
    syncope/branches/1_0_X/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java
    syncope/branches/1_0_X/core/src/test/resources/content.xml

Modified: syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/persistence/beans/AbstractBaseBean.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/persistence/beans/AbstractBaseBean.java?rev=1440512&r1=1440511&r2=1440512&view=diff
==============================================================================
--- syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/persistence/beans/AbstractBaseBean.java (original)
+++ syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/persistence/beans/AbstractBaseBean.java Wed Jan 30 16:44:24 2013
@@ -68,7 +68,7 @@ public abstract class AbstractBaseBean i
      * @param property the integer representing a boolean value
      * @return the boolean value corresponding to the property param
      */
-    public final Boolean isBooleanAsInteger(final Integer property) {
+    public final boolean isBooleanAsInteger(final Integer property) {
         return property != null && property == 1;
     }
 
@@ -98,7 +98,7 @@ public abstract class AbstractBaseBean i
             }
         }
 
-        return excludeFields.toArray(new String[] {});
+        return excludeFields.toArray(new String[]{});
     }
 
     @Override

Modified: syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/persistence/beans/user/SyncopeUser.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/persistence/beans/user/SyncopeUser.java?rev=1440512&r1=1440511&r2=1440512&view=diff
==============================================================================
--- syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/persistence/beans/user/SyncopeUser.java (original)
+++ syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/persistence/beans/user/SyncopeUser.java Wed Jan 30 16:44:24 2013
@@ -544,8 +544,8 @@ public class SyncopeUser extends Abstrac
         this.suspended = getBooleanAsInteger(suspended);
     }
 
-    public Boolean getSuspended() {
-        return isBooleanAsInteger(suspended);
+    public Boolean isSuspended() {
+        return suspended == null ? null : isBooleanAsInteger(suspended);
     }
 
     private String encodePassword(final String password, final CipherAlgorithm cipherAlgoritm)

Modified: syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/policy/AccountPolicyEnforcer.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/policy/AccountPolicyEnforcer.java?rev=1440512&r1=1440511&r2=1440512&view=diff
==============================================================================
--- syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/policy/AccountPolicyEnforcer.java (original)
+++ syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/policy/AccountPolicyEnforcer.java Wed Jan 30 16:44:24 2013
@@ -104,7 +104,7 @@ public class AccountPolicyEnforcer exten
 
         // check for subsequent failed logins
         if (user.getFailedLogins() != null && policy.getPermittedLoginRetries() > 0
-                && user.getFailedLogins() > policy.getPermittedLoginRetries() && !user.getSuspended()) {
+                && user.getFailedLogins() > policy.getPermittedLoginRetries() && !user.isSuspended()) {
             try {
                 LOG.debug("User {}:{} is over to max failed logins", user.getId(), user.getUsername());
 

Modified: syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/scheduling/SyncJob.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/scheduling/SyncJob.java?rev=1440512&r1=1440511&r2=1440512&view=diff
==============================================================================
--- syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/scheduling/SyncJob.java (original)
+++ syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/scheduling/SyncJob.java Wed Jan 30 16:44:24 2013
@@ -18,9 +18,11 @@
  */
 package org.apache.syncope.core.scheduling;
 
+import java.util.AbstractMap.SimpleEntry;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import javassist.NotFoundException;
@@ -48,6 +50,7 @@ import org.apache.syncope.core.persisten
 import org.apache.syncope.core.persistence.dao.UserSearchDAO;
 import org.apache.syncope.core.persistence.validation.attrvalue.ParsingValidationException;
 import org.apache.syncope.core.propagation.ConnectorFacadeProxy;
+import org.apache.syncope.core.propagation.PropagationByResource;
 import org.apache.syncope.core.propagation.PropagationException;
 import org.apache.syncope.core.propagation.PropagationManager;
 import org.apache.syncope.core.rest.controller.InvalidSearchConditionException;
@@ -310,8 +313,20 @@ public class SyncJob extends AbstractTas
         return result;
     }
 
+    private Boolean readEnabled(final ConnectorObject connectorObject) {
+        Boolean enabled = null;
+        if (((SyncTask) this.task).isSyncStatus()) {
+            Attribute status = AttributeUtil.find(OperationalAttributes.ENABLE_NAME, connectorObject.getAttributes());
+            if (status != null && status.getValue() != null && !status.getValue().isEmpty()) {
+                enabled = (Boolean) status.getValue().get(0);
+            }
+        }
+
+        return enabled;
+    }
+
     /**
-     * Creates user and stores the result in parameter delta (!)
+     * Creates user.
      *
      * @param delta
      * @param dryRun
@@ -319,7 +334,6 @@ public class SyncJob extends AbstractTas
      * @throws JobExecutionException
      */
     private SyncResult createUser(SyncDelta delta, final boolean dryRun) throws JobExecutionException {
-
         final SyncResult result = new SyncResult();
         result.setOperation(Operation.CREATE);
 
@@ -333,23 +347,7 @@ public class SyncJob extends AbstractTas
             result.setStatus(Status.SUCCESS);
         } else {
             try {
-                Boolean enabled = null;
-
-                // --------------------------
-                // Check for status synchronization ...
-                // --------------------------
-                if (((SyncTask) this.task).isSyncStatus()) {
-                    Attribute status = AttributeUtil.find(OperationalAttributes.ENABLE_NAME, delta.getObject()
-                            .getAttributes());
-
-                    if (status != null) {
-                        enabled = status.getValue() != null && !status.getValue().isEmpty()
-                                ? (Boolean) status.getValue().get(0)
-                                : null;
-                    }
-                }
-                // --------------------------
-
+                Boolean enabled = readEnabled(delta.getObject());
                 WorkflowResult<Map.Entry<Long, Boolean>> created = wfAdapter.create(userTO, true, enabled);
 
                 List<PropagationTask> tasks = propagationManager.getCreateTaskIds(created, userTO.getPassword(), userTO
@@ -379,7 +377,68 @@ public class SyncJob extends AbstractTas
         return result;
     }
 
-    private void updateUsers(SyncDelta delta, final List<Long> users, final boolean dryRun,
+    private void updateUser(final Long userId, SyncDelta delta, final boolean dryRun, final SyncResult result)
+            throws Exception {
+
+        UserTO userTO = userDataBinder.getUserTO(userId);
+        UserMod userMod = connObjectUtil.getUserMod(userId, delta.getObject(), (SyncTask) task);
+
+        delta = actions.beforeUpdate(delta, userTO, userMod);
+
+        if (dryRun) {
+            return;
+        }
+
+        WorkflowResult<Map.Entry<Long, Boolean>> updated;
+        try {
+            updated = wfAdapter.update(userMod);
+        } catch (Exception e) {
+            LOG.error("Update of user {} failed, trying to sync its status anyway (if configured)", userId, e);
+
+            result.setStatus(Status.FAILURE);
+            result.setMessage("Update failed, trying to sync status anyway (if configured)\n" + e.getMessage());
+
+            updated = new WorkflowResult<Map.Entry<Long, Boolean>>(
+                    new SimpleEntry<Long, Boolean>(userId, false), new PropagationByResource(), new HashSet<String>());
+        }
+
+        Boolean enabled = readEnabled(delta.getObject());
+        if (enabled != null) {
+            WorkflowResult<Long> enableUpdate = null;
+
+            SyncopeUser user = userDAO.find(userId);
+            enableUpdate = user.isSuspended() == null
+                    ? wfAdapter.activate(userId, null)
+                    : enabled
+                    ? wfAdapter.reactivate(userId)
+                    : wfAdapter.suspend(userId);
+
+            if (enableUpdate != null) {
+                if (enableUpdate.getPropByRes() != null) {
+                    updated.getPropByRes().merge(enableUpdate.getPropByRes());
+                    updated.getPropByRes().purge();
+                }
+                updated.getPerformedTasks().addAll(enableUpdate.getPerformedTasks());
+            }
+        }
+
+        List<PropagationTask> tasks = propagationManager.getUpdateTaskIds(updated,
+                userMod.getPassword(),
+                userMod.getVirtualAttributesToBeRemoved(),
+                userMod.getVirtualAttributesToBeUpdated(),
+                Collections.singleton(((SyncTask) this.task).getResource().getName()));
+
+        propagationManager.execute(tasks);
+
+        notificationManager.createTasks(new WorkflowResult<Long>(updated.getResult().getKey(),
+                updated.getPropByRes(), updated.getPerformedTasks()));
+
+        userTO = userDataBinder.getUserTO(updated.getResult().getKey());
+
+        actions.after(delta, userTO, result);
+    }
+
+    private void updateUsers(final SyncDelta delta, final List<Long> users, final boolean dryRun,
             final List<SyncResult> results) throws JobExecutionException {
 
         if (!((SyncTask) task).isPerformUpdate()) {
@@ -390,50 +449,30 @@ public class SyncJob extends AbstractTas
         LOG.debug("About to update {}", users);
 
         for (Long userId : users) {
+            LOG.debug("About to update user {}", userId);
+
             final SyncResult result = new SyncResult();
             result.setOperation(Operation.UPDATE);
+            result.setStatus(Status.SUCCESS);
+            result.setUserId(userId);
 
             try {
-                UserTO userTO = userDataBinder.getUserTO(userId);
-                try {
-
-                    final UserMod userMod = connObjectUtil.getUserMod(userId, delta.getObject(), (SyncTask) task);
-                    delta = actions.beforeUpdate(delta, userTO, userMod);
-
-                    result.setStatus(Status.SUCCESS);
-                    result.setUserId(userMod.getId());
-                    result.setUsername(userMod.getUsername());
-
-                    if (!dryRun) {
-                        WorkflowResult<Map.Entry<Long, Boolean>> updated = wfAdapter.update(userMod);
-
-                        List<PropagationTask> tasks = propagationManager.getUpdateTaskIds(updated, userMod
-                                .getPassword(), userMod.getVirtualAttributesToBeRemoved(), userMod
-                                .getVirtualAttributesToBeUpdated(), Collections.singleton(((SyncTask) this.task)
-                                .getResource().getName()));
-
-                        propagationManager.execute(tasks);
-
-                        notificationManager.createTasks(new WorkflowResult<Long>(updated.getResult().getKey(),
-                                updated.getPropByRes(), updated.getPerformedTasks()));
+                updateUser(userId, delta, dryRun, result);
+            } catch (PropagationException e) {
+                result.setStatus(Status.FAILURE);
+                result.setMessage("User " + delta.getUid().getUidValue() + "updated but not propagated\n"
+                        + e.getMessage());
 
-                        userTO = userDataBinder.getUserTO(updated.getResult().getKey());
-                    }
-                } catch (PropagationException e) {
-                    LOG.error("Could not propagate user " + delta.getUid().getUidValue(), e);
-                } catch (Exception e) {
-                    result.setStatus(Status.FAILURE);
-                    result.setMessage(e.getMessage());
-                    LOG.error("Could not update user " + delta.getUid().getUidValue(), e);
-                }
+                LOG.error("Could not propagate user " + delta.getUid().getUidValue(), e);
+            } catch (Exception e) {
+                result.setStatus(Status.FAILURE);
+                result.setMessage(e.getMessage());
 
-                actions.after(delta, userTO, result);
-                results.add(result);
-            } catch (NotFoundException e) {
-                LOG.error("Could not find user {}", userId, e);
-            } catch (UnauthorizedRoleException e) {
-                LOG.error("Not allowed to read user {}", userId, e);
+                LOG.error("Could not update user " + delta.getUid().getUidValue(), e);
             }
+            results.add(result);
+
+            LOG.debug("User {} successfully updated", userId);
         }
     }
 

Modified: syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/security/SyncopeAuthenticationProvider.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/security/SyncopeAuthenticationProvider.java?rev=1440512&r1=1440511&r2=1440512&view=diff
==============================================================================
--- syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/security/SyncopeAuthenticationProvider.java (original)
+++ syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/security/SyncopeAuthenticationProvider.java Wed Jan 30 16:44:24 2013
@@ -99,9 +99,8 @@ public class SyncopeAuthenticationProvid
             authenticated = adminMD5Password.equalsIgnoreCase(passwordUser.getPassword());
         } else {
             user = userDAO.find(username);
-
-            if (user != null) {
-                if (user.getSuspended()) {
+            if (user != null && user.isSuspended() != null) {
+                if (user.isSuspended()) {
                     throw new DisabledException("User " + user.getUsername() + " is suspended");
                 }
 

Modified: syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/workflow/AbstractUserWorkflowAdapter.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/workflow/AbstractUserWorkflowAdapter.java?rev=1440512&r1=1440511&r2=1440512&view=diff
==============================================================================
--- syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/workflow/AbstractUserWorkflowAdapter.java (original)
+++ syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/workflow/AbstractUserWorkflowAdapter.java Wed Jan 30 16:44:24 2013
@@ -82,7 +82,6 @@ public abstract class AbstractUserWorkfl
 
     @Override
     public WorkflowResult<Long> suspend(final SyncopeUser user) throws UnauthorizedRoleException, WorkflowException {
-
         // set suspended flag
         user.setSuspended(Boolean.TRUE);
 
@@ -110,7 +109,6 @@ public abstract class AbstractUserWorkfl
 
     @Override
     public void delete(final Long userId) throws UnauthorizedRoleException, NotFoundException, WorkflowException {
-
         doDelete(dataBinder.getUserFromId(userId));
     }
 }

Modified: syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/workflow/NoOpUserWorkflowAdapter.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/workflow/NoOpUserWorkflowAdapter.java?rev=1440512&r1=1440511&r2=1440512&view=diff
==============================================================================
--- syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/workflow/NoOpUserWorkflowAdapter.java (original)
+++ syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/workflow/NoOpUserWorkflowAdapter.java Wed Jan 30 16:44:24 2013
@@ -48,6 +48,7 @@ public class NoOpUserWorkflowAdapter ext
     @Override
     public WorkflowResult<Map.Entry<Long, Boolean>> create(final UserTO userTO, final boolean disablePwdPolicyCheck)
             throws WorkflowException {
+
         return create(userTO, disablePwdPolicyCheck, null);
     }
 
@@ -58,8 +59,7 @@ public class NoOpUserWorkflowAdapter ext
         SyncopeUser user = new SyncopeUser();
         dataBinder.create(user, userTO);
 
-        // this will make SyncopeUserValidator not to consider
-        // password policies at all
+        // this will make SyncopeUserValidator not to consider password policies at all
         if (disablePwdPolicyCheck) {
             user.removeClearPassword();
         }

Modified: syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/workflow/WorkflowResult.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/workflow/WorkflowResult.java?rev=1440512&r1=1440511&r2=1440512&view=diff
==============================================================================
--- syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/workflow/WorkflowResult.java (original)
+++ syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/workflow/WorkflowResult.java Wed Jan 30 16:44:24 2013
@@ -35,14 +35,12 @@ public class WorkflowResult<T> {
     private Set<String> performedTasks;
 
     public WorkflowResult(final T result, final PropagationByResource propByRes, final String performedTask) {
-
         this.result = result;
         this.propByRes = propByRes;
         this.performedTasks = Collections.singleton(performedTask);
     }
 
     public WorkflowResult(final T result, final PropagationByResource propByRes, final Set<String> performedTasks) {
-
         this.result = result;
         this.propByRes = propByRes;
         this.performedTasks = performedTasks;

Modified: syncope/branches/1_0_X/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java?rev=1440512&r1=1440511&r2=1440512&view=diff
==============================================================================
--- syncope/branches/1_0_X/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java (original)
+++ syncope/branches/1_0_X/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java Wed Jan 30 16:44:24 2013
@@ -361,7 +361,7 @@ public class TaskTestITCase extends Abst
 
     @Test
     public void reconcile() {
-        // Update sync task
+        // update sync task
         SyncTaskTO task = restTemplate.getForObject(BASE_URL + "task/read/{taskId}", SyncTaskTO.class, 7);
         assertNotNull(task);
 
@@ -397,14 +397,14 @@ public class TaskTestITCase extends Abst
         // read executions before sync (dryrun test could be executed before)
         int preSyncSize = actual.getExecutions().size();
 
+        // trigger SyncTask execution
         TaskExecTO execution = restTemplate.postForObject(BASE_URL + "task/execute/{taskId}", null, TaskExecTO.class,
                 actual.getId());
         assertEquals("JOB_FIRED", execution.getStatus());
 
-        int i = 0;
-        int maxit = 20;
-
         // wait for sync completion (executions incremented)
+        int i = 0;
+        final int maxit = 20;
         do {
             try {
                 Thread.sleep(1000);
@@ -412,30 +412,63 @@ public class TaskTestITCase extends Abst
             }
 
             actual = restTemplate.getForObject(BASE_URL + "task/read/{taskId}", SyncTaskTO.class, actual.getId());
-
             assertNotNull(actual);
             assertNotNull(actual.getExecutions());
 
             i++;
-
         } while (preSyncSize == actual.getExecutions().size() && i < maxit);
+        assertEquals(preSyncSize + 1, actual.getExecutions().size());
 
-        assertEquals(1, actual.getExecutions().size());
-
-        final String status = actual.getExecutions().get(0).getStatus();
+        String status = actual.getExecutions().get(0).getStatus();
         assertNotNull(status);
         assertTrue(PropagationTaskExecStatus.valueOf(status).isSuccessful());
 
-        final UserTO userTO =
+        UserTO userTO =
                 restTemplate.getForObject(BASE_URL + "user/readByUsername/{username}.json", UserTO.class, "testuser1");
-
         assertNotNull(userTO);
         assertEquals("reconciled@syncope.apache.org", userTO.getAttributeMap().get("userId").getValues().get(0));
+        assertEquals("suspended", userTO.getStatus());
+
+        //enable user on external resource
+        JdbcTemplate jdbcTemplate = new JdbcTemplate(testDataSource);
+        jdbcTemplate.execute("UPDATE TEST SET STATUS=TRUE");
+
+        // re-execute the same SyncTask: now user must me active
+        preSyncSize = actual.getExecutions().size();
+
+        execution = restTemplate.postForObject(BASE_URL + "task/execute/{taskId}", null, TaskExecTO.class,
+                actual.getId());
+        assertEquals("JOB_FIRED", execution.getStatus());
+
+        // wait for sync completion (executions incremented)
+        i = 0;
+        do {
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException e) {
+            }
+
+            actual = restTemplate.getForObject(BASE_URL + "task/read/{taskId}", SyncTaskTO.class, actual.getId());
+            assertNotNull(actual);
+            assertNotNull(actual.getExecutions());
+
+            i++;
+        } while (preSyncSize == actual.getExecutions().size() && i < maxit);
+        assertEquals(preSyncSize + 1, actual.getExecutions().size());
+
+        status = actual.getExecutions().get(0).getStatus();
+        assertNotNull(status);
+        assertTrue(PropagationTaskExecStatus.valueOf(status).isSuccessful());
+
+        userTO = restTemplate.getForObject(BASE_URL + "user/readByUsername/{username}.json", UserTO.class, "testuser1");
+        assertNotNull(userTO);
+        assertEquals("active", userTO.getStatus());
     }
 
     @Test
     public void issue196() {
-        TaskExecTO execution = restTemplate.postForObject(BASE_URL + "task/execute/{taskId}", null, TaskExecTO.class, 6);
+        TaskExecTO execution = restTemplate.postForObject(
+                BASE_URL + "task/execute/{taskId}", null, TaskExecTO.class, 6);
         assertNotNull(execution);
         assertEquals(0, execution.getId());
         assertNotNull(execution.getTask());
@@ -766,9 +799,7 @@ public class TaskTestITCase extends Abst
 
     @Test
     public void issueSYNCOPE272() {
-
-        //Create user with testdb resource
-
+        // create user with testdb resource
         UserTO userTO = new UserTO();
         userTO.setUsername("syncope261@syncope.apache.org");
         userTO.setPassword("password");
@@ -842,10 +873,9 @@ public class TaskTestITCase extends Abst
                 actual.getId());
         assertEquals("JOB_FIRED", execution.getStatus());
 
-        int i = 0;
-        int maxit = 20;
-
         // wait for sync completion (executions incremented)
+        int i = 0;
+        final int maxit = 20;
         do {
             try {
                 Thread.sleep(1000);
@@ -858,13 +888,10 @@ public class TaskTestITCase extends Abst
             assertNotNull(actual.getExecutions());
 
             i++;
-
         } while (preSyncSize == actual.getExecutions().size() && i < maxit);
-
-        assertEquals(2, actual.getExecutions().size());
+        assertEquals(preSyncSize + 1, actual.getExecutions().size());
 
         final String status = actual.getExecutions().get(1).getStatus();
-
         assertNotNull(status);
         assertTrue(PropagationTaskExecStatus.valueOf(status).isSuccessful());
 

Modified: syncope/branches/1_0_X/core/src/test/resources/content.xml
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/core/src/test/resources/content.xml?rev=1440512&r1=1440511&r2=1440512&view=diff
==============================================================================
--- syncope/branches/1_0_X/core/src/test/resources/content.xml (original)
+++ syncope/branches/1_0_X/core/src/test/resources/content.xml Wed Jan 30 16:44:24 2013
@@ -39,15 +39,15 @@ under the License.
   <Policy DTYPE="PasswordPolicy" id="8" description="sample password policy" type="PASSWORD" specification="%3Corg.apache.syncope.types.PasswordPolicySpec%3E%0A++%3ChistoryLength%3E0%3C%2FhistoryLength%3E%0A++%3CmaxLength%3E0%3C%2FmaxLength%3E%0A++%3CminLength%3E10%3C%2FminLength%3E%0A++%3CnonAlphanumericRequired%3Efalse%3C%2FnonAlphanumericRequired%3E%0A++%3CalphanumericRequired%3Efalse%3C%2FalphanumericRequired%3E%0A++%3CdigitRequired%3Etrue%3C%2FdigitRequired%3E%0A++%3ClowercaseRequired%3Efalse%3C%2FlowercaseRequired%3E%0A++%3CuppercaseRequired%3Efalse%3C%2FuppercaseRequired%3E%0A++%3CmustStartWithDigit%3Efalse%3C%2FmustStartWithDigit%3E%0A++%3CmustntStartWithDigit%3Efalse%3C%2FmustntStartWithDigit%3E%0A++%3CmustEndWithDigit%3Efalse%3C%2FmustEndWithDigit%3E%0A++%3CmustntEndWithDigit%3Efalse%3C%2FmustntEndWithDigit%3E%0A++%3CmustStartWithNonAlpha%3Efalse%3C%2FmustStartWithNonAlpha%3E%0A++%3CmustStartWithAlpha%3Efalse%3C%2FmustStartWithAlpha%3E%0A++%3CmustntStartWithNonAlph
 a%3Efalse%3C%2FmustntStartWithNonAlpha%3E%0A++%3CmustntStartWithAlpha%3Efalse%3C%2FmustntStartWithAlpha%3E%0A++%3CmustEndWithNonAlpha%3Efalse%3C%2FmustEndWithNonAlpha%3E%0A++%3CmustEndWithAlpha%3Efalse%3C%2FmustEndWithAlpha%3E%0A++%3CmustntEndWithNonAlpha%3Efalse%3C%2FmustntEndWithNonAlpha%3E%0A++%3CmustntEndWithAlpha%3Efalse%3C%2FmustntEndWithAlpha%3E%0A++%3CprefixesNotPermitted%3E%0A++++%3Cstring%3Enotpermitted1%3C%2Fstring%3E%0A++++%3Cstring%3Enotpermitted2%3C%2Fstring%3E%0A++%3C%2FprefixesNotPermitted%3E%0A%3C%2Forg.apache.syncope.types.PasswordPolicySpec%3E"/>
     
   <SyncopeUser id="1" workflowId="0" status="active" password="5f4dcc3b5aa765d61d8327deb882cf99" cipherAlgorithm="MD5"
-               username="user1" creationDate="2010-10-20 11:00:00"/>
+               username="user1" creationDate="2010-10-20 11:00:00" suspended="0"/>
   <SyncopeUser id="2" workflowId="0" status="active" password="5f4dcc3b5aa765d61d8327deb882cf99" cipherAlgorithm="MD5"
-               username="user2" creationDate="2010-10-20 11:00:00"/>
+               username="user2" creationDate="2010-10-20 11:00:00" suspended="0"/>
   <SyncopeUser id="3" workflowId="0" status="active" password="5f4dcc3b5aa765d61d8327deb882cf99" cipherAlgorithm="MD5"
-               username="user3" creationDate="2010-10-20 11:00:00"/>
+               username="user3" creationDate="2010-10-20 11:00:00" suspended="0"/>
   <SyncopeUser id="4" workflowId="0" status="active" password="5f4dcc3b5aa765d61d8327deb882cf99" cipherAlgorithm="MD5"
-               username="user4" creationDate="2010-10-20 11:00:00"/>
+               username="user4" creationDate="2010-10-20 11:00:00" suspended="0"/>
   <SyncopeUser id="5" workflowId="0" status="active" password="5f4dcc3b5aa765d61d8327deb882cf99" cipherAlgorithm="MD5"
-               username="user5" creationDate="2010-10-20 11:00:00"/>
+               username="user5" creationDate="2010-10-20 11:00:00" suspended="0"/>
 
   <SyncopeRole id="1" name="root"/>
   <SyncopeRole id="2" name="child" parent_id="1"/>