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


Java UriUtils.buildUriPath方法代码示例

本文整理汇总了Java中com.vmware.xenon.common.UriUtils.buildUriPath方法的典型用法代码示例。如果您正苦于以下问题:Java UriUtils.buildUriPath方法的具体用法?Java UriUtils.buildUriPath怎么用?Java UriUtils.buildUriPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.vmware.xenon.common.UriUtils的用法示例。


在下文中一共展示了UriUtils.buildUriPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testFailOnMissingEndpointToDelete

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
@Test
public void testFailOnMissingEndpointToDelete() throws Throwable {
    EndpointState endpoint = createEndpointState();

    endpoint.documentSelfLink = UriUtils.buildUriPath(EndpointService.FACTORY_LINK,
            "fake-endpoint");

    EndpointRemovalTaskState removalTaskState = createEndpointRemovalTaskState(endpoint);

    EndpointRemovalTaskState returnState = this
            .postServiceSynchronously(
                    EndpointRemovalTaskService.FACTORY_LINK,
                    removalTaskState, EndpointRemovalTaskState.class);

    EndpointRemovalTaskState completeState = this
            .waitForServiceState(
                    EndpointRemovalTaskState.class,
                    returnState.documentSelfLink,
                    state -> TaskState.TaskStage.FAILED.ordinal() <= state.taskInfo.stage
                            .ordinal());

    assertThat(completeState.taskInfo.stage,
            is(TaskState.TaskStage.FAILED));

}
 
开发者ID:vmware,项目名称:photon-model,代码行数:26,代码来源:EndpointRemovalTaskServiceTest.java

