Replace "Master/Slave" with "Manager/Worker"
Resolves BATCH-2834
This commit is contained in:
committed by
Michael Minella
parent
3f126fe0ff
commit
3743894fa4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2018 the original author or authors.
|
||||
* Copyright 2018-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -66,12 +66,13 @@ import static org.mockito.Mockito.atLeastOnce;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(classes = {RemoteChunkingMasterStepBuilderTest.BatchConfiguration.class})
|
||||
public class RemoteChunkingMasterStepBuilderTest {
|
||||
@ContextConfiguration(classes = {RemoteChunkingManagerStepBuilderTest.BatchConfiguration.class})
|
||||
public class RemoteChunkingManagerStepBuilderTest {
|
||||
|
||||
@Rule
|
||||
public ExpectedException expectedException = ExpectedException.none();
|
||||
@@ -92,7 +93,7 @@ public class RemoteChunkingMasterStepBuilderTest {
|
||||
this.expectedException.expectMessage("inputChannel must not be null");
|
||||
|
||||
// when
|
||||
TaskletStep step = new RemoteChunkingMasterStepBuilder<String, String>("step")
|
||||
TaskletStep step = new RemoteChunkingManagerStepBuilder<String, String>("step")
|
||||
.inputChannel(null)
|
||||
.build();
|
||||
|
||||
@@ -107,7 +108,7 @@ public class RemoteChunkingMasterStepBuilderTest {
|
||||
this.expectedException.expectMessage("outputChannel must not be null");
|
||||
|
||||
// when
|
||||
TaskletStep step = new RemoteChunkingMasterStepBuilder<String, String>("step")
|
||||
TaskletStep step = new RemoteChunkingManagerStepBuilder<String, String>("step")
|
||||
.outputChannel(null)
|
||||
.build();
|
||||
|
||||
@@ -122,7 +123,7 @@ public class RemoteChunkingMasterStepBuilderTest {
|
||||
this.expectedException.expectMessage("messagingTemplate must not be null");
|
||||
|
||||
// when
|
||||
TaskletStep step = new RemoteChunkingMasterStepBuilder<String, String>("step")
|
||||
TaskletStep step = new RemoteChunkingManagerStepBuilder<String, String>("step")
|
||||
.messagingTemplate(null)
|
||||
.build();
|
||||
|
||||
@@ -137,7 +138,7 @@ public class RemoteChunkingMasterStepBuilderTest {
|
||||
this.expectedException.expectMessage("maxWaitTimeouts must be greater than zero");
|
||||
|
||||
// when
|
||||
TaskletStep step = new RemoteChunkingMasterStepBuilder<String, String>("step")
|
||||
TaskletStep step = new RemoteChunkingManagerStepBuilder<String, String>("step")
|
||||
.maxWaitTimeouts(-1)
|
||||
.build();
|
||||
|
||||
@@ -152,7 +153,7 @@ public class RemoteChunkingMasterStepBuilderTest {
|
||||
this.expectedException.expectMessage("throttleLimit must be greater than zero");
|
||||
|
||||
// when
|
||||
TaskletStep step = new RemoteChunkingMasterStepBuilder<String, String>("step")
|
||||
TaskletStep step = new RemoteChunkingManagerStepBuilder<String, String>("step")
|
||||
.throttleLimit(-1L)
|
||||
.build();
|
||||
|
||||
@@ -163,7 +164,7 @@ public class RemoteChunkingMasterStepBuilderTest {
|
||||
@Test
|
||||
public void testMandatoryInputChannel() {
|
||||
// given
|
||||
RemoteChunkingMasterStepBuilder<String, String> builder = new RemoteChunkingMasterStepBuilder<>("step");
|
||||
RemoteChunkingManagerStepBuilder<String, String> builder = new RemoteChunkingManagerStepBuilder<>("step");
|
||||
|
||||
this.expectedException.expect(IllegalArgumentException.class);
|
||||
this.expectedException.expectMessage("An InputChannel must be provided");
|
||||
@@ -178,7 +179,7 @@ public class RemoteChunkingMasterStepBuilderTest {
|
||||
@Test
|
||||
public void eitherOutputChannelOrMessagingTemplateMustBeProvided() {
|
||||
// given
|
||||
RemoteChunkingMasterStepBuilder<String, String> builder = new RemoteChunkingMasterStepBuilder<String, String>("step")
|
||||
RemoteChunkingManagerStepBuilder<String, String> builder = new RemoteChunkingManagerStepBuilder<String, String>("step")
|
||||
.inputChannel(this.inputChannel)
|
||||
.outputChannel(new DirectChannel())
|
||||
.messagingTemplate(new MessagingTemplate());
|
||||
@@ -197,13 +198,13 @@ public class RemoteChunkingMasterStepBuilderTest {
|
||||
public void testUnsupportedOperationExceptionWhenSpecifyingAnItemWriter() {
|
||||
// given
|
||||
this.expectedException.expect(UnsupportedOperationException.class);
|
||||
this.expectedException.expectMessage("When configuring a master " +
|
||||
this.expectedException.expectMessage("When configuring a manager " +
|
||||
"step for remote chunking, the item writer will be automatically " +
|
||||
"set to an instance of ChunkMessageChannelItemWriter. " +
|
||||
"The item writer must not be provided in this case.");
|
||||
|
||||
// when
|
||||
TaskletStep step = new RemoteChunkingMasterStepBuilder<String, String>("step")
|
||||
TaskletStep step = new RemoteChunkingManagerStepBuilder<String, String>("step")
|
||||
.reader(this.itemReader)
|
||||
.writer(items -> { })
|
||||
.repository(this.jobRepository)
|
||||
@@ -217,9 +218,9 @@ public class RemoteChunkingMasterStepBuilderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMasterStepCreation() {
|
||||
public void testManagerStepCreation() {
|
||||
// when
|
||||
TaskletStep taskletStep = new RemoteChunkingMasterStepBuilder<String, String>("step")
|
||||
TaskletStep taskletStep = new RemoteChunkingManagerStepBuilder<String, String>("step")
|
||||
.reader(this.itemReader)
|
||||
.repository(this.jobRepository)
|
||||
.transactionManager(this.transactionManager)
|
||||
@@ -292,7 +293,7 @@ public class RemoteChunkingMasterStepBuilderTest {
|
||||
}
|
||||
};
|
||||
|
||||
TaskletStep taskletStep = new RemoteChunkingMasterStepBuilder<String, String>("step")
|
||||
TaskletStep taskletStep = new RemoteChunkingManagerStepBuilder<String, String>("step")
|
||||
.reader(itemReader)
|
||||
.readerIsTransactionalQueue()
|
||||
.processor(itemProcessor)
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014 the original author or authors.
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -42,16 +42,21 @@ import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Test cases for the {@link org.springframework.batch.integration.config.xml.RemoteChunkingSlaveParser}
|
||||
* and {@link org.springframework.batch.integration.config.xml.RemoteChunkingMasterParser}.
|
||||
* Test cases for the {@link RemoteChunkingWorkerParser}
|
||||
* and {@link RemoteChunkingManagerParser}.
|
||||
* </p>
|
||||
*
|
||||
* @author Chris Schaefer
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 3.1
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public class RemoteChunkingParserTests {
|
||||
|
||||
/* TODO delete the following deprecated tests when related APIs are removed
|
||||
* /!\ Deliberately not using parametrized tests as it will be easier to delete
|
||||
* the following tests afterwards
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Test
|
||||
public void testRemoteChunkingSlaveParserWithProcessorDefined() {
|
||||
@@ -267,6 +272,223 @@ public class RemoteChunkingParserTests {
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO end of deprecated tests to remove */
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Test
|
||||
public void testRemoteChunkingWorkerParserWithProcessorDefined() {
|
||||
ApplicationContext applicationContext =
|
||||
new ClassPathXmlApplicationContext("/org/springframework/batch/integration/config/xml/RemoteChunkingWorkerParserTests.xml");
|
||||
|
||||
ChunkHandler chunkHandler = applicationContext.getBean(ChunkProcessorChunkHandler.class);
|
||||
ChunkProcessor chunkProcessor = (SimpleChunkProcessor) TestUtils.getPropertyValue(chunkHandler, "chunkProcessor");
|
||||
assertNotNull("ChunkProcessor must not be null", chunkProcessor);
|
||||
|
||||
ItemWriter<String> itemWriter = (ItemWriter<String>) TestUtils.getPropertyValue(chunkProcessor, "itemWriter");
|
||||
assertNotNull("ChunkProcessor ItemWriter must not be null", itemWriter);
|
||||
assertTrue("Got wrong instance of ItemWriter", itemWriter instanceof Writer);
|
||||
|
||||
ItemProcessor<String, String> itemProcessor = (ItemProcessor<String, String>) TestUtils.getPropertyValue(chunkProcessor, "itemProcessor");
|
||||
assertNotNull("ChunkProcessor ItemWriter must not be null", itemProcessor);
|
||||
assertTrue("Got wrong instance of ItemProcessor", itemProcessor instanceof Processor);
|
||||
|
||||
FactoryBean serviceActivatorFactoryBean = applicationContext.getBean(ServiceActivatorFactoryBean.class);
|
||||
assertNotNull("ServiceActivatorFactoryBean must not be null", serviceActivatorFactoryBean);
|
||||
assertNotNull("Output channel name must not be null", TestUtils.getPropertyValue(serviceActivatorFactoryBean, "outputChannelName"));
|
||||
|
||||
MessageChannel inputChannel = applicationContext.getBean("requests", MessageChannel.class);
|
||||
assertNotNull("Input channel must not be null", inputChannel);
|
||||
|
||||
String targetMethodName = (String) TestUtils.getPropertyValue(serviceActivatorFactoryBean, "targetMethodName");
|
||||
assertNotNull("Target method name must not be null", targetMethodName);
|
||||
assertTrue("Target method name must be handleChunk, got: " + targetMethodName, "handleChunk".equals(targetMethodName));
|
||||
|
||||
ChunkHandler targetObject = (ChunkHandler) TestUtils.getPropertyValue(serviceActivatorFactoryBean, "targetObject");
|
||||
assertNotNull("Target object must not be null", targetObject);
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Test
|
||||
public void testRemoteChunkingWorkerParserWithProcessorNotDefined() {
|
||||
ApplicationContext applicationContext =
|
||||
new ClassPathXmlApplicationContext("/org/springframework/batch/integration/config/xml/RemoteChunkingWorkerParserNoProcessorTests.xml");
|
||||
|
||||
ChunkHandler chunkHandler = applicationContext.getBean(ChunkProcessorChunkHandler.class);
|
||||
ChunkProcessor chunkProcessor = (SimpleChunkProcessor) TestUtils.getPropertyValue(chunkHandler, "chunkProcessor");
|
||||
assertNotNull("ChunkProcessor must not be null", chunkProcessor);
|
||||
|
||||
ItemProcessor<String, String> itemProcessor = (ItemProcessor<String, String>) TestUtils.getPropertyValue(chunkProcessor, "itemProcessor");
|
||||
assertNotNull("ChunkProcessor ItemWriter must not be null", itemProcessor);
|
||||
assertTrue("Got wrong instance of ItemProcessor", itemProcessor instanceof PassThroughItemProcessor);
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Test
|
||||
public void testRemoteChunkingManagerParser() {
|
||||
ApplicationContext applicationContext =
|
||||
new ClassPathXmlApplicationContext("/org/springframework/batch/integration/config/xml/RemoteChunkingManagerParserTests.xml");
|
||||
|
||||
ItemWriter itemWriter = applicationContext.getBean("itemWriter", ChunkMessageChannelItemWriter.class);
|
||||
assertNotNull("Messaging template must not be null", TestUtils.getPropertyValue(itemWriter, "messagingGateway"));
|
||||
assertNotNull("Reply channel must not be null", TestUtils.getPropertyValue(itemWriter, "replyChannel"));
|
||||
|
||||
FactoryBean<ChunkHandler> remoteChunkingHandlerFactoryBean = applicationContext.getBean(RemoteChunkHandlerFactoryBean.class);
|
||||
assertNotNull("Chunk writer must not be null", TestUtils.getPropertyValue(remoteChunkingHandlerFactoryBean, "chunkWriter"));
|
||||
assertNotNull("Step must not be null", TestUtils.getPropertyValue(remoteChunkingHandlerFactoryBean, "step"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoteChunkingManagerIdAttrAssert() throws Exception {
|
||||
ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext();
|
||||
applicationContext.setValidating(false);
|
||||
applicationContext.setConfigLocation("/org/springframework/batch/integration/config/xml/RemoteChunkingManagerParserMissingIdAttrTests.xml");
|
||||
|
||||
try {
|
||||
applicationContext.refresh();
|
||||
fail();
|
||||
} catch (BeanDefinitionStoreException e) {
|
||||
assertTrue("Nested exception must be of type IllegalArgumentException", e.getCause() instanceof IllegalArgumentException);
|
||||
|
||||
IllegalArgumentException iae = (IllegalArgumentException) e.getCause();
|
||||
|
||||
assertTrue("Expected: " + "The id attribute must be specified" + " but got: " + iae.getMessage(),
|
||||
"The id attribute must be specified".equals(iae.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoteChunkingManagerMessageTemplateAttrAssert() throws Exception {
|
||||
ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext();
|
||||
applicationContext.setValidating(false);
|
||||
applicationContext.setConfigLocation("/org/springframework/batch/integration/config/xml/RemoteChunkingManagerParserMissingMessageTemplateAttrTests.xml");
|
||||
|
||||
try {
|
||||
applicationContext.refresh();
|
||||
fail();
|
||||
} catch (BeanDefinitionStoreException e) {
|
||||
assertTrue("Nested exception must be of type IllegalArgumentException", e.getCause() instanceof IllegalArgumentException);
|
||||
|
||||
IllegalArgumentException iae = (IllegalArgumentException) e.getCause();
|
||||
|
||||
assertTrue("Expected: " + "The message-template attribute must be specified" + " but got: " + iae.getMessage(),
|
||||
"The message-template attribute must be specified".equals(iae.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoteChunkingManagerStepAttrAssert() throws Exception {
|
||||
ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext();
|
||||
applicationContext.setValidating(false);
|
||||
applicationContext.setConfigLocation("/org/springframework/batch/integration/config/xml/RemoteChunkingManagerParserMissingStepAttrTests.xml");
|
||||
|
||||
try {
|
||||
applicationContext.refresh();
|
||||
fail();
|
||||
} catch (BeanDefinitionStoreException e) {
|
||||
assertTrue("Nested exception must be of type IllegalArgumentException", e.getCause() instanceof IllegalArgumentException);
|
||||
|
||||
IllegalArgumentException iae = (IllegalArgumentException) e.getCause();
|
||||
|
||||
assertTrue("Expected: " + "The step attribute must be specified" + " but got: " + iae.getMessage(),
|
||||
"The step attribute must be specified".equals(iae.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoteChunkingManagerReplyChannelAttrAssert() throws Exception {
|
||||
ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext();
|
||||
applicationContext.setValidating(false);
|
||||
applicationContext.setConfigLocation("/org/springframework/batch/integration/config/xml/RemoteChunkingManagerParserMissingReplyChannelAttrTests.xml");
|
||||
|
||||
try {
|
||||
applicationContext.refresh();
|
||||
fail();
|
||||
} catch (BeanDefinitionStoreException e) {
|
||||
assertTrue("Nested exception must be of type IllegalArgumentException", e.getCause() instanceof IllegalArgumentException);
|
||||
|
||||
IllegalArgumentException iae = (IllegalArgumentException) e.getCause();
|
||||
|
||||
assertTrue("Expected: " + "The reply-channel attribute must be specified" + " but got: " + iae.getMessage(),
|
||||
"The reply-channel attribute must be specified".equals(iae.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoteChunkingWorkerIdAttrAssert() throws Exception {
|
||||
ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext();
|
||||
applicationContext.setValidating(false);
|
||||
applicationContext.setConfigLocation("/org/springframework/batch/integration/config/xml/RemoteChunkingWorkerParserMissingIdAttrTests.xml");
|
||||
|
||||
try {
|
||||
applicationContext.refresh();
|
||||
fail();
|
||||
} catch (BeanDefinitionStoreException e) {
|
||||
assertTrue("Nested exception must be of type IllegalArgumentException", e.getCause() instanceof IllegalArgumentException);
|
||||
|
||||
IllegalArgumentException iae = (IllegalArgumentException) e.getCause();
|
||||
|
||||
assertTrue("Expected: " + "The id attribute must be specified" + " but got: " + iae.getMessage(),
|
||||
"The id attribute must be specified".equals(iae.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoteChunkingWorkerInputChannelAttrAssert() throws Exception {
|
||||
ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext();
|
||||
applicationContext.setValidating(false);
|
||||
applicationContext.setConfigLocation("/org/springframework/batch/integration/config/xml/RemoteChunkingWorkerParserMissingInputChannelAttrTests.xml");
|
||||
|
||||
try {
|
||||
applicationContext.refresh();
|
||||
fail();
|
||||
} catch (BeanDefinitionStoreException e) {
|
||||
assertTrue("Nested exception must be of type IllegalArgumentException", e.getCause() instanceof IllegalArgumentException);
|
||||
|
||||
IllegalArgumentException iae = (IllegalArgumentException) e.getCause();
|
||||
|
||||
assertTrue("Expected: " + "The input-channel attribute must be specified" + " but got: " + iae.getMessage(),
|
||||
"The input-channel attribute must be specified".equals(iae.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoteChunkingWorkerItemWriterAttrAssert() throws Exception {
|
||||
ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext();
|
||||
applicationContext.setValidating(false);
|
||||
applicationContext.setConfigLocation("/org/springframework/batch/integration/config/xml/RemoteChunkingWorkerParserMissingItemWriterAttrTests.xml");
|
||||
|
||||
try {
|
||||
applicationContext.refresh();
|
||||
fail();
|
||||
} catch (BeanDefinitionStoreException e) {
|
||||
assertTrue("Nested exception must be of type IllegalArgumentException", e.getCause() instanceof IllegalArgumentException);
|
||||
|
||||
IllegalArgumentException iae = (IllegalArgumentException) e.getCause();
|
||||
|
||||
assertTrue("Expected: " + "The item-writer attribute must be specified" + " but got: " + iae.getMessage(),
|
||||
"The item-writer attribute must be specified".equals(iae.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoteChunkingWorkerOutputChannelAttrAssert() throws Exception {
|
||||
ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext();
|
||||
applicationContext.setValidating(false);
|
||||
applicationContext.setConfigLocation("/org/springframework/batch/integration/config/xml/RemoteChunkingWorkerParserMissingOutputChannelAttrTests.xml");
|
||||
|
||||
try {
|
||||
applicationContext.refresh();
|
||||
fail();
|
||||
} catch (BeanDefinitionStoreException e) {
|
||||
assertTrue("Nested exception must be of type IllegalArgumentException", e.getCause() instanceof IllegalArgumentException);
|
||||
|
||||
IllegalArgumentException iae = (IllegalArgumentException) e.getCause();
|
||||
|
||||
assertTrue("Expected: " + "The output-channel attribute must be specified" + " but got: " + iae.getMessage(),
|
||||
"The output-channel attribute must be specified".equals(iae.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Writer implements ItemWriter<String> {
|
||||
@Override
|
||||
public void write(List<? extends String> items) throws Exception {
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:batch-int="http://www.springframework.org/schema/batch-integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/batch-integration
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
|
||||
|
||||
<batch-int:remote-chunking-manager message-template="messagingTemplate" step="process" reply-channel="replies"/>
|
||||
</beans>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:batch-int="http://www.springframework.org/schema/batch-integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/batch-integration
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
|
||||
|
||||
<batch-int:remote-chunking-manager id="itemWriter" step="process" reply-channel="replies"/>
|
||||
</beans>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:batch-int="http://www.springframework.org/schema/batch-integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/batch-integration
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
|
||||
|
||||
<batch-int:remote-chunking-manager id="itemWriter" message-template="messagingTemplate" step="process"/>
|
||||
</beans>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:batch-int="http://www.springframework.org/schema/batch-integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/batch-integration
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
|
||||
|
||||
<batch-int:remote-chunking-manager id="itemWriter" message-template="messagingTemplate" reply-channel="replies"/>
|
||||
</beans>
|
||||
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:batch="http://www.springframework.org/schema/batch"
|
||||
xmlns:batch-int="http://www.springframework.org/schema/batch-integration"
|
||||
xmlns:p="http://www.springframework.org/schema/p"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/batch
|
||||
https://www.springframework.org/schema/batch/spring-batch.xsd
|
||||
http://www.springframework.org/schema/batch-integration
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd
|
||||
http://www.springframework.org/schema/integration https://www.springframework.org/schema/integration/spring-integration.xsd">
|
||||
|
||||
<batch:job id="processingJob">
|
||||
<batch:step id="process">
|
||||
<batch:tasklet>
|
||||
<batch:chunk reader="itemReader" writer="itemWriter" commit-interval="6"/>
|
||||
</batch:tasklet>
|
||||
</batch:step>
|
||||
</batch:job>
|
||||
|
||||
<batch:job-repository/>
|
||||
|
||||
<bean id="itemReader" class="org.springframework.batch.item.support.ListItemReader">
|
||||
<constructor-arg>
|
||||
<list>
|
||||
<value>1</value>
|
||||
<value>2</value>
|
||||
<value>3</value>
|
||||
<value>4</value>
|
||||
<value>5</value>
|
||||
<value>6</value>
|
||||
</list>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<batch-int:remote-chunking-manager id="itemWriter" message-template="messagingTemplate" step="process" reply-channel="replies"/>
|
||||
|
||||
<bean id="messagingTemplate" class="org.springframework.integration.core.MessagingTemplate"/>
|
||||
|
||||
<int:channel id="replies">
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
<bean id="placeholderProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
|
||||
p:location="classpath:batch-${ENVIRONMENT:hsql}.properties"/>
|
||||
|
||||
<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource"
|
||||
p:driverClassName="${batch.jdbc.driver}" p:url="${batch.jdbc.url}"
|
||||
p:username="${batch.jdbc.user}" p:password="${batch.jdbc.password}"/>
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"
|
||||
p:dataSource-ref="dataSource"/>
|
||||
</beans>
|
||||
@@ -6,7 +6,7 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/batch-integration
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration-3.1.xsd">
|
||||
|
||||
<batch-int:remote-chunking-master message-template="messagingTemplate" step="process" reply-channel="replies"/>
|
||||
</beans>
|
||||
</beans>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/batch-integration
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration-3.1.xsd">
|
||||
|
||||
<batch-int:remote-chunking-master id="itemWriter" step="process" reply-channel="replies"/>
|
||||
</beans>
|
||||
</beans>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/batch-integration
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration-3.1.xsd">
|
||||
|
||||
<batch-int:remote-chunking-master id="itemWriter" message-template="messagingTemplate" step="process"/>
|
||||
</beans>
|
||||
</beans>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/batch-integration
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration-3.1.xsd">
|
||||
|
||||
<batch-int:remote-chunking-master id="itemWriter" message-template="messagingTemplate" reply-channel="replies"/>
|
||||
</beans>
|
||||
</beans>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
http://www.springframework.org/schema/batch
|
||||
https://www.springframework.org/schema/batch/spring-batch.xsd
|
||||
http://www.springframework.org/schema/batch-integration
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration-3.1.xsd
|
||||
http://www.springframework.org/schema/integration https://www.springframework.org/schema/integration/spring-integration.xsd">
|
||||
|
||||
<batch:job id="processingJob">
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/batch-integration
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration-3.1.xsd">
|
||||
|
||||
<batch-int:remote-chunking-slave input-channel="requests" output-channel="replies"
|
||||
item-processor="itemProcessor" item-writer="itemWriter"/>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/batch-integration
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration-3.1.xsd">
|
||||
|
||||
<batch-int:remote-chunking-slave id="remote-chunking-slave" output-channel="replies"
|
||||
item-processor="itemProcessor" item-writer="itemWriter"/>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/batch-integration
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration-3.1.xsd">
|
||||
|
||||
<batch-int:remote-chunking-slave id="remote-chunking-slave" input-channel="requests" output-channel="replies"
|
||||
item-processor="itemProcessor"/>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/batch-integration
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration-3.1.xsd">
|
||||
|
||||
<batch-int:remote-chunking-slave id="remote-chunking-slave" input-channel="requests"
|
||||
item-processor="itemProcessor" item-writer="itemWriter"/>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/batch-integration
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration-3.1.xsd">
|
||||
|
||||
<batch-int:remote-chunking-slave id="remote-chunking-slave" input-channel="requests" output-channel="replies"
|
||||
item-writer="itemWriter"/>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/batch-integration
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration-3.1.xsd">
|
||||
|
||||
<batch-int:remote-chunking-slave id="remote-chunking-slave" input-channel="requests" output-channel="replies"
|
||||
item-processor="itemProcessor" item-writer="itemWriter"/>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:batch-int="http://www.springframework.org/schema/batch-integration"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/batch-integration
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
|
||||
|
||||
<batch-int:remote-chunking-worker input-channel="requests" output-channel="replies"
|
||||
item-processor="itemProcessor" item-writer="itemWriter"/>
|
||||
</beans>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:batch-int="http://www.springframework.org/schema/batch-integration"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/batch-integration
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
|
||||
|
||||
<batch-int:remote-chunking-worker id="remote-chunking-worker" output-channel="replies"
|
||||
item-processor="itemProcessor" item-writer="itemWriter"/>
|
||||
</beans>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:batch-int="http://www.springframework.org/schema/batch-integration"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/batch-integration
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
|
||||
|
||||
<batch-int:remote-chunking-worker id="remote-chunking-worker" input-channel="requests" output-channel="replies"
|
||||
item-processor="itemProcessor"/>
|
||||
</beans>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:batch-int="http://www.springframework.org/schema/batch-integration"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/batch-integration
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
|
||||
|
||||
<batch-int:remote-chunking-worker id="remote-chunking-worker" input-channel="requests"
|
||||
item-processor="itemProcessor" item-writer="itemWriter"/>
|
||||
</beans>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:batch-int="http://www.springframework.org/schema/batch-integration"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/batch-integration
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
|
||||
|
||||
<batch-int:remote-chunking-worker id="remote-chunking-worker" input-channel="requests" output-channel="replies"
|
||||
item-writer="itemWriter"/>
|
||||
|
||||
<bean id="itemProcessor" class="org.springframework.batch.integration.config.xml.RemoteChunkingParserTests$Processor"/>
|
||||
|
||||
<bean id="itemWriter" class="org.springframework.batch.integration.config.xml.RemoteChunkingParserTests$Writer"/>
|
||||
|
||||
<int:channel id="requests"/>
|
||||
<int:channel id="replies"/>
|
||||
</beans>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:batch-int="http://www.springframework.org/schema/batch-integration"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/batch-integration
|
||||
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
|
||||
|
||||
<batch-int:remote-chunking-worker id="remote-chunking-worker" input-channel="requests" output-channel="replies"
|
||||
item-processor="itemProcessor" item-writer="itemWriter"/>
|
||||
|
||||
<bean id="itemProcessor" class="org.springframework.batch.integration.config.xml.RemoteChunkingParserTests$Processor"/>
|
||||
|
||||
<bean id="itemWriter" class="org.springframework.batch.integration.config.xml.RemoteChunkingParserTests$Writer"/>
|
||||
|
||||
<int:channel id="requests"/>
|
||||
<int:channel id="replies"/>
|
||||
</beans>
|
||||
Reference in New Issue
Block a user