Search in sources :

Example 16 with IdmBulkActionDto

use of eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto in project CzechIdMng by bcvsolutions.

the class NotificationTemplateBackupBulkActionIntegrationTest method processBulkActionWithoutPermission.

@Test
public void processBulkActionWithoutPermission() {
    IdmNotificationTemplateDto template1 = templateService.getByCode(TEST_TEMPLATE);
    Set<UUID> templates = new HashSet<UUID>();
    templates.add(template1.getId());
    template1.setSubject(CHANGED_TEST_DESC);
    template1 = templateService.save(template1);
    assertEquals(template1.getSubject(), CHANGED_TEST_DESC);
    // user hasn't permission for script update
    IdmIdentityDto readerIdentity = this.createUserWithAuthorities(IdmBasePermission.UPDATE);
    loginAsNoAdmin(readerIdentity.getUsername());
    IdmBulkActionDto bulkAction = this.findBulkAction(IdmNotificationTemplate.class, NotificationTemplateBackupBulkAction.NAME);
    bulkAction.setIdentifiers(templates);
    IdmBulkActionDto processAction = bulkActionManager.processAction(bulkAction);
    checkResultLrt(processAction, 0l, null, null);
    // no backup files exits
    assertNull(getBackupFiles());
}
Also used : IdmBulkActionDto(eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto) IdmNotificationTemplateDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto) UUID(java.util.UUID) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) HashSet(java.util.HashSet) AbstractBulkActionTest(eu.bcvsolutions.idm.test.api.AbstractBulkActionTest) Test(org.junit.Test)

Example 17 with IdmBulkActionDto

use of eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto in project CzechIdMng by bcvsolutions.

the class NotificationTemplateBackupBulkActionIntegrationTest method prevalidationBulkActionByIds.

@Test
public void prevalidationBulkActionByIds() {
    IdmNotificationTemplateDto template1 = templateService.getByCode(TEST_TEMPLATE);
    IdmBulkActionDto bulkAction = this.findBulkAction(IdmNotificationTemplate.class, NotificationTemplateBackupBulkAction.NAME);
    bulkAction.getIdentifiers().add(template1.getId());
    // None info results
    ResultModels resultModels = bulkActionManager.prevalidate(bulkAction);
    List<ResultModel> results = resultModels.getInfos();
    assertEquals(1, results.size());
    assertEquals(results.get(0).getStatusEnum(), CoreResultCode.BACKUP_FOLDER_FOUND.toString());
}
Also used : IdmBulkActionDto(eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto) ResultModel(eu.bcvsolutions.idm.core.api.dto.ResultModel) IdmNotificationTemplateDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto) ResultModels(eu.bcvsolutions.idm.core.api.dto.ResultModels) AbstractBulkActionTest(eu.bcvsolutions.idm.test.api.AbstractBulkActionTest) Test(org.junit.Test)

Example 18 with IdmBulkActionDto

use of eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto in project CzechIdMng by bcvsolutions.

the class NotificationTemplateBackupBulkActionIntegrationTest method processBulkActionByFilter.

@Test
public void processBulkActionByFilter() {
    IdmNotificationTemplateDto template1 = templateService.getByCode(TEST_TEMPLATE);
    Set<UUID> templates = new HashSet<UUID>();
    templates.add(template1.getId());
    template1.setSubject(CHANGED_TEST_DESC);
    template1 = templateService.save(template1);
    assertEquals(template1.getSubject(), CHANGED_TEST_DESC);
    IdmNotificationTemplateFilter filter = new IdmNotificationTemplateFilter();
    filter.setText(CHANGED_TEST_DESC);
    List<IdmNotificationTemplateDto> checkScripts = templateService.find(filter, null).getContent();
    assertEquals(1, checkScripts.size());
    IdmBulkActionDto bulkAction = this.findBulkAction(IdmNotificationTemplate.class, NotificationTemplateBackupBulkAction.NAME);
    bulkAction.setTransformedFilter(filter);
    bulkAction.setFilter(toMap(filter));
    IdmBulkActionDto processAction = bulkActionManager.processAction(bulkAction);
    checkResultLrt(processAction, 1l, null, null);
    testBackupFileContent(template1, loggedUser.getUsername());
}
Also used : IdmNotificationTemplateFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationTemplateFilter) IdmBulkActionDto(eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto) IdmNotificationTemplateDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto) UUID(java.util.UUID) HashSet(java.util.HashSet) AbstractBulkActionTest(eu.bcvsolutions.idm.test.api.AbstractBulkActionTest) Test(org.junit.Test)

