diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..0dfd30702 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +target +bin + diff --git a/archetypes/simple-cli/.springBeans b/archetypes/simple-cli/.springBeans index 7657879a7..f2c1c7d8a 100644 --- a/archetypes/simple-cli/.springBeans +++ b/archetypes/simple-cli/.springBeans @@ -1,13 +1,15 @@ 1 - + src/test/resources/test-context.xml + src/main/resources/META-INF/spring/module-context.xml + src/main/resources/launch-context.xml diff --git a/spring-batch-core/.settings/com.springsource.sts.config.flow.prefs b/spring-batch-core/.settings/com.springsource.sts.config.flow.prefs index eb16c0f70..191469bce 100644 --- a/spring-batch-core/.settings/com.springsource.sts.config.flow.prefs +++ b/spring-batch-core/.settings/com.springsource.sts.config.flow.prefs @@ -1,3 +1,4 @@ -#Wed Mar 24 07:48:49 GMT 2010 +#Thu Jun 24 11:17:24 BST 2010 //com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/batch\:/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/JobRepositoryDefaultParserTests-context.xml=\n +//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/batch\:/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/StepWithPojoListenerJobParserTests-context.xml=\n\n\n\n\n\n eclipse.preferences.version=1 diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepWithPojoListenerJobParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepWithPojoListenerJobParserTests.java new file mode 100644 index 000000000..be9b45a56 --- /dev/null +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepWithPojoListenerJobParserTests.java @@ -0,0 +1,70 @@ +/* + * Copyright 2006-2007 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.batch.core.configuration.xml; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.batch.core.BatchStatus; +import org.springframework.batch.core.Job; +import org.springframework.batch.core.JobExecution; +import org.springframework.batch.core.JobParameters; +import org.springframework.batch.core.repository.JobRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * @author Dave Syer + * + */ +@ContextConfiguration +@RunWith(SpringJUnit4ClassRunner.class) +public class StepWithPojoListenerJobParserTests { + + @Autowired + private Job job; + + @Autowired + private JobRepository jobRepository; + + @Autowired + private TestReader reader; + + @Autowired + @Qualifier("listener") + private TestPojoListener listener; + + @Autowired + private TestWriter writer; + + @Test + public void testStepWithTask() throws Exception { + assertNotNull(job); + JobExecution jobExecution = jobRepository.createJobExecution(job.getName(), new JobParameters()); + job.execute(jobExecution); + assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus()); + assertEquals(1, jobExecution.getStepExecutions().size()); + assertTrue(reader.isExecuted()); + assertTrue(reader.isOpened()); + assertTrue(writer.isExecuted()); + assertTrue(listener.isExecuted()); + } +} diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestPojoListener.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestPojoListener.java new file mode 100644 index 000000000..529672f7c --- /dev/null +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestPojoListener.java @@ -0,0 +1,14 @@ +package org.springframework.batch.core.configuration.xml; + +import java.util.List; + +import org.springframework.batch.core.annotation.AfterWrite; + +public class TestPojoListener extends AbstractTestComponent { + + @AfterWrite + public void after(List items){ + executed = true; + } + +} diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/StepWithPojoListenerJobParserTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/StepWithPojoListenerJobParserTests-context.xml new file mode 100644 index 000000000..992a1abf1 --- /dev/null +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/StepWithPojoListenerJobParserTests-context.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file