Search in sources :

Example 1 with UpdateGroupParams

use of com.enonic.xp.security.UpdateGroupParams in project xp by enonic.

the class SecurityServiceImplTest method testUpdateGroup.

@Test
public void testUpdateGroup() throws Exception {
    runAsAdmin(() -> {
        final CreateGroupParams createGroup = CreateGroupParams.create().groupKey(PrincipalKey.ofGroup(SYSTEM, "Group-a")).displayName("Group A").build();
        final Group group = securityService.createGroup(createGroup);
        refresh();
        final UpdateGroupParams groupUpdate = UpdateGroupParams.create(group).displayName("___Group B___").description("description").build();
        final Group updatedGroupResult = securityService.updateGroup(groupUpdate);
        refresh();
        final Group updatedGroup = securityService.getGroup(group.getKey()).get();
        assertEquals("___Group B___", updatedGroupResult.getDisplayName());
        assertEquals("___Group B___", updatedGroup.getDisplayName());
        assertEquals("description", updatedGroupResult.getDescription());
        assertEquals("description", updatedGroup.getDescription());
    });
}
Also used : Group(com.enonic.xp.security.Group) UpdateGroupParams(com.enonic.xp.security.UpdateGroupParams) CreateGroupParams(com.enonic.xp.security.CreateGroupParams) AbstractElasticsearchIntegrationTest(com.enonic.xp.repo.impl.elasticsearch.AbstractElasticsearchIntegrationTest) Test(org.junit.jupiter.api.Test)

Aggregations

AbstractElasticsearchIntegrationTest (com.enonic.xp.repo.impl.elasticsearch.AbstractElasticsearchIntegrationTest)1 CreateGroupParams (com.enonic.xp.security.CreateGroupParams)1 Group (com.enonic.xp.security.Group)1 UpdateGroupParams (com.enonic.xp.security.UpdateGroupParams)1 Test (org.junit.jupiter.api.Test)1