@Test public void testAttribute() { context.checking(new Expectations() { { allowing(membershipCriteriaDAO).execute(null); will(returnValue(criteriaList)); allowing(membershipCriteria).getCriteria(); will(returnValue("=")); allowing(attributeLookupStrategy).findPeople("=", Integer.MAX_VALUE); will(returnValue(new ArrayList<Person>())); } }); sut.getPeople(); context.assertIsSatisfied(); }
@Override public Set<Person> getPeople() { List<MembershipCriteriaDTO> membershipCriteria = membershipCriteriaDAO.execute(null); HashSet<Person> results = new HashSet<Person>(); PersonLookupStrategy lookupStrategy = null; for (MembershipCriteriaDTO criterion : membershipCriteria) { String ldapQuery = criterion.getCriteria(); log.info("Processing criteria: " + ldapQuery); if (ldapQuery.contains("=")) { lookupStrategy = attributeLookupStrategy; } else { lookupStrategy = groupLookupStrategy; } List<Person> people = lookupStrategy.findPeople(ldapQuery, new Integer(Integer.MAX_VALUE)); log.info(people.size() + " people found for criteria."); results.addAll(people); } return results; }
PersonSourceLDAP implements PersonSource { @Override public Set<Person> getPeople() { List<MembershipCriteriaDTO> membershipCriteria = membershipCriteriaDAO.execute(null); HashSet<Person> results = new HashSet<Person>(); PersonLookupStrategy lookupStrategy = null; for (MembershipCriteriaDTO criterion : membershipCriteria) { String ldapQuery = criterion.getCriteria(); log.info("Processing criteria: " + ldapQuery); if (ldapQuery.contains("=")) { lookupStrategy = attributeLookupStrategy; } else { lookupStrategy = groupLookupStrategy; } List<Person> people = lookupStrategy.findPeople(ldapQuery, new Integer(Integer.MAX_VALUE)); log.info(people.size() + " people found for criteria."); results.addAll(people); } return results; } }
PersonSourceLDAP implements PersonSource { @Override public Set<Person> getPeople() { List<MembershipCriteriaDTO> membershipCriteria = membershipCriteriaDAO.execute(null); HashSet<Person> results = new HashSet<Person>(); PersonLookupStrategy lookupStrategy = null; for (MembershipCriteriaDTO criterion : membershipCriteria) { String ldapQuery = criterion.getCriteria(); log.info("Processing criteria: " + ldapQuery); if (ldapQuery.contains("=")) { lookupStrategy = attributeLookupStrategy; } else { lookupStrategy = groupLookupStrategy; } List<Person> people = lookupStrategy.findPeople(ldapQuery, new Integer(Integer.MAX_VALUE)); log.info(people.size() + " people found for criteria."); results.addAll(people); } return results; } PersonSourceLDAP(final DomainMapper<MapperRequest, List<MembershipCriteriaDTO>> inMembershipCriteriaDAO,
            final PersonLookupStrategy inGroupLookupStrategy, final PersonLookupStrategy inAttributeLookupStrategy); }
PersonSourceLDAP implements PersonSource { @Override public Set<Person> getPeople() { List<MembershipCriteriaDTO> membershipCriteria = membershipCriteriaDAO.execute(null); HashSet<Person> results = new HashSet<Person>(); PersonLookupStrategy lookupStrategy = null; for (MembershipCriteriaDTO criterion : membershipCriteria) { String ldapQuery = criterion.getCriteria(); log.info("Processing criteria: " + ldapQuery); if (ldapQuery.contains("=")) { lookupStrategy = attributeLookupStrategy; } else { lookupStrategy = groupLookupStrategy; } List<Person> people = lookupStrategy.findPeople(ldapQuery, new Integer(Integer.MAX_VALUE)); log.info(people.size() + " people found for criteria."); results.addAll(people); } return results; } PersonSourceLDAP(final DomainMapper<MapperRequest, List<MembershipCriteriaDTO>> inMembershipCriteriaDAO,
            final PersonLookupStrategy inGroupLookupStrategy, final PersonLookupStrategy inAttributeLookupStrategy); @Override Set<Person> getPeople(); }
PersonSourceLDAP implements PersonSource { @Override public Set<Person> getPeople() { List<MembershipCriteriaDTO> membershipCriteria = membershipCriteriaDAO.execute(null); HashSet<Person> results = new HashSet<Person>(); PersonLookupStrategy lookupStrategy = null; for (MembershipCriteriaDTO criterion : membershipCriteria) { String ldapQuery = criterion.getCriteria(); log.info("Processing criteria: " + ldapQuery); if (ldapQuery.contains("=")) { lookupStrategy = attributeLookupStrategy; } else { lookupStrategy = groupLookupStrategy; } List<Person> people = lookupStrategy.findPeople(ldapQuery, new Integer(Integer.MAX_VALUE)); log.info(people.size() + " people found for criteria."); results.addAll(people); } return results; } PersonSourceLDAP(final DomainMapper<MapperRequest, List<MembershipCriteriaDTO>> inMembershipCriteriaDAO,
            final PersonLookupStrategy inGroupLookupStrategy, final PersonLookupStrategy inAttributeLookupStrategy); @Override Set<Person> getPeople();  }