SnapshotController { @RequestMapping(value = "/spaces/restores/{storeId}/by-snapshot/{snapshotId:.+}", method = RequestMethod.GET) @ResponseBody public String getRestore(@PathVariable("storeId") String storeId, @PathVariable("snapshotId") String snapshotId) { try { return getTaskClient(storeId).getRestoreBySnapshot(snapshotId).serialize(); } 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 testGetRestoreBySnaphshotId() throws Exception { setupGetTaskClient(storeId); EasyMock.expect(this.taskClient.getRestoreBySnapshot(snapshotId)) .andReturn(new GetRestoreTaskResult()); replayAll(); SnapshotController controller = createController(); Assert.assertNotNull(controller.getRestore(storeId, snapshotId)); }
@Test public void testGetRestore() throws Exception { setupGetTaskClient(storeId); String restoreId = "restore-id"; EasyMock.expect(this.taskClient.getRestore(restoreId)) .andReturn(new GetRestoreTaskResult()); replayAll(); SnapshotController controller = createController(); Assert.assertNotNull(controller.getRestoreByRestoreId(storeId, restoreId)); }