@SuppressWarnings("deprecation") @Test public void testExecuteApprovePrivateGroupTest() throws Exception { final ReviewPendingGroupRequest request = new ReviewPendingGroupRequest(GROUP_SHORTNAME, true); setupCommonExpectations(); context.checking(new Expectations() { { oneOf(group).setPending(false); oneOf(groupMapper).flush(); oneOf(group).isPublicGroup(); will(returnValue(false)); oneOf(addPrivateGroupIdToCachedListMock).execute(GROUP_ID); } }); List<UserActionRequest> asyncRequests = callExecute(request); context.assertIsSatisfied(); assertEquals(1, asyncRequests.size()); assertEquals("createNotificationsAction", asyncRequests.get(0).getActionKey()); TargetEntityNotificationsRequest expected = new TargetEntityNotificationsRequest( RequestType.REQUEST_NEW_GROUP_APPROVED, 0L, GROUP_ID); assertTrue(IsEqualInternally.areEqualInternally(expected, asyncRequests.get(0).getParams())); }
@Override public Serializable execute(final TaskHandlerActionContext<PrincipalActionContext> inActionContext) { try { ReviewPendingGroupRequest request = (ReviewPendingGroupRequest) inActionContext.getActionContext() .getParams(); DomainGroup group = groupMapper.findByShortName(request.getGroupShortName()); final long groupId = group.getId(); if (log.isInfoEnabled()) { log.info((request.getApproved() ? "Approving" : "Disapproving") + " pending group '" + request.getGroupShortName() + "' with id " + groupId); } notifyCoordinators(inActionContext, group, request); if (request.getApproved()) { group.setPending(false); groupMapper.flush(); if (!group.isPublicGroup()) { addPrivateGroupIdToCachedListMapper.execute(groupId); } } else { new InlineExecutionStrategyExecutor().execute(deleteGroupExecution, groupId, inActionContext); } } catch (Exception e) { throw new ExecutionException(e); } return true; }
ReviewPendingGroupExecution implements TaskHandlerExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final TaskHandlerActionContext<PrincipalActionContext> inActionContext) { try { ReviewPendingGroupRequest request = (ReviewPendingGroupRequest) inActionContext.getActionContext() .getParams(); DomainGroup group = groupMapper.findByShortName(request.getGroupShortName()); final long groupId = group.getId(); if (log.isInfoEnabled()) { log.info((request.getApproved() ? "Approving" : "Disapproving") + " pending group '" + request.getGroupShortName() + "' with id " + groupId); } notifyCoordinators(inActionContext, group, request); if (request.getApproved()) { group.setPending(false); groupMapper.flush(); if (!group.isPublicGroup()) { addPrivateGroupIdToCachedListMapper.execute(groupId); } } else { new InlineExecutionStrategyExecutor().execute(deleteGroupExecution, groupId, inActionContext); } } catch (Exception e) { throw new ExecutionException(e); } return true; } }
ReviewPendingGroupExecution implements TaskHandlerExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final TaskHandlerActionContext<PrincipalActionContext> inActionContext) { try { ReviewPendingGroupRequest request = (ReviewPendingGroupRequest) inActionContext.getActionContext() .getParams(); DomainGroup group = groupMapper.findByShortName(request.getGroupShortName()); final long groupId = group.getId(); if (log.isInfoEnabled()) { log.info((request.getApproved() ? "Approving" : "Disapproving") + " pending group '" + request.getGroupShortName() + "' with id " + groupId); } notifyCoordinators(inActionContext, group, request); if (request.getApproved()) { group.setPending(false); groupMapper.flush(); if (!group.isPublicGroup()) { addPrivateGroupIdToCachedListMapper.execute(groupId); } } else { new InlineExecutionStrategyExecutor().execute(deleteGroupExecution, groupId, inActionContext); } } catch (Exception e) { throw new ExecutionException(e); } return true; } ReviewPendingGroupExecution(final DomainGroupMapper inGroupMapper,
            final AddPrivateGroupIdToCachedCoordinatorAccessList inAddPrivateGroupIdToCachedListMapper,
            final TaskHandlerExecutionStrategy inDeleteGroupExecution); }
ReviewPendingGroupExecution implements TaskHandlerExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final TaskHandlerActionContext<PrincipalActionContext> inActionContext) { try { ReviewPendingGroupRequest request = (ReviewPendingGroupRequest) inActionContext.getActionContext() .getParams(); DomainGroup group = groupMapper.findByShortName(request.getGroupShortName()); final long groupId = group.getId(); if (log.isInfoEnabled()) { log.info((request.getApproved() ? "Approving" : "Disapproving") + " pending group '" + request.getGroupShortName() + "' with id " + groupId); } notifyCoordinators(inActionContext, group, request); if (request.getApproved()) { group.setPending(false); groupMapper.flush(); if (!group.isPublicGroup()) { addPrivateGroupIdToCachedListMapper.execute(groupId); } } else { new InlineExecutionStrategyExecutor().execute(deleteGroupExecution, groupId, inActionContext); } } catch (Exception e) { throw new ExecutionException(e); } return true; } ReviewPendingGroupExecution(final DomainGroupMapper inGroupMapper,
            final AddPrivateGroupIdToCachedCoordinatorAccessList inAddPrivateGroupIdToCachedListMapper,
            final TaskHandlerExecutionStrategy inDeleteGroupExecution); @Override Serializable execute(final TaskHandlerActionContext<PrincipalActionContext> inActionContext); }
ReviewPendingGroupExecution implements TaskHandlerExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final TaskHandlerActionContext<PrincipalActionContext> inActionContext) { try { ReviewPendingGroupRequest request = (ReviewPendingGroupRequest) inActionContext.getActionContext() .getParams(); DomainGroup group = groupMapper.findByShortName(request.getGroupShortName()); final long groupId = group.getId(); if (log.isInfoEnabled()) { log.info((request.getApproved() ? "Approving" : "Disapproving") + " pending group '" + request.getGroupShortName() + "' with id " + groupId); } notifyCoordinators(inActionContext, group, request); if (request.getApproved()) { group.setPending(false); groupMapper.flush(); if (!group.isPublicGroup()) { addPrivateGroupIdToCachedListMapper.execute(groupId); } } else { new InlineExecutionStrategyExecutor().execute(deleteGroupExecution, groupId, inActionContext); } } catch (Exception e) { throw new ExecutionException(e); } return true; } ReviewPendingGroupExecution(final DomainGroupMapper inGroupMapper,
            final AddPrivateGroupIdToCachedCoordinatorAccessList inAddPrivateGroupIdToCachedListMapper,
            final TaskHandlerExecutionStrategy inDeleteGroupExecution); @Override Serializable execute(final TaskHandlerActionContext<PrincipalActionContext> inActionContext);  }