@Test(expected = AssetRenditionsException.class) public void checkForMaxSize_Over() throws AssetRenditionsException { final String expected = "Test Assets.zip"; ctx.registerInjectActivateService(new AssetRenditionsZipperImpl(), "max.size", 10000); AssetRenditionsZipperImpl zipper = (AssetRenditionsZipperImpl) ctx.getService(AssetRenditionsDownloadOrchestrator.class); zipper.checkForMaxSize((10000 * 1024) + 100); assertTrue( "Exception should not be throw", true); }
protected void checkForMaxSize(long size) throws AssetRenditionsException { if (cfg.max_size() >= 0 && size > cfg.max_size() * BYTES_IN_MB) { throw new AssetRenditionsException("Selected assets exceed maximum allows size."); } }
AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected void checkForMaxSize(long size) throws AssetRenditionsException { if (cfg.max_size() >= 0 && size > cfg.max_size() * BYTES_IN_MB) { throw new AssetRenditionsException("Selected assets exceed maximum allows size."); } } }
AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected void checkForMaxSize(long size) throws AssetRenditionsException { if (cfg.max_size() >= 0 && size > cfg.max_size() * BYTES_IN_MB) { throw new AssetRenditionsException("Selected assets exceed maximum allows size."); } }  }
AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected void checkForMaxSize(long size) throws AssetRenditionsException { if (cfg.max_size() >= 0 && size > cfg.max_size() * BYTES_IN_MB) { throw new AssetRenditionsException("Selected assets exceed maximum allows size."); } }  @Override void execute(final SlingHttpServletRequest request,
                        final SlingHttpServletResponse response,
                        final List<AssetModel> assets,
                        final List<String> renditionNames); @Override boolean accepts(SlingHttpServletRequest request, List<AssetModel> assets, List<String> renditionNames); }
AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected void checkForMaxSize(long size) throws AssetRenditionsException { if (cfg.max_size() >= 0 && size > cfg.max_size() * BYTES_IN_MB) { throw new AssetRenditionsException("Selected assets exceed maximum allows size."); } }  @Override void execute(final SlingHttpServletRequest request,
                        final SlingHttpServletResponse response,
                        final List<AssetModel> assets,
                        final List<String> renditionNames); @Override boolean accepts(SlingHttpServletRequest request, List<AssetModel> assets, List<String> renditionNames); static final String NAME; static final String VAR_ASSET_NAME; static final String VAR_ASSET_EXTENSION; static final String VAR_RENDITION_NAME; static final String VAR_RENDITION_EXTENSION; static final String VAR_ASSET_FILE_NAME; static final String VAR_ASSET_TITLE; static final String ZIP_EXTENSION; static final String DEFAULT_NO_CONTENT_FILE_NAME; static final String DEFAULT_NO_CONTENT_MESSAGE; }