@Test void testSearchResources() throws Exception { String query = "text"; when(navigatorService.findResources(query)).thenReturn(getMockResources()); String expectedContent = "{\"resources\":[{\"type\":\"PACKAGE\",\"id\":\"myPackageId\",\"label\":\"label\",\"description\":\"description\",\"hidden\":false,\"readonly\":false}]}"; mockMvc .perform(get(NavigatorController.URI + "/search?query=" + query)) .andExpect(status().isOk()) .andExpect(content().string(expectedContent)); }
@GetMapping("/search") @ResponseBody public SearchResourcesResponse searchResources(@RequestParam(value = "query") String query) { List<Resource> resources = navigatorService.findResources(query); return SearchResourcesResponse.create(resources); }
NavigatorController extends PluginController { @GetMapping("/search") @ResponseBody public SearchResourcesResponse searchResources(@RequestParam(value = "query") String query) { List<Resource> resources = navigatorService.findResources(query); return SearchResourcesResponse.create(resources); } }
NavigatorController extends PluginController { @GetMapping("/search") @ResponseBody public SearchResourcesResponse searchResources(@RequestParam(value = "query") String query) { List<Resource> resources = navigatorService.findResources(query); return SearchResourcesResponse.create(resources); } NavigatorController(MenuReaderService menuReaderService, NavigatorService navigatorService); }
NavigatorController extends PluginController { @GetMapping("/search") @ResponseBody public SearchResourcesResponse searchResources(@RequestParam(value = "query") String query) { List<Resource> resources = navigatorService.findResources(query); return SearchResourcesResponse.create(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("/search") @ResponseBody public SearchResourcesResponse searchResources(@RequestParam(value = "query") String query) { List<Resource> resources = navigatorService.findResources(query); return SearchResourcesResponse.create(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; }