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

Java ServiceInstanceBindingExistsException类代码示例

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

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



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

示例1: createServiceInstanceBinding

import org.springframework.cloud.servicebroker.exception.ServiceInstanceBindingExistsException; //导入依赖的package包/类
@Override
public CreateServiceInstanceBindingResponse createServiceInstanceBinding(
        CreateServiceInstanceBindingRequest request)
        throws ServiceInstanceBindingExistsException,
        ServiceBrokerException {
    try {
        BindingWorkflow workflow = getWorkflow(request);

        LOG.info("creating binding");
        workflow.checkIfUserExists();
        String secretKey = workflow.createBindingUser();

        LOG.info("building binding response");
        Map<String, Object> credentials = workflow.getCredentials(secretKey,
                request.getParameters());
        ServiceInstanceBinding binding = workflow.getBinding(credentials);

        LOG.info("saving binding...");
        repository.save(binding);
        LOG.info("binding saved.");

        return workflow.getResponse(credentials);
    } catch (IOException | JAXBException | EcsManagementClientException e) {
        throw new ServiceBrokerException(e);
    }
}
 
开发者ID:codedellemc,项目名称:ecs-cf-service-broker,代码行数:27,代码来源:EcsServiceInstanceBindingService.java


示例2: newServiceInstanceBindingCreatedSuccessfully

import org.springframework.cloud.servicebroker.exception.ServiceInstanceBindingExistsException; //导入依赖的package包/类
@Test
public void newServiceInstanceBindingCreatedSuccessfully()
        throws ServiceBrokerException, ServiceInstanceBindingExistsException {

   when(admin.getCredentialsFromSensors(anyString(), anyString(), any(Predicate.class), any(Predicate.class), any(Predicate.class), any(Predicate.class))).thenReturn(new AsyncResult<>(Collections.<String, Object>emptyMap()));
   when(admin.hasEffector(anyString(), anyString(), anyString())).thenReturn(new AsyncResult<>(false));
   when(instanceRepository.findOne(anyString(), anyBoolean())).thenReturn(serviceInstance);
   when(serviceDefinition.getMetadata()).thenReturn(ImmutableMap.of());
   when(brooklynCatalogService.getServiceDefinition(anyString())).thenReturn(serviceDefinition);
   when(serviceInstance.getEntityId()).thenReturn("entityId");
   CreateServiceInstanceBindingRequest request = new CreateServiceInstanceBindingRequest(serviceInstance.getServiceDefinitionId(), "planId", "appGuid", null);
   CreateServiceInstanceBindingResponse binding = bindingService.createServiceInstanceBinding(request.withBindingId(SVC_INST_BIND_ID));

   assertNotNull(binding);
   // TODO assert binding was completed successfully
   //assertEquals(SVC_INST_BIND_ID, binding.getServiceBindingId());
}
 
开发者ID:cloudfoundry-incubator,项目名称:apache-brooklyn-service-broker,代码行数:18,代码来源:BrooklynServiceInstanceBindingServiceTest.java


示例3: createServiceInstanceBinding

import org.springframework.cloud.servicebroker.exception.ServiceInstanceBindingExistsException; //导入依赖的package包/类
@Override
public CreateServiceInstanceBindingResponse createServiceInstanceBinding(final CreateServiceInstanceBindingRequest request) {
    final String bindingId = request.getBindingId();
    final String serviceInstanceId = request.getServiceInstanceId();

    ServiceInstanceBinding binding = bindingRepository.findOne(bindingId);
    if (binding != null) {
        throw new ServiceInstanceBindingExistsException(serviceInstanceId, bindingId);
    }

    ServiceInstance instance = instanceRepository.findOne(serviceInstanceId);
    if (instance == null) {
        throw new CloudKarafkaServiceException("Instance don't exist :" + serviceInstanceId);
    }

    final Map<String, Object> credentials = new HashMap<String, Object>(){
        {
            put("brokers", instance.getCloudKarafkaBrokers());
            put("ca", instance.getCloudKarafkaCa());
            put("cert", instance.getCloudKarafkaCert());
            put("id", instance.getCloudKarafkaId());
            put("private_key", instance.getCloudKarafkaPrivateKey());
            put("topic_prefix", instance.getCloudKarafkaTopicPrefix());
            put("brokers",instance.getCloudKarafkaBrokers());
            put("message",instance.getCloudKarafkaMessage());
        }};

    binding = new ServiceInstanceBinding(bindingId, serviceInstanceId, credentials, null, request.getBoundAppGuid());
    bindingRepository.save(binding);

    return new CreateServiceInstanceAppBindingResponse().withCredentials(credentials);
}
 
