test_class.declarator: geoServer
test_class.modifier: @Mock
test_class.original_string: @Mock
      GeoServer geoServer;
test_class.type: GeoServer
test_class.var_name: geoServer
test_class.declarator: recent
test_class.modifier: @Mock
test_class.original_string: @Mock
      RecentObjectCache recent;
test_class.type: RecentObjectCache
test_class.var_name: recent
test_class.declarator: ctrl
test_class.modifier: @InjectMocks
test_class.original_string: @InjectMocks
      WorkspaceController ctrl;
test_class.type: WorkspaceController
test_class.var_name: ctrl
test_class.declarator: mvc
test_class.original_string: MockMvc mvc;
test_class.type: MockMvc
test_class.var_name: mvc
test_class.file: geoserver/webapp/api-composer/src/test/java/com/boundlessgeo/geoserver/api/controllers/WorkspaceControllerTest.java
test_class.identifier: WorkspaceControllerTest
test_case.body: @Test
      public void testGet() throws Exception {
          MockGeoServer.get().catalog()
              .workspace("foo", "http://scratch.org", true)
                  .layer("foo").workspace().catalog()
              .workspace("bar", "http://bar.org", false).catalog()
              .geoServer().build(geoServer);
  
          GeoServerResourceLoader resourceLoader = mock(GeoServerResourceLoader.class);
          when(resourceLoader.get("workspaces/foo/workspace.xml")).thenAnswer(mockResource());
          when(resourceLoader.get("workspaces/bar/workspace.xml")).thenAnswer(mockResource());
  
          Catalog catalog = geoServer.getCatalog();
          when(catalog.getResourceLoader()).thenReturn(resourceLoader);
  
          MvcResult result = mvc.perform(get("/app/api/workspaces/foo"))
              .andExpect(status().isOk())
              .andExpect(content().contentType(MediaType.APPLICATION_JSON))
              .andReturn();
  
          JSONObj obj = JSONWrapper.read(result.getResponse().getContentAsString()).toObject();
          assertEquals("foo", obj.str("name"));
          assertEquals("http://scratch.org", obj.str("uri"));
          assertTrue(obj.bool("default"));
  
          assertEquals(0, obj.integer("maps").intValue());
          assertEquals(1, obj.integer("layers").intValue());
          assertEquals(0, obj.integer("stores").intValue());
  
          result = mvc.perform(get("/app/api/workspaces/bar"))
                  .andExpect(status().isOk())
                  .andExpect(content().contentType(MediaType.APPLICATION_JSON))
                  .andReturn();
  
          obj = JSONWrapper.read(result.getResponse().getContentAsString()).toObject();
          assertEquals("bar", obj.str("name"));
          assertEquals("http://bar.org", obj.str("uri"));
          assertFalse(obj.bool("default"));
      }
