You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by an...@apache.org on 2014/07/11 15:39:01 UTC
svn commit: r1609714 [2/2] - in /syncope/branches/1_2_X:
common/src/main/java/org/apache/syncope/common/services/
common/src/main/java/org/apache/syncope/common/types/
common/src/main/java/org/apache/syncope/common/util/
console/src/main/java/org/apach...
Modified: syncope/branches/1_2_X/core/src/test/java/org/apache/syncope/core/rest/VirAttrTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_2_X/core/src/test/java/org/apache/syncope/core/rest/VirAttrTestITCase.java?rev=1609714&r1=1609713&r2=1609714&view=diff
==============================================================================
--- syncope/branches/1_2_X/core/src/test/java/org/apache/syncope/core/rest/VirAttrTestITCase.java (original)
+++ syncope/branches/1_2_X/core/src/test/java/org/apache/syncope/core/rest/VirAttrTestITCase.java Fri Jul 11 13:38:59 2014
@@ -267,74 +267,77 @@ public class VirAttrTestITCase extends A
@Test
public void issueSYNCOPE397() {
ResourceTO csv = resourceService.read(RESOURCE_NAME_CSV);
- // change mapping of resource-csv
- MappingTO origMapping = SerializationUtils.clone(csv.getUmapping());
- assertNotNull(origMapping);
- for (MappingItemTO item : csv.getUmapping().getItems()) {
- if ("email".equals(item.getIntAttrName())) {
- // unset internal attribute mail and set virtual attribute virtualdata as mapped to external email
- item.setIntMappingType(IntMappingType.UserVirtualSchema);
- item.setIntAttrName("virtualdata");
- item.setPurpose(MappingPurpose.BOTH);
- item.setExtAttrName("email");
+ final MappingTO origMapping = SerializationUtils.clone(csv.getUmapping());
+ try {
+ // change mapping of resource-csv
+ assertNotNull(origMapping);
+ for (MappingItemTO item : csv.getUmapping().getItems()) {
+ if ("email".equals(item.getIntAttrName())) {
+ // unset internal attribute mail and set virtual attribute virtualdata as mapped to external email
+ item.setIntMappingType(IntMappingType.UserVirtualSchema);
+ item.setIntAttrName("virtualdata");
+ item.setPurpose(MappingPurpose.BOTH);
+ item.setExtAttrName("email");
+ }
}
- }
- resourceService.update(csv.getName(), csv);
- csv = resourceService.read(RESOURCE_NAME_CSV);
- assertNotNull(csv.getUmapping());
-
- boolean found = false;
- for (MappingItemTO item : csv.getUmapping().getItems()) {
- if ("email".equals(item.getExtAttrName()) && "virtualdata".equals(item.getIntAttrName())) {
- found = true;
+ resourceService.update(csv.getName(), csv);
+ csv = resourceService.read(RESOURCE_NAME_CSV);
+ assertNotNull(csv.getUmapping());
+
+ boolean found = false;
+ for (MappingItemTO item : csv.getUmapping().getItems()) {
+ if ("email".equals(item.getExtAttrName()) && "virtualdata".equals(item.getIntAttrName())) {
+ found = true;
+ }
}
- }
- assertTrue(found);
+ assertTrue(found);
- // create a new user
- UserTO userTO = UserTestITCase.getUniqueSampleTO("syncope397@syncope.apache.org");
- userTO.getResources().clear();
- userTO.getMemberships().clear();
- userTO.getDerAttrs().clear();
- userTO.getVirAttrs().clear();
-
- userTO.getDerAttrs().add(attributeTO("csvuserid", null));
- userTO.getDerAttrs().add(attributeTO("cn", null));
- userTO.getVirAttrs().add(attributeTO("virtualdata", "test@testone.org"));
- // assign resource-csv to user
- userTO.getResources().add(RESOURCE_NAME_CSV);
- // save user
- UserTO created = createUser(userTO);
- // make std controls about user
- assertNotNull(created);
- assertTrue(RESOURCE_NAME_CSV.equals(created.getResources().iterator().next()));
- // update user
- UserTO toBeUpdated = userService.read(created.getId());
- UserMod userMod = new UserMod();
- userMod.setId(toBeUpdated.getId());
- userMod.setPassword("password2");
- // assign new resource to user
- userMod.getResourcesToAdd().add(RESOURCE_NAME_WS2);
- //modify virtual attribute
- userMod.getVirAttrsToRemove().add("virtualdata");
- userMod.getVirAttrsToUpdate().add(attributeMod("virtualdata", "test@testoneone.com"));
-
- // check Syncope change password
- StatusMod pwdPropRequest = new StatusMod();
- pwdPropRequest.setOnSyncope(true);
- pwdPropRequest.getResourceNames().add(RESOURCE_NAME_WS2);
- userMod.setPwdPropRequest(pwdPropRequest);
-
- toBeUpdated = updateUser(userMod);
- assertNotNull(toBeUpdated);
- assertEquals("test@testoneone.com", toBeUpdated.getVirAttrs().get(0).getValues().get(0));
- // check if propagates correctly with assertEquals on size of tasks list
- assertEquals(2, toBeUpdated.getPropagationStatusTOs().size());
- // restore mapping of resource-csv
- csv.setUmapping(origMapping);
- resourceService.update(csv.getName(), csv);
+ // create a new user
+ UserTO userTO = UserTestITCase.getUniqueSampleTO("syncope397@syncope.apache.org");
+ userTO.getResources().clear();
+ userTO.getMemberships().clear();
+ userTO.getDerAttrs().clear();
+ userTO.getVirAttrs().clear();
+
+ userTO.getDerAttrs().add(attributeTO("csvuserid", null));
+ userTO.getDerAttrs().add(attributeTO("cn", null));
+ userTO.getVirAttrs().add(attributeTO("virtualdata", "test@testone.org"));
+ // assign resource-csv to user
+ userTO.getResources().add(RESOURCE_NAME_CSV);
+ // save user
+ UserTO created = createUser(userTO);
+ // make std controls about user
+ assertNotNull(created);
+ assertTrue(RESOURCE_NAME_CSV.equals(created.getResources().iterator().next()));
+ // update user
+ UserTO toBeUpdated = userService.read(created.getId());
+ UserMod userMod = new UserMod();
+ userMod.setId(toBeUpdated.getId());
+ userMod.setPassword("password2");
+ // assign new resource to user
+ userMod.getResourcesToAdd().add(RESOURCE_NAME_WS2);
+ //modify virtual attribute
+ userMod.getVirAttrsToRemove().add("virtualdata");
+ userMod.getVirAttrsToUpdate().add(attributeMod("virtualdata", "test@testoneone.com"));
+
+ // check Syncope change password
+ StatusMod pwdPropRequest = new StatusMod();
+ pwdPropRequest.setOnSyncope(true);
+ pwdPropRequest.getResourceNames().add(RESOURCE_NAME_WS2);
+ userMod.setPwdPropRequest(pwdPropRequest);
+
+ toBeUpdated = updateUser(userMod);
+ assertNotNull(toBeUpdated);
+ assertEquals("test@testoneone.com", toBeUpdated.getVirAttrs().get(0).getValues().get(0));
+ // check if propagates correctly with assertEquals on size of tasks list
+ assertEquals(2, toBeUpdated.getPropagationStatusTOs().size());
+ } finally {
+ // restore mapping of resource-csv
+ csv.setUmapping(origMapping);
+ resourceService.update(csv.getName(), csv);
+ }
}
@Test
@@ -750,7 +753,7 @@ public class VirAttrTestITCase extends A
final StatusMod statusMod = new StatusMod();
statusMod.getResourceNames().addAll(Collections.<String>emptySet());
- statusMod.setOnSyncope(Boolean.FALSE);
+ statusMod.setOnSyncope(false);
userMod.setPwdPropRequest(statusMod);
// change virtual attribute value
Modified: syncope/branches/1_2_X/core/src/test/resources/content.xml
URL: http://svn.apache.org/viewvc/syncope/branches/1_2_X/core/src/test/resources/content.xml?rev=1609714&r1=1609713&r2=1609714&view=diff
==============================================================================
--- syncope/branches/1_2_X/core/src/test/resources/content.xml (original)
+++ syncope/branches/1_2_X/core/src/test/resources/content.xml Fri Jul 11 13:38:59 2014
@@ -72,11 +72,11 @@ under the License.
<Policy DTYPE="SyncPolicy" id="1" description="global sync policy" type="GLOBAL_SYNC"
specification='{"userJavaRule":null,"roleJavaRule":null,"conflictResolutionAction":"IGNORE","userAltSearchSchemas":[],"roleAltSearchSchemas":[]}'/>
<Policy DTYPE="PasswordPolicy" id="2" description="global password policy" type="GLOBAL_PASSWORD"
- specification='{"historyLength":1,"maxLength":0,"minLength":8,"nonAlphanumericRequired":false,"alphanumericRequired":false,"digitRequired":false,"lowercaseRequired":false,"uppercaseRequired":false,"mustStartWithDigit":false,"mustntStartWithDigit":false,"mustEndWithDigit":false,"mustntEndWithDigit":false,"mustStartWithNonAlpha":false,"mustStartWithAlpha":false,"mustntStartWithNonAlpha":false,"mustntStartWithAlpha":false,"mustEndWithNonAlpha":false,"mustEndWithAlpha":false,"mustntEndWithNonAlpha":false,"mustntEndWithAlpha":false,"wordsNotPermitted":[],"schemasNotPermitted":[],"prefixesNotPermitted":["notpermitted1","notpermitted2"],"suffixesNotPermitted":[]}'/>
+ specification='{"historyLength":1,"maxLength":0,"minLength":8,"nonAlphanumericRequired":false,"alphanumericRequired":false,"digitRequired":false,"lowercaseRequired":false,"uppercaseRequired":false,"mustStartWithDigit":false,"mustntStartWithDigit":false,"mustEndWithDigit":false,"mustntEndWithDigit":false,"mustStartWithNonAlpha":false,"mustStartWithAlpha":false,"mustntStartWithNonAlpha":false,"mustntStartWithAlpha":false,"mustEndWithNonAlpha":false,"mustEndWithAlpha":false,"mustntEndWithNonAlpha":false,"mustntEndWithAlpha":false,"wordsNotPermitted":[],"schemasNotPermitted":[],"prefixesNotPermitted":["notpermitted1","notpermitted2"],"suffixesNotPermitted":[],"allowNullPassword":true}'/>
<Policy DTYPE="SyncPolicy" id="3" description="sync policy 2" type="SYNC"
specification='{"userJavaRule":null,"roleJavaRule":null,"conflictResolutionAction":"ALL","userAltSearchSchemas":["username","firstname"],"roleAltSearchSchemas":[]}'/>
<Policy DTYPE="PasswordPolicy" id="4" description="sample password policy" type="PASSWORD"
- specification='{"historyLength":0,"maxLength":0,"minLength":10,"nonAlphanumericRequired":false,"alphanumericRequired":false,"digitRequired":true,"lowercaseRequired":false,"uppercaseRequired":false,"mustStartWithDigit":false,"mustntStartWithDigit":false,"mustEndWithDigit":false,"mustntEndWithDigit":false,"mustStartWithNonAlpha":false,"mustStartWithAlpha":false,"mustntStartWithNonAlpha":false,"mustntStartWithAlpha":false,"mustEndWithNonAlpha":false,"mustEndWithAlpha":false,"mustntEndWithNonAlpha":false,"mustntEndWithAlpha":false,"wordsNotPermitted":[],"schemasNotPermitted":[],"prefixesNotPermitted":["notpermitted1","notpermitted2"],"suffixesNotPermitted":[]}'/>
+ specification='{"historyLength":0,"maxLength":0,"minLength":10,"nonAlphanumericRequired":false,"alphanumericRequired":false,"digitRequired":true,"lowercaseRequired":false,"uppercaseRequired":false,"mustStartWithDigit":false,"mustntStartWithDigit":false,"mustEndWithDigit":false,"mustntEndWithDigit":false,"mustStartWithNonAlpha":false,"mustStartWithAlpha":false,"mustntStartWithNonAlpha":false,"mustntStartWithAlpha":false,"mustEndWithNonAlpha":false,"mustEndWithAlpha":false,"mustntEndWithNonAlpha":false,"mustntEndWithAlpha":false,"wordsNotPermitted":[],"schemasNotPermitted":[],"prefixesNotPermitted":["notpermitted1","notpermitted2"],"suffixesNotPermitted":[], "allowNullPassword":false}'/>
<Policy DTYPE="AccountPolicy" id="5" description="global account policy" type="GLOBAL_ACCOUNT"
specification='{"maxLength":0,"minLength":0,"pattern":null,"allUpperCase":false,"allLowerCase":false,"propagateSuspension":false,"permittedLoginRetries":0,"wordsNotPermitted":[],"schemasNotPermitted":[],"prefixesNotPermitted":[],"suffixesNotPermitted":[]}'/>
<Policy DTYPE="AccountPolicy" id="6" description="sample account policy" type="ACCOUNT"
@@ -84,7 +84,7 @@ under the License.
<Policy DTYPE="SyncPolicy" id="7" description="sync policy 1" type="SYNC"
specification='{"userJavaRule":null,"roleJavaRule":null,"conflictResolutionAction":"IGNORE","userAltSearchSchemas":[],"roleAltSearchSchemas":[]}'/>
<Policy DTYPE="PasswordPolicy" id="8" description="sample password policy" type="PASSWORD"
- specification='{"historyLength":0,"maxLength":0,"minLength":10,"nonAlphanumericRequired":true,"alphanumericRequired":false,"digitRequired":true,"lowercaseRequired":true,"uppercaseRequired":true,"mustStartWithDigit":true,"mustntStartWithDigit":false,"mustEndWithDigit":true,"mustntEndWithDigit":false,"mustStartWithNonAlpha":false,"mustStartWithAlpha":false,"mustntStartWithNonAlpha":false,"mustntStartWithAlpha":false,"mustEndWithNonAlpha":false,"mustEndWithAlpha":false,"mustntEndWithNonAlpha":false,"mustntEndWithAlpha":false,"wordsNotPermitted":[],"schemasNotPermitted":[],"prefixesNotPermitted":["notpermitted1","notpermitted2"],"suffixesNotPermitted":[]}'/>
+ specification='{"historyLength":0,"maxLength":0,"minLength":10,"nonAlphanumericRequired":true,"alphanumericRequired":false,"digitRequired":true,"lowercaseRequired":true,"uppercaseRequired":true,"mustStartWithDigit":true,"mustntStartWithDigit":false,"mustEndWithDigit":true,"mustntEndWithDigit":false,"mustStartWithNonAlpha":false,"mustStartWithAlpha":false,"mustntStartWithNonAlpha":false,"mustntStartWithAlpha":false,"mustEndWithNonAlpha":false,"mustEndWithAlpha":false,"mustntEndWithNonAlpha":false,"mustntEndWithAlpha":false,"wordsNotPermitted":[],"schemasNotPermitted":[],"prefixesNotPermitted":["notpermitted1","notpermitted2"],"suffixesNotPermitted":[],"allowNullPassword":false}'/>
<Policy DTYPE="SyncPolicy" id="9" description="sync policy for java rule" type="SYNC"
specification='{"userJavaRule":null,"roleJavaRule":null,"conflictResolutionAction":"IGNORE","userAltSearchSchemas":[],"roleAltSearchSchemas":[]}'/>
@@ -966,7 +966,7 @@ under the License.
<Task DTYPE="SyncTask" id="26" name="CSV (ignore matching; assign unmatching)" resource_name="resource-csv"
performCreate="1" performUpdate="1" performDelete="1" syncStatus="1" fullReconciliation="0"
jobClassName="org.apache.syncope.core.sync.impl.SyncJob" unmatchingRule="ASSIGN" matchingRule="IGNORE"/>
-
+
<Notification id="1" sender="test@syncope.apache.org" subject="Test subject" template="test" selfAsRecipient="0" traceLevel="ALL"
userAbout="fullname==*o*;fullname==*i*"
recipients="$roles==7"