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 2014/06/24 15:25:21 UTC

svn commit: r1605077 [5/5] - in /syncope/trunk: ./ common/src/main/java/org/apache/syncope/common/services/ common/src/main/java/org/apache/syncope/common/to/ common/src/main/java/org/apache/syncope/common/types/ common/src/test/java/org/apache/syncope...

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=1605077&r1=1605076&r2=1605077&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 Tue Jun 24 13:25:18 2014
@@ -57,7 +57,6 @@ import org.apache.syncope.common.service
 import org.apache.syncope.common.services.UserSelfService;
 import org.apache.syncope.common.services.UserService;
 import org.apache.syncope.common.to.AttributeTO;
-import org.apache.syncope.common.to.ConfigurationTO;
 import org.apache.syncope.common.to.ConnObjectTO;
 import org.apache.syncope.common.to.MappingItemTO;
 import org.apache.syncope.common.to.MappingTO;
@@ -1390,16 +1389,13 @@ public class UserTestITCase extends Abst
 
     @Test()
     public void issueSYNCOPE51() {
-        ConfigurationTO defaultConfigurationTO = configurationService.read("password.cipher.algorithm");
-
-        ConfigurationTO configurationTO = new ConfigurationTO();
-        configurationTO.setKey("password.cipher.algorithm");
-        configurationTO.setValue("MD5");
-
-        configurationService.update(configurationTO.getKey(), configurationTO);
-        ConfigurationTO newConfTO = configurationService.read(configurationTO.getKey());
-
-        assertEquals(configurationTO, newConfTO);
+        AttributeTO defaultCA = configurationService.read("password.cipher.algorithm");
+        final String originalCAValue = defaultCA.getValues().get(0);
+        defaultCA.getValues().set(0, "MD5");
+        configurationService.set(defaultCA.getSchema(), defaultCA);
+        
+        AttributeTO newCA = configurationService.read(defaultCA.getSchema());
+        assertEquals(defaultCA, newCA);
 
         UserTO userTO = getSampleTO("syncope51@syncope.apache.org");
         userTO.setPassword("password");
@@ -1409,13 +1405,14 @@ public class UserTestITCase extends Abst
             fail("Create user should not succeed");
         } catch (SyncopeClientException e) {
             assertEquals(ClientExceptionType.NotFound, e.getType());
-            assertTrue(e.getElements().iterator().next().toString().contains("MD5"));
+            assertTrue(e.getElements().iterator().next().contains("MD5"));
         }
 
-        configurationService.update(defaultConfigurationTO.getKey(), defaultConfigurationTO);
-        ConfigurationTO oldConfTO = configurationService.read(defaultConfigurationTO.getKey());
-
-        assertEquals(defaultConfigurationTO, oldConfTO);
+        defaultCA.getValues().set(0, originalCAValue);
+        configurationService.set(defaultCA.getSchema(), defaultCA);
+        
+        AttributeTO oldCA = configurationService.read(defaultCA.getSchema());
+        assertEquals(defaultCA, oldCA);
     }
 
     @Test
@@ -1546,12 +1543,12 @@ public class UserTestITCase extends Abst
     @Test
     public void isseSYNCOPE136AES() {
         // 1. read configured cipher algorithm in order to be able to restore it at the end of test
-        ConfigurationTO pwdCipherAlgo = configurationService.read("password.cipher.algorithm");
-        final String origpwdCipherAlgo = pwdCipherAlgo.getValue();
+        AttributeTO pwdCipherAlgo = configurationService.read("password.cipher.algorithm");
+        final String origpwdCipherAlgo = pwdCipherAlgo.getValues().get(0);
 
         // 2. set AES password cipher algorithm
-        pwdCipherAlgo.setValue("AES");
-        configurationService.update(pwdCipherAlgo.getKey(), pwdCipherAlgo);
+        pwdCipherAlgo.getValues().set(0, "AES");
+        configurationService.set(pwdCipherAlgo.getSchema(), pwdCipherAlgo);
 
         // 3. create user with no resources
         UserTO userTO = getUniqueSampleTO("syncope136_AES@apache.org");
@@ -1578,8 +1575,8 @@ public class UserTestITCase extends Abst
         assertEquals(PropagationTaskExecStatus.SUBMITTED, prop.getStatus());
 
         // 6. restore initial cipher algorithm
-        pwdCipherAlgo.setValue(origpwdCipherAlgo);
-        configurationService.update(pwdCipherAlgo.getKey(), pwdCipherAlgo);
+        pwdCipherAlgo.getValues().set(0, origpwdCipherAlgo);
+        configurationService.set(pwdCipherAlgo.getSchema(), pwdCipherAlgo);
     }
 
     @Test

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/data/SearchCondConverterTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/data/SearchCondConverterTest.java?rev=1605077&r1=1605076&r2=1605077&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/data/SearchCondConverterTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/data/SearchCondConverterTest.java Tue Jun 24 13:25:18 2014
@@ -23,7 +23,7 @@ import static org.junit.Assert.assertEqu
 import org.apache.syncope.client.SyncopeClient;
 import org.apache.syncope.common.search.SpecialAttr;
 import org.apache.syncope.core.AbstractNonDAOTest;
