@Test public void testDeleteActivities() throws Exception { context.checking(new Expectations() { { allowing(principalDao).execute(USERID_ONE); will(returnValue(principalMock)); oneOf(serviceActionControllerMock).execute(with(any(ServiceActionContext.class)), with(any(TaskHandlerAction.class))); will(returnValue(null)); } }); sut.deleteActivities(testId, testGroupId, TEST_APP_ID, activityIds, FAKETOKEN); context.assertIsSatisfied(); }
public Future<Void> deleteActivities(final UserId userId, final GroupId groupId, final String appId, final Set<String> activityIds, final SecurityToken token) { log.debug("Entering deleteActivities data with userId" + userId.getUserId(token) + ", appId " + appId + ", " + activityIds.size() + ", token appId " + token.getAppId()); Principal currentUserPrincipal = openSocialPrincipalDao.execute(userId.getUserId(token)); try { ArrayList<Long> params = new ArrayList<Long>(activityIds.size()); for (String id : activityIds) { params.add(Long.parseLong(id)); } ServiceActionContext currentContext = new ServiceActionContext(params, currentUserPrincipal); serviceActionController.execute(currentContext, deleteUserActivities); } catch (Exception e) { log.error("Error occurred deleting OpenSocial Application Data " + e.toString()); throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.toString()); } return ImmediateFuture.newInstance(null); }
ActivityServiceImpl implements ActivityService { public Future<Void> deleteActivities(final UserId userId, final GroupId groupId, final String appId, final Set<String> activityIds, final SecurityToken token) { log.debug("Entering deleteActivities data with userId" + userId.getUserId(token) + ", appId " + appId + ", " + activityIds.size() + ", token appId " + token.getAppId()); Principal currentUserPrincipal = openSocialPrincipalDao.execute(userId.getUserId(token)); try { ArrayList<Long> params = new ArrayList<Long>(activityIds.size()); for (String id : activityIds) { params.add(Long.parseLong(id)); } ServiceActionContext currentContext = new ServiceActionContext(params, currentUserPrincipal); serviceActionController.execute(currentContext, deleteUserActivities); } catch (Exception e) { log.error("Error occurred deleting OpenSocial Application Data " + e.toString()); throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.toString()); } return ImmediateFuture.newInstance(null); } }
ActivityServiceImpl implements ActivityService { public Future<Void> deleteActivities(final UserId userId, final GroupId groupId, final String appId, final Set<String> activityIds, final SecurityToken token) { log.debug("Entering deleteActivities data with userId" + userId.getUserId(token) + ", appId " + appId + ", " + activityIds.size() + ", token appId " + token.getAppId()); Principal currentUserPrincipal = openSocialPrincipalDao.execute(userId.getUserId(token)); try { ArrayList<Long> params = new ArrayList<Long>(activityIds.size()); for (String id : activityIds) { params.add(Long.parseLong(id)); } ServiceActionContext currentContext = new ServiceActionContext(params, currentUserPrincipal); serviceActionController.execute(currentContext, deleteUserActivities); } catch (Exception e) { log.error("Error occurred deleting OpenSocial Application Data " + e.toString()); throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.toString()); } return ImmediateFuture.newInstance(null); } @Inject  ActivityServiceImpl(@Named("getUserActivities") final ServiceAction inGetUserActivitiesAction,
            @Named("deleteUserActivities") final TaskHandlerAction inDeleteActivitiesAction,
            final ActionController inServiceActionController,
            @Named("openSocialPrincipalDao") final DomainMapper<String, Principal> inOpenSocialPrincipalDao,
            @Named("postPersonActivityServiceActionTaskHandler") final TaskHandlerServiceAction inPostActivityAction,
            @Named("jpaGadgetDefinitionMapper") final GadgetDefinitionMapper inGadgetDefinitionMapper,
            final GadgetMetaDataFetcher inGadgetMetaDataFetcher); }
