• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java GetLastServiceOperationResponse类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.springframework.cloud.servicebroker.model.GetLastServiceOperationResponse的典型用法代码示例。如果您正苦于以下问题:Java GetLastServiceOperationResponse类的具体用法?Java GetLastServiceOperationResponse怎么用?Java GetLastServiceOperationResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



GetLastServiceOperationResponse类属于org.springframework.cloud.servicebroker.model包,在下文中一共展示了GetLastServiceOperationResponse类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getLastOperation

import org.springframework.cloud.servicebroker.model.GetLastServiceOperationResponse; //导入依赖的package包/类
GetLastServiceOperationResponse getLastOperation(JsonElement jsonElement) {
    JsonObject jo = jsonElement.getAsJsonObject();
    JsonElement state = jo.get("state");
    JsonElement id = jo.get("id");

    if (id == null) {
        return new GetLastServiceOperationResponse().withDescription("Unable to determine id of request.").withOperationState(OperationState.FAILED);
    }

    if (state == null) {
        return new GetLastServiceOperationResponse().withDescription("Unable to determine state of request: " + id).withOperationState(OperationState.FAILED);
    }

    String requestId = id.getAsString();
    String vrState = state.getAsString();

    LOG.info("vra status for request id: " + requestId + " : " + vrState);

    return new GetLastServiceOperationResponse().withDescription(requestId).withOperationState(vrStatusToOperationState(vrState));
}
 
开发者ID:cf-platform-eng,项目名称:vrealize-service-broker,代码行数:21,代码来源:VraClient.java


示例2: lastOperationHasInProgressStatus

