@Test void testCopyResources() throws Exception { String targetFolderId = "myFolderId"; List<ResourceIdentifier> resources = getMockResourceIdentifiers(); JobExecution jobExecution = mock(JobExecution.class); EntityType entityType = mock(EntityType.class); when(jobExecution.getEntityType()).thenReturn(entityType); when(navigatorService.copyResources(resources, targetFolderId)).thenReturn(jobExecution); String json = "{\"resources\":[{\"type\":\"PACKAGE\",\"id\":\"myPackageId\",\"label\":\"label\",\"description\":\"description\"}],\"targetFolderId\":\"myFolderId\"}"; mockMvc .perform( post(NavigatorController.URI + "/copy").content(json).contentType(APPLICATION_JSON)) .andExpect(status().isOk()); }
@PostMapping("/copy") @ResponseBody public JobExecution copyResources(@RequestBody @Valid CopyResourcesRequest copyResourcesRequest) { return navigatorService.copyResources( copyResourcesRequest.getResources(), copyResourcesRequest.getTargetFolderId()); }
NavigatorController extends PluginController { @PostMapping("/copy") @ResponseBody public JobExecution copyResources(@RequestBody @Valid CopyResourcesRequest copyResourcesRequest) { return navigatorService.copyResources( copyResourcesRequest.getResources(), copyResourcesRequest.getTargetFolderId()); } }
NavigatorController extends PluginController { @PostMapping("/copy") @ResponseBody public JobExecution copyResources(@RequestBody @Valid CopyResourcesRequest copyResourcesRequest) { return navigatorService.copyResources( copyResourcesRequest.getResources(), copyResourcesRequest.getTargetFolderId()); } NavigatorController(MenuReaderService menuReaderService, NavigatorService navigatorService); }
NavigatorController extends PluginController { @PostMapping("/copy") @ResponseBody public JobExecution copyResources(@RequestBody @Valid CopyResourcesRequest copyResourcesRequest) { return navigatorService.copyResources( copyResourcesRequest.getResources(), copyResourcesRequest.getTargetFolderId()); } NavigatorController(MenuReaderService menuReaderService, NavigatorService navigatorService); @GetMapping("/**") String init(Model model); @GetMapping("/get") @ResponseBody GetResourcesResponse getResources(
      @RequestParam(value = "folderId", required = false) @Nullable @CheckForNull String folderId); @GetMapping("/search") @ResponseBody SearchResourcesResponse searchResources(@RequestParam(value = "query") String query); @PutMapping("/update") @ResponseStatus(OK) void updateResource(@RequestBody @Valid UpdateResourceRequest updateResourceRequest); @PostMapping("/copy") @ResponseBody JobExecution copyResources(@RequestBody @Valid CopyResourcesRequest copyResourcesRequest); @PostMapping("/download") @ResponseBody JobExecution downloadResources(
      @RequestBody @Valid DownloadResourcesRequest downloadResourcesRequest); @PostMapping("/move") @ResponseStatus(OK) void moveResources(@RequestBody @Valid MoveResourcesRequest moveResourcesRequest); @DeleteMapping("/delete") @ResponseBody JobExecution deleteResources(
      @RequestBody @Valid DeleteResourcesRequest deleteItemsRequest); }
NavigatorController extends PluginController { @PostMapping("/copy") @ResponseBody public JobExecution copyResources(@RequestBody @Valid CopyResourcesRequest copyResourcesRequest) { return navigatorService.copyResources( copyResourcesRequest.getResources(), copyResourcesRequest.getTargetFolderId()); } NavigatorController(MenuReaderService menuReaderService, NavigatorService navigatorService); @GetMapping("/**") String init(Model model); @GetMapping("/get") @ResponseBody GetResourcesResponse getResources(
      @RequestParam(value = "folderId", required = false) @Nullable @CheckForNull String folderId); @GetMapping("/search") @ResponseBody SearchResourcesResponse searchResources(@RequestParam(value = "query") String query); @PutMapping("/update") @ResponseStatus(OK) void updateResource(@RequestBody @Valid UpdateResourceRequest updateResourceRequest); @PostMapping("/copy") @ResponseBody JobExecution copyResources(@RequestBody @Valid CopyResourcesRequest copyResourcesRequest); @PostMapping("/download") @ResponseBody JobExecution downloadResources(
      @RequestBody @Valid DownloadResourcesRequest downloadResourcesRequest); @PostMapping("/move") @ResponseStatus(OK) void moveResources(@RequestBody @Valid MoveResourcesRequest moveResourcesRequest); @DeleteMapping("/delete") @ResponseBody JobExecution deleteResources(
      @RequestBody @Valid DeleteResourcesRequest deleteItemsRequest); static final String ID; static final String URI; }