// @Test public void deleteFileSystem() { DeleteStorageResourceRequest req = new DeleteStorageResourceRequest(_client); VNXeCommandResult response = null; response = req.deleteFileSystemSync("fs_25", true); System.out.println(response.getSuccess()); }
public VNXeCommandResult postRequestSync(ParamBase param) { ClientResponse response = postRequest(param); if (response.getClientResponseStatus() == ClientResponse.Status.NO_CONTENT) { VNXeCommandResult result = new VNXeCommandResult(); result.setSuccess(true); return result; } String resString = response.getEntity(String.class); _logger.debug("KH API returned: {} ", resString); JSONObject res; String objectString = null; VNXeCommandResult returnedObject = null; try { res = new JSONObject(resString); if (res != null) { JSONObject object = (JSONObject) res.get(VNXeConstants.CONTENT); if (object != null) { objectString = object.toString(); ObjectMapper mapper = new ObjectMapper(); try { returnedObject = mapper.readValue(objectString, VNXeCommandResult.class); returnedObject.setSuccess(true); } catch (JsonParseException e) { _logger.error(String.format("unexpected data returned: %s", objectString), e); throw VNXeException.exceptions.unexpectedDataError( String.format("unexpected data returned: %s", objectString), e); } catch (JsonMappingException e) { _logger.error(String.format("unexpected data returned: %s", objectString), e); throw VNXeException.exceptions.unexpectedDataError( String.format("unexpected data returned: %s", objectString), e); } catch (IOException e) { _logger.error(String.format("unexpected data returned: %s", objectString), e); throw VNXeException.exceptions.unexpectedDataError( String.format("unexpected data returned: %s", objectString), e); } } } } catch (JSONException e) { _logger.error(String.format("unexpected data returned: %s from: %s", resString, _url), e); throw VNXeException.exceptions.unexpectedDataError( String.format("unexpected data returned: %s", objectString), e); } return returnedObject; }