@Test public void testExecute() { final List<UserActionRequest> requests = new ArrayList<UserActionRequest>(); context.checking(new Expectations() { { allowing(taskHandlerConext).getActionContext(); will(returnValue(actionContext)); allowing(actionContext).getParams(); will(returnValue(fsdto)); allowing(actionContext).getState(); will(returnValue(new HashMap())); allowing(fsdto).getDescription(); will(returnValue(description)); allowing(fsdto).getStreamId(); will(returnValue(streamId)); allowing(streamScopeProxyMapper).execute(streamId); will(returnValue(streamScope)); allowing(insertMapper).execute(with(any(PersistenceRequest.class))); will(returnValue(9L)); allowing(taskHandlerConext).getUserActionRequests(); will(returnValue(requests)); } }); sut.execute(taskHandlerConext); Assert.assertEquals(1, requests.size()); Assert.assertEquals("regenerateStreamDiscoverListsAction", requests.get(0).getActionKey()); context.assertIsSatisfied(); }
@Override public Serializable execute(final TaskHandlerActionContext<ActionContext> inActionContext) { FeaturedStreamDTO dto = (FeaturedStreamDTO) inActionContext.getActionContext().getParams(); StreamScope streamScope = (inActionContext.getActionContext().getState().get("streamScope") == null) ? streamScopeProxyMapper.execute(dto.getStreamId()) : (StreamScope) inActionContext.getActionContext().getState().get("streamScope"); FeaturedStream entity = new FeaturedStream(dto.getDescription(), streamScope); Long entityId = insertMapper.execute(new PersistenceRequest<FeaturedStream>(entity)); inActionContext.getUserActionRequests().add( new UserActionRequest("regenerateStreamDiscoverListsAction", null, null)); return entityId; }
AddFeaturedStreamExecution implements TaskHandlerExecutionStrategy<ActionContext> { @Override public Serializable execute(final TaskHandlerActionContext<ActionContext> inActionContext) { FeaturedStreamDTO dto = (FeaturedStreamDTO) inActionContext.getActionContext().getParams(); StreamScope streamScope = (inActionContext.getActionContext().getState().get("streamScope") == null) ? streamScopeProxyMapper.execute(dto.getStreamId()) : (StreamScope) inActionContext.getActionContext().getState().get("streamScope"); FeaturedStream entity = new FeaturedStream(dto.getDescription(), streamScope); Long entityId = insertMapper.execute(new PersistenceRequest<FeaturedStream>(entity)); inActionContext.getUserActionRequests().add( new UserActionRequest("regenerateStreamDiscoverListsAction", null, null)); return entityId; } }
AddFeaturedStreamExecution implements TaskHandlerExecutionStrategy<ActionContext> { @Override public Serializable execute(final TaskHandlerActionContext<ActionContext> inActionContext) { FeaturedStreamDTO dto = (FeaturedStreamDTO) inActionContext.getActionContext().getParams(); StreamScope streamScope = (inActionContext.getActionContext().getState().get("streamScope") == null) ? streamScopeProxyMapper.execute(dto.getStreamId()) : (StreamScope) inActionContext.getActionContext().getState().get("streamScope"); FeaturedStream entity = new FeaturedStream(dto.getDescription(), streamScope); Long entityId = insertMapper.execute(new PersistenceRequest<FeaturedStream>(entity)); inActionContext.getUserActionRequests().add( new UserActionRequest("regenerateStreamDiscoverListsAction", null, null)); return entityId; } AddFeaturedStreamExecution(final DomainMapper<Long, StreamScope> inStreamScopeProxyMapper,
            final DomainMapper<PersistenceRequest<FeaturedStream>, Long> inInsertMapper); }
AddFeaturedStreamExecution implements TaskHandlerExecutionStrategy<ActionContext> { @Override public Serializable execute(final TaskHandlerActionContext<ActionContext> inActionContext) { FeaturedStreamDTO dto = (FeaturedStreamDTO) inActionContext.getActionContext().getParams(); StreamScope streamScope = (inActionContext.getActionContext().getState().get("streamScope") == null) ? streamScopeProxyMapper.execute(dto.getStreamId()) : (StreamScope) inActionContext.getActionContext().getState().get("streamScope"); FeaturedStream entity = new FeaturedStream(dto.getDescription(), streamScope); Long entityId = insertMapper.execute(new PersistenceRequest<FeaturedStream>(entity)); inActionContext.getUserActionRequests().add( new UserActionRequest("regenerateStreamDiscoverListsAction", null, null)); return entityId; } AddFeaturedStreamExecution(final DomainMapper<Long, StreamScope> inStreamScopeProxyMapper,
            final DomainMapper<PersistenceRequest<FeaturedStream>, Long> inInsertMapper); @Override Serializable execute(final TaskHandlerActionContext<ActionContext> inActionContext); }
AddFeaturedStreamExecution implements TaskHandlerExecutionStrategy<ActionContext> { @Override public Serializable execute(final TaskHandlerActionContext<ActionContext> inActionContext) { FeaturedStreamDTO dto = (FeaturedStreamDTO) inActionContext.getActionContext().getParams(); StreamScope streamScope = (inActionContext.getActionContext().getState().get("streamScope") == null) ? streamScopeProxyMapper.execute(dto.getStreamId()) : (StreamScope) inActionContext.getActionContext().getState().get("streamScope"); FeaturedStream entity = new FeaturedStream(dto.getDescription(), streamScope); Long entityId = insertMapper.execute(new PersistenceRequest<FeaturedStream>(entity)); inActionContext.getUserActionRequests().add( new UserActionRequest("regenerateStreamDiscoverListsAction", null, null)); return entityId; } AddFeaturedStreamExecution(final DomainMapper<Long, StreamScope> inStreamScopeProxyMapper,
            final DomainMapper<PersistenceRequest<FeaturedStream>, Long> inInsertMapper); @Override Serializable execute(final TaskHandlerActionContext<ActionContext> inActionContext);  }