@Test public void testExecuteNoPeople() { context.checking(new Expectations() { { oneOf(createNotificationsMapper).execute(request); will(returnValue(0)); } }); TaskHandlerActionContext<PrincipalActionContext> actionContext = TestContextCreator .createTaskHandlerContextWithPrincipal(request, null); Serializable result = sut.execute(actionContext); context.assertIsSatisfied(); assertEquals(0, result); assertTrue(actionContext.getUserActionRequests().isEmpty()); }
@Override public Serializable execute(final TaskHandlerActionContext<PrincipalActionContext> inWrapperContext) { final PrincipalActionContext actionContext = inWrapperContext.getActionContext(); Date d = new Date(); d = logTime(d, "START"); int count = (Integer) createNotificationsMapper.execute((SendPrebuiltNotificationRequest) actionContext .getParams()); d = logTime(d, "created notifications (" + count + ")"); if (count > 0) { List<Long> userIds = unlockedUsersMapper.execute(false); d = logTime(d, "got unlocked users (" + userIds.size() + ")"); List<UserActionRequest> actions = inWrapperContext.getUserActionRequests(); for (Long userId : userIds) { actions.add(new UserActionRequest("refreshUserInAppNotificationCounts", null, userId)); } d = logTime(d, "added async requests [DONE]"); } return count; }
SendMassPrebuiltNotificationExecution implements TaskHandlerExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final TaskHandlerActionContext<PrincipalActionContext> inWrapperContext) { final PrincipalActionContext actionContext = inWrapperContext.getActionContext(); Date d = new Date(); d = logTime(d, "START"); int count = (Integer) createNotificationsMapper.execute((SendPrebuiltNotificationRequest) actionContext .getParams()); d = logTime(d, "created notifications (" + count + ")"); if (count > 0) { List<Long> userIds = unlockedUsersMapper.execute(false); d = logTime(d, "got unlocked users (" + userIds.size() + ")"); List<UserActionRequest> actions = inWrapperContext.getUserActionRequests(); for (Long userId : userIds) { actions.add(new UserActionRequest("refreshUserInAppNotificationCounts", null, userId)); } d = logTime(d, "added async requests [DONE]"); } return count; } }
SendMassPrebuiltNotificationExecution implements TaskHandlerExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final TaskHandlerActionContext<PrincipalActionContext> inWrapperContext) { final PrincipalActionContext actionContext = inWrapperContext.getActionContext(); Date d = new Date(); d = logTime(d, "START"); int count = (Integer) createNotificationsMapper.execute((SendPrebuiltNotificationRequest) actionContext .getParams()); d = logTime(d, "created notifications (" + count + ")"); if (count > 0) { List<Long> userIds = unlockedUsersMapper.execute(false); d = logTime(d, "got unlocked users (" + userIds.size() + ")"); List<UserActionRequest> actions = inWrapperContext.getUserActionRequests(); for (Long userId : userIds) { actions.add(new UserActionRequest("refreshUserInAppNotificationCounts", null, userId)); } d = logTime(d, "added async requests [DONE]"); } return count; } SendMassPrebuiltNotificationExecution(
            final DomainMapper<SendPrebuiltNotificationRequest, Serializable> inCreateNotificationsMapper,
            final DomainMapper<Boolean, List<Long>> inUnlockedUsersMapper); }
SendMassPrebuiltNotificationExecution implements TaskHandlerExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final TaskHandlerActionContext<PrincipalActionContext> inWrapperContext) { final PrincipalActionContext actionContext = inWrapperContext.getActionContext(); Date d = new Date(); d = logTime(d, "START"); int count = (Integer) createNotificationsMapper.execute((SendPrebuiltNotificationRequest) actionContext .getParams()); d = logTime(d, "created notifications (" + count + ")"); if (count > 0) { List<Long> userIds = unlockedUsersMapper.execute(false); d = logTime(d, "got unlocked users (" + userIds.size() + ")"); List<UserActionRequest> actions = inWrapperContext.getUserActionRequests(); for (Long userId : userIds) { actions.add(new UserActionRequest("refreshUserInAppNotificationCounts", null, userId)); } d = logTime(d, "added async requests [DONE]"); } return count; } SendMassPrebuiltNotificationExecution(
            final DomainMapper<SendPrebuiltNotificationRequest, Serializable> inCreateNotificationsMapper,
            final DomainMapper<Boolean, List<Long>> inUnlockedUsersMapper); @Override Serializable execute(final TaskHandlerActionContext<PrincipalActionContext> inWrapperContext); }
SendMassPrebuiltNotificationExecution implements TaskHandlerExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final TaskHandlerActionContext<PrincipalActionContext> inWrapperContext) { final PrincipalActionContext actionContext = inWrapperContext.getActionContext(); Date d = new Date(); d = logTime(d, "START"); int count = (Integer) createNotificationsMapper.execute((SendPrebuiltNotificationRequest) actionContext .getParams()); d = logTime(d, "created notifications (" + count + ")"); if (count > 0) { List<Long> userIds = unlockedUsersMapper.execute(false); d = logTime(d, "got unlocked users (" + userIds.size() + ")"); List<UserActionRequest> actions = inWrapperContext.getUserActionRequests(); for (Long userId : userIds) { actions.add(new UserActionRequest("refreshUserInAppNotificationCounts", null, userId)); } d = logTime(d, "added async requests [DONE]"); } return count; } SendMassPrebuiltNotificationExecution(
            final DomainMapper<SendPrebuiltNotificationRequest, Serializable> inCreateNotificationsMapper,
            final DomainMapper<Boolean, List<Long>> inUnlockedUsersMapper); @Override Serializable execute(final TaskHandlerActionContext<PrincipalActionContext> inWrapperContext);  }