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

The following examples show how to use org.springframework.cloud.servicebroker.service.ServiceInstanceService. These examples are extracted from open source projects. 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
@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 2
@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 3
@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 4
@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 5
@Test
void serviceInstanceIsNotCreatedIfProvided() {
	configuredContext()
		.withUserConfiguration(CustomServiceConfiguration.class)
		.run(context -> {
			assertBeansCreated(context);

			assertThat(context)
				.hasSingleBean(ServiceInstanceService.class)
				.getBean(ServiceInstanceService.class)
				.isExactlyInstanceOf(TestServiceInstanceService.class);
		});
}
 
Example 6
/**
 * 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 7
/**
 * 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 8
@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 9
@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 10
@Bean
public ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example 11
@Bean
public ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example 12
@Bean
protected ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example 13
@Bean
protected ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example 14
@Bean
protected ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example 15
@Bean
protected ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example 16
protected MissingInstanceServiceConfiguration(ServiceInstanceService serviceInstanceService) {
	this.serviceInstanceService = serviceInstanceService;
}
 
Example 17
@Bean
protected ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example 18
protected MissingAllConfiguration(CatalogService catalogService,
		ServiceInstanceService serviceInstanceService) {
	this.catalogService = catalogService;
	this.serviceInstanceService = serviceInstanceService;
}
 
Example 19
@Bean
public ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example 20
@Bean
protected ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example 21
@Bean
protected ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example 22
@Bean
protected ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example 23
@Bean
protected ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example 24
@Bean
protected ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example 25
@Bean
protected ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example 26
@Bean
protected ServiceInstanceService serviceInstanceService() {
	return new TestServiceInstanceService();
}
 
Example 27
/**
 * 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
/**
 * NoOp ServiceInstanceService Bean
 *
 * @return the bean
 */
@Bean
public ServiceInstanceService serviceInstanceService() {
	return new NoOpServiceInstanceService();
}
 
Example 29
/**
 * 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
/**
 * NoOp ServiceInstanceService Bean
 *
 * @return the bean
 */
@Bean
public ServiceInstanceService serviceInstanceService() {
	return new NoOpServiceInstanceService();
}