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

Java ServiceInstanceExistsException类代码示例

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

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



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

示例1: provisionTest_kerberosEnabled_createsDBAddGrants

import org.cloudfoundry.community.servicebroker.exception.ServiceInstanceExistsException; //导入依赖的package包/类
@Test
public void provisionTest_kerberosEnabled_createsDBAddGrants()
    throws ServiceBrokerException, ServiceInstanceExistsException {
  //given
  when(hiveBindingClient.isKerberosEnabled()).thenReturn(true);
  HiveShared toTest = new HiveShared(hiveBindingClient, jdbcOperations);

  //when
  toTest.provision(getServiceInstance("04d4e5d2-0568-11e6-8d01-00155d3d2c21"));

  //then
  InOrder inOrder = inOrder(jdbcOperations);
  inOrder.verify(jdbcOperations)
      .execute("create database if not exists `04d4e5d2_0568_11e6_8d01_00155d3d2c21`");
  inOrder.verify(jdbcOperations)
      .execute("GRANT ALL ON DATABASE `04d4e5d2_0568_11e6_8d01_00155d3d2c21` "
               + "TO ROLE `f0487d90-fde6-4da1-a933-03f38776115d`");
}
 
开发者ID:trustedanalytics,项目名称:hive-broker,代码行数:19,代码来源:HiveSharedTest.java


示例2: createServiceInstance

import org.cloudfoundry.community.servicebroker.exception.ServiceInstanceExistsException; //导入依赖的package包/类
@Override
public ServiceInstance createServiceInstance(CreateServiceInstanceRequest request) throws ServiceInstanceExistsException, ServiceBrokerException {
    DbDumperServiceInstance dbDumperServiceInstance = repository.findOne(request.getServiceInstanceId());
    if (dbDumperServiceInstance != null && !dbDumperServiceInstance.isDeleted()) {
        throw new ServiceInstanceExistsException(new ServiceInstance(request));
    }
    DbDumperPlan dbDumperPlan = dbDumperPlanRepo.findOne(request.getPlanId());
    if (dbDumperPlan == null) {
        throw new ServiceBrokerException("Plan '" + request.getPlanId() + "' is not available.");
    }
    if (dbDumperServiceInstance != null && dbDumperServiceInstance.isDeleted()) {
        dbDumperServiceInstance.setDeleted(false);
    }
    if (dbDumperServiceInstance == null) {
        dbDumperServiceInstance = new DbDumperServiceInstance(
                request.getServiceInstanceId(),
                request.getPlanId(),
                request.getOrganizationGuid(),
                request.getSpaceGuid(),
                appUri + DASHBOARD_ROUTE,
                dbDumperPlan);
    }

    this.createDump(request.getParameters(), dbDumperServiceInstance);
    return new ServiceInstance(request).withDashboardUrl(appUri + DASHBOARD_ROUTE + dbDumperServiceInstance.getServiceInstanceId()).withAsync(true);
}
 
开发者ID:orange-cloudfoundry,项目名称:db-dumper-service,代码行数:27,代码来源:DbDumperServiceInstanceService.java


示例3: itReturnsTheCorrectListOfServices

import org.cloudfoundry.community.servicebroker.exception.ServiceInstanceExistsException; //导入依赖的package包/类
@Test
public void itReturnsTheCorrectListOfServices()
		throws ServiceBrokerException, ServiceInstanceExistsException {

	Collection<Pair<String, ServiceInstance>> instances = createInstances();

	when(instanceManager.getInstances()).thenReturn(instances);

	List<InstancePair> provisionedInstances = service
			.getProvisionedInstances();
	assertThat(provisionedInstances, hasSize(5));
	assertTrue(provisionedInstances.contains(new InstancePair(
			"source_instance_id", "copy_instance2")));
	assertTrue(provisionedInstances.contains(new InstancePair(
			"source_instance_id", "source_instance_id")));
}
 
