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());
}
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());
}
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());
}
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);
}
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);
}
Aggregations