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


Java CreateServiceInstanceRequest类代码示例

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


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

示例1: testCreateInstanceBindingPlanShared_success_shouldReturnBinding

import org.cloudfoundry.community.servicebroker.model.CreateServiceInstanceRequest; //导入依赖的package包/类
@Test
public void testCreateInstanceBindingPlanShared_success_shouldReturnBinding() throws Exception {
  String instanceId = UUID.randomUUID().toString();
  CreateServiceInstanceRequest request = getCreateInstanceRequest(instanceId,
                                                                  "shared-plan");
  instanceService.createServiceInstance(request);
  CreateServiceInstanceBindingRequest bindingRequest =
      new CreateServiceInstanceBindingRequest(getServiceInstance(instanceId)
                                                  .getServiceDefinitionId(),
                                              "FAKE-BASE_GUID-shared-plan",
                                              "appGuid").withBindingId("bindingId")
          .withServiceInstanceId(instanceId);
  ServiceInstanceBinding binding = instanceBindingService.createServiceInstanceBinding(
      bindingRequest);
  assertThat(binding.getServiceInstanceId(), equalTo(instanceId));
}
 
开发者ID:trustedanalytics,项目名称:hive-broker,代码行数:17,代码来源:HiveBrokerIntegrationTest.java

示例2: createServiceInstance

import org.cloudfoundry.community.servicebroker.model.CreateServiceInstanceRequest; //导入依赖的package包/类
@Override
public ServiceInstance createServiceInstance(CreateServiceInstanceRequest request) throws ServiceInstanceExistsException, ServiceBrokerException, ServiceBrokerAsyncRequiredException {
    ServiceInstance serviceInstance = new ServiceInstance(request);
    serviceInstance.withDashboardUrl(appUri);
    serviceInstance.withAsync(false);
    if (this.oauthRegServiceInstanceRepo.exists(request.getServiceInstanceId())) {
        throw new ServiceInstanceExistsException(serviceInstance);
    }
    OauthRegServiceInstance instance = this.generateOauthRegServiceInstance(serviceInstance);
    Driver driver = this.getDriverFromInstance(instance);
    if (!this.manageGlobalProvider.hasGlobalProviderConfig(driver)) {
        this.loadLoginProviderToInstance(request.getParameters(), instance);
    }
    String authenticationCode = this.getParameter(request.getParameters(), AUTHENTICATION_CODE_PARAMETER, null);
    instance.setAuthenticationCode(authenticationCode);
    this.oauthRegServiceInstanceRepo.save(instance);
    return serviceInstance;
}
 
开发者ID:cloudfoundry-community,项目名称:oauth-register-broker,代码行数:19,代码来源:OauthRegInstanceService.java

示例3: findServiceInstance

import org.cloudfoundry.community.servicebroker.model.CreateServiceInstanceRequest; //导入依赖的package包/类
public ServiceInstance findServiceInstance(String instanceId) throws SQLException {
    Utils.checkValidUUID(instanceId);

    Map<Integer, String> parameterMap = new HashMap<Integer, String>();
    parameterMap.put(1, instanceId);

    Map<String, String> result = PostgreSQLDatabase.executePreparedSelect("SELECT * FROM service WHERE serviceinstanceid = ?", parameterMap);

    String serviceDefinitionId = result.get("servicedefinitionid");
    String organizationGuid = result.get("organizationguid");
    String planId = result.get("planid");
    String spaceGuid = result.get("spaceguid");

    CreateServiceInstanceRequest wrapper = new CreateServiceInstanceRequest(serviceDefinitionId, planId, organizationGuid, spaceGuid).withServiceInstanceId(instanceId);
    return new ServiceInstance(wrapper);
}
 
开发者ID:cloudfoundry-community,项目名称:postgresql-cf-service-broker,代码行数:17,代码来源:Database.java

示例4: createServiceInstance

import org.cloudfoundry.community.servicebroker.model.CreateServiceInstanceRequest; //导入依赖的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: testCreateServiceInstance_success_shouldReturnCreatedInstanceAndStoreCredentials