开发者ID:ipolyzos,项目名称:cloudkarafka-broker,代码行数:33,代码来源:CloudKarafkaServiceInstanceBindingService.java


示例4: createServiceInstanceBinding

import org.springframework.cloud.servicebroker.exception.ServiceInstanceBindingExistsException; //导入依赖的package包/类
@Override
public CreateServiceInstanceBindingResponse createServiceInstanceBinding(CreateServiceInstanceBindingRequest request) {

    String bindingId = request.getBindingId();
    String serviceInstanceId = request.getServiceInstanceId();

    ServiceInstanceBinding binding = bindingRepository.findOne(bindingId);
    if (binding != null) {
        throw new ServiceInstanceBindingExistsException(serviceInstanceId, bindingId);
    }

    String database = serviceInstanceId;
    String username = bindingId;
    // TODO Password Generator
    String password = "password";

    // TODO check if user already exists in the DB

    mongo.createUser(database, username, password);

    Map<String, Object> credentials =
            Collections.singletonMap("uri", (Object) mongo.getConnectionString(database, username, password));

    binding = new ServiceInstanceBinding(bindingId, serviceInstanceId, credentials, null, request.getBoundAppGuid());
    bindingRepository.save(binding);

    return new CreateServiceInstanceAppBindingResponse().withCredentials(credentials);
}
 
开发者ID:cf-platform-eng,项目名称:mongodb-broker,代码行数:29,代码来源:MongoServiceInstanceBindingService.java


示例5: serviceInstanceCreationFailsWithExistingInstance

import org.springframework.cloud.servicebroker.exception.ServiceInstanceBindingExistsException; //导入依赖的package包/类
@Test(expected = ServiceInstanceBindingExistsException.class)
public void serviceInstanceCreationFailsWithExistingInstance() throws Exception {

	when(repository.findOne(any(String.class)))
			.thenReturn(ServiceInstanceBindingFixture.getServiceInstanceBinding());

	service.createServiceInstanceBinding(buildCreateRequest());
}
 
开发者ID:cf-platform-eng,项目名称:mongodb-broker,代码行数:9,代码来源:MongoServiceInstanceBindingServiceTest.java


示例6: testBinding

import org.springframework.cloud.servicebroker.exception.ServiceInstanceBindingExistsException; //导入依赖的package包/类
@Test
public void testBinding() throws ServiceBrokerException,
        ServiceInstanceBindingExistsException {

    VrServiceInstanceBinding b = TestConfig.getServiceInstanceBinding();
    assertNotNull(b);
    Map<String, Object> m = b.getCredentials();
    assertNotNull(m);
    assertEquals("mysql://root:[email protected]:1234/aDB",
            m.get(VrServiceInstance.URI));
    assertNotNull(b.getId());
    assertEquals("anID", b.getServiceInstanceId());
}
 
开发者ID:cf-platform-eng,项目名称:vrealize-service-broker,代码行数:14,代码来源:VrServiceInstanceBindingServiceTest.java


示例7: checkIfUserExists

