@Test public void testDelete() throws Exception { MockGeoServer.get().catalog() .workspace("foo", "http: .geoServer().build(geoServer); mvc.perform(delete("/app/api/workspaces/foo")) .andExpect(status().isNoContent()) .andReturn(); Catalog cat = geoServer.getCatalog(); verify(cat, times(1)).remove(isA(WorkspaceInfo.class)); }
@RequestMapping(value = "/{wsName:.+}", method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void delete(@PathVariable String wsName, HttpServletResponse response) { Catalog cat = geoServer.getCatalog(); WorkspaceInfo ws = findWorkspace(wsName, cat); new CascadeDeleteVisitor(cat).visit(ws); recent.remove(WorkspaceInfo.class, ws); }
WorkspaceController extends ApiController { @RequestMapping(value = "/{wsName:.+}", method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void delete(@PathVariable String wsName, HttpServletResponse response) { Catalog cat = geoServer.getCatalog(); WorkspaceInfo ws = findWorkspace(wsName, cat); new CascadeDeleteVisitor(cat).visit(ws); recent.remove(WorkspaceInfo.class, ws); } }
WorkspaceController extends ApiController { @RequestMapping(value = "/{wsName:.+}", method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void delete(@PathVariable String wsName, HttpServletResponse response) { Catalog cat = geoServer.getCatalog(); WorkspaceInfo ws = findWorkspace(wsName, cat); new CascadeDeleteVisitor(cat).visit(ws); recent.remove(WorkspaceInfo.class, ws); } @Autowired  WorkspaceController(GeoServer geoServer, RecentObjectCache recentCache); }
WorkspaceController extends ApiController { @RequestMapping(value = "/{wsName:.+}", method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void delete(@PathVariable String wsName, HttpServletResponse response) { Catalog cat = geoServer.getCatalog(); WorkspaceInfo ws = findWorkspace(wsName, cat); new CascadeDeleteVisitor(cat).visit(ws); recent.remove(WorkspaceInfo.class, ws); } @Autowired  WorkspaceController(GeoServer geoServer, RecentObjectCache recentCache); @RequestMapping(method = RequestMethod.GET) @ResponseBody JSONArr list(); @RequestMapping(value = "/recent", method = RequestMethod.GET) @ResponseBody JSONArr recent(); @RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.CREATED) @ResponseBody JSONObj create(@RequestBody JSONObj obj); @RequestMapping(value = "/{wsName:.+}", method = RequestMethod.GET) @ResponseBody JSONObj get(@PathVariable String wsName); @RequestMapping(value = "/{wsName:.+}", method = RequestMethod.PATCH) @ResponseBody JSONObj patch(@PathVariable String wsName, @RequestBody JSONObj obj); @RequestMapping(value = "/{wsName:.+}", method = RequestMethod.PUT) @ResponseBody JSONObj put(@PathVariable String wsName, @RequestBody JSONObj obj); @RequestMapping(value = "/{wsName:.+}", method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.NO_CONTENT) void delete(@PathVariable String wsName, HttpServletResponse response); @RequestMapping(value = "/{wsName}/export", method = RequestMethod.POST, produces = APPLICATION_ZIP_VALUE) @ResponseStatus(value = HttpStatus.OK) void export(@PathVariable String wsName, HttpServletResponse response); @RequestMapping(value = "/{wsName}/import", method = RequestMethod.POST, consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @ResponseStatus(value = HttpStatus.OK) void inport(@PathVariable String wsName, HttpServletRequest request, HttpServletResponse response); }
WorkspaceController extends ApiController { @RequestMapping(value = "/{wsName:.+}", method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void delete(@PathVariable String wsName, HttpServletResponse response) { Catalog cat = geoServer.getCatalog(); WorkspaceInfo ws = findWorkspace(wsName, cat); new CascadeDeleteVisitor(cat).visit(ws); recent.remove(WorkspaceInfo.class, ws); } @Autowired  WorkspaceController(GeoServer geoServer, RecentObjectCache recentCache); @RequestMapping(method = RequestMethod.GET) @ResponseBody JSONArr list(); @RequestMapping(value = "/recent", method = RequestMethod.GET) @ResponseBody JSONArr recent(); @RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.CREATED) @ResponseBody JSONObj create(@RequestBody JSONObj obj); @RequestMapping(value = "/{wsName:.+}", method = RequestMethod.GET) @ResponseBody JSONObj get(@PathVariable String wsName); @RequestMapping(value = "/{wsName:.+}", method = RequestMethod.PATCH) @ResponseBody JSONObj patch(@PathVariable String wsName, @RequestBody JSONObj obj); @RequestMapping(value = "/{wsName:.+}", method = RequestMethod.PUT) @ResponseBody JSONObj put(@PathVariable String wsName, @RequestBody JSONObj obj); @RequestMapping(value = "/{wsName:.+}", method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.NO_CONTENT) void delete(@PathVariable String wsName, HttpServletResponse response); @RequestMapping(value = "/{wsName}/export", method = RequestMethod.POST, produces = APPLICATION_ZIP_VALUE) @ResponseStatus(value = HttpStatus.OK) void export(@PathVariable String wsName, HttpServletResponse response); @RequestMapping(value = "/{wsName}/import", method = RequestMethod.POST, consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @ResponseStatus(value = HttpStatus.OK) void inport(@PathVariable String wsName, HttpServletRequest request, HttpServletResponse response); static final String APPLICATION_ZIP_VALUE; }