开发者ID:krujos,项目名称:data-lifecycle-service-broker,代码行数:17,代码来源:LCServiceInstanceServiceCopyTest.java


示例4: createServiceInstance

import org.cloudfoundry.community.servicebroker.exception.ServiceInstanceExistsException; //导入依赖的package包/类
@Override
public ServiceInstance createServiceInstance(CreateServiceInstanceRequest createServiceInstanceRequest)
        throws ServiceInstanceExistsException, ServiceBrokerException {
    String serviceInstanceId = createServiceInstanceRequest.getServiceInstanceId();
    String serviceId = createServiceInstanceRequest.getServiceDefinitionId();
    String planId = createServiceInstanceRequest.getPlanId();
    String organizationGuid = createServiceInstanceRequest.getOrganizationGuid();
    String spaceGuid = createServiceInstanceRequest.getSpaceGuid();
    try {
        db.createDatabaseForInstance(serviceInstanceId, serviceId, planId, organizationGuid, spaceGuid);
        role.createRoleForInstance(serviceInstanceId);
    } catch (SQLException e) {
        logger.error("Error while creating service instance '" + serviceInstanceId + "'", e);
        throw new ServiceBrokerException(e.getMessage());
    }
    return new ServiceInstance(createServiceInstanceRequest);
}
 
开发者ID:cloudfoundry-community,项目名称:postgresql-cf-service-broker,代码行数:18,代码来源:PostgreSQLServiceInstanceService.java


示例5: provision

import org.cloudfoundry.community.servicebroker.exception.ServiceInstanceExistsException; //导入依赖的package包/类
@Override
public void provision(ServiceInstance serviceInstance, Optional<Map<String, Object>> parameters)
    throws ServiceInstanceExistsException, ServiceBrokerException {
  if (!isMapNotNullAndNotEmpty(parameters)) {
    throw new ServiceBrokerException("This plan require parametere uri");
  }
  String uri =
      getParameterUri(parameters.get(), URI_KEY).orElseThrow(
          () -> new ServiceBrokerException("No required parameter uri")).toString();
  LOGGER.info("Detected parameter path: " + uri);

  HdfsBrokerInstancePath instance = HdfsBrokerInstancePath.createInstance(uri);
  credentialsStore.save(
      ImmutableMap.<String, Object>builder()
          .putAll(credentialsStore.get(instance.getInstanceId())).put(URI_KEY, uri).build(),
      UUID.fromString(serviceInstance.getServiceInstanceId()));
}
 
开发者ID:trustedanalytics,项目名称:hdfs-broker,代码行数:18,代码来源:HdfsPlanGetUserDirectory.java


示例6: provision

import org.cloudfoundry.community.servicebroker.exception.ServiceInstanceExistsException; //导入依赖的package包/类
@Override
public void provision(ServiceInstance serviceInstance)
    throws ServiceInstanceExistsException, ServiceBrokerException {
  operations.execute(String.format("create database if not exists `%s`",
                                   DbNameNormalizer.create().
                                       normalize(serviceInstance.getServiceInstanceId())));

  if (bindingOperations.isKerberosEnabled()) {
    operations.execute(String.format("GRANT ALL ON DATABASE `%s` TO ROLE `%s`",
                                     DbNameNormalizer.create().
                                         normalize(serviceInstance.getServiceInstanceId()),
                                     serviceInstance.getOrganizationGuid()));
  }
}
 
开发者ID:trustedanalytics,项目名称:hive-broker,代码行数:15,代码来源:HiveShared.java


示例7: provisionTest_kerberosDisabled_createsDB

import org.cloudfoundry.community.servicebroker.exception.ServiceInstanceExistsException; //导入依赖的package包/类
@Test
public void provisionTest_kerberosDisabled_createsDB()
    throws ServiceBrokerException, ServiceInstanceExistsException {
  //given
  when(hiveBindingClient.isKerberosEnabled()).thenReturn(false);
  HiveShared toTest = new HiveShared(hiveBindingClient, jdbcOperations);

  //when
  toTest.provision(getServiceInstance("04d4e5d2-0568-11e6-8d01-00155d3d2c21"));

  //then
  verify(jdbcOperations, only())
      .execute("create database if not exists `04d4e5d2_0568_11e6_8d01_00155d3d2c21`");
}
 