import org.cloudfoundry.community.servicebroker.model.CreateServiceInstanceRequest; //导入依赖的package包/类
@Test
public void testCreateServiceInstance_success_shouldReturnCreatedInstanceAndStoreCredentials()
    throws Exception {

  // arrange
  final String INSTANCE_ID = "instanceId0";
  when(h2oProvisionerRestApi.createH2oInstance(INSTANCE_ID, conf.getH2oMapperNodes(),
      conf.getH2oMapperMemory(), true, yarnConfig))
          .thenReturn(new ResponseEntity<>(CREDENTIALS, HttpStatus.OK));

  // act
  CreateServiceInstanceRequest request =
      CfBrokerRequestsFactory.getCreateInstanceRequest(INSTANCE_ID);
  ServiceInstance createdInstance = instanceService.createServiceInstance(request);

  // assert
  assertThat(createdInstance.getServiceInstanceId(), equalTo(INSTANCE_ID));

  freeze().until(() -> credentialsStore.getById(Location.newInstance(INSTANCE_ID)).get(),
      equalTo(CREDENTIALS));

  verify(h2oProvisionerRestApi, times(1)).createH2oInstance(INSTANCE_ID, conf.getH2oMapperNodes(),
      conf.getH2oMapperMemory(), true, yarnConfig);
}
 
开发者ID:trustedanalytics,项目名称:h2o-broker,代码行数:25,代码来源:H2oBrokerIntegrationTest.java

示例6: createServiceInstance_provisionerAndStoreWorks_instanceCreated

import org.cloudfoundry.community.servicebroker.model.CreateServiceInstanceRequest; //导入依赖的package包/类
@Test
public void createServiceInstance_provisionerAndStoreWorks_instanceCreated() throws Exception {
  // arrange
  CreateServiceInstanceRequest request =
      CfBrokerRequestsFactory.getCreateInstanceRequest(INSTANCE_ID);
  ServiceInstance expectedInstance = new ServiceInstance(request);
  H2oCredentials expectedCredentials = new H2oCredentials("a", "b", "c", "d");

  when(delegateMock.createServiceInstance(request)).thenReturn(expectedInstance);
  when(h2oProvisioner.provisionInstance(INSTANCE_ID)).thenReturn(expectedCredentials);
  doNothing().when(credentialsStoreMock).save(Location.newInstance(INSTANCE_ID),
      expectedCredentials);

  // act
  ServiceInstance createdInstance = instanceService.createServiceInstance(request);

  // assert
  assertThat(createdInstance, equalTo(expectedInstance));
  verify(delegateMock, timeout(200)).createServiceInstance(request);
  verify(h2oProvisioner, timeout(200)).provisionInstance(INSTANCE_ID);
  verify(credentialsStoreMock, timeout(200)).save(Location.newInstance(INSTANCE_ID),
      expectedCredentials);
}
 
开发者ID:trustedanalytics,项目名称:h2o-broker,代码行数:24,代码来源:H2oServiceInstanceServiceTest.java

示例7: createServiceInstance_provisionerFails_instanceCreated

import org.cloudfoundry.community.servicebroker.model.CreateServiceInstanceRequest; //导入依赖的package包/类
@Test
public void createServiceInstance_provisionerFails_instanceCreated() throws Exception {
  // arrange
  CreateServiceInstanceRequest request =
      CfBrokerRequestsFactory.getCreateInstanceRequest(INSTANCE_ID);
  ServiceInstance expectedInstance = new ServiceInstance(request);

  when(delegateMock.createServiceInstance(request)).thenReturn(expectedInstance);
  when(h2oProvisioner.provisionInstance(INSTANCE_ID)).thenThrow(new ServiceBrokerException(""));

  // act
  ServiceInstance createdInstance = instanceService.createServiceInstance(request);

  // assert
  assertThat(createdInstance, equalTo(expectedInstance));
  verify(delegateMock, timeout(200)).createServiceInstance(request);
  verify(h2oProvisioner, timeout(200)).provisionInstance(INSTANCE_ID);
}
 
开发者ID:trustedanalytics,项目名称:h2o-broker,代码行数:19,代码来源:H2oServiceInstanceServiceTest.java

示例8: createServiceInstance_storeFails_instanceCreated

