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/11/20 12:53:02 UTC

svn commit: r1543795 - in /syncope/trunk: ./ core/ core/src/main/java/org/apache/syncope/core/workflow/user/ core/src/main/resources/ core/src/test/java/org/apache/syncope/core/rest/ core/src/test/resources/

Author: ilgrosso
Date: Wed Nov 20 11:53:01 2013
New Revision: 1543795

URL: http://svn.apache.org/r1543795
Log:
Merge from 1_1_X

Modified:
    syncope/trunk/   (props changed)
    syncope/trunk/core/pom.xml
    syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/NoOpUserWorkflowAdapter.java
    syncope/trunk/core/src/main/resources/syncopeContext.xml
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserSelfTestITCase.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java
    syncope/trunk/core/src/test/resources/content.xml

Propchange: syncope/trunk/
------------------------------------------------------------------------------
  Merged /syncope/branches/1_1_X:r1543789-1543794

Modified: syncope/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/pom.xml?rev=1543795&r1=1543794&r2=1543795&view=diff
==============================================================================
--- syncope/trunk/core/pom.xml (original)
+++ syncope/trunk/core/pom.xml Wed Nov 20 11:53:01 2013
@@ -828,7 +828,7 @@ under the License.
         <defaultGoal>clean verify</defaultGoal>
         
         <plugins>
-          <!-- Strip Activiti-related entries from content.xml -->
+          <!-- Strip Activiti-related entries from content.xml and indexes.xml -->
           <plugin>
             <groupId>org.codehaus.mojo</groupId>
             <artifactId>xml-maven-plugin</artifactId>
@@ -848,6 +848,7 @@ under the License.
                   <dir>${project.build.directory}/test-classes</dir>
                   <includes>
                     <include>content.xml</include>
+                    <include>indexes.xml</include>
                   </includes>
                   <outputDir>${project.build.directory}/test-classes/</outputDir>
                   <stylesheet>${basedir}/src/test/resources/noopworkflow/stripActivitiFromContent.xsl</stylesheet>
@@ -863,24 +864,24 @@ under the License.
           </plugin>
         </plugins>
         
-        <testResources>
-          <testResource>
-            <directory>src/test/resources</directory>
+        <resources>
+          <resource>
+            <directory>src/main/resources</directory>
             <filtering>true</filtering>
             <excludes>
               <exclude>workflowContext.xml</exclude>
               <exclude>workflow.properties</exclude>
             </excludes>
-          </testResource>
-          <testResource>
+          </resource>
+          <resource>
             <directory>src/test/resources/noopworkflow</directory>
             <filtering>true</filtering>
             <includes>
               <include>workflowContext.xml</include>
               <include>workflow.properties</include>
             </includes>
-          </testResource>
-        </testResources>
+          </resource>
+        </resources>
       </build>
     </profile>
 

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/NoOpUserWorkflowAdapter.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/NoOpUserWorkflowAdapter.java?rev=1543795&r1=1543794&r2=1543795&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/NoOpUserWorkflowAdapter.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/user/NoOpUserWorkflowAdapter.java Wed Nov 20 11:53:01 2013
@@ -25,6 +25,7 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
+import org.apache.commons.lang3.SerializationUtils;
 import org.apache.syncope.common.mod.UserMod;
 import org.apache.syncope.common.to.UserTO;
 import org.apache.syncope.common.to.WorkflowFormTO;