开发者ID:trustedanalytics,项目名称:hive-broker,代码行数:15,代码来源:HiveSharedTest.java


示例8: when_unsupported_database_type_is_passed_it_should_give_back_a_message_to_say_its_not_supported

import org.cloudfoundry.community.servicebroker.exception.ServiceInstanceExistsException; //导入依赖的package包/类
@Test
public void when_unsupported_database_type_is_passed_it_should_give_back_a_message_to_say_its_not_supported() throws ServiceInstanceExistsException, ServiceBrokerAsyncRequiredException {
    CreateServiceInstanceRequest instanceRequest = serviceBrokerRequestForge.createNewDumpRequest("hdfs://my.db.com/mydb", "instance-1");
    try {
        this.dbDumperServiceInstanceService.createServiceInstance(instanceRequest);
        fail("It should raise an ServiceBrokerException");
    } catch (ServiceBrokerException e) {
        assertThat(e.getMessage()).contains("The database driver 'hdfs' is not supported");
    }
}
 
开发者ID:orange-cloudfoundry,项目名称:db-dumper-service,代码行数:11,代码来源:DbDumperServiceInstanceServiceIT.java


示例9: when_a_service_name_passed_not_exists_it_should_give_back_a_message_to_say_it

import org.cloudfoundry.community.servicebroker.exception.ServiceInstanceExistsException; //导入依赖的package包/类
@Test
public void when_a_service_name_passed_not_exists_it_should_give_back_a_message_to_say_it() throws ServiceInstanceExistsException, ServiceBrokerAsyncRequiredException {
    serviceBrokerRequestForge.setOrg("org");
    serviceBrokerRequestForge.setOrgGuid("org-1");
    serviceBrokerRequestForge.setSpace("space");
    serviceBrokerRequestForge.setSpaceGuid("space-1");
    serviceBrokerRequestForge.setUserToken("usertoken");
    CreateServiceInstanceRequest instanceRequest = serviceBrokerRequestForge.createNewDumpRequest(CloudFoundryClientFake.SERVICE_NOT_ACCESSIBLE, "instance-1");
    try {
        this.dbDumperServiceInstanceService.createServiceInstance(instanceRequest);
        fail("It should raise an ServiceBrokerException");
    } catch (ServiceBrokerException e) {
        assertThat(e.getMessage()).contains("User don't have access to service '" + CloudFoundryClientFake.SERVICE_NOT_ACCESSIBLE + "'");
    }
}
 
开发者ID:orange-cloudfoundry,项目名称:db-dumper-service,代码行数:16,代码来源:DbDumperServiceInstanceServiceIT.java


示例10: when_creating_dump_from_non_existing_service_which_already_exist_it_should_raise_an_exception

import org.cloudfoundry.community.servicebroker.exception.ServiceInstanceExistsException; //导入依赖的package包/类
@Test
public void when_creating_dump_from_non_existing_service_which_already_exist_it_should_raise_an_exception() {
    when(repository.findOne(anyString())).thenReturn(dbDumperServiceInstance);
    try {
        instanceService.createServiceInstance(createRequest);
        fail("Should throw an ServiceInstanceExistsException");
    } catch (Exception e) {
        assertThat(e).isInstanceOf(ServiceInstanceExistsException.class);
    }
}
 
开发者ID:orange-cloudfoundry,项目名称:db-dumper-service,代码行数:11,代码来源:DbDumperServiceInstanceServiceTest.java


示例11: when