-import org.apache.syncope.core.persistence.dao.search.AttributableCond;
+import org.apache.syncope.core.persistence.dao.search.SubjectCond;
 import org.apache.syncope.core.persistence.dao.search.AttributeCond;
 import org.apache.syncope.core.persistence.dao.search.EntitlementCond;
 import org.apache.syncope.core.persistence.dao.search.MembershipCond;
@@ -38,7 +38,7 @@ public class SearchCondConverterTest ext
         String fiqlExpression = SyncopeClient.getUserSearchConditionBuilder().is("username").equalTo("rossini").query();
         assertEquals("username==rossini", fiqlExpression);
 
-        AttributableCond attrCond = new AttributableCond(AttributeCond.Type.EQ);
+        SubjectCond attrCond = new SubjectCond(AttributeCond.Type.EQ);
         attrCond.setSchema("username");
         attrCond.setExpression("rossini");
         SearchCond simpleCond = SearchCond.getLeafCond(attrCond);
@@ -51,7 +51,7 @@ public class SearchCondConverterTest ext
         String fiqlExpression = SyncopeClient.getUserSearchConditionBuilder().is("username").equalTo("ros*").query();
         assertEquals("username==ros*", fiqlExpression);
 
-        AttributeCond attrCond = new AttributableCond(AttributeCond.Type.LIKE);
+        AttributeCond attrCond = new SubjectCond(AttributeCond.Type.LIKE);
         attrCond.setSchema("username");
         attrCond.setExpression("ros%");
         SearchCond simpleCond = SearchCond.getLeafCond(attrCond);

Modified: syncope/trunk/core/src/test/resources/content.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/resources/content.xml?rev=1605077&r1=1605076&r2=1605077&view=diff
==============================================================================
--- syncope/trunk/core/src/test/resources/content.xml (original)
+++ syncope/trunk/core/src/test/resources/content.xml Tue Jun 24 13:25:18 2014
@@ -18,20 +18,55 @@ specific language governing permissions 
 under the License.
 -->
 <dataset>
-  <SyncopeConf confKey="password.cipher.algorithm" confValue="SHA1"/>
+  <SyncopeConf id="1" 
+               creator="admin" lastModifier="admin"
+               creationDate="2014-06-20 11:00:00" lastChangeDate="2014-06-20 11:00:00"/>
+
+  <CSchema name="password.cipher.algorithm" type="String"
+           mandatoryCondition="true" multivalue="0" uniqueConstraint="0" readonly="0"/>
+  <CAttr id="1" owner_id="1" schema_name="password.cipher.algorithm"/>
+  <CAttrValue id="1" attribute_id="1" stringValue="SHA1"/>
+
   <!-- notificationjob.cronExpression:
   + not existing: NotificationJob runs according to Notification.DEFAULT_CRON_EXP
   + provided as empty string: NotificationJob disabled
   + provided as non-empty string: NotificationJob runs according to the given value -->