import org.cloudfoundry.community.servicebroker.model.CreateServiceInstanceRequest; //导入依赖的package包/类
@Test
public void createServiceInstance_storeFails_instanceCreated() throws Exception {
  // arrange
  CreateServiceInstanceRequest request =
      CfBrokerRequestsFactory.getCreateInstanceRequest(INSTANCE_ID);
  ServiceInstance expectedInstance = new ServiceInstance(request);
  H2oCredentials expectedCredentials = new H2oCredentials("a", "b", "c", "d");

  when(delegateMock.createServiceInstance(request)).thenReturn(expectedInstance);
  when(h2oProvisioner.provisionInstance(INSTANCE_ID)).thenReturn(expectedCredentials);
  doThrow(new IOException()).when(credentialsStoreMock).save(Location.newInstance(INSTANCE_ID),
      expectedCredentials);

  // act
  ServiceInstance createdInstance = instanceService.createServiceInstance(request);

  // assert
  assertThat(createdInstance, equalTo(expectedInstance));
  verify(delegateMock, timeout(200)).createServiceInstance(request);
  verify(h2oProvisioner, timeout(200)).provisionInstance(INSTANCE_ID);
  verify(credentialsStoreMock, timeout(200)).save(Location.newInstance(INSTANCE_ID),
      expectedCredentials);
}
 
开发者ID:trustedanalytics,项目名称:h2o-broker,代码行数:24,代码来源:H2oServiceInstanceServiceTest.java

示例9: createBindingPlanShared_validRequest_credentialsReturnedBindingSavedOnFileSystem

import org.cloudfoundry.community.servicebroker.model.CreateServiceInstanceRequest; //导入依赖的package包/类
@Test
public void createBindingPlanShared_validRequest_credentialsReturnedBindingSavedOnFileSystem() throws Exception {

  String serviceInstanceId = UUID.randomUUID().toString();
  String bindingId = UUID.randomUUID().toString();
  ServiceInstance instance = getServiceInstance(serviceInstanceId, "fakeBaseGuid-shared-plan");

  CreateServiceInstanceRequest request = getCreateInstanceRequest(instance);
  serviceBean.createServiceInstance(request);

  //arrange
  CreateServiceInstanceBindingRequest bindReq =
      getCreateBindingRequest(serviceInstanceId, instance.getPlanId()).withBindingId(bindingId);

  //act
  ServiceInstanceBinding serviceInstanceBinding = bindingBean.createServiceInstanceBinding(bindReq);
  String userDirUri = (String) serviceInstanceBinding.getCredentials().get("uri");

  //assert
  assertThat(userDirUri, endsWith(getUserDirectoryPath(serviceInstanceId, instance.getOrganizationGuid())));
  CreateServiceInstanceBindingRequest savedRequest = getSavedBindReqFromZooKeeper(serviceInstanceId, bindingId);
  assertThat(savedRequest, equalTo(bindReq));
}
 
开发者ID:trustedanalytics,项目名称:hdfs-broker,代码行数:24,代码来源:CreateTest.java

示例10: deleteServiceInstancePlanShared_instanceCreated_getReturnsNull

import org.cloudfoundry.community.servicebroker.model.CreateServiceInstanceRequest; //导入依赖的package包/类
@Test
public void deleteServiceInstancePlanShared_instanceCreated_getReturnsNull() throws Exception {
  //arrange
  String serviceInstanceId = UUID.randomUUID().toString();
  ServiceInstance instance = getServiceInstance(serviceInstanceId, "fakeBaseGuid-shared-plan");
  CreateServiceInstanceRequest request = getCreateInstanceRequest(instance);
  serviceBean.createServiceInstance(request);

  //act
  DeleteServiceInstanceRequest deleteRequest = getDeleteInstanceRequest(instance);
  serviceBean.deleteServiceInstance(deleteRequest);

  //assert
  ServiceInstance serviceInstance = serviceBean.getServiceInstance(serviceInstanceId);
  assertThat(serviceInstance, is(nullValue()));
}
 
开发者ID:trustedanalytics,项目名称:hdfs-broker,代码行数:17,代码来源:CreateDeleteThenGetTest.java

示例11: testCreateInstanceBinding_success_shouldReturnZookeeperNodeInCredentials

