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


Java DeleteServiceInstanceRequest类代码示例

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


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

示例1: deleteServiceInstance

import org.cloudfoundry.community.servicebroker.model.DeleteServiceInstanceRequest; //导入依赖的package包/类
@Override
public ServiceInstance deleteServiceInstance(
		DeleteServiceInstanceRequest request)
		throws ServiceBrokerException, ServiceBrokerAsyncRequiredException {
	throwIfSync(request);
	String id = request.getServiceInstanceId();
	log(id, "Deleting service instance", IN_PROGRESS);
	ServiceInstance instance = instanceManager.getInstance(id);
	if (null == instance) {
		log(id, "Service instance not found", FAILED);
		return null;
	}
	String copyId = instanceManager.getCopyIdForInstance(id);

	instanceManager.saveInstance(
			instance.withLastOperation(
					new ServiceInstanceLastOperation("deprovisioning",
							OperationState.IN_PROGRESS)).isAsync(true),
			copyId);

	deProvision(request, id, instance);

	return instance;

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

示例2: deProvision

import org.cloudfoundry.community.servicebroker.model.DeleteServiceInstanceRequest; //导入依赖的package包/类
private void deProvision(DeleteServiceInstanceRequest request, String id,
		ServiceInstance instance) {
	executor.execute(new Runnable() {
		@Override
		public void run() {
			try {
				if (COPY.equals(request.getPlanId())) {
					copyProvider.deleteCopy(instanceManager
							.getCopyIdForInstance(id));
				}
				log(id, "Deleted service instance", COMPLETE);
				instanceManager.removeInstance(id);
			} catch (ServiceBrokerException e) {
				log(id,
						"Failed to delete service instance: "
								+ e.getMessage(), FAILED);
				instance.withLastOperation(new ServiceInstanceLastOperation(
						"failed to delete", OperationState.FAILED));
				String copyId = instanceManager.getCopyIdForInstance(id);
				instanceManager.saveInstance(instance, copyId);
			}
		}
	});
}
 
开发者ID:krujos,项目名称:data-lifecycle-service-broker,代码行数:25,代码来源:LCServiceInstanceService.java

示例3: itShouldSaveTheInstnaceAsFailedIfDeprovisionFails

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

	ServiceInstance theInstance = new ServiceInstance(
			newCreateServiceInstanceRequest());

	doThrow(new ServiceBrokerException("Problem!")).when(copyProvider)
			.deleteCopy(anyString());

	when(instanceManager.getInstance(anyString())).thenReturn(theInstance);
	when(instanceManager.getCopyIdForInstance(anyString())).thenReturn(
			"copy_id");

	ServiceInstance failedInstance = service
			.deleteServiceInstance(new DeleteServiceInstanceRequest(
					theInstance.getServiceInstanceId(), theInstance
							.getServiceDefinitionId(), COPY, true));

	assertThat(failedInstance.getServiceInstanceLastOperation().getState(),
			is(equalTo("failed")));

	// Once for in progress, once for failed.
	verify(instanceManager, times(2)).saveInstance(any(), anyString());
	assertTrue(failedInstance.isAsync());
}
 
开发者ID:krujos,项目名称:data-lifecycle-service-broker,代码行数:27,代码来源:LCServiceInstanceServiceCopyTest.java

示例4: deleteServiceInstance

import org.cloudfoundry.community.servicebroker.model.DeleteServiceInstanceRequest; //导入依赖的package包/类
@Override
public ServiceInstance deleteServiceInstance(DeleteServiceInstanceRequest request)
    throws ServiceBrokerException {

    LOGGER.debug(LoggerHelper
        .getParamsAsString("deleteServiceInstance", request.getServiceInstanceId(),
            request.getServiceId(), request.getPlanId()));

    Optional<ServiceInstance> instance;
    try {
        Location storingLocation = Location.newInstance(request.getServiceInstanceId());
        instance = store.deleteById(storingLocation);
    } catch (IOException e) {
        throw new ServiceBrokerException(e.getMessage(), e);
    }
    return instance.orElse(null);
}
 
开发者ID:trustedanalytics,项目名称:broker-store,代码行数:18,代码来源:ServiceInstanceServiceStore.java

