@Test void testGetResources() throws Exception { String folderId = "myFolderId"; Folder folder = Folder.create(folderId, "label", null); when(navigatorService.getFolder(folderId)).thenReturn(folder); when(navigatorService.getResources(folderId)).thenReturn(getMockResources()); String expectedContent = "{\"folder\":{\"id\":\"myFolderId\",\"label\":\"label\"},\"resources\":[{\"type\":\"PACKAGE\",\"id\":\"myPackageId\",\"label\":\"label\",\"description\":\"description\",\"hidden\":false,\"readonly\":false}]}"; mockMvc .perform(get(NavigatorController.URI + "/get?folderId=" + folderId)) .andExpect(status().isOk()) .andExpect(content().string(expectedContent)); }
@GetMapping("/get") @ResponseBody public GetResourcesResponse getResources( @RequestParam(value = "folderId", required = false) @Nullable @CheckForNull String folderId) { Folder folder = navigatorService.getFolder(folderId); List<Resource> resources = navigatorService.getResources(folderId); return GetResourcesResponse.create(folder, resources); }
NavigatorController extends PluginController { @GetMapping("/get") @ResponseBody public GetResourcesResponse getResources( @RequestParam(value = "folderId", required = false) @Nullable @CheckForNull String folderId) { Folder folder = navigatorService.getFolder(folderId); List<Resource> resources = navigatorService.getResources(folderId); return GetResourcesResponse.create(folder, resources); } }
NavigatorController extends PluginController { @GetMapping("/get") @ResponseBody public GetResourcesResponse getResources( @RequestParam(value = "folderId", required = false) @Nullable @CheckForNull String folderId) { Folder folder = navigatorService.getFolder(folderId); List<Resource> resources = navigatorService.getResources(folderId); return GetResourcesResponse.create(folder, resources); } NavigatorController(MenuReaderService menuReaderService, NavigatorService navigatorService); }
NavigatorController extends PluginController { @GetMapping("/get") @ResponseBody public GetResourcesResponse getResources( @RequestParam(value = "folderId", required = false) @Nullable @CheckForNull String folderId) { Folder folder = navigatorService.getFolder(folderId); List<Resource> resources = navigatorService.getResources(folderId); return GetResourcesResponse.create(folder, resources); } 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 { @GetMapping("/get") @ResponseBody public GetResourcesResponse getResources( @RequestParam(value = "folderId", required = false) @Nullable @CheckForNull String folderId) { Folder folder = navigatorService.getFolder(folderId); List<Resource> resources = navigatorService.getResources(folderId); return GetResourcesResponse.create(folder, resources); } 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; }