1.8
1.8
@@ -45,14 +45,22 @@
org.apache.maven.plugins
maven-war-plugin
- 3.0.0
+ ${maven-war-plugin.version}
org.eclipse.jetty
jetty-maven-plugin
- 9.3.12.v20160915
+ ${jetty-maven-plugin.version}
+
+
+ 3.1.0
+
+ 3.6.0
+ 3.0.0
+ 9.4.0.v20161208
+
diff --git a/pdf/README.md b/pdf/README.md
new file mode 100644
index 0000000000..7160df4081
--- /dev/null
+++ b/pdf/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [PDF Conversions in Java](http://www.baeldung.com/pdf-conversions-java)
diff --git a/pdf/pom.xml b/pdf/pom.xml
index 311265880d..332e1f5244 100644
--- a/pdf/pom.xml
+++ b/pdf/pom.xml
@@ -14,6 +14,15 @@
UTF-8
+ 4.12
+ 2.0.3
+ 1.6
+ 5.5.10
+ 5.5.10
+ 3.15
+ 1.8
+ 3.15
+
3.5.1
@@ -21,43 +30,43 @@
junit
junit
- 3.8.1
+ ${junit.version}
test
org.apache.pdfbox
pdfbox-tools
- 2.0.3
+ ${pdfbox-tools.version}
net.sf.cssbox
pdf2dom
- 1.6
+ ${pdf2dom.version}
com.itextpdf
itextpdf
- 5.5.10
+ ${itextpdf.version}
- org.apache.poi
- poi
- 3.15
+ com.itextpdf.tool
+ xmlworker
+ ${xmlworker.version}
org.apache.poi
poi-scratchpad
- 3.15
+ ${poi-scratchpad.version}
org.apache.xmlgraphics
batik-transcoder
- 1.8
+ ${batik-transcoder.version}
org.apache.poi
poi-ooxml
- 3.15
+ ${poi-ooxml.version}
diff --git a/pdf/src/main/java/com/baeldung/pdf/PDF2HTMLExample.java b/pdf/src/main/java/com/baeldung/pdf/PDF2HTMLExample.java
index 0d38208bab..1fdf07a05f 100644
--- a/pdf/src/main/java/com/baeldung/pdf/PDF2HTMLExample.java
+++ b/pdf/src/main/java/com/baeldung/pdf/PDF2HTMLExample.java
@@ -1,6 +1,8 @@
package com.baeldung.pdf;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Writer;
@@ -10,14 +12,21 @@ import javax.xml.parsers.ParserConfigurationException;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.fit.pdfdom.PDFDomTree;
+import com.itextpdf.text.Document;
+import com.itextpdf.text.DocumentException;
+import com.itextpdf.text.pdf.PdfWriter;
+import com.itextpdf.tool.xml.XMLWorkerHelper;
+
public class PDF2HTMLExample {
- private static final String FILENAME = "src/main/resources/pdf.pdf";
+ private static final String PDF = "src/main/resources/pdf.pdf";
+ private static final String HTML = "src/main/resources/html.html";
public static void main(String[] args) {
try {
- generateHTMLFromPDF(FILENAME);
- } catch (IOException | ParserConfigurationException e) {
+ generateHTMLFromPDF(PDF);
+ generatePDFFromHTML(HTML);
+ } catch (IOException | ParserConfigurationException | DocumentException e) {
e.printStackTrace();
}
}
@@ -32,4 +41,12 @@ public class PDF2HTMLExample {
pdf.close();
}
}
+
+ private static void generatePDFFromHTML(String filename) throws ParserConfigurationException, IOException, DocumentException {
+ Document document = new Document();
+ PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("src/output/html.pdf"));
+ document.open();
+ XMLWorkerHelper.getInstance().parseXHtml(writer, document, new FileInputStream(filename));
+ document.close();
+ }
}
diff --git a/pdf/src/main/java/com/baeldung/pdf/PDF2ImageExample.java b/pdf/src/main/java/com/baeldung/pdf/PDF2ImageExample.java
index 00778d16c1..69f5d9731f 100644
--- a/pdf/src/main/java/com/baeldung/pdf/PDF2ImageExample.java
+++ b/pdf/src/main/java/com/baeldung/pdf/PDF2ImageExample.java
@@ -1,24 +1,36 @@
package com.baeldung.pdf;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URL;
+
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.rendering.ImageType;
import org.apache.pdfbox.rendering.PDFRenderer;
import org.apache.pdfbox.tools.imageio.ImageIOUtil;
-import java.awt.image.BufferedImage;
-import java.io.File;
-import java.io.IOException;
+import com.itextpdf.text.BadElementException;
+import com.itextpdf.text.Document;
+import com.itextpdf.text.DocumentException;
+import com.itextpdf.text.Image;
+import com.itextpdf.text.pdf.PdfWriter;
public class PDF2ImageExample {
- private static final String FILENAME = "src/main/resources/pdf.pdf";
-
+ private static final String PDF = "src/main/resources/pdf.pdf";
+ private static final String JPG = "http://cdn2.baeldung.netdna-cdn.com/wp-content/uploads/2016/05/baeldung-rest-widget-main-1.2.0";
+ private static final String GIF = "https://media.giphy.com/media/l3V0x6kdXUW9M4ONq/giphy";
+
public static void main(String[] args) {
try {
- generateImageFromPDF(FILENAME, "png");
- generateImageFromPDF(FILENAME, "jpeg");
- generateImageFromPDF(FILENAME, "gif");
- } catch (IOException e) {
+ generateImageFromPDF(PDF, "png");
+ generateImageFromPDF(PDF, "jpeg");
+ generateImageFromPDF(PDF, "gif");
+ generatePDFFromImage(JPG, "jpg");
+ generatePDFFromImage(GIF, "gif");
+ } catch (IOException | DocumentException e) {
e.printStackTrace();
}
}
@@ -32,4 +44,19 @@ public class PDF2ImageExample {
}
document.close();
}
+
+ private static void generatePDFFromImage(String filename, String extension)
+ throws IOException, BadElementException, DocumentException {
+ Document document = new Document();
+ String input = filename + "." + extension;
+ String output = "src/output/" + extension + ".pdf";
+ FileOutputStream fos = new FileOutputStream(output);
+ PdfWriter writer = PdfWriter.getInstance(document, fos);
+ writer.open();
+ document.open();
+ document.add(Image.getInstance((new URL(input))));
+ document.close();
+ writer.close();
+ }
+
}
diff --git a/pdf/src/main/java/com/baeldung/pdf/PDF2TextExample.java b/pdf/src/main/java/com/baeldung/pdf/PDF2TextExample.java
index c5880a4e91..7965152234 100644
--- a/pdf/src/main/java/com/baeldung/pdf/PDF2TextExample.java
+++ b/pdf/src/main/java/com/baeldung/pdf/PDF2TextExample.java
@@ -1,6 +1,9 @@
package com.baeldung.pdf;
+import java.io.BufferedReader;
import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
@@ -10,14 +13,24 @@ import org.apache.pdfbox.pdfparser.PDFParser;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.text.PDFTextStripper;
+import com.itextpdf.text.Document;
+import com.itextpdf.text.DocumentException;
+import com.itextpdf.text.Element;
+import com.itextpdf.text.Font;
+import com.itextpdf.text.PageSize;
+import com.itextpdf.text.Paragraph;
+import com.itextpdf.text.pdf.PdfWriter;
+
public class PDF2TextExample {
- private static final String FILENAME = "src/main/resources/pdf.pdf";
+ private static final String PDF = "src/main/resources/pdf.pdf";
+ private static final String TXT = "src/main/resources/txt.txt";
public static void main(String[] args) {
try {
- generateTxtFromPDF(FILENAME);
- } catch (IOException e) {
+ generateTxtFromPDF(PDF);
+ generatePDFFromTxt(TXT);
+ } catch (IOException | DocumentException e) {
e.printStackTrace();
}
}
@@ -45,4 +58,27 @@ public class PDF2TextExample {
pw.close();
}
+ private static void generatePDFFromTxt(String filename) throws IOException, DocumentException {
+ Document pdfDoc = new Document(PageSize.A4);
+ PdfWriter.getInstance(pdfDoc, new FileOutputStream("src/output/txt.pdf"))
+ .setPdfVersion(PdfWriter.PDF_VERSION_1_7);
+ pdfDoc.open();
+
+ Font myfont = new Font();
+ myfont.setStyle(Font.NORMAL);
+ myfont.setSize(11);
+ pdfDoc.add(new Paragraph("\n"));
+
+ BufferedReader br = new BufferedReader(new FileReader(filename));
+ String strLine;
+ while ((strLine = br.readLine()) != null) {
+ Paragraph para = new Paragraph(strLine + "\n", myfont);
+ para.setAlignment(Element.ALIGN_JUSTIFIED);
+ pdfDoc.add(para);
+ }
+
+ pdfDoc.close();
+ br.close();
+ }
+
}
diff --git a/pdf/src/main/resources/html.html b/pdf/src/main/resources/html.html
new file mode 100644
index 0000000000..d3072c056c
--- /dev/null
+++ b/pdf/src/main/resources/html.html
@@ -0,0 +1,53 @@
+
+
+
+
+A very simple webpage
+
+
+
+A very simple webpage. This is an "h1" level header.
+
+This is a level h2 header.
+
+This is a level h6 header. Pretty small!
+
+This is a standard paragraph.
+
+Now I've aligned it in the center of the screen.
+
+Now aligned to the right
+
+Bold text
+
+Strongly emphasized text Can you tell the difference vs. bold?
+
+Italics
+
+Emphasized text Just like Italics!
+
+How about a nice ordered list!
+
+ - This little piggy went to market
+ - This little piggy went to SB228 class
+ - This little piggy went to an expensive restaurant in Downtown Palo Alto
+ - This little piggy ate too much at Indian Buffet.
+ - This little piggy got lost
+
+
+Unordered list
+
+ - First element
+ - Second element
+ - Third element
+
+
+
+And finally, how about some
Links?
+
+Remember, you can view the HTMl code from this or any other page by using the "View Page Source" command of your browser.
+
+
+
+
+
diff --git a/pdf/src/main/resources/txt.txt b/pdf/src/main/resources/txt.txt
new file mode 100644
index 0000000000..de0c36ae75
--- /dev/null
+++ b/pdf/src/main/resources/txt.txt
@@ -0,0 +1,3 @@
+Test
+Text
+ Test TEST
\ No newline at end of file
diff --git a/play-framework/README.md b/play-framework/README.md
new file mode 100644
index 0000000000..0fd13fba27
--- /dev/null
+++ b/play-framework/README.md
@@ -0,0 +1,4 @@
+###Relevant Articles:
+- [REST API with Play Framework in Java](http://www.baeldung.com/rest-api-with-play)
+- [Routing In Play Applications in Java](http://www.baeldung.com/routing-in-play)
+- [Introduction To Play In Java](http://www.baeldung.com/java-intro-to-the-play-framework)
diff --git a/pom.xml b/pom.xml
index 9dfb0fdaaf..52c6ec611d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,5 +1,6 @@
-
+
4.0.0
com.baeldung
parent-modules
@@ -16,7 +17,9 @@
annotations
apache-cxf
- apache-fop
+ apache-fop
+ apache-poi
+ aspectj
assertj
autovalue
@@ -28,6 +31,8 @@
deltaspike
dozer
+ ejb
+
feign
flyway
@@ -44,21 +49,27 @@
httpclient
hystrix
+ image-processing
immutables
jackson
+ jackson-annotations
java-cassandra
+ javax-servlets
javaxval
+ jaxb
jee7
jjwt
jpa-storedprocedure
- jsf
+ jsf
json-path
json
+ jsoup
junit5
-
- log4j
+
log-mdc
+ log4j
+ log4j2
lombok
mapstruct
@@ -68,23 +79,24 @@
orika
patterns
+ pdf
querydsl
- redis
+ redis
rest-assured
rest-testing
resteasy
selenium-junit-testng
- spring-akka
+ spring-akka
spring-all
spring-apache-camel
spring-autowire
spring-batch
spring-boot
- spring-cloud-data-flow
+ spring-cloud-data-flow
spring-cloud
spring-core
spring-cucumber
@@ -108,12 +120,15 @@
spring-jpa
spring-katharsis
spring-mockito
+ spring-mvc-email
+ spring-mvc-forms
spring-mvc-java
spring-mvc-no-xml
spring-mvc-tiles
spring-mvc-velocity
spring-mvc-web-vs-initializer
spring-mvc-xml
+ spring-mvc-simple
spring-openid
spring-protobuf
spring-quartz
@@ -121,6 +136,14 @@
spring-rest-docs
spring-rest
spring-security-basic-auth
+ spring-security-client/spring-security-jsp-authentication
+ spring-security-client/spring-security-jsp-authorize
+ spring-security-client/spring-security-jsp-config
+ spring-security-client/spring-security-mvc
+ spring-security-client/spring-security-thymeleaf-authentication
+ spring-security-client/spring-security-thymeleaf-authorize
+ spring-security-client/spring-security-thymeleaf-config
+ spring-security-core
spring-security-custom-permission
spring-security-mvc-custom
spring-security-mvc-digest-auth
@@ -132,9 +155,10 @@
spring-security-rest-custom
spring-security-rest-digest-auth
spring-security-rest-full
- spring-security-rest
+ spring-security-rest
spring-security-x509
spring-session
+ spring-social-login
spring-spel
spring-thymeleaf
spring-userservice
@@ -147,7 +171,6 @@
xml
xmlunit2
xstream
- pdf
-
+
-
\ No newline at end of file
+
diff --git a/querydsl/pom.xml b/querydsl/pom.xml
index 13528526ea..a9218e7751 100644
--- a/querydsl/pom.xml
+++ b/querydsl/pom.xml
@@ -16,10 +16,19 @@
UTF-8
1.8
4.12
- 4.3.1.RELEASE
- 5.2.1.Final
- 4.1.3
+ 4.3.4.RELEASE
+ 5.2.5.Final
+ 1.0.0.Final
+ 4.1.4
+ 2.3.4
+ 1.6
+ 1.4
+
1.7.21
+ 1.1.7
+
+ 3.6.0
+ 1.1.3
2.19.1
@@ -50,14 +59,14 @@
org.hibernate.javax.persistence
hibernate-jpa-2.1-api
- 1.0.0.Final
+ ${hibernate-jpa.version}
compile
commons-dbcp
commons-dbcp
- 1.4
+ ${commons-dbcp.version}
jar
compile
@@ -65,7 +74,7 @@
commons-pool
commons-pool
- 1.6
+ ${commons-pool.version}
jar
compile
@@ -74,7 +83,7 @@
org.hsqldb
hsqldb
- 2.3.4
+ ${hsqldb.version}
@@ -116,7 +125,7 @@
ch.qos.logback
logback-classic
- 1.1.7
+ ${logback.version}
org.slf4j
@@ -142,7 +151,7 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.5.1
+ ${maven-compiler-plugin.version}
${java.version}
${java.version}
@@ -154,7 +163,7 @@
com.mysema.maven
apt-maven-plugin
- 1.1.3
+ ${apt-maven-plugin.version}
diff --git a/redis/pom.xml b/redis/pom.xml
index a5d3af8097..e3affdd7ef 100644
--- a/redis/pom.xml
+++ b/redis/pom.xml
@@ -1,7 +1,6 @@
-
+
4.0.0
com.baeldung
@@ -15,13 +14,13 @@
redis.clients
jedis
- 2.8.1
+ ${jedis.version}
com.github.kstyrc
embedded-redis
- 0.6
+ ${embedded-redis.version}
@@ -38,19 +37,38 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.5.1
+ ${maven-compiler-plugin.version}
1.8
1.8
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ **/*IntegrationTest.java
+ **/*LongRunningUnitTest.java
+ **/*ManualTest.java
+
+ true
+
+
+
UTF-8
+
+ 2.9.0
+ 0.6
+
4.12
+
+ 3.6.0
diff --git a/rest-assured/pom.xml b/rest-assured/pom.xml
index e2a2af9cd9..bbeef8bb9c 100644
--- a/rest-assured/pom.xml
+++ b/rest-assured/pom.xml
@@ -10,106 +10,106 @@
javax.servlet
javax.servlet-api
- 3.1-b06
+ ${javax.servlet-api.version}
javax.servlet
servlet-api
- 2.5
+ ${servlet-api.version}
org.eclipse.jetty
jetty-security
- 9.2.0.M1
+ ${jetty.version}
org.eclipse.jetty
jetty-servlet
- 9.2.0.M1
+ ${jetty.version}
org.eclipse.jetty
jetty-servlets
- 9.2.0.M1
+ ${jetty.version}
org.eclipse.jetty
jetty-io
- 9.2.0.M1
+ ${jetty.version}
org.eclipse.jetty
jetty-http
- 9.2.0.M1
+ ${jetty.version}
org.eclipse.jetty
jetty-server
- 9.2.0.M1
+ ${jetty.version}
org.eclipse.jetty
jetty-util
- 9.2.0.M1
+ ${jetty.version}
org.slf4j
slf4j-api
- 1.7.21
+ ${slf4j.version}
log4j
log4j
- 1.2.17
+ ${log4j.version}
org.slf4j
slf4j-log4j12
- 1.7.21
+ ${slf4j.version}
commons-logging
commons-logging
- 1.2
+ ${commons-logging.version}
org.apache.httpcomponents
httpcore
- 4.4.5
+ ${httpcore.version}
org.apache.commons
commons-lang3
- 3.4
+ ${commons-lang3.version}
com.github.fge
uri-template
- 0.9
+ ${uri-template.version}
com.googlecode.libphonenumber
libphonenumber
- 7.4.5
+ ${libphonenumber.version}
javax.mail
mail
- 1.4.7
+ ${javax.mail.version}
joda-time
joda-time
- 2.9.4
+ ${joda-time.version}
@@ -126,13 +126,13 @@
com.github.fge
msg-simple
- 1.1
+ ${msg-simple.version}
com.github.fge
jackson-coreutils
- 1.8
+ ${jackson-coreutils.version}
@@ -143,63 +143,63 @@
com.github.fge
btf
- 1.2
+ ${btf.version}
org.apache.httpcomponents
httpclient
- 4.5.2
+ ${httpclient.version}
org.codehaus.groovy
groovy-all
- 2.4.7
+ ${groovy.version}
com.github.tomakehurst
wiremock
- 2.1.7
+ ${wiremock.version}
io.rest-assured
rest-assured
- 3.0.0
+ ${rest-assured.version}
test
io.rest-assured
json-schema-validator
- 3.0.0
+ ${rest-assured-json-schema-validator.version}
com.github.fge
json-schema-validator
- 2.2.6
+ ${github-json-schema-validator.version}
com.github.fge
json-schema-core
- 1.2.5
+ ${json-schema-core.version}
junit
junit
- 4.3
+ ${junit.version}
test
org.hamcrest
hamcrest-all
- 1.3
+ ${hamcrest.version}
commons-collections
commons-collections
- 3.2.2
+ ${commons-collections.version}
@@ -209,18 +209,101 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.3
+ ${maven-compiler-plugin.version}
8
8
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ ${maven-surefire-plugin.version}
+
+
+ **/*IntegrationTest.java
+ **/*LiveTest.java
+
+
+
+
+
+
+ integration
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ integration-test
+
+ test
+
+
+
+ **/*LiveTest.java
+
+
+ **/*IntegrationTest.java
+
+
+
+
+
+
+ json
+
+
+
+
+
+
+
+
+
- 2.8.3
+ 2.8.5
+ 1.8
19.0
+
+ 3.1.0
+ 2.5
+ 1.4.7
+ 9.4.0.v20161208
+
+ 1.2.17
+ 1.7.21
+
+ 3.5
+ 1.2
+ 3.2.2
+
+ 4.4.5
+ 4.5.2
+
+ 0.9
+ 8.0.0
+ 2.9.6
+ 1.1
+ 1.2
+ 2.4.7
+ 2.4.1
+
+ 2.2.6
+ 1.2.5
+
+ 1.3
+ 3.0.1
+ 3.0.1
+ 4.12
+
+ 3.6.0
+ 2.19.1
diff --git a/rest-assured/src/test/java/com/baeldung/restassured/RestAssured2Test.java b/rest-assured/src/test/java/com/baeldung/restassured/RestAssured2IntegrationTest.java
similarity index 92%
rename from rest-assured/src/test/java/com/baeldung/restassured/RestAssured2Test.java
rename to rest-assured/src/test/java/com/baeldung/restassured/RestAssured2IntegrationTest.java
index 067756823b..13ba3ccac9 100644
--- a/rest-assured/src/test/java/com/baeldung/restassured/RestAssured2Test.java
+++ b/rest-assured/src/test/java/com/baeldung/restassured/RestAssured2IntegrationTest.java
@@ -15,7 +15,7 @@ import static io.restassured.RestAssured.get;
import com.github.tomakehurst.wiremock.WireMockServer;
-public class RestAssured2Test {
+public class RestAssured2IntegrationTest {
private WireMockServer wireMockServer = new WireMockServer();
private static final String EVENTS_PATH = "/odds";
@@ -41,7 +41,7 @@ public class RestAssured2Test {
private static String getJson() {
- return Util.inputStreamToString(new RestAssured2Test().getClass()
+ return Util.inputStreamToString(new RestAssured2IntegrationTest().getClass()
.getResourceAsStream("/odds.json"));
}
diff --git a/rest-assured/src/test/java/com/baeldung/restassured/RestAssuredTest.java b/rest-assured/src/test/java/com/baeldung/restassured/RestAssuredIntegrationTest.java
similarity index 96%
rename from rest-assured/src/test/java/com/baeldung/restassured/RestAssuredTest.java
rename to rest-assured/src/test/java/com/baeldung/restassured/RestAssuredIntegrationTest.java
index 06f54aae24..f14d9920b6 100644
--- a/rest-assured/src/test/java/com/baeldung/restassured/RestAssuredTest.java
+++ b/rest-assured/src/test/java/com/baeldung/restassured/RestAssuredIntegrationTest.java
@@ -20,7 +20,7 @@ import com.github.fge.jsonschema.cfg.ValidationConfiguration;
import com.github.fge.jsonschema.main.JsonSchemaFactory;
import com.github.tomakehurst.wiremock.WireMockServer;
-public class RestAssuredTest {
+public class RestAssuredIntegrationTest {
private WireMockServer wireMockServer = new WireMockServer();
private static final String EVENTS_PATH = "/events?id=390";
@@ -99,7 +99,7 @@ public class RestAssuredTest {
}
private static String getEventJson() {
- return Util.inputStreamToString(RestAssuredTest.class
+ return Util.inputStreamToString(RestAssuredIntegrationTest.class
.getResourceAsStream("/event_0.json"));
}
diff --git a/rest-assured/src/test/java/com/baeldung/restassured/RestAssuredXML2Test.java b/rest-assured/src/test/java/com/baeldung/restassured/RestAssuredXML2IntegrationTest.java
similarity index 91%
rename from rest-assured/src/test/java/com/baeldung/restassured/RestAssuredXML2Test.java
rename to rest-assured/src/test/java/com/baeldung/restassured/RestAssuredXML2IntegrationTest.java
index 597280c7c0..b77f24b15f 100644
--- a/rest-assured/src/test/java/com/baeldung/restassured/RestAssuredXML2Test.java
+++ b/rest-assured/src/test/java/com/baeldung/restassured/RestAssuredXML2IntegrationTest.java
@@ -15,7 +15,7 @@ import static io.restassured.RestAssured.get;
import com.github.tomakehurst.wiremock.WireMockServer;
-public class RestAssuredXML2Test {
+public class RestAssuredXML2IntegrationTest {
private WireMockServer wireMockServer = new WireMockServer();
private static final String EVENTS_PATH = "/teachers";
@@ -42,7 +42,7 @@ public class RestAssuredXML2Test {
private static String getXml() {
return Util
- .inputStreamToString(new RestAssuredXML2Test().getClass().getResourceAsStream("/teachers.xml"));
+ .inputStreamToString(new RestAssuredXML2IntegrationTest().getClass().getResourceAsStream("/teachers.xml"));
}
@After
diff --git a/rest-assured/src/test/java/com/baeldung/restassured/RestAssuredXMLTest.java b/rest-assured/src/test/java/com/baeldung/restassured/RestAssuredXMLIntegrationTest.java
similarity index 95%
rename from rest-assured/src/test/java/com/baeldung/restassured/RestAssuredXMLTest.java
rename to rest-assured/src/test/java/com/baeldung/restassured/RestAssuredXMLIntegrationTest.java
index 315dc76169..10aef63cdb 100644
--- a/rest-assured/src/test/java/com/baeldung/restassured/RestAssuredXMLTest.java
+++ b/rest-assured/src/test/java/com/baeldung/restassured/RestAssuredXMLIntegrationTest.java
@@ -25,7 +25,7 @@ import com.github.fge.jsonschema.SchemaVersion;
import com.github.fge.jsonschema.cfg.ValidationConfiguration;
import com.github.fge.jsonschema.main.JsonSchemaFactory;
import com.github.tomakehurst.wiremock.WireMockServer;
-public class RestAssuredXMLTest {
+public class RestAssuredXMLIntegrationTest {
private WireMockServer wireMockServer = new WireMockServer();
private static final String EVENTS_PATH = "/employees";
private static final String APPLICATION_XML = "application/xml";
@@ -88,7 +88,7 @@ public class RestAssuredXMLTest {
private static String getXml() {
return Util
- .inputStreamToString(new RestAssuredXMLTest().getClass().getResourceAsStream("/employees.xml"));
+ .inputStreamToString(new RestAssuredXMLIntegrationTest().getClass().getResourceAsStream("/employees.xml"));
}
@After
diff --git a/rest-testing/pom.xml b/rest-testing/pom.xml
index 90c160af15..f7f94a49a6 100644
--- a/rest-testing/pom.xml
+++ b/rest-testing/pom.xml
@@ -20,7 +20,7 @@
commons-io
commons-io
- 2.4
+ ${commons-io.version}
@@ -106,20 +106,20 @@
com.github.tomakehurst
wiremock
- 1.58
+ ${wiremock.version}
test
info.cukes
cucumber-java
- 1.2.4
+ ${cucumber.version}
test
info.cukes
cucumber-junit
- 1.2.4
+ ${cucumber.version}
@@ -198,35 +198,33 @@
- 2.7.8
+ 2.8.5
- 1.7.13
- 1.1.3
-
-
- 5.1.3.Final
+ 1.7.21
+ 1.1.7
19.0
- 3.4
+ 3.5
+ 2.5
1.3
4.12
1.10.19
+ 2.9.0
+ 1.2.5
+ 2.4.1
- 4.4.1
- 4.5
+ 4.4.5
+ 4.5.2
- 2.9.0
- 3.5.1
+ 3.6.0
2.6
2.19.1
- 2.7
- 1.4.18
diff --git a/resteasy/pom.xml b/resteasy/pom.xml
index 04e8576e1f..f0bd8298f5 100644
--- a/resteasy/pom.xml
+++ b/resteasy/pom.xml
@@ -9,9 +9,11 @@
war
- 3.0.14.Final
+ 3.0.19.Final
+ 4.12
+ 2.5
2.19.1
- 1.6.0
+ 1.6.1
@@ -93,13 +95,13 @@
junit
junit
- 4.4
+ ${junit.version}
commons-io
commons-io
- 2.4
+ ${commons-io.version}
diff --git a/selenium-junit-testng/pom.xml b/selenium-junit-testng/pom.xml
index 754bf679b5..b4490f779b 100644
--- a/selenium-junit-testng/pom.xml
+++ b/selenium-junit-testng/pom.xml
@@ -9,7 +9,7 @@
maven-compiler-plugin
- 3.1
+ ${maven-compiler-plugin.version}
1.8
1.8
@@ -18,7 +18,7 @@
org.apache.maven.plugins
maven-surefire-plugin
- 2.19.1
+ ${maven-surefire-plugin.version}
true
@@ -38,7 +38,7 @@
org.apache.maven.plugins
maven-surefire-plugin
- 2.19.1
+ ${maven-surefire-plugin.version}
**/*LiveTest.java
@@ -55,17 +55,26 @@
org.seleniumhq.selenium
selenium-java
- 3.0.1
+ ${selenium-java.version}
junit
junit
- 4.12
+ ${junit.version}
org.testng
testng
- 6.9.13.6
+ ${testng.version}
+
+
+ 4.12
+ 6.10
+ 3.0.1
+
+ 2.19.1
+ 3.6.0
+
\ No newline at end of file
diff --git a/selenium-junit-testng/src/main/java/com/baeldung/selenium/SeleniumExample.java b/selenium-junit-testng/src/main/java/com/baeldung/selenium/SeleniumExample.java
index dd309cec79..b97f66e9dd 100644
--- a/selenium-junit-testng/src/main/java/com/baeldung/selenium/SeleniumExample.java
+++ b/selenium-junit-testng/src/main/java/com/baeldung/selenium/SeleniumExample.java
@@ -1,14 +1,13 @@
package main.java.com.baeldung.selenium;
-import java.util.List;
-import java.util.NoSuchElementException;
-import java.util.concurrent.TimeUnit;
-
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
public class SeleniumExample {
private WebDriver webDriver;
@@ -38,12 +37,12 @@ public class SeleniumExample {
private void closeOverlay() {
List webElementList = webDriver.findElements(By.tagName("a"));
- try {
- if (webElementList != null && !webElementList.isEmpty()) {
- webElementList.stream().filter(webElement -> "Close".equalsIgnoreCase(webElement.getAttribute("title"))).findAny().orElseThrow(NoSuchElementException::new).click();
- }
- } catch (NoSuchElementException exception) {
- exception.printStackTrace();
+ if (webElementList != null) {
+ webElementList.stream()
+ .filter(webElement -> "Close".equalsIgnoreCase(webElement.getAttribute("title")))
+ .filter(WebElement::isDisplayed)
+ .findAny()
+ .ifPresent(WebElement::click);
}
}
diff --git a/spring-akka/pom.xml b/spring-akka/pom.xml
index eb33ca4848..1a273b0fed 100644
--- a/spring-akka/pom.xml
+++ b/spring-akka/pom.xml
@@ -115,11 +115,11 @@
- 4.3.2.RELEASE
- 2.4.8
+ 4.3.4.RELEASE
+ 2.4.14
4.12
- 3.5.1
+ 3.6.0
2.19.1
diff --git a/spring-all/pom.xml b/spring-all/pom.xml
index 23f2531b51..e77bf0b284 100644
--- a/spring-all/pom.xml
+++ b/spring-all/pom.xml
@@ -11,7 +11,7 @@
org.springframework.boot
spring-boot-starter-parent
- 1.3.6.RELEASE
+ 1.4.2.RELEASE
@@ -134,7 +134,7 @@
org.assertj
assertj-core
- 3.5.1
+ ${assertj.version}
test
@@ -158,13 +158,13 @@
org.easymock
easymock
- 3.4
+ ${easymock.version}
test
org.ehcache
ehcache
- 3.1.3
+ ${ehcache.version}
@@ -273,42 +273,17 @@
- 4.3.1.RELEASE
- 4.0.4.RELEASE
- 3.20.0-GA
- 1.2
+ 4.3.4.RELEASE
+ 4.2.0.RELEASE
- 4.3.11.Final
- 5.1.38
-
-
- 1.7.13
- 1.1.3
-
-
- 5.2.2.Final
+ 5.2.5.Final
19.0
- 3.4
-
-
- 1.3
- 4.12
- 1.10.19
-
- 4.4.1
- 4.5
-
- 2.9.0
-
-
- 3.5.1
- 2.6
- 2.19.1
- 2.7
- 1.4.18
+ 3.1.3
+ 3.4
+ 3.6.1
diff --git a/spring-apache-camel/README.md b/spring-apache-camel/README.md
index 4015760f7d..ab7cf5c575 100644
--- a/spring-apache-camel/README.md
+++ b/spring-apache-camel/README.md
@@ -8,6 +8,7 @@ This article will demonstrate how to configure and use Apache Camel with Spring
Framework Versions:
diff --git a/spring-apache-camel/pom.xml b/spring-apache-camel/pom.xml
index fbea9b779d..da7dad1a1f 100644
--- a/spring-apache-camel/pom.xml
+++ b/spring-apache-camel/pom.xml
@@ -9,27 +9,28 @@
http://maven.apache.org
- 2.16.1
- 4.2.4.RELEASE
- 1.7
- 4.1
+ 2.18.1
+ 4.3.4.RELEASE
+ 2.19.1
+ 1.8
+ 4.12
-
+
junit
junit
${junit.version}
test
-
+
org.apache.camel
camel-core
${env.camel.version}
-
+
org.apache.camel
camel-spring
@@ -47,9 +48,19 @@
spring-context
${env.spring.version}
+
+ org.slf4j
+ slf4j-log4j12
+ 1.7.21
+
+
+ org.apache.camel
+ camel-spring-javaconfig
+ ${env.camel.version}
+
-
+
@@ -62,6 +73,22 @@
${java.version}
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ ${maven-surefire-plugin.version}
+
+
+ **/*IntegrationTest.java
+
+
+
+
+
+
+
+
diff --git a/spring-apache-camel/src/main/java/com/baeldung/camel/file/ContentBasedFileRouter.java b/spring-apache-camel/src/main/java/com/baeldung/camel/file/ContentBasedFileRouter.java
new file mode 100644
index 0000000000..9106e996c3
--- /dev/null
+++ b/spring-apache-camel/src/main/java/com/baeldung/camel/file/ContentBasedFileRouter.java
@@ -0,0 +1,16 @@
+package com.baeldung.camel.file;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class ContentBasedFileRouter extends RouteBuilder {
+
+ private static final String SOURCE_FOLDER = "src/test/source-folder";
+ private static final String DESTINATION_FOLDER_TXT = "src/test/destination-folder-txt";
+ private static final String DESTINATION_FOLDER_OTHER = "src/test/destination-folder-other";
+
+ @Override
+ public void configure() throws Exception {
+ from("file://" + SOURCE_FOLDER + "?delete=true").choice().when(simple("${file:ext} == 'txt'")).to("file://" + DESTINATION_FOLDER_TXT).otherwise().to("file://" + DESTINATION_FOLDER_OTHER);
+ }
+
+}
diff --git a/spring-apache-camel/src/main/java/com/baeldung/camel/file/DeadLetterChannelFileRouter.java b/spring-apache-camel/src/main/java/com/baeldung/camel/file/DeadLetterChannelFileRouter.java
new file mode 100644
index 0000000000..fdcad99f02
--- /dev/null
+++ b/spring-apache-camel/src/main/java/com/baeldung/camel/file/DeadLetterChannelFileRouter.java
@@ -0,0 +1,18 @@
+package com.baeldung.camel.file;
+
+import org.apache.camel.LoggingLevel;
+import org.apache.camel.builder.RouteBuilder;
+
+public class DeadLetterChannelFileRouter extends RouteBuilder {
+ private static final String SOURCE_FOLDER = "src/test/source-folder";
+
+ @Override
+ public void configure() throws Exception {
+ errorHandler(deadLetterChannel("log:dead?level=ERROR").maximumRedeliveries(3)
+ .redeliveryDelay(1000).retryAttemptedLogLevel(LoggingLevel.ERROR));
+
+ from("file://" + SOURCE_FOLDER + "?delete=true").process((exchange) -> {
+ throw new IllegalArgumentException("Exception thrown!");
+ });
+ }
+}
diff --git a/spring-apache-camel/src/main/java/com/baeldung/camel/file/MessageTranslatorFileRouter.java b/spring-apache-camel/src/main/java/com/baeldung/camel/file/MessageTranslatorFileRouter.java
new file mode 100644
index 0000000000..b99de99dac
--- /dev/null
+++ b/spring-apache-camel/src/main/java/com/baeldung/camel/file/MessageTranslatorFileRouter.java
@@ -0,0 +1,14 @@
+package com.baeldung.camel.file;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+
+public class MessageTranslatorFileRouter extends RouteBuilder {
+ private static final String SOURCE_FOLDER = "src/test/source-folder";
+ private static final String DESTINATION_FOLDER = "src/test/destination-folder";
+
+ @Override
+ public void configure() throws Exception {
+ from("file://" + SOURCE_FOLDER + "?delete=true").transform(body().append(header(Exchange.FILE_NAME))).to("file://" + DESTINATION_FOLDER);
+ }
+}
diff --git a/spring-apache-camel/src/main/java/com/baeldung/camel/file/MulticastFileRouter.java b/spring-apache-camel/src/main/java/com/baeldung/camel/file/MulticastFileRouter.java
new file mode 100644
index 0000000000..75a6e81d45
--- /dev/null
+++ b/spring-apache-camel/src/main/java/com/baeldung/camel/file/MulticastFileRouter.java
@@ -0,0 +1,18 @@
+package com.baeldung.camel.file;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class MulticastFileRouter extends RouteBuilder {
+ private static final String SOURCE_FOLDER = "src/test/source-folder";
+ private static final String DESTINATION_FOLDER_WORLD = "src/test/destination-folder-world";
+ private static final String DESTINATION_FOLDER_HELLO = "src/test/destination-folder-hello";
+
+ @Override
+ public void configure() throws Exception {
+ from("file://" + SOURCE_FOLDER + "?delete=true").multicast().to("direct:append", "direct:prepend").end();
+
+ from("direct:append").transform(body().append("World")).to("file://" + DESTINATION_FOLDER_WORLD);
+
+ from("direct:prepend").transform(body().prepend("Hello")).to("file://" + DESTINATION_FOLDER_HELLO);
+ }
+}
diff --git a/spring-apache-camel/src/main/java/com/baeldung/camel/file/SplitterFileRouter.java b/spring-apache-camel/src/main/java/com/baeldung/camel/file/SplitterFileRouter.java
new file mode 100644
index 0000000000..551f9c9685
--- /dev/null
+++ b/spring-apache-camel/src/main/java/com/baeldung/camel/file/SplitterFileRouter.java
@@ -0,0 +1,15 @@
+package com.baeldung.camel.file;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+
+public class SplitterFileRouter extends RouteBuilder {
+ private static final String SOURCE_FOLDER = "src/test/source-folder";
+ private static final String DESTINATION_FOLDER = "src/test/destination-folder";
+
+ @Override
+ public void configure() throws Exception {
+
+ from("file://" + SOURCE_FOLDER + "?delete=true").split(body().convertToString().tokenize("\n")).setHeader(Exchange.FILE_NAME, body()).to("file://" + DESTINATION_FOLDER);
+ }
+}
diff --git a/spring-apache-camel/src/main/java/com/baeldung/camel/file/cfg/ContentBasedFileRouterConfig.java b/spring-apache-camel/src/main/java/com/baeldung/camel/file/cfg/ContentBasedFileRouterConfig.java
new file mode 100644
index 0000000000..ceb68dfa3b
--- /dev/null
+++ b/spring-apache-camel/src/main/java/com/baeldung/camel/file/cfg/ContentBasedFileRouterConfig.java
@@ -0,0 +1,26 @@
+package com.baeldung.camel.file.cfg;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spring.javaconfig.CamelConfiguration;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import com.baeldung.camel.file.ContentBasedFileRouter;
+
+@Configuration
+public class ContentBasedFileRouterConfig extends CamelConfiguration {
+
+ @Bean
+ ContentBasedFileRouter getContentBasedFileRouter() {
+ return new ContentBasedFileRouter();
+ }
+
+ @Override
+ public List routes() {
+ return Arrays.asList(getContentBasedFileRouter());
+ }
+
+}
diff --git a/spring-apache-camel/src/main/resources/camel-context-ContentBasedFileRouterTest.xml b/spring-apache-camel/src/main/resources/camel-context-ContentBasedFileRouterTest.xml
new file mode 100644
index 0000000000..d6d3e62f1c
--- /dev/null
+++ b/spring-apache-camel/src/main/resources/camel-context-ContentBasedFileRouterTest.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-apache-camel/src/main/resources/camel-context-DeadLetterChannelFileRouter.xml b/spring-apache-camel/src/main/resources/camel-context-DeadLetterChannelFileRouter.xml
new file mode 100644
index 0000000000..ef61174b32
--- /dev/null
+++ b/spring-apache-camel/src/main/resources/camel-context-DeadLetterChannelFileRouter.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-apache-camel/src/main/resources/camel-context-MessageTranslatorFileRouterTest.xml b/spring-apache-camel/src/main/resources/camel-context-MessageTranslatorFileRouterTest.xml
new file mode 100644
index 0000000000..7ab988ca8a
--- /dev/null
+++ b/spring-apache-camel/src/main/resources/camel-context-MessageTranslatorFileRouterTest.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-apache-camel/src/main/resources/camel-context-MulticastFileRouterTest.xml b/spring-apache-camel/src/main/resources/camel-context-MulticastFileRouterTest.xml
new file mode 100644
index 0000000000..6f7e7cbb60
--- /dev/null
+++ b/spring-apache-camel/src/main/resources/camel-context-MulticastFileRouterTest.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-apache-camel/src/main/resources/camel-context-SplitterFileRouter.xml b/spring-apache-camel/src/main/resources/camel-context-SplitterFileRouter.xml
new file mode 100644
index 0000000000..9d4a890cc6
--- /dev/null
+++ b/spring-apache-camel/src/main/resources/camel-context-SplitterFileRouter.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-apache-camel/src/main/resources/log4j.xml b/spring-apache-camel/src/main/resources/log4j.xml
new file mode 100644
index 0000000000..4a86fb2357
--- /dev/null
+++ b/spring-apache-camel/src/main/resources/log4j.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-apache-camel/src/test/destination-folder/2016-12-18 22-00-11File1.txt b/spring-apache-camel/src/test/destination-folder/2016-12-18 22-00-11File1.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/spring-apache-camel/src/test/destination-folder/2016-12-18 22-00-11File2.txt b/spring-apache-camel/src/test/destination-folder/2016-12-18 22-00-11File2.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/spring-apache-camel/src/test/java/com/apache/camel/file/processor/ContentBasedFileRouterIntegrationTest.java b/spring-apache-camel/src/test/java/com/apache/camel/file/processor/ContentBasedFileRouterIntegrationTest.java
new file mode 100644
index 0000000000..23f5787e4e
--- /dev/null
+++ b/spring-apache-camel/src/test/java/com/apache/camel/file/processor/ContentBasedFileRouterIntegrationTest.java
@@ -0,0 +1,71 @@
+package com.apache.camel.file.processor;
+
+import java.io.File;
+
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+import org.springframework.context.annotation.AnnotationConfigApplicationContext;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import com.baeldung.camel.file.cfg.ContentBasedFileRouterConfig;
+
+@RunWith(JUnit4.class)
+public class ContentBasedFileRouterIntegrationTest {
+
+ private static final long DURATION_MILIS = 10000;
+ private static final String SOURCE_FOLDER = "src/test/source-folder";
+ private static final String DESTINATION_FOLDER_TXT = "src/test/destination-folder-txt";
+ private static final String DESTINATION_FOLDER_OTHER = "src/test/destination-folder-other";
+
+ @Before
+ public void setUp() throws Exception {
+ File sourceFolder = new File(SOURCE_FOLDER);
+ File destinationFolderTxt = new File(DESTINATION_FOLDER_TXT);
+ File destinationFolderOther = new File(DESTINATION_FOLDER_OTHER);
+
+ cleanFolder(sourceFolder);
+ cleanFolder(destinationFolderTxt);
+ cleanFolder(destinationFolderOther);
+
+ sourceFolder.mkdirs();
+ File file1 = new File(SOURCE_FOLDER + "/File1.txt");
+ File file2 = new File(SOURCE_FOLDER + "/File2.csv");
+ file1.createNewFile();
+ file2.createNewFile();
+ }
+
+ private void cleanFolder(File folder) {
+ File[] files = folder.listFiles();
+ if (files != null) {
+ for (File file : files) {
+ if (file.isFile()) {
+ file.delete();
+ }
+ }
+ }
+ }
+
+ @Test
+ @Ignore
+ public void routeWithXMLConfigTest() throws InterruptedException {
+ AbstractApplicationContext applicationContext = new ClassPathXmlApplicationContext(
+ "camel-context-ContentBasedFileRouterTest.xml");
+ Thread.sleep(DURATION_MILIS);
+ applicationContext.close();
+
+ }
+
+ @Test
+ @Ignore
+ public void routeWithJavaConfigTest() throws InterruptedException {
+ AbstractApplicationContext applicationContext = new AnnotationConfigApplicationContext(
+ ContentBasedFileRouterConfig.class);
+ Thread.sleep(DURATION_MILIS);
+ applicationContext.close();
+
+ }
+}
\ No newline at end of file
diff --git a/spring-apache-camel/src/test/java/com/apache/camel/file/processor/DeadLetterChannelFileRouterIntegrationTest.java b/spring-apache-camel/src/test/java/com/apache/camel/file/processor/DeadLetterChannelFileRouterIntegrationTest.java
new file mode 100644
index 0000000000..eb684230c9
--- /dev/null
+++ b/spring-apache-camel/src/test/java/com/apache/camel/file/processor/DeadLetterChannelFileRouterIntegrationTest.java
@@ -0,0 +1,43 @@
+package com.apache.camel.file.processor;
+
+import java.io.File;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class DeadLetterChannelFileRouterIntegrationTest {
+
+ private static final long DURATION_MILIS = 10000;
+ private static final String SOURCE_FOLDER = "src/test/source-folder";
+
+ @Before
+ public void setUp() throws Exception {
+ File sourceFolder = new File(SOURCE_FOLDER);
+
+ cleanFolder(sourceFolder);
+
+ sourceFolder.mkdirs();
+ File file = new File(SOURCE_FOLDER + "/File.txt");
+ file.createNewFile();
+ }
+
+ private void cleanFolder(File folder) {
+ File[] files = folder.listFiles();
+ if (files != null) {
+ for (File file : files) {
+ if (file.isFile()) {
+ file.delete();
+ }
+ }
+ }
+ }
+
+ @Test
+ public void routeTest() throws InterruptedException {
+ ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("camel-context-DeadLetterChannelFileRouter.xml");
+ Thread.sleep(DURATION_MILIS);
+ applicationContext.close();
+
+ }
+}
diff --git a/spring-apache-camel/src/test/java/org/apache/camel/file/processor/FileProcessorTest.java b/spring-apache-camel/src/test/java/com/apache/camel/file/processor/FileProcessorIntegrationTest.java
similarity index 96%
rename from spring-apache-camel/src/test/java/org/apache/camel/file/processor/FileProcessorTest.java
rename to spring-apache-camel/src/test/java/com/apache/camel/file/processor/FileProcessorIntegrationTest.java
index 3d63f614e0..1d88e8aeb4 100644
--- a/spring-apache-camel/src/test/java/org/apache/camel/file/processor/FileProcessorTest.java
+++ b/spring-apache-camel/src/test/java/com/apache/camel/file/processor/FileProcessorIntegrationTest.java
@@ -1,4 +1,4 @@
-package org.apache.camel.file.processor;
+package com.apache.camel.file.processor;
import java.io.File;
@@ -12,7 +12,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.baeldung.camel.file.FileProcessor;
-public class FileProcessorTest {
+public class FileProcessorIntegrationTest {
private static final long DURATION_MILIS = 10000;
private static final String SOURCE_FOLDER = "src/test/source-folder";
diff --git a/spring-apache-camel/src/test/java/com/apache/camel/file/processor/MessageTranslatorFileRouterIntegrationTest.java b/spring-apache-camel/src/test/java/com/apache/camel/file/processor/MessageTranslatorFileRouterIntegrationTest.java
new file mode 100644
index 0000000000..bcd382dd6c
--- /dev/null
+++ b/spring-apache-camel/src/test/java/com/apache/camel/file/processor/MessageTranslatorFileRouterIntegrationTest.java
@@ -0,0 +1,50 @@
+package com.apache.camel.file.processor;
+
+import java.io.File;
+
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class MessageTranslatorFileRouterIntegrationTest {
+
+ private static final long DURATION_MILIS = 10000;
+ private static final String SOURCE_FOLDER = "src/test/source-folder";
+ private static final String DESTINATION_FOLDER = "src/test/destination-folder";
+
+ @Before
+ public void setUp() throws Exception {
+ File sourceFolder = new File(SOURCE_FOLDER);
+ File destinationFolder = new File(DESTINATION_FOLDER);
+
+ cleanFolder(sourceFolder);
+ cleanFolder(destinationFolder);
+
+ sourceFolder.mkdirs();
+ File file1 = new File(SOURCE_FOLDER + "/File1.txt");
+ File file2 = new File(SOURCE_FOLDER + "/File2.txt");
+ file1.createNewFile();
+ file2.createNewFile();
+ }
+
+ private void cleanFolder(File folder) {
+ File[] files = folder.listFiles();
+ if (files != null) {
+ for (File file : files) {
+ if (file.isFile()) {
+ file.delete();
+ }
+ }
+ }
+ }
+
+ @Test
+ @Ignore
+ public void routeTest() throws InterruptedException {
+ ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("camel-context-MessageTranslatorFileRouterTest.xml");
+ Thread.sleep(DURATION_MILIS);
+ applicationContext.close();
+
+ }
+}
diff --git a/spring-apache-camel/src/test/java/com/apache/camel/file/processor/MulticastFileRouterIntegrationTest.java b/spring-apache-camel/src/test/java/com/apache/camel/file/processor/MulticastFileRouterIntegrationTest.java
new file mode 100644
index 0000000000..137480ac8e
--- /dev/null
+++ b/spring-apache-camel/src/test/java/com/apache/camel/file/processor/MulticastFileRouterIntegrationTest.java
@@ -0,0 +1,53 @@
+package com.apache.camel.file.processor;
+
+import java.io.File;
+
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class MulticastFileRouterIntegrationTest {
+
+ private static final long DURATION_MILIS = 10000;
+ private static final String SOURCE_FOLDER = "src/test/source-folder";
+ private static final String DESTINATION_FOLDER_WORLD = "src/test/destination-folder-world";
+ private static final String DESTINATION_FOLDER_HELLO = "src/test/destination-folder-hello";
+
+ @Before
+ public void setUp() throws Exception {
+ File sourceFolder = new File(SOURCE_FOLDER);
+ File destinationFolderWorld = new File(DESTINATION_FOLDER_WORLD);
+ File destinationFolderHello = new File(DESTINATION_FOLDER_HELLO);
+
+ cleanFolder(sourceFolder);
+ cleanFolder(destinationFolderWorld);
+ cleanFolder(destinationFolderHello);
+
+ sourceFolder.mkdirs();
+ File file1 = new File(SOURCE_FOLDER + "/File1.txt");
+ File file2 = new File(SOURCE_FOLDER + "/File2.txt");
+ file1.createNewFile();
+ file2.createNewFile();
+ }
+
+ private void cleanFolder(File folder) {
+ File[] files = folder.listFiles();
+ if (files != null) {
+ for (File file : files) {
+ if (file.isFile()) {
+ file.delete();
+ }
+ }
+ }
+ }
+
+ @Test
+ @Ignore
+ public void routeTest() throws InterruptedException {
+ ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("camel-context-MulticastFileRouterTest.xml");
+ Thread.sleep(DURATION_MILIS);
+ applicationContext.close();
+
+ }
+}
diff --git a/spring-apache-camel/src/test/java/com/apache/camel/file/processor/SplitterFileRouterIntegrationTest.java b/spring-apache-camel/src/test/java/com/apache/camel/file/processor/SplitterFileRouterIntegrationTest.java
new file mode 100644
index 0000000000..1991dd8d21
--- /dev/null
+++ b/spring-apache-camel/src/test/java/com/apache/camel/file/processor/SplitterFileRouterIntegrationTest.java
@@ -0,0 +1,52 @@
+package com.apache.camel.file.processor;
+
+import java.io.File;
+import java.io.FileWriter;
+
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class SplitterFileRouterIntegrationTest {
+
+ private static final long DURATION_MILIS = 10000;
+ private static final String SOURCE_FOLDER = "src/test/source-folder";
+ private static final String DESTINATION_FOLDER = "src/test/destination-folder";
+
+ @Before
+ public void setUp() throws Exception {
+ File sourceFolder = new File(SOURCE_FOLDER);
+ File destinationFolder = new File(DESTINATION_FOLDER);
+
+ cleanFolder(sourceFolder);
+ cleanFolder(destinationFolder);
+
+ sourceFolder.mkdirs();
+ File file = new File(SOURCE_FOLDER + "/File.txt");
+ FileWriter fileWriter = new FileWriter(file, false);
+ fileWriter.write("Hello\nWorld");
+ file.createNewFile();
+ fileWriter.close();
+ }
+
+ private void cleanFolder(File folder) {
+ File[] files = folder.listFiles();
+ if (files != null) {
+ for (File file : files) {
+ if (file.isFile()) {
+ file.delete();
+ }
+ }
+ }
+ }
+
+ @Test
+ @Ignore
+ public void routeTests() throws InterruptedException {
+ ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("camel-context-SplitterFileRouter.xml");
+ Thread.sleep(DURATION_MILIS);
+ applicationContext.close();
+
+ }
+}
diff --git a/spring-apache-camel/src/test/java/org/apache/camel/main/AppTest.java b/spring-apache-camel/src/test/java/com/apache/camel/main/AppIntegrationTest.java
similarity index 95%
rename from spring-apache-camel/src/test/java/org/apache/camel/main/AppTest.java
rename to spring-apache-camel/src/test/java/com/apache/camel/main/AppIntegrationTest.java
index 87b20369f3..b33e6a3b29 100644
--- a/spring-apache-camel/src/test/java/org/apache/camel/main/AppTest.java
+++ b/spring-apache-camel/src/test/java/com/apache/camel/main/AppIntegrationTest.java
@@ -1,4 +1,4 @@
-package org.apache.camel.main;
+package com.apache.camel.main;
import com.baeldung.camel.main.App;
import junit.framework.TestCase;
@@ -15,7 +15,7 @@ import java.nio.channels.FileChannel;
import java.nio.file.Files;
import java.nio.file.Paths;
-public class AppTest extends TestCase {
+public class AppIntegrationTest extends TestCase {
private static final String FILE_NAME = "file.txt";
private static final String SAMPLE_INPUT_DIR = "src/test/data/sampleInputFile/";
diff --git a/spring-autowire/pom.xml b/spring-autowire/pom.xml
index fd03c77605..391cfc018e 100644
--- a/spring-autowire/pom.xml
+++ b/spring-autowire/pom.xml
@@ -12,8 +12,9 @@
UTF-8
- 4.2.5.RELEASE
- 3.5.1
+ 4.3.4.RELEASE
+ 4.12
+ 3.6.0
2.19.1
@@ -21,7 +22,7 @@
junit
junit
- 4.11
+ ${junit.version}
org.springframework
diff --git a/spring-batch/pom.xml b/spring-batch/pom.xml
index 5538dd912f..a92a0e8323 100644
--- a/spring-batch/pom.xml
+++ b/spring-batch/pom.xml
@@ -11,9 +11,9 @@
UTF-8
- 4.2.0.RELEASE
- 3.0.5.RELEASE
- 3.8.11.2
+ 4.3.4.RELEASE
+ 3.0.7.RELEASE
+ 3.15.1
diff --git a/spring-boot/README.MD b/spring-boot/README.MD
index 1610d77e81..19203d2b8d 100644
--- a/spring-boot/README.MD
+++ b/spring-boot/README.MD
@@ -5,3 +5,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Quick Guide to @RestClientTest in Spring Boot](http://www.baeldung.com/restclienttest-in-spring-boot)
- [Intro to Spring Boot Starters](http://www.baeldung.com/spring-boot-starters)
- [A Guide to Spring in Eclipse STS](http://www.baeldung.com/eclipse-sts-spring)
+- [Introduction to WebJars](http://www.baeldung.com/maven-webjars)
diff --git a/spring-boot/pom.xml b/spring-boot/pom.xml
index a2555259b0..68a5857865 100644
--- a/spring-boot/pom.xml
+++ b/spring-boot/pom.xml
@@ -1,136 +1,128 @@
- 4.0.0
- com.baeldung
- spring-boot
- 0.0.1-SNAPSHOT
- war
- Spring Boot Actuator
- This is simple boot application for Spring boot actuator test
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ 4.0.0
+ com.baeldung
+ spring-boot
+ 0.0.1-SNAPSHOT
+ war
+ spring-boot
+ This is simple boot application for Spring boot actuator test
-
-
- org.springframework.boot
- spring-boot-starter-parent
- 1.4.0.RC1
-
-
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.4.2.RELEASE
+
+
-
-
- org.baeldung.boot.DemoApplication
- UTF-8
- 1.8
- 4.3.1.RELEASE
-
+
+
+ org.springframework.boot
+ spring-boot-starter-thymeleaf
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
-
-
- org.springframework.boot
- spring-boot-starter-thymeleaf
-
-
- org.springframework.boot
- spring-boot-starter-web
-
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+
-
- org.springframework.boot
- spring-boot-starter-data-jpa
-
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
-
- org.springframework.boot
- spring-boot-starter-actuator
-
+
+ org.springframework.boot
+ spring-boot-starter-security
+
-
- org.springframework.boot
- spring-boot-starter-security
-
+
+ io.dropwizard.metrics
+ metrics-core
+
-
- io.dropwizard.metrics
- metrics-core
-
+
+ com.h2database
+ h2
+
-
- com.h2database
- h2
-
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+ com.jayway.jsonpath
+ json-path
+ test
+
+
+ org.springframework.boot
+ spring-boot-starter-mail
+
+
+ org.subethamail
+ subethasmtp
+ ${subethasmtp.version}
+ test
+
-
- org.springframework.boot
- spring-boot-starter
-
-
- com.jayway.jsonpath
- json-path
- test
-
-
- org.springframework.boot
- spring-boot-starter-mail
-
-
- org.subethamail
- subethasmtp
- 3.1.7
- test
-
-
-
- org.webjars
- bootstrap
- 3.3.7-1
-
-
- org.webjars
- jquery
- 3.1.1
-
-
+
+ org.webjars
+ bootstrap
+ ${bootstrap.version}
+
+
+ org.webjars
+ jquery
+ ${jquery.version}
+
+
-
- spring-boot
-
-
- src/main/resources
- true
-
-
+
+ spring-boot
+
+
+ src/main/resources
+ true
+
+
-
+
-
- org.springframework.boot
- spring-boot-maven-plugin
-
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- 1.8
- 1.8
-
-
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ 1.8
+ 1.8
+
+
-
- org.apache.maven.plugins
- maven-war-plugin
-
+
+ org.apache.maven.plugins
+ maven-war-plugin
+
pl.project13.maven
git-commit-id-plugin
- 2.2.1
+ ${git-commit-id-plugin.version}
@@ -143,10 +135,10 @@
-
+
-
+
@@ -182,42 +174,18 @@
-
-
-
- spring-snapshots
- Spring Snapshots
- https://repo.spring.io/snapshot
-
- true
-
-
-
- spring-milestones
- Spring Milestones
- https://repo.spring.io/milestone
-
- false
-
-
-
-
-
- spring-snapshots
- Spring Snapshots
- https://repo.spring.io/snapshot
-
- true
-
-
-
- spring-milestones
- Spring Milestones
- https://repo.spring.io/milestone
-
- false
-
-
-
+
+
+
+
+ org.baeldung.boot.DemoApplication
+ UTF-8
+ 1.8
+ 4.3.4.RELEASE
+ 2.2.1
+ 3.1.1
+ 3.3.7-1
+ 3.1.7
+
diff --git a/spring-cloud-data-flow/batch-job/pom.xml b/spring-cloud-data-flow/batch-job/pom.xml
index 99e57d4c20..3d05732027 100644
--- a/spring-cloud-data-flow/batch-job/pom.xml
+++ b/spring-cloud-data-flow/batch-job/pom.xml
@@ -14,7 +14,7 @@
org.springframework.boot
spring-boot-starter-parent
- 1.4.0.RELEASE
+ 1.4.2.RELEASE
@@ -22,13 +22,14 @@
UTF-8
UTF-8
1.8
+ 1.0.3.RELEASE
org.springframework.cloud
spring-cloud-task-starter
- 1.0.1.RELEASE
+ ${spring-cloud-task-starter.version}
diff --git a/spring-cloud-data-flow/data-flow-server/pom.xml b/spring-cloud-data-flow/data-flow-server/pom.xml
index 451a58e12a..b1f920c94e 100644
--- a/spring-cloud-data-flow/data-flow-server/pom.xml
+++ b/spring-cloud-data-flow/data-flow-server/pom.xml
@@ -1,68 +1,70 @@
- 4.0.0
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ 4.0.0
- org.baeldung.spring.cloud
- data-flow-server
- 0.0.1-SNAPSHOT
- jar
+ org.baeldung.spring.cloud
+ data-flow-server
+ 0.0.1-SNAPSHOT
+ jar
- data-flow-server
- Demo project for Spring Boot
+ data-flow-server
+ Demo project for Spring Boot
-
- org.springframework.boot
- spring-boot-starter-parent
- 1.4.0.RELEASE
-
-
-
-
- UTF-8
- UTF-8
- 1.8
-
-
-
-
- org.springframework.cloud
- spring-cloud-starter-dataflow-server-local
-
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
-
-
-
- org.springframework.cloud
- spring-cloud-dataflow-dependencies
- 1.0.0.BUILD-SNAPSHOT
- pom
- import
-
-
- org.springframework.cloud
- spring-cloud-dependencies
- Brixton.SR5
- pom
- import
-
-
-
-
-
-
-
+
org.springframework.boot
- spring-boot-maven-plugin
-
-
+ spring-boot-starter-parent
+ 1.4.2.RELEASE
+
+
+
+
+ UTF-8
+ UTF-8
+ 1.8
+ 1.1.0.RELEASE
+ Brixton.SR7
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-dataflow-server-local
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-dataflow-dependencies
+ ${spring-cloud-dataflow-dependencies.version}
+ pom
+ import
+
+
+ org.springframework.cloud
+ spring-cloud-dependencies
+ ${spring-cloud-dependencies.version}
+ pom
+ import
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
org.apache.maven.plugins
maven-surefire-plugin
@@ -110,23 +112,4 @@
-
-
- spring-snapshots
- Spring Snapshots
- https://repo.spring.io/snapshot
-
- true
-
-
-
- spring-milestones
- Spring Milestones
- https://repo.spring.io/milestone
-
- false
-
-
-
-
diff --git a/spring-cloud-data-flow/data-flow-shell/pom.xml b/spring-cloud-data-flow/data-flow-shell/pom.xml
index 31d3dce507..55fa995052 100644
--- a/spring-cloud-data-flow/data-flow-shell/pom.xml
+++ b/spring-cloud-data-flow/data-flow-shell/pom.xml
@@ -1,67 +1,69 @@
- 4.0.0
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ 4.0.0
- org.baeldung.spring.cloud
- data-flow-shell
- 0.0.1-SNAPSHOT
- jar
+ org.baeldung.spring.cloud
+ data-flow-shell
+ 0.0.1-SNAPSHOT
+ jar
- data-flow-shell
- Demo project for Spring Boot
+ data-flow-shell
+ Demo project for Spring Boot
-
- org.springframework.boot
- spring-boot-starter-parent
- 1.4.0.RELEASE
-
-
-
-
- UTF-8
- UTF-8
- 1.8
-
-
-
-
- org.springframework.cloud
- spring-cloud-dataflow-shell
-
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
-
-
-
- org.springframework.cloud
- spring-cloud-dataflow-dependencies
- 1.0.0.BUILD-SNAPSHOT
- pom
- import
-
-
- org.springframework.cloud
- spring-cloud-dependencies
- Brixton.SR5
- pom
- import
-
-
-
-
-
-
-
+
org.springframework.boot
- spring-boot-maven-plugin
-
+ spring-boot-starter-parent
+ 1.4.2.RELEASE
+
+
+
+
+ UTF-8
+ UTF-8
+ 1.8
+ Brixton.SR7
+ 1.1.0.RELEASE
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-dataflow-shell
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-dataflow-dependencies
+ ${spring-cloud-dataflow-dependencies.version}
+ pom
+ import
+
+
+ org.springframework.cloud
+ spring-cloud-dependencies
+ ${spring-cloud-dependencies.version}
+ pom
+ import
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
org.apache.maven.plugins
maven-surefire-plugin
@@ -75,23 +77,4 @@
-
-
- spring-snapshots
- Spring Snapshots
- https://repo.spring.io/snapshot
-
- true
-
-
-
- spring-milestones
- Spring Milestones
- https://repo.spring.io/milestone
-
- false
-
-
-
-
diff --git a/spring-cloud-data-flow/log-sink/pom.xml b/spring-cloud-data-flow/log-sink/pom.xml
index db488c05ef..6443ed88c8 100644
--- a/spring-cloud-data-flow/log-sink/pom.xml
+++ b/spring-cloud-data-flow/log-sink/pom.xml
@@ -14,7 +14,7 @@
org.springframework.boot
spring-boot-starter-parent
- 1.4.0.RELEASE
+ 1.4.2.RELEASE
@@ -22,6 +22,7 @@
UTF-8
UTF-8
1.8
+ Brixton.SR7
@@ -42,7 +43,7 @@
org.springframework.cloud
spring-cloud-dependencies
- Brixton.SR5
+ ${spring-cloud-dependencies.version}
pom
import
diff --git a/spring-cloud-data-flow/pom.xml b/spring-cloud-data-flow/pom.xml
index 509c185d61..520ff63d49 100644
--- a/spring-cloud-data-flow/pom.xml
+++ b/spring-cloud-data-flow/pom.xml
@@ -1,15 +1,18 @@
-
- 4.0.0
- org.baeldung.spring.cloud
- spring-cloud-data-flow
- 0.0.1-SNAPSHOT
- pom
-
- data-flow-server
- data-flow-shell
- time-source
- time-processor
- log-sink
- batch-job
-
+
+ 4.0.0
+ org.baeldung.spring.cloud
+ spring-cloud-data-flow
+ 0.0.1-SNAPSHOT
+ pom
+
+
+ data-flow-server
+
+ time-source
+ time-processor
+ log-sink
+ batch-job
+
+
diff --git a/spring-cloud-data-flow/time-processor/pom.xml b/spring-cloud-data-flow/time-processor/pom.xml
index 8277c9c836..d7553b110f 100644
--- a/spring-cloud-data-flow/time-processor/pom.xml
+++ b/spring-cloud-data-flow/time-processor/pom.xml
@@ -14,7 +14,7 @@
org.springframework.boot
spring-boot-starter-parent
- 1.4.0.RELEASE
+ 1.4.2.RELEASE
@@ -22,6 +22,7 @@
UTF-8
UTF-8
1.8
+ Brixton.SR7
@@ -42,7 +43,7 @@
org.springframework.cloud
spring-cloud-dependencies
- Brixton.SR5
+ ${spring-cloud-dependencies.version}
pom
import
diff --git a/spring-cloud-data-flow/time-source/pom.xml b/spring-cloud-data-flow/time-source/pom.xml
index 086d761f78..2523dfabea 100644
--- a/spring-cloud-data-flow/time-source/pom.xml
+++ b/spring-cloud-data-flow/time-source/pom.xml
@@ -14,7 +14,7 @@
org.springframework.boot
spring-boot-starter-parent
- 1.4.0.RELEASE
+ 1.4.2.RELEASE
@@ -22,6 +22,7 @@
UTF-8
UTF-8
1.8
+ Brixton.SR7
@@ -42,7 +43,7 @@
org.springframework.cloud
spring-cloud-dependencies
- Brixton.SR5
+ ${spring-cloud-dependencies.version}
pom
import
diff --git a/spring-cloud/README.md b/spring-cloud/README.md
index 60acdaeed5..2ffb3a86d0 100644
--- a/spring-cloud/README.md
+++ b/spring-cloud/README.md
@@ -16,4 +16,5 @@
- [Dockerizing a Spring Boot Application](http://www.baeldung.com/dockerizing-spring-boot-application)
- [Introduction to Spring Cloud Rest Client with Netflix Ribbon](http://www.baeldung.com/spring-cloud-rest-client-with-netflix-ribbon)
-
+### Relevant Articles:
+- [Introduction to Spring Cloud Rest Client with Netflix Ribbon](http://www.baeldung.com/spring-cloud-rest-client-with-netflix-ribbon)
diff --git a/spring-cloud/pom.xml b/spring-cloud/pom.xml
index 455a5b876b..299115634e 100644
--- a/spring-cloud/pom.xml
+++ b/spring-cloud/pom.xml
@@ -26,6 +26,16 @@
UTF-8
+ 1.2.2.RELEASE
+ Brixton.SR7
+ 1.2.2.RELEASE
+ 1.2.2.RELEASE
+ 1.2.3.RELEASE
+ 1.2.3.RELEASE
+ 1.2.3.RELEASE
+ 1.4.2.RELEASE
+ 3.6.0
+ 1.4.2.RELEASE
@@ -34,7 +44,7 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.5.1
+ ${maven-compiler-plugin.version}
1.8
1.8
@@ -43,7 +53,7 @@
org.springframework.boot
spring-boot-maven-plugin
- 1.4.0.RELEASE
+ ${spring-boot-maven-plugin.version}
diff --git a/spring-cloud/spring-cloud-bootstrap/README.MD b/spring-cloud/spring-cloud-bootstrap/README.MD
index c16ba3e247..d6f8faf31e 100644
--- a/spring-cloud/spring-cloud-bootstrap/README.MD
+++ b/spring-cloud/spring-cloud-bootstrap/README.MD
@@ -1,2 +1,3 @@
### Relevant Articles:
- [Spring Cloud – Bootstrapping](http://www.baeldung.com/spring-cloud-bootstrapping)
+- [Spring Cloud – Securing Services](http://www.baeldung.com/spring-cloud-securing-services)
diff --git a/spring-cloud/spring-cloud-bootstrap/config/pom.xml b/spring-cloud/spring-cloud-bootstrap/config/pom.xml
index bcb40ac062..24d054a87b 100644
--- a/spring-cloud/spring-cloud-bootstrap/config/pom.xml
+++ b/spring-cloud/spring-cloud-bootstrap/config/pom.xml
@@ -10,7 +10,7 @@
org.springframework.boot
spring-boot-starter-parent
- 1.4.0.RELEASE
+ 1.4.2.RELEASE
@@ -39,7 +39,7 @@
org.springframework.cloud
spring-cloud-dependencies
- Brixton.RELEASE
+ ${spring-cloud-dependencies.version}
pom
import
@@ -55,7 +55,7 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.3
+ ${maven-compiler-plugin.version}
1.8
1.8
@@ -64,4 +64,8 @@
+
+ Brixton.SR7
+ 3.6.0
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-bootstrap/config/src/main/java/com/baeldung/spring/cloud/bootstrap/config/ConfigApplication.java b/spring-cloud/spring-cloud-bootstrap/config/src/main/java/com/baeldung/spring/cloud/bootstrap/config/ConfigApplication.java
index 847c86f881..c51819dfe5 100644
--- a/spring-cloud/spring-cloud-bootstrap/config/src/main/java/com/baeldung/spring/cloud/bootstrap/config/ConfigApplication.java
+++ b/spring-cloud/spring-cloud-bootstrap/config/src/main/java/com/baeldung/spring/cloud/bootstrap/config/ConfigApplication.java
@@ -9,7 +9,7 @@ import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
@EnableConfigServer
@EnableEurekaClient
public class ConfigApplication {
- public static void main(String[] args) {
- SpringApplication.run(ConfigApplication.class, args);
- }
+ public static void main(String[] args) {
+ SpringApplication.run(ConfigApplication.class, args);
+ }
}
diff --git a/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml b/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml
index f3cb3be2af..be3bfbb0be 100644
--- a/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml
+++ b/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml
@@ -10,7 +10,7 @@
org.springframework.boot
spring-boot-starter-parent
- 1.4.0.RELEASE
+ 1.4.2.RELEASE
@@ -36,7 +36,6 @@
org.springframework.session
spring-session
- 1.2.1.RELEASE
org.springframework.boot
@@ -49,7 +48,7 @@
org.springframework.cloud
spring-cloud-dependencies
- Brixton.RELEASE
+ ${spring-cloud-dependencies.version}
pom
import
@@ -65,7 +64,7 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.3
+ ${maven-compiler-plugin.version}
1.8
1.8
@@ -73,4 +72,9 @@
+
+
+ Brixton.SR7
+ 3.6.0
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-bootstrap/discovery/src/main/java/com/baeldung/spring/cloud/bootstrap/discovery/DiscoveryApplication.java b/spring-cloud/spring-cloud-bootstrap/discovery/src/main/java/com/baeldung/spring/cloud/bootstrap/discovery/DiscoveryApplication.java
index 32bcdc90b6..4ac445b083 100644
--- a/spring-cloud/spring-cloud-bootstrap/discovery/src/main/java/com/baeldung/spring/cloud/bootstrap/discovery/DiscoveryApplication.java
+++ b/spring-cloud/spring-cloud-bootstrap/discovery/src/main/java/com/baeldung/spring/cloud/bootstrap/discovery/DiscoveryApplication.java
@@ -7,7 +7,7 @@ import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer
public class DiscoveryApplication {
- public static void main(String[] args) {
- SpringApplication.run(DiscoveryApplication.class, args);
- }
+ public static void main(String[] args) {
+ SpringApplication.run(DiscoveryApplication.class, args);
+ }
}
diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml b/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml
index add551ff95..9186f12226 100644
--- a/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml
+++ b/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml
@@ -10,7 +10,7 @@
org.springframework.boot
spring-boot-starter-parent
- 1.4.0.RELEASE
+ 1.4.2.RELEASE
@@ -35,7 +35,6 @@
org.springframework.session
spring-session
- 1.2.1.RELEASE
org.springframework.boot
@@ -54,7 +53,7 @@
org.springframework.cloud
spring-cloud-dependencies
- Brixton.RELEASE
+ ${spring-cloud-dependencies.version}
pom
import
@@ -70,12 +69,26 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.3
+ ${maven-compiler-plugin.version}
1.8
1.8
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ **/*LiveTest.java
+
+
+
+
+
+ Brixton.SR7
+ 3.6.0
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/java/com/baeldung/spring/cloud/bootstrap/gateway/GatewayApplication.java b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/java/com/baeldung/spring/cloud/bootstrap/gateway/GatewayApplication.java
index a3d2df5357..b5ae1e4e7b 100644
--- a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/java/com/baeldung/spring/cloud/bootstrap/gateway/GatewayApplication.java
+++ b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/java/com/baeldung/spring/cloud/bootstrap/gateway/GatewayApplication.java
@@ -18,23 +18,23 @@ import java.util.List;
@EnableZuulProxy
@EnableEurekaClient
public class GatewayApplication {
- public static void main(String[] args) {
- SpringApplication.run(GatewayApplication.class, args);
- }
+ public static void main(String[] args) {
+ SpringApplication.run(GatewayApplication.class, args);
+ }
- @Autowired(required = false)
- private List configurations = new ArrayList<>();
+ @Autowired(required = false)
+ private List configurations = new ArrayList<>();
- @Bean
- @LoadBalanced RestTemplate restTemplate(){
- return new RestTemplate();
- }
+ @Bean
+ @LoadBalanced
+ RestTemplate restTemplate() {
+ return new RestTemplate();
+ }
-
- @Bean
- public SpringClientFactory springClientFactory() {
- SpringClientFactory factory = new SpringClientFactory();
- factory.setConfigurations(this.configurations);
- return factory;
- }
+ @Bean
+ public SpringClientFactory springClientFactory() {
+ SpringClientFactory factory = new SpringClientFactory();
+ factory.setConfigurations(this.configurations);
+ return factory;
+ }
}
diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/java/com/baeldung/spring/cloud/bootstrap/gateway/filter/SessionSavingZuulPreFilter.java b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/java/com/baeldung/spring/cloud/bootstrap/gateway/filter/SessionSavingZuulPreFilter.java
index 9a2b5bab74..1c90ba2e12 100644
--- a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/java/com/baeldung/spring/cloud/bootstrap/gateway/filter/SessionSavingZuulPreFilter.java
+++ b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/java/com/baeldung/spring/cloud/bootstrap/gateway/filter/SessionSavingZuulPreFilter.java
@@ -14,34 +14,34 @@ import javax.servlet.http.HttpSession;
@Component
public class SessionSavingZuulPreFilter extends ZuulFilter {
- private Logger log = LoggerFactory.getLogger(this.getClass());
+ private Logger log = LoggerFactory.getLogger(this.getClass());
- @Autowired
- private SessionRepository repository;
+ @Autowired
+ private SessionRepository repository;
- @Override public boolean shouldFilter() {
- return true;
- }
+ @Override
+ public boolean shouldFilter() {
+ return true;
+ }
- @Override
- public Object run() {
- RequestContext context = RequestContext.getCurrentContext();
+ @Override
+ public Object run() {
+ RequestContext context = RequestContext.getCurrentContext();
+ HttpSession httpSession = context.getRequest().getSession();
+ Session session = repository.getSession(httpSession.getId());
- HttpSession httpSession = context.getRequest().getSession();
- Session session = repository.getSession(httpSession.getId());
+ context.addZuulRequestHeader("Cookie", "SESSION=" + httpSession.getId());
+ log.info("ZuulPreFilter session proxy: {}", session.getId());
+ return null;
+ }
- context.addZuulRequestHeader("Cookie", "SESSION=" + httpSession.getId());
+ @Override
+ public String filterType() {
+ return "pre";
+ }
- log.info("ZuulPreFilter session proxy: {}", session.getId());
-
- return null;
- }
-
- @Override public String filterType() {
- return "pre";
- }
-
- @Override public int filterOrder() {
- return 0;
- }
+ @Override
+ public int filterOrder() {
+ return 0;
+ }
}
diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/test/java/com/baeldung/spring/cloud/bootstrap/gateway/GatewayApplicationLiveTest.java b/spring-cloud/spring-cloud-bootstrap/gateway/src/test/java/com/baeldung/spring/cloud/bootstrap/gateway/GatewayApplicationLiveTest.java
new file mode 100644
index 0000000000..cea431d461
--- /dev/null
+++ b/spring-cloud/spring-cloud-bootstrap/gateway/src/test/java/com/baeldung/spring/cloud/bootstrap/gateway/GatewayApplicationLiveTest.java
@@ -0,0 +1,69 @@
+package com.baeldung.spring.cloud.bootstrap.gateway;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.http.*;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+
+public class GatewayApplicationLiveTest {
+
+ @Test
+ public void testAccess() throws Exception {
+ TestRestTemplate testRestTemplate = new TestRestTemplate();
+ String testUrl = "http://localhost:8080";
+
+ ResponseEntity response = testRestTemplate.getForEntity(testUrl + "/resource/hello/cloud", String.class);
+ Assert.assertEquals(HttpStatus.OK, response.getStatusCode());
+ Assert.assertEquals("hello cloud", response.getBody());
+
+ //try the protected resource and confirm the redirect to login
+ response = testRestTemplate.getForEntity(testUrl + "/resource/hello/user", String.class);
+ Assert.assertEquals(HttpStatus.FOUND, response.getStatusCode());
+ Assert.assertEquals("http://localhost:8080/login", response.getHeaders().get("Location").get(0));
+
+ //login as user/password
+ MultiValueMap form = new LinkedMultiValueMap<>();
+ form.add("username", "user");
+ form.add("password", "password");
+ response = testRestTemplate.postForEntity(testUrl + "/login", form, String.class);
+
+ //extract the session from the cookie and propagate it to the next request
+ String sessionCookie = response.getHeaders().get("Set-Cookie").get(0).split(";")[0];
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("Cookie", sessionCookie);
+ HttpEntity httpEntity = new HttpEntity<>(headers);
+
+ //request the protected resource
+ response = testRestTemplate.exchange(testUrl + "/resource/hello/user", HttpMethod.GET, httpEntity, String.class);
+ Assert.assertEquals(HttpStatus.OK, response.getStatusCode());
+ Assert.assertEquals("hello cloud user", response.getBody());
+
+ //request the admin protected resource to determine it is still protected
+ response = testRestTemplate.exchange(testUrl + "/resource/hello/admin", HttpMethod.GET, httpEntity, String.class);
+ Assert.assertEquals(HttpStatus.FORBIDDEN, response.getStatusCode());
+
+ //login as the admin
+ form.clear();
+ form.add("username", "admin");
+ form.add("password", "admin");
+ response = testRestTemplate.postForEntity(testUrl + "/login", form, String.class);
+
+ //extract the session from the cookie and propagate it to the next request
+ sessionCookie = response.getHeaders().get("Set-Cookie").get(0).split(";")[0];
+ headers = new HttpHeaders();
+ headers.add("Cookie", sessionCookie);
+ httpEntity = new HttpEntity<>(headers);
+
+ //request the protected resource
+ response = testRestTemplate.exchange(testUrl + "/resource/hello/admin", HttpMethod.GET, httpEntity, String.class);
+ Assert.assertEquals(HttpStatus.OK, response.getStatusCode());
+ Assert.assertEquals("hello cloud admin", response.getBody());
+
+ //request the discovery resources as the admin
+ response = testRestTemplate.exchange(testUrl + "/discovery", HttpMethod.GET, httpEntity, String.class);
+ Assert.assertEquals(HttpStatus.OK, response.getStatusCode());
+ }
+
+}
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-bootstrap/pom.xml b/spring-cloud/spring-cloud-bootstrap/pom.xml
index c14c277d7f..9a1b2e6d0e 100644
--- a/spring-cloud/spring-cloud-bootstrap/pom.xml
+++ b/spring-cloud/spring-cloud-bootstrap/pom.xml
@@ -18,7 +18,7 @@
- spring-cloud-integration
+ spring-cloud-bootstrap
1.0.0-SNAPSHOT
pom
diff --git a/spring-cloud/spring-cloud-bootstrap/resource/pom.xml b/spring-cloud/spring-cloud-bootstrap/resource/pom.xml
index 8940ca71da..1472693de8 100644
--- a/spring-cloud/spring-cloud-bootstrap/resource/pom.xml
+++ b/spring-cloud/spring-cloud-bootstrap/resource/pom.xml
@@ -10,7 +10,7 @@
org.springframework.boot
spring-boot-starter-parent
- 1.4.0.RELEASE
+ 1.4.2.RELEASE
@@ -35,7 +35,6 @@
org.springframework.session
spring-session
- 1.2.1.RELEASE
org.springframework.boot
@@ -54,7 +53,7 @@
org.springframework.cloud
spring-cloud-dependencies
- Brixton.RELEASE
+ ${spring-cloud-dependencies.version}
pom
import
@@ -70,7 +69,7 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.3
+ ${maven-compiler-plugin.version}
1.8
1.8
@@ -78,4 +77,8 @@
+
+ Brixton.SR7
+ 3.6.0
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-bootstrap/resource/src/main/java/com/baeldung/spring/cloud/bootstrap/resource/ResourceApplication.java b/spring-cloud/spring-cloud-bootstrap/resource/src/main/java/com/baeldung/spring/cloud/bootstrap/resource/ResourceApplication.java
index e12d43f46b..accef18a14 100644
--- a/spring-cloud/spring-cloud-bootstrap/resource/src/main/java/com/baeldung/spring/cloud/bootstrap/resource/ResourceApplication.java
+++ b/spring-cloud/spring-cloud-bootstrap/resource/src/main/java/com/baeldung/spring/cloud/bootstrap/resource/ResourceApplication.java
@@ -11,31 +11,31 @@ import org.springframework.web.bind.annotation.RestController;
@EnableEurekaClient
@RestController
public class ResourceApplication {
- public static void main(String[] args) {
- SpringApplication.run(ResourceApplication.class, args);
- }
+ public static void main(String[] args) {
+ SpringApplication.run(ResourceApplication.class, args);
+ }
- @Value("${resource.returnString}")
- private String returnString;
+ @Value("${resource.returnString}")
+ private String returnString;
- @Value("${resource.user.returnString}")
- private String userReturnString;
+ @Value("${resource.user.returnString}")
+ private String userReturnString;
- @Value("${resource.admin.returnString}")
- private String adminReturnString;
+ @Value("${resource.admin.returnString}")
+ private String adminReturnString;
- @RequestMapping("/hello/cloud")
- public String getString() {
- return returnString;
- }
+ @RequestMapping("/hello/cloud")
+ public String getString() {
+ return returnString;
+ }
- @RequestMapping("/hello/user")
- public String getUserString() {
- return userReturnString;
- }
+ @RequestMapping("/hello/user")
+ public String getUserString() {
+ return userReturnString;
+ }
- @RequestMapping("/hello/admin")
- public String getAdminString() {
- return adminReturnString;
- }
+ @RequestMapping("/hello/admin")
+ public String getAdminString() {
+ return adminReturnString;
+ }
}
diff --git a/spring-cloud/spring-cloud-config/client/pom.xml b/spring-cloud/spring-cloud-config/client/pom.xml
index 2c4b748e8a..24da043515 100644
--- a/spring-cloud/spring-cloud-config/client/pom.xml
+++ b/spring-cloud/spring-cloud-config/client/pom.xml
@@ -14,7 +14,7 @@
org.springframework.cloud
spring-cloud-starter-config
- 1.2.0.RELEASE
+ ${spring-cloud-starter-config.version}
org.springframework.boot
@@ -38,4 +38,9 @@