import org.cloudfoundry.community.servicebroker.exception.ServiceInstanceExistsException; //导入依赖的package包/类
@Test
public void when_creating_dump_from_non_existing_service_with_target_parameter_it_should_return_a_service_instance() throws ServiceBrokerException, ServiceInstanceExistsException {
    when(repository.findOne(anyString())).thenReturn(null);
    params.put("db", targetDatabase);
    ServiceInstance serviceInstance = instanceService.createServiceInstance(createRequest);
    assertServiceInstanceCreateRequest(serviceInstance);
}
 
开发者ID:orange-cloudfoundry,项目名称:db-dumper-service,代码行数:8,代码来源:DbDumperServiceInstanceServiceTest.java


示例12: createServiceInstance

import org.cloudfoundry.community.servicebroker.exception.ServiceInstanceExistsException; //导入依赖的package包/类
@Override
public ServiceInstance createServiceInstance(CreateServiceInstanceRequest request)
        throws ServiceInstanceExistsException, ServiceBrokerException {

    PersistableServiceInstance psi = new PersistableServiceInstance(
            request.getServiceDefinitionId(),
            request.getPlanId(), request.getOrganizationGuid(),
            request.getSpaceGuid(), request.getServiceInstanceId());

    return this.serviceInstanceRepository.save(psi);

}
 
开发者ID:joshlong,项目名称:cloudfoundry-ftp-service-broker,代码行数:13,代码来源:FtpServiceInstanceService.java


示例13: createServiceInstance

import org.cloudfoundry.community.servicebroker.exception.ServiceInstanceExistsException; //导入依赖的package包/类
@Override
public ServiceInstance createServiceInstance(
		CreateServiceInstanceRequest request)
		throws ServiceInstanceExistsException, ServiceBrokerException,
		ServiceBrokerAsyncRequiredException {

	String id = request.getServiceInstanceId();
	log(id, "Creating service instance", IN_PROGRESS);
	throwIfDuplicate(id);
	throwIfSync(request);

	ServiceInstance instance = null;

	if (PRODUCTION.equals(request.getPlanId())) {
		instance = new ServiceInstance(request).isAsync(false)
				.withLastOperation(
						new ServiceInstanceLastOperation("Provisioned",
								OperationState.SUCCEEDED));
		instanceManager.saveInstance(instance, sourceInstanceId);
	} else {
		instance = new ServiceInstance(request).isAsync(true)
				.withLastOperation(
						new ServiceInstanceLastOperation(
								"Creating instance",
								OperationState.IN_PROGRESS));
		instanceManager.saveInstance(instance, null);
		provision(request, id, instance);
	}
	return instance;
}
 
开发者ID:krujos,项目名称:data-lifecycle-service-broker,代码行数:31,代码来源:LCServiceInstanceService.java


示例14: throwIfDuplicate

import org.cloudfoundry.community.servicebroker.exception.ServiceInstanceExistsException; //导入依赖的package包/类
private void throwIfDuplicate(String id)
		throws ServiceInstanceExistsException {
	if (null != instanceManager.getInstance(id)) {
		log(id, "Duplicate service instance requested", FAILED);
		throw new ServiceInstanceExistsException(
				instanceManager.getInstance(id));
	}
}
 
开发者ID:krujos,项目名称:data-lifecycle-service-broker,代码行数:9,代码来源:LCServiceInstanceService.java


示例15: setUp

import org.cloudfoundry.community.servicebroker.exception.ServiceInstanceExistsException; //导入依赖的package包/类
@Before
public void setUp() throws ServiceInstanceExistsException,
		ServiceBrokerException {
	MockitoAnnotations.initMocks(this);
	service = new LCServiceInstanceService(copyProvider, dataProvider,
			"source_instance_id", brokerRepo, instanceManager,
			new SyncTaskExecutor(), dataProviderService);

}
 
开发者ID:krujos,项目名称:data-lifecycle-service-broker,代码行数:10,代码来源:LCServiceInstanceServiceCopyTest.java


示例16: createServiceInstance

