@SuppressWarnings("unchecked") @Test public void testExecute() { final DomainGroup g = context.mock(DomainGroup.class); final Person p1 = context.mock(Person.class, "p1"); final Person p2 = context.mock(Person.class, "p2"); final Set<Person> coordinators = new HashSet<Person>(); coordinators.add(p1); coordinators.add(p2); final Long gId = 3333L; final Long p1Id = 82737L; final Long p2Id = 37772L; context.checking(new Expectations() { { allowing(g).getCoordinators(); will(returnValue(coordinators)); allowing(g).getId(); will(returnValue(gId)); allowing(p1).getId(); will(returnValue(p1Id)); allowing(p2).getId(); will(returnValue(p2Id)); } }); List<Long> returnValue = sut.execute(g); List<Long> cachedCoordinators = cache .getList(CacheKeys.COORDINATOR_PERSON_IDS_BY_GROUP_ID + gId); assertEquals(returnValue, cachedCoordinators); assertEquals(2, cachedCoordinators.size()); assertTrue(cachedCoordinators.contains(p1Id)); assertTrue(cachedCoordinators.contains(p2Id)); context.assertIsSatisfied(); }
public List<Long> execute(final DomainGroup inDomainGroup) { List<Long> coordinatorPeopleIds = new ArrayList<Long>(); for (Person coordinator : inDomainGroup.getCoordinators()) { coordinatorPeopleIds.add(coordinator.getId()); } log.info("Saving group #" + inDomainGroup.getId() + "'s cordinators to cache - coordinator ids: " + coordinatorPeopleIds.toString()); getCache().setList( CacheKeys.COORDINATOR_PERSON_IDS_BY_GROUP_ID + inDomainGroup.getId(), coordinatorPeopleIds); return coordinatorPeopleIds; }
SaveDomainGroupCoordinatorsListToCache extends CachedDomainMapper { public List<Long> execute(final DomainGroup inDomainGroup) { List<Long> coordinatorPeopleIds = new ArrayList<Long>(); for (Person coordinator : inDomainGroup.getCoordinators()) { coordinatorPeopleIds.add(coordinator.getId()); } log.info("Saving group #" + inDomainGroup.getId() + "'s cordinators to cache - coordinator ids: " + coordinatorPeopleIds.toString()); getCache().setList( CacheKeys.COORDINATOR_PERSON_IDS_BY_GROUP_ID + inDomainGroup.getId(), coordinatorPeopleIds); return coordinatorPeopleIds; } }
SaveDomainGroupCoordinatorsListToCache extends CachedDomainMapper { public List<Long> execute(final DomainGroup inDomainGroup) { List<Long> coordinatorPeopleIds = new ArrayList<Long>(); for (Person coordinator : inDomainGroup.getCoordinators()) { coordinatorPeopleIds.add(coordinator.getId()); } log.info("Saving group #" + inDomainGroup.getId() + "'s cordinators to cache - coordinator ids: " + coordinatorPeopleIds.toString()); getCache().setList( CacheKeys.COORDINATOR_PERSON_IDS_BY_GROUP_ID + inDomainGroup.getId(), coordinatorPeopleIds); return coordinatorPeopleIds; }  }
SaveDomainGroupCoordinatorsListToCache extends CachedDomainMapper { public List<Long> execute(final DomainGroup inDomainGroup) { List<Long> coordinatorPeopleIds = new ArrayList<Long>(); for (Person coordinator : inDomainGroup.getCoordinators()) { coordinatorPeopleIds.add(coordinator.getId()); } log.info("Saving group #" + inDomainGroup.getId() + "'s cordinators to cache - coordinator ids: " + coordinatorPeopleIds.toString()); getCache().setList( CacheKeys.COORDINATOR_PERSON_IDS_BY_GROUP_ID + inDomainGroup.getId(), coordinatorPeopleIds); return coordinatorPeopleIds; }  List<Long> execute(final DomainGroup inDomainGroup); }
SaveDomainGroupCoordinatorsListToCache extends CachedDomainMapper { public List<Long> execute(final DomainGroup inDomainGroup) { List<Long> coordinatorPeopleIds = new ArrayList<Long>(); for (Person coordinator : inDomainGroup.getCoordinators()) { coordinatorPeopleIds.add(coordinator.getId()); } log.info("Saving group #" + inDomainGroup.getId() + "'s cordinators to cache - coordinator ids: " + coordinatorPeopleIds.toString()); getCache().setList( CacheKeys.COORDINATOR_PERSON_IDS_BY_GROUP_ID + inDomainGroup.getId(), coordinatorPeopleIds); return coordinatorPeopleIds; }  List<Long> execute(final DomainGroup inDomainGroup);  }