public TransformerSourceTargetSuffixValue(String transformerName, String sourceExt, String targetExt, String suffix, String use, String value, MimetypeService mimetypeService) { super(transformerName, sourceExt, targetExt, suffix, use); this.value = value; this.sourceMimetype = ANY.equals(sourceExt) ? ANY : mimetypeService.getMimetype(sourceExt); this.targetMimetype = ANY.equals(targetExt) ? ANY : mimetypeService.getMimetype(targetExt); }
sourceMimetype = bit.equals("*") ? bit : mimetypeService.getMimetype(bit); if (sourceMimetype == null) targetMimetype = bit.equals("*") ? bit : mimetypeService.getMimetype(bit); if (targetMimetype == null)
/** * Mock up the responses from the mimetypeService so that it: * a) returns all the supplied mimetypes * b) returns the extension given the mimetype * c) returns the mimetype given the extension. * @param mimetypeService mimetype service * @param mimetypesAndExtensions sequence of mimetypes and extenstions. * @throws IllegalStateException if there is not an extension for every mimetype */ public static void mockMimetypes(MimetypeService mimetypeService, String... mimetypesAndExtensions) { if (mimetypesAndExtensions.length % 2 != 0) { // Not using IllegalArgumentException as this is thrown by classes under test throw new java.lang.IllegalStateException("There should be an extension for every mimetype"); } final Set<String> allMimetypes = new HashSet<String>(); for (int i=0; i < mimetypesAndExtensions.length; i+=2) { allMimetypes.add(mimetypesAndExtensions[i]); when(mimetypeService.getExtension(mimetypesAndExtensions[i])).thenReturn(mimetypesAndExtensions[i+1]); when(mimetypeService.getMimetype(mimetypesAndExtensions[i+1])).thenReturn(mimetypesAndExtensions[i]); } when(mimetypeService.getMimetypes()).thenReturn(new ArrayList<String>(allMimetypes)); }
public TransformerSourceTargetSuffixValue(String transformerName, String sourceExt, String targetExt, String suffix, String use, String value, MimetypeService mimetypeService) { super(transformerName, sourceExt, targetExt, suffix, use); this.value = value; this.sourceMimetype = ANY.equals(sourceExt) ? ANY : mimetypeService.getMimetype(sourceExt); this.targetMimetype = ANY.equals(targetExt) ? ANY : mimetypeService.getMimetype(targetExt); }
sourceMimetype = bit.equals("*") ? bit : mimetypeService.getMimetype(bit); if (sourceMimetype == null) targetMimetype = bit.equals("*") ? bit : mimetypeService.getMimetype(bit); if (targetMimetype == null)
private String stdMimetype(String mimetype) { return mimetypeService.getMimetype(mimetypeService.getExtension(mimetype)); } }
private String stdMimetype(String mimetype) { return mimetypeService.getMimetype(mimetypeService.getExtension(mimetype)); } }
String mimetype = mimetypeService.getMimetype(name); if (!MimetypeMap.EXTENSION_BINARY.equals(name) && MimetypeMap.MIMETYPE_BINARY.equals(mimetype))
String mimetype = mimetypeService.getMimetype(name); if (!MimetypeMap.EXTENSION_BINARY.equals(name) && MimetypeMap.MIMETYPE_BINARY.equals(mimetype))
contentData = ContentData .setMimetype(contentData, mimetypeService.getMimetype(fileName.substring(fileName .lastIndexOf(".") + 1)));
String mimetype = mimetypeService.getMimetype(extension); if (mimetype != null)
String mimetype = mimetypeService.getMimetype(extension); if (mimetype != null)