import org.cloudfoundry.community.servicebroker.model.CreateServiceInstanceRequest; //导入依赖的package包/类
@Test
public void testCreateInstanceBinding_success_shouldReturnZookeeperNodeInCredentials()
    throws Exception {
  //arrange
  String bindingId = UUID.randomUUID().toString();
  String serviceInstanceId = UUID.randomUUID().toString();
  ServiceInstance instance = getServiceInstance(serviceInstanceId, "fakeBaseGuid-shared-plan");
  CreateServiceInstanceRequest instanceReq = getCreateInstanceRequest(instance);
  CreateServiceInstanceBindingRequest bindReq = getCreateBindingRequest(serviceInstanceId).withBindingId(bindingId);

  //act
  serviceBean.createServiceInstance(getCreateInstanceRequest(instance));
  ServiceInstanceBinding binding = bindingBean.createServiceInstanceBinding(bindReq);
  String namespaceInCredentials = (String) binding.getCredentials().get("zk.node");

  //assert
  assertThat(namespaceInCredentials, equalTo(conf.getBrokerRootNode() + "/" + serviceInstanceId));
}
 
开发者ID:trustedanalytics,项目名称:zookeeper-broker,代码行数:19,代码来源:ZookeeperBrokerIntegrationTest.java

示例12: getServiceInstance

import org.cloudfoundry.community.servicebroker.model.CreateServiceInstanceRequest; //导入依赖的package包/类
private ServiceInstance getServiceInstance(String id) {
  return new ServiceInstance(
      new CreateServiceInstanceRequest(id,
                                       "FAKE-BASE_GUID-shared-plan",
                                       "f0487d90-fde6-4da1-a933-03f38776115d",
                                       "spaceGuid")
          .withServiceInstanceId(id)
  );
}
 
开发者ID:trustedanalytics,项目名称:hive-broker,代码行数:10,代码来源:HiveSharedTest.java

示例13: testCreateServiceInstance_success_shouldReturnCreatedInstance

import org.cloudfoundry.community.servicebroker.model.CreateServiceInstanceRequest; //导入依赖的package包/类
@Test
public void testCreateServiceInstance_success_shouldReturnCreatedInstance() throws Exception {
  CreateServiceInstanceRequest request = getCreateInstanceRequest("instanceId",
                                                                  "multitenant-plan");
  instanceService.createServiceInstance(request);
  ServiceInstance instance = instanceService.getServiceInstance(request.getServiceInstanceId());
  assertThat(instance.getServiceInstanceId(), equalTo("instanceId"));
}
 
开发者ID:trustedanalytics,项目名称:hive-broker,代码行数:9,代码来源:HiveBrokerIntegrationTest.java

示例14: testCreateInstanceBinding_success_shouldReturnBinding

import org.cloudfoundry.community.servicebroker.model.CreateServiceInstanceRequest; //导入依赖的package包/类
@Test
public void testCreateInstanceBinding_success_shouldReturnBinding() throws Exception {
  CreateServiceInstanceRequest request = getCreateInstanceRequest("instanceId4",
                                                                  "multitenant-plan");
  instanceService.createServiceInstance(request);
  CreateServiceInstanceBindingRequest bindingRequest =
      new CreateServiceInstanceBindingRequest(
          getServiceInstance("instanceId4").getServiceDefinitionId(),
          "FAKE-BASE_GUID-multitenant-plan",
          "appGuid")
          .withBindingId("bindingId").withServiceInstanceId("instanceId4");
  ServiceInstanceBinding binding =
      instanceBindingService.createServiceInstanceBinding(bindingRequest);
  assertThat(binding.getServiceInstanceId(), equalTo("instanceId4"));
}
 
开发者ID:trustedanalytics,项目名称:hive-broker,代码行数:16,代码来源:HiveBrokerIntegrationTest.java

示例15: getServiceInstance

import org.cloudfoundry.community.servicebroker.model.CreateServiceInstanceRequest; //导入依赖的package包/类
private ServiceInstance getServiceInstance(String id) {
  return new ServiceInstance(
      new CreateServiceInstanceRequest(id,
                                       "FAKE-BASE_GUID-multitenant-plan",
                                       "f0487d90-fde6-4da1-a933-03f38776115d",
                                       "spaceGuid")
  );
}
 
开发者ID:trustedanalytics,项目名称:hive-broker,代码行数:9,代码来源:HiveBrokerIntegrationTest.java


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