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

The following examples show how to use org.springframework.cloud.servicebroker.service.ServiceInstanceBindingService. 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 servicesAreCreatedWithCloudFoundryConfigured() {
	configuredContext()
		.run(context -> {
			assertBeansCreated(context);
			assertPropertiesLoaded(context);

			assertThat(context)
				.hasSingleBean(ServiceInstanceBindingService.class)
				.getBean(ServiceInstanceBindingService.class)
				.isExactlyInstanceOf(WorkflowServiceInstanceBindingService.class);
		});
}
 
Example #6
Source File: NonBindableServiceInstanceBindingControllerIntegrationTest.java    From spring-cloud-open-service-broker with Apache License 2.0 5 votes vote down vote up
@BeforeEach
void setUp() {
	ServiceInstanceBindingService serviceInstanceBindingService = new NonBindableServiceInstanceBindingService();
	ServiceInstanceBindingController controller =
			new ServiceInstanceBindingController(catalogService, serviceInstanceBindingService);

	this.client = WebTestClient.bindToController(controller)
			.build();
}
 
Example #7
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 #8
Source File: NonBindableServiceInstanceBindingControllerIntegrationTest.java    From spring-cloud-open-service-broker with Apache License 2.0 5 votes vote down vote up
@BeforeEach
void setUp() {
	ServiceInstanceBindingService serviceInstanceBindingService = new NonBindableServiceInstanceBindingService();
	ServiceInstanceBindingController controller =
			new ServiceInstanceBindingController(catalogService, serviceInstanceBindingService);

	this.mockMvc = MockMvcBuilders.standaloneSetup(controller)
			.setControllerAdvice(ServiceBrokerWebMvcExceptionHandler.class)
			.setMessageConverters(new MappingJackson2HttpMessageConverter()).build();
}
 
Example #9
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 #10
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 #11
Source File: AppBrokerAutoConfigurationTest.java    From spring-cloud-app-broker with Apache License 2.0 5 votes vote down vote up
@Test
void bindingServiceIsNotCreatedIfProvided() {
	configuredContext()
		.withUserConfiguration(CustomBindingServiceConfiguration.class)
		.run(context -> {
			assertBeansCreated(context);

			assertThat(context)
				.hasSingleBean(ServiceInstanceBindingService.class)
				.getBean(ServiceInstanceBindingService.class)
				.isExactlyInstanceOf(TestServiceInstanceBindingService.class);
		});
}
 
Example #12
Source File: AppBrokerAutoConfiguration.java    From spring-cloud-app-broker with Apache License 2.0 5 votes vote down vote up
/**
 * Provide a {@link WorkflowServiceInstanceBindingService} bean
 *
 * @param stateRepository the ServiceInstanceBindingStateRepository bean
 * @param createServiceInstanceAppBindingWorkflows a collection of create app binding workflows
 * @param createServiceInstanceRouteBindingWorkflows a collection of create route binding workflows
 * @param deleteServiceInstanceBindingWorkflows a collection of update workflows
 * @return the bean
 */
@Bean
@ConditionalOnMissingBean(ServiceInstanceBindingService.class)
public WorkflowServiceInstanceBindingService serviceInstanceBindingService(
	ServiceInstanceBindingStateRepository stateRepository,
	@Autowired(required = false) List<CreateServiceInstanceAppBindingWorkflow> createServiceInstanceAppBindingWorkflows,
	@Autowired(required = false) List<CreateServiceInstanceRouteBindingWorkflow> createServiceInstanceRouteBindingWorkflows,
	@Autowired(required = false) List<DeleteServiceInstanceBindingWorkflow> deleteServiceInstanceBindingWorkflows) {
	return new WorkflowServiceInstanceBindingService(stateRepository,
		createServiceInstanceAppBindingWorkflows, createServiceInstanceRouteBindingWorkflows,
		deleteServiceInstanceBindingWorkflows);
}
 
Example #13
Source File: ServiceBrokerAutoConfiguration.java    From spring-cloud-open-service-broker with Apache License 2.0 4 votes vote down vote up
/**
 * Conditionally provides a {@link ServiceInstanceBindingService} bean
 *
 * @return the bean
 */
@Bean
@ConditionalOnMissingBean(ServiceInstanceBindingService.class)
public ServiceInstanceBindingService nonBindableServiceInstanceBindingService() {
	return new NonBindableServiceInstanceBindingService();
}
 
Example #14
Source File: AppBrokerAutoConfigurationTest.java    From spring-cloud-app-broker with Apache License 2.0 4 votes vote down vote up
@Bean
public ServiceInstanceBindingService serviceInstanceBindingService() {
	return new TestServiceInstanceBindingService();
}
 
Example #15
Source File: ServiceBrokerAutoConfigurationTest.java    From spring-cloud-open-service-broker with Apache License 2.0 4 votes vote down vote up
@Bean
protected ServiceInstanceBindingService serviceInstanceBindingService() {
	return new TestServiceInstanceBindingService();
}
 
Example #16
Source File: ServiceBrokerAutoConfigurationTest.java    From spring-cloud-open-service-broker with Apache License 2.0 4 votes vote down vote up
@Bean
protected ServiceInstanceBindingService serviceInstanceBindingService() {
	return new TestServiceInstanceBindingService();
}
 
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 ServiceInstanceBindingService serviceInstanceBindingService() {
	return new TestServiceInstanceBindingService();
}
 
Example #18
Source File: AbstractServiceBrokerWebAutoConfigurationTest.java    From spring-cloud-open-service-broker with Apache License 2.0 4 votes vote down vote up
@Bean
protected ServiceInstanceBindingService serviceInstanceBindingService() {
	return new TestServiceInstanceBindingService();
}
 
Example #19
Source File: BindingServletBase.java    From spring-cloud-open-service-broker with Apache License 2.0 4 votes vote down vote up
@Bean
protected ServiceInstanceBindingService serviceInstanceBindingService() {
	return new TestServiceInstanceBindingService();
}
 
Example #20
Source File: BindingReactiveBase.java    From spring-cloud-open-service-broker with Apache License 2.0 4 votes vote down vote up
@Bean
protected ServiceInstanceBindingService serviceInstanceBindingService() {
	return new TestServiceInstanceBindingService();
}
 
Example #21
Source File: AppBrokerApplication.java    From spring-cloud-app-broker with Apache License 2.0 2 votes vote down vote up
/**
 * A no-op ServiceInstanceBindingService bean
 *
 * @return the bean
 */
@Bean
public ServiceInstanceBindingService serviceInstanceBindingService() {
	return new NoOpServiceInstanceBindingService();
}
 
Example #22
Source File: ServiceInstanceBindingController.java    From spring-cloud-open-service-broker with Apache License 2.0 2 votes vote down vote up
/**
 * Construct a new {@link ServiceInstanceBindingController}
 *
 * @param catalogService the catalog service
 * @param serviceInstanceBindingService the service instance binding service
 */
public ServiceInstanceBindingController(CatalogService catalogService,
		ServiceInstanceBindingService serviceInstanceBindingService) {
	super(catalogService);
	this.service = serviceInstanceBindingService;
}