org.springframework.cloud.servicebroker.service.ServiceInstanceService Java Examples

The following examples show how to use org.springframework.cloud.servicebroker.service.ServiceInstanceService. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ServiceBrokerAutoConfigurationTest.java    From spring-cloud-open-service-broker with Apache License 2.0 6 votes vote down vote up
@Test
void servicesAreCreatedWithCatalogAndCatalogServiceConfiguration() {
	this.contextRunner
			.withUserConfiguration(CatalogAndCatalogServiceConfiguration.class)
			.run((context) -> {
				assertThat(context)
						.getBean(CatalogService.class)
						.isExactlyInstanceOf(TestCatalogService.class);

				assertThat(context)
						.getBean(ServiceInstanceBindingService.class)
						.isExactlyInstanceOf(NonBindableServiceInstanceBindingService.class);

				assertThat(context)
						.getBean(ServiceInstanceService.class)
						.isExactlyInstanceOf(TestServiceInstanceService.class);
			});
}
 
Example #2
Source File: ServiceBrokerAutoConfigurationTest.java    From spring-cloud-open-service-broker with Apache License 2.0 6 votes vote down vote up
@Test
void servicesAreCreatedWithFullConfiguration() {
	this.contextRunner
			.withUserConfiguration(FullServicesConfiguration.class)
			.run((context) -> {
				assertThat(context)
						.getBean(CatalogService.class)
						.isExactlyInstanceOf(TestCatalogService.class);

				assertThat(context)
						.getBean(ServiceInstanceBindingService.class)
						.isExactlyInstanceOf(TestServiceInstanceBindingService.class);

				assertThat(context)
						.getBean(ServiceInstanceService.class)
						.isExactlyInstanceOf(TestServiceInstanceService.class);
			});
}
 
Example #3
Source File: ServiceBrokerAutoConfigurationTest.java    From spring-cloud-open-service-broker with Apache License 2.0 6 votes vote down vote up
@Test
void servicesAreCreatedWithCatalogAndFullConfiguration() {
	this.contextRunner
			.withUserConfiguration(FullServicesWithCatalogConfiguration.class)
			.run((context) -> {
				assertThat(context)
						.getBean(CatalogService.class)
						.isExactlyInstanceOf(BeanCatalogService.class);

				assertThat(context)
						.getBean(ServiceInstanceBindingService.class)
						.isExactlyInstanceOf(TestServiceInstanceBindingService.class);

				assertThat(context)
						.getBean(ServiceInstanceService.class)
						.isExactlyInstanceOf(TestServiceInstanceService.class);
			});
}
 
Example #4
Source File: ServiceBrokerAutoConfigurationTest.java    From spring-cloud-open-service-broker with Apache License 2.0 6 votes vote down vote up
@Test
void servicesAreCreatedWithMinimalConfiguration() {
	this.contextRunner
			.withUserConfiguration(MinimalWithCatalogConfiguration.class)
			.run((context) -> {
				assertThat(context)
						.getBean(CatalogService.class)
						.isExactlyInstanceOf(BeanCatalogService.class);

				assertThat(context)
						.getBean(ServiceInstanceBindingService.class)
						.isExactlyInstanceOf(NonBindableServiceInstanceBindingService.class);

				assertThat(context)
						.getBean(ServiceInstanceService.class)
						.isExactlyInstanceOf(TestServiceInstanceService.class);
			});
}
 
Example #5
Source File: AppBrokerAutoConfigurationTest.java    From spring-cloud-app-broker with Apache License 2.0 5 votes vote down vote up
@Test
void serviceInstanceIsNotCreatedIfProvided() {
	configuredContext()
		.withUserConfiguration(CustomServiceConfiguration.class)
		.run(context -> {
			assertBeansCreated(context);

			assertThat(context)
				.hasSingleBean(ServiceInstanceService.class)
				.getBean(ServiceInstanceService.class)
				.isExactlyInstanceOf(TestServiceInstanceService.class);
		});
}
 