@@ -111,7 +112,13 @@ public class NoOpUserWorkflowAdapter ext
     protected WorkflowResult<Map.Entry<UserMod, Boolean>> doUpdate(final SyncopeUser user, final UserMod userMod)
             throws WorkflowException {
 
-        PropagationByResource propByRes = dataBinder.update(user, userMod);
+        // update password internally only if required
+        UserMod actualMod = SerializationUtils.clone(userMod);
+        if (actualMod.getPwdPropRequest() != null && !actualMod.getPwdPropRequest().isOnSyncope()) {
+            actualMod.setPassword(null);
+        }
+        // update SyncopeUser
+        PropagationByResource propByRes = dataBinder.update(user, actualMod);
 
         SyncopeUser updated = userDAO.save(user);
 

Modified: syncope/trunk/core/src/main/resources/syncopeContext.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/resources/syncopeContext.xml?rev=1543795&r1=1543794&r2=1543795&view=diff
==============================================================================
--- syncope/trunk/core/src/main/resources/syncopeContext.xml (original)
+++ syncope/trunk/core/src/main/resources/syncopeContext.xml Wed Nov 20 11:53:01 2013
@@ -53,7 +53,9 @@ under the License.
   <context:component-scan base-package="org.apache.syncope.core.audit"/>
   <context:component-scan base-package="org.apache.syncope.core.connid"/>
   <context:component-scan base-package="org.apache.syncope.core.rest.data"/>
-  <context:component-scan base-package="org.apache.syncope.core.workflow"/>
+  <context:component-scan base-package="org.apache.syncope.core.workflow">
+    <context:exclude-filter type="regex" expression=".*\.activiti\..*"/>
+  </context:component-scan>
 
   <bean id="nonJPAdbInitializer" class="org.springframework.jdbc.datasource.init.DataSourceInitializer">
     <property name="dataSource" ref="dataSource"/>

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserSelfTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserSelfTestITCase.java?rev=1543795&r1=1543794&r2=1543795&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserSelfTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserSelfTestITCase.java Wed Nov 20 11:53:01 2013
@@ -40,6 +40,8 @@ import org.apache.syncope.common.to.Work
 import org.apache.syncope.common.types.AttributableType;
 import org.apache.syncope.common.types.ClientExceptionType;
 import org.apache.syncope.common.validation.SyncopeClientException;
+import org.apache.syncope.core.workflow.ActivitiDetector;
+import org.junit.Assume;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
 import org.junit.runners.MethodSorters;
@@ -54,6 +56,8 @@ public class UserSelfTestITCase extends 
 
     @Test
     public void create() {
+        Assume.assumeTrue(ActivitiDetector.isActivitiEnabledForUsers());
+        
         // 1. self-registration as admin: failure
         try {
             userSelfService.create(UserTestITCase.getUniqueSampleTO("anonymous@syncope.apache.org"));
@@ -73,6 +77,8 @@ public class UserSelfTestITCase extends 
 
     @Test
     public void createAndApprove() {
+        Assume.assumeTrue(ActivitiDetector.isActivitiEnabledForUsers());
+
         // self-create user with membership: goes 'createApproval' with resources and membership but no propagation
         UserTO userTO = UserTestITCase.getUniqueSampleTO("anonymous@syncope.apache.org");
         MembershipTO membership = new MembershipTO();
@@ -139,12 +145,14 @@ public class UserSelfTestITCase extends 
         UserTO updated = authClient.getService(UserSelfService.class).update(created.getId(), userMod).
                 readEntity(UserTO.class);
         assertNotNull(updated);
-        assertEquals("active", updated.getStatus());
+        assertEquals(ActivitiDetector.isActivitiEnabledForUsers()? "active": "created", updated.getStatus());
         assertTrue(updated.getUsername().endsWith("XX"));
     }
 
     @Test
     public void updateWitApproval() {
+        Assume.assumeTrue(ActivitiDetector.isActivitiEnabledForUsers());
+
         // 1. create user as admin
         UserTO created = createUser(UserTestITCase.getUniqueSampleTO("anonymous@syncope.apache.org"));
         assertNotNull(created);
@@ -210,7 +218,7 @@ public class UserSelfTestITCase extends 
         SyncopeClient authClient = clientFactory.create(created.getUsername(), "password123");
         UserTO deleted = authClient.getService(UserSelfService.class).delete().readEntity(UserTO.class);
         assertNotNull(deleted);
-        assertEquals("deleteApproval", deleted.getStatus());
+        assertEquals(ActivitiDetector.isActivitiEnabledForUsers()? "deleteApproval": null, deleted.getStatus());
     }
 
     @Test

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java?rev=1543795&r1=1543794&r2=1543795&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java Wed Nov 20 11:53:01 2013
@@ -1628,7 +1628,7 @@ public class UserTestITCase extends Abst
     @Test
     public void issueSYNCOPE122() {
         // 1. create user on testdb and testdb2
-        UserTO userTO = getUniqueSampleTO("syncope123@apache.org");
+        UserTO userTO = getUniqueSampleTO("syncope122@apache.org");
         userTO.getResources().clear();
         userTO.getResources().add(RESOURCE_NAME_TESTDB);
         userTO.getResources().add("resource-testdb2");

Modified: syncope/trunk/core/src/test/resources/content.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/resources/content.xml?rev=1543795&r1=1543794&r2=1543795&view=diff
==============================================================================
--- syncope/trunk/core/src/test/resources/content.xml (original)
+++ syncope/trunk/core/src/test/resources/content.xml Wed Nov 20 11:53:01 2013
@@ -31,7 +31,7 @@ under the License.
   <SyncopeConf confKey="selfRegistration.allowed" confValue="true"/>
   <SyncopeConf confKey="notification.maxRetries" confValue="3"/>
   <!-- when needing to provide more values, use '|' as separator and no spaces -->
-  <SyncopeConf confKey="authentication.statuses" confValue="active"/>
+  <SyncopeConf confKey="authentication.statuses" confValue="created|active"/>
 
   <!-- sample policies -->
   <Policy DTYPE="SyncPolicy" id="1" description="sync policy 1" type="GLOBAL_SYNC" specification="%3Corg.apache.syncope.common.types.SyncPolicySpec%2F%3E"/>