示例2: getDocumentTemplate

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
@Override
public ServiceDocument getDocumentTemplate() {
    ServiceDocument td = super.getDocumentTemplate();
    // enable metadata indexing
    td.documentDescription.documentIndexingOptions =
            EnumSet.of(DocumentIndexingOption.INDEX_METADATA);
    ServiceUtils.setRetentionLimit(td);
    NetworkInterfaceDescription template = (NetworkInterfaceDescription) td;

    template.id = UUID.randomUUID().toString();
    template.name = "my-nic";
    template.subnetLink = UriUtils.buildUriPath(SubnetService.FACTORY_LINK,
            "sub-network");
    template.assignment = IpAssignment.STATIC;
    template.address = "10.1.0.12";
    template.securityGroupLinks = Collections
            .singletonList(UriUtils.buildUriPath(SecurityGroupService.FACTORY_LINK,
                    "security-group-one"));
    template.deviceIndex = 0;
    template.assignPublicIpAddress = Boolean.TRUE;

    return template;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:24,代码来源:NetworkInterfaceDescriptionService.java

示例3: getStatsQueryTaskOperation

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
/**
 * Create a query task for each compute VM and return the operation.
 */
private Operation getStatsQueryTaskOperation(AzureStatsDataHolder statsData, String computeLink) {
    String computeId = UriUtils.getLastPathSegment(computeLink);
    String selfLink = UriUtils.buildUriPath(ResourceMetricsService.FACTORY_LINK, computeId);

    // TODO VSYM-3695: Limit the time boundaries on Azure metrics retrieval for each compute
    Query query = Query.Builder.create()
            .addKindFieldClause(ResourceMetrics.class)
            .addFieldClause(ServiceDocument.FIELD_NAME_SELF_LINK, selfLink, MatchType.PREFIX)
            .build();

    QueryTask queryTask = QueryTask.Builder.createDirectTask()
            .setQuery(query)
            .addOption(QueryOption.EXPAND_CONTENT)
            .addOption(QueryOption.TOP_RESULTS)
            .setResultLimit(QueryUtils.DEFAULT_MAX_RESULT_LIMIT)
            .build();
    queryTask.tenantLinks = statsData.computeHost.tenantLinks;

    return QueryUtils.createQueryTaskOperation(this, queryTask, ServiceTypeCluster.METRIC_SERVICE);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:24,代码来源:AzureComputeHostStatsGatherer.java

示例4: createPrimaryRootCompute

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
public ComputeStateWithDescription createPrimaryRootCompute() {
    ComputeStateWithDescription primaryRootCompute = new ComputeStateWithDescription();
    primaryRootCompute.id = "456";
    primaryRootCompute.name = "MOCK_ACC";
    primaryRootCompute.type = ComputeType.VM_HOST;
    primaryRootCompute.documentSelfLink = "selfLink";
    primaryRootCompute.description = new ComputeDescription();
    Set<URI> statsAdapterReferences = new HashSet<>();
    statsAdapterReferences.add(UriUtils
            .buildUri("stats-adapter-references"));
    primaryRootCompute.description.statsAdapterReferences = statsAdapterReferences;
    primaryRootCompute.creationTimeMicros = 1492610429910002L;
    primaryRootCompute.endpointLink = UriUtils
            .buildUriPath(ComputeDescriptionService.FACTORY_LINK,
                    generateUuidFromStr("endpointLink"));
    primaryRootCompute.adapterManagementReference = UriUtils.buildUri("amazonaws.com");
    primaryRootCompute.customProperties = new HashMap<>();
    primaryRootCompute.customProperties.put(EndpointAllocationTaskService
            .CUSTOM_PROP_ENPOINT_TYPE, EndpointType.aws.name());
    primaryRootCompute.resourcePoolLink = "resourcePoolLink";
    return primaryRootCompute;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:23,代码来源:TestAWSMissingEnumerationResourcesService.java

示例5: getDocumentTemplate

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
@Override
public ServiceDocument getDocumentTemplate() {
    ServiceDocument td = super.getDocumentTemplate();
    // enable metadata indexing
    td.documentDescription.documentIndexingOptions =
            EnumSet.of(DocumentIndexingOption.INDEX_METADATA);
    ServiceUtils.setRetentionLimit(td);
    SubnetState template = (SubnetState) td;

    template.id = UUID.randomUUID().toString();
    template.subnetCIDR = "10.1.0.0/16";
    template.name = "sub-network";
    template.networkLink = UriUtils.buildUriPath(NetworkService.FACTORY_LINK,
            "on-prem-network");
    template.dnsServerAddresses = new ArrayList<>();
    template.dnsServerAddresses.add("10.12.14.12");
    template.gatewayAddress = "10.1.0.1";
    template.supportPublicIpAddress = Boolean.TRUE;
    template.defaultForZone = Boolean.TRUE;

    return template;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:23,代码来源:SubnetService.java

示例6: executeTagsGroomerTask

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
/**
 * Run groomer task and wait for completion
 */
private void executeTagsGroomerTask() {
    TagDeletionRequest state = new TagDeletionRequest();
    state.documentSelfLink = UriUtils.buildUriPath(TagGroomerTaskService.FACTORY_LINK,
            UUID.randomUUID().toString());

    Operation postOp = Operation.createPost(UriUtils.buildUri(this.host,
            TagGroomerTaskService.FACTORY_LINK))
            .setBody(state);
    this.host.waitForResponse(postOp);
    this.host.waitForFinishedTask(TagDeletionRequest.class, state.documentSelfLink);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:15,代码来源:TagGroomerTaskServiceTest.java

示例7: testShouldCreateNewEndpointWithPredefinedSelfLink

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
@Test
public void testShouldCreateNewEndpointWithPredefinedSelfLink() throws Throwable {
    EndpointState endpoint = createEndpointState();
    endpoint.documentSelfLink = UriUtils.buildUriPath(EndpointService.FACTORY_LINK,
            "test-endpoint");

    // Check endpoint doesn't exists
    this.host.sendAndWaitExpectFailure(
            Operation.createGet(UriUtils.buildUri(this.host, endpoint.documentSelfLink)));

    EndpointAllocationTaskState startState = createEndpointAllocationRequest(endpoint);
    startState.adapterReference = UriUtils.buildUri(getHost(),
            MockSuccessEndpointAdapter.SELF_LINK);

    EndpointAllocationTaskState returnState = this
            .postServiceSynchronously(
                    EndpointAllocationTaskService.FACTORY_LINK,
                    startState, EndpointAllocationTaskState.class);

    EndpointAllocationTaskState completeState = this
            .waitForServiceState(
                    EndpointAllocationTaskState.class,
                    returnState.documentSelfLink,
                    state -> TaskState.TaskStage.FINISHED.ordinal() <= state.taskInfo.stage
                            .ordinal());

    assertThat(completeState.taskInfo.stage,
            is(TaskState.TaskStage.FINISHED));

    assertEquals(endpoint.documentSelfLink, completeState.endpointState.documentSelfLink);

    // Check endpoint was created
    this.host.sendAndWaitExpectSuccess(
            Operation.createGet(UriUtils.buildUri(this.host, endpoint.documentSelfLink)));
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:36,代码来源:EndpointAllocationTaskServiceTest.java

示例8: testResourceGroomerTaskNoTenantSpecified

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
/**
 * POST to groomer task service without a tenantLink and expect illegalArgumentException.
 */
@Test
public void testResourceGroomerTaskNoTenantSpecified() throws Throwable {
    EndpointResourceDeletionRequest state = new EndpointResourceDeletionRequest();
    state.documentSelfLink = UriUtils.buildUriPath(ResourceGroomerTaskService.FACTORY_LINK,
            UUID.randomUUID().toString());

    Operation postOp = Operation.createPost(UriUtils.buildUri(this.host, ResourceGroomerTaskService.FACTORY_LINK))
            .setBody(state)
            .setReferer(this.host.getUri());

    Operation postResponse = this.host.waitForResponse(postOp);

    assertEquals(400, postResponse.getStatusCode());
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:18,代码来源:ResourceGroomerTaskServiceTest.java

示例9: executeResourceGroomerTask

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
/**
 * Executes the groomer task on TENANT_LINK_1 and waits for it to finish. Returns the selfLink
 * of the task after it finishes.
 */
public String executeResourceGroomerTask() {
    EndpointResourceDeletionRequest state = new EndpointResourceDeletionRequest();
    state.tenantLinks = Collections.singleton(TENANT_LINK_1);
    state.documentSelfLink = UriUtils.buildUriPath(ResourceGroomerTaskService.FACTORY_LINK,
            UUID.randomUUID().toString());

    Operation postOp = Operation.createPost(UriUtils.buildUri(this.host, ResourceGroomerTaskService.FACTORY_LINK))
            .setBody(state)
            .setReferer(this.host.getUri());
    this.host.waitForResponse(postOp);
    this.host.waitForFinishedTask(EndpointResourceDeletionRequest.class, state.documentSelfLink);

    return state.documentSelfLink;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:19,代码来源:ResourceGroomerTaskServiceTest.java

示例10: createNetworkDescription

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
private static List<String> createNetworkDescription(BaseModelTest test)
        throws Throwable {
    NetworkInterfaceDescription nid = new NetworkInterfaceDescription();
    nid.id = UUID.randomUUID().toString();
    nid.networkLink = UriUtils.buildUriPath(NetworkService.FACTORY_LINK, "my-net");
    NetworkInterfaceDescription n1 = test.postServiceSynchronously(
            NetworkInterfaceDescriptionService.FACTORY_LINK, nid,
            NetworkInterfaceDescription.class);
    List<String> links = new ArrayList<>();
    links.add(n1.documentSelfLink);

    return links;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:14,代码来源:ResourceAllocationTaskServiceTest.java

示例11: buildDefaultAdapterLink

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
public static String buildDefaultAdapterLink(String endpointType,
        ResourceType resourceType,
        String operation) {
    AssertUtil.assertNotEmpty(endpointType, "'endpointType' must be set.");
    AssertUtil.assertNotNull(resourceType, "'resourceType' must be set.");
    AssertUtil.assertNotEmpty(operation, "'operation' must be set.");
    return UriUtils.buildUriPath(
            UriPaths.PROVISIONING,
            endpointType,
            ADAPTER_PATH_STEP_OPERATION,
            resourceType.toString().toLowerCase(),
            operation.toLowerCase() + "-adapter");
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:14,代码来源:ResourceOperationSpecService.java

示例12: createSubnetStateForNetwork

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
private SubnetState createSubnetStateForNetwork(NetworkState networkState,
        EnumerationProgress enumerationProgress, NetworkOverlay net) {

    if (!VimNames.TYPE_NETWORK.equals(net.getId().getType()) &&
            !VimNames.TYPE_OPAQUE_NETWORK.equals(net.getId().getType())) {
        return null;
    }

    SubnetState subnet = new SubnetState();
    subnet.documentSelfLink = UriUtils.buildUriPath(SubnetService.FACTORY_LINK,
            UriUtils.getLastPathSegment(networkState.documentSelfLink));
    subnet.id = subnet.name = net.getName();
    subnet.endpointLink = enumerationProgress.getRequest().endpointLink;
    subnet.networkLink = networkState.documentSelfLink;
    subnet.tenantLinks = enumerationProgress.getTenantLinks();
    subnet.regionId = networkState.regionId;
    enumerationProgress.touchResource(subnet.documentSelfLink);

    CustomProperties.of(subnet)
            .put(CustomProperties.MOREF, net.getId())
            .put(CustomProperties.TYPE, net.getId().getType());

    // Add NSX-T related properties to the subnet
    if (VimNames.TYPE_OPAQUE_NETWORK.equals(net.getId().getType())) {
        OpaqueNetworkSummary opaqueNetworkSummary = (OpaqueNetworkSummary) net.getSummary();
        CustomProperties.of(subnet)
                .put(NsxProperties.OPAQUE_NET_ID, opaqueNetworkSummary.getOpaqueNetworkId())
                .put(NsxProperties.OPAQUE_NET_TYPE,
                        opaqueNetworkSummary.getOpaqueNetworkType());
    }
    return subnet;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:33,代码来源:VSphereAdapterResourceEnumerationService.java

示例13: getDocumentTemplate

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
@Override
public ServiceDocument getDocumentTemplate() {
    ServiceDocument td = super.getDocumentTemplate();
    // enable metadata indexing
    td.documentDescription.documentIndexingOptions =
            EnumSet.of(DocumentIndexingOption.INDEX_METADATA);
    ServiceUtils.setRetentionLimit(td);
    LoadBalancerState template = (LoadBalancerState) td;

    template.id = UUID.randomUUID().toString();
    template.descriptionLink = "lb-description-link";
    template.name = "load-balancer";
    template.endpointLink = UriUtils.buildUriPath(EndpointService.FACTORY_LINK,
            "my-endpoint");
    template.internetFacing = Boolean.TRUE;
    template.address = "my-address";

    RouteConfiguration routeConfiguration = new RouteConfiguration();
    routeConfiguration.protocol = Protocol.HTTP.name();
    routeConfiguration.port = "80";
    routeConfiguration.instanceProtocol = Protocol.HTTP.name();
    routeConfiguration.instancePort = "80";
    routeConfiguration.healthCheckConfiguration = new HealthCheckConfiguration();
    routeConfiguration.healthCheckConfiguration.protocol = Protocol.HTTP.name();
    routeConfiguration.healthCheckConfiguration.port = "80";
    template.routes = Arrays.asList(routeConfiguration);

    return template;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:30,代码来源:LoadBalancerService.java

示例14: createSelfLinkFromState

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
public static final String createSelfLinkFromState(GatewayPathService.State state) {
    String uriPath = UriUtils.convertPathCharsFromLink(state.path);
    return UriUtils.buildUriPath(GatewayPathFactoryService.SELF_LINK, uriPath);
}
 
开发者ID:vmware,项目名称:xenon-utils,代码行数:5,代码来源:GatewayPathFactoryService.java

示例15: getResourceGroomerTaskUri

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
public static String getResourceGroomerTaskUri(String endpointLink) {
    return UriUtils.buildUriPath(ResourceGroomerTaskService.FACTORY_LINK,
            UriUtils.getLastPathSegment(endpointLink) + SEPARATOR +
                    RESOURCE_GROOMER_TASK_POSTFIX);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:6,代码来源:EndpointRemovalTaskService.java


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