Example 19 with IdmBulkActionDto

use of eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto in project CzechIdMng by bcvsolutions.

the class NotificationTemplateRedeployBulkActionIntegrationTest method processBulkActionWithoutPermission.

@Test
public void processBulkActionWithoutPermission() {
    IdmNotificationTemplateDto template1 = templateService.getByCode(TEST_TEMPLATE);
    Set<UUID> templates = new HashSet<UUID>();
    templates.add(template1.getId());
    String origSubj = template1.getSubject();
    template1.setSubject(CHANGED_TEST_DESC);
    template1 = templateService.save(template1);
    assertNotEquals(template1.getSubject(), origSubj);
    // user hasn't permission for script update
    IdmIdentityDto readerIdentity = this.createUserWithAuthorities(IdmBasePermission.READ);
    loginAsNoAdmin(readerIdentity.getUsername());
    IdmBulkActionDto bulkAction = this.findBulkAction(IdmNotificationTemplate.class, NotificationTemplateRedeployBulkAction.NAME);
    bulkAction.setIdentifiers(templates);
    IdmBulkActionDto processAction = bulkActionManager.processAction(bulkAction);
    checkResultLrt(processAction, 0l, null, null);
    template1 = templateService.get(template1.getId());
    assertEquals(template1.getSubject(), CHANGED_TEST_DESC);
}
Also used : IdmBulkActionDto(eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto) IdmNotificationTemplateDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto) UUID(java.util.UUID) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) HashSet(java.util.HashSet) AbstractBulkActionTest(eu.bcvsolutions.idm.test.api.AbstractBulkActionTest) Test(org.junit.Test)

Example 20 with IdmBulkActionDto

use of eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto in project CzechIdMng by bcvsolutions.

the class NotificationTemplateRedeployBulkActionIntegrationTest method processBulkActionByIds.

@Test
public void processBulkActionByIds() {
    IdmNotificationTemplateDto template1 = templateService.getByCode(TEST_TEMPLATE);
    Set<UUID> templates = new HashSet<UUID>();
    templates.add(template1.getId());
    String origSubj = template1.getSubject();
    template1.setSubject(CHANGED_TEST_DESC);
    template1 = templateService.save(template1);
    assertNotEquals(template1.getSubject(), origSubj);
    IdmBulkActionDto bulkAction = this.findBulkAction(IdmNotificationTemplate.class, NotificationTemplateRedeployBulkAction.NAME);
    bulkAction.setIdentifiers(templates);
    IdmBulkActionDto processAction = bulkActionManager.processAction(bulkAction);
    checkResultLrt(processAction, 1l, null, null);
    template1 = templateService.get(template1.getId());
    assertEquals(template1.getSubject(), origSubj);
}
Also used : IdmBulkActionDto(eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto) IdmNotificationTemplateDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto) UUID(java.util.UUID) HashSet(java.util.HashSet) AbstractBulkActionTest(eu.bcvsolutions.idm.test.api.AbstractBulkActionTest) Test(org.junit.Test)

Aggregations

IdmBulkActionDto (eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto)262 Test (org.junit.Test)238 AbstractBulkActionTest (eu.bcvsolutions.idm.test.api.AbstractBulkActionTest)220 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)142 UUID (java.util.UUID)129 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)98 HashMap (java.util.HashMap)72 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)64 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)52 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)41 IdmIdentityRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto)38 ResultModels (eu.bcvsolutions.idm.core.api.dto.ResultModels)35 HashSet (java.util.HashSet)33 List (java.util.List)29 Autowired (org.springframework.beans.factory.annotation.Autowired)26 IdmFormAttributeDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto)24 After (org.junit.After)21 Assert (org.junit.Assert)21 Before (org.junit.Before)21 IdmTreeNodeDto (eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto)20