@Test public void testExecuteSetAlready() { sut = new UpdateActivityFlagExecution(setFlagMapper, true); final UpdateActivityFlagRequest rqst = new UpdateActivityFlagRequest(ACTIVITY_ID, true); context.checking(new Expectations() { { oneOf(setFlagMapper).execute(with(equalInternally(rqst))); will(returnValue(false)); } }); sut.execute(contextOuter); context.assertIsSatisfied(); assertTrue(userActionRequests.isEmpty()); }
@Override public Serializable execute(final TaskHandlerActionContext<PrincipalActionContext> inActionContext) throws ExecutionException { Long activityId = (Long) inActionContext.getActionContext().getParams(); boolean updated = setFlagMapper.execute(new UpdateActivityFlagRequest(activityId, toFlag)); if (toFlag && updated) { inActionContext.getUserActionRequests().add( new UserActionRequest(CreateNotificationsRequest.ACTION_NAME, null, new ActivityNotificationsRequest(RequestType.FLAG_ACTIVITY, inActionContext .getActionContext().getPrincipal().getId(), 0L, activityId))); } return toFlag; }
UpdateActivityFlagExecution implements TaskHandlerExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final TaskHandlerActionContext<PrincipalActionContext> inActionContext) throws ExecutionException { Long activityId = (Long) inActionContext.getActionContext().getParams(); boolean updated = setFlagMapper.execute(new UpdateActivityFlagRequest(activityId, toFlag)); if (toFlag && updated) { inActionContext.getUserActionRequests().add( new UserActionRequest(CreateNotificationsRequest.ACTION_NAME, null, new ActivityNotificationsRequest(RequestType.FLAG_ACTIVITY, inActionContext .getActionContext().getPrincipal().getId(), 0L, activityId))); } return toFlag; } }
UpdateActivityFlagExecution implements TaskHandlerExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final TaskHandlerActionContext<PrincipalActionContext> inActionContext) throws ExecutionException { Long activityId = (Long) inActionContext.getActionContext().getParams(); boolean updated = setFlagMapper.execute(new UpdateActivityFlagRequest(activityId, toFlag)); if (toFlag && updated) { inActionContext.getUserActionRequests().add( new UserActionRequest(CreateNotificationsRequest.ACTION_NAME, null, new ActivityNotificationsRequest(RequestType.FLAG_ACTIVITY, inActionContext .getActionContext().getPrincipal().getId(), 0L, activityId))); } return toFlag; } UpdateActivityFlagExecution(final UpdateActivityFlag inSetFlagMapper, final boolean inToFlag); }
UpdateActivityFlagExecution implements TaskHandlerExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final TaskHandlerActionContext<PrincipalActionContext> inActionContext) throws ExecutionException { Long activityId = (Long) inActionContext.getActionContext().getParams(); boolean updated = setFlagMapper.execute(new UpdateActivityFlagRequest(activityId, toFlag)); if (toFlag && updated) { inActionContext.getUserActionRequests().add( new UserActionRequest(CreateNotificationsRequest.ACTION_NAME, null, new ActivityNotificationsRequest(RequestType.FLAG_ACTIVITY, inActionContext .getActionContext().getPrincipal().getId(), 0L, activityId))); } return toFlag; } UpdateActivityFlagExecution(final UpdateActivityFlag inSetFlagMapper, final boolean inToFlag); @Override Serializable execute(final TaskHandlerActionContext<PrincipalActionContext> inActionContext); }
UpdateActivityFlagExecution implements TaskHandlerExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final TaskHandlerActionContext<PrincipalActionContext> inActionContext) throws ExecutionException { Long activityId = (Long) inActionContext.getActionContext().getParams(); boolean updated = setFlagMapper.execute(new UpdateActivityFlagRequest(activityId, toFlag)); if (toFlag && updated) { inActionContext.getUserActionRequests().add( new UserActionRequest(CreateNotificationsRequest.ACTION_NAME, null, new ActivityNotificationsRequest(RequestType.FLAG_ACTIVITY, inActionContext .getActionContext().getPrincipal().getId(), 0L, activityId))); } return toFlag; } UpdateActivityFlagExecution(final UpdateActivityFlag inSetFlagMapper, final boolean inToFlag); @Override Serializable execute(final TaskHandlerActionContext<PrincipalActionContext> inActionContext);  }