import org.springframework.cloud.servicebroker.exception.ServiceInstanceBindingExistsException; //导入依赖的package包/类
@Override
public void checkIfUserExists() throws EcsManagementClientException, IOException {
    ServiceInstance instance = instanceRepository.find(instanceId);
    if (instance == null)
        throw new ServiceInstanceDoesNotExistException(instanceId);
    if (instance.remoteConnectionKeyExists(bindingId))
        throw new ServiceInstanceBindingExistsException(instanceId, bindingId);
}
 
开发者ID:codedellemc,项目名称:ecs-cf-service-broker,代码行数:9,代码来源:RemoteConnectBindingWorkflow.java


示例8: testCreateExistingNamespaceUserFails

import org.springframework.cloud.servicebroker.exception.ServiceInstanceBindingExistsException; //导入依赖的package包/类
/**
 * If the binding-service attempts to create a namespace user that already
 * exists, the service will throw an error.
 *
 */
@Test(expected = ServiceInstanceBindingExistsException.class)
public void testCreateExistingNamespaceUserFails() {
    when(ecs.lookupServiceDefinition(NAMESPACE_SERVICE_ID))
            .thenReturn(namespaceServiceFixture());
    when(ecs.userExists(BINDING_ID)).thenReturn(true);

    bindSvc.createServiceInstanceBinding(namespaceBindingRequestFixture());
}
 
开发者ID:codedellemc,项目名称:ecs-cf-service-broker,代码行数:14,代码来源:EcsServiceInstanceBindingServiceTest.java


示例9: testCreateExistingBucketUserFails

import org.springframework.cloud.servicebroker.exception.ServiceInstanceBindingExistsException; //导入依赖的package包/类
/**
 * If the binding-service attempts to create a bucket user that already
 * exists, the service will throw an error.
 *
 * @throws EcsManagementClientException if ecs management API returns an error
 */
@Test(expected = ServiceInstanceBindingExistsException.class)
public void testCreateExistingBucketUserFails()
        throws EcsManagementClientException {
    when(ecs.lookupServiceDefinition(BUCKET_SERVICE_ID))
            .thenReturn(bucketServiceFixture());
    when(ecs.getObjectEndpoint()).thenReturn(OBJ_ENDPOINT);
    when(ecs.userExists(BINDING_ID)).thenReturn(true);

    bindSvc.createServiceInstanceBinding(
            bucketBindingPermissionRequestFixture());
}
 
开发者ID:codedellemc,项目名称:ecs-cf-service-broker,代码行数:18,代码来源:EcsServiceInstanceBindingServiceTest.java


示例10: createBindingWithDuplicateIdFails

