BATCH-2223: Removed 'archetypes' in favor of Spring Boot based start up
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- This file is imported in the archetype pom.xml files for integration tests -->
|
||||
<project name="common-test" default="test">
|
||||
|
||||
<property name="version" value="${version}"/>
|
||||
<property name="archetype" value="${archetype}"/>
|
||||
<property name="test.dir" value="${basedir}/target/test-archetype"/>
|
||||
|
||||
<target name="test" description="Tests that 'mvn integration-test' works with archetype">
|
||||
<echo message="Creating archetype '${archetype}', version '${version}'"/>
|
||||
<test archetype="${archetype}" version="${version}"/>
|
||||
</target>
|
||||
|
||||
<macrodef name="test">
|
||||
<attribute name="archetype"/>
|
||||
<attribute name="version"/>
|
||||
|
||||
<sequential>
|
||||
<delete dir="${test.dir}"/>
|
||||
<mkdir dir="${test.dir}"/>
|
||||
<maven dir="${basedir}" command="install -Dmaven.test.skip=true"/>
|
||||
<maven dir="${test.dir}" archetype="@{archetype}" version="@{version}" />
|
||||
<maven dir="${test.dir}/test" command="clean package exec:exec"/>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<macrodef name="maven">
|
||||
<attribute name="dir"/>
|
||||
<attribute name="name" default=""/>
|
||||
<attribute name="archetype" default=""/>
|
||||
<attribute name="version" default=""/>
|
||||
<attribute name="command" default="-e archetype:create -DarchetypeGroupId=org.springframework.batch -DarchetypeArtifactId=@{archetype} -DarchetypeVersion=@{version} -DgroupId=com.foo -DartifactId=test"/>
|
||||
|
||||
<sequential>
|
||||
<exec dir="@{dir}" executable="mvn.bat" os="Windows XP" failonerror="true">
|
||||
<arg line="@{command}"/>
|
||||
</exec>
|
||||
<exec dir="@{dir}" executable="mvn" os="Mac OS X" failonerror="true">
|
||||
<arg line="@{command}"/>
|
||||
</exec>
|
||||
<exec dir="@{dir}" executable="mvn" os="Linux" failonerror="true">
|
||||
<arg line="@{command}"/>
|
||||
</exec>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
</project>
|
||||
@@ -1,32 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>spring-batch-archetype</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>Archetypes</name>
|
||||
<url>http://docs.spring.io/spring-batch/${artifactId}</url>
|
||||
<description>Spring Batch archetypes are simple project templates containing just enough code to get you started running a job. For more detailed examples of using particular features of the framework, look at the Spring Batch Samples project. Currently the archetypes are deployed as regular Maven projects (not archetypes), because of limitations in the archetype plugin (or our understanding of how it works). For most effective use, copy one into Eclipse and use Q4E to manage the dependencies.</description>
|
||||
<parent>
|
||||
<groupId>org.springframework.batch</groupId>
|
||||
<artifactId>spring-batch-parent</artifactId>
|
||||
<version>3.0.0.BUILD-SNAPSHOT</version>
|
||||
<relativePath>../spring-batch-parent</relativePath>
|
||||
</parent>
|
||||
<modules>
|
||||
<module>simple-cli</module>
|
||||
<module>simple-cli-javaconfig</module>
|
||||
</modules>
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<junitArtifactName>junit:junit</junitArtifactName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,287 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.batch</groupId>
|
||||
<artifactId>spring-batch-simple-cli-javaconfig</artifactId>
|
||||
<version>3.0.0.BUILD-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>Commandline</name>
|
||||
<url>http://projects.spring.io/spring-batch/</url>
|
||||
<description>This project is a command line batch sample from Spring Batch demonstrating a typical batch job.
|
||||
The job can be invoked via "mvn exec:java" to see the job run from the command line.
|
||||
During an "mvn package", a distribution archive in the format defined in src/main/assembly/descriptor.xml will
|
||||
be created in the target directory which can be deployed and extracted to your target location of choice.
|
||||
The ./bin/runJob.(sh|bat) script from the extracted deployment archive can be invoked to run the job.
|
||||
</description>
|
||||
<properties>
|
||||
<spring.framework.version>4.0.2.RELEASE</spring.framework.version>
|
||||
<spring.batch.version>3.0.0.BUILD-SNAPSHOT</spring.batch.version>
|
||||
<dependency.locations.enabled>false</dependency.locations.enabled>
|
||||
<junit.version>4.10</junit.version>
|
||||
<maven.compiler.plugin>3.1</maven.compiler.plugin>
|
||||
<compiler.target.version>1.6</compiler.target.version>
|
||||
<compiler.source.version>1.6</compiler.source.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>staging</id>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>staging</id>
|
||||
<url>file:///${user.dir}/target/staging</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>staging</id>
|
||||
<url>file:///${user.dir}/target/staging</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>bootstrap</id>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>Codehaus</id>
|
||||
<url>http://repository.codehaus.org/</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
<pluginRepository>
|
||||
<id>com.springsource.repository.bundles.release</id>
|
||||
<name>SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases</name>
|
||||
<url>http://repository.springsource.com/maven/bundles/release</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
</profiles>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<version>${spring.framework.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aop</artifactId>
|
||||
<version>${spring.framework.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jdbc</artifactId>
|
||||
<version>${spring.framework.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.batch</groupId>
|
||||
<artifactId>spring-batch-core</artifactId>
|
||||
<version>${spring.batch.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.batch</groupId>
|
||||
<artifactId>spring-batch-infrastructure</artifactId>
|
||||
<version>${spring.batch.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.batch</groupId>
|
||||
<artifactId>spring-batch-test</artifactId>
|
||||
<version>${spring.batch.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-dbcp</groupId>
|
||||
<artifactId>commons-dbcp</artifactId>
|
||||
<version>1.2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.5.8</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.14</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hsqldb</groupId>
|
||||
<artifactId>hsqldb</artifactId>
|
||||
<version>2.2.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjrt</artifactId>
|
||||
<version>1.6.8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjweaver</artifactId>
|
||||
<version>1.6.8</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>org.springframework.build.aws</groupId>
|
||||
<artifactId>org.springframework.build.aws.maven</artifactId>
|
||||
<version>3.0.0.RELEASE</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<inherited>false</inherited>
|
||||
<configuration>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>project</descriptorRef>
|
||||
</descriptorRefs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!--This plugin's configuration is used to store Eclipse m2e settings
|
||||
only. It has no influence on the Maven build itself. -->
|
||||
<plugin>
|
||||
<groupId>org.eclipse.m2e</groupId>
|
||||
<artifactId>lifecycle-mapping</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<configuration>
|
||||
<lifecycleMappingMetadata>
|
||||
<pluginExecutions>
|
||||
<pluginExecution>
|
||||
<pluginExecutionFilter>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<versionRange>[1.0,)</versionRange>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
</pluginExecutionFilter>
|
||||
<action>
|
||||
<ignore />
|
||||
</action>
|
||||
</pluginExecution>
|
||||
</pluginExecutions>
|
||||
</lifecycleMappingMetadata>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>${maven.compiler.plugin}</version>
|
||||
<configuration>
|
||||
<source>${compiler.source.version}</source>
|
||||
<target>${compiler.target.version}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>**/*Tests.java</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>**/Abstract*.java</exclude>
|
||||
</excludes>
|
||||
<junitArtifactName>junit:junit</junitArtifactName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.1</version>
|
||||
<configuration>
|
||||
<mainClass>org.springframework.batch.core.launch.support.CommandLineJobRunner</mainClass>
|
||||
<arguments>
|
||||
<argument>classpath:/launch-context.xml</argument>
|
||||
<argument>personJob</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-dependencies</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/lib</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/descriptor.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-distribution</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<index>false</index>
|
||||
<manifest>
|
||||
<mainClass>org.springframework.batch.core.launch.support.CommandLineJobRunner</mainClass>
|
||||
<addClasspath>true</addClasspath>
|
||||
<classpathPrefix>lib/</classpathPrefix>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<distributionManagement>
|
||||
<downloadUrl>http://projects.spring.io/spring-batch/</downloadUrl>
|
||||
<site>
|
||||
<id>staging</id>
|
||||
<url>file:///${user.dir}/target/staging/org.springframework.batch.archetype/${project.artifactId}</url>
|
||||
</site>
|
||||
<repository>
|
||||
<id>spring-release</id>
|
||||
<name>Spring Release Repository</name>
|
||||
<url>file:///${user.dir}/target/staging/release</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>spring-snapshot</id>
|
||||
<name>Spring Snapshot Repository</name>
|
||||
<url>file:///${user.dir}/target/staging/snapshot</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
</project>
|
||||
@@ -1,25 +0,0 @@
|
||||
<assembly>
|
||||
<id>distribution</id>
|
||||
<formats>
|
||||
<format>tar.gz</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>src/main/scripts</directory>
|
||||
<outputDirectory>bin</outputDirectory>
|
||||
<useDefaultExcludes>true</useDefaultExcludes>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>src/main/resources</directory>
|
||||
<outputDirectory>resources</outputDirectory>
|
||||
<useDefaultExcludes>true</useDefaultExcludes>
|
||||
<filtered>true</filtered>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<outputDirectory>lib</outputDirectory>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
</assembly>
|
||||
@@ -1,94 +0,0 @@
|
||||
package example;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.commons.dbcp.BasicDataSource;
|
||||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.item.database.BeanPropertyItemSqlParameterSourceProvider;
|
||||
import org.springframework.batch.item.database.JdbcBatchItemWriter;
|
||||
import org.springframework.batch.item.file.FlatFileItemReader;
|
||||
import org.springframework.batch.item.file.mapping.BeanWrapperFieldSetMapper;
|
||||
import org.springframework.batch.item.file.mapping.DefaultLineMapper;
|
||||
import org.springframework.batch.item.file.transform.DelimitedLineTokenizer;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.jdbc.datasource.init.DatabasePopulatorUtils;
|
||||
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
|
||||
|
||||
@Configuration
|
||||
@PropertySource("classpath:batch.properties")
|
||||
@EnableBatchProcessing
|
||||
@Import(ModuleContext.class)
|
||||
public class LaunchContext {
|
||||
|
||||
@Autowired
|
||||
Environment env;
|
||||
|
||||
@Bean
|
||||
static PropertyPlaceholderConfigurer configurer() {
|
||||
return new PropertyPlaceholderConfigurer();
|
||||
}
|
||||
|
||||
@Bean
|
||||
ItemReader<Person> itemReader() {
|
||||
FlatFileItemReader<Person> reader = new FlatFileItemReader<Person>();
|
||||
reader.setResource(new ClassPathResource("support/sample-data.csv"));
|
||||
reader.setLineMapper(new DefaultLineMapper<Person>() {{
|
||||
setLineTokenizer(new DelimitedLineTokenizer() {{
|
||||
setNames(new String[] { "firstName", "lastName" });
|
||||
}});
|
||||
setFieldSetMapper(new BeanWrapperFieldSetMapper<Person>() {{
|
||||
setTargetType(Person.class);
|
||||
}});
|
||||
}});
|
||||
return reader;
|
||||
}
|
||||
|
||||
@Bean
|
||||
PersonItemProcessor itemProcess() {
|
||||
return new PersonItemProcessor();
|
||||
}
|
||||
|
||||
@Bean
|
||||
ItemWriter<Person> itemWriter(DataSource dataSource) {
|
||||
JdbcBatchItemWriter<Person> writer = new JdbcBatchItemWriter<Person>();
|
||||
writer.setItemSqlParameterSourceProvider(new BeanPropertyItemSqlParameterSourceProvider<Person>());
|
||||
writer.setSql(env.getProperty("person.insert.sql"));
|
||||
writer.setDataSource(dataSource);
|
||||
return writer;
|
||||
}
|
||||
|
||||
@Bean
|
||||
BasicDataSource dataSource() {
|
||||
BasicDataSource dataSource = new BasicDataSource();
|
||||
dataSource.setDriverClassName(env.getProperty("batch.jdbc.driver"));
|
||||
dataSource.setUrl(env.getProperty("batch.jdbc.url"));
|
||||
dataSource.setUsername(env.getProperty("batch.jdbc.user"));
|
||||
dataSource.setPassword(env.getProperty("batch.jdbc.password"));
|
||||
return dataSource;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ResourceLoader resourceLoader;
|
||||
|
||||
@PostConstruct
|
||||
protected void initialize() throws Exception {
|
||||
ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
|
||||
populator.addScript(this.resourceLoader.getResource(env.getProperty("batch.drop.script")));
|
||||
populator.addScript(this.resourceLoader.getResource(env.getProperty("person.sql.location")));
|
||||
populator.addScript(this.resourceLoader.getResource(env.getProperty("batch.schema.script")));
|
||||
populator.setContinueOnError(true);
|
||||
DatabasePopulatorUtils.execute(populator, dataSource());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package example;
|
||||
|
||||
import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.Step;
|
||||
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
|
||||
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
|
||||
import org.springframework.batch.core.launch.support.RunIdIncrementer;
|
||||
import org.springframework.batch.item.ItemProcessor;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class ModuleContext {
|
||||
|
||||
@Bean
|
||||
public Job personJob(JobBuilderFactory jobs, Step s1) {
|
||||
return jobs.get("personJob")
|
||||
.incrementer(new RunIdIncrementer())
|
||||
.flow(s1)
|
||||
.end()
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Step step1(StepBuilderFactory stepBuilderFactory, ItemReader<Person> reader,
|
||||
ItemWriter<Person> writer, ItemProcessor<Person, Person> processor) {
|
||||
return stepBuilderFactory.get("step1")
|
||||
.<Person, Person> chunk(10)
|
||||
.reader(reader)
|
||||
.processor(processor)
|
||||
.writer(writer)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 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 example;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Domain object representing information about a person.
|
||||
* </p>
|
||||
*/
|
||||
public class Person {
|
||||
private String lastName;
|
||||
private String firstName;
|
||||
|
||||
public Person() {
|
||||
|
||||
}
|
||||
|
||||
public Person(String firstName, String lastName) {
|
||||
this.firstName = firstName;
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
public void setFirstName(final String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
|
||||
public void setLastName(final String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "firstName: " + firstName + ", lastName: " + lastName;
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 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 example;
|
||||
|
||||
import org.springframework.batch.item.ItemProcessor;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* An example {@link org.springframework.batch.item.ItemProcessor} implementation that upper cases attributes on the
|
||||
* provided {@link Person} object.
|
||||
* </p>
|
||||
*/
|
||||
public class PersonItemProcessor implements ItemProcessor<Person, Person> {
|
||||
@Override
|
||||
public Person process(final Person person) throws Exception {
|
||||
final String firstName = person.getFirstName().toUpperCase();
|
||||
final String lastName = person.getLastName().toUpperCase();
|
||||
|
||||
final Person transformedPerson = new Person();
|
||||
transformedPerson.setFirstName(firstName);
|
||||
transformedPerson.setLastName(lastName);
|
||||
|
||||
return transformedPerson;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
# Placeholders batch.*
|
||||
# for HSQLDB:
|
||||
batch.jdbc.driver=org.hsqldb.jdbcDriver
|
||||
batch.jdbc.url=jdbc:hsqldb:mem:testdb;sql.enforce_strict_size=true
|
||||
# use this one for a separate server process so you can inspect the results
|
||||
# (or add it to system properties with -D to override at run time).
|
||||
# batch.jdbc.url=jdbc:hsqldb:hsql://localhost:9005/samples
|
||||
batch.jdbc.user=sa
|
||||
batch.jdbc.password=
|
||||
batch.schema.script=classpath:org/springframework/batch/core/schema-hsqldb.sql
|
||||
batch.drop.script=classpath:org/springframework/batch/core/schema-drop-hsqldb.sql
|
||||
person.sql.location=classpath:support/person.sql
|
||||
person.test.data.location=classpath:support/sample-data.csv
|
||||
person.insert.sql=INSERT INTO people (first_name, last_name) VALUES (:firstName, :lastName)
|
||||
step1.commit.interval=5
|
||||
@@ -1,8 +0,0 @@
|
||||
log4j.rootCategory=INFO, stdout
|
||||
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d %p %t [%c] - <%m>%n
|
||||
|
||||
log4j.category.org.springframework.batch=DEBUG
|
||||
log4j.category.org.springframework.transaction=INFO
|
||||
@@ -1,7 +0,0 @@
|
||||
DROP TABLE people IF EXISTS;
|
||||
|
||||
CREATE TABLE people (
|
||||
person_id BIGINT IDENTITY NOT NULL PRIMARY KEY,
|
||||
first_name VARCHAR(20),
|
||||
last_name VARCHAR(20)
|
||||
);
|
||||
@@ -1,5 +0,0 @@
|
||||
Jill,Doe
|
||||
Joe,Doe
|
||||
Justin,Doe
|
||||
Jane,Doe
|
||||
John,Doe
|
||||
|
@@ -1,8 +0,0 @@
|
||||
@echo off
|
||||
|
||||
IF NOT DEFINED JAVA_HOME (
|
||||
echo Error: JAVA_HOME environment variable is not set.
|
||||
EXIT /B
|
||||
)
|
||||
|
||||
%JAVA_HOME%\bin\java -cp resources\;lib\* org.springframework.batch.core.launch.support.CommandLineJobRunner example.LaunchContext personJob
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$JAVA_HOME" = "" ]; then
|
||||
echo "Error: JAVA_HOME environment variable is not set."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$JAVA_HOME/bin/java -cp resources/:lib/* org.springframework.batch.core.launch.support.CommandLineJobRunner example.LaunchContext personJob
|
||||
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<project name="Spring Batch: ${project.name}">
|
||||
<bannerLeft>
|
||||
<name>Spring Batch: ${project.name}</name>
|
||||
<href>index.html</href>
|
||||
</bannerLeft>
|
||||
|
||||
<skin>
|
||||
<groupId>org.springframework.maven.skins</groupId>
|
||||
<artifactId>maven-spring-skin</artifactId>
|
||||
<version>1.0.5</version>
|
||||
</skin>
|
||||
|
||||
<body>
|
||||
<links>
|
||||
<item name="${project.name}" href="index.html"/>
|
||||
</links>
|
||||
<menu ref="reports"/>
|
||||
</body>
|
||||
</project>
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 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 example;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Example test case processing a {@link Person} using the {@link PersonItemProcessor}.
|
||||
* </p>
|
||||
*/
|
||||
public class PersonItemProcessorTest {
|
||||
@Test
|
||||
public void testProcessedPersonRecord() throws Exception {
|
||||
final Person person = new Person();
|
||||
person.setFirstName("Jane");
|
||||
person.setLastName("Doe");
|
||||
|
||||
final Person processedPerson = new PersonItemProcessor().process(person);
|
||||
|
||||
assertEquals("First name does not match expected value.", "JANE", processedPerson.getFirstName());
|
||||
assertEquals("Last name does not match expected value.", "DOE", processedPerson.getLastName());
|
||||
}
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
/*
|
||||
* Copyright 2006-2013 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 example;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
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.JobInstance;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.launch.JobLauncher;
|
||||
import org.springframework.batch.core.launch.JobOperator;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Test cases asserting on the example job's configuration.
|
||||
* </p>
|
||||
*/
|
||||
@ContextConfiguration(classes=TestContext.class)
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class PersonJobConfigurationTest {
|
||||
@Autowired
|
||||
private JobLauncher jobLauncher;
|
||||
|
||||
@Autowired
|
||||
private Job job;
|
||||
|
||||
@Autowired
|
||||
private JobOperator jobOperator;
|
||||
|
||||
@Autowired
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Creates a new {@link JobExecution} using a {@link JobLauncher}.
|
||||
* </p>
|
||||
*
|
||||
* @throws Exception if any {@link Exception}'s occur
|
||||
*/
|
||||
@Test
|
||||
public void testLaunchJobWithJobLauncher() throws Exception {
|
||||
final JobExecution jobExecution = jobLauncher.run(job, new JobParameters());
|
||||
assertEquals("Batch status not COMPLETED", BatchStatus.COMPLETED, jobExecution.getStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Create a unique job instance and check it's execution completes successfully.
|
||||
* Uses the convenience methods provided by the testing superclass.
|
||||
* </p>
|
||||
*
|
||||
* @throws Exception if any {@link Exception}'s occur
|
||||
*/
|
||||
@Test
|
||||
public void testLaunchJob() throws Exception {
|
||||
final JobExecution jobExecution = jobLauncherTestUtils.launchJob(jobLauncherTestUtils.getUniqueJobParameters());
|
||||
assertEquals("Batch status not COMPLETED", BatchStatus.COMPLETED, jobExecution.getStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Execute a fresh {@link JobInstance} using {@link JobOperator} which is closer to
|
||||
* a remote invocation scenario.
|
||||
* </p>
|
||||
*
|
||||
* @throws Exception if any {@link Exception}'s occur
|
||||
*/
|
||||
@Test
|
||||
public void testLaunchByJobOperator() throws Exception {
|
||||
final long jobExecutionId = jobOperator.startNextInstance(jobLauncherTestUtils.getJob().getName());
|
||||
|
||||
final String result = jobOperator.getSummary(jobExecutionId);
|
||||
assertTrue("Result does not contain status=COMPLETED", result.contains("status=" + BatchStatus.COMPLETED));
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package example;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.batch.core.configuration.JobRegistry;
|
||||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
||||
import org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor;
|
||||
import org.springframework.batch.core.configuration.support.MapJobRegistry;
|
||||
import org.springframework.batch.core.explore.JobExplorer;
|
||||
import org.springframework.batch.core.explore.support.JobExplorerFactoryBean;
|
||||
import org.springframework.batch.core.launch.JobLauncher;
|
||||
import org.springframework.batch.core.launch.JobOperator;
|
||||
import org.springframework.batch.core.launch.support.SimpleJobOperator;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
@Configuration
|
||||
@EnableBatchProcessing
|
||||
@Import(LaunchContext.class)
|
||||
public class TestContext {
|
||||
|
||||
@Bean
|
||||
JobLauncherTestUtils jobLauncherTestUtils() {
|
||||
return new JobLauncherTestUtils();
|
||||
}
|
||||
|
||||
@Bean
|
||||
JobOperator jobOperator(final JobLauncher jobLauncher, final JobExplorer jobExplorer,
|
||||
final JobRepository jobRepository, final JobRegistry jobRegistry) {
|
||||
return new SimpleJobOperator() {{
|
||||
setJobLauncher(jobLauncher);
|
||||
setJobExplorer(jobExplorer);
|
||||
setJobRepository(jobRepository);
|
||||
setJobRegistry(jobRegistry);
|
||||
}};
|
||||
}
|
||||
|
||||
@Bean
|
||||
JobExplorerFactoryBean jobExplorer(final DataSource dataSource) {
|
||||
return new JobExplorerFactoryBean() {{
|
||||
setDataSource(dataSource);
|
||||
}};
|
||||
}
|
||||
|
||||
@Bean
|
||||
MapJobRegistry jobRegister() {
|
||||
return new MapJobRegistry();
|
||||
}
|
||||
|
||||
@Bean
|
||||
JobRegistryBeanPostProcessor jobRegisterBeanPostProcess(final JobRegistry jobRegistry) {
|
||||
return new JobRegistryBeanPostProcessor() {{
|
||||
setJobRegistry(jobRegistry);
|
||||
}};
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beansProjectDescription>
|
||||
<version>1</version>
|
||||
<pluginVersion><![CDATA[2.3.3.201006182200-CI-R3784-B777]]></pluginVersion>
|
||||
<configSuffixes>
|
||||
<configSuffix><![CDATA[xml]]></configSuffix>
|
||||
</configSuffixes>
|
||||
<enableImports><![CDATA[true]]></enableImports>
|
||||
<configs>
|
||||
<config>src/test/resources/test-context.xml</config>
|
||||
<config>src/main/resources/META-INF/spring/module-context.xml</config>
|
||||
<config>src/main/resources/launch-context.xml</config>
|
||||
</configs>
|
||||
<configSets>
|
||||
</configSets>
|
||||
</beansProjectDescription>
|
||||
@@ -1,286 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.batch</groupId>
|
||||
<artifactId>spring-batch-simple-cli</artifactId>
|
||||
<version>3.0.0.BUILD-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>Commandline</name>
|
||||
<description>This project is a command line batch sample from Spring Batch demonstrating a typical batch job.
|
||||
The job can be invoked via "mvn exec:java" to see the job run from the command line.
|
||||
During an "mvn package", a distribution archive in the format defined in src/main/assembly/descriptor.xml will
|
||||
be created in the target directory which can be deployed and extracted to your target location of choice.
|
||||
The ./bin/runJob.(sh|bat) script from the extracted deployment archive can be invoked to run the job.
|
||||
</description>
|
||||
<properties>
|
||||
<spring.framework.version>4.0.2.RELEASE</spring.framework.version>
|
||||
<spring.batch.version>3.0.0.BUILD-SNAPSHOT</spring.batch.version>
|
||||
<dependency.locations.enabled>false</dependency.locations.enabled>
|
||||
<junit.version>4.10</junit.version>
|
||||
<maven.compiler.plugin>3.1</maven.compiler.plugin>
|
||||
<compiler.target.version>1.6</compiler.target.version>
|
||||
<compiler.source.version>1.6</compiler.source.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>staging</id>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>staging</id>
|
||||
<url>file:///${user.dir}/target/staging</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>staging</id>
|
||||
<url>file:///${user.dir}/target/staging</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>bootstrap</id>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>Codehaus</id>
|
||||
<url>http://repository.codehaus.org/</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
<!-- <pluginRepository>
|
||||
<id>com.springsource.repository.bundles.release</id>
|
||||
<name>SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases</name>
|
||||
<url>http://repository.springsource.com/maven/bundles/release</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
--> </pluginRepositories>
|
||||
</profile>
|
||||
</profiles>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<version>${spring.framework.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aop</artifactId>
|
||||
<version>${spring.framework.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jdbc</artifactId>
|
||||
<version>${spring.framework.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.batch</groupId>
|
||||
<artifactId>spring-batch-core</artifactId>
|
||||
<version>${spring.batch.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.batch</groupId>
|
||||
<artifactId>spring-batch-infrastructure</artifactId>
|
||||
<version>${spring.batch.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.batch</groupId>
|
||||
<artifactId>spring-batch-test</artifactId>
|
||||
<version>${spring.batch.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-dbcp</groupId>
|
||||
<artifactId>commons-dbcp</artifactId>
|
||||
<version>1.2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.5.8</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.14</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hsqldb</groupId>
|
||||
<artifactId>hsqldb</artifactId>
|
||||
<version>2.2.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjrt</artifactId>
|
||||
<version>1.6.8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjweaver</artifactId>
|
||||
<version>1.6.8</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>org.springframework.build.aws</groupId>
|
||||
<artifactId>org.springframework.build.aws.maven</artifactId>
|
||||
<version>3.0.0.RELEASE</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<inherited>false</inherited>
|
||||
<configuration>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>project</descriptorRef>
|
||||
</descriptorRefs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!--This plugin's configuration is used to store Eclipse m2e settings
|
||||
only. It has no influence on the Maven build itself. -->
|
||||
<plugin>
|
||||
<groupId>org.eclipse.m2e</groupId>
|
||||
<artifactId>lifecycle-mapping</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<configuration>
|
||||
<lifecycleMappingMetadata>
|
||||
<pluginExecutions>
|
||||
<pluginExecution>
|
||||
<pluginExecutionFilter>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<versionRange>[1.0,)</versionRange>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
</pluginExecutionFilter>
|
||||
<action>
|
||||
<ignore />
|
||||
</action>
|
||||
</pluginExecution>
|
||||
</pluginExecutions>
|
||||
</lifecycleMappingMetadata>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>${maven.compiler.plugin}</version>
|
||||
<configuration>
|
||||
<source>${compiler.source.version}</source>
|
||||
<target>${compiler.target.version}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>**/*Tests.java</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>**/Abstract*.java</exclude>
|
||||
</excludes>
|
||||
<junitArtifactName>junit:junit</junitArtifactName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.1</version>
|
||||
<configuration>
|
||||
<mainClass>org.springframework.batch.core.launch.support.CommandLineJobRunner</mainClass>
|
||||
<arguments>
|
||||
<argument>classpath:/launch-context.xml</argument>
|
||||
<argument>personJob</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-dependencies</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/lib</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/descriptor.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-distribution</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<index>false</index>
|
||||
<manifest>
|
||||
<mainClass>org.springframework.batch.core.launch.support.CommandLineJobRunner</mainClass>
|
||||
<addClasspath>true</addClasspath>
|
||||
<classpathPrefix>lib/</classpathPrefix>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<distributionManagement>
|
||||
<downloadUrl>http://projects.spring.io/spring-batch/</downloadUrl>
|
||||
<site>
|
||||
<id>staging</id>
|
||||
<url>file:///${user.dir}/target/staging/org.springframework.batch.archetype/${project.artifactId}</url>
|
||||
</site>
|
||||
<repository>
|
||||
<id>spring-release</id>
|
||||
<name>Spring Release Repository</name>
|
||||
<url>file:///${user.dir}/target/staging/release</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>spring-snapshot</id>
|
||||
<name>Spring Snapshot Repository</name>
|
||||
<url>file:///${user.dir}/target/staging/snapshot</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
</project>
|
||||
@@ -1,25 +0,0 @@
|
||||
<assembly>
|
||||
<id>distribution</id>
|
||||
<formats>
|
||||
<format>tar.gz</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>src/main/scripts</directory>
|
||||
<outputDirectory>bin</outputDirectory>
|
||||
<useDefaultExcludes>true</useDefaultExcludes>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>src/main/resources</directory>
|
||||
<outputDirectory>resources</outputDirectory>
|
||||
<useDefaultExcludes>true</useDefaultExcludes>
|
||||
<filtered>true</filtered>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<outputDirectory>lib</outputDirectory>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
</assembly>
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 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 example;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Domain object representing information about a person.
|
||||
* </p>
|
||||
*/
|
||||
public class Person {
|
||||
private String lastName;
|
||||
private String firstName;
|
||||
|
||||
public void setFirstName(final String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
|
||||
public void setLastName(final String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "firstName: " + firstName + ", lastName: " + lastName;
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 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 example;
|
||||
|
||||
import org.springframework.batch.item.ItemProcessor;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* An example {@link org.springframework.batch.item.ItemProcessor} implementation that upper cases attributes on the
|
||||
* provided {@link Person} object.
|
||||
* </p>
|
||||
*/
|
||||
public class PersonItemProcessor implements ItemProcessor<Person, Person> {
|
||||
@Override
|
||||
public Person process(final Person person) throws Exception {
|
||||
final String firstName = person.getFirstName().toUpperCase();
|
||||
final String lastName = person.getLastName().toUpperCase();
|
||||
|
||||
final Person transformedPerson = new Person();
|
||||
transformedPerson.setFirstName(firstName);
|
||||
transformedPerson.setLastName(lastName);
|
||||
|
||||
return transformedPerson;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans:beans
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:batch="http://www.springframework.org/schema/batch"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.2.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">
|
||||
|
||||
<beans:description>Example job providing a skeleton for a typical batch application.</beans:description>
|
||||
|
||||
<batch:job id="personJob" incrementer="jobParametersIncrementer">
|
||||
<batch:step id="step1">
|
||||
<batch:tasklet>
|
||||
<batch:chunk reader="itemReader" processor="itemProcessor" writer="itemWriter"
|
||||
commit-interval="${step1.commit.interval}"/>
|
||||
</batch:tasklet>
|
||||
<batch:fail on="FAILED"/>
|
||||
<batch:end on="*"/>
|
||||
</batch:step>
|
||||
</batch:job>
|
||||
</beans:beans>
|
||||
@@ -1,15 +0,0 @@
|
||||
# Placeholders batch.*
|
||||
# for HSQLDB:
|
||||
batch.jdbc.driver=org.hsqldb.jdbcDriver
|
||||
batch.jdbc.url=jdbc:hsqldb:mem:testdb;sql.enforce_strict_size=true
|
||||
# use this one for a separate server process so you can inspect the results
|
||||
# (or add it to system properties with -D to override at run time).
|
||||
# batch.jdbc.url=jdbc:hsqldb:hsql://localhost:9005/samples
|
||||
batch.jdbc.user=sa
|
||||
batch.jdbc.password=
|
||||
batch.schema.script=classpath:org/springframework/batch/core/schema-hsqldb.sql
|
||||
batch.drop.script=classpath:org/springframework/batch/core/schema-drop-hsqldb.sql
|
||||
person.sql.location=classpath:support/person.sql
|
||||
person.test.data.location=classpath:support/sample-data.csv
|
||||
person.insert.sql=INSERT INTO people (first_name, last_name) VALUES (:firstName, :lastName)
|
||||
step1.commit.interval=5
|
||||
@@ -1,69 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<beans:beans
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
|
||||
xmlns:batch="http://www.springframework.org/schema/batch"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:p="http://www.springframework.org/schema/p"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.2.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
|
||||
|
||||
<beans:import resource="classpath:META-INF/spring/module-context.xml"/>
|
||||
|
||||
<context:property-placeholder location="classpath:batch.properties"/>
|
||||
|
||||
<jdbc:initialize-database data-source="dataSource">
|
||||
<jdbc:script location="${batch.drop.script}"/>
|
||||
<jdbc:script location="${person.sql.location}"/>
|
||||
<jdbc:script location="${batch.schema.script}"/>
|
||||
</jdbc:initialize-database>
|
||||
|
||||
<batch:job-repository id="jobRepository"/>
|
||||
|
||||
<beans:bean id="itemReader" class="org.springframework.batch.item.file.FlatFileItemReader">
|
||||
<beans:property name="resource" value="${person.test.data.location}"/>
|
||||
<beans:property name="lineMapper">
|
||||
<beans:bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper">
|
||||
<beans:property name="lineTokenizer">
|
||||
<beans:bean class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer">
|
||||
<beans:property name="names" value="firstName,lastName"/>
|
||||
</beans:bean>
|
||||
</beans:property>
|
||||
<beans:property name="fieldSetMapper">
|
||||
<beans:bean class="org.springframework.batch.item.file.mapping.BeanWrapperFieldSetMapper">
|
||||
<beans:property name="targetType" value="example.Person"/>
|
||||
</beans:bean>
|
||||
</beans:property>
|
||||
</beans:bean>
|
||||
</beans:property>
|
||||
</beans:bean>
|
||||
|
||||
<beans:bean id="itemProcessor" class="example.PersonItemProcessor"/>
|
||||
|
||||
<beans:bean id="itemWriter" class="org.springframework.batch.item.database.JdbcBatchItemWriter">
|
||||
<beans:property name="itemSqlParameterSourceProvider">
|
||||
<beans:bean class="org.springframework.batch.item.database.BeanPropertyItemSqlParameterSourceProvider" />
|
||||
</beans:property>
|
||||
<beans:property name="sql" value="${person.insert.sql}" />
|
||||
<beans:property name="dataSource" ref="dataSource" />
|
||||
</beans:bean>
|
||||
|
||||
<beans:bean id="jobParametersIncrementer" class="org.springframework.batch.core.launch.support.RunIdIncrementer" />
|
||||
|
||||
<beans:bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
|
||||
p:driverClassName="${batch.jdbc.driver}"
|
||||
p:url="${batch.jdbc.url}"
|
||||
p:username="${batch.jdbc.user}"
|
||||
p:password="${batch.jdbc.password}"/>
|
||||
|
||||
<beans:bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"
|
||||
p:dataSource-ref="dataSource"/>
|
||||
|
||||
<beans:bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher"
|
||||
p:jobRepository-ref="jobRepository"/>
|
||||
</beans:beans>
|
||||
@@ -1,8 +0,0 @@
|
||||
log4j.rootCategory=INFO, stdout
|
||||
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d %p %t [%c] - <%m>%n
|
||||
|
||||
log4j.category.org.springframework.batch=DEBUG
|
||||
log4j.category.org.springframework.transaction=INFO
|
||||
@@ -1,7 +0,0 @@
|
||||
DROP TABLE people IF EXISTS;
|
||||
|
||||
CREATE TABLE people (
|
||||
person_id BIGINT IDENTITY NOT NULL PRIMARY KEY,
|
||||
first_name VARCHAR(20),
|
||||
last_name VARCHAR(20)
|
||||
);
|
||||
@@ -1,5 +0,0 @@
|
||||
Jill,Doe
|
||||
Joe,Doe
|
||||
Justin,Doe
|
||||
Jane,Doe
|
||||
John,Doe
|
||||
|
@@ -1,8 +0,0 @@
|
||||
@echo off
|
||||
|
||||
IF NOT DEFINED JAVA_HOME (
|
||||
echo Error: JAVA_HOME environment variable is not set.
|
||||
EXIT /B
|
||||
)
|
||||
|
||||
%JAVA_HOME%\bin\java -cp resources\;lib\* org.springframework.batch.core.launch.support.CommandLineJobRunner classpath:/launch-context.xml personJob
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$JAVA_HOME" = "" ]; then
|
||||
echo "Error: JAVA_HOME environment variable is not set."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$JAVA_HOME/bin/java -cp resources/:lib/* org.springframework.batch.core.launch.support.CommandLineJobRunner classpath:/launch-context.xml personJob
|
||||
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<project name="Spring Batch: ${project.name}">
|
||||
<bannerLeft>
|
||||
<name>Spring Batch: ${project.name}</name>
|
||||
<href>index.html</href>
|
||||
</bannerLeft>
|
||||
|
||||
<skin>
|
||||
<groupId>org.springframework.maven.skins</groupId>
|
||||
<artifactId>maven-spring-skin</artifactId>
|
||||
<version>1.0.5</version>
|
||||
</skin>
|
||||
|
||||
<body>
|
||||
<links>
|
||||
<item name="${project.name}" href="index.html"/>
|
||||
</links>
|
||||
<menu ref="reports"/>
|
||||
</body>
|
||||
</project>
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 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 example;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Example test case processing a {@link Person} using the {@link PersonItemProcessor}.
|
||||
* </p>
|
||||
*/
|
||||
public class PersonItemProcessorTest {
|
||||
@Test
|
||||
public void testProcessedPersonRecord() throws Exception {
|
||||
final Person person = new Person();
|
||||
person.setFirstName("Jane");
|
||||
person.setLastName("Doe");
|
||||
|
||||
final Person processedPerson = new PersonItemProcessor().process(person);
|
||||
|
||||
assertEquals("First name does not match expected value.", "JANE", processedPerson.getFirstName());
|
||||
assertEquals("Last name does not match expected value.", "DOE", processedPerson.getLastName());
|
||||
}
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
/*
|
||||
* Copyright 2006-2013 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 example;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
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.JobInstance;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.launch.JobLauncher;
|
||||
import org.springframework.batch.core.launch.JobOperator;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Test cases asserting on the example job's configuration.
|
||||
* </p>
|
||||
*/
|
||||
@ContextConfiguration(locations = "/test-context.xml")
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class PersonJobConfigurationTest {
|
||||
@Autowired
|
||||
private JobLauncher jobLauncher;
|
||||
|
||||
@Autowired
|
||||
private Job job;
|
||||
|
||||
@Autowired
|
||||
private JobOperator jobOperator;
|
||||
|
||||
@Autowired
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Creates a new {@link JobExecution} using a {@link JobLauncher}.
|
||||
* </p>
|
||||
*
|
||||
* @throws Exception if any {@link Exception}'s occur
|
||||
*/
|
||||
@Test
|
||||
public void testLaunchJobWithJobLauncher() throws Exception {
|
||||
final JobExecution jobExecution = jobLauncher.run(job, new JobParameters());
|
||||
assertEquals("Batch status not COMPLETED", BatchStatus.COMPLETED, jobExecution.getStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Create a unique job instance and check it's execution completes successfully.
|
||||
* Uses the convenience methods provided by the testing superclass.
|
||||
* </p>
|
||||
*
|
||||
* @throws Exception if any {@link Exception}'s occur
|
||||
*/
|
||||
@Test
|
||||
public void testLaunchJob() throws Exception {
|
||||
final JobExecution jobExecution = jobLauncherTestUtils.launchJob(jobLauncherTestUtils.getUniqueJobParameters());
|
||||
assertEquals("Batch status not COMPLETED", BatchStatus.COMPLETED, jobExecution.getStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Execute a fresh {@link JobInstance} using {@link JobOperator} which is closer to
|
||||
* a remote invocation scenario.
|
||||
* </p>
|
||||
*
|
||||
* @throws Exception if any {@link Exception}'s occur
|
||||
*/
|
||||
@Test
|
||||
public void testLaunchByJobOperator() throws Exception {
|
||||
final long jobExecutionId = jobOperator.startNextInstance(jobLauncherTestUtils.getJob().getName());
|
||||
|
||||
final String result = jobOperator.getSummary(jobExecutionId);
|
||||
assertTrue("Result does not contain status=COMPLETED", result.contains("status=" + BatchStatus.COMPLETED));
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans:beans
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
|
||||
xmlns:p="http://www.springframework.org/schema/p"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
|
||||
|
||||
<beans:import resource="classpath:launch-context.xml"/>
|
||||
|
||||
<context:annotation-config/>
|
||||
|
||||
<jdbc:initialize-database data-source="dataSource">
|
||||
<jdbc:script location="${batch.drop.script}"/>
|
||||
<jdbc:script location="${person.sql.location}"/>
|
||||
<jdbc:script location="${batch.schema.script}"/>
|
||||
</jdbc:initialize-database>
|
||||
|
||||
<beans:bean class="org.springframework.batch.test.JobLauncherTestUtils"/>
|
||||
|
||||
<beans:bean id="jobOperator"
|
||||
class="org.springframework.batch.core.launch.support.SimpleJobOperator"
|
||||
p:jobLauncher-ref="jobLauncher" p:jobExplorer-ref="jobExplorer"
|
||||
p:jobRepository-ref="jobRepository" p:jobRegistry-ref="jobRegistry"/>
|
||||
|
||||
<beans:bean id="jobExplorer"
|
||||
class="org.springframework.batch.core.explore.support.JobExplorerFactoryBean"
|
||||
p:dataSource-ref="dataSource"/>
|
||||
|
||||
<beans:bean id="jobRegistry"
|
||||
class="org.springframework.batch.core.configuration.support.MapJobRegistry"/>
|
||||
|
||||
<beans:bean class="org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor"
|
||||
p:jobRegistry-ref="jobRegistry"/>
|
||||
</beans:beans>
|
||||
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<project name="Spring Batch: ${project.name}">
|
||||
|
||||
<bannerLeft>
|
||||
<name>Spring Batch: ${project.name}</name>
|
||||
<href>index.html</href>
|
||||
</bannerLeft>
|
||||
|
||||
<body>
|
||||
|
||||
<links>
|
||||
<item name="${project.name}" href="index.html"/>
|
||||
</links>
|
||||
|
||||
<menu ref="modules"/>
|
||||
<menu ref="reports"/>
|
||||
|
||||
</body>
|
||||
|
||||
</project>
|
||||
3
pom.xml
3
pom.xml
@@ -64,7 +64,6 @@
|
||||
<id>all</id>
|
||||
<modules>
|
||||
<module>spring-batch-samples</module>
|
||||
<module>archetypes</module>
|
||||
<module>spring-batch-infrastructure-tests</module>
|
||||
<module>spring-batch-core-tests</module>
|
||||
</modules>
|
||||
@@ -73,7 +72,6 @@
|
||||
<id>release</id>
|
||||
<modules>
|
||||
<module>spring-batch-samples</module>
|
||||
<module>archetypes</module>
|
||||
</modules>
|
||||
<build>
|
||||
<plugins>
|
||||
@@ -354,7 +352,6 @@
|
||||
<id>samples</id>
|
||||
<modules>
|
||||
<module>spring-batch-samples</module>
|
||||
<module>archetypes</module>
|
||||
</modules>
|
||||
</profile>
|
||||
<profile>
|
||||
|
||||
Reference in New Issue
Block a user