Example #6
Source File: ServiceBrokerAutoConfigurationTest.java    From spring-cloud-open-service-broker with Apache License 2.0 5 votes vote down vote up
@Test
void servicesAreCreatedFromCatalogProperties() {
	this.contextRunner
			.withUserConfiguration(MissingCatalogServiceConfiguration.class)
			.withPropertyValues(
					"spring.cloud.openservicebroker.catalog.services[0].id=service-one-id",
					"spring.cloud.openservicebroker.catalog.services[0].name=Service One",
					"spring.cloud.openservicebroker.catalog.services[0].description=Description for Service One",
					"spring.cloud.openservicebroker.catalog.services[0].plans[0].id=plan-one-id",
					"spring.cloud.openservicebroker.catalog.services[0].plans[0].name=Plan One",
					"spring.cloud.openservicebroker.catalog.services[0].plans[0].description=Description for Plan One")
			.run((context) -> {
				assertThat(context).hasSingleBean(Catalog.class);
				Catalog catalog = context.getBean(Catalog.class);
				assertThat(catalog.getServiceDefinitions()).hasSize(1);
				assertThat(catalog.getServiceDefinitions().get(0).getId()).isEqualTo("service-one-id");
				assertThat(catalog.getServiceDefinitions().get(0).getName()).isEqualTo("Service One");
				assertThat(catalog.getServiceDefinitions().get(0).getDescription())
						.isEqualTo("Description for Service One");
				assertThat(catalog.getServiceDefinitions().get(0).getPlans()).hasSize(1);
				assertThat(catalog.getServiceDefinitions().get(0).getPlans().get(0).getId())
						.isEqualTo("plan-one-id");
				assertThat(catalog.getServiceDefinitions().get(0).getPlans().get(0).getName())
						.isEqualTo("Plan One");
				assertThat(catalog.getServiceDefinitions().get(0).getPlans().get(0).getDescription())
						.isEqualTo("Description for Plan One");
				assertThat(context)
						.getBean(CatalogService.class)
						.isExactlyInstanceOf(BeanCatalogService.class);

				assertThat(context)
						.getBean(ServiceInstanceBindingService.class)
						.isExactlyInstanceOf(NonBindableServiceInstanceBindingService.class);

				assertThat(context)
						.getBean(ServiceInstanceService.class)
						.isExactlyInstanceOf(TestServiceInstanceService.class);
			});
}
 
Example #7
Source File: RequiredServiceInstanceServiceBeanFailureAnalyzer.java    From spring-cloud-open-service-broker with Apache License 2.0 5 votes vote down vote up
@Override
protected FailureAnalysis analyze(Throwable rootFailure, ServiceInstanceServiceBeanDoesNotExistException cause) {
	String description = String.format("Service brokers must implement the '%s' and " +
			"provide implementations of the required methods of that interface.", ServiceInstanceService.class);
	String action = String.format("Consider defining a bean of type '%s' in your configuration. See " +
					"the reference documentation for more information: " + REFERENCE_DOC,
			ServiceInstanceService.class);
	return new FailureAnalysis(description, action, cause);
}
 
Example #8
Source File: ServiceBrokerWebFluxAutoConfiguration.java    From spring-cloud-open-service-broker with Apache License 2.0 5 votes vote down vote up
/**
 * Construct a new {@link ServiceBrokerWebFluxAutoConfiguration}
 *
 * @param catalogService the CatalogService bean
 * @param serviceInstanceService the ServiceInstanceService bean
 * @param serviceInstanceBindingService the ServiceInstanceBindingService bean
 * @param eventFlowRegistries the EventFlowRegistries bean
 */
protected ServiceBrokerWebFluxAutoConfiguration(CatalogService catalogService,
		@Autowired(required = false) ServiceInstanceService serviceInstanceService,
		ServiceInstanceBindingService serviceInstanceBindingService,
		EventFlowRegistries eventFlowRegistries) {
	if (serviceInstanceService == null) {
		throw new ServiceInstanceServiceBeanDoesNotExistException();
	}
	this.catalogService = catalogService;
	this.serviceInstanceEventService = new ServiceInstanceEventService(
			serviceInstanceService, eventFlowRegistries);
	this.serviceInstanceBindingEventService = new ServiceInstanceBindingEventService(
			serviceInstanceBindingService, eventFlowRegistries);
}
 
Example #9
Source File: ServiceBrokerWebMvcAutoConfiguration.java    From spring-cloud-open-service-broker with Apache License 2.0 5 votes vote down vote up
/**
 * Construct a new {@link ServiceBrokerWebMvcAutoConfiguration}
 *
 * @param catalogService the CatalogService bean
 * @param serviceInstanceService the ServiceInstanceService bean
 * @param serviceInstanceBindingService the ServiceInstanceBindingService bean
 * @param eventFlowRegistries the EventFlowRegistries bean
 */
protected ServiceBrokerWebMvcAutoConfiguration(CatalogService catalogService,
		@Autowired(required = false) ServiceInstanceService serviceInstanceService,
		ServiceInstanceBindingService serviceInstanceBindingService,
		EventFlowRegistries eventFlowRegistries) {
	if (serviceInstanceService == null) {
		throw new ServiceInstanceServiceBeanDoesNotExistException();
	}
	this.catalogService = catalogService;
	this.serviceInstanceEventService = new ServiceInstanceEventService(
			serviceInstanceService, eventFlowRegistries);
	this.serviceInstanceBindingEventService = new ServiceInstanceBindingEventService(
			serviceInstanceBindingService, eventFlowRegistries);
}
 