import org.springframework.cloud.servicebroker.exception.ServiceInstanceBindingExistsException; //导入依赖的package包/类
@Test
public void createBindingWithDuplicateIdFails() throws Exception {
	when(serviceInstanceBindingService.createServiceInstanceBinding(eq(createRequest)))
		.thenThrow(new ServiceInstanceBindingExistsException(createRequest.getServiceInstanceId(), createRequest.getBindingId()));

	setupCatalogService(createRequest.getServiceDefinitionId());

	mockMvc.perform(put(buildCreateUrl(false))
			.content(DataFixture.toJson(createRequest))
			.accept(MediaType.APPLICATION_JSON)
			.contentType(MediaType.APPLICATION_JSON))
			.andExpect(status().isConflict())
			.andExpect(jsonPath("$.description", containsString(createRequest.getServiceInstanceId())))
			.andExpect(jsonPath("$.description", containsString(createRequest.getBindingId())));
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-cloudfoundry-service-broker,代码行数:16,代码来源:ServiceInstanceBindingControllerIntegrationTest.java


示例11: newServiceInstanceBindingCreatedSuccessfullyWithBindEffector

import org.springframework.cloud.servicebroker.exception.ServiceInstanceBindingExistsException; //导入依赖的package包/类
@Test
public void newServiceInstanceBindingCreatedSuccessfullyWithBindEffector()
        throws ServiceBrokerException, ServiceInstanceBindingExistsException, PollingException {
   when(admin.getRestApi()).thenReturn(brooklynApi);
   when(admin.getCredentialsFromSensors(
           anyString(),
           anyString(),
           any(Predicate.class),
           any(Predicate.class),
           any(Predicate.class),
           any(Predicate.class)
   )).thenReturn(new AsyncResult<>(Collections.<String, Object>emptyMap()));
   when(admin.hasEffector(anyString(), anyString(), anyString())).thenReturn(new AsyncResult<>(true));
   when(admin.invokeEffector(anyString(), anyString(), anyString(), anyString(), anyMap())).thenReturn(new AsyncResult<>(TASK_RESPONSE_COMPLETE));
   when(brooklynApi.getActivityApi()).thenReturn(activityApi);
   when(activityApi.get(anyString()))
           .thenReturn(TASK_SUMMARY_INCOMPLETE)
           .thenReturn(TASK_SUMMARY_INCOMPLETE)
           .thenReturn(TASK_SUMMARY_INCOMPLETE)
           .thenReturn(TASK_SUMMARY_INCOMPLETE)
           .thenReturn(TASK_SUMMARY_COMPLETE);
   doCallRealMethod().when(admin).blockUntilTaskCompletes(anyString());
   doCallRealMethod().when(admin).blockUntilTaskCompletes(anyString(), any(Duration.class), any(Object[].class));
   when(instanceRepository.findOne(anyString(), anyBoolean())).thenReturn(serviceInstance);
   when(serviceDefinition.getMetadata()).thenReturn(ImmutableMap.of());
   when(brooklynCatalogService.getServiceDefinition(anyString())).thenReturn(serviceDefinition);
   CreateServiceInstanceBindingRequest request = new CreateServiceInstanceBindingRequest(serviceInstance.getServiceDefinitionId(), "planId", "appGuid", null);
   CreateServiceInstanceBindingResponse binding = bindingService.createServiceInstanceBinding(request.withBindingId(SVC_INST_BIND_ID));

   // TODO assert binding was completed successfully
   //assertEquals(SVC_INST_BIND_ID, binding.getServiceBindingId());
}
 
开发者ID:cloudfoundry-incubator,项目名称:apache-brooklyn-service-broker,代码行数:33,代码来源:BrooklynServiceInstanceBindingServiceTest.java


示例12: testServiceInstanceBindingFailureWithBindEffector

import org.springframework.cloud.servicebroker.exception.ServiceInstanceBindingExistsException; //导入依赖的package包/类
@Test(expected = RuntimeException.class)
public void testServiceInstanceBindingFailureWithBindEffector()
        throws ServiceBrokerException, ServiceInstanceBindingExistsException, PollingException {
   when(admin.getRestApi()).thenReturn(brooklynApi);
   when(admin.getCredentialsFromSensors(
           anyString(),
           anyString(),
           any(Predicate.class),
           any(Predicate.class),
           any(Predicate.class),
           any(Predicate.class)
   )).thenReturn(new AsyncResult<>(Collections.<String, Object>emptyMap()));
   when(admin.hasEffector(anyString(), anyString(), anyString())).thenReturn(new AsyncResult<>(true));
   when(admin.invokeEffector(anyString(), anyString(), anyString(), anyString(), anyMap())).thenReturn(new AsyncResult<>(null));
   when(brooklynApi.getActivityApi()).thenReturn(activityApi);
   when(activityApi.get(anyString()))
           .thenReturn(TASK_SUMMARY_INCOMPLETE)
           .thenReturn(TASK_SUMMARY_INCOMPLETE)
           .thenReturn(TASK_SUMMARY_INCOMPLETE)
           .thenReturn(TASK_SUMMARY_INCOMPLETE)
           .thenReturn(TASK_SUMMARY_COMPLETE);
   doCallRealMethod().when(admin).blockUntilTaskCompletes(anyString());
   doCallRealMethod().when(admin).blockUntilTaskCompletes(anyString(), any(Duration.class), any(Object[].class));
   when(instanceRepository.findOne(anyString(), anyBoolean())).thenReturn(serviceInstance);
   when(serviceDefinition.getMetadata()).thenReturn(ImmutableMap.of());
   when(brooklynCatalogService.getServiceDefinition(anyString())).thenReturn(serviceDefinition);
   CreateServiceInstanceBindingRequest request = new CreateServiceInstanceBindingRequest(serviceInstance.getServiceDefinitionId(), "planId", "appGuid", null);
   bindingService.createServiceInstanceBinding(request.withBindingId(SVC_INST_BIND_ID));
}
 
开发者ID:cloudfoundry-incubator,项目名称:apache-brooklyn-service-broker,代码行数:30,代码来源:BrooklynServiceInstanceBindingServiceTest.java


示例13: testWhitelistCreatedSuccessfully

import org.springframework.cloud.servicebroker.exception.ServiceInstanceBindingExistsException; //导入依赖的package包/类
@Test
public void testWhitelistCreatedSuccessfully() throws ServiceInstanceBindingExistsException, ServiceBrokerException {

   bindingService = new BrooklynServiceInstanceBindingService(new BrooklynRestAdmin(brooklynApi, httpClient, config), bindingRepository, instanceRepository, brooklynCatalogService);

   when(admin.getCredentialsFromSensors(anyString(), anyString(), any(Predicate.class), any(Predicate.class), any(Predicate.class), any(Predicate.class))).thenCallRealMethod();

   when(brooklynApi.getSensorApi()).thenReturn(sensorApi);
   when(sensorApi.list(anyString(), anyString())).thenReturn(ImmutableList.of(
           new SensorSummary("my.sensor", "my sensor type", "my sensor description", ImmutableMap.of()),
           new SensorSummary("sensor.one.name", "sensor one type", "sensor one description", ImmutableMap.of())
   ));
   when(brooklynApi.getEntityApi()).thenReturn(entityApi);
   when(entityApi.list(any())).thenReturn(ImmutableList.of(
           new EntitySummary("entityId", "name", "entityType", "catalogItemId", ImmutableMap.of())
   ));
   when(instanceRepository.findOne(anyString(), anyBoolean())).thenReturn(serviceInstance);
   when(brooklynCatalogService.getServiceDefinition(Mockito.anyString())).thenReturn(serviceDefinition);
   when(serviceInstance.getServiceDefinitionId()).thenReturn(SVC_DEFN_ID);
   when(serviceDefinition.getMetadata()).thenReturn(ImmutableMap.of("planYaml", WHITELIST_YAML));
   when(brooklynApi.getEffectorApi()).thenReturn(effectorApi);
   when(effectorApi.invoke(anyString(), anyString(), anyString(), anyString(), anyMap())).thenReturn(bindEffectorResponse);
   when(sensorApi.get(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), anyBoolean())).thenReturn("");
   when(serviceInstance.getEntityId()).thenReturn("entityId");

   CreateServiceInstanceBindingRequest request = new CreateServiceInstanceBindingRequest(serviceInstance.getServiceDefinitionId(), "planId", "appGuid", null);
   CreateServiceInstanceBindingResponse binding = bindingService.createServiceInstanceBinding(request.withBindingId(SVC_INST_BIND_ID));

   BrooklynServiceInstanceBinding expectedBinding = new BrooklynServiceInstanceBinding(SVC_INST_BIND_ID, serviceInstance.getServiceInstanceId(), EXPECTED_CREDENTIALS, "appGuid", "childEntityId");

   // TODO: test binding properly
   //assertEquals(expectedBinding.getAppGuid(), binding.getAppGuid());
   //assertEquals(expectedBinding.getCredentials(), binding.getCredentials());
   //assertEquals(expectedBinding.getServiceBindingId(), binding.getServiceBindingId());
   //assertEquals(expectedBinding.getServiceInstanceId(), binding.getServiceInstanceId());
}
 
