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

Java OperationState类代码示例

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

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



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

示例1: getLastOperation

import org.springframework.cloud.servicebroker.model.OperationState; //导入依赖的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: vrStatusToOperationState

import org.springframework.cloud.servicebroker.model.OperationState; //导入依赖的package包/类
OperationState vrStatusToOperationState(String vrStatus) {
    if (vrStatus == null) {
        return OperationState.FAILED;
    }

    if (SUCCESSFUL.equals(vrStatus)) {
        return OperationState.SUCCEEDED;
    }

    if (UNSUBMITTED.equals(vrStatus) || SUBMITTED.equals(vrStatus)
            || PENDING_PRE_APPROVAL.equals(vrStatus)
            || PRE_APPROVED.equals(vrStatus)
            || IN_PROGRESS.equals(vrStatus)
            || PENDING_POST_APPROVAL.equals(vrStatus)
            || POST_APPROVED.equals(vrStatus)
            || PROVIDER_COMPLETED.equals(vrStatus)) {
        return OperationState.IN_PROGRESS;
    }

    return OperationState.FAILED;

}
 
开发者ID:cf-platform-eng,项目名称:vrealize-service-broker,代码行数:23,代码来源:VraClient.java


示例3: instanceDeletedSuccessfully

import org.springframework.cloud.servicebroker.model.OperationState; //导入依赖的package包/类
@Test
public void instanceDeletedSuccessfully() throws Exception {
    VrServiceInstance si = getInstance();
    assertEquals(0, repository.entries(VrServiceInstanceService.OBJECT_ID).size());

    repository.put(VrServiceInstanceService.OBJECT_ID, si.getId(), si);
    assertEquals(1, repository.entries(VrServiceInstanceService.OBJECT_ID).size());

    VrServiceInstance si2 = repository.get(VrServiceInstanceService.OBJECT_ID, si.getId());
    assertNotNull(si2);
    assertEquals("anID", si2.getId());

    VrServiceInstance si3 = repository.get(VrServiceInstanceService.OBJECT_ID, "anID");
    assertNotNull(si3);
    assertEquals("anID", si3.getId());
    assertEquals(TestConfig.SD_ID, si3.getServiceDefinitionId());
    assertNotNull(si3.getServiceInstanceLastOperation());
    assertEquals(OperationState.IN_PROGRESS, si3.getServiceInstanceLastOperation()
            .getState());

    //System.out.println(gson.toJson(si3));

    repository.delete(VrServiceInstanceService.OBJECT_ID, si3.getId());

    assertEquals(0, repository.entries(VrServiceInstanceService.OBJECT_ID).size());
}
 
开发者ID:cf-platform-eng,项目名称:vrealize-service-broker,代码行数:27,代码来源:VrServiceInstanceRepositoryTest.java


示例4: setUp

import org.springframework.cloud.servicebroker.model.OperationState; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);

    VrServiceInstance si = TestConfig.getServiceInstance();
    LastOperation lo = new LastOperation(OperationState.SUCCEEDED, "anOp", false);
    si.withLastOperation(lo);

    when(vrServiceInstanceService.getServiceInstance(Matchers.anyString()))
            .thenReturn(si);

    when(
            vrServiceInstanceService
                    .saveInstance(any(VrServiceInstance.class)))
            .thenReturn(si);

    when(
            vrServiceInstanceService
                    .deleteInstance(any(VrServiceInstance.class)))
            .thenReturn(si);

    Set<String> keys = repo.keys(VrServiceInstanceBindingService.OBJECT_ID);
    for (String key : keys) {
        repo.delete(VrServiceInstanceBindingService.OBJECT_ID, key);
    }
}
 
开发者ID:cf-platform-eng,项目名称:vrealize-service-broker,代码行数:27,代码来源:VrServiceInstanceBindingServiceTest.java


示例5: ServiceInstance

import org.springframework.cloud.servicebroker.model.OperationState; //导入依赖的package包/类
public ServiceInstance(CreateServiceInstanceRequest request) {
    super();
    serviceDefinitionId = request.getServiceDefinitionId();
    planId = request.getPlanId();
    organizationGuid = request.getOrganizationGuid();
    spaceGuid = request.getSpaceGuid();
    serviceInstanceId = request.getServiceInstanceId();
    lastOperation = new LastOperationSerializer(
            OperationState.IN_PROGRESS, "Provisioning", false);
    
    // name is set on 1st create only, not by connecting remotely
    name = serviceInstanceId;

    // add a reference to itself, used to find remotely created instances
    // of the same actual service instance
    references.add(serviceInstanceId);
}
 
开发者ID:codedellemc,项目名称:ecs-cf-service-broker,代码行数:18,代码来源:ServiceInstance.java


示例6: lastOperationHasInProgressStatus

import org.springframework.cloud.servicebroker.model.OperationState; //导入依赖的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


示例7: lastOperationHasSucceededStatusWithDeletionComplete

import org.springframework.cloud.servicebroker.model.OperationState; //导入依赖的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