示例5: testDeleteServiceInstance_success_shouldReturnRemovedInstance

import org.cloudfoundry.community.servicebroker.model.DeleteServiceInstanceRequest; //导入依赖的package包/类
@Test
public void testDeleteServiceInstance_success_shouldReturnRemovedInstance() throws Exception {
  // arrange
  final String INSTANCE_ID = "instanceId1";
  when(h2oProvisionerRestApi.createH2oInstance(INSTANCE_ID, conf.getH2oMapperNodes(),
      conf.getH2oMapperMemory(), true, yarnConfig))
          .thenReturn(new ResponseEntity<>(CREDENTIALS, HttpStatus.OK));
  when(h2oProvisionerRestApi.deleteH2oInstance(INSTANCE_ID, yarnConfig))
      .thenReturn(new ResponseEntity<>("test-job-id", HttpStatus.OK));
  ServiceInstance instance = instanceService
      .createServiceInstance(CfBrokerRequestsFactory.getCreateInstanceRequest(INSTANCE_ID));

  // act
  ServiceInstance removedInstance = instanceService
      .deleteServiceInstance(new DeleteServiceInstanceRequest(instance.getServiceInstanceId(),
          instance.getServiceDefinitionId(), instance.getPlanId()));

  // assert
  verify(h2oProvisionerRestApi, times(1)).deleteH2oInstance(INSTANCE_ID, yarnConfig);
  assertThat(instance.getServiceInstanceId(), equalTo(removedInstance.getServiceInstanceId()));
}
 
开发者ID:trustedanalytics,项目名称:h2o-broker,代码行数:22,代码来源:H2oBrokerIntegrationTest.java

示例6: deleteServiceInstancePlanShared_instanceCreated_getReturnsNull

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

示例7: testDeleteServiceInstance_success_shouldReturnRemovedInstance

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

示例8: deleteServiceInstance

import org.cloudfoundry.community.servicebroker.model.DeleteServiceInstanceRequest; //导入依赖的package包/类
@Override
public ServiceInstance deleteServiceInstance(DeleteServiceInstanceRequest request) throws ServiceBrokerException, ServiceBrokerAsyncRequiredException {
    ServiceInstance serviceInstance = new ServiceInstance(request);
    serviceInstance.withAsync(false);
    serviceInstance.withDashboardUrl(appUri);
    if (!this.oauthRegServiceInstanceRepo.exists(request.getServiceInstanceId())) {
        logger.warn("The service instance '" + request.getServiceInstanceId() + "' doesn't exist. Defaulting to say to cloud controller that instance is deleted.");
    }
    this.oauthRegServiceInstanceRepo.delete(request.getServiceInstanceId());
    return serviceInstance;
}
 
开发者ID:cloudfoundry-community,项目名称:oauth-register-broker,代码行数:12,代码来源:OauthRegInstanceService.java

示例9: deleteServiceInstance

import org.cloudfoundry.community.servicebroker.model.DeleteServiceInstanceRequest; //导入依赖的package包/类
@Override
public ServiceInstance deleteServiceInstance(DeleteServiceInstanceRequest request)
        throws ServiceBrokerException {
    PersistableServiceInstance instance = this.serviceInstanceRepository
            .findOne(request.getServiceInstanceId());
    if (null != instance)
        this.serviceInstanceRepository.delete(instance);
    return instance;
}
 
开发者ID:joshlong,项目名称:cloudfoundry-ftp-service-broker,代码行数:10,代码来源:FtpServiceInstanceService.java

示例10: throwIfSync

import org.cloudfoundry.community.servicebroker.model.DeleteServiceInstanceRequest; //导入依赖的package包/类
private void throwIfSync(DeleteServiceInstanceRequest request)
		throws ServiceBrokerAsyncRequiredException {
	if (!request.hasAsyncClient()) {
		throw new ServiceBrokerAsyncRequiredException(
				"Lifecycle broker requires an async CloudController");
	}
}
 
开发者ID:krujos,项目名称:data-lifecycle-service-broker,代码行数:8,代码来源:LCServiceInstanceService.java

