@Test public void execute() { final ArrayList<StreamEntityDTO> entities = new ArrayList<StreamEntityDTO>(); StreamEntityDTO person = new StreamEntityDTO(); person.setType(EntityType.PERSON); person.setUniqueIdentifier("person1"); entities.add(person); StreamEntityDTO group = new StreamEntityDTO(); group.setType(EntityType.GROUP); group.setUniqueIdentifier("group1"); entities.add(group); context.checking(new Expectations() { { allowing(actionContext).getParams(); will(returnValue(entities)); oneOf(getPersonModelViewsByAccountIdsMapper).execute(with(any(List.class))); will(returnValue(new ArrayList<PersonModelView>())); oneOf(groupMapper).execute(with(any(List.class))); will(returnValue(new ArrayList<DomainGroupModelView>())); } }); sut.execute(actionContext); }
@Override public ArrayList<Serializable> execute(final PrincipalActionContext inActionContext) throws ExecutionException { ArrayList<Serializable> entities = new ArrayList<Serializable>(); List<String> personIds = new ArrayList<String>(); List<String> groupIds = new ArrayList<String>(); for (StreamEntityDTO entity : (List<StreamEntityDTO>) inActionContext.getParams()) { if (entity.getType().equals(EntityType.PERSON)) { personIds.add(entity.getUniqueIdentifier()); } else { groupIds.add(entity.getUniqueIdentifier()); } } entities.addAll(getPersonModelViewsByAccountIdsMapper.execute(personIds)); entities.addAll(groupMapper.execute(groupIds)); return entities; }
GetBulkEntitiesExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public ArrayList<Serializable> execute(final PrincipalActionContext inActionContext) throws ExecutionException { ArrayList<Serializable> entities = new ArrayList<Serializable>(); List<String> personIds = new ArrayList<String>(); List<String> groupIds = new ArrayList<String>(); for (StreamEntityDTO entity : (List<StreamEntityDTO>) inActionContext.getParams()) { if (entity.getType().equals(EntityType.PERSON)) { personIds.add(entity.getUniqueIdentifier()); } else { groupIds.add(entity.getUniqueIdentifier()); } } entities.addAll(getPersonModelViewsByAccountIdsMapper.execute(personIds)); entities.addAll(groupMapper.execute(groupIds)); return entities; } }
GetBulkEntitiesExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public ArrayList<Serializable> execute(final PrincipalActionContext inActionContext) throws ExecutionException { ArrayList<Serializable> entities = new ArrayList<Serializable>(); List<String> personIds = new ArrayList<String>(); List<String> groupIds = new ArrayList<String>(); for (StreamEntityDTO entity : (List<StreamEntityDTO>) inActionContext.getParams()) { if (entity.getType().equals(EntityType.PERSON)) { personIds.add(entity.getUniqueIdentifier()); } else { groupIds.add(entity.getUniqueIdentifier()); } } entities.addAll(getPersonModelViewsByAccountIdsMapper.execute(personIds)); entities.addAll(groupMapper.execute(groupIds)); return entities; } GetBulkEntitiesExecution(
            final DomainMapper<List<String>, List<PersonModelView>> inGetPersonModelViewsByAccountIdsMapper,
            final GetDomainGroupsByShortNames inGroupMapper); }
GetBulkEntitiesExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public ArrayList<Serializable> execute(final PrincipalActionContext inActionContext) throws ExecutionException { ArrayList<Serializable> entities = new ArrayList<Serializable>(); List<String> personIds = new ArrayList<String>(); List<String> groupIds = new ArrayList<String>(); for (StreamEntityDTO entity : (List<StreamEntityDTO>) inActionContext.getParams()) { if (entity.getType().equals(EntityType.PERSON)) { personIds.add(entity.getUniqueIdentifier()); } else { groupIds.add(entity.getUniqueIdentifier()); } } entities.addAll(getPersonModelViewsByAccountIdsMapper.execute(personIds)); entities.addAll(groupMapper.execute(groupIds)); return entities; } GetBulkEntitiesExecution(
            final DomainMapper<List<String>, List<PersonModelView>> inGetPersonModelViewsByAccountIdsMapper,
            final GetDomainGroupsByShortNames inGroupMapper); @Override ArrayList<Serializable> execute(final PrincipalActionContext inActionContext); }
GetBulkEntitiesExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public ArrayList<Serializable> execute(final PrincipalActionContext inActionContext) throws ExecutionException { ArrayList<Serializable> entities = new ArrayList<Serializable>(); List<String> personIds = new ArrayList<String>(); List<String> groupIds = new ArrayList<String>(); for (StreamEntityDTO entity : (List<StreamEntityDTO>) inActionContext.getParams()) { if (entity.getType().equals(EntityType.PERSON)) { personIds.add(entity.getUniqueIdentifier()); } else { groupIds.add(entity.getUniqueIdentifier()); } } entities.addAll(getPersonModelViewsByAccountIdsMapper.execute(personIds)); entities.addAll(groupMapper.execute(groupIds)); return entities; } GetBulkEntitiesExecution(
            final DomainMapper<List<String>, List<PersonModelView>> inGetPersonModelViewsByAccountIdsMapper,
            final GetDomainGroupsByShortNames inGroupMapper); @Override ArrayList<Serializable> execute(final PrincipalActionContext inActionContext);  }