本文整理汇总了Java中com.vmware.xenon.common.UriUtils.appendQueryParam方法的典型用法代码示例。如果您正苦于以下问题:Java UriUtils.appendQueryParam方法的具体用法?Java UriUtils.appendQueryParam怎么用?Java UriUtils.appendQueryParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vmware.xenon.common.UriUtils
的用法示例。
在下文中一共展示了UriUtils.appendQueryParam方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSupportedInstanceStoreDiskSize
import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
public static Integer getSupportedInstanceStoreDiskSize(VerificationHost host,
String instanceType,
String endpointLink) {
URI instanceTypeServiceURI = UriUtils
.buildUri(host, AWSInstanceTypeService.SELF_LINK);
instanceTypeServiceURI = UriUtils.appendQueryParam(instanceTypeServiceURI,
URI_PARAM_ENDPOINT, endpointLink);
instanceTypeServiceURI = UriUtils.appendQueryParam(instanceTypeServiceURI,
URI_PARAM_INSTANCE_TYPE, instanceType);
Operation op = Operation.createGet(instanceTypeServiceURI).setReferer(host.getUri());
Operation response = host.waitForResponse(op);
InstanceTypeList.InstanceType type = response.getBody(InstanceTypeList.InstanceType.class);
Assert.assertNotNull(type);
Assert.assertNotNull(type.dataDiskSizeInMB);
return type.dataDiskSizeInMB;
}
示例2: getComputeByAWSId
import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
/**
* Lookup a Compute by aws Id
*/
public static ComputeState getComputeByAWSId(VerificationHost host, String awsId)
throws Throwable {
URI computesURI = UriUtils.buildUri(host, ComputeService.FACTORY_LINK);
computesURI = UriUtils.buildExpandLinksQueryUri(computesURI);
computesURI = UriUtils.appendQueryParam(computesURI, "$filter",
String.format("id eq %s", awsId));
Operation op = host.waitForResponse(Operation.createGet(computesURI));
ServiceDocumentQueryResult result = op.getBody(ServiceDocumentQueryResult.class);
assertNotNull(result);
assertNotNull(result.documents);
assertEquals(1, result.documents.size());
return Utils.fromJson(result.documents.values().iterator().next(), ComputeState.class);
}
示例3: getNICByAWSId
import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
/**
* Lookup a NIC State by aws Id
*/
public static NetworkInterfaceState getNICByAWSId(VerificationHost host, String awsId)
throws Throwable {
URI networkInterfacesURI = UriUtils.buildUri(host, NetworkInterfaceService.FACTORY_LINK);
networkInterfacesURI = UriUtils.buildExpandLinksQueryUri(networkInterfacesURI);
networkInterfacesURI = UriUtils.appendQueryParam(networkInterfacesURI, "$filter",
String.format("id eq %s", awsId));
Operation op = host.waitForResponse(Operation.createGet(networkInterfacesURI));
ServiceDocumentQueryResult result = op.getBody(ServiceDocumentQueryResult.class);
assertNotNull(result);
assertNotNull(result.documents);
if (result.documents.size() == 0) {
return null;
}
return Utils.fromJson(result.documents.values().iterator().next(), NetworkInterfaceState.class);
}
示例4: getLoadBalancerByAWSId
import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
/**
* Lookup a Load Balancer by aws Id
*/
public static LoadBalancerState getLoadBalancerByAWSId(VerificationHost host, String awsId)
throws Throwable {
URI lbURI = UriUtils.buildUri(host, LoadBalancerService.FACTORY_LINK);
lbURI = UriUtils.buildExpandLinksQueryUri(lbURI);
lbURI = UriUtils.appendQueryParam(lbURI, "$filter",
String.format("id eq %s", awsId));
Operation op = host.waitForResponse(Operation.createGet(lbURI));
ServiceDocumentQueryResult result = op.getBody(ServiceDocumentQueryResult.class);
assertNotNull(result);
assertNotNull(result.documents);
assertEquals(1, result.documents.size());
return Utils.fromJson(result.documents.values().iterator().next(), LoadBalancerState.class);
}
示例5: testGetSnapshotStateByCompute
import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
@Test
public void testGetSnapshotStateByCompute() throws Throwable {
ComputeService.ComputeState computeState = createComputeService();
SnapshotService.SnapshotState startState = createSnapshotService(computeState.documentSelfLink);
URI uri = UriUtils.appendQueryParam(
UriUtils.buildUri(VSphereListComputeSnapshotService.SELF_LINK),
VSphereListComputeSnapshotService.QUERY_PARAM_COMPUTE, computeState.documentSelfLink);
Operation operation = sendOperationSynchronously(Operation.createGet(getHost(), uri.toString())
.setReferer(this.host.getReferer()));
Assert.assertNotNull(operation);
String json = Utils.toJson(operation.getBodyRaw());
List<SnapshotService.SnapshotState> list = Utils.fromJson(json,
new TypeToken<List<SnapshotService.SnapshotState>>() {}.getType());
Assert.assertNotNull(list);
assertEquals(list.get(0).name, startState.name);
}
示例6: testGetInstanceTypes_invalidEndpoint
import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testGetInstanceTypes_invalidEndpoint() throws Throwable {
EndpointState endpointNoRegion;
{
endpointNoRegion = new EndpointState();
// Copy from original end-point
endpointNoRegion.id = this.endpointState.id;
endpointNoRegion.name = this.endpointState.name;
endpointNoRegion.endpointType = this.endpointState.endpointType;
endpointNoRegion.authCredentialsLink = this.endpointState.authCredentialsLink;
endpointNoRegion.tenantLinks = this.endpointState.tenantLinks;
// Do NOT set REGION
endpointNoRegion.endpointProperties = Collections.emptyMap();
endpointNoRegion = TestUtils.doPost(getHost(), endpointNoRegion, EndpointState.class,
UriUtils.buildUri(getHost(), EndpointService.FACTORY_LINK));
}
URI uri = UriUtils.appendQueryParam(
UriUtils.buildUri(AzureInstanceTypeService.SELF_LINK),
"endpoint", endpointNoRegion.documentSelfLink);
getServiceSynchronously(uri.toString(), ServiceDocument.class);
}