示例8: testFindOneReturnsBrooklynServiceInstanceIfNoEntityId

import org.springframework.cloud.servicebroker.model.OperationState; //导入依赖的package包/类
@Test
public void testFindOneReturnsBrooklynServiceInstanceIfNoEntityId() throws ExecutionException, InterruptedException {
    final ImmutableMap<String, Object> config = ImmutableMap.of();
    final String serviceInstanceId = "foo";

    when(futureConfigAsMap.get()).thenReturn(config);

    final BrooklynServiceInstance brooklynServiceInstance = brooklynServiceInstanceRepository.findOne(serviceInstanceId);

    assertEquals(serviceInstanceId, brooklynServiceInstance.getServiceInstanceId());
    assertEquals("null", brooklynServiceInstance.getServiceDefinitionId());
    assertEquals("null", brooklynServiceInstance.getPlanId());
    assertEquals("null", brooklynServiceInstance.getEntityId());
    assertEquals("null", brooklynServiceInstance.getOperation());
    assertEquals(OperationState.FAILED, brooklynServiceInstance.getOperationState());
    verify(brooklynRestAdmin, never()).deleteConfig(anyString(), anyString(), anyString());
    verify(brooklynRestAdmin, times(1)).setConfig("service-broker-records","service-instance-repository", serviceInstanceId, brooklynServiceInstance);
}
 
开发者ID:cloudfoundry-incubator,项目名称:apache-brooklyn-service-broker,代码行数:19,代码来源:BrooklynServiceInstanceRepositoryTest.java


示例9: testFindOneReturnsBrooklynServiceInstanceIfNoPlanId

import org.springframework.cloud.servicebroker.model.OperationState; //导入依赖的package包/类
@Test
public void testFindOneReturnsBrooklynServiceInstanceIfNoPlanId() throws ExecutionException, InterruptedException {
    final ImmutableMap<String, Object> config = ImmutableMap.of();
    final String serviceInstanceId = "foo";

    when(futureConfigAsMap.get()).thenReturn(config);

    final BrooklynServiceInstance brooklynServiceInstance = brooklynServiceInstanceRepository.findOne(serviceInstanceId);

    assertEquals(serviceInstanceId, brooklynServiceInstance.getServiceInstanceId());
    assertEquals("null", brooklynServiceInstance.getServiceDefinitionId());
    assertEquals("null", brooklynServiceInstance.getPlanId());
    assertEquals("null", brooklynServiceInstance.getEntityId());
    assertEquals("null", brooklynServiceInstance.getOperation());
    assertEquals(OperationState.FAILED, brooklynServiceInstance.getOperationState());
    verify(brooklynRestAdmin, never()).deleteConfig(anyString(), anyString(), anyString());
    verify(brooklynRestAdmin,times(1)).setConfig("service-broker-records","service-instance-repository", serviceInstanceId, brooklynServiceInstance);
}
 
开发者ID:cloudfoundry-incubator,项目名称:apache-brooklyn-service-broker,代码行数:19,代码来源:BrooklynServiceInstanceRepositoryTest.java


示例10: testFindOneReturnsStateInProgressWithCreatingLastOperation

import org.springframework.cloud.servicebroker.model.OperationState; //导入依赖的package包/类
@Test
public void testFindOneReturnsStateInProgressWithCreatingLastOperation() throws ExecutionException, InterruptedException {
    final ImmutableMap<String, Object> config = ImmutableMap.of("operation", "CREATING");
    final String serviceInstanceId = "foo";

    when(futureConfigAsMap.get()).thenReturn(config);

    final ImmutableList<String> states = ImmutableList.of("CREATED", "STARTING");
    for (String state : states) {
        when(futureServiceState.get()).thenReturn(state);

        final BrooklynServiceInstance brooklynServiceInstance = brooklynServiceInstanceRepository.findOne(serviceInstanceId);

        assertEquals(OperationState.IN_PROGRESS, brooklynServiceInstance.getOperationState());
    }
}
 
开发者ID:cloudfoundry-incubator,项目名称:apache-brooklyn-service-broker,代码行数:17,代码来源:BrooklynServiceInstanceRepositoryTest.java


示例11: testFindOneReturnsStateInProgressWithDeletingLastOperation

import org.springframework.cloud.servicebroker.model.OperationState; //导入依赖的package包/类
@Test
public void testFindOneReturnsStateInProgressWithDeletingLastOperation() throws ExecutionException, InterruptedException {
    final ImmutableMap<String, Object> config = ImmutableMap.of("operation", "DELETING");
    final String serviceInstanceId = "foo";

    when(futureConfigAsMap.get()).thenReturn(config);

    final ImmutableList<String> states = ImmutableList.of("STOPPED", "STOPPING");
    for (String state : states) {
        when(futureServiceState.get()).thenReturn(state);

        final BrooklynServiceInstance brooklynServiceInstance = brooklynServiceInstanceRepository.findOne(serviceInstanceId);

        assertEquals(OperationState.IN_PROGRESS, brooklynServiceInstance.getOperationState());
    }
}
 
