syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [1/2] syncope git commit: [SYNCOPE-1067] Fix test execution
Date Fri, 09 Jun 2017 07:54:12 GMT
Repository: syncope
Updated Branches:
  refs/heads/2_0_X 062c87a25 -> d6d52e1ac
  refs/heads/master a1bb67231 -> 8683655c6


[SYNCOPE-1067] Fix test execution


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/d6d52e1a
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/d6d52e1a
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/d6d52e1a

Branch: refs/heads/2_0_X
Commit: d6d52e1aca563168c3ad53f17ca0d9ae9370d427
Parents: 062c87a
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Fri Jun 9 09:53:54 2017 +0200
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Fri Jun 9 09:53:54 2017 +0200

----------------------------------------------------------------------
 .../apache/syncope/fit/core/DynRealmITCase.java | 33 ++++++++++----------
 .../syncope/fit/core/ExceptionMapperITCase.java |  2 +-
 2 files changed, 17 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/d6d52e1a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DynRealmITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DynRealmITCase.java
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DynRealmITCase.java
index e773716..1ad59ea 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DynRealmITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DynRealmITCase.java
@@ -113,13 +113,12 @@ public class DynRealmITCase extends AbstractITCase {
             role = createRole(role);
             assertNotNull(role);
 
-            // 3. assign the new role to vivaldi
-            UserPatch userPatch = new UserPatch();
-            userPatch.setKey("b3cbc78d-32e6-4bd4-92e0-bbe07566a2ee");
-            userPatch.getRoles().add(new StringPatchItem.Builder().value(role.getKey()).build());
-            UserTO vivaldi = updateUser(userPatch).getEntity();
-            assertNotNull(vivaldi);
-            assertTrue(vivaldi.getRoles().contains(role.getKey()));
+            // 3. create new user and assign the new role
+            UserTO dynRealmAdmin = UserITCase.getUniqueSampleTO("dynRealmAdmin@apache.org");
+            dynRealmAdmin.setPassword("password123");
+            dynRealmAdmin.getRoles().add(role.getKey());
+            dynRealmAdmin = createUser(dynRealmAdmin).getEntity();
+            assertNotNull(dynRealmAdmin);
 
             // 4. create new user and group, assign resource-ldap
             UserTO user = UserITCase.getUniqueSampleTO("dynRealmUser@apache.org");
@@ -158,20 +157,20 @@ public class DynRealmITCase extends AbstractITCase {
                 }
             }));
 
-            // 6. perpare to act as vivaldi
-            SyncopeClient vivaldiClient = clientFactory.create("vivaldi", ADMIN_PWD);
-            UserService vivaldiUserService = vivaldiClient.getService(UserService.class);
-            GroupService vivaldiGroupService = vivaldiClient.getService(GroupService.class);
+            // 6. prepare to act as delegated admin
+            SyncopeClient delegatedClient = clientFactory.create(dynRealmAdmin.getUsername(),
"password123");
+            UserService delegatedUserService = delegatedClient.getService(UserService.class);
+            GroupService delegatedGroupService = delegatedClient.getService(GroupService.class);
 
             // 7. verify delegated administration
             // USER_READ
-            assertNotNull(vivaldiUserService.read(userKey));
+            assertNotNull(delegatedUserService.read(userKey));
 
             // GROUP_READ
-            assertNotNull(vivaldiGroupService.read(groupKey));
+            assertNotNull(delegatedGroupService.read(groupKey));
 
             // USER_SEARCH
-            matchingUsers = vivaldiUserService.search(new AnyQuery.Builder().realm("/").build());
+            matchingUsers = delegatedUserService.search(new AnyQuery.Builder().realm("/").build());
             assertTrue(IterableUtils.matchesAny(matchingUsers.getResult(), new Predicate<UserTO>()
{
 
                 @Override
@@ -181,10 +180,10 @@ public class DynRealmITCase extends AbstractITCase {
             }));
 
             // USER_UPDATE
-            userPatch = new UserPatch();
+            UserPatch userPatch = new UserPatch();
             userPatch.setKey(userKey);
             userPatch.getResources().add(new StringPatchItem.Builder().value(RESOURCE_NAME_NOPROPAGATION).build());
-            user = vivaldiUserService.update(userPatch).
+            user = delegatedUserService.update(userPatch).
                     readEntity(new GenericType<ProvisioningResult<UserTO>>()
{
                     }).getEntity();
             assertNotNull(user);
@@ -194,7 +193,7 @@ public class DynRealmITCase extends AbstractITCase {
             GroupPatch groupPatch = new GroupPatch();
             groupPatch.setKey(groupKey);
             groupPatch.getPlainAttrs().add(new AttrPatch.Builder().attrTO(attrTO("icon",
"modified")).build());
-            group = vivaldiGroupService.update(groupPatch).
+            group = delegatedGroupService.update(groupPatch).
                     readEntity(new GenericType<ProvisioningResult<GroupTO>>()
{
                     }).getEntity();
             assertNotNull(group);

http://git-wip-us.apache.org/repos/asf/syncope/blob/d6d52e1a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ExceptionMapperITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ExceptionMapperITCase.java
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ExceptionMapperITCase.java
index 9db9031..0e6357f 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ExceptionMapperITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ExceptionMapperITCase.java
@@ -125,7 +125,7 @@ public class ExceptionMapperITCase extends AbstractITCase {
             fail();
         } catch (Exception e) {
             String message = ERROR_MESSAGES.getProperty("errMessage.UniqueConstraintViolation");
-            assertEquals("EntityExists [" + message + "]", e.getMessage());
+            assertEquals("DataIntegrityViolation [" + message + "]", e.getMessage());
         }
     }
 


Mime
View raw message