当前位置: 首页>>代码示例>>Java>>正文


Java UriUtils.buildExpandLinksQueryUri方法代码示例

本文整理汇总了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());
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:25,代码来源:ProvisioningUtils.java

示例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);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:20,代码来源:TestAWSSetupUtils.java

示例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);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:21,代码来源:TestAWSSetupUtils.java

示例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);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:20,代码来源:TestAWSSetupUtils.java

示例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;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:28,代码来源:TestAzureLongRunningEnumeration.java

示例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;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:12,代码来源:ProvisioningUtils.java

示例7: buildUri

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
public static URI buildUri(URI loadBalancerStateUri) {
    return UriUtils.buildExpandLinksQueryUri(loadBalancerStateUri);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:4,代码来源:LoadBalancerService.java

示例8: buildUri

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
public static URI buildUri(URI diskStateUri) {
    return UriUtils.buildExpandLinksQueryUri(diskStateUri);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:4,代码来源:DiskService.java

示例9: buildUri

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
public static URI buildUri(URI sdUri) {
    return UriUtils.buildExpandLinksQueryUri(sdUri);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:4,代码来源:StorageDescriptionService.java


注:本文中的com.vmware.xenon.common.UriUtils.buildExpandLinksQueryUri方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。