开发者ID:cloudfoundry-incubator,项目名称:apache-brooklyn-service-broker,代码行数:37,代码来源:BrooklynServiceInstanceBindingServiceTest.java


示例14: serviceInstanceCreationFailsWithExistingInstance

import org.springframework.cloud.servicebroker.exception.ServiceInstanceBindingExistsException; //导入依赖的package包/类
@Test(expected = ServiceInstanceBindingExistsException.class)
public void serviceInstanceCreationFailsWithExistingInstance()
        throws ServiceBrokerException, ServiceInstanceBindingExistsException {

   when(bindingRepository.findOne(anyString()))
           .thenReturn(TEST_SERVICE_INSTANCE_BINDING);
   when(admin.getApplicationSensors(anyString())).thenReturn(new AsyncResult<>(Collections.<String, Object>emptyMap()));
   CreateServiceInstanceBindingRequest request = new CreateServiceInstanceBindingRequest(serviceInstance.getServiceDefinitionId(), "planId", "appGuid", null);

   bindingService.createServiceInstanceBinding(request.withBindingId(SVC_INST_BIND_ID));
   bindingService.createServiceInstanceBinding(request.withBindingId(SVC_INST_BIND_ID));
}
 
开发者ID:cloudfoundry-incubator,项目名称:apache-brooklyn-service-broker,代码行数:13,代码来源:BrooklynServiceInstanceBindingServiceTest.java


