@Test @SuppressWarnings("unchecked") public void testExecute() { final String accountId = "sldfjkds"; final GetFlaggedActivitiesRequest rqst = new GetFlaggedActivitiesRequest(3, 5); final PagedSet<ActivityDTO> pagedSet = context.mock(PagedSet.class); final List<ActivityDTO> activities = new ArrayList<ActivityDTO>(); context.checking(new Expectations() { { oneOf(mapper).execute(with(equalInternally(rqst))); will(returnValue(pagedSet)); allowing(actionCtx).getParams(); will(returnValue(rqst)); allowing(actionCtx).getPrincipal(); will(returnValue(principal)); allowing(principal).getAccountId(); will(returnValue(accountId)); oneOf(getPersonModelViewByAccountIdMapper).execute(accountId); will(returnValue(pmv)); allowing(pagedSet).getPagedSet(); will(returnValue(activities)); oneOf(activityDeletabilityFilter).filter(activities, pmv); } }); Serializable result = sut.execute(actionCtx); context.assertIsSatisfied(); assertSame(pagedSet, result); assertEquals(accountId, rqst.getRequestingUserAccountId()); }
@Override public Serializable execute(final PrincipalActionContext inActionContext) { String userName = inActionContext.getPrincipal().getAccountId(); GetFlaggedActivitiesRequest request = (GetFlaggedActivitiesRequest) inActionContext.getParams(); if (log.isInfoEnabled()) { log.info("scoping the request for flagged activities with the requesting user account: " + userName); } request.setRequestingUserAccountId(userName); PagedSet<ActivityDTO> activities = mapper.execute(request); activityDeletabilityFilter.filter(activities.getPagedSet(), getPersonModelViewByAccountIdMapper .execute(inActionContext.getPrincipal().getAccountId())); if (log.isInfoEnabled()) { log.info("Found " + activities.getPagedSet().size() + " activities"); } return activities; }
GetFlaggedActivitiesExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) { String userName = inActionContext.getPrincipal().getAccountId(); GetFlaggedActivitiesRequest request = (GetFlaggedActivitiesRequest) inActionContext.getParams(); if (log.isInfoEnabled()) { log.info("scoping the request for flagged activities with the requesting user account: " + userName); } request.setRequestingUserAccountId(userName); PagedSet<ActivityDTO> activities = mapper.execute(request); activityDeletabilityFilter.filter(activities.getPagedSet(), getPersonModelViewByAccountIdMapper .execute(inActionContext.getPrincipal().getAccountId())); if (log.isInfoEnabled()) { log.info("Found " + activities.getPagedSet().size() + " activities"); } return activities; } }
GetFlaggedActivitiesExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) { String userName = inActionContext.getPrincipal().getAccountId(); GetFlaggedActivitiesRequest request = (GetFlaggedActivitiesRequest) inActionContext.getParams(); if (log.isInfoEnabled()) { log.info("scoping the request for flagged activities with the requesting user account: " + userName); } request.setRequestingUserAccountId(userName); PagedSet<ActivityDTO> activities = mapper.execute(request); activityDeletabilityFilter.filter(activities.getPagedSet(), getPersonModelViewByAccountIdMapper .execute(inActionContext.getPrincipal().getAccountId())); if (log.isInfoEnabled()) { log.info("Found " + activities.getPagedSet().size() + " activities"); } return activities; } GetFlaggedActivitiesExecution(final GetFlaggedActivities inMapper,
            final DomainMapper<String, PersonModelView> inGetPersonModelViewByAccountIdMapper,
            final ActivityFilter inActivityDeletabilityFilter); }
GetFlaggedActivitiesExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) { String userName = inActionContext.getPrincipal().getAccountId(); GetFlaggedActivitiesRequest request = (GetFlaggedActivitiesRequest) inActionContext.getParams(); if (log.isInfoEnabled()) { log.info("scoping the request for flagged activities with the requesting user account: " + userName); } request.setRequestingUserAccountId(userName); PagedSet<ActivityDTO> activities = mapper.execute(request); activityDeletabilityFilter.filter(activities.getPagedSet(), getPersonModelViewByAccountIdMapper .execute(inActionContext.getPrincipal().getAccountId())); if (log.isInfoEnabled()) { log.info("Found " + activities.getPagedSet().size() + " activities"); } return activities; } GetFlaggedActivitiesExecution(final GetFlaggedActivities inMapper,
            final DomainMapper<String, PersonModelView> inGetPersonModelViewByAccountIdMapper,
            final ActivityFilter inActivityDeletabilityFilter); @Override Serializable execute(final PrincipalActionContext inActionContext); }
GetFlaggedActivitiesExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) { String userName = inActionContext.getPrincipal().getAccountId(); GetFlaggedActivitiesRequest request = (GetFlaggedActivitiesRequest) inActionContext.getParams(); if (log.isInfoEnabled()) { log.info("scoping the request for flagged activities with the requesting user account: " + userName); } request.setRequestingUserAccountId(userName); PagedSet<ActivityDTO> activities = mapper.execute(request); activityDeletabilityFilter.filter(activities.getPagedSet(), getPersonModelViewByAccountIdMapper .execute(inActionContext.getPrincipal().getAccountId())); if (log.isInfoEnabled()) { log.info("Found " + activities.getPagedSet().size() + " activities"); } return activities; } GetFlaggedActivitiesExecution(final GetFlaggedActivities inMapper,
            final DomainMapper<String, PersonModelView> inGetPersonModelViewByAccountIdMapper,
            final ActivityFilter inActivityDeletabilityFilter); @Override Serializable execute(final PrincipalActionContext inActionContext);  }