@Test public void testExecute() { final String streamUID = "stream"; final long streamId = 55L; long userId = 44L; final GetStreamActivitySubscriptionMapperRequest request = new GetStreamActivitySubscriptionMapperRequest( userId, streamId); context.checking(new Expectations() { { allowing(entityIdFromUniqueIdDAO).execute(streamUID); will(returnValue(streamId)); allowing(getNotificationPreferenceDAO).execute(with(equalInternally(request))); will(returnValue(true)); } }); ExecutionStrategy<PrincipalActionContext> sut = new GetStreamActivitySubscriptionExecution( entityIdFromUniqueIdDAO, getNotificationPreferenceDAO); assertTrue((Boolean) sut.execute(TestContextCreator.createPrincipalActionContext(streamUID, "jdoe", userId))); context.assertIsSatisfied(); }
@Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { String uniqueId = (String) inActionContext.getParams(); log.debug("Getting group email notification for {} and stream entity with unique id {}", inActionContext .getPrincipal().getAccountId(), uniqueId); Long id = entityIdFromUniqueIdDAO.execute(uniqueId); if (id == null) { return false; } else { return getNotificationPreferenceDAO.execute(new GetStreamActivitySubscriptionMapperRequest(inActionContext .getPrincipal().getId(), id)); } }
GetStreamActivitySubscriptionExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { String uniqueId = (String) inActionContext.getParams(); log.debug("Getting group email notification for {} and stream entity with unique id {}", inActionContext .getPrincipal().getAccountId(), uniqueId); Long id = entityIdFromUniqueIdDAO.execute(uniqueId); if (id == null) { return false; } else { return getNotificationPreferenceDAO.execute(new GetStreamActivitySubscriptionMapperRequest(inActionContext .getPrincipal().getId(), id)); } } }
GetStreamActivitySubscriptionExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { String uniqueId = (String) inActionContext.getParams(); log.debug("Getting group email notification for {} and stream entity with unique id {}", inActionContext .getPrincipal().getAccountId(), uniqueId); Long id = entityIdFromUniqueIdDAO.execute(uniqueId); if (id == null) { return false; } else { return getNotificationPreferenceDAO.execute(new GetStreamActivitySubscriptionMapperRequest(inActionContext .getPrincipal().getId(), id)); } } GetStreamActivitySubscriptionExecution(final DomainMapper<String, Long> inEntityIdFromUniqueIdDAO,
            final DomainMapper<GetStreamActivitySubscriptionMapperRequest, Boolean> //
            inGetNotificationPreferenceDAO); }
GetStreamActivitySubscriptionExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { String uniqueId = (String) inActionContext.getParams(); log.debug("Getting group email notification for {} and stream entity with unique id {}", inActionContext .getPrincipal().getAccountId(), uniqueId); Long id = entityIdFromUniqueIdDAO.execute(uniqueId); if (id == null) { return false; } else { return getNotificationPreferenceDAO.execute(new GetStreamActivitySubscriptionMapperRequest(inActionContext .getPrincipal().getId(), id)); } } GetStreamActivitySubscriptionExecution(final DomainMapper<String, Long> inEntityIdFromUniqueIdDAO,
            final DomainMapper<GetStreamActivitySubscriptionMapperRequest, Boolean> //
            inGetNotificationPreferenceDAO); @Override Serializable execute(final PrincipalActionContext inActionContext); }
GetStreamActivitySubscriptionExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { String uniqueId = (String) inActionContext.getParams(); log.debug("Getting group email notification for {} and stream entity with unique id {}", inActionContext .getPrincipal().getAccountId(), uniqueId); Long id = entityIdFromUniqueIdDAO.execute(uniqueId); if (id == null) { return false; } else { return getNotificationPreferenceDAO.execute(new GetStreamActivitySubscriptionMapperRequest(inActionContext .getPrincipal().getId(), id)); } } GetStreamActivitySubscriptionExecution(final DomainMapper<String, Long> inEntityIdFromUniqueIdDAO,
            final DomainMapper<GetStreamActivitySubscriptionMapperRequest, Boolean> //
            inGetNotificationPreferenceDAO); @Override Serializable execute(final PrincipalActionContext inActionContext);  }