@Test public void testExecuteDenyPrivateGroupTest() throws Exception { final ReviewPendingGroupRequest request = new ReviewPendingGroupRequest(GROUP_SHORTNAME, false); setupCommonExpectations(); final AnonymousClassInterceptor<TaskHandlerActionContext<ActionContext>> intCtx = new AnonymousClassInterceptor<TaskHandlerActionContext<ActionContext>>(); context.checking(new Expectations() { { oneOf(deleteGroupExecution).execute(with(any(TaskHandlerActionContext.class))); will(intCtx); } }); List<UserActionRequest> asyncRequests = callExecute(request); context.assertIsSatisfied(); assertEquals(1, asyncRequests.size()); assertEquals("createNotificationsAction", asyncRequests.get(0).getActionKey()); GroupRemovedNotificationsRequest params = (GroupRemovedNotificationsRequest) asyncRequests.get(0).getParams(); assertEquals(RequestType.REQUEST_NEW_GROUP_DENIED, params.getType()); assertEquals(GROUP_NAME, params.getGroupName()); assertTrue("Expected recipient list", TestHelper.containsExactly(params.getCoordinatorIds(), 7L, 8L)); }
@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);  }