本文整理汇总了Java中com.vmware.xenon.common.UriUtils.buildExpandLinksQueryUri方法的典型用法代码示例。如果您正苦于以下问题:Java UriUtils.buildExpandLinksQueryUri方法的具体用法?Java UriUtils.buildExpandLinksQueryUri怎么用?Java UriUtils.buildExpandLinksQueryUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vmware.xenon.common.UriUtils
的用法示例。
在下文中一共展示了UriUtils.buildExpandLinksQueryUri方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: queryDocumentsAndAssertExpectedCount
import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
public static ServiceDocumentQueryResult queryDocumentsAndAssertExpectedCount(
VerificationHost host, URI peerURI,
int desiredCount, String factoryLink, boolean exactCountFlag) throws Throwable {
URI queryUri = UriUtils.buildExpandLinksQueryUri(
createServiceURI(host, peerURI, factoryLink));
// add limit, otherwise the query will not return if there are too many docs or versions
queryUri = UriUtils.extendUriWithQuery(queryUri,
UriUtils.URI_PARAM_ODATA_LIMIT, String.valueOf(desiredCount * 2));
ServiceDocumentQueryResult res = host.getFactoryState(queryUri);
if (exactCountFlag) {
if (res.documents.size() == desiredCount) {
return res;
}
} else {
if (res.documents.size() >= desiredCount) {
host.log(Level.INFO, "Documents count in %s is %s, expected at least %s",
factoryLink, res.documents.size(), desiredCount);
return res;
}
}
throw new Exception("Desired number of documents not found in " + factoryLink
+ " factory states. Expected " + desiredCount + ", found " + res.documents.size());
}
示例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: getVMComputeStatesWithPrefix
import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
/**
* Filters and returns all compute states with a VM name starting with a particular prefix.
* @param vmPrefix A VM name prefix for distinguishing relevant compute states.
* @return A map of ComputeStates with a prefix, with each VM name as the key.
*/
private Map<String, ComputeState> getVMComputeStatesWithPrefix(String vmPrefix) {
URI queryUri = UriUtils.buildExpandLinksQueryUri(createServiceURI(host,
host.getUri(), ComputeService.FACTORY_LINK));
// add limit, otherwise the query will not return if there are too many docs or versions
queryUri = UriUtils.extendUriWithQuery(queryUri, UriUtils.URI_PARAM_ODATA_LIMIT,
String.valueOf(numOfVMsToTest * 2));
ServiceDocumentQueryResult res = host.getFactoryState(queryUri);
// Add compute states with the prefix to map.
Map<String, ComputeService.ComputeState> filteredComputeStates = new HashMap<>();
for (String key : res.documents.keySet()) {
String json = Utils.toJson(res.documents.get(key));
ComputeService.ComputeState doc = Utils.fromJson(json,
ComputeService.ComputeState.class);
if (doc.name.startsWith(vmPrefix)) {
filteredComputeStates.put(doc.name, doc);
}
}
return filteredComputeStates;
}
示例6: queryAllFactoryResources
import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
/**
* Query all resources for a factory
*/
public static ServiceDocumentQueryResult queryAllFactoryResources(VerificationHost host, String factoryLink)
throws Throwable {
URI queryUri = UriUtils.buildExpandLinksQueryUri(
createServiceURI(host, host.getUri(), factoryLink));
ServiceDocumentQueryResult res = host.getFactoryState(queryUri);
return res;
}
示例7: buildUri
import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
public static URI buildUri(URI loadBalancerStateUri) {
return UriUtils.buildExpandLinksQueryUri(loadBalancerStateUri);
}
示例8: buildUri
import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
public static URI buildUri(URI diskStateUri) {
return UriUtils.buildExpandLinksQueryUri(diskStateUri);
}
示例9: buildUri
import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
public static URI buildUri(URI sdUri) {
return UriUtils.buildExpandLinksQueryUri(sdUri);
}