diff --git a/cook-books/errorhandling/.classpath b/cook-books/errorhandling/.classpath index 24166ba5..0ce7eaab 100644 --- a/cook-books/errorhandling/.classpath +++ b/cook-books/errorhandling/.classpath @@ -1,6 +1,9 @@ + + + diff --git a/cook-books/errorhandling/.gitignore b/cook-books/errorhandling/.gitignore new file mode 100644 index 00000000..ea8c4bf7 --- /dev/null +++ b/cook-books/errorhandling/.gitignore @@ -0,0 +1 @@ +/target diff --git a/cook-books/errorhandling/pom.xml b/cook-books/errorhandling/pom.xml index 889b9c52..b0d0fb9b 100644 --- a/cook-books/errorhandling/pom.xml +++ b/cook-books/errorhandling/pom.xml @@ -2,38 +2,51 @@ 4.0.0 - - org.springframework.integration.samples - spring-integration-samples - 2.0.0.BUILD-SNAPSHOT - + org.springframework.integration.samples errorhandling Spring Integration Error Handling Sample + 2.0.0 + + 2.0.0.M7 + 1.2.15 + 4.7 + org.springframework.integration spring-integration-core + ${spring.integration.version} org.springframework.integration spring-integration-stream + ${spring.integration.version} + + + log4j + log4j + ${log4j.version} + + + + junit + junit + ${junit.version} - - - repository.springframework.maven.release - Spring Framework Maven Release Repository - http://maven.springframework.org/release - - - repository.springframework.maven.milestone - Spring Framework Maven Milestone Repository - http://maven.springframework.org/milestone - - - repository.springframework.maven.snapshot - Spring Framework Maven Snapshot Repository - http://maven.springframework.org/snapshot - - + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.5 + 1.5 + -Xlint:all + true + false + + + + diff --git a/cook-books/errorhandling/src/main/java/org/springframework/integration/samples/errorhandling/PartyGuest.java b/cook-books/errorhandling/src/main/java/org/springframework/integration/samples/errorhandling/PartyGuest.java index 54ab6aa0..c777b570 100644 --- a/cook-books/errorhandling/src/main/java/org/springframework/integration/samples/errorhandling/PartyGuest.java +++ b/cook-books/errorhandling/src/main/java/org/springframework/integration/samples/errorhandling/PartyGuest.java @@ -15,6 +15,7 @@ package org.springframework.integration.samples.errorhandling; +import org.apache.log4j.Logger; import org.springframework.integration.annotation.MessageEndpoint; /** @@ -25,9 +26,10 @@ import org.springframework.integration.annotation.MessageEndpoint; */ @MessageEndpoint public class PartyGuest { - + private Logger logger = Logger.getLogger(PartyGuest.class); + public void onInvitation(Invitation invitation) { - System.out.println("Guest is throwing exception"); + logger.info("Guest is throwing exception"); throw new RuntimeException("Wrong address"); } diff --git a/cook-books/errorhandling/src/main/java/org/springframework/integration/samples/errorhandling/PartyHost.java b/cook-books/errorhandling/src/main/java/org/springframework/integration/samples/errorhandling/PartyHost.java index 2d18e8ef..624102a3 100644 --- a/cook-books/errorhandling/src/main/java/org/springframework/integration/samples/errorhandling/PartyHost.java +++ b/cook-books/errorhandling/src/main/java/org/springframework/integration/samples/errorhandling/PartyHost.java @@ -17,6 +17,7 @@ package org.springframework.integration.samples.errorhandling; import java.util.concurrent.atomic.AtomicInteger; +import org.apache.log4j.Logger; import org.springframework.integration.annotation.MessageEndpoint; /** @@ -27,7 +28,7 @@ import org.springframework.integration.annotation.MessageEndpoint; */ @MessageEndpoint public class PartyHost { - + private Logger logger = Logger.getLogger(PartyHost.class); private final AtomicInteger counter = new AtomicInteger(0); public Invitation nextInvitation() { @@ -35,7 +36,6 @@ public class PartyHost { } public void onInvitationFailed(Invitation inv) { - System.out.println("Host received failure notification for: " + inv); + logger.info("Host received failure notification for: " + inv); } - } diff --git a/cook-books/errorhandling/src/main/java/org/springframework/integration/samples/errorhandling/errorHandlingDemo.xml b/cook-books/errorhandling/src/main/resources/META-INF/spring/integration/errorHandlingDemo.xml similarity index 100% rename from cook-books/errorhandling/src/main/java/org/springframework/integration/samples/errorhandling/errorHandlingDemo.xml rename to cook-books/errorhandling/src/main/resources/META-INF/spring/integration/errorHandlingDemo.xml diff --git a/cook-books/errorhandling/src/main/java/org/springframework/integration/samples/errorhandling/PartyDemo.java b/cook-books/errorhandling/src/test/java/org/springframework/integration/samples/errorhandling/PartyDemoTest.java similarity index 76% rename from cook-books/errorhandling/src/main/java/org/springframework/integration/samples/errorhandling/PartyDemo.java rename to cook-books/errorhandling/src/test/java/org/springframework/integration/samples/errorhandling/PartyDemoTest.java index 7f77fb4e..337b75b1 100644 --- a/cook-books/errorhandling/src/main/java/org/springframework/integration/samples/errorhandling/PartyDemo.java +++ b/cook-books/errorhandling/src/test/java/org/springframework/integration/samples/errorhandling/PartyDemoTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright 2002-2010 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,8 +16,7 @@ package org.springframework.integration.samples.errorhandling; -import java.io.IOException; - +import org.junit.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; /** @@ -29,18 +28,10 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; * * @author Iwein Fuld */ -public class PartyDemo { - - public static void main(String[] args) { - new ClassPathXmlApplicationContext("errorHandlingDemo.xml", PartyDemo.class); - System.out.println("### Hit ENTER to stop ###"); - try { - System.in.read(); - } - catch (IOException e) { - throw new RuntimeException(e); - } - System.exit(0); +public class PartyDemoTest { + @Test + public void runPartyDemoTest() throws Exception{ + new ClassPathXmlApplicationContext("/META-INF/spring/integration/errorHandlingDemo.xml", PartyDemoTest.class); + Thread.sleep(5000); } - } diff --git a/cook-books/errorhandling/src/main/java/log4j.xml b/cook-books/errorhandling/src/test/resources/log4j.xml similarity index 88% rename from cook-books/errorhandling/src/main/java/log4j.xml rename to cook-books/errorhandling/src/test/resources/log4j.xml index a01d5446..678b69b3 100644 --- a/cook-books/errorhandling/src/main/java/log4j.xml +++ b/cook-books/errorhandling/src/test/resources/log4j.xml @@ -15,8 +15,8 @@ - - + + diff --git a/cook-books/errorhandling/target/classes/log4j.xml b/cook-books/errorhandling/target/classes/log4j.xml deleted file mode 100644 index a01d5446..00000000 --- a/cook-books/errorhandling/target/classes/log4j.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/cook-books/errorhandling/target/classes/org/springframework/integration/samples/errorhandling/ErrorUnwrapper.class b/cook-books/errorhandling/target/classes/org/springframework/integration/samples/errorhandling/ErrorUnwrapper.class deleted file mode 100644 index ce16e430..00000000 Binary files a/cook-books/errorhandling/target/classes/org/springframework/integration/samples/errorhandling/ErrorUnwrapper.class and /dev/null differ diff --git a/cook-books/errorhandling/target/classes/org/springframework/integration/samples/errorhandling/Invitation.class b/cook-books/errorhandling/target/classes/org/springframework/integration/samples/errorhandling/Invitation.class deleted file mode 100644 index 2ac32634..00000000 Binary files a/cook-books/errorhandling/target/classes/org/springframework/integration/samples/errorhandling/Invitation.class and /dev/null differ diff --git a/cook-books/errorhandling/target/classes/org/springframework/integration/samples/errorhandling/PartyDemo.class b/cook-books/errorhandling/target/classes/org/springframework/integration/samples/errorhandling/PartyDemo.class deleted file mode 100644 index 017278a3..00000000 Binary files a/cook-books/errorhandling/target/classes/org/springframework/integration/samples/errorhandling/PartyDemo.class and /dev/null differ diff --git a/cook-books/errorhandling/target/classes/org/springframework/integration/samples/errorhandling/PartyGuest.class b/cook-books/errorhandling/target/classes/org/springframework/integration/samples/errorhandling/PartyGuest.class deleted file mode 100644 index 4d4eb7b2..00000000 Binary files a/cook-books/errorhandling/target/classes/org/springframework/integration/samples/errorhandling/PartyGuest.class and /dev/null differ diff --git a/cook-books/errorhandling/target/classes/org/springframework/integration/samples/errorhandling/PartyHost.class b/cook-books/errorhandling/target/classes/org/springframework/integration/samples/errorhandling/PartyHost.class deleted file mode 100644 index 5ce69811..00000000 Binary files a/cook-books/errorhandling/target/classes/org/springframework/integration/samples/errorhandling/PartyHost.class and /dev/null differ diff --git a/cook-books/errorhandling/target/classes/org/springframework/integration/samples/errorhandling/errorHandlingDemo.xml b/cook-books/errorhandling/target/classes/org/springframework/integration/samples/errorhandling/errorHandlingDemo.xml deleted file mode 100644 index 7485ab44..00000000 --- a/cook-books/errorhandling/target/classes/org/springframework/integration/samples/errorhandling/errorHandlingDemo.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/cook-books/errorhandling/target/errorhandling-2.0.0.BUILD-SNAPSHOT.jar b/cook-books/errorhandling/target/errorhandling-2.0.0.BUILD-SNAPSHOT.jar deleted file mode 100644 index 2ae91940..00000000 Binary files a/cook-books/errorhandling/target/errorhandling-2.0.0.BUILD-SNAPSHOT.jar and /dev/null differ diff --git a/cook-books/errorhandling/target/maven-archiver/pom.properties b/cook-books/errorhandling/target/maven-archiver/pom.properties deleted file mode 100644 index 82b74938..00000000 --- a/cook-books/errorhandling/target/maven-archiver/pom.properties +++ /dev/null @@ -1,5 +0,0 @@ -#Generated by Maven -#Sat Sep 04 08:22:04 EDT 2010 -version=2.0.0.BUILD-SNAPSHOT -groupId=org.springframework.integration.samples -artifactId=errorhandling