ShowThumbnailsController extends AbstractTemplateController { @Override protected ModelAndView svnHandle(final SVNConnection connection, final BaseCommand cmd, final long headRevision, final UserRepositoryContext userRepositoryContext, final HttpServletRequest request, final HttpServletResponse response, final BindException exception) throws Exception { final MultipleEntriesCommand command = (MultipleEntriesCommand) cmd; final Map<String, Object> model = new HashMap<String, Object>(); final List<PathRevision> imageEntries = new ArrayList<PathRevision>(); logger.debug("Showing thumbnail images"); for (final PathRevision entry : command.getEntries()) { logger.debug("entry: " + entry); if (mimeFileTypeMap.getContentType(entry.getPath()).startsWith("image")) { imageEntries.add(entry); } } logger.debug(imageEntries.size() + " entries out of " + command.getEntries().length + " are image files"); model.put("thumbnailentries", imageEntries); return new ModelAndView(getViewName(), model); } ShowThumbnailsController(final FileTypeMap mimeFileTypeMap);   }
@Test public void testSvnHandle() throws Exception { final ConfigurableMimeFileTypeMap fileTypeMap = new ConfigurableMimeFileTypeMap(); fileTypeMap.afterPropertiesSet(); final MultipleEntriesCommand command = new MultipleEntriesCommand(); final ShowThumbnailsController ctrl = new ShowThumbnailsController(fileTypeMap); final String[] pathEntries = new String[]{ "file1.gif@123", "file2.jpg@123", "file.abc@123"}; command.setEntries(PathRevision.parse(pathEntries)); final MockHttpServletRequest req = new MockHttpServletRequest(); req.addParameter(GetFileController.DISPLAY_REQUEST_PARAMETER, GetFileController.CONTENT_DISPOSITION_INLINE); final ModelAndView modelAndView = ctrl.svnHandle(null, command, 100, null, req, null, null); final Map model = modelAndView.getModel(); final List entries = (List) model.get("thumbnailentries"); assertEquals(2, entries.size()); final PathRevision entry0 = (PathRevision) entries.get(0); assertEquals("file1.gif", entry0.getPath()); assertEquals(123, entry0.getRevision().getNumber()); }