@Test public void performAction() throws Exception { final FileItem file = null; context.checking(new Expectations() { { oneOf(bannerableMapper).updateBannerId(ORG_ID, BANNER_ID); will(returnValue(true)); oneOf(bannerableMapper).flush(); oneOf(updateCacheMock).execute(with(any(UpdateCachedBannerMapperRequest.class))); oneOf(imageWriter).write(file, "n" + BANNER_ID); } }); SaveImageRequest currentRequest = new SaveImageRequest(file, ORG_ID, BANNER_ID); ServiceActionContext currentContext = new ServiceActionContext(currentRequest, principalMock); sut.execute(currentContext); context.assertIsSatisfied(); }
@Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { try { SaveImageRequest currentRequest = (SaveImageRequest) inActionContext.getParams(); imageWriter.write(currentRequest.getFileItem(), "n" + currentRequest.getImageId()); mapper.updateBannerId(currentRequest.getEntityId(), currentRequest.getImageId()); mapper.flush(); cacheMapper.execute(new UpdateCachedBannerMapperRequest(currentRequest.getImageId(), currentRequest .getEntityId())); } catch (Exception ex) { log.error("Error running SaveBannerAction", ex); throw new ExecutionException("Error occurred saving the supplied banner", ex); } return null; }
UpdateBannerExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { try { SaveImageRequest currentRequest = (SaveImageRequest) inActionContext.getParams(); imageWriter.write(currentRequest.getFileItem(), "n" + currentRequest.getImageId()); mapper.updateBannerId(currentRequest.getEntityId(), currentRequest.getImageId()); mapper.flush(); cacheMapper.execute(new UpdateCachedBannerMapperRequest(currentRequest.getImageId(), currentRequest .getEntityId())); } catch (Exception ex) { log.error("Error running SaveBannerAction", ex); throw new ExecutionException("Error occurred saving the supplied banner", ex); } return null; } }
UpdateBannerExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { try { SaveImageRequest currentRequest = (SaveImageRequest) inActionContext.getParams(); imageWriter.write(currentRequest.getFileItem(), "n" + currentRequest.getImageId()); mapper.updateBannerId(currentRequest.getEntityId(), currentRequest.getImageId()); mapper.flush(); cacheMapper.execute(new UpdateCachedBannerMapperRequest(currentRequest.getImageId(), currentRequest .getEntityId())); } catch (Exception ex) { log.error("Error running SaveBannerAction", ex); throw new ExecutionException("Error occurred saving the supplied banner", ex); } return null; } UpdateBannerExecution(final BannerableMapper inMapper,
            final BaseArgCachedDomainMapper<UpdateCachedBannerMapperRequest, Object> inCacheMapper,
            final ImageWriter inImageWriter); }
UpdateBannerExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { try { SaveImageRequest currentRequest = (SaveImageRequest) inActionContext.getParams(); imageWriter.write(currentRequest.getFileItem(), "n" + currentRequest.getImageId()); mapper.updateBannerId(currentRequest.getEntityId(), currentRequest.getImageId()); mapper.flush(); cacheMapper.execute(new UpdateCachedBannerMapperRequest(currentRequest.getImageId(), currentRequest .getEntityId())); } catch (Exception ex) { log.error("Error running SaveBannerAction", ex); throw new ExecutionException("Error occurred saving the supplied banner", ex); } return null; } UpdateBannerExecution(final BannerableMapper inMapper,
            final BaseArgCachedDomainMapper<UpdateCachedBannerMapperRequest, Object> inCacheMapper,
            final ImageWriter inImageWriter); @Override Serializable execute(final PrincipalActionContext inActionContext); }
UpdateBannerExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { try { SaveImageRequest currentRequest = (SaveImageRequest) inActionContext.getParams(); imageWriter.write(currentRequest.getFileItem(), "n" + currentRequest.getImageId()); mapper.updateBannerId(currentRequest.getEntityId(), currentRequest.getImageId()); mapper.flush(); cacheMapper.execute(new UpdateCachedBannerMapperRequest(currentRequest.getImageId(), currentRequest .getEntityId())); } catch (Exception ex) { log.error("Error running SaveBannerAction", ex); throw new ExecutionException("Error occurred saving the supplied banner", ex); } return null; } UpdateBannerExecution(final BannerableMapper inMapper,
            final BaseArgCachedDomainMapper<UpdateCachedBannerMapperRequest, Object> inCacheMapper,
            final ImageWriter inImageWriter); @Override Serializable execute(final PrincipalActionContext inActionContext);  }