示例11: itDeletesWhatItShould

import org.cloudfoundry.community.servicebroker.model.DeleteServiceInstanceRequest; //导入依赖的package包/类
@Test
public void itDeletesWhatItShould() throws Exception {
	createServiceInstance();
	String id = instance.getServiceInstanceId();
	when(instanceManager.getInstance(id)).thenReturn(instance);
	when(instanceManager.removeInstance(id)).thenReturn(instance);
	when(instanceManager.getCopyIdForInstance(id)).thenReturn(
			"copy_instance");
	assertThat(
			service.deleteServiceInstance(new DeleteServiceInstanceRequest(
					id, instance.getServiceDefinitionId(), instance
							.getPlanId(), true)), is(equalTo(instance)));
	verify(copyProvider).deleteCopy("copy_instance");
	verify(instanceManager).removeInstance(instance.getServiceInstanceId());
}
 
开发者ID:krujos,项目名称:data-lifecycle-service-broker,代码行数:16,代码来源:LCServiceInstanceServiceCopyTest.java

示例12: itShouldNotDeleteACopyForProd

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

	createServiceInstance();
	String id = instance.getServiceInstanceId();
	when(instanceManager.getInstance(id)).thenReturn(instance);
	when(instanceManager.removeInstance(id)).thenReturn(instance);

	assertNotNull(service
			.deleteServiceInstance(new DeleteServiceInstanceRequest(id,
					"serviceId", PRODUCTION, true)));
	verifyZeroInteractions(copyProvider);
}
 
开发者ID:krujos,项目名称:data-lifecycle-service-broker,代码行数:14,代码来源:LCServiceInstanceServiceProdTest.java

示例13: itShouldDocumentItsInFlightDeleteActions

import org.cloudfoundry.community.servicebroker.model.DeleteServiceInstanceRequest; //导入依赖的package包/类
@Test
public void itShouldDocumentItsInFlightDeleteActions() throws Exception {
	createServiceInstance();
	service.deleteServiceInstance(new DeleteServiceInstanceRequest(instance
			.getServiceInstanceId(), "serviceId", PRODUCTION, true));
	verify(brokerRepo, times(3)).save(any(BrokerAction.class));
}
 
开发者ID:krujos,项目名称:data-lifecycle-service-broker,代码行数:8,代码来源:LCServiceInstanceServiceProdTest.java

示例14: deleteServiceInstance

import org.cloudfoundry.community.servicebroker.model.DeleteServiceInstanceRequest; //导入依赖的package包/类
@Override
public ServiceInstance deleteServiceInstance(DeleteServiceInstanceRequest deleteServiceInstanceRequest)
        throws ServiceBrokerException {
    String serviceInstanceId = deleteServiceInstanceRequest.getServiceInstanceId();
    ServiceInstance instance = getServiceInstance(serviceInstanceId);

    try {
        db.deleteDatabase(serviceInstanceId);
        role.deleteRole(serviceInstanceId);
    } catch (SQLException e) {
        logger.error("Error while deleting service instance '" + serviceInstanceId + "'", e);
        throw new ServiceBrokerException(e.getMessage());
    }
    return instance;
}
 
开发者ID:cloudfoundry-community,项目名称:postgresql-cf-service-broker,代码行数:16,代码来源:PostgreSQLServiceInstanceService.java

示例15: deleteServiceInstance

import org.cloudfoundry.community.servicebroker.model.DeleteServiceInstanceRequest; //导入依赖的package包/类
@Override
public ServiceInstance deleteServiceInstance(DeleteServiceInstanceRequest request)
    throws ServiceBrokerException {
  ServiceInstance serviceInstance = super.deleteServiceInstance(request);
  String serviceInstanceId = serviceInstance.getServiceInstanceId();

  String killedJob = h2oProvisioner.deprovisionInstance(serviceInstanceId);
  LOGGER.info("Killed YARN job: " + killedJob + " for H2O instance " + serviceInstanceId
      + ". H2O deleted.");
  return serviceInstance;
}
 
开发者ID:trustedanalytics,项目名称:h2o-broker,代码行数:12,代码来源:H2oServiceInstanceService.java


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