@Test public void testSuccessOnYesRestricted() { final ChangeStreamActivitySubscriptionMapperRequest expected = new ChangeStreamActivitySubscriptionMapperRequest(PERSON_ID, STREAM_ENTITY_ID, true, true); context.checking(new Expectations() { { allowing(entityIdFromUniqueIdDAO).execute(STREAM_ENTITY_UNIQUE_ID); will(returnValue(STREAM_ENTITY_ID)); oneOf(changePreferenceDAO).execute(with(equalInternally(expected))); will(returnValue(Boolean.TRUE)); } }); PrincipalActionContext actionContext = TestContextCreator.createPrincipalActionContext( new ChangeStreamActivitySubscriptionRequest(EntityType.GROUP, STREAM_ENTITY_UNIQUE_ID, true, true), PERSON_ACCOUNT_ID, PERSON_ID); sut.execute(actionContext); context.assertIsSatisfied(); }
@Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { ChangeStreamActivitySubscriptionRequest request = (ChangeStreamActivitySubscriptionRequest) inActionContext .getParams(); if (log.isInfoEnabled()) { log.info("Setting group email notification " + (request.getReceiveNewActivityNotifications() ? "on" : "off") + " for " + inActionContext.getPrincipal().getAccountId() + " and stream entity with unique id " + request.getStreamEntityUniqueId()); } Long id = entityIdFromUniqueIdDAO.execute(request.getStreamEntityUniqueId()); changeNotificationPreferenceDAO.execute(new ChangeStreamActivitySubscriptionMapperRequest(inActionContext .getPrincipal().getId(), id, request.getReceiveNewActivityNotifications(), request .getCoordinatorOnlyNotifications())); return null; }
ChangeStreamActivitySubscriptionExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { ChangeStreamActivitySubscriptionRequest request = (ChangeStreamActivitySubscriptionRequest) inActionContext .getParams(); if (log.isInfoEnabled()) { log.info("Setting group email notification " + (request.getReceiveNewActivityNotifications() ? "on" : "off") + " for " + inActionContext.getPrincipal().getAccountId() + " and stream entity with unique id " + request.getStreamEntityUniqueId()); } Long id = entityIdFromUniqueIdDAO.execute(request.getStreamEntityUniqueId()); changeNotificationPreferenceDAO.execute(new ChangeStreamActivitySubscriptionMapperRequest(inActionContext .getPrincipal().getId(), id, request.getReceiveNewActivityNotifications(), request .getCoordinatorOnlyNotifications())); return null; } }
ChangeStreamActivitySubscriptionExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { ChangeStreamActivitySubscriptionRequest request = (ChangeStreamActivitySubscriptionRequest) inActionContext .getParams(); if (log.isInfoEnabled()) { log.info("Setting group email notification " + (request.getReceiveNewActivityNotifications() ? "on" : "off") + " for " + inActionContext.getPrincipal().getAccountId() + " and stream entity with unique id " + request.getStreamEntityUniqueId()); } Long id = entityIdFromUniqueIdDAO.execute(request.getStreamEntityUniqueId()); changeNotificationPreferenceDAO.execute(new ChangeStreamActivitySubscriptionMapperRequest(inActionContext .getPrincipal().getId(), id, request.getReceiveNewActivityNotifications(), request .getCoordinatorOnlyNotifications())); return null; } ChangeStreamActivitySubscriptionExecution(final DomainMapper<String, Long> inEntityIdFromUniqueIdDAO,
            final DomainMapper<ChangeStreamActivitySubscriptionMapperRequest, Boolean> //
            inChangeNotificationPreferenceDAO); }
ChangeStreamActivitySubscriptionExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { ChangeStreamActivitySubscriptionRequest request = (ChangeStreamActivitySubscriptionRequest) inActionContext .getParams(); if (log.isInfoEnabled()) { log.info("Setting group email notification " + (request.getReceiveNewActivityNotifications() ? "on" : "off") + " for " + inActionContext.getPrincipal().getAccountId() + " and stream entity with unique id " + request.getStreamEntityUniqueId()); } Long id = entityIdFromUniqueIdDAO.execute(request.getStreamEntityUniqueId()); changeNotificationPreferenceDAO.execute(new ChangeStreamActivitySubscriptionMapperRequest(inActionContext .getPrincipal().getId(), id, request.getReceiveNewActivityNotifications(), request .getCoordinatorOnlyNotifications())); return null; } ChangeStreamActivitySubscriptionExecution(final DomainMapper<String, Long> inEntityIdFromUniqueIdDAO,
            final DomainMapper<ChangeStreamActivitySubscriptionMapperRequest, Boolean> //
            inChangeNotificationPreferenceDAO); @Override Serializable execute(final PrincipalActionContext inActionContext); }
ChangeStreamActivitySubscriptionExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { ChangeStreamActivitySubscriptionRequest request = (ChangeStreamActivitySubscriptionRequest) inActionContext .getParams(); if (log.isInfoEnabled()) { log.info("Setting group email notification " + (request.getReceiveNewActivityNotifications() ? "on" : "off") + " for " + inActionContext.getPrincipal().getAccountId() + " and stream entity with unique id " + request.getStreamEntityUniqueId()); } Long id = entityIdFromUniqueIdDAO.execute(request.getStreamEntityUniqueId()); changeNotificationPreferenceDAO.execute(new ChangeStreamActivitySubscriptionMapperRequest(inActionContext .getPrincipal().getId(), id, request.getReceiveNewActivityNotifications(), request .getCoordinatorOnlyNotifications())); return null; } ChangeStreamActivitySubscriptionExecution(final DomainMapper<String, Long> inEntityIdFromUniqueIdDAO,
            final DomainMapper<ChangeStreamActivitySubscriptionMapperRequest, Boolean> //
            inChangeNotificationPreferenceDAO); @Override Serializable execute(final PrincipalActionContext inActionContext);  }