-  <SyncopeConf confKey="notificationjob.cronExpression" confValue=""/>
-  <SyncopeConf confKey="notification.maxRetries" confValue="3"/>
-  <SyncopeConf confKey="token.length" confValue="256"/>
-  <SyncopeConf confKey="token.expireTime" confValue="60"/>
-  <SyncopeConf confKey="selfRegistration.allowed" confValue="true"/>
-  <!-- when needing to provide more values, use '|' as separator and no spaces -->
-  <SyncopeConf confKey="authentication.statuses" confValue="created|active"/>
+  <CSchema name="notificationjob.cronExpression" type="String"
+           mandatoryCondition="false" multivalue="0" uniqueConstraint="0" readonly="0"/>
+  <CAttr id="2" owner_id="1" schema_name="notificationjob.cronExpression"/>
+  <CAttrValue id="2" attribute_id="2" stringValue=""/>
+
+  <CSchema name="notification.maxRetries" type="Long"
+           mandatoryCondition="true" multivalue="0" uniqueConstraint="0" readonly="0"/>
+  <CAttr id="3" owner_id="1" schema_name="notification.maxRetries"/>
+  <CAttrValue id="3" attribute_id="3" longValue="3"/>
+
+  <CSchema name="token.length" type="Long"
+           mandatoryCondition="true" multivalue="0" uniqueConstraint="0" readonly="0"/>
+  <CAttr id="4" owner_id="1" schema_name="token.length"/>
+  <CAttrValue id="4" attribute_id="4" longValue="256"/>
+
+  <CSchema name="token.expireTime" type="Long"
+           mandatoryCondition="true" multivalue="0" uniqueConstraint="0" readonly="0"/>
+  <CAttr id="5" owner_id="1" schema_name="token.expireTime"/>
+  <CAttrValue id="5" attribute_id="5" longValue="60"/>
+
+  <CSchema name="selfRegistration.allowed" type="Boolean"
+           mandatoryCondition="true" multivalue="0" uniqueConstraint="0" readonly="0"/>
+  <CAttr id="6" owner_id="1" schema_name="selfRegistration.allowed"/>
+  <CAttrValue id="6" attribute_id="6" booleanValue="1"/>
+
+  <CSchema name="authentication.statuses" type="String"
+           mandatoryCondition="true" multivalue="1" uniqueConstraint="0" readonly="0"/>
+  <CAttr id="7" owner_id="1" schema_name="authentication.statuses"/>
+  <CAttrValue id="7" attribute_id="7" stringValue="created"/>
+  <CAttrValue id="8" attribute_id="7" stringValue="active"/>
+
   <!-- Save user login date upon successful authentication -->
-  <SyncopeConf confKey="log.lastlogindate" confValue="true"/>
+  <CSchema name="log.lastlogindate" type="Boolean"
+           mandatoryCondition="true" multivalue="0" uniqueConstraint="0" readonly="0"/>
+  <CAttr id="10" owner_id="1" schema_name="log.lastlogindate"/>
+  <CAttrValue id="10" attribute_id="10" booleanValue="1"/>
 
   <!-- sample policies -->
   <Policy DTYPE="SyncPolicy" id="1" description="global sync policy" type="GLOBAL_SYNC" specification="%3Corg.apache.syncope.common.types.SyncPolicySpec%3E%0A++%3CuAltSearchSchemas%2F%3E%0A++%3CrAltSearchSchemas%2F%3E%0A%3C%2Forg.apache.syncope.common.types.SyncPolicySpec%3E"/>
@@ -923,10 +958,10 @@ under the License.
   <Entitlement name="CONNECTOR_UPDATE"/>
   <Entitlement name="CONNECTOR_DELETE"/>
   <Entitlement name="CONNECTOR_RELOAD"/>
+  <Entitlement name="CONFIGURATION_EXPORT"/>
   <Entitlement name="CONFIGURATION_LIST"/>
-  <Entitlement name="CONFIGURATION_CREATE"/>
   <Entitlement name="CONFIGURATION_READ"/>
-  <Entitlement name="CONFIGURATION_UPDATE"/>
+  <Entitlement name="CONFIGURATION_SET"/>
   <Entitlement name="CONFIGURATION_DELETE"/>
   <Entitlement name="TASK_LIST"/>
   <Entitlement name="TASK_CREATE"/>

Modified: syncope/trunk/pom.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/pom.xml?rev=1605077&r1=1605076&r2=1605077&view=diff
==============================================================================
--- syncope/trunk/pom.xml (original)
+++ syncope/trunk/pom.xml Tue Jun 24 13:25:18 2014
@@ -1125,6 +1125,7 @@ under the License.
                 <downloadDir>${settings.localRepository}/org/codehaus/cargo/cargo-container-archives</downloadDir>
                 <extractDir>${project.build.directory}/cargo/extract</extractDir>
               </zipUrlInstaller>
+              <timeout>240000</timeout>
               <log>${cargo.log}</log>
               <output>${cargo.output}</output>    
             </container>