INTSAMPLES-89 - Upgrade to Spring Integration 2.2 RC3

* Test samples
* Polish documentation
* Polish code

For reference see: https://jira.springsource.org/browse/INTSAMPLES-89
This commit is contained in:
Gunnar Hillert
2012-10-28 22:51:14 -04:00
parent 251e035a18
commit 3c9c91c847
93 changed files with 1666 additions and 1454 deletions

View File

@@ -1,23 +1,19 @@
Spring Integration - JDBC Sample
================================
# Overview
## Overview
This sample provides example of how the Jdbc Adapters can be used.
This sample provides example of how the JDBC Adapters can be used.
The example presented covers the following use cases
* Find a Person detail from the database based on the name provided
* Create a new Person record in the table
The first example demonstrates the use of outbound gateway to search for a person record using the
spring integration's jdbc outbound gateway
The first example demonstrates the use of *Outbound Gateway* to search for a person record using *Spring Integration*'s *JDBC Outbound Gateway*.
The second example on other hand demonstrates how the jdbc outbound gateway be used to create a new
Person record and then return the newly created Person record.
This example demonstrates how to make use of the sql parameter source factory to extract
the required values to be inserted/updated/selected in the query provided.
The second example on other hand demonstrates how the *JDBC Outbound Gateway* can be used to create a new *Person* record and then return the newly created *Person* record. This example demonstrates how to make use of the sql parameter source factory to extract the required values to be inserted/updated/selected in the query provided.
# Getting Started
## Getting Started
You can run the application by either
@@ -26,18 +22,18 @@ You can run the application by either
- mvn package
- mvn exec:java
Make an appropriate choice for searching a Person or creating a Person
Make an appropriate choice for searching a Person or creating a Person.
For creating the person record, select the appropriate steps as prompted by the application
For creating the person record, select the appropriate steps as prompted by the application.
On creation of Person records, you may choose the option of selecting the created person records and view their details
On creation of *Person* records, you may choose the option of selecting the created person records and view their details.
#Some details about the sample "Person Outbound Gateway"
## Details
We use the outbound gateway to insert records in a Person table based on the values contained
in the message payload that is received over the channel to the adapter.
The following are used to configure the gateway
The following are used to configure the *Gateway*:
* The request and reply channels
* The data source for the database
@@ -47,7 +43,7 @@ The following are used to configure the gateway
* Optional reply SQL Parameter source factory
* RowMapper if you intend to map the ResultSet to your custom object
The following sequence of events happen when we invoke the createPerson method on the gateway
The following sequence of events happen when we invoke the *createPerson* method on the *Gateway*:
* The parameter of type Person is sent as a payload of a message over the reply-channel
* The outbound gateway reads this message and extracts the payload
@@ -61,10 +57,12 @@ The following sequence of events happen when we invoke the createPerson method o
* The Person object is then sent as a payload of the Message over the reply channel.
* The Person payload is extracted from the Message and returned to the calling application.
For executing the program and see the results, execute the junit test case
org.springframework.integration.samples.jdbc.OutboundGatewayTest
## Running the Sample
# Resources
For executing the program and see the results, execute the junit test case
**org.springframework.integration.samples.jdbc.OutboundGatewayTest**
## Resources
For help please take a look at the Spring Integration documentation:

View File

@@ -4,16 +4,20 @@
<groupId>org.springframework.integration.samples</groupId>
<artifactId>jdbc</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Samples (Basic) - JDBC</name>
<url>http://www.springsource.org/spring-integration</url>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
@@ -29,7 +33,7 @@
<plugins>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<version>2.9</version>
<configuration>
<additionalProjectnatures>
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
@@ -44,7 +48,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
@@ -56,7 +60,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<version>1.2.1</version>
<configuration>
<mainClass>org.springframework.integration.samples.jdbc.Main</mainClass>
</configuration>
@@ -102,7 +106,7 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.162</version>
<version>1.3.168</version>
</dependency>
</dependencies>
</project>

View File

@@ -80,14 +80,15 @@ public final class Main {
System.out.print("Enter you choice: ");
while (true) {
final String input = scanner.nextLine();
if("1".equals(input.trim()))
if("1".equals(input.trim())) {
getPersonDetails(scanner, personService);
else if("2".equals(input.trim()))
} else if("2".equals(input.trim())) {
createPersonDetails(scanner,personService);
else if("q".equals(input.trim()))
} else if("q".equals(input.trim())) {
break;
else
} else {
System.out.println("Invalid choice\n\n");
}
System.out.println("Please enter a choice and press <enter>: ");
System.out.println("\t1. Find person details");