IdentityLogExampleBulkAction extends AbstractBulkAction<IdmIdentityDto, IdmIdentityFilter> { @Override public NotificationLevel getLevel() { return NotificationLevel.INFO; }  @Override String getName(); @Override List<IdmFormAttributeDto> getFormAttributes(); @Override int getOrder(); @Override NotificationLevel getLevel(); @Override ReadWriteDtoService<IdmIdentityDto, IdmIdentityFilter> getService(); @Override boolean isRecoverable(); static final String BULK_ACTION_NAME; }
@Test public void processBulkAction() { IdmBulkActionDto exampleAction = findBulkAction(IdmIdentity.class, IdentityLogExampleBulkAction.BULK_ACTION_NAME); assertNotNull(exampleAction); Assert.assertEquals(NotificationLevel.INFO, exampleAction.getLevel()); IdmIdentityDto identity = getHelper().createIdentity(); IdmIdentityDto identity2 = getHelper().createIdentity(); IdmIdentityDto identity3 = getHelper().createIdentity(); exampleAction.setIdentifiers(Sets.newHashSet(identity.getId(), identity2.getId(), identity3.getId())); IdmBulkActionDto processAction = bulkActionManager.processAction(exampleAction); assertNotNull(processAction.getLongRunningTaskId()); IdmLongRunningTaskFilter context = new IdmLongRunningTaskFilter(); context.setIncludeItemCounts(true); IdmLongRunningTaskDto longRunningTask = longRunningTaskService.get(processAction.getLongRunningTaskId(), context); assertEquals(Long.valueOf(3), longRunningTask.getCount()); assertEquals(Long.valueOf(3), longRunningTask.getSuccessItemCount()); assertEquals(Long.valueOf(0), longRunningTask.getFailedItemCount()); assertEquals(Long.valueOf(0), longRunningTask.getWarningItemCount()); List<IdmProcessedTaskItemDto> items = getItemsForLrt(longRunningTask); assertEquals(3, items.size()); boolean identitySuccess = false; boolean identitySuccess2 = false; boolean identitySuccess3 = false; for (IdmProcessedTaskItemDto item : items) { if (item.getOperationResult().getState() != OperationState.EXECUTED) { fail("Identity " + item.getReferencedEntityId() + ", failed."); } if (item.getReferencedEntityId().equals(identity.getId())) { identitySuccess = true; } if (item.getReferencedEntityId().equals(identity2.getId())) { identitySuccess2 = true; } if (item.getReferencedEntityId().equals(identity3.getId())) { identitySuccess3 = true; } } assertTrue(identitySuccess); assertTrue(identitySuccess2); assertTrue(identitySuccess3); }