org.springframework.cloud.stream.test.binder.TestSupportBinderAutoConfiguration Java Examples
The following examples show how to use
org.springframework.cloud.stream.test.binder.TestSupportBinderAutoConfiguration.
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: TaskEventTests.java From spring-cloud-task with Apache License 2.0 | 6 votes |
@Test public void testDefaultConfiguration() { ApplicationContextRunner applicationContextRunner = new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of( EmbeddedDataSourceConfiguration.class, TaskEventAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class, TestSupportBinderAutoConfiguration.class, SimpleTaskAutoConfiguration.class, SingleTaskConfiguration.class, BindingServiceConfiguration.class)) .withUserConfiguration(TaskEventsConfiguration.class) .withPropertyValues("spring.cloud.task.closecontext_enabled=false", "spring.main.web-environment=false"); applicationContextRunner.run((context) -> { assertThat(context.getBean("taskEventListener")).isNotNull(); assertThat( context.getBean(TaskEventAutoConfiguration.TaskEventChannels.class)) .isNotNull(); }); }
Example #2
Source File: JobExecutionEventTests.java From spring-cloud-task with Apache License 2.0 | 5 votes |
@Test public void testOrderConfiguration() { ApplicationContextRunner applicationContextRunner = new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of( EventJobExecutionConfiguration.class, PropertyPlaceholderAutoConfiguration.class, TestSupportBinderAutoConfiguration.class, SimpleTaskAutoConfiguration.class, SingleTaskConfiguration.class)) .withUserConfiguration( BatchEventAutoConfiguration.JobExecutionListenerConfiguration.class) .withPropertyValues("--spring.cloud.task.closecontext_enabled=false", "--spring.main.web-environment=false", "--spring.cloud.task.batch.events.chunk-order=5", "--spring.cloud.task.batch.events.item-process-order=5", "--spring.cloud.task.batch.events.item-read-order=5", "--spring.cloud.task.batch.events.item-write-order=5", "--spring.cloud.task.batch.events.job-execution-order=5", "--spring.cloud.task.batch.events.skip-order=5", "--spring.cloud.task.batch.events.step-execution-order=5"); applicationContextRunner.run((context) -> { for (String beanName : LISTENER_BEAN_NAMES) { Ordered ordered = (Ordered) context.getBean(beanName); assertThat(5).as("Expected order value of 5 for " + beanName) .isEqualTo(ordered.getOrder()); } }); }
Example #3
Source File: JobExecutionEventTests.java From spring-cloud-task with Apache License 2.0 | 5 votes |
private void testDisabledConfiguration(String property, String disabledListener) { String disabledPropertyArg = (property != null) ? "--" + property + "=false" : ""; ApplicationContextRunner applicationContextRunner = new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of( EventJobExecutionConfiguration.class, PropertyPlaceholderAutoConfiguration.class, TestSupportBinderAutoConfiguration.class, SimpleTaskAutoConfiguration.class, SingleTaskConfiguration.class)) .withUserConfiguration( BatchEventAutoConfiguration.JobExecutionListenerConfiguration.class) .withPropertyValues("--spring.cloud.task.closecontext_enabled=false", "--spring.main.web-environment=false", disabledPropertyArg); applicationContextRunner.run((context) -> { boolean exceptionThrown = false; for (String beanName : LISTENER_BEAN_NAMES) { if (disabledListener != null && disabledListener.equals(beanName)) { try { context.getBean(disabledListener); } catch (NoSuchBeanDefinitionException nsbde) { exceptionThrown = true; } assertThat(exceptionThrown).as( String.format("Did not expect %s bean in context", beanName)) .isTrue(); } else { context.getBean(beanName); } } }); }