@Test(expected = IllegalArgumentException.class) public void executeWithBadTargetType() throws Exception { ArrayList<Person> list = new ArrayList<Person>(); for (int i = 0; i < 8; i++) { Person p = new Person("secon" + i, "Stephen", "X", "Economopolus", "Steve"); p.setTitle("Chief Strategist"); list.add(p); } final PagedSet<Person> connections = new PagedSet<Person>(0, 7, 8, list); context.checking(new Expectations() { { oneOf(actionContext).getParams(); will(returnValue(getFollowersFollowingRequest)); oneOf(getFollowersFollowingRequest).getEntityId(); will(returnValue(TARGET_USER)); oneOf(getFollowersFollowingRequest).getEntityType(); will(returnValue(EntityType.NOTSET)); oneOf(getFollowersFollowingRequest).getStartIndex(); will(returnValue(START_VALUE)); oneOf(getFollowersFollowingRequest).getEndIndex(); will(returnValue(END_VALUE)); } }); assertEquals(sut.execute(actionContext), connections); context.assertIsSatisfied(); }
@Override public PagedSet<Person> execute(final PrincipalActionContext inActionContext) { GetFollowersFollowingRequest inRequest = (GetFollowersFollowingRequest) inActionContext.getParams(); final String uniqueEntityId = inRequest.getEntityId(); EntityType targetType = inRequest.getEntityType(); Integer startValue = (inRequest.getStartIndex()).intValue(); Integer endValue = (inRequest.getEndIndex()).intValue(); FollowMapper mapper = pickMapper(targetType); PagedSet<Person> connections = mapper.getFollowers(uniqueEntityId, startValue, endValue); if (log.isTraceEnabled()) { log.trace("Retrieved " + connections.getFromIndex() + " to " + connections.getToIndex() + " of " + connections.getTotal() + " followers"); } return connections; }
GetFollowersExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public PagedSet<Person> execute(final PrincipalActionContext inActionContext) { GetFollowersFollowingRequest inRequest = (GetFollowersFollowingRequest) inActionContext.getParams(); final String uniqueEntityId = inRequest.getEntityId(); EntityType targetType = inRequest.getEntityType(); Integer startValue = (inRequest.getStartIndex()).intValue(); Integer endValue = (inRequest.getEndIndex()).intValue(); FollowMapper mapper = pickMapper(targetType); PagedSet<Person> connections = mapper.getFollowers(uniqueEntityId, startValue, endValue); if (log.isTraceEnabled()) { log.trace("Retrieved " + connections.getFromIndex() + " to " + connections.getToIndex() + " of " + connections.getTotal() + " followers"); } return connections; } }
GetFollowersExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public PagedSet<Person> execute(final PrincipalActionContext inActionContext) { GetFollowersFollowingRequest inRequest = (GetFollowersFollowingRequest) inActionContext.getParams(); final String uniqueEntityId = inRequest.getEntityId(); EntityType targetType = inRequest.getEntityType(); Integer startValue = (inRequest.getStartIndex()).intValue(); Integer endValue = (inRequest.getEndIndex()).intValue(); FollowMapper mapper = pickMapper(targetType); PagedSet<Person> connections = mapper.getFollowers(uniqueEntityId, startValue, endValue); if (log.isTraceEnabled()) { log.trace("Retrieved " + connections.getFromIndex() + " to " + connections.getToIndex() + " of " + connections.getTotal() + " followers"); } return connections; } GetFollowersExecution(final PersonMapper inPersonMapper, final DomainGroupMapper inGroupMapper); }
GetFollowersExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public PagedSet<Person> execute(final PrincipalActionContext inActionContext) { GetFollowersFollowingRequest inRequest = (GetFollowersFollowingRequest) inActionContext.getParams(); final String uniqueEntityId = inRequest.getEntityId(); EntityType targetType = inRequest.getEntityType(); Integer startValue = (inRequest.getStartIndex()).intValue(); Integer endValue = (inRequest.getEndIndex()).intValue(); FollowMapper mapper = pickMapper(targetType); PagedSet<Person> connections = mapper.getFollowers(uniqueEntityId, startValue, endValue); if (log.isTraceEnabled()) { log.trace("Retrieved " + connections.getFromIndex() + " to " + connections.getToIndex() + " of " + connections.getTotal() + " followers"); } return connections; } GetFollowersExecution(final PersonMapper inPersonMapper, final DomainGroupMapper inGroupMapper); @Override PagedSet<Person> execute(final PrincipalActionContext inActionContext); }
GetFollowersExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public PagedSet<Person> execute(final PrincipalActionContext inActionContext) { GetFollowersFollowingRequest inRequest = (GetFollowersFollowingRequest) inActionContext.getParams(); final String uniqueEntityId = inRequest.getEntityId(); EntityType targetType = inRequest.getEntityType(); Integer startValue = (inRequest.getStartIndex()).intValue(); Integer endValue = (inRequest.getEndIndex()).intValue(); FollowMapper mapper = pickMapper(targetType); PagedSet<Person> connections = mapper.getFollowers(uniqueEntityId, startValue, endValue); if (log.isTraceEnabled()) { log.trace("Retrieved " + connections.getFromIndex() + " to " + connections.getToIndex() + " of " + connections.getTotal() + " followers"); } return connections; } GetFollowersExecution(final PersonMapper inPersonMapper, final DomainGroupMapper inGroupMapper); @Override PagedSet<Person> execute(final PrincipalActionContext inActionContext);  }