ActivityServiceImpl implements ActivityService { public Future<Void> deleteActivities(final UserId userId, final GroupId groupId, final String appId, final Set<String> activityIds, final SecurityToken token) { log.debug("Entering deleteActivities data with userId" + userId.getUserId(token) + ", appId " + appId + ", " + activityIds.size() + ", token appId " + token.getAppId()); Principal currentUserPrincipal = openSocialPrincipalDao.execute(userId.getUserId(token)); try { ArrayList<Long> params = new ArrayList<Long>(activityIds.size()); for (String id : activityIds) { params.add(Long.parseLong(id)); } ServiceActionContext currentContext = new ServiceActionContext(params, currentUserPrincipal); serviceActionController.execute(currentContext, deleteUserActivities); } catch (Exception e) { log.error("Error occurred deleting OpenSocial Application Data " + e.toString()); throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.toString()); } return ImmediateFuture.newInstance(null); } @Inject  ActivityServiceImpl(@Named("getUserActivities") final ServiceAction inGetUserActivitiesAction,
            @Named("deleteUserActivities") final TaskHandlerAction inDeleteActivitiesAction,
            final ActionController inServiceActionController,
            @Named("openSocialPrincipalDao") final DomainMapper<String, Principal> inOpenSocialPrincipalDao,
            @Named("postPersonActivityServiceActionTaskHandler") final TaskHandlerServiceAction inPostActivityAction,
            @Named("jpaGadgetDefinitionMapper") final GadgetDefinitionMapper inGadgetDefinitionMapper,
            final GadgetMetaDataFetcher inGadgetMetaDataFetcher); Future<Void> createActivity(final UserId userId, final GroupId groupId, final String appId,
            final Set<String> fields, final Activity activity, final SecurityToken token); Future<Void> deleteActivities(final UserId userId, final GroupId groupId, final String appId,
            final Set<String> activityIds, final SecurityToken token); @SuppressWarnings("unchecked") Future<RestfulCollection<Activity>> getActivities(final Set<UserId> userIds, final GroupId groupId,
            final String appId, final Set<String> fields, final CollectionOptions options, final SecurityToken token); @SuppressWarnings("unchecked") Future<RestfulCollection<Activity>> getActivities(final UserId userId, final GroupId groupId,
            final String appId, final Set<String> fields, final CollectionOptions options,
            final Set<String> activityIds, final SecurityToken token); Future<Activity> getActivity(final UserId userId, final GroupId groupId, final String appId,
            final Set<String> fields, final String activityId, final SecurityToken token); }
ActivityServiceImpl implements ActivityService { public Future<Void> deleteActivities(final UserId userId, final GroupId groupId, final String appId, final Set<String> activityIds, final SecurityToken token) { log.debug("Entering deleteActivities data with userId" + userId.getUserId(token) + ", appId " + appId + ", " + activityIds.size() + ", token appId " + token.getAppId()); Principal currentUserPrincipal = openSocialPrincipalDao.execute(userId.getUserId(token)); try { ArrayList<Long> params = new ArrayList<Long>(activityIds.size()); for (String id : activityIds) { params.add(Long.parseLong(id)); } ServiceActionContext currentContext = new ServiceActionContext(params, currentUserPrincipal); serviceActionController.execute(currentContext, deleteUserActivities); } catch (Exception e) { log.error("Error occurred deleting OpenSocial Application Data " + e.toString()); throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.toString()); } return ImmediateFuture.newInstance(null); } @Inject  ActivityServiceImpl(@Named("getUserActivities") final ServiceAction inGetUserActivitiesAction,
            @Named("deleteUserActivities") final TaskHandlerAction inDeleteActivitiesAction,
            final ActionController inServiceActionController,
            @Named("openSocialPrincipalDao") final DomainMapper<String, Principal> inOpenSocialPrincipalDao,
            @Named("postPersonActivityServiceActionTaskHandler") final TaskHandlerServiceAction inPostActivityAction,
            @Named("jpaGadgetDefinitionMapper") final GadgetDefinitionMapper inGadgetDefinitionMapper,
            final GadgetMetaDataFetcher inGadgetMetaDataFetcher); Future<Void> createActivity(final UserId userId, final GroupId groupId, final String appId,
            final Set<String> fields, final Activity activity, final SecurityToken token); Future<Void> deleteActivities(final UserId userId, final GroupId groupId, final String appId,
            final Set<String> activityIds, final SecurityToken token); @SuppressWarnings("unchecked") Future<RestfulCollection<Activity>> getActivities(final Set<UserId> userIds, final GroupId groupId,
            final String appId, final Set<String> fields, final CollectionOptions options, final SecurityToken token); @SuppressWarnings("unchecked") Future<RestfulCollection<Activity>> getActivities(final UserId userId, final GroupId groupId,
            final String appId, final Set<String> fields, final CollectionOptions options,
            final Set<String> activityIds, final SecurityToken token); Future<Activity> getActivity(final UserId userId, final GroupId groupId, final String appId,
            final Set<String> fields, final String activityId, final SecurityToken token);  }