开发者ID:cloudfoundry-incubator,项目名称:apache-brooklyn-service-broker,代码行数:17,代码来源:BrooklynServiceInstanceRepositoryTest.java


示例12: VrServiceInstance

import org.springframework.cloud.servicebroker.model.OperationState; //导入依赖的package包/类
public VrServiceInstance(CreateServiceInstanceRequest request) {
    this.serviceDefinitionId = request.getServiceDefinitionId();
    this.planId = request.getPlanId();
    this.organizationGuid = request.getOrganizationGuid();
    this.spaceGuid = request.getSpaceGuid();
    this.id = request.getServiceInstanceId();
    this.lastOperation = new LastOperation(OperationState.IN_PROGRESS, "Provisioning", false);

    if (request.getParameters() != null) {
        getParameters().putAll(request.getParameters());
    }
}
 
开发者ID:cf-platform-eng,项目名称:vrealize-service-broker,代码行数:13,代码来源:VrServiceInstance.java


示例13: isInProgress

import org.springframework.cloud.servicebroker.model.OperationState; //导入依赖的package包/类
public boolean isInProgress() {
    if (getServiceInstanceLastOperation() == null
            || getServiceInstanceLastOperation().getState() == null) {
        return false;
    }

    return getServiceInstanceLastOperation().getState().equals(OperationState.IN_PROGRESS);
}
 
开发者ID:cf-platform-eng,项目名称:vrealize-service-broker,代码行数:9,代码来源:VrServiceInstance.java


示例14: isCurrentOperationSuccessful

import org.springframework.cloud.servicebroker.model.OperationState; //导入依赖的package包/类
public boolean isCurrentOperationSuccessful() {
    if (getServiceInstanceLastOperation() == null
            || getServiceInstanceLastOperation().getState() == null) {
        return false;
    }
    return getServiceInstanceLastOperation().getState().equals(OperationState.SUCCEEDED);
}
 
开发者ID:cf-platform-eng,项目名称:vrealize-service-broker,代码行数:8,代码来源:VrServiceInstance.java


示例15: getRequestStatus

import org.springframework.cloud.servicebroker.model.OperationState; //导入依赖的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


示例16: delete

import org.springframework.cloud.servicebroker.model.OperationState; //导入依赖的package包/类
private VrServiceInstance delete(VrServiceInstance instance,
                                 String deleteRequestId) {
    instance.getMetadata().put(VrServiceInstance.DELETE_REQUEST_ID, deleteRequestId);
    LastOperation lo = new LastOperation(OperationState.IN_PROGRESS, deleteRequestId, true);
    instance.withLastOperation(lo);

    return instance;
}
 
开发者ID:cf-platform-eng,项目名称:vrealize-service-broker,代码行数:9,代码来源:VrServiceInstanceTest.java


示例17: testGetRequestStatus

import org.springframework.cloud.servicebroker.model.OperationState; //导入依赖的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


示例18: testStateTranslation

import org.springframework.cloud.servicebroker.model.OperationState; //导入依赖的package包/类
@Test
public void testStateTranslation() {
    assertEquals(OperationState.FAILED,
            client.vrStatusToOperationState(null));
    assertEquals(OperationState.FAILED,
            client.vrStatusToOperationState(""));
    assertEquals(OperationState.FAILED,
            client.vrStatusToOperationState("foo"));
    assertEquals(OperationState.IN_PROGRESS,
            client.vrStatusToOperationState(VraClient.IN_PROGRESS));
    assertEquals(OperationState.IN_PROGRESS,
            client.vrStatusToOperationState(VraClient.PENDING_POST_APPROVAL));
    assertEquals(OperationState.IN_PROGRESS,
            client.vrStatusToOperationState(VraClient.PENDING_PRE_APPROVAL));
    assertEquals(OperationState.IN_PROGRESS,
            client.vrStatusToOperationState(VraClient.POST_APPROVED));
    assertEquals(OperationState.IN_PROGRESS,
            client.vrStatusToOperationState(VraClient.PRE_APPROVED));
    assertEquals(OperationState.IN_PROGRESS,
            client.vrStatusToOperationState(VraClient.SUBMITTED));
    assertEquals(OperationState.IN_PROGRESS,
            client.vrStatusToOperationState(VraClient.PROVIDER_COMPLETED));
    assertEquals(OperationState.IN_PROGRESS,
            client.vrStatusToOperationState(VraClient.UNSUBMITTED));
    assertEquals(OperationState.SUCCEEDED,
            client.vrStatusToOperationState(VraClient.SUCCESSFUL));
}
 
开发者ID:cf-platform-eng,项目名称:vrealize-service-broker,代码行数:28,代码来源:VraClientTest.java


示例19: testGetStatus

import org.springframework.cloud.servicebroker.model.OperationState; //导入依赖的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


示例20: testDelete

import org.springframework.cloud.servicebroker.model.OperationState; //导入依赖的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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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