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


Java Operation.STATUS_CODE_OK属性代码示例

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


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

示例1: handleGet

@RouteDocumentation(description = "@CAR_ENGINE",
        path = "?engine",
        produces = { "application/json" },
        responses = {
            @ApiResponse(statusCode = Operation.STATUS_CODE_OK, description = "OK", response = EngineInfo.class)
        })
@RouteDocumentation(description = "@CAR",
        produces = { "application/json" },
        responses = {
            @ApiResponse(statusCode = Operation.STATUS_CODE_OK, description = "OK", response = Car.class),
            @ApiResponse(statusCode = Operation.STATUS_CODE_NOT_FOUND, description = "Not Found"),
        })
@Override
public void handleGet(Operation get) {
    Map<String,String> queryParams = UriUtils.parseUriQueryParams(get.getUri());
    boolean engineInfo = Boolean.parseBoolean(queryParams.get("engine"));
    if (engineInfo) {
        Car car = this.getState(get);
        get.setBody(car.engineInfo);
        get.complete();
    } else {
        super.handleGet(get);
    }
}
 
开发者ID:vmware,项目名称:xenon-utils,代码行数:24,代码来源:CarService.java

示例2: createTagStates

/**
 * Create n tagLinks
 */
private List<String> createTagStates(String prefix, int count, boolean external)
        throws Throwable {
    List<String> tags = new ArrayList<>();

    for (int i = 0; i < count; i++) {
        TagState tag = buildTagState(prefix, i, i, external);
        Operation op = Operation
                .createPost(UriUtils.buildUri(this.host, TagService.FACTORY_LINK))
                .setBody(tag);

        Operation response = this.host.waitForResponse(op);

        if (response.getStatusCode() == Operation.STATUS_CODE_OK) {
            tags.add(response.getBody(TagState.class).documentSelfLink);
        }
    }

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

示例3: createComputes

/**
 * Create given number of computes with given endpointLinks and tenantLink.
 */
private List<String> createComputes(int count, Set<String> endpointLinks, String tenantLink) {
    List<String> computeLinks = new ArrayList<>();

    ComputeState computeState = new ComputeState();
    computeState.descriptionLink = "description-link";
    computeState.id = UUID.randomUUID().toString();
    computeState.name = computeState.id;
    computeState.tenantLinks = Collections.singletonList(tenantLink);
    computeState.endpointLinks = endpointLinks;

    for (int i = 0; i < count; i++) {
        Operation op = Operation
                .createPost(UriUtils.buildUri(this.host, ComputeService.FACTORY_LINK))
                .setBody(computeState);

        Operation response = this.host.waitForResponse(op);

        if (response.getStatusCode() == Operation.STATUS_CODE_OK) {
            computeLinks.add(response.getBody(ComputeState.class).documentSelfLink);
        }
    }
    return computeLinks;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:26,代码来源:ResourceGroomerTaskServiceTest.java

示例4: testMergeWithNewValues

@Test
public void testMergeWithNewValues() {
    ResourceState current = new ResourceState();
    current.tenantLinks = new ArrayList<>(Arrays.asList("tenant1"));
    current.groupLinks = new HashSet<>(Arrays.asList("groupA"));
    current.tagLinks = new HashSet<>(Arrays.asList("tag1", "tag2"));

    ResourceState patch = new ResourceState();
    patch.tenantLinks = new ArrayList<>(Arrays.asList("tenant2"));
    patch.groupLinks = new HashSet<>(Arrays.asList("groupB"));
    patch.tagLinks = new HashSet<>();

    boolean changed = handlePatch(current, patch).getStatusCode() == Operation.STATUS_CODE_OK;

    assertTrue(changed);
    assertEquals(Arrays.asList("tenant1", "tenant2"), current.tenantLinks);
    assertEquals(new HashSet<>(Arrays.asList("groupA", "groupB")), current.groupLinks);
    assertEquals(new HashSet<>(Arrays.asList("tag1", "tag2")), current.tagLinks);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:19,代码来源:ResourceUtilsTest.java

示例5: registerComputeState

protected ComputeState registerComputeState(ComputeState computeState) throws Throwable {
    Operation operation = sendOperationSynchronously(Operation
            .createPost(super.host, ComputeService.FACTORY_LINK)
            .setBody(computeState));
    if (operation.getStatusCode() == Operation.STATUS_CODE_OK) {
        ComputeState result = operation.getBody(ComputeState.class);
        markForDelete(result.documentSelfLink);
        return result;
    }
    throw new IllegalStateException(String.valueOf(operation.getBodyRaw()));
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:11,代码来源:BaseResourceOperationTest.java


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