import org.springframework.cloud.servicebroker.model.GetLastServiceOperationResponse; //导入依赖的package包/类
@Test
public void lastOperationHasInProgressStatus() throws Exception {
	when(serviceInstanceService.getLastOperation(eq(lastOperationRequest)))
			.thenReturn(GetLastServiceOperationResponse.builder()
					.operationState(OperationState.IN_PROGRESS)
					.description("working on it")
			.build());

	mockMvc.perform(get(buildUrl(lastOperationRequest, false)))
			.andExpect(status().isOk())
			.andExpect(jsonPath("$.state", is(OperationState.IN_PROGRESS.toString())))
			.andExpect(jsonPath("$.description", is("working on it")));

	GetLastServiceOperationRequest actualRequest = verifyLastOperation();
	assertNull(actualRequest.getCfInstanceId());
	assertNull(actualRequest.getApiInfoLocation());
	assertNull(actualRequest.getOriginatingIdentity());
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-cloudfoundry-service-broker,代码行数:19,代码来源:ServiceInstanceControllerIntegrationTest.java


示例3: lastOperationHasSucceededStatusWithDeletionComplete

import org.springframework.cloud.servicebroker.model.GetLastServiceOperationResponse; //导入依赖的package包/类
@Test
public void lastOperationHasSucceededStatusWithDeletionComplete() throws Exception {
	GetLastServiceOperationResponse response = GetLastServiceOperationResponse.builder()
			.operationState(OperationState.SUCCEEDED)
			.description("all gone")
			.deleteOperation(true)
			.build();

	when(serviceInstanceService.getLastOperation(eq(lastOperationRequest)))
			.thenReturn(response);

	mockMvc.perform(get(buildUrl(lastOperationRequest, false)))
			.andExpect(status().isGone())
			.andExpect(jsonPath("$.state", is(OperationState.SUCCEEDED.toString())))
			.andExpect(jsonPath("$.description", is("all gone")));
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-cloudfoundry-service-broker,代码行数:17,代码来源:ServiceInstanceControllerIntegrationTest.java


示例4: getRequestStatus

import org.springframework.cloud.servicebroker.model.GetLastServiceOperationResponse; //导入依赖的package包/类
public GetLastServiceOperationResponse getRequestStatus(VrServiceInstance si) {
    if (si == null || si.getServiceInstanceLastOperation() == null) {
        return new GetLastServiceOperationResponse().withDescription("Unable to get request status: invalid request.").withOperationState(OperationState.FAILED);
    }

    String requestId = si.getCurrentOperationRequestId();
    if (requestId == null) {
        return new GetLastServiceOperationResponse().withDescription("Unable to get requestId from last operation.").withOperationState(OperationState.FAILED);
    }

    return getRequestStatus(tokenService.getToken(), requestId);
}
 
开发者ID:cf-platform-eng,项目名称:vrealize-service-broker,代码行数:13,代码来源:VraClient.java


示例5: testGetRequestStatus

import org.springframework.cloud.servicebroker.model.GetLastServiceOperationResponse; //导入依赖的package包/类
@Test
public void testGetRequestStatus() throws Exception {
    JsonParser parser = new JsonParser();
    JsonElement je = parser.parse(TestConfig
            .getContents("requestResponse.json"));

    GetLastServiceOperationResponse silo = client.getLastOperation(je);
    assertNotNull(silo);
    assertEquals(OperationState.IN_PROGRESS, silo.getState());
}
 
开发者ID:cf-platform-eng,项目名称:vrealize-service-broker,代码行数:11,代码来源:VraClientTest.java


示例6: testGetStatus

import org.springframework.cloud.servicebroker.model.GetLastServiceOperationResponse; //导入依赖的package包/类
@Test
@Ignore
public void testGetStatus() throws ServiceBrokerException {
    VrServiceInstance instance = TestConfig.getServiceInstance();
    LastOperation lo = new LastOperation(OperationState.IN_PROGRESS, REQ_ID, false);
    instance.withLastOperation(lo);
    GetLastServiceOperationResponse status = client.getRequestStatus(instance);
    assertNotNull(status);
    assertEquals(OperationState.SUCCEEDED, status.getState());
}
 
开发者ID:cf-platform-eng,项目名称:vrealize-service-broker,代码行数:11,代码来源:LifecycleTest.java


示例7: testDelete

import org.springframework.cloud.servicebroker.model.GetLastServiceOperationResponse; //导入依赖的package包/类
@Test
@Ignore
public void testDelete() throws Exception {
    LOG.info("get a token.");
    String token = tokenService.getToken();
    assertNotNull(token);

    VrServiceInstance instance = getServiceInstanceToDelete();
    instance = client.deleteInstance(instance);

    String requestId = instance.getCurrentOperationRequestId();
    assertNotNull(requestId);
    LOG.info("delete request id: " + requestId);

    OperationState status = instance.getServiceInstanceLastOperation().getState();
    assertNotNull(status);
    LOG.info("delete request state: " + status);

    LOG.info("wait for delete request to complete....");

    GetLastServiceOperationResponse silo = client.getRequestStatus(token,
            requestId);
    assertNotNull(silo);
    while (silo.getState().equals(OperationState.IN_PROGRESS)) {
        TimeUnit.SECONDS.sleep(10);
        silo = client.getRequestStatus(token, requestId);
        LOG.info("state is: " + silo.getState() + ": "
                + silo.getDescription());
    }

    LOG.info("state is: "
            + client.getRequestStatus(token, requestId).getState());
}
 
开发者ID:cf-platform-eng,项目名称:vrealize-service-broker,代码行数:34,代码来源:LifecycleTest.java


示例8: lastOperationHasSucceededStatus

import org.springframework.cloud.servicebroker.model.GetLastServiceOperationResponse; //导入依赖的package包/类
@Test
public void lastOperationHasSucceededStatus() throws Exception {
	lastOperationRequest.setApiInfoLocation(API_INFO_LOCATION);
	lastOperationRequest.setOriginatingIdentity(buildOriginatingIdentity());
	lastOperationRequest.setCfInstanceId(CF_INSTANCE_ID);

	GetLastServiceOperationResponse response = GetLastServiceOperationResponse.builder()
			.operationState(OperationState.SUCCEEDED)
			.description("all good")
			.build();

	when(serviceInstanceService.getLastOperation(eq(lastOperationRequest))).thenReturn(response);

	mockMvc.perform(get(buildUrl(lastOperationRequest, true))
			.header(API_INFO_LOCATION_HEADER, API_INFO_LOCATION)
			.header(ORIGINATING_IDENTITY_HEADER, buildOriginatingIdentityHeader()))
			.andExpect(status().isOk())
			.andExpect(jsonPath("$.state", is(OperationState.SUCCEEDED.toString())))
			.andExpect(jsonPath("$.description", is("all good")));

	GetLastServiceOperationRequest actualRequest = verifyLastOperation();
	assertEquals(CF_INSTANCE_ID, actualRequest.getCfInstanceId());
	assertEquals(API_INFO_LOCATION, actualRequest.getApiInfoLocation());
	assertEquals(ORIGINATING_IDENTITY_PLATFORM, actualRequest.getOriginatingIdentity().getPlatform());
	assertEquals(ORIGINATING_USER_VALUE, actualRequest.getOriginatingIdentity().getProperty(ORIGINATING_USER_KEY));
	assertEquals(ORIGINATING_EMAIL_VALUE, actualRequest.getOriginatingIdentity().getProperty(ORIGINATING_EMAIL_KEY));
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-cloudfoundry-service-broker,代码行数:28,代码来源:ServiceInstanceControllerIntegrationTest.java


示例9: lastOperationHasFailedStatus

import org.springframework.cloud.servicebroker.model.GetLastServiceOperationResponse; //导入依赖的package包/类
@Test
public void lastOperationHasFailedStatus() throws Exception {
	GetLastServiceOperationResponse response = GetLastServiceOperationResponse.builder()
			.operationState(OperationState.FAILED)
			.description("not so good")
			.build();

	when(serviceInstanceService.getLastOperation(eq(lastOperationRequest)))
			.thenReturn(response);

	mockMvc.perform(get(buildUrl(lastOperationRequest, false)))
			.andExpect(status().isOk())
			.andExpect(jsonPath("$.state", is(OperationState.FAILED.toString())))
			.andExpect(jsonPath("$.description", is("not so good")));
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-cloudfoundry-service-broker,代码行数:16,代码来源:ServiceInstanceControllerIntegrationTest.java


示例10: getServiceInstanceLastOperation

import org.springframework.cloud.servicebroker.model.GetLastServiceOperationResponse; //导入依赖的package包/类
@GetMapping(value = {
		"/{cfInstanceId}/v2/service_instances/{instanceId}/last_operation",
		"/v2/service_instances/{instanceId}/last_operation"
})
public ResponseEntity<?> getServiceInstanceLastOperation(@PathVariable Map<String, String> pathVariables,
														 @PathVariable("instanceId") String serviceInstanceId,
														 @RequestParam("service_id") String serviceDefinitionId,
														 @RequestParam("plan_id") String planId,
														 @RequestParam(value = "operation", required = false) String operation,
														 @RequestHeader(value = API_INFO_LOCATION_HEADER, required = false) String apiInfoLocation,
														 @RequestHeader(value = ORIGINATING_IDENTITY_HEADER, required = false) String originatingIdentityString) {
	GetLastServiceOperationRequest request = new GetLastServiceOperationRequest();
	request.setServiceDefinitionId(serviceDefinitionId);
	request.setServiceInstanceId(serviceInstanceId);
	request.setPlanId(planId);
	request.setOperation(operation);
	setCommonRequestFields(request, pathVariables.get("cfInstanceId"), apiInfoLocation, originatingIdentityString);

	log.debug("Getting service instance status: request={}", request);

	GetLastServiceOperationResponse response = service.getLastOperation(request);

	log.debug("Getting service instance status succeeded: serviceInstanceId={}, response={}",
			serviceInstanceId, response);

	boolean isSuccessfulDelete = response.getState().equals(OperationState.SUCCEEDED) && response.isDeleteOperation();

	return new ResponseEntity<>(response, isSuccessfulDelete ? HttpStatus.GONE : HttpStatus.OK);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-cloudfoundry-service-broker,代码行数:30,代码来源:ServiceInstanceController.java


示例11: getLastOperation

import org.springframework.cloud.servicebroker.model.GetLastServiceOperationResponse; //导入依赖的package包/类
@Override
public GetLastServiceOperationResponse getLastOperation(GetLastServiceOperationRequest request) {
       try {
           OperationState serviceInstanceLastOperation = getServiceInstance(request.getServiceInstanceId()).getOperationState();
           LOG.info("getting last operation for {}: {}", request, serviceInstanceLastOperation);
           return new GetLastServiceOperationResponse().withOperationState(serviceInstanceLastOperation);
       } catch (Exception e) {
           LOG.info("exception thrown getting last operation for {}: {}", request, e);
           throw e;
       }
}
 
开发者ID:cloudfoundry-incubator,项目名称:apache-brooklyn-service-broker,代码行数:12,代码来源:BrooklynServiceInstanceService.java


示例12: getLastOperation

import org.springframework.cloud.servicebroker.model.GetLastServiceOperationResponse; //导入依赖的package包/类
@Override
public GetLastServiceOperationResponse getLastOperation(GetLastServiceOperationRequest request) {
	return new GetLastServiceOperationResponse().withOperationState(OperationState.SUCCEEDED);
}
 
开发者ID:cf-platform-eng,项目名称:mongodb-broker,代码行数:5,代码来源:MongoServiceInstanceService.java


示例13: fromResponse

import org.springframework.cloud.servicebroker.model.GetLastServiceOperationResponse; //导入依赖的package包/类
public static LastOperation fromResponse(GetLastServiceOperationResponse response) {
    return new LastOperation(response.getState(), response.getDescription(), response.isDeleteOperation());
}
 
开发者ID:cf-platform-eng,项目名称:vrealize-service-broker,代码行数:4,代码来源:LastOperation.java


示例14: toResponse

import org.springframework.cloud.servicebroker.model.GetLastServiceOperationResponse; //导入依赖的package包/类
public GetLastServiceOperationResponse toResponse() {
    return new GetLastServiceOperationResponse().
            withDescription(getDescription()).
            withOperationState(getState()).
            withDeleteOperation(isDelete());
}
 
开发者ID:cf-platform-eng,项目名称:vrealize-service-broker,代码行数:7,代码来源:LastOperation.java


示例15: testGetLastOperation

import org.springframework.cloud.servicebroker.model.GetLastServiceOperationResponse; //导入依赖的package包/类
@Test
public void testGetLastOperation() throws Exception {
    JsonParser parser = new JsonParser();
    JsonElement je = parser.parse(TestConfig
            .getContents("submittedRequestResponse.json"));

    GetLastServiceOperationResponse silo = client.getLastOperation(je);
    assertNotNull(silo);
    assertEquals(OperationState.IN_PROGRESS, silo.getState());

    je = parser.parse(TestConfig
            .getContents("inProgressRequestResponse.json"));
    silo = client.getLastOperation(je);
    assertNotNull(silo);
    assertEquals(OperationState.IN_PROGRESS, silo.getState());

    je = parser.parse(TestConfig
            .getContents("pendingPreRequestResponse.json"));
    silo = client.getLastOperation(je);
    assertNotNull(silo);
    assertEquals(OperationState.IN_PROGRESS, silo.getState());

    je = parser.parse(TestConfig
            .getContents("pendingPostRequestResponse.json"));
    silo = client.getLastOperation(je);
    assertNotNull(silo);
    assertEquals(OperationState.IN_PROGRESS, silo.getState());

    je = parser.parse(TestConfig
            .getContents("successfulPostRequestResponse.json"));
    silo = client.getLastOperation(je);
    assertNotNull(silo);
    assertEquals(OperationState.SUCCEEDED, silo.getState());

    je = parser.parse(TestConfig
            .getContents("failedPostRequestResponse.json"));
    silo = client.getLastOperation(je);
    assertNotNull(silo);
    assertEquals(OperationState.FAILED, silo.getState());

    je = parser.parse(TestConfig
            .getContents("rejectedRequestResponse.json"));
    silo = client.getLastOperation(je);
    assertNotNull(silo);
    assertEquals(OperationState.FAILED, silo.getState());

    je = parser.parse(TestConfig
            .getContents("bogusStateRequestResponse.json"));
    silo = client.getLastOperation(je);
    assertNotNull(silo);
    assertEquals(OperationState.FAILED, silo.getState());

    je = parser.parse(TestConfig
            .getContents("missingStateRequestResponse.json"));
    silo = client.getLastOperation(je);
    assertNotNull(silo);
    assertEquals(OperationState.FAILED, silo.getState());
}
 
开发者ID:cf-platform-eng,项目名称:vrealize-service-broker,代码行数:59,代码来源:VraClientTest.java


示例16: testCreate

import org.springframework.cloud.servicebroker.model.GetLastServiceOperationResponse; //导入依赖的package包/类
@Test
@Ignore
public void testCreate() throws Exception {
    LOG.info("get a token.");
    String token = tokenService.getToken();
    assertNotNull(token);

    LOG.info("get a service def.");
    ServiceDefinition sd = catalogService
            .getServiceDefinition(TestConfig.SD_ID);
    assertNotNull(sd);

    LOG.info("submitting create request.");
    VrServiceInstance instance = client.createInstance(
            TestConfig.getCreateServiceInstanceRequest(sd, true), sd);

    Object requestId = instance.getCreateRequestId();
    assertNotNull(requestId);
    LOG.info("requestId: " + requestId);

    OperationState status = instance.getServiceInstanceLastOperation().getState();
    assertNotNull(status);

    LOG.info("request status is: " + status + " requestId is: " + requestId);

    Object location = instance.getLocation();
    assertNotNull(location);

    LOG.info("location: " + location);

    LOG.info("wait for create request to complete....");

    GetLastServiceOperationResponse silo = client.getRequestStatus(token,
            requestId.toString());
    assertNotNull(silo);
    while (silo.getState().equals(OperationState.IN_PROGRESS)) {
        TimeUnit.SECONDS.sleep(10);
        silo = client.getRequestStatus(token, requestId.toString());
        LOG.info("state is: " + silo.getState() + ": "
                + silo.getDescription());
    }

    LOG.info("state is: "
            + client.getRequestStatus(token, requestId.toString()).getState());

    while (true) {
        LOG.info("host is: " + instance.getHost());
        client.loadCredentials(instance);

        if (instance.getHost() != null) {
            break;
        }

        TimeUnit.SECONDS.sleep(10);
    }

    Map creds = instance.getCredentials();
    assertNotNull(creds);

    LOG.info("credentials: " + instance.getCredentials().toString());
    LOG.info("uri: " + instance.getCredentials().get(VrServiceInstance.URI));
}
 
开发者ID:cf-platform-eng,项目名称:vrealize-service-broker,代码行数:63,代码来源:LifecycleTest.java


示例17: getLastOperation

import org.springframework.cloud.servicebroker.model.GetLastServiceOperationResponse; //导入依赖的package包/类
/**
 * Get the status of the last requested operation for a service instance.
 *
 * @param request containing the details of the request
 * @return the details of the completed request
 * @throws ServiceInstanceDoesNotExistException if a service instance with the given ID is not known to the broker
 */
GetLastServiceOperationResponse getLastOperation(GetLastServiceOperationRequest request);
 
开发者ID:spring-cloud,项目名称:spring-cloud-cloudfoundry-service-broker,代码行数:9,代码来源:ServiceInstanceService.java



注:本文中的org.springframework.cloud.servicebroker.model.GetLastServiceOperationResponse类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FieldSignatureParser类代码示例发布时间:2022-05-22
下一篇:
Java ApplicationAdapter类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap