本文整理汇总了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);
}
}
示例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;
}
示例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;
}
示例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);
}
示例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()));
}