Update versions and update code format
This commit is contained in:
@@ -51,8 +51,9 @@ public class MessagePublisher<P> {
|
||||
}
|
||||
|
||||
public void publishWithThrowableHeader(String bindingName, P payload, String header) {
|
||||
Message<P> message = MessageBuilder.withPayload(payload).setHeader(BatchJobHeaders.BATCH_EXCEPTION, header)
|
||||
.build();
|
||||
Message<P> message = MessageBuilder.withPayload(payload)
|
||||
.setHeader(BatchJobHeaders.BATCH_EXCEPTION, header)
|
||||
.build();
|
||||
publishMessage(bindingName, message);
|
||||
}
|
||||
|
||||
|
||||
@@ -90,11 +90,11 @@ public class TaskBatchEventListenerBeanPostProcessor implements BeanPostProcesso
|
||||
Field chunkProviderField = ReflectionUtils.findField(ChunkOrientedTasklet.class, "chunkProvider");
|
||||
ReflectionUtils.makeAccessible(chunkProviderField);
|
||||
SimpleChunkProvider chunkProvider = (SimpleChunkProvider) ReflectionUtils
|
||||
.getField(chunkProviderField, tasklet);
|
||||
.getField(chunkProviderField, tasklet);
|
||||
Field chunkProcessorField = ReflectionUtils.findField(ChunkOrientedTasklet.class, "chunkProcessor");
|
||||
ReflectionUtils.makeAccessible(chunkProcessorField);
|
||||
SimpleChunkProcessor chunkProcessor = (SimpleChunkProcessor) ReflectionUtils
|
||||
.getField(chunkProcessorField, tasklet);
|
||||
.getField(chunkProcessorField, tasklet);
|
||||
registerItemReadEvents(chunkProvider);
|
||||
registerSkipEvents(chunkProvider);
|
||||
registerItemProcessEvents(chunkProcessor);
|
||||
@@ -115,21 +115,21 @@ public class TaskBatchEventListenerBeanPostProcessor implements BeanPostProcesso
|
||||
private void registerItemProcessEvents(SimpleChunkProcessor chunkProcessor) {
|
||||
if (this.applicationContext.containsBean(BatchEventAutoConfiguration.ITEM_PROCESS_EVENTS_LISTENER)) {
|
||||
chunkProcessor.registerListener((ItemProcessListener) this.applicationContext
|
||||
.getBean(BatchEventAutoConfiguration.ITEM_PROCESS_EVENTS_LISTENER));
|
||||
.getBean(BatchEventAutoConfiguration.ITEM_PROCESS_EVENTS_LISTENER));
|
||||
}
|
||||
}
|
||||
|
||||
private void registerItemReadEvents(SimpleChunkProvider chunkProvider) {
|
||||
if (this.applicationContext.containsBean(BatchEventAutoConfiguration.ITEM_READ_EVENTS_LISTENER)) {
|
||||
chunkProvider.registerListener((ItemReadListener) this.applicationContext
|
||||
.getBean(BatchEventAutoConfiguration.ITEM_READ_EVENTS_LISTENER));
|
||||
.getBean(BatchEventAutoConfiguration.ITEM_READ_EVENTS_LISTENER));
|
||||
}
|
||||
}
|
||||
|
||||
private void registerItemWriteEvents(SimpleChunkProcessor chunkProcessor) {
|
||||
if (this.applicationContext.containsBean(BatchEventAutoConfiguration.ITEM_WRITE_EVENTS_LISTENER)) {
|
||||
chunkProcessor.registerListener((ItemWriteListener) this.applicationContext
|
||||
.getBean(BatchEventAutoConfiguration.ITEM_WRITE_EVENTS_LISTENER));
|
||||
.getBean(BatchEventAutoConfiguration.ITEM_WRITE_EVENTS_LISTENER));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ public class TaskBatchEventListenerBeanPostProcessor implements BeanPostProcesso
|
||||
if (bean instanceof AbstractJob job
|
||||
&& this.applicationContext.containsBean(BatchEventAutoConfiguration.JOB_EXECUTION_EVENTS_LISTENER)) {
|
||||
JobExecutionListener jobExecutionEventsListener = (JobExecutionListener) this.applicationContext
|
||||
.getBean(BatchEventAutoConfiguration.JOB_EXECUTION_EVENTS_LISTENER);
|
||||
.getBean(BatchEventAutoConfiguration.JOB_EXECUTION_EVENTS_LISTENER);
|
||||
|
||||
job.registerJobExecutionListener(jobExecutionEventsListener);
|
||||
}
|
||||
@@ -167,7 +167,7 @@ public class TaskBatchEventListenerBeanPostProcessor implements BeanPostProcesso
|
||||
private void registerStepExecutionEventListener(Object bean) {
|
||||
if (this.applicationContext.containsBean(BatchEventAutoConfiguration.STEP_EXECUTION_EVENTS_LISTENER)) {
|
||||
StepExecutionListener stepExecutionListener = (StepExecutionListener) this.applicationContext
|
||||
.getBean(BatchEventAutoConfiguration.STEP_EXECUTION_EVENTS_LISTENER);
|
||||
.getBean(BatchEventAutoConfiguration.STEP_EXECUTION_EVENTS_LISTENER);
|
||||
AbstractStep step = (AbstractStep) bean;
|
||||
step.registerStepExecutionListener(stepExecutionListener);
|
||||
}
|
||||
|
||||
@@ -82,8 +82,10 @@ public class EventListenerTests {
|
||||
objectMapper.registerModule(new JavaTimeModule());
|
||||
|
||||
this.applicationContext = new SpringApplicationBuilder()
|
||||
.sources(TestChannelBinderConfiguration.getCompleteConfiguration(BatchEventsApplication.class))
|
||||
.web(WebApplicationType.NONE).build().run();
|
||||
.sources(TestChannelBinderConfiguration.getCompleteConfiguration(BatchEventsApplication.class))
|
||||
.web(WebApplicationType.NONE)
|
||||
.build()
|
||||
.run();
|
||||
StreamBridge streamBridge = this.applicationContext.getBean(StreamBridge.class);
|
||||
MessagePublisher messagePublisher = new MessagePublisher(streamBridge);
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
@@ -125,22 +127,22 @@ public class EventListenerTests {
|
||||
this.eventEmittingItemProcessListener.onProcessError("HELLO", new RuntimeException("Test Exception"));
|
||||
|
||||
assertThat(getStringFromDestination(this.taskEventProperties.getItemProcessEventBindingName()))
|
||||
.isEqualTo("Exception while item was being processed");
|
||||
.isEqualTo("Exception while item was being processed");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testItemProcessListenerAfterProcess() {
|
||||
this.eventEmittingItemProcessListener.afterProcess("HELLO_AFTER_PROCESS_EQUAL", "HELLO_AFTER_PROCESS_EQUAL");
|
||||
assertThat(getStringFromDestination(this.taskEventProperties.getItemProcessEventBindingName()))
|
||||
.isEqualTo("item equaled result after processing");
|
||||
.isEqualTo("item equaled result after processing");
|
||||
|
||||
this.eventEmittingItemProcessListener.afterProcess("HELLO_NOT_EQUAL", "WORLD");
|
||||
assertThat(getStringFromDestination(this.taskEventProperties.getItemProcessEventBindingName()))
|
||||
.isEqualTo("item did not equal result after processing");
|
||||
.isEqualTo("item did not equal result after processing");
|
||||
|
||||
this.eventEmittingItemProcessListener.afterProcess("HELLO_AFTER_PROCESS", null);
|
||||
assertThat(getStringFromDestination(this.taskEventProperties.getItemProcessEventBindingName()))
|
||||
.isEqualTo("1 item was filtered");
|
||||
.isEqualTo("1 item was filtered");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -153,7 +155,7 @@ public class EventListenerTests {
|
||||
public void EventEmittingSkipListenerSkipRead() {
|
||||
this.eventEmittingSkipListener.onSkipInRead(new RuntimeException("Text Exception"));
|
||||
assertThat(getStringFromDestination(this.taskEventProperties.getSkipEventBindingName()))
|
||||
.isEqualTo("Skipped when reading.");
|
||||
.isEqualTo("Skipped when reading.");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -174,7 +176,7 @@ public class EventListenerTests {
|
||||
public void EventEmittingItemReadListener() {
|
||||
this.eventEmittingItemReadListener.onReadError(new RuntimeException("Text Exception"));
|
||||
assertThat(getStringFromDestination(this.taskEventProperties.getItemReadEventBindingName()))
|
||||
.isEqualTo("Exception while item was being read");
|
||||
.isEqualTo("Exception while item was being read");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -193,14 +195,14 @@ public class EventListenerTests {
|
||||
public void EventEmittingItemWriteListenerBeforeWrite() {
|
||||
this.eventEmittingItemWriteListener.beforeWrite(getSampleList());
|
||||
assertThat(getStringFromDestination(this.taskEventProperties.getItemWriteEventBindingName()))
|
||||
.isEqualTo("3 items to be written.");
|
||||
.isEqualTo("3 items to be written.");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void EventEmittingItemWriteListenerAfterWrite() {
|
||||
this.eventEmittingItemWriteListener.afterWrite(getSampleList());
|
||||
assertThat(getStringFromDestination(this.taskEventProperties.getItemWriteEventBindingName()))
|
||||
.isEqualTo("3 items have been written.");
|
||||
.isEqualTo("3 items have been written.");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -209,7 +211,7 @@ public class EventListenerTests {
|
||||
this.eventEmittingItemWriteListener.onWriteError(exception, getSampleList());
|
||||
|
||||
assertThat(getStringFromDestination(this.taskEventProperties.getItemWriteEventBindingName()))
|
||||
.isEqualTo("Exception while 3 items are attempted to be written.");
|
||||
.isEqualTo("Exception while 3 items are attempted to be written.");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -266,7 +268,7 @@ public class EventListenerTests {
|
||||
final String CHUNK_MESSAGE = "Before Chunk Processing";
|
||||
this.eventEmittingChunkListener.beforeChunk(getChunkContext());
|
||||
assertThat(getStringFromDestination(this.taskEventProperties.getChunkEventBindingName()))
|
||||
.isEqualTo(CHUNK_MESSAGE);
|
||||
.isEqualTo(CHUNK_MESSAGE);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -274,7 +276,7 @@ public class EventListenerTests {
|
||||
final String CHUNK_MESSAGE = "After Chunk Processing";
|
||||
this.eventEmittingChunkListener.afterChunk(getChunkContext());
|
||||
assertThat(getStringFromDestination(this.taskEventProperties.getChunkEventBindingName()))
|
||||
.isEqualTo(CHUNK_MESSAGE);
|
||||
.isEqualTo(CHUNK_MESSAGE);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -88,12 +88,12 @@ public class JobExecutionEventTests {
|
||||
assertThat(jobExecutionEvent.getJobParameters()).as("jobParameters should not be null").isNotNull();
|
||||
|
||||
assertThat(jobExecutionEvent.getJobParameters().getParameters().size()).as("jobParameters size did not match")
|
||||
.isEqualTo(0);
|
||||
.isEqualTo(0);
|
||||
assertThat(jobExecutionEvent.getJobInstance().getJobName()).as("jobInstance name did not match")
|
||||
.isEqualTo(JOB_NAME);
|
||||
.isEqualTo(JOB_NAME);
|
||||
assertThat(jobExecutionEvent.getStepExecutions().size()).as("no step executions were expected").isEqualTo(0);
|
||||
assertThat(jobExecutionEvent.getExitStatus().getExitCode()).as("exitStatus did not match expected")
|
||||
.isEqualTo("UNKNOWN");
|
||||
.isEqualTo("UNKNOWN");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -118,13 +118,13 @@ public class JobExecutionEventTests {
|
||||
assertThat(jobExecutionEvent.getJobParameters().getDate("D")).as("Job Parameter D was expected").isNotNull();
|
||||
|
||||
assertThat(jobExecutionEvent.getJobParameters().getString("A")).as("Job Parameter A value was not correct")
|
||||
.isEqualTo("FOO");
|
||||
.isEqualTo("FOO");
|
||||
assertThat(jobExecutionEvent.getJobParameters().getLong("B")).as("Job Parameter B value was not correct")
|
||||
.isEqualTo(Long.valueOf(1));
|
||||
.isEqualTo(Long.valueOf(1));
|
||||
assertThat(jobExecutionEvent.getJobParameters().getDouble("C")).as("Job Parameter C value was not correct")
|
||||
.isEqualTo(Double.valueOf(1));
|
||||
.isEqualTo(Double.valueOf(1));
|
||||
assertThat(jobExecutionEvent.getJobParameters().getDate("D")).as("Job Parameter D value was not correct")
|
||||
.isEqualTo(testDate);
|
||||
.isEqualTo(testDate);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -285,20 +285,19 @@ public class JobExecutionEventTests {
|
||||
@Test
|
||||
public void testOrderConfiguration() {
|
||||
ApplicationContextRunner applicationContextRunner = new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
|
||||
SimpleTaskAutoConfiguration.class, SingleTaskConfiguration.class))
|
||||
.withUserConfiguration(BatchEventAutoConfiguration.JobExecutionListenerConfiguration.class)
|
||||
.withBean(
|
||||
"org.springframework.cloud.task.batch.listener.JobExecutionEventTests$BatchEventTestApplication",
|
||||
BatchEventTestApplication.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");
|
||||
.withConfiguration(AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
|
||||
SimpleTaskAutoConfiguration.class, SingleTaskConfiguration.class))
|
||||
.withUserConfiguration(BatchEventAutoConfiguration.JobExecutionListenerConfiguration.class)
|
||||
.withBean("org.springframework.cloud.task.batch.listener.JobExecutionEventTests$BatchEventTestApplication",
|
||||
BatchEventTestApplication.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);
|
||||
@@ -311,35 +310,33 @@ public class JobExecutionEventTests {
|
||||
@Test
|
||||
public void singleStepBatchJobSkip() {
|
||||
ApplicationContextRunner applicationContextRunner = new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
|
||||
SimpleTaskAutoConfiguration.class, SingleTaskConfiguration.class))
|
||||
.withUserConfiguration(BatchEventAutoConfiguration.JobExecutionListenerConfiguration.class)
|
||||
.withBean(
|
||||
"org.springframework.cloud.task.batch.listener.JobExecutionEventTests$BatchEventTestApplication",
|
||||
BatchEventTestApplication.class)
|
||||
.withPropertyValues("--spring.cloud.task.closecontext_enabled=false",
|
||||
"--spring.main.web-environment=false", "spring.batch.job.jobName=FOO");
|
||||
.withConfiguration(AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
|
||||
SimpleTaskAutoConfiguration.class, SingleTaskConfiguration.class))
|
||||
.withUserConfiguration(BatchEventAutoConfiguration.JobExecutionListenerConfiguration.class)
|
||||
.withBean("org.springframework.cloud.task.batch.listener.JobExecutionEventTests$BatchEventTestApplication",
|
||||
BatchEventTestApplication.class)
|
||||
.withPropertyValues("--spring.cloud.task.closecontext_enabled=false", "--spring.main.web-environment=false",
|
||||
"spring.batch.job.jobName=FOO");
|
||||
applicationContextRunner.run((context) -> {
|
||||
NoSuchBeanDefinitionException exception = Assertions.assertThrows(NoSuchBeanDefinitionException.class,
|
||||
() -> {
|
||||
context.getBean("jobExecutionEventsListener");
|
||||
});
|
||||
assertThat(exception.getMessage())
|
||||
.contains(String.format("No bean named 'jobExecutionEventsListener' available"));
|
||||
.contains(String.format("No bean named 'jobExecutionEventsListener' available"));
|
||||
});
|
||||
}
|
||||
|
||||
private void testDisabledConfiguration(String property, String disabledListener) {
|
||||
String disabledPropertyArg = (property != null) ? "--" + property + "=false" : "";
|
||||
ApplicationContextRunner applicationContextRunner = new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
|
||||
SimpleTaskAutoConfiguration.class, SingleTaskConfiguration.class))
|
||||
.withUserConfiguration(BatchEventAutoConfiguration.JobExecutionListenerConfiguration.class)
|
||||
.withBean(
|
||||
"org.springframework.cloud.task.batch.listener.JobExecutionEventTests$BatchEventTestApplication",
|
||||
BatchEventTestApplication.class)
|
||||
.withPropertyValues("--spring.cloud.task.closecontext_enabled=false",
|
||||
"--spring.main.web-environment=false", disabledPropertyArg);
|
||||
.withConfiguration(AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
|
||||
SimpleTaskAutoConfiguration.class, SingleTaskConfiguration.class))
|
||||
.withUserConfiguration(BatchEventAutoConfiguration.JobExecutionListenerConfiguration.class)
|
||||
.withBean("org.springframework.cloud.task.batch.listener.JobExecutionEventTests$BatchEventTestApplication",
|
||||
BatchEventTestApplication.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) {
|
||||
@@ -351,7 +348,7 @@ public class JobExecutionEventTests {
|
||||
exceptionThrown = true;
|
||||
}
|
||||
assertThat(exceptionThrown).as(String.format("Did not expect %s bean in context", beanName))
|
||||
.isTrue();
|
||||
.isTrue();
|
||||
}
|
||||
else {
|
||||
context.getBean(beanName);
|
||||
|
||||
@@ -56,23 +56,23 @@ public class StepExecutionEventTests {
|
||||
StepExecutionEvent stepExecutionEvent = new StepExecutionEvent(stepExecution);
|
||||
assertThat(stepExecutionEvent.getStepName()).as("stepName result was not as expected").isEqualTo(STEP_NAME);
|
||||
assertThat(stepExecutionEvent.getStartTime()).as("startTime result was not as expected")
|
||||
.isEqualTo(stepExecution.getStartTime());
|
||||
.isEqualTo(stepExecution.getStartTime());
|
||||
assertThat(stepExecutionEvent.getEndTime()).as("endTime result was not as expected")
|
||||
.isEqualTo(stepExecution.getEndTime());
|
||||
.isEqualTo(stepExecution.getEndTime());
|
||||
assertThat(stepExecutionEvent.getLastUpdated()).as("lastUpdated result was not as expected")
|
||||
.isEqualTo(stepExecution.getLastUpdated());
|
||||
.isEqualTo(stepExecution.getLastUpdated());
|
||||
assertThat(stepExecutionEvent.getCommitCount()).as("commitCount result was not as expected")
|
||||
.isEqualTo(stepExecution.getCommitCount());
|
||||
.isEqualTo(stepExecution.getCommitCount());
|
||||
assertThat(stepExecutionEvent.getReadCount()).as("readCount result was not as expected")
|
||||
.isEqualTo(stepExecution.getReadCount());
|
||||
.isEqualTo(stepExecution.getReadCount());
|
||||
assertThat(stepExecutionEvent.getReadSkipCount()).as("readSkipCount result was not as expected")
|
||||
.isEqualTo(stepExecution.getReadSkipCount());
|
||||
.isEqualTo(stepExecution.getReadSkipCount());
|
||||
assertThat(stepExecutionEvent.getWriteCount()).as("writeCount result was not as expected")
|
||||
.isEqualTo(stepExecution.getWriteCount());
|
||||
.isEqualTo(stepExecution.getWriteCount());
|
||||
assertThat(stepExecutionEvent.getWriteSkipCount()).as("writeSkipCount result was not as expected")
|
||||
.isEqualTo(stepExecution.getWriteSkipCount());
|
||||
.isEqualTo(stepExecution.getWriteSkipCount());
|
||||
assertThat(stepExecutionEvent.getSkipCount()).as("skipCount result was not as expected")
|
||||
.isEqualTo(stepExecution.getSkipCount());
|
||||
.isEqualTo(stepExecution.getSkipCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -90,9 +90,9 @@ public class StepExecutionEventTests {
|
||||
StepExecution stepExecution = getBasicStepExecution();
|
||||
StepExecutionEvent stepExecutionEvent = new StepExecutionEvent(stepExecution);
|
||||
assertThat(stepExecutionEvent.getSummary())
|
||||
.isEqualTo("StepExecutionEvent: id=null, version=null, name=STEP_NAME, status=STARTING,"
|
||||
+ " exitStatus=EXECUTING, readCount=0, filterCount=0, writeCount=0 readSkipCount=0,"
|
||||
+ " writeSkipCount=0, processSkipCount=0, commitCount=0, rollbackCount=0");
|
||||
.isEqualTo("StepExecutionEvent: id=null, version=null, name=STEP_NAME, status=STARTING,"
|
||||
+ " exitStatus=EXECUTING, readCount=0, filterCount=0, writeCount=0 readSkipCount=0,"
|
||||
+ " writeSkipCount=0, processSkipCount=0, commitCount=0, rollbackCount=0");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -97,7 +97,7 @@ public class TaskBatchEventListenerBeanPostProcessorTests {
|
||||
@Test
|
||||
public void testPostProcessor() {
|
||||
TaskBatchEventListenerBeanPostProcessor postProcessor = this.context
|
||||
.getBean(TaskBatchEventListenerBeanPostProcessor.class);
|
||||
.getBean(TaskBatchEventListenerBeanPostProcessor.class);
|
||||
assertThat(postProcessor).isNotNull();
|
||||
TaskletStep updatedTaskletStep = (TaskletStep) postProcessor.postProcessBeforeInitialization(this.taskletStep,
|
||||
"FOO");
|
||||
|
||||
@@ -43,8 +43,9 @@ public class TaskLaunchConfigurationExistingTests {
|
||||
@Test
|
||||
public void testTaskLauncher() {
|
||||
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(
|
||||
TaskLaunchConfigurationExistingTests.TestTaskDeployerConfiguration.class).web(WebApplicationType.NONE)
|
||||
.run("--spring.jmx.enabled=false")) {
|
||||
TaskLaunchConfigurationExistingTests.TestTaskDeployerConfiguration.class)
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.jmx.enabled=false")) {
|
||||
LocalTaskLauncher taskLauncher = context.getBean(LocalTaskLauncher.class);
|
||||
assertThat(testTaskLauncher).isNotNull();
|
||||
assertThat(taskLauncher).isNotNull();
|
||||
|
||||
@@ -60,7 +60,8 @@ public class TaskLauncherFunctionTests {
|
||||
public void testProcessorFromFunction() {
|
||||
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(
|
||||
TestChannelBinderConfiguration.getCompleteConfiguration(TaskLauncherSinkTestApplication.class))
|
||||
.web(WebApplicationType.NONE).run("--spring.jmx.enabled=false")) {
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.jmx.enabled=false")) {
|
||||
|
||||
InputDestination source = context.getBean(InputDestination.class);
|
||||
TaskLaunchRequest request = new TaskLaunchRequest(VALID_URL, Collections.emptyList(),
|
||||
@@ -79,7 +80,8 @@ public class TaskLauncherFunctionTests {
|
||||
commandLineArgs.add(PARAM2);
|
||||
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(
|
||||
TestChannelBinderConfiguration.getCompleteConfiguration(TaskLauncherSinkTestApplication.class))
|
||||
.web(WebApplicationType.NONE).run("--spring.jmx.enabled=false")) {
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.jmx.enabled=false")) {
|
||||
TaskConfiguration.TestTaskLauncher testTaskLauncher = launchTaskString(VALID_URL, commandLineArgs, null,
|
||||
context);
|
||||
verifySuccessWithParams(testTaskLauncher);
|
||||
@@ -96,7 +98,8 @@ public class TaskLauncherFunctionTests {
|
||||
public void testSuccessWithAppName() throws Exception {
|
||||
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(
|
||||
TestChannelBinderConfiguration.getCompleteConfiguration(TaskLauncherSinkTestApplication.class))
|
||||
.web(WebApplicationType.NONE).run("--spring.jmx.enabled=false")) {
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.jmx.enabled=false")) {
|
||||
TaskConfiguration.TestTaskLauncher testTaskLauncher = launchTaskString(VALID_URL, null, APP_NAME, context);
|
||||
verifySuccessWithAppName(testTaskLauncher);
|
||||
|
||||
@@ -112,7 +115,8 @@ public class TaskLauncherFunctionTests {
|
||||
public void testInvalidJar() throws Exception {
|
||||
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(
|
||||
TestChannelBinderConfiguration.getCompleteConfiguration(TaskLauncherSinkTestApplication.class))
|
||||
.web(WebApplicationType.NONE).run("--spring.jmx.enabled=false")) {
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.jmx.enabled=false")) {
|
||||
TaskConfiguration.TestTaskLauncher testTaskLauncher = launchTaskTaskLaunchRequest(INVALID_URL, null,
|
||||
APP_NAME, context);
|
||||
verifySuccessWithAppName(testTaskLauncher);
|
||||
@@ -123,9 +127,10 @@ public class TaskLauncherFunctionTests {
|
||||
public void testNoRun() {
|
||||
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(
|
||||
TestChannelBinderConfiguration.getCompleteConfiguration(TaskLauncherSinkTestApplication.class))
|
||||
.web(WebApplicationType.NONE).run("--spring.jmx.enabled=false")) {
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.jmx.enabled=false")) {
|
||||
TaskConfiguration.TestTaskLauncher testTaskLauncher = context
|
||||
.getBean(TaskConfiguration.TestTaskLauncher.class);
|
||||
.getBean(TaskConfiguration.TestTaskLauncher.class);
|
||||
assertThat(testTaskLauncher.status(DEFAULT_STATUS).getState()).isEqualTo(LaunchState.unknown);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,8 +37,10 @@ public class TaskEventTests {
|
||||
@Test
|
||||
public void testDefaultConfiguration() {
|
||||
ConfigurableApplicationContext applicationContext = new SpringApplicationBuilder()
|
||||
.sources(TestChannelBinderConfiguration.getCompleteConfiguration(TaskEventsApplication.class))
|
||||
.web(WebApplicationType.NONE).build().run();
|
||||
.sources(TestChannelBinderConfiguration.getCompleteConfiguration(TaskEventsApplication.class))
|
||||
.web(WebApplicationType.NONE)
|
||||
.build()
|
||||
.run();
|
||||
assertThat(applicationContext.getBean("taskEventEmitter")).isNotNull();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user