SnapshotController { @RequestMapping(value = "/spaces/snapshots/{storeId}/{snapshotId}/content", method = RequestMethod.GET) public ModelAndView getContent(@PathVariable("storeId") String storeId, @PathVariable("snapshotId") String snapshotId, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "prefix", required = false) String prefix) { try { SnapshotTaskClient taskClient = getTaskClient(storeId); if (page == null) { page = 0; } int pageSize = 200; GetSnapshotContentsTaskResult result = taskClient.getSnapshotContents(snapshotId, page, pageSize, prefix); List<SnapshotContentItem> items = result.getContentItems(); ModelAndView mav = new ModelAndView("jsonView"); mav.addObject("contents", items); mav.addObject("page", page); mav.addObject("snapshotId", snapshotId); mav.addObject("storeId", storeId); mav.addObject("nextPage", items.size() == pageSize ? page + 1 : null); mav.addObject("prefix", prefix); mav.addObject("totalCount", result.getTotalCount()); return mav; } catch (Exception e) { log.error(e.getMessage(), e); throw new RuntimeException(e); } } @Autowired(required = true)  SnapshotController(@Qualifier("contentStoreManager") ContentStoreManager contentStoreManager,
                              @Qualifier("userDetailsSvc") DuracloudUserDetailsService userDetailsService,
                              SnapshotTaskClientManager snapshotTaskClientManager); @RequestMapping(value = "/spaces/snapshot", method = RequestMethod.POST) @ResponseBody String create(HttpServletRequest request,
                         HttpServletResponse response,
                         @RequestParam String spaceId,
                         @RequestParam String storeId,
                         @RequestParam String description); @RequestMapping(value = "/spaces/snapshot", method = RequestMethod.GET) ModelAndView get(@RequestParam String storeId,
                            @RequestParam String spaceId); @RequestMapping(value = "/spaces/snapshots/{storeId}", method = RequestMethod.GET) @ResponseBody String getSnapshotList(@PathVariable("storeId") String storeId); @RequestMapping(value = "/spaces/snapshots/{storeId}/{snapshotId:.+}", method = RequestMethod.GET) @ResponseBody String getSnapshot(@PathVariable("storeId") String storeId,
                              @PathVariable("snapshotId") String snapshotId); @RequestMapping(value = "/spaces/snapshots/{storeId}/{snapshotId}/history", method = RequestMethod.GET) ModelAndView getHistory(@PathVariable("storeId") String storeId,
                                   @PathVariable("snapshotId") String snapshotId,
                                   @RequestParam(value = "page", required = false) Integer page,
                                   @RequestParam(value = "attachment", required = false, defaultValue = "false")
                                       Boolean attachment,
                                   HttpServletResponse response); @RequestMapping(value = "/spaces/snapshots/{storeId}/{snapshotId}/content", method = RequestMethod.GET) ModelAndView getContent(@PathVariable("storeId") String storeId,
                                   @PathVariable("snapshotId") String snapshotId,
                                   @RequestParam(value = "page", required = false) Integer page,
                                   @RequestParam(value = "prefix", required = false) String prefix); @RequestMapping(value = "/spaces/snapshots/{storeId}/{snapshotId}/restore-space-id", method = RequestMethod.GET) @ResponseBody String restoreSpaceId(HttpServletRequest request,
                                 @PathVariable("storeId") String storeId,
                                 @PathVariable("snapshotId") String snapshotId); @RequestMapping(value = "/spaces/restores/{storeId}/by-snapshot/{snapshotId:.+}", method = RequestMethod.GET) @ResponseBody String getRestore(@PathVariable("storeId") String storeId,
                             @PathVariable("snapshotId") String snapshotId); @RequestMapping(value = "/spaces/restores/{storeId}/{restoreId:.+}", method = RequestMethod.GET) @ResponseBody String getRestoreByRestoreId(@PathVariable("storeId") String storeId,
                                        @PathVariable("restoreId") String restoreId); @RequestMapping(value = "/spaces/restores", method = RequestMethod.POST) @ResponseBody String restore(HttpServletRequest request,
                          @RequestParam String storeId,
                          @RequestParam String snapshotId); @RequestMapping(value = "/spaces/restores/request", method = RequestMethod.POST) @ResponseBody String requestRestore(HttpServletRequest request,
                                 @RequestParam String storeId,
                                 @RequestParam String snapshotId);  }
@Test public void testGetContent() throws Exception { Integer page = 0; String prefix = "prefix"; List<SnapshotContentItem> items = new ArrayList<>(); for (int i = 0; i < 200; i++) { SnapshotContentItem item = new SnapshotContentItem(); item.setContentId("content-id" + i); item.setContentProperties(new HashMap<String, String>()); items.add(item); } GetSnapshotContentsTaskResult result = new GetSnapshotContentsTaskResult(); result.setContentItems(items); setupGetTaskClient(storeId); EasyMock.expect(taskClient.getSnapshotContents(snapshotId, page, 200, prefix)) .andReturn(result); replayAll(); SnapshotController controller = createController(); ModelAndView mav = controller.getContent(storeId, snapshotId, page, prefix); Map<String, Object> model = mav.getModel(); Assert.assertEquals(model.get("storeId"), storeId); Assert.assertEquals(model.get("snapshotId"), snapshotId); Assert.assertEquals(model.get("prefix"), prefix); Assert.assertEquals(model.get("page"), page); Assert.assertEquals(model.get("nextPage"), page + 1); }