当前位置: 首页>>代码示例>>Java>>正文


Java ServiceInstanceExistsException类代码示例

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


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


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