@Test public void getSuccess() throws Exception { final HashMap<String, Serializable> formData = new HashMap<String, Serializable>(); final long id = 1L; final Person testPerson = new Person(); formData.put(DomainGroupModelView.ID_KEY, Long.toString(id)); final DomainGroup expectedGroup = new DomainGroup("newOrg", "newOrg", testPerson); final String accessingUser = "jschmoe"; expectedGroup.addCoordinator(new Person(accessingUser, "b", "c", "d", "e")); context.checking(new Expectations() { { oneOf(groupMapperMock).findById(with(any(Long.class))); will(returnValue(expectedGroup)); oneOf(activityStreamSearchClearer).execute(with(any(Long.class))); } }); DomainGroup returnedGroup = sut.get(taskHandlerActionContext, formData); context.assertIsSatisfied(); assertEquals(expectedGroup, returnedGroup); }
@Override public DomainGroup get(final TaskHandlerActionContext<PrincipalActionContext> inActionContext, final Map<String, Serializable> inFields) { long id = Long.parseLong(inFields.get("id").toString()); DomainGroup entity = getGroupMapper().findById(id); inFields.put(ORIGINAL_GROUP_NAME_KEY, entity.getName()); inFields.put(ORIGINAL_GROUP_COORDINATORS_KEY, (Serializable) entity.getCoordinators()); if (!entity.isPublicGroup()) { clearActivityStreamSearchStringForUsersMapper.execute(entity.getId()); } return entity; }
GroupUpdater extends GroupPersister { @Override public DomainGroup get(final TaskHandlerActionContext<PrincipalActionContext> inActionContext, final Map<String, Serializable> inFields) { long id = Long.parseLong(inFields.get("id").toString()); DomainGroup entity = getGroupMapper().findById(id); inFields.put(ORIGINAL_GROUP_NAME_KEY, entity.getName()); inFields.put(ORIGINAL_GROUP_COORDINATORS_KEY, (Serializable) entity.getCoordinators()); if (!entity.isPublicGroup()) { clearActivityStreamSearchStringForUsersMapper.execute(entity.getId()); } return entity; } }
GroupUpdater extends GroupPersister { @Override public DomainGroup get(final TaskHandlerActionContext<PrincipalActionContext> inActionContext, final Map<String, Serializable> inFields) { long id = Long.parseLong(inFields.get("id").toString()); DomainGroup entity = getGroupMapper().findById(id); inFields.put(ORIGINAL_GROUP_NAME_KEY, entity.getName()); inFields.put(ORIGINAL_GROUP_COORDINATORS_KEY, (Serializable) entity.getCoordinators()); if (!entity.isPublicGroup()) { clearActivityStreamSearchStringForUsersMapper.execute(entity.getId()); } return entity; } GroupUpdater(final DomainGroupMapper inGroupMapper,
            final GetAllPersonIdsWhoHaveGroupCoordinatorAccess inAccessCheckerMapper,
            final DomainMapper<Long, Void> inClearActivityStreamSearchStringForUsersMapper,
            final TaskHandlerExecutionStrategy inFollowStrategy); }
GroupUpdater extends GroupPersister { @Override public DomainGroup get(final TaskHandlerActionContext<PrincipalActionContext> inActionContext, final Map<String, Serializable> inFields) { long id = Long.parseLong(inFields.get("id").toString()); DomainGroup entity = getGroupMapper().findById(id); inFields.put(ORIGINAL_GROUP_NAME_KEY, entity.getName()); inFields.put(ORIGINAL_GROUP_COORDINATORS_KEY, (Serializable) entity.getCoordinators()); if (!entity.isPublicGroup()) { clearActivityStreamSearchStringForUsersMapper.execute(entity.getId()); } return entity; } GroupUpdater(final DomainGroupMapper inGroupMapper,
            final GetAllPersonIdsWhoHaveGroupCoordinatorAccess inAccessCheckerMapper,
            final DomainMapper<Long, Void> inClearActivityStreamSearchStringForUsersMapper,
            final TaskHandlerExecutionStrategy inFollowStrategy); @Override DomainGroup get(final TaskHandlerActionContext<PrincipalActionContext> inActionContext,
            final Map<String, Serializable> inFields); @Override void persist(final TaskHandlerActionContext<PrincipalActionContext> inActionContext,
            final Map<String, Serializable> inFields, final DomainGroup inGroup); }
GroupUpdater extends GroupPersister { @Override public DomainGroup get(final TaskHandlerActionContext<PrincipalActionContext> inActionContext, final Map<String, Serializable> inFields) { long id = Long.parseLong(inFields.get("id").toString()); DomainGroup entity = getGroupMapper().findById(id); inFields.put(ORIGINAL_GROUP_NAME_KEY, entity.getName()); inFields.put(ORIGINAL_GROUP_COORDINATORS_KEY, (Serializable) entity.getCoordinators()); if (!entity.isPublicGroup()) { clearActivityStreamSearchStringForUsersMapper.execute(entity.getId()); } return entity; } GroupUpdater(final DomainGroupMapper inGroupMapper,
            final GetAllPersonIdsWhoHaveGroupCoordinatorAccess inAccessCheckerMapper,
            final DomainMapper<Long, Void> inClearActivityStreamSearchStringForUsersMapper,
            final TaskHandlerExecutionStrategy inFollowStrategy); @Override DomainGroup get(final TaskHandlerActionContext<PrincipalActionContext> inActionContext,
            final Map<String, Serializable> inFields); @Override void persist(final TaskHandlerActionContext<PrincipalActionContext> inActionContext,
            final Map<String, Serializable> inFields, final DomainGroup inGroup);  }