use of com.sun.jersey.core.util.MultivaluedMapImpl in project incubator-atlas by apache.
the class TypesJerseyResourceIT method testGetTraitNames.
@Test
public void testGetTraitNames() throws Exception {
String[] traitsAdded = addTraits();
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
queryParams.add("type", DataTypes.TypeCategory.TRAIT.name());
JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.LIST_TYPES, queryParams);
Assert.assertNotNull(response);
Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
final JSONArray list = response.getJSONArray(AtlasClient.RESULTS);
Assert.assertNotNull(list);
Assert.assertTrue(list.length() >= traitsAdded.length);
}
use of com.sun.jersey.core.util.MultivaluedMapImpl in project coprhd-controller by CoprHD.
the class DataDomainClient method getMTreeCapacityInfo.
public DDMtreeCapacityInfos getMTreeCapacityInfo(String ddSystem, String mtreeId, int page, int pgSize, DDStatsDataViewQuery dataView, DDStatsIntervalQuery interval, boolean requestedIntervalOnly, String sort) throws DataDomainApiException {
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
if (page >= 0) {
queryParams.add(DataDomainApiConstants.PAGE, String.valueOf(page));
}
if (pgSize > 0) {
queryParams.add(DataDomainApiConstants.PAGE_SIZE, String.valueOf(pgSize));
}
if (DDStatsDataViewQuery.isMember(dataView)) {
queryParams.add(DataDomainApiConstants.DATA_VIEW, dataView.toString());
}
// }
if (dataView.equals(DDStatsDataViewQuery.delta)) {
queryParams.add(DataDomainApiConstants.REQUESTED_INTERVAL_ONLY, String.valueOf(requestedIntervalOnly));
}
if ((sort != null) && (sort.endsWith(DataDomainApiConstants.COLLECTION_EPOCH))) {
queryParams.add(DataDomainApiConstants.SORT, sort);
}
ClientResponse response = get(DataDomainApiConstants.uriDataDomainMtreeStatsCapacity(ddSystem, mtreeId), (MultivaluedMap<String, String>) queryParams);
return getResponseObject(DDMtreeCapacityInfos.class, response);
}
use of com.sun.jersey.core.util.MultivaluedMapImpl in project coprhd-controller by CoprHD.
the class DataDomainClient method getMTreeList.
public DDMTreeList getMTreeList(String system) throws DataDomainApiException {
// As per DD team, the maximum mtrees that DDOS supports is 100. Hence we need
// to request for page with size 100 so we get all MTrees.
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
queryParams.add("size", String.valueOf(DataDomainApiConstants.DD_MAX_MTREE_LIMIT));
ClientResponse response = get(DataDomainApiConstants.uriDataDomainMtrees(system), (MultivaluedMap<String, String>) queryParams);
return getResponseObject(DDMTreeList.class, response);
}
use of com.sun.jersey.core.util.MultivaluedMapImpl in project coprhd-controller by CoprHD.
the class IsilonApi method createDir.
/**
* Create a directory with the path specified
*
* @param fspath
* Dir path to be created
* @param recursive
* if true, will create parent recursively if it doesn't
* exist
* @throws IsilonException
*/
public void createDir(String fspath, boolean recursive) throws IsilonException {
fspath = scrubPath(fspath);
ClientResponse resp = null;
try {
// check if already exists
if (existsDir(fspath)) {
return;
}
fspath = URLEncoder.encode(fspath, "UTF-8");
MultivaluedMap<String, String> queryParams = null;
if (recursive) {
queryParams = new MultivaluedMapImpl();
queryParams.add("recursive", "1");
}
sLogger.debug("IsilonApi createDir {} - start", fspath);
resp = _client.put(_baseUrl.resolve(URI_IFS.resolve(fspath)), queryParams, "");
sLogger.debug("IsilonApi createDir {} - complete", fspath);
if (resp.getStatus() != 200) {
processErrorResponse("create directory", fspath, resp.getStatus(), resp.getEntity(JSONObject.class));
}
} catch (IsilonException ie) {
throw ie;
} catch (Exception e) {
if (e.getCause() instanceof ConnectException) {
throw IsilonException.exceptions.unableToConnect(_baseUrl, e);
}
final Status status = resp != null ? resp.getClientResponseStatus() : Status.NOT_FOUND;
throw IsilonException.exceptions.createDirFailed(fspath, status, e);
} finally {
if (resp != null) {
resp.close();
}
}
}
use of com.sun.jersey.core.util.MultivaluedMapImpl in project coprhd-controller by CoprHD.
the class FileSystemListRequest method getByStorageResource.
/**
* Get file system using its storageResourceId
*
* @param storageResourceId
* @return
*/
public VNXeFileSystem getByStorageResource(String storageResourceId) {
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
queryParams.add(VNXeConstants.FILTER, VNXeConstants.STORAGE_RESOURCE_FILTER + "\"" + storageResourceId + "\"");
setQueryParameters(queryParams);
VNXeFileSystem result = null;
List<VNXeFileSystem> fsList = getDataForObjects(VNXeFileSystem.class);
// it should just return 1
if (fsList != null && !fsList.isEmpty()) {
result = fsList.get(0);
} else {
_logger.info("No file system found using the storage resource id: " + storageResourceId);
}
return result;
}
Aggregations