import org.cloudfoundry.community.servicebroker.exception.ServiceInstanceExistsException; //导入依赖的package包/类
private void createServiceInstance() throws ServiceInstanceExistsException,
		ServiceBrokerException, ServiceBrokerAsyncRequiredException {
	when(copyProvider.createCopy("source_instance_id")).thenReturn(
			"copy_instance");
	CreateServiceInstanceRequest createServiceInstanceRequest = newCreateServiceInstanceRequest();

	instance = service.createServiceInstance(createServiceInstanceRequest);
}
 
开发者ID:krujos,项目名称:data-lifecycle-service-broker,代码行数:9,代码来源:LCServiceInstanceServiceCopyTest.java


示例17: itShouldStoreWhatItCreates

import org.cloudfoundry.community.servicebroker.exception.ServiceInstanceExistsException; //导入依赖的package包/类
@Test
public void itShouldStoreWhatItCreates()
		throws ServiceInstanceExistsException, ServiceBrokerException,
		ServiceBrokerAsyncRequiredException {
	createServiceInstance();
	assertThat(instance.getServiceInstanceLastOperation().getState(),
			is(equalTo("succeeded")));
	verify(instanceManager).saveInstance(instance, "copy_instance");
}
 
开发者ID:krujos,项目名称:data-lifecycle-service-broker,代码行数:10,代码来源:LCServiceInstanceServiceCopyTest.java


示例18: createInstances

import org.cloudfoundry.community.servicebroker.exception.ServiceInstanceExistsException; //导入依赖的package包/类
private Collection<Pair<String, ServiceInstance>> createInstances()
		throws ServiceInstanceExistsException, ServiceBrokerException {
	Collection<Pair<String, ServiceInstance>> instances = new ArrayList<Pair<String, ServiceInstance>>();
	IntStream.range(0, 4).forEach(
			i -> instances.add(new ImmutablePair<String, ServiceInstance>(
					"copy_instance" + i, null)));
	instances.add(new ImmutablePair<String, ServiceInstance>(
			"source_instance_id", null));
	return instances;
}
 
开发者ID:krujos,项目名称:data-lifecycle-service-broker,代码行数:11,代码来源:LCServiceInstanceServiceCopyTest.java


示例19: itShouldThrowIfInstanceAlreadyExists

import org.cloudfoundry.community.servicebroker.exception.ServiceInstanceExistsException; //导入依赖的package包/类
@Test(expected = ServiceInstanceExistsException.class)
public void itShouldThrowIfInstanceAlreadyExists() throws Exception {
	when(instanceManager.getInstance(any())).thenReturn(
			new ServiceInstance(new CreateServiceInstanceRequest(null,
					null, null, null, true)));
	createServiceInstance();
}
 
开发者ID:krujos,项目名称:data-lifecycle-service-broker,代码行数:8,代码来源:LCServiceInstanceServiceCopyTest.java


示例20: testCreateServiceInstance_instanceAlreadyExists_throwsException

import org.cloudfoundry.community.servicebroker.exception.ServiceInstanceExistsException; //导入依赖的package包/类
@Test(expected = ServiceInstanceExistsException.class)
public void testCreateServiceInstance_instanceAlreadyExists_throwsException()
        throws Exception {
    ServiceInstance instance = getServiceInstance("id");
    Location storingLocation = Location.newInstance("id");
    when(store.getById(storingLocation)).thenReturn(Optional.of(instance));
    CreateServiceInstanceRequest request = new CreateServiceInstanceRequest(
            getServiceDefinition().getId(), instance.getPlanId(), instance.getOrganizationGuid(), instance.getSpaceGuid()).
            withServiceInstanceId(instance.getServiceInstanceId()).withServiceDefinition(getServiceDefinition());

    when(store.getById(storingLocation)).thenReturn(Optional.of(instance));
    service.createServiceInstance(request);
}
 
开发者ID:trustedanalytics,项目名称:broker-store,代码行数:14,代码来源:ServiceInstanceServiceStoreTest.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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