@Test void testInit() throws Exception { when(menuReaderService.findMenuItemPath(NavigatorController.ID)).thenReturn("/test/path"); when(localeResolver.resolveLocale(any())).thenReturn(Locale.FRENCH); mockMvc .perform(get(NavigatorController.URI)) .andExpect(status().isOk()) .andExpect(view().name("view-navigator")) .andExpect(model().attribute("baseUrl", "/test/path")); }
@GetMapping("/**") public String init(Model model) { model.addAttribute(KEY_BASE_URL, menuReaderService.findMenuItemPath(ID)); asList("dataexplorer", "metadata-manager", "importwizard") .forEach( pluginId -> model.addAttribute( pluginId.replace('-', '_'), menuReaderService.findMenuItemPath(pluginId))); return "view-navigator"; }
NavigatorController extends PluginController { @GetMapping("/**") public String init(Model model) { model.addAttribute(KEY_BASE_URL, menuReaderService.findMenuItemPath(ID)); asList("dataexplorer", "metadata-manager", "importwizard") .forEach( pluginId -> model.addAttribute( pluginId.replace('-', '_'), menuReaderService.findMenuItemPath(pluginId))); return "view-navigator"; } }
NavigatorController extends PluginController { @GetMapping("/**") public String init(Model model) { model.addAttribute(KEY_BASE_URL, menuReaderService.findMenuItemPath(ID)); asList("dataexplorer", "metadata-manager", "importwizard") .forEach( pluginId -> model.addAttribute( pluginId.replace('-', '_'), menuReaderService.findMenuItemPath(pluginId))); return "view-navigator"; } NavigatorController(MenuReaderService menuReaderService, NavigatorService navigatorService); }
NavigatorController extends PluginController { @GetMapping("/**") public String init(Model model) { model.addAttribute(KEY_BASE_URL, menuReaderService.findMenuItemPath(ID)); asList("dataexplorer", "metadata-manager", "importwizard") .forEach( pluginId -> model.addAttribute( pluginId.replace('-', '_'), menuReaderService.findMenuItemPath(pluginId))); return "view-navigator"; } 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("/**") public String init(Model model) { model.addAttribute(KEY_BASE_URL, menuReaderService.findMenuItemPath(ID)); asList("dataexplorer", "metadata-manager", "importwizard") .forEach( pluginId -> model.addAttribute( pluginId.replace('-', '_'), menuReaderService.findMenuItemPath(pluginId))); return "view-navigator"; } 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; }