Example #10
Source File: CatalogServletBase.java    From spring-cloud-open-service-broker with Apache License 2.0 4 votes vote down vote up
@Bean
protected ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example #11
Source File: InstanceServletBase.java    From spring-cloud-open-service-broker with Apache License 2.0 4 votes vote down vote up
@Bean
protected ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example #12
Source File: ServiceBrokerAutoConfigurationTest.java    From spring-cloud-open-service-broker with Apache License 2.0 4 votes vote down vote up
@Bean
protected ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example #13
Source File: CatalogReactiveBase.java    From spring-cloud-open-service-broker with Apache License 2.0 4 votes vote down vote up
@Bean
protected ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example #14
Source File: BindingReactiveBase.java    From spring-cloud-open-service-broker with Apache License 2.0 4 votes vote down vote up
@Bean
protected ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example #15
Source File: BindingServletBase.java    From spring-cloud-open-service-broker with Apache License 2.0 4 votes vote down vote up
@Bean
protected ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example #16
Source File: InstanceReactiveBase.java    From spring-cloud-open-service-broker with Apache License 2.0 4 votes vote down vote up
@Bean
protected ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example #17
Source File: AbstractServiceBrokerWebAutoConfigurationTest.java    From spring-cloud-open-service-broker with Apache License 2.0 4 votes vote down vote up
@Bean
protected ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example #18
Source File: ApiVersionWebFluxAutoConfigurationTest.java    From spring-cloud-open-service-broker with Apache License 2.0 4 votes vote down vote up
@Bean
public ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example #19
Source File: ServiceBrokerAutoConfigurationTest.java    From spring-cloud-open-service-broker with Apache License 2.0 4 votes vote down vote up
protected MissingAllConfiguration(CatalogService catalogService,
		ServiceInstanceService serviceInstanceService) {
	this.catalogService = catalogService;
	this.serviceInstanceService = serviceInstanceService;
}
 
Example #20
Source File: ServiceBrokerAutoConfigurationTest.java    From spring-cloud-open-service-broker with Apache License 2.0 4 votes vote down vote up
@Bean
protected ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example #21
Source File: ServiceBrokerAutoConfigurationTest.java    From spring-cloud-open-service-broker with Apache License 2.0 4 votes vote down vote up
protected MissingInstanceServiceConfiguration(ServiceInstanceService serviceInstanceService) {
	this.serviceInstanceService = serviceInstanceService;
}
 
Example #22
Source File: ServiceBrokerAutoConfigurationTest.java    From spring-cloud-open-service-broker with Apache License 2.0 4 votes vote down vote up
@Bean
protected ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example #23
Source File: ServiceBrokerAutoConfigurationTest.java    From spring-cloud-open-service-broker with Apache License 2.0 4 votes vote down vote up
@Bean
protected ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example #24
Source File: ServiceBrokerAutoConfigurationTest.java    From spring-cloud-open-service-broker with Apache License 2.0 4 votes vote down vote up
@Bean
protected ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example #25
Source File: ApiVersionWebMvcAutoConfigurationTest.java    From spring-cloud-open-service-broker with Apache License 2.0 4 votes vote down vote up
@Bean
public ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example #26
Source File: AppBrokerAutoConfigurationTest.java    From spring-cloud-app-broker with Apache License 2.0 4 votes vote down vote up
@Bean
public ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example #27
Source File: AppBrokerAutoConfiguration.java    From spring-cloud-app-broker with Apache License 2.0 3 votes vote down vote up
/**
 * Provide a {@link WorkflowServiceInstanceService} bean
 *
 * @param stateRepository the ServiceInstanceStateRepository bean
 * @param createWorkflows a collection of create workflows
 * @param deleteWorkflows a collection of delete workflows
 * @param updateWorkflows a collection of update workflows
 * @return the bean
 */
@Bean
@ConditionalOnMissingBean(ServiceInstanceService.class)
public WorkflowServiceInstanceService serviceInstanceService(ServiceInstanceStateRepository stateRepository,
	List<CreateServiceInstanceWorkflow> createWorkflows, List<DeleteServiceInstanceWorkflow> deleteWorkflows,
	List<UpdateServiceInstanceWorkflow> updateWorkflows) {
	return new WorkflowServiceInstanceService(stateRepository, createWorkflows, deleteWorkflows, updateWorkflows);
}
 
Example #28
Source File: WebFluxApplication.java    From spring-cloud-open-service-broker with Apache License 2.0 2 votes vote down vote up
/**
 * NoOp ServiceInstanceService Bean
 *
 * @return the bean
 */
@Bean
public ServiceInstanceService serviceInstanceService() {
	return new NoOpServiceInstanceService();
}
 
Example #29
Source File: ServiceInstanceController.java    From spring-cloud-open-service-broker with Apache License 2.0 2 votes vote down vote up
/**
 * Construct a new {@link ServiceInstanceController}
 *
 * @param catalogService the catalog service
 * @param serviceInstanceService the service instance service
 */
public ServiceInstanceController(CatalogService catalogService, ServiceInstanceService serviceInstanceService) {
	super(catalogService);
	this.service = serviceInstanceService;
}
 
Example #30
Source File: WebMvcApplication.java    From spring-cloud-open-service-broker with Apache License 2.0 2 votes vote down vote up
/**
 * NoOp ServiceInstanceService Bean
 *
 * @return the bean
 */
@Bean
public ServiceInstanceService serviceInstanceService() {
	return new NoOpServiceInstanceService();
}