test_case.class_method_signature: WorkspaceControllerTest.testGet()
test_case.full_signature: @Test public void testGet()
test_case.identifier: testGet
test_case.invocations: build geoServer catalog workspace catalog workspace layer workspace catalog get mock thenAnswer when get mockResource thenAnswer when get mockResource getCatalog thenReturn when getResourceLoader andReturn andExpect andExpect perform get isOk status contentType content toObject read getContentAsString getResponse assertEquals str assertEquals str assertTrue bool assertEquals intValue integer assertEquals intValue integer assertEquals intValue integer andReturn andExpect andExpect perform get isOk status contentType content toObject read getContentAsString getResponse assertEquals str assertEquals str assertFalse bool
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGet()
focal_class.declarator: APPLICATION_ZIP_VALUE = "application/zip"
focal_class.modifier: public static final
focal_class.original_string: public static final String APPLICATION_ZIP_VALUE = "application/zip";
focal_class.type: String
focal_class.var_name: APPLICATION_ZIP_VALUE
focal_class.file: geoserver/webapp/api-composer/src/main/java/com/boundlessgeo/geoserver/api/controllers/WorkspaceController.java
focal_class.identifier: WorkspaceController
focal_class.class_method_signature: WorkspaceController.WorkspaceController(GeoServer geoServer, RecentObjectCache recentCache)
focal_class.full_signature: @Autowired public  WorkspaceController(GeoServer geoServer, RecentObjectCache recentCache)
focal_class.identifier: WorkspaceController
focal_class.modifiers: @Autowired public
focal_class.parameters: (GeoServer geoServer, RecentObjectCache recentCache)
focal_class.signature:  WorkspaceController(GeoServer geoServer, RecentObjectCache recentCache)
focal_class.class_method_signature: WorkspaceController.list()
focal_class.full_signature: @RequestMapping(method = RequestMethod.GET) public @ResponseBody JSONArr list()
focal_class.identifier: list
focal_class.modifiers: @RequestMapping(method = RequestMethod.GET) public @ResponseBody
focal_class.parameters: ()
focal_class.return: JSONArr
focal_class.signature: JSONArr list()
focal_class.class_method_signature: WorkspaceController.recent()
focal_class.full_signature: @RequestMapping(value = "/recent", method = RequestMethod.GET) public @ResponseBody JSONArr recent()
focal_class.identifier: recent
focal_class.modifiers: @RequestMapping(value = "/recent", method = RequestMethod.GET) public @ResponseBody
focal_class.parameters: ()
focal_class.return: JSONArr
focal_class.signature: JSONArr recent()
focal_class.class_method_signature: WorkspaceController.create(@RequestBody JSONObj obj)
focal_class.full_signature: @RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.CREATED) public @ResponseBody JSONObj create(@RequestBody JSONObj obj)
focal_class.identifier: create
focal_class.modifiers: @RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.CREATED) public @ResponseBody
focal_class.parameters: (@RequestBody JSONObj obj)
focal_class.return: JSONObj
focal_class.signature: JSONObj create(@RequestBody JSONObj obj)
focal_class.class_method_signature: WorkspaceController.get(@PathVariable String wsName)
focal_class.full_signature: @RequestMapping(value = "/{wsName:.+}", method = RequestMethod.GET) public @ResponseBody JSONObj get(@PathVariable String wsName)
focal_class.identifier: get
focal_class.modifiers: @RequestMapping(value = "/{wsName:.+}", method = RequestMethod.GET) public @ResponseBody
focal_class.parameters: (@PathVariable String wsName)
focal_class.return: JSONObj
focal_class.signature: JSONObj get(@PathVariable String wsName)
focal_class.class_method_signature: WorkspaceController.workspace(JSONObj obj, WorkspaceInfo ws, NamespaceInfo ns, boolean isDefault)
focal_class.full_signature:  JSONObj workspace(JSONObj obj, WorkspaceInfo ws, NamespaceInfo ns, boolean isDefault)
focal_class.identifier: workspace
focal_class.parameters: (JSONObj obj, WorkspaceInfo ws, NamespaceInfo ns, boolean isDefault)
focal_class.return: JSONObj
focal_class.signature: JSONObj workspace(JSONObj obj, WorkspaceInfo ws, NamespaceInfo ns, boolean isDefault)
focal_class.class_method_signature: WorkspaceController.countMaps(WorkspaceInfo ws, Catalog cat)
focal_class.full_signature:  Integer countMaps(WorkspaceInfo ws, Catalog cat)
focal_class.identifier: countMaps
focal_class.parameters: (WorkspaceInfo ws, Catalog cat)
focal_class.return: Integer
focal_class.signature: Integer countMaps(WorkspaceInfo ws, Catalog cat)
focal_class.class_method_signature: WorkspaceController.countLayers(WorkspaceInfo ws, Catalog cat)
focal_class.full_signature:  Integer countLayers(WorkspaceInfo ws, Catalog cat)
focal_class.identifier: countLayers
focal_class.parameters: (WorkspaceInfo ws, Catalog cat)
focal_class.return: Integer
focal_class.signature: Integer countLayers(WorkspaceInfo ws, Catalog cat)
focal_class.class_method_signature: WorkspaceController.countStores(WorkspaceInfo ws, Catalog cat)
focal_class.full_signature:  Integer countStores(WorkspaceInfo ws, Catalog cat)
focal_class.identifier: countStores
focal_class.parameters: (WorkspaceInfo ws, Catalog cat)
focal_class.return: Integer
focal_class.signature: Integer countStores(WorkspaceInfo ws, Catalog cat)
focal_class.class_method_signature: WorkspaceController.patch(@PathVariable String wsName, @RequestBody JSONObj obj)
focal_class.full_signature: @RequestMapping(value = "/{wsName:.+}", method = RequestMethod.PATCH) public @ResponseBody JSONObj patch(@PathVariable String wsName, @RequestBody JSONObj obj)
focal_class.identifier: patch
focal_class.modifiers: @RequestMapping(value = "/{wsName:.+}", method = RequestMethod.PATCH) public @ResponseBody
focal_class.parameters: (@PathVariable String wsName, @RequestBody JSONObj obj)
focal_class.return: JSONObj
focal_class.signature: JSONObj patch(@PathVariable String wsName, @RequestBody JSONObj obj)
focal_class.class_method_signature: WorkspaceController.put(@PathVariable String wsName, @RequestBody JSONObj obj)
focal_class.full_signature: @RequestMapping(value = "/{wsName:.+}", method = RequestMethod.PUT) public @ResponseBody JSONObj put(@PathVariable String wsName, @RequestBody JSONObj obj)
focal_class.identifier: put
focal_class.modifiers: @RequestMapping(value = "/{wsName:.+}", method = RequestMethod.PUT) public @ResponseBody
focal_class.parameters: (@PathVariable String wsName, @RequestBody JSONObj obj)
focal_class.return: JSONObj
focal_class.signature: JSONObj put(@PathVariable String wsName, @RequestBody JSONObj obj)
focal_class.class_method_signature: WorkspaceController.delete(@PathVariable String wsName, HttpServletResponse response)
focal_class.full_signature: @RequestMapping(value = "/{wsName:.+}", method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void delete(@PathVariable String wsName, HttpServletResponse response)
focal_class.identifier: delete
focal_class.modifiers: @RequestMapping(value = "/{wsName:.+}", method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.NO_CONTENT) public
focal_class.parameters: (@PathVariable String wsName, HttpServletResponse response)
focal_class.return: void
focal_class.signature: void delete(@PathVariable String wsName, HttpServletResponse response)
focal_class.class_method_signature: WorkspaceController.export(@PathVariable String wsName, HttpServletResponse response)
focal_class.full_signature: @RequestMapping(value = "/{wsName}/export", method = RequestMethod.POST, produces = APPLICATION_ZIP_VALUE) @ResponseStatus(value = HttpStatus.OK) public void export(@PathVariable String wsName, HttpServletResponse response)
focal_class.identifier: export
focal_class.modifiers: @RequestMapping(value = "/{wsName}/export", method = RequestMethod.POST, produces = APPLICATION_ZIP_VALUE) @ResponseStatus(value = HttpStatus.OK) public
focal_class.parameters: (@PathVariable String wsName, HttpServletResponse response)
focal_class.return: void
focal_class.signature: void export(@PathVariable String wsName, HttpServletResponse response)
focal_class.class_method_signature: WorkspaceController.inport(@PathVariable String wsName, HttpServletRequest request, HttpServletResponse response)
focal_class.full_signature: @RequestMapping(value = "/{wsName}/import", method = RequestMethod.POST, consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @ResponseStatus(value = HttpStatus.OK) public void inport(@PathVariable String wsName, HttpServletRequest request, HttpServletResponse response)
focal_class.identifier: inport
focal_class.modifiers: @RequestMapping(value = "/{wsName}/import", method = RequestMethod.POST, consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @ResponseStatus(value = HttpStatus.OK) public
focal_class.parameters: (@PathVariable String wsName, HttpServletRequest request, HttpServletResponse response)
focal_class.return: void
focal_class.signature: void inport(@PathVariable String wsName, HttpServletRequest request, HttpServletResponse response)
focal_class.superclass: extends ApiController
focal_method.body: @RequestMapping(value = "/{wsName:.+}", method = RequestMethod.GET)
      public @ResponseBody JSONObj get(@PathVariable String wsName) {
          Catalog cat = geoServer.getCatalog();
  
          WorkspaceInfo ws = findWorkspace(wsName, cat);
          WorkspaceInfo def = cat.getDefaultWorkspace();
  
          JSONObj obj = IO.workspace(new JSONObj(), ws, namespaceFor(ws), def != null && def.equals(ws));
  
          obj.put("maps", countMaps(ws, cat));
          obj.put("layers", countLayers(ws, cat));
          obj.put("stores", countStores(ws, cat));
  
          return obj;
      }
focal_method.class_method_signature: WorkspaceController.get(@PathVariable String wsName)
focal_method.full_signature: @RequestMapping(value = "/{wsName:.+}", method = RequestMethod.GET) public @ResponseBody JSONObj get(@PathVariable String wsName)
focal_method.identifier: get
focal_method.invocations: getCatalog findWorkspace getDefaultWorkspace workspace namespaceFor equals put countMaps put countLayers put countStores
focal_method.modifiers: @RequestMapping(value = "/{wsName:.+}", method = RequestMethod.GET) public @ResponseBody
focal_method.parameters: (@PathVariable String wsName)
focal_method.return: JSONObj
focal_method.signature: JSONObj get(@PathVariable String wsName)