示例15: serviceInstanceBindingRetrievedSuccessfully

import org.springframework.cloud.servicebroker.exception.ServiceInstanceBindingExistsException; //导入依赖的package包/类
@Test
public void serviceInstanceBindingRetrievedSuccessfully()
        throws ServiceBrokerException, ServiceInstanceBindingExistsException {

   BrooklynServiceInstanceBinding binding = TEST_SERVICE_INSTANCE_BINDING;
   when(bindingRepository.findOne(anyString())).thenReturn(binding);

   assertEquals(binding.getServiceBindingId(), bindingService.getServiceInstanceBinding(binding.getServiceBindingId()).getServiceBindingId());
}
 
开发者ID:cloudfoundry-incubator,项目名称:apache-brooklyn-service-broker,代码行数:10,代码来源:BrooklynServiceInstanceBindingServiceTest.java


示例16: serviceInstanceBindingDeletedSuccessfully

import org.springframework.cloud.servicebroker.exception.ServiceInstanceBindingExistsException; //导入依赖的package包/类
@Test
public void serviceInstanceBindingDeletedSuccessfully()
        throws ServiceBrokerException, ServiceInstanceBindingExistsException {

   BrooklynServiceInstanceBinding binding = TEST_SERVICE_INSTANCE_BINDING;
   when(bindingRepository.findOne(anyString())).thenReturn(binding);
   when(instanceRepository.findOne(anyString(), any(Boolean.class))).thenReturn(serviceInstance);
   when(serviceInstance.getServiceDefinitionId()).thenReturn(SVC_DEFN_ID);
   when(admin.invokeEffector(anyString(), anyString(), anyString(), anyString(), anyMap())).thenReturn(new AsyncResult<>("effector called"));

   DeleteServiceInstanceBindingRequest request = new DeleteServiceInstanceBindingRequest(serviceInstance.getServiceInstanceId(), binding.getServiceBindingId(), "serviceId", "planId", null);
}
 
开发者ID:cloudfoundry-incubator,项目名称:apache-brooklyn-service-broker,代码行数:13,代码来源:BrooklynServiceInstanceBindingServiceTest.java


示例17: createServiceInstanceBinding

import org.springframework.cloud.servicebroker.exception.ServiceInstanceBindingExistsException; //导入依赖的package包/类
@Override
public CreateServiceInstanceBindingResponse createServiceInstanceBinding(CreateServiceInstanceBindingRequest request) {

	String bindingId = request.getBindingId();
	String serviceInstanceId = request.getServiceInstanceId();

	ServiceInstanceBinding binding = bindingRepository.findOne(bindingId);
	if (binding != null) {
		throw new ServiceInstanceBindingExistsException(serviceInstanceId, bindingId);
	}

	String database = serviceInstanceId;
	String username = bindingId;
	String password = RandomStringUtils.randomAlphanumeric(25);
	
	// TODO check if user already exists in the DB

	mongo.createUser(database, username, password);
	
	Map<String, Object> credentials =
			Collections.singletonMap("uri", (Object) mongo.getConnectionString(database, username, password));

	binding = new ServiceInstanceBinding(bindingId, serviceInstanceId, credentials, null, request.getBoundAppGuid());
	bindingRepository.save(binding);
	
	return new CreateServiceInstanceAppBindingResponse().withCredentials(credentials);
}
 
开发者ID:spring-cloud-samples,项目名称:cloudfoundry-service-broker,代码行数:28,代码来源:MongoServiceInstanceBindingService.java


示例18: createServiceInstanceBinding

import org.springframework.cloud.servicebroker.exception.ServiceInstanceBindingExistsException; //导入依赖的package包/类
@Override
public CreateServiceInstanceBindingResponse createServiceInstanceBinding(
        CreateServiceInstanceBindingRequest request)
        throws ServiceInstanceBindingExistsException,
        ServiceBrokerException {

    String bindingId = request.getBindingId();

    VrServiceInstanceBinding sib = repository.get(OBJECT_ID, bindingId);
    if (sib != null) {
        throw new ServiceInstanceBindingExistsException(request.getServiceInstanceId(), bindingId);
    }

    String serviceInstanceId = request.getServiceInstanceId();
    VrServiceInstance si = serviceInstanceService
            .getServiceInstance(serviceInstanceId);

    if (si == null) {
        throw new ServiceBrokerException("service instance for binding: "
                + bindingId + " is missing.");
    }

    // not supposed to happen per the spec, but better check...
    if (si.isInProgress()) {
        throw new ServiceBrokerException(
                "ServiceInstance operation is still in progress.");
    }

    LOG.info("creating binding for service instance: "
            + request.getServiceInstanceId() + " service: "
            + request.getServiceInstanceId());

    VrServiceInstanceBinding binding = new VrServiceInstanceBinding(bindingId,
            serviceInstanceId, si.getCredentials(), null,
            request.getBindResource());

    LOG.info("saving binding: " + binding.getId());

    repository.put(OBJECT_ID, binding.getId(), binding);

    return new CreateServiceInstanceAppBindingResponse().withCredentials(si.getCredentials());
}
 
开发者ID:cf-platform-eng,项目名称:vrealize-service-broker,代码行数:43,代码来源:VrServiceInstanceBindingService.java


示例19: checkIfUserExists

import org.springframework.cloud.servicebroker.exception.ServiceInstanceBindingExistsException; //导入依赖的package包/类
public void checkIfUserExists() throws EcsManagementClientException, IOException {
    if (ecs.userExists(bindingId))
        throw new ServiceInstanceBindingExistsException(instanceId, bindingId);
}
 
开发者ID:codedellemc,项目名称:ecs-cf-service-broker,代码行数:5,代码来源:BucketBindingWorkflow.java


示例20: handleException

import org.springframework.cloud.servicebroker.exception.ServiceInstanceBindingExistsException; //导入依赖的package包/类
@ExceptionHandler(ServiceInstanceBindingExistsException.class)
public ResponseEntity<ErrorMessage> handleException(ServiceInstanceBindingExistsException ex) {
	log.debug("Service instance binding already exists: ", ex);
	return getErrorResponse(ex.getMessage(), HttpStatus.CONFLICT);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-cloudfoundry-service-broker,代码行数:6,代码来源:ServiceInstanceBindingController.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java AnnotationParserFactory类代码示例发布时间:2022-05-23
下一篇:
Java TransportConstants类代码示例发布时间: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