@Test public void getFileName_FromResource() { final String expected = "My Assets.zip"; ctx.registerInjectActivateService(new AssetRenditionsZipperImpl(), "file.name", "OSGi value"); AssetRenditionsZipperImpl zipper = (AssetRenditionsZipperImpl) ctx.getService(AssetRenditionsDownloadOrchestrator.class); assertEquals(expected, zipper.getFileName(new ValueMapDecorator(ImmutableMap.of("fileName", "My Assets")))); }
protected String getFileName(final ValueMap properties) { String fileName = properties.get(PN_FILE_NAME, StringUtils.defaultString(cfg.file_name(), DEFAULT_FILE_ATTACHMENT_NAME)); if (!StringUtils.endsWith(fileName, ZIP_EXTENSION)) { fileName += ZIP_EXTENSION; } return fileName; }
AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected String getFileName(final ValueMap properties) { String fileName = properties.get(PN_FILE_NAME, StringUtils.defaultString(cfg.file_name(), DEFAULT_FILE_ATTACHMENT_NAME)); if (!StringUtils.endsWith(fileName, ZIP_EXTENSION)) { fileName += ZIP_EXTENSION; } return fileName; } }
AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected String getFileName(final ValueMap properties) { String fileName = properties.get(PN_FILE_NAME, StringUtils.defaultString(cfg.file_name(), DEFAULT_FILE_ATTACHMENT_NAME)); if (!StringUtils.endsWith(fileName, ZIP_EXTENSION)) { fileName += ZIP_EXTENSION; } return fileName; }  }
AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected String getFileName(final ValueMap properties) { String fileName = properties.get(PN_FILE_NAME, StringUtils.defaultString(cfg.file_name(), DEFAULT_FILE_ATTACHMENT_NAME)); if (!StringUtils.endsWith(fileName, ZIP_EXTENSION)) { fileName += ZIP_EXTENSION; } return fileName; }  @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 String getFileName(final ValueMap properties) { String fileName = properties.get(PN_FILE_NAME, StringUtils.defaultString(cfg.file_name(), DEFAULT_FILE_ATTACHMENT_NAME)); if (!StringUtils.endsWith(fileName, ZIP_EXTENSION)) { fileName += ZIP_EXTENSION; } return fileName; }  @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; }