diff --git a/annotations/readme.md b/annotations/readme.md
index 8b13789179..2b052803e6 100644
--- a/annotations/readme.md
+++ b/annotations/readme.md
@@ -1 +1,2 @@
-
+### Relevant Articles:
+- [Java Annotation Processing and Creating a Builder](http://www.baeldung.com/java-annotation-processing-builder)
diff --git a/apache-cxf/cxf-introduction/README.md b/apache-cxf/cxf-introduction/README.md
new file mode 100644
index 0000000000..9a076524b7
--- /dev/null
+++ b/apache-cxf/cxf-introduction/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Introduction to Apache CXF](http://www.baeldung.com/introduction-to-apache-cxf)
diff --git a/assertj/README.md b/assertj/README.md
new file mode 100644
index 0000000000..86eff05057
--- /dev/null
+++ b/assertj/README.md
@@ -0,0 +1,3 @@
+### Relevant Articles:
+- [AssertJ’s Java 8 Features](http://www.baeldung.com/assertJ-java-8-features)
+- [AssertJ for Guava](http://www.baeldung.com/assertJ-for-guava)
diff --git a/autovalue-tutorial/README.md b/autovalue-tutorial/README.md
new file mode 100644
index 0000000000..2385e82847
--- /dev/null
+++ b/autovalue-tutorial/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Introduction to AutoValue](http://www.baeldung.com/introduction-to-autovalue)
diff --git a/cdi/README.md b/cdi/README.md
new file mode 100644
index 0000000000..a27c35772a
--- /dev/null
+++ b/cdi/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [CDI Interceptor vs Spring AspectJ](http://www.baeldung.com/cdi-interceptor-vs-spring-aspectj)
diff --git a/core-java-8/src/main/java/com/baeldung/datetime/README.md b/core-java-8/src/main/java/com/baeldung/datetime/README.md
new file mode 100644
index 0000000000..1e4adbb612
--- /dev/null
+++ b/core-java-8/src/main/java/com/baeldung/datetime/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Introduction to the Java 8 Date/Time API](http://www.baeldung.com/java-8-date-time-intro)
diff --git a/core-java-8/src/main/java/com/baeldung/enums/README.md b/core-java-8/src/main/java/com/baeldung/enums/README.md
new file mode 100644
index 0000000000..6ccfa725f5
--- /dev/null
+++ b/core-java-8/src/main/java/com/baeldung/enums/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [A Guide to Java Enums](http://www.baeldung.com/a-guide-to-java-enums)
diff --git a/core-java-9/src/test/java/com/baeldung/java9/README.MD b/core-java-9/src/test/java/com/baeldung/java9/README.MD
index 8b13789179..2f44a2336b 100644
--- a/core-java-9/src/test/java/com/baeldung/java9/README.MD
+++ b/core-java-9/src/test/java/com/baeldung/java9/README.MD
@@ -1 +1,2 @@
-
+### Relevant Artiles:
+- [Filtering a Stream of Optionals in Java](http://www.baeldung.com/java-filter-stream-of-optional)
diff --git a/core-java/README.md b/core-java/README.md
index 23fe12465f..440af67252 100644
--- a/core-java/README.md
+++ b/core-java/README.md
@@ -13,3 +13,8 @@
- [Java – Write to File](http://www.baeldung.com/java-write-to-file)
- [Java Scanner](http://www.baeldung.com/java-scanner)
- [Java Timer](http://www.baeldung.com/java-timer-and-timertask)
+- [Java – Byte Array to Writer](http://www.baeldung.com/java-convert-byte-array-to-writer)
+- [How to Run a Shell Command in Java](http://www.baeldung.com/run-shell-command-in-java)
+- [MD5 Hashing in Java](http://www.baeldung.com/java-md5)
+- [Guide to the Java ArrayList](http://www.baeldung.com/java-arraylist)
+- [Guide to Java Reflection](http://www.baeldung.com/java-reflection)
diff --git a/core-java/pom.xml b/core-java/pom.xml
index a5e89d2a76..75608b59ba 100644
--- a/core-java/pom.xml
+++ b/core-java/pom.xml
@@ -1,211 +1,321 @@
-
- 4.0.0
- com.baeldung
- core-java
- 0.1.0-SNAPSHOT
+
+ 4.0.0
+ com.baeldung
+ core-java
+ 0.1.0-SNAPSHOT
+ jar
- core-java
+ core-java
-
+
-
-
- net.sourceforge.collections
- collections-generic
- 4.01
-
-
- com.google.guava
- guava
- ${guava.version}
-
+
+
+ net.sourceforge.collections
+ collections-generic
+ 4.01
+
+
+ com.google.guava
+ guava
+ ${guava.version}
+
-
- org.apache.commons
- commons-collections4
- 4.0
-
+
+ org.apache.commons
+ commons-collections4
+ 4.0
+
-
- commons-io
- commons-io
- 2.4
-
+
+ commons-io
+ commons-io
+ 2.4
+
-
- org.apache.commons
- commons-lang3
- ${commons-lang3.version}
-
+
+ org.apache.commons
+ commons-lang3
+ ${commons-lang3.version}
+
-
- org.apache.commons
- commons-math3
- 3.3
-
+
+ org.apache.commons
+ commons-math3
+ 3.3
+
-
+
-
+
-
- com.fasterxml.jackson.core
- jackson-databind
- ${jackson.version}
-
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ ${jackson.version}
+
-
+
-
- org.slf4j
- slf4j-api
- ${org.slf4j.version}
-
-
- ch.qos.logback
- logback-classic
- ${logback.version}
-
-
-
- org.slf4j
- jcl-over-slf4j
- ${org.slf4j.version}
-
-
-
- org.slf4j
- log4j-over-slf4j
- ${org.slf4j.version}
-
+
+ org.slf4j
+ slf4j-api
+ ${org.slf4j.version}
+
+
+ ch.qos.logback
+ logback-classic
+ ${logback.version}
+
+
+
+ org.slf4j
+ jcl-over-slf4j
+ ${org.slf4j.version}
+
+
+
+ org.slf4j
+ log4j-over-slf4j
+ ${org.slf4j.version}
+
-
+
-
- junit
- junit
- ${junit.version}
- test
-
+
+ junit
+ junit
+ ${junit.version}
+ test
+
-
- org.hamcrest
- hamcrest-core
- ${org.hamcrest.version}
- test
-
-
- org.hamcrest
- hamcrest-library
- ${org.hamcrest.version}
- test
-
+
+ org.hamcrest
+ hamcrest-core
+ ${org.hamcrest.version}
+ test
+
+
+ org.hamcrest
+ hamcrest-library
+ ${org.hamcrest.version}
+ test
+
-
- org.assertj
- assertj-core
- ${assertj.version}
- test
-
+
+ org.assertj
+ assertj-core
+ ${assertj.version}
+ test
+
-
- org.testng
- testng
- ${testng.version}
- test
-
+
+ org.testng
+ testng
+ ${testng.version}
+ test
+
-
- org.mockito
- mockito-core
- ${mockito.version}
- test
-
-
-
- commons-codec
- commons-codec
- 1.10
-
+
+ org.mockito
+ mockito-core
+ ${mockito.version}
+ test
+
-
+
+ commons-codec
+ commons-codec
+ 1.10
+
-
- core-java
-
-
- src/main/resources
- true
-
-
+
-
+
+ core-java
+
+
+ src/main/resources
+ true
+
+
-
- org.apache.maven.plugins
- maven-compiler-plugin
- ${maven-compiler-plugin.version}
-
- 1.8
- 1.8
-
-
+
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire-plugin.version}
-
-
- **/*IntegrationTest.java
-
-
-
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ ${maven-compiler-plugin.version}
+
+ 1.8
+ 1.8
+
+
-
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ ${maven-surefire-plugin.version}
+
+
+ **/*IntegrationTest.java
+
+
+
-
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+ copy-dependencies
+ prepare-package
+
+ copy-dependencies
+
+
+ ${project.build.directory}/libs
+
+
+
+
-
-
- 4.3.11.Final
- 5.1.38
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+
+ true
+ libs/
+ org.baeldung.executable.ExecutableMavenJar
+
+
+
+
-
- 2.7.8
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+
+
+ package
+
+ single
+
+
+
+
+ org.baeldung.executable.ExecutableMavenJar
+
+
+
+ jar-with-dependencies
+
+
+
+
+
-
- 1.7.13
- 1.1.3
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+
+
+
+ shade
+
+
+ true
+
+
+ org.baeldung.executable.ExecutableMavenJar
+
+
+
+
+
+
-
- 5.1.3.Final
+
+ com.jolira
+ onejar-maven-plugin
+
+
+
+ org.baeldung.executable.ExecutableMavenJar
+ true
+ ${project.build.finalName}-onejar.${project.packaging}
+
+
+ one-jar
+
+
+
+
-
- 19.0
- 3.4
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ repackage
+
+
+ spring-boot
+ org.baeldung.executable.ExecutableMavenJar
+
+
+
+
+
+
-
- 1.3
- 4.12
- 1.10.19
- 6.8
- 3.5.1
+
- 4.4.1
- 4.5
+
+
+ 4.3.11.Final
+ 5.1.38
- 2.9.0
+
+ 2.7.8
-
- 3.5.1
- 2.6
- 2.19.1
- 2.7
- 1.4.18
+
+ 1.7.13
+ 1.1.3
-
+
+ 5.1.3.Final
+
+
+ 19.0
+ 3.4
+
+
+ 1.3
+ 4.12
+ 1.10.19
+ 6.8
+ 3.5.1
+
+ 4.4.1
+ 4.5
+
+ 2.9.0
+
+
+ 3.5.1
+ 2.6
+ 2.19.1
+ 2.7
+ 1.4.18
+
+
\ No newline at end of file
diff --git a/core-java/src/main/java/org/baeldung/executable/ExecutableMavenJar.java b/core-java/src/main/java/org/baeldung/executable/ExecutableMavenJar.java
new file mode 100644
index 0000000000..2c52a17904
--- /dev/null
+++ b/core-java/src/main/java/org/baeldung/executable/ExecutableMavenJar.java
@@ -0,0 +1,11 @@
+package org.baeldung.executable;
+
+import javax.swing.JOptionPane;
+
+public class ExecutableMavenJar {
+
+ public static void main(String[] args) {
+ JOptionPane.showMessageDialog(null, "It worked!", "Executable Jar with Maven", 1);
+ }
+
+}
diff --git a/core-java/src/test/java/org/baeldung/java/lists/README.md b/core-java/src/test/java/org/baeldung/java/lists/README.md
new file mode 100644
index 0000000000..2a1e8aeeaa
--- /dev/null
+++ b/core-java/src/test/java/org/baeldung/java/lists/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Check If Two Lists are Equal in Java](http://www.baeldung.com/java-test-a-list-for-ordinality-and-equality)
diff --git a/dependency-injection/README.md b/dependency-injection/README.md
new file mode 100644
index 0000000000..5554412c31
--- /dev/null
+++ b/dependency-injection/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Wiring in Spring: @Autowired, @Resource and @Inject](http://www.baeldung.com/spring-annotations-resource-inject-autowire)
diff --git a/dozer/README.md b/dozer/README.md
new file mode 100644
index 0000000000..5e104d914c
--- /dev/null
+++ b/dozer/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [A Guide to Mapping With Dozer](http://www.baeldung.com/dozer)
diff --git a/feign-client/README.md b/feign-client/README.md
index e6ade4d161..149f7320d9 100644
--- a/feign-client/README.md
+++ b/feign-client/README.md
@@ -3,3 +3,6 @@
This is the implementation of a [spring-hypermedia-api][1] client using Feign.
[1]: https://github.com/eugenp/spring-hypermedia-api
+
+###Relevant Articles:
+- [Intro to Feign](http://www.baeldung.com/intro-to-feign)
diff --git a/flyway-migration/README.MD b/flyway-migration/README.MD
index 8b13789179..1b3f3c05ee 100644
--- a/flyway-migration/README.MD
+++ b/flyway-migration/README.MD
@@ -1 +1,2 @@
-
+### Relevant Articles:
+- [Database Migrations with Flyway](http://www.baeldung.com/database-migrations-with-flyway)
diff --git a/gatling/README.md b/gatling/README.md
new file mode 100644
index 0000000000..5c81c4bd6a
--- /dev/null
+++ b/gatling/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Intro to Gatling](http://www.baeldung.com/introduction-to-gatling)
diff --git a/gson-jackson-performance/README.md b/gson-jackson-performance/README.md
new file mode 100644
index 0000000000..e662219718
--- /dev/null
+++ b/gson-jackson-performance/README.md
@@ -0,0 +1,6 @@
+## Performance of Gson and Jackson
+
+Standalone java programs to measure the performance of both JSON APIs based on file size and object graph complexity.
+
+###Relevant Articles:
+- [Jackson vs Gson: A Quick Look At Performance](http://www.baeldung.com/jackson-gson-performance)
diff --git a/gson/README.md b/gson/README.md
index 67651b732e..60c80477b1 100644
--- a/gson/README.md
+++ b/gson/README.md
@@ -5,3 +5,4 @@
### Relevant Articles:
- [Gson Deserialization Cookbook](http://www.baeldung.com/gson-deserialization-guide)
+- [Jackson vs Gson](http://www.baeldung.com/jackson-vs-gson)
diff --git a/guava/README.md b/guava/README.md
index 28bcfeb912..40e7f19f41 100644
--- a/guava/README.md
+++ b/guava/README.md
@@ -15,3 +15,4 @@
- [Guava – Lists](http://www.baeldung.com/guava-lists)
- [Guava – Sets](http://www.baeldung.com/guava-sets)
- [Guava – Maps](http://www.baeldung.com/guava-maps)
+- [Guava Set + Function = Map](http://www.baeldung.com/guava-set-function-map-tutorial)
diff --git a/guava/src/test/java/org/baeldung/hamcrest/README.md b/guava/src/test/java/org/baeldung/hamcrest/README.md
new file mode 100644
index 0000000000..7266ecda3a
--- /dev/null
+++ b/guava/src/test/java/org/baeldung/hamcrest/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Testing with Hamcrest](http://www.baeldung.com/java-junit-hamcrest-guide)
diff --git a/handling-spring-static-resources/README.md b/handling-spring-static-resources/README.md
new file mode 100644
index 0000000000..d8f64bc427
--- /dev/null
+++ b/handling-spring-static-resources/README.md
@@ -0,0 +1,3 @@
+### Relevant Articles:
+- [Cachable Static Assets with Spring MVC](http://www.baeldung.com/cachable-static-assets-with-spring-mvc)
+- [Minification of JS and CSS Assets with Maven](http://www.baeldung.com/maven-minification-of-js-and-css-assets)
diff --git a/httpclient/src/test/java/org/baeldung/httpclient/HttpAsyncClientTest.java b/httpclient/src/test/java/org/baeldung/httpclient/HttpAsyncClientLiveTest.java
similarity index 99%
rename from httpclient/src/test/java/org/baeldung/httpclient/HttpAsyncClientTest.java
rename to httpclient/src/test/java/org/baeldung/httpclient/HttpAsyncClientLiveTest.java
index 151ed10f37..bfe1e68ebe 100644
--- a/httpclient/src/test/java/org/baeldung/httpclient/HttpAsyncClientTest.java
+++ b/httpclient/src/test/java/org/baeldung/httpclient/HttpAsyncClientLiveTest.java
@@ -33,7 +33,7 @@ import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HttpContext;
import org.junit.Test;
-public class HttpAsyncClientTest {
+public class HttpAsyncClientLiveTest {
private static final String HOST = "http://www.google.com";
private static final String HOST_WITH_SSL = "https://mms.nw.ru/";
diff --git a/httpclient/src/test/java/org/baeldung/httpclient/SandboxTest.java b/httpclient/src/test/java/org/baeldung/httpclient/SandboxTest.java
deleted file mode 100644
index dc1a206f0d..0000000000
--- a/httpclient/src/test/java/org/baeldung/httpclient/SandboxTest.java
+++ /dev/null
@@ -1,188 +0,0 @@
-package org.baeldung.httpclient;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-
-import org.apache.http.Header;
-import org.apache.http.HttpHost;
-import org.apache.http.HttpResponse;
-import org.apache.http.auth.AuthScope;
-import org.apache.http.auth.AuthenticationException;
-import org.apache.http.auth.MalformedChallengeException;
-import org.apache.http.auth.UsernamePasswordCredentials;
-import org.apache.http.client.AuthCache;
-import org.apache.http.client.ClientProtocolException;
-import org.apache.http.client.CookieStore;
-import org.apache.http.client.CredentialsProvider;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.protocol.HttpClientContext;
-import org.apache.http.impl.auth.DigestScheme;
-import org.apache.http.impl.client.BasicAuthCache;
-import org.apache.http.impl.client.BasicCookieStore;
-import org.apache.http.impl.client.BasicCredentialsProvider;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-import org.apache.http.impl.cookie.BasicClientCookie;
-import org.apache.http.util.EntityUtils;
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class SandboxTest {
-
- // original example
- @Ignore
- @Test
- public final void whenInterestingDigestAuthScenario_then401UnAuthorized() throws AuthenticationException, ClientProtocolException, IOException, MalformedChallengeException {
- final HttpHost targetHost = new HttpHost("httpbin.org", 80, "http");
-
- // set up the credentials to run agains the server
- final CredentialsProvider credsProvider = new BasicCredentialsProvider();
- credsProvider.setCredentials(new AuthScope(targetHost.getHostName(), targetHost.getPort()), new UsernamePasswordCredentials("user", "passwd"));
-
- // We need a first run to get a 401 to seed the digest auth
-
- // Make a client using those creds
- final CloseableHttpClient client = HttpClients.custom().setDefaultCredentialsProvider(credsProvider).build();
-
- // And make a call to the URL we are after
- final HttpGet httpget = new HttpGet("http://httpbin.org/digest-auth/auth/user/passwd");
-
- // Create a context to use
- final HttpClientContext context = HttpClientContext.create();
-
- // Get a response from the sever (expect a 401!)
- final HttpResponse authResponse = client.execute(targetHost, httpget, context);
-
- // Pull out the auth header that came back from the server
- final Header challenge = authResponse.getHeaders("WWW-Authenticate")[0];
-
- // Lets use a digest scheme to solve it
- final DigestScheme digest = new DigestScheme();
- digest.processChallenge(challenge);
-
- // Make a header with the solution based upon user/password and what the digest got out of the initial 401 reponse
- final Header solution = digest.authenticate(new UsernamePasswordCredentials("user", "passwd"), httpget, context);
-
- // Need an auth cache to use the new digest we made
- final AuthCache authCache = new BasicAuthCache();
- authCache.put(targetHost, digest);
-
- // Add the authCache and thus solved digest to the context
- context.setAuthCache(authCache);
-
- // Pimp up our http get with the solved header made by the digest
- httpget.addHeader(solution);
-
- // use it!
- System.out.println("Executing request " + httpget.getRequestLine() + " to target " + targetHost);
-
- for (int i = 0; i < 3; i++) {
- final CloseableHttpResponse responseGood = client.execute(targetHost, httpget, context);
-
- try {
- System.out.println("----------------------------------------");
- System.out.println(responseGood.getStatusLine());
- System.out.println(EntityUtils.toString(responseGood.getEntity()));
- } finally {
- responseGood.close();
- }
- }
- }
-
- @Test
- public final void whenInterestingDigestAuthScenario_then200OK() throws AuthenticationException, ClientProtocolException, IOException, MalformedChallengeException {
- final HttpHost targetHost = new HttpHost("httpbin.org", 80, "http");
-
- // set up the credentials to run agains the server
- final CredentialsProvider credsProvider = new BasicCredentialsProvider();
- credsProvider.setCredentials(new AuthScope(targetHost.getHostName(), targetHost.getPort()), new UsernamePasswordCredentials("user", "passwd"));
-
- // This endpoint need fake cookie to work properly
- final CookieStore cookieStore = new BasicCookieStore();
- final BasicClientCookie cookie = new BasicClientCookie("fake", "fake_value");
- cookie.setDomain("httpbin.org");
- cookie.setPath("/");
- cookieStore.addCookie(cookie);
-
- // Make a client using those creds
- final CloseableHttpClient client = HttpClients.custom().setDefaultCookieStore(cookieStore).setDefaultCredentialsProvider(credsProvider).build();
-
- // And make a call to the URL we are after
- final HttpGet httpget = new HttpGet("http://httpbin.org/digest-auth/auth/user/passwd");
-
- // Create a context to use
- final HttpClientContext context = HttpClientContext.create();
-
- // Get a response from the sever (401 implicitly)
- final HttpResponse authResponse = client.execute(targetHost, httpget, context);
- assertEquals(200, authResponse.getStatusLine().getStatusCode());
-
- // HttpClient will use cached digest parameters for future requests
- System.out.println("Executing request " + httpget.getRequestLine() + " to target " + targetHost);
-
- for (int i = 0; i < 3; i++) {
- final CloseableHttpResponse responseGood = client.execute(targetHost, httpget, context);
-
- try {
- System.out.println("----------------------------------------");
- System.out.println(responseGood.getStatusLine());
- assertEquals(200, responseGood.getStatusLine().getStatusCode());
- } finally {
- responseGood.close();
- }
- }
- client.close();
- }
-
- // This test needs module spring-security-rest-digest-auth to be running
- @Test
- public final void whenWeKnowDigestParameters_thenNo401Status() throws AuthenticationException, ClientProtocolException, IOException, MalformedChallengeException {
- final HttpHost targetHost = new HttpHost("localhost", 8080, "http");
-
- final CredentialsProvider credsProvider = new BasicCredentialsProvider();
- credsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("user1", "user1Pass"));
-
- final CloseableHttpClient client = HttpClients.custom().setDefaultCredentialsProvider(credsProvider).build();
-
- final HttpGet httpget = new HttpGet("http://localhost:8080/spring-security-rest-digest-auth/api/foos/1");
-
- final HttpClientContext context = HttpClientContext.create();
- // == make it preemptive
- final AuthCache authCache = new BasicAuthCache();
- final DigestScheme digestAuth = new DigestScheme();
- digestAuth.overrideParamter("realm", "Custom Realm Name");
- digestAuth.overrideParamter("nonce", "nonce value goes here");
- authCache.put(targetHost, digestAuth);
- context.setAuthCache(authCache);
- // == end
- System.out.println("Executing The Request knowing the digest parameters ==== ");
- final HttpResponse authResponse = client.execute(targetHost, httpget, context);
- assertEquals(200, authResponse.getStatusLine().getStatusCode());
- client.close();
- }
-
- // This test needs module spring-security-rest-digest-auth to be running
- @Test
- public final void whenDoNotKnowParameters_thenOnlyOne401() throws AuthenticationException, ClientProtocolException, IOException, MalformedChallengeException {
- final HttpClientContext context = HttpClientContext.create();
- final HttpHost targetHost = new HttpHost("localhost", 8080, "http");
- final CredentialsProvider credsProvider = new BasicCredentialsProvider();
- credsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("user1", "user1Pass"));
- final CloseableHttpClient client = HttpClients.custom().setDefaultCredentialsProvider(credsProvider).build();
-
- final HttpGet httpget = new HttpGet("http://localhost:8080/spring-security-rest-digest-auth/api/foos/1");
- System.out.println("Executing The Request NOT knowing the digest parameters ==== ");
- final HttpResponse tempResponse = client.execute(targetHost, httpget, context);
- assertEquals(200, tempResponse.getStatusLine().getStatusCode());
-
- for (int i = 0; i < 3; i++) {
- System.out.println("No more Challenges or 401");
- final CloseableHttpResponse authResponse = client.execute(targetHost, httpget, context);
- assertEquals(200, authResponse.getStatusLine().getStatusCode());
- authResponse.close();
- }
- client.close();
- }
-}
diff --git a/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientSandboxLiveTest.java b/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientSandboxLiveTest.java
index ff2f1cd194..2333e2f8c9 100644
--- a/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientSandboxLiveTest.java
+++ b/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientSandboxLiveTest.java
@@ -10,9 +10,11 @@ import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
+import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.impl.client.HttpClients;
import org.junit.After;
import org.junit.Test;
@@ -58,4 +60,14 @@ public class HttpClientSandboxLiveTest {
System.out.println(response.getStatusLine());
}
+ @Test
+ public final void givenIgnoringCertificates_whenHttpsUrlIsConsumed_thenCorrect() throws ClientProtocolException, IOException {
+ final CloseableHttpClient httpClient = HttpClients.custom().setSSLHostnameVerifier(new NoopHostnameVerifier()).build();
+
+ final HttpGet httpGet = new HttpGet("https://sesar3.geoinfogeochem.org/sample/igsn/ODP000002");
+ httpGet.setHeader("Accept", "application/xml");
+
+ response = httpClient.execute(httpGet);
+ }
+
}
diff --git a/httpclient/src/test/java/org/baeldung/httpclient/conn/HttpClientConnectionManagementTest.java b/httpclient/src/test/java/org/baeldung/httpclient/conn/HttpClientConnectionManagementLiveTest.java
similarity index 99%
rename from httpclient/src/test/java/org/baeldung/httpclient/conn/HttpClientConnectionManagementTest.java
rename to httpclient/src/test/java/org/baeldung/httpclient/conn/HttpClientConnectionManagementLiveTest.java
index c5c960f527..e9db8c1e16 100644
--- a/httpclient/src/test/java/org/baeldung/httpclient/conn/HttpClientConnectionManagementTest.java
+++ b/httpclient/src/test/java/org/baeldung/httpclient/conn/HttpClientConnectionManagementLiveTest.java
@@ -36,7 +36,7 @@ import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
-public class HttpClientConnectionManagementTest {
+public class HttpClientConnectionManagementLiveTest {
private static final String SERVER1 = "http://www.petrikainulainen.net/";
private static final String SERVER7 = "http://www.baeldung.com/";
diff --git a/hystrix/README.md b/hystrix/README.md
new file mode 100644
index 0000000000..cc5c8a197f
--- /dev/null
+++ b/hystrix/README.md
@@ -0,0 +1,3 @@
+### Relevant Articles:
+- [Hystrix Integration with Existing Spring Application](http://www.baeldung.com/hystrix-integration-with-spring-aop)
+- [Introduction to Hystrix](http://www.baeldung.com/introduction-to-hystrix)
diff --git a/immutables/README.md b/immutables/README.md
new file mode 100644
index 0000000000..b69a14f035
--- /dev/null
+++ b/immutables/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Introduction to Immutables](http://www.baeldung.com/immutables)
diff --git a/jackson/README.md b/jackson/README.md
index 68765de686..f48a7dc8ab 100644
--- a/jackson/README.md
+++ b/jackson/README.md
@@ -19,3 +19,8 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Jackson – Decide What Fields Get Serialized/Deserializaed](http://www.baeldung.com/jackson-field-serializable-deserializable-or-not)
- [A Guide to Jackson Annotations](http://www.baeldung.com/jackson-annotations)
- [Working with Tree Model Nodes in Jackson](http://www.baeldung.com/jackson-json-node-tree-model)
+- [Jackson vs Gson](http://www.baeldung.com/jackson-vs-gson)
+- [Intro to the Jackson ObjectMapper](http://www.baeldung.com/jackson-object-mapper-tutorial)
+- [XML Serialization and Deserialization with Jackson](http://www.baeldung.com/jackson-xml-serialization-and-deserialization)
+- [More Jackson Annotations](http://www.baeldung.com/jackson-advanced-annotations)
+- [Inheritance with Jackson](http://www.baeldung.com/jackson-inheritance)
diff --git a/jee7schedule/README.md b/jee7schedule/README.md
new file mode 100644
index 0000000000..44ca9c2f6e
--- /dev/null
+++ b/jee7schedule/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Scheduling in Java EE](http://www.baeldung.com/scheduling-in-java-enterprise-edition)
diff --git a/jooq-spring/README.md b/jooq-spring/README.md
new file mode 100644
index 0000000000..79718e74c6
--- /dev/null
+++ b/jooq-spring/README.md
@@ -0,0 +1,3 @@
+### Relevant Articles:
+- [Spring Boot Support for jOOQ](http://www.baeldung.com/spring-boot-support-for-jooq)
+- [Introduction to jOOQ with Spring](http://www.baeldung.com/jooq-with-spring)
diff --git a/jpa-storedprocedure/README.md b/jpa-storedprocedure/README.md
new file mode 100644
index 0000000000..39d6784d8b
--- /dev/null
+++ b/jpa-storedprocedure/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [A Guide to Stored Procedures with JPA](http://www.baeldung.com/jpa-stored-procedures)
diff --git a/jsf/README.md b/jsf/README.md
new file mode 100644
index 0000000000..ae92ffc42f
--- /dev/null
+++ b/jsf/README.md
@@ -0,0 +1,4 @@
+### Relevant Articles:
+- [Introduction to JSF Expression Language 3.0](http://www.baeldung.com/jsf-expression-language-el-3)
+- [Introduction to JSF EL 2](http://www.baeldung.com/intro-to-jsf-expression-language)
+- [JavaServer Faces (JSF) with Spring](http://www.baeldung.com/spring-jsf)
diff --git a/json/README.md b/json/README.md
index c47eca3e84..e217da170f 100644
--- a/json/README.md
+++ b/json/README.md
@@ -5,3 +5,5 @@
### Relevant Articles:
- [Introduction to JSON Schema in Java](http://www.baeldung.com/introduction-to-json-schema-in-java)
- [A Guide to FastJson](http://www.baeldung.com/????????)
+- [Introduction to JSONForms](http://www.baeldung.com/introduction-to-jsonforms)
+- [Introduction to JsonPath](http://www.baeldung.com/guide-to-jayway-jsonpath)
diff --git a/junit5/REDAME.md b/junit5/REDAME.md
new file mode 100644
index 0000000000..d4e30cd257
--- /dev/null
+++ b/junit5/REDAME.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [The Basics of JUnit 5 – A Preview](http://www.baeldung.com/junit-5-preview)
diff --git a/log4j/README.md b/log4j/README.md
new file mode 100644
index 0000000000..7355372f23
--- /dev/null
+++ b/log4j/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Introduction to Java Logging](http://www.baeldung.com/java-logging-intro)
diff --git a/lombok/README.md b/lombok/README.md
new file mode 100644
index 0000000000..4dc1c2d09d
--- /dev/null
+++ b/lombok/README.md
@@ -0,0 +1,2 @@
+## Relevant Articles:
+- [Introduction to Project Lombok](http://www.baeldung.com/intro-to-project-lombok)
diff --git a/mockito/README.md b/mockito/README.md
index 5e7cd19f78..6de2fb0c7a 100644
--- a/mockito/README.md
+++ b/mockito/README.md
@@ -8,3 +8,5 @@
- [Mockito When/Then Cookbook](http://www.baeldung.com/mockito-behavior)
- [Mockito – Using Spies](http://www.baeldung.com/mockito-spy)
- [Mockito – @Mock, @Spy, @Captor and @InjectMocks](http://www.baeldung.com/mockito-annotations)
+- [Mockito’s Mock Methods](http://www.baeldung.com/mockito-mock-methods)
+- [Introduction to PowerMock](http://www.baeldung.com/intro-to-powermock)
diff --git a/mocks/jmockit/README.md b/mocks/jmockit/README.md
index db78b2a3ac..3063fdc31d 100644
--- a/mocks/jmockit/README.md
+++ b/mocks/jmockit/README.md
@@ -7,3 +7,4 @@
- [JMockit 101](http://www.baeldung.com/jmockit-101)
- [A Guide to JMockit Expectations](http://www.baeldung.com/jmockit-expectations)
- [JMockit Advanced Topics](http://www.baeldung.com/jmockit-advanced-topics)
+- [JMockit Advanced Usage](http://www.baeldung.com/jmockit-advanced-usage)
diff --git a/mutation-testing/README.md b/mutation-testing/README.md
index 5dd60620ba..f49aeeb881 100644
--- a/mutation-testing/README.md
+++ b/mutation-testing/README.md
@@ -4,3 +4,5 @@
### Relevant Articles:
- [Introduction to Mutation Testing Using the PITest Library](http://www.baeldung.com/java-mutation-testing-with-pitest)
+- [Intro to JaCoCo](http://www.baeldung.com/jacoco)
+- [Mutation Testing with PITest](http://www.baeldung.com/java-mutation-testing-with-pitest)
diff --git a/okhttp/pom.xml b/okhttp/pom.xml
deleted file mode 100644
index ba5bcf9725..0000000000
--- a/okhttp/pom.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-
- 4.0.0
- org.baeldung.okhttp
- okhttp
- 0.0.1-SNAPSHOT
-
-
-
-
-
- com.squareup.okhttp3
- okhttp
- ${com.squareup.okhttp3.version}
-
-
-
-
- junit
- junit
- ${junit.version}
- test
-
-
-
- org.hamcrest
- hamcrest-library
- ${org.hamcrest.version}
- test
-
-
-
-
-
-
-
- 3.4.1
-
-
- 1.3
- 4.12
-
-
-
-
diff --git a/okhttp/src/test/java/org/baeldung/okhttp/OkHttpMiscTest.java b/okhttp/src/test/java/org/baeldung/okhttp/OkHttpMiscTest.java
deleted file mode 100644
index 829bafe8ef..0000000000
--- a/okhttp/src/test/java/org/baeldung/okhttp/OkHttpMiscTest.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package org.baeldung.okhttp;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.Test;
-
-import okhttp3.Cache;
-import okhttp3.Call;
-import okhttp3.OkHttpClient;
-import okhttp3.Request;
-import okhttp3.Response;
-
-public class OkHttpMiscTest {
-
- private static final String BASE_URL = "http://localhost:8080/spring-rest";
-
- //@Test
- public void whenSetRequestTimeoutUsingOkHttp_thenFail() throws IOException {
-
- OkHttpClient client = new OkHttpClient.Builder()
- //.connectTimeout(10, TimeUnit.SECONDS)
- //.writeTimeout(10, TimeUnit.SECONDS)
- .readTimeout(1, TimeUnit.SECONDS)
- .build();
-
- Request request = new Request.Builder()
- .url(BASE_URL + "/delay/2") // This URL is served with a 2 second delay.
- .build();
-
- Call call = client.newCall(request);
- Response response = call.execute();
- response.close();
- }
-
- //@Test
- public void whenCancelRequestUsingOkHttp_thenCorrect() throws IOException {
-
- ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
-
- OkHttpClient client = new OkHttpClient();
-
- Request request = new Request.Builder()
- .url(BASE_URL + "/delay/2") // This URL is served with a 2 second delay.
- .build();
-
- final int seconds = 1;
- //final int seconds = 3;
-
- final long startNanos = System.nanoTime();
- final Call call = client.newCall(request);
-
- // Schedule a job to cancel the call in 1 second.
- executor.schedule(new Runnable() {
- public void run() {
-
- System.out.printf("%.2f Canceling call.%n", (System.nanoTime() - startNanos) / 1e9f);
- call.cancel();
- System.out.printf("%.2f Canceled call.%n", (System.nanoTime() - startNanos) / 1e9f);
- }
- }, seconds, TimeUnit.SECONDS);
-
- try {
-
- System.out.printf("%.2f Executing call.%n", (System.nanoTime() - startNanos) / 1e9f);
- Response response = call.execute();
- System.out.printf("%.2f Call was expected to fail, but completed: %s%n", (System.nanoTime() - startNanos) / 1e9f, response);
-
- } catch (IOException e) {
-
- System.out.printf("%.2f Call failed as expected: %s%n", (System.nanoTime() - startNanos) / 1e9f, e);
- }
- }
-
- @Test
- public void whenSetResponseCacheUsingOkHttp_thenCorrect() throws IOException {
-
- int cacheSize = 10 * 1024 * 1024; // 10 MiB
- File cacheDirectory = new File("src/test/resources/cache");
- Cache cache = new Cache(cacheDirectory, cacheSize);
-
- OkHttpClient client = new OkHttpClient.Builder()
- .cache(cache)
- .build();
-
- Request request = new Request.Builder()
- .url("http://publicobject.com/helloworld.txt")
- //.cacheControl(CacheControl.FORCE_NETWORK)
- //.cacheControl(CacheControl.FORCE_CACHE)
- .build();
-
- Response response1 = client.newCall(request).execute();
-
- String responseBody1 = response1.body().string();
-
- System.out.println("Response 1 response: " + response1);
- System.out.println("Response 1 cache response: " + response1.cacheResponse());
- System.out.println("Response 1 network response: " + response1.networkResponse());
- System.out.println("Response 1 responseBody: " + responseBody1);
-
- Response response2 = client.newCall(request).execute();
-
- String responseBody2 = response2.body().string();
-
- System.out.println("Response 2 response: " + response2);
- System.out.println("Response 2 cache response: " + response2.cacheResponse());
- System.out.println("Response 2 network response: " + response2.networkResponse());
- System.out.println("Response 2 responseBody: " + responseBody2);
- }
-}
diff --git a/orika/README.md b/orika/README.md
new file mode 100644
index 0000000000..4ed033c170
--- /dev/null
+++ b/orika/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Mapping with Orika](http://www.baeldung.com/orika-mapping)
diff --git a/pom.xml b/pom.xml
index 709c3e4e00..eee9f07ab9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -18,7 +18,7 @@
apache-cxf
autovalue-tutorial
-
+
cdi
core-java
core-java-8
@@ -68,7 +68,6 @@
rest-assured
rest-testing
resteasy
- okhttp
spring-all
spring-akka
diff --git a/querydsl/README.md b/querydsl/README.md
new file mode 100644
index 0000000000..ef9f8f894c
--- /dev/null
+++ b/querydsl/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Intro to Querydsl](http://www.baeldung.com/intro-to-querydsl)
diff --git a/raml/resource-types-and-traits/README.md b/raml/resource-types-and-traits/README.md
new file mode 100644
index 0000000000..72e7b454d6
--- /dev/null
+++ b/raml/resource-types-and-traits/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Eliminate Redundancies in RAML with Resource Types and Traits](http://www.baeldung.com/simple-raml-with-resource-types-and-traits)
diff --git a/rest-assured/README.md b/rest-assured/README.md
index e69de29bb2..50f36f61eb 100644
--- a/rest-assured/README.md
+++ b/rest-assured/README.md
@@ -0,0 +1,2 @@
+###Relevant Articles:
+- [A Guide to REST-assured](http://www.baeldung.com/rest-assured-tutorial)
diff --git a/rest-testing/README.md b/rest-testing/README.md
index 54a2e98dda..5dd4e49162 100644
--- a/rest-testing/README.md
+++ b/rest-testing/README.md
@@ -7,3 +7,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
### Relevant Articles:
- [Test a REST API with Java](http://www.baeldung.com/2011/10/13/integration-testing-a-rest-api/)
+- [Introduction to WireMock](http://www.baeldung.com/introduction-to-wiremock)
+- [REST API Testing with Cucumber](http://www.baeldung.com/cucumber-rest-api-testing)
diff --git a/sockets/README.md b/sockets/README.md
new file mode 100644
index 0000000000..ad8811ee80
--- /dev/null
+++ b/sockets/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [A Guide to Java Sockets](http://www.baeldung.com/a-guide-to-java-sockets)
diff --git a/spring-akka/README.md b/spring-akka/README.md
new file mode 100644
index 0000000000..0f1c013214
--- /dev/null
+++ b/spring-akka/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Introduction to Spring with Akka](http://www.baeldung.com/akka-with-spring)
diff --git a/spring-all/README.md b/spring-all/README.md
index 0bbb600860..aae98440f3 100644
--- a/spring-all/README.md
+++ b/spring-all/README.md
@@ -12,3 +12,6 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Spring Profiles](http://www.baeldung.com/spring-profiles)
- [A Spring Custom Annotation for a Better DAO](http://www.baeldung.com/spring-annotation-bean-pre-processor)
- [What's New in Spring 4.3?](http://www.baeldung.com/whats-new-in-spring-4-3/)
+- [Guide To Running Logic on Startup in Spring](http://www.baeldung.com/running-setup-logic-on-startup-in-spring)
+- [Quick Guide to Spring Controllers](http://www.baeldung.com/spring-controllers)
+- [Quick Guide to Spring Bean Scopes](http://www.baeldung.com/spring-bean-scopes)
diff --git a/spring-all/src/test/java/org/baeldung/ehcache/SquareCalculatorTest.java b/spring-all/src/test/java/org/baeldung/ehcache/SquareCalculatorTest.java
new file mode 100644
index 0000000000..875fd2a25e
--- /dev/null
+++ b/spring-all/src/test/java/org/baeldung/ehcache/SquareCalculatorTest.java
@@ -0,0 +1,43 @@
+package org.baeldung.ehcache;
+
+import static org.junit.Assert.*;
+
+import org.baeldung.ehcache.calculator.SquaredCalculator;
+import org.baeldung.ehcache.config.CacheHelper;
+import org.junit.Before;
+import org.junit.Test;
+
+public class SquareCalculatorTest {
+ SquaredCalculator squaredCalculator = new SquaredCalculator();
+ CacheHelper cacheHelper = new CacheHelper();
+
+ @Before
+ public void setup() {
+ squaredCalculator.setCache(cacheHelper);
+
+ }
+
+ @Test
+ public void whenCalculatingSquareValueOnce_thenCacheDontHaveValues() {
+ for (int i = 10; i < 15; i++) {
+ assertFalse(cacheHelper.getSquareNumberCache().containsKey(i));
+ System.out.println("Square value of " + i + " is: "
+ + squaredCalculator.getSquareValueOfNumber(i) + "\n");
+ }
+ }
+
+ @Test
+ public void whenCalculatingSquareValueAgain_thenCacheHasAllValues() {
+ for (int i = 10; i < 15; i++) {
+ assertFalse(cacheHelper.getSquareNumberCache().containsKey(i));
+ System.out.println("Square value of " + i + " is: "
+ + squaredCalculator.getSquareValueOfNumber(i) + "\n");
+ }
+
+ for (int i = 10; i < 15; i++) {
+ assertTrue(cacheHelper.getSquareNumberCache().containsKey(i));
+ System.out.println("Square value of " + i + " is: "
+ + squaredCalculator.getSquareValueOfNumber(i) + "\n");
+ }
+ }
+}
diff --git a/spring-autowire/README.md b/spring-autowire/README.md
new file mode 100644
index 0000000000..d5b8221b25
--- /dev/null
+++ b/spring-autowire/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Guide to Spring @Autowired](http://www.baeldung.com/spring-autowire)
diff --git a/spring-boot/README.MD b/spring-boot/README.MD
index 2a87b46021..1610d77e81 100644
--- a/spring-boot/README.MD
+++ b/spring-boot/README.MD
@@ -1,2 +1,7 @@
###The Course
The "REST With Spring" Classes: http://bit.ly/restwithspring
+
+###Relevant Articles:
+- [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)
diff --git a/spring-boot/src/main/java/com/baeldung/git/README.md b/spring-boot/src/main/java/com/baeldung/git/README.md
new file mode 100644
index 0000000000..7e6a597c28
--- /dev/null
+++ b/spring-boot/src/main/java/com/baeldung/git/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Injecting Git Information Into Spring](http://www.baeldung.com/spring-git-information)
diff --git a/spring-cloud-data-flow/README.MD b/spring-cloud-data-flow/README.MD
index 8b13789179..17d0ec6286 100644
--- a/spring-cloud-data-flow/README.MD
+++ b/spring-cloud-data-flow/README.MD
@@ -1 +1,3 @@
-
+### Relevant Articles:
+- [Batch Processing with Spring Cloud Data Flow](http://www.baeldung.com/spring-cloud-data-flow-batch-processing)
+- [Getting Started with Stream Processing with Spring Cloud Data Flow](http://www.baeldung.com/spring-cloud-data-flow-stream-processing)
diff --git a/spring-cloud/spring-cloud-bootstrap/README.MD b/spring-cloud/spring-cloud-bootstrap/README.MD
index 8b13789179..c16ba3e247 100644
--- a/spring-cloud/spring-cloud-bootstrap/README.MD
+++ b/spring-cloud/spring-cloud-bootstrap/README.MD
@@ -1 +1,2 @@
-
+### Relevant Articles:
+- [Spring Cloud – Bootstrapping](http://www.baeldung.com/spring-cloud-bootstrapping)
diff --git a/spring-cloud/spring-cloud-config/README.md b/spring-cloud/spring-cloud-config/README.md
new file mode 100644
index 0000000000..b28c750ee6
--- /dev/null
+++ b/spring-cloud/spring-cloud-config/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Dockerizing a Spring Boot Application](http://www.baeldung.com/dockerizing-spring-boot-application)
diff --git a/spring-cloud/spring-cloud-eureka/README.md b/spring-cloud/spring-cloud-eureka/README.md
new file mode 100644
index 0000000000..badf4c8d50
--- /dev/null
+++ b/spring-cloud/spring-cloud-eureka/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Introduction to Spring Cloud Netflix – Eureka](http://www.baeldung.com/spring-cloud-netflix-eureka)
diff --git a/spring-cloud/spring-cloud-hystrix/README.MD b/spring-cloud/spring-cloud-hystrix/README.MD
index 8b13789179..a235f6311f 100644
--- a/spring-cloud/spring-cloud-hystrix/README.MD
+++ b/spring-cloud/spring-cloud-hystrix/README.MD
@@ -1 +1,2 @@
-
+### Relevant Articles:
+- [A Guide to Spring Cloud Netflix – Hystrix](http://www.baeldung.com/spring-cloud-netflix-hystrix)
diff --git a/spring-cucumber/README.md b/spring-cucumber/README.md
new file mode 100644
index 0000000000..1e506f3a09
--- /dev/null
+++ b/spring-cucumber/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Cucumber Spring Integration](http://www.baeldung.com/cucumber-spring-integration)
diff --git a/spring-data-elasticsearch/README.md b/spring-data-elasticsearch/README.md
index 74d9e4f642..a7b090818e 100644
--- a/spring-data-elasticsearch/README.md
+++ b/spring-data-elasticsearch/README.md
@@ -1,6 +1,10 @@
## Spring Data Elasticsearch
- [Introduction to Spring Data Elasticsearch](http://www.baeldung.com/spring-data-elasticsearch-tutorial)
+###Relevant Articles:
+- [Elasticsearch Queries with Spring Data](http://www.baeldung.com/spring-data-elasticsearch-queries)
+- [Guide to Elasticsearch in Java](http://www.baeldung.com/elasticsearch-java)
+
### Build the Project with Tests Running
```
mvn clean install
diff --git a/spring-data-elasticsearch/pom.xml b/spring-data-elasticsearch/pom.xml
index 084695c2f3..42cf8fc740 100644
--- a/spring-data-elasticsearch/pom.xml
+++ b/spring-data-elasticsearch/pom.xml
@@ -11,8 +11,9 @@
UTF-8
+ 1.8
+ 1.8
- 1.3.2.RELEASE
4.2.5.RELEASE
4.11
@@ -27,6 +28,12 @@
spring-core
${org.springframework.version}
+
+ org.springframework.data
+ spring-data-elasticsearch
+ ${elasticsearch.version}
+
+
junit
junit-dep
@@ -39,16 +46,13 @@
${org.springframework.version}
test
-
- org.springframework.data
- spring-data-elasticsearch
- ${elasticsearch.version}
-
- net.java.dev.jna
+
+ net.java.dev.jna
jna
4.1.0
test
+
org.slf4j
slf4j-api
@@ -81,16 +85,5 @@
1.2.13
-
-
-
- maven-compiler-plugin
- 2.3.2
-
- 1.8
- 1.8
-
-
-
-
-
+
+
\ No newline at end of file
diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/config/Config.java b/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/config/Config.java
index f93999a1cc..37e9fd46eb 100644
--- a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/config/Config.java
+++ b/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/config/Config.java
@@ -32,18 +32,22 @@ public class Config {
public Client client() {
try {
final Path tmpDir = Files.createTempDirectory(Paths.get(System.getProperty("java.io.tmpdir")), "elasticsearch_data");
-
+ logger.debug(tmpDir.toAbsolutePath().toString());
+
// @formatter:off
final Settings.Builder elasticsearchSettings =
Settings.settingsBuilder().put("http.enabled", "false")
.put("path.data", tmpDir.toAbsolutePath().toString())
.put("path.home", elasticsearchHome);
+
+ return new NodeBuilder()
+ .local(true)
+ .settings(elasticsearchSettings)
+ .node()
+ .client();
+
// @formatter:on
-
- logger.debug(tmpDir.toAbsolutePath().toString());
-
- return new NodeBuilder().local(true).settings(elasticsearchSettings.build()).node().client();
} catch (final IOException ioex) {
logger.error("Cannot create temp dir", ioex);
throw new RuntimeException();
diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleServiceImpl.java b/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleServiceImpl.java
index 0ea922bdd3..2a31b52602 100644
--- a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleServiceImpl.java
+++ b/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleServiceImpl.java
@@ -10,10 +10,10 @@ import org.springframework.stereotype.Service;
@Service
public class ArticleServiceImpl implements ArticleService {
- private ArticleRepository articleRepository;
-
+ private final ArticleRepository articleRepository;
+
@Autowired
- public void setArticleRepository(ArticleRepository articleRepository) {
+ public ArticleServiceImpl(ArticleRepository articleRepository) {
this.articleRepository = articleRepository;
}
diff --git a/spring-data-elasticsearch/src/main/resources/logback.xml b/spring-data-elasticsearch/src/main/resources/logback.xml
index 37a9e2edbf..db75fcbe40 100644
--- a/spring-data-elasticsearch/src/main/resources/logback.xml
+++ b/spring-data-elasticsearch/src/main/resources/logback.xml
@@ -8,10 +8,10 @@
-
-
-
+
+
+
diff --git a/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchQueryTest.java b/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchQueryTest.java
index 1551d6442e..ddf0ef4dac 100644
--- a/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchQueryTest.java
+++ b/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchQueryTest.java
@@ -34,7 +34,6 @@ import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilde
import org.springframework.data.elasticsearch.core.query.SearchQuery;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.test.context.support.AnnotationConfigContextLoader;
import com.baeldung.spring.data.es.config.Config;
import com.baeldung.spring.data.es.model.Article;
@@ -42,7 +41,7 @@ import com.baeldung.spring.data.es.model.Author;
import com.baeldung.spring.data.es.service.ArticleService;
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = { Config.class }, loader = AnnotationConfigContextLoader.class)
+@ContextConfiguration(classes = Config.class)
public class ElasticSearchQueryTest {
@Autowired
diff --git a/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchTest.java b/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchTest.java
index e10b5f48d7..863e1e4620 100644
--- a/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchTest.java
+++ b/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchTest.java
@@ -21,7 +21,6 @@ import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilde
import org.springframework.data.elasticsearch.core.query.SearchQuery;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.test.context.support.AnnotationConfigContextLoader;
import com.baeldung.spring.data.es.config.Config;
import com.baeldung.spring.data.es.model.Article;
@@ -29,7 +28,7 @@ import com.baeldung.spring.data.es.model.Author;
import com.baeldung.spring.data.es.service.ArticleService;
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = { Config.class }, loader = AnnotationConfigContextLoader.class)
+@ContextConfiguration(classes = Config.class)
public class ElasticSearchTest {
@Autowired
diff --git a/spring-data-redis/README.md b/spring-data-redis/README.md
index 89eae99f05..da44920e16 100644
--- a/spring-data-redis/README.md
+++ b/spring-data-redis/README.md
@@ -2,6 +2,7 @@
### Relevant Articles:
- [Introduction to Spring Data Redis](http://www.baeldung.com/spring-data-redis-tutorial)
+- [PubSub Messaging with Spring Data Redis](http://www.baeldung.com/spring-data-redis-pub-sub)
### Build the Project with Tests Running
```
diff --git a/spring-data-rest/README.md b/spring-data-rest/README.md
index 7dc439206b..4e8828a688 100644
--- a/spring-data-rest/README.md
+++ b/spring-data-rest/README.md
@@ -12,3 +12,6 @@ The application uses [Spring Boot](http://projects.spring.io/spring-boot/), so i
# Viewing the running application
To view the running application, visit [http://localhost:8080](http://localhost:8080) in your browser
+
+###Relevant Articles:
+- [Guide to Spring Data REST Validators](http://www.baeldung.com/spring-data-rest-validators)
diff --git a/spring-exceptions/README.md b/spring-exceptions/README.md
index ab6a9643e9..fd9250c6da 100644
--- a/spring-exceptions/README.md
+++ b/spring-exceptions/README.md
@@ -10,3 +10,4 @@ This project is used to replicate Spring Exceptions only.
- [Spring DataIntegrityViolationException](http://www.baeldung.com/spring-dataIntegrityviolationexception)
- [Spring BeanDefinitionStoreException](http://www.baeldung.com/spring-beandefinitionstoreexception)
- [Spring NoSuchBeanDefinitionException](http://www.baeldung.com/spring-nosuchbeandefinitionexception)
+- [Guide to Spring NonTransientDataAccessException](http://www.baeldung.com/nontransientdataaccessexception)
diff --git a/spring-hibernate4/README.md b/spring-hibernate4/README.md
index 1f18e1d0e8..7888e8b4ee 100644
--- a/spring-hibernate4/README.md
+++ b/spring-hibernate4/README.md
@@ -10,6 +10,8 @@
- [Auditing with JPA, Hibernate, and Spring Data JPA](http://www.baeldung.com/database-auditing-jpa)
- [Stored Procedures with Hibernate](http://www.baeldung.com/stored-procedures-with-hibernate-tutorial)
- [Hibernate: save, persist, update, merge, saveOrUpdate](http://www.baeldung.com/hibernate-save-persist-update-merge-saveorupdate/)
+- [Eager/Lazy Loading In Hibernate](http://www.baeldung.com/hibernate-lazy-eager-loading)
+- [Hibernate Criteria Queries](http://www.baeldung.com/hibernate-criteria-queries)
### Quick Start
diff --git a/spring-jpa/README.md b/spring-jpa/README.md
index f974c6e22c..4568c0bc7f 100644
--- a/spring-jpa/README.md
+++ b/spring-jpa/README.md
@@ -10,3 +10,5 @@
- [JPA Pagination](http://www.baeldung.com/jpa-pagination)
- [Sorting with JPA](http://www.baeldung.com/jpa-sort)
- [Spring JPA – Multiple Databases](http://www.baeldung.com/spring-data-jpa-multiple-databases)
+- [Hibernate Second-Level Cache](http://www.baeldung.com/hibernate-second-level-cache)
+- [Spring, Hibernate and a JNDI Datasource](http://www.baeldung.com/spring-persistence-jpa-jndi-datasource)
diff --git a/spring-katharsis/pom.xml b/spring-katharsis/pom.xml
index 892aaf24f1..e2e3ea6f97 100644
--- a/spring-katharsis/pom.xml
+++ b/spring-katharsis/pom.xml
@@ -3,11 +3,12 @@
org.springframework.samples
spring-katharsis
0.0.1-SNAPSHOT
+ war
org.springframework.boot
spring-boot-starter-parent
- 1.2.6.RELEASE
+ 1.3.3.RELEASE
@@ -62,6 +63,7 @@
1.8
1.0.0
2.4.0
+ 1.6.0
@@ -71,7 +73,100 @@
org.springframework.boot
spring-boot-maven-plugin
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ **/*LiveTest.java
+
+
+
+
+
+
+
+
+ org.codehaus.cargo
+ cargo-maven2-plugin
+ ${cargo-maven2-plugin.version}
+
+ true
+
+ tomcat8x
+ embedded
+
+
+
+
+
+
+ 8082
+
+
+
+
+
+
+
+
+
+ live
+
+
+
+ org.codehaus.cargo
+ cargo-maven2-plugin
+
+
+ start-server
+ pre-integration-test
+
+ start
+
+
+
+ stop-server
+ post-integration-test
+
+ stop
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ integration-test
+
+ test
+
+
+
+ none
+
+
+ **/*LiveTest.java
+
+
+ cargo
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-katharsis/src/main/java/org/baeldung/Application.java b/spring-katharsis/src/main/java/org/baeldung/Application.java
index 1b409f8b91..e7beb16e04 100644
--- a/spring-katharsis/src/main/java/org/baeldung/Application.java
+++ b/spring-katharsis/src/main/java/org/baeldung/Application.java
@@ -2,9 +2,10 @@ package org.baeldung;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.context.web.SpringBootServletInitializer;
@SpringBootApplication
-public class Application {
+public class Application extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
diff --git a/spring-katharsis/src/main/resources/application.properties b/spring-katharsis/src/main/resources/application.properties
index 25d4559e3d..b55fdbba03 100644
--- a/spring-katharsis/src/main/resources/application.properties
+++ b/spring-katharsis/src/main/resources/application.properties
@@ -3,4 +3,7 @@ spring.datasource.username = sa
spring.datasource.password =
spring.jpa.show-sql = false
spring.jpa.hibernate.ddl-auto = create-drop
-spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.H2Dialect
\ No newline at end of file
+spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.H2Dialect
+
+server.port=8082
+server.context-path=/spring-katharsis
\ No newline at end of file
diff --git a/spring-katharsis/src/test/java/org/baeldung/test/JsonApiLiveTest.java b/spring-katharsis/src/test/java/org/baeldung/test/JsonApiLiveTest.java
index bbddba3490..26a8c42a25 100644
--- a/spring-katharsis/src/test/java/org/baeldung/test/JsonApiLiveTest.java
+++ b/spring-katharsis/src/test/java/org/baeldung/test/JsonApiLiveTest.java
@@ -2,22 +2,14 @@ package org.baeldung.test;
import static org.junit.Assert.assertEquals;
-import org.baeldung.Application;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.boot.test.SpringApplicationConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.test.context.web.WebAppConfiguration;
import com.jayway.restassured.RestAssured;
import com.jayway.restassured.response.Response;
-@RunWith(SpringJUnit4ClassRunner.class)
-@SpringApplicationConfiguration(classes = Application.class)
-@WebAppConfiguration
public class JsonApiLiveTest {
- private final static String URL_PREFIX = "http://localhost:8080/users";
+ private final static String URL_PREFIX = "http://localhost:8082/spring-katharsis/users";
@Test
public void whenGettingAllUsers_thenCorrect() {
diff --git a/spring-mvc-java/README.md b/spring-mvc-java/README.md
index 951d80033e..996a7d96b1 100644
--- a/spring-mvc-java/README.md
+++ b/spring-mvc-java/README.md
@@ -10,3 +10,9 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Introduction to Pointcut Expressions in Spring](http://www.baeldung.com/spring-aop-pointcut-tutorial)
- [Introduction to Advice Types in Spring](http://www.baeldung.com/spring-aop-advice-tutorial)
- [A Guide to the ViewResolver in Spring MVC](http://www.baeldung.com/spring-mvc-view-resolver-tutorial)
+- [Integration Testing in Spring](http://www.baeldung.com/integration-testing-in-spring)
+- [Spring JSON-P with Jackson](http://www.baeldung.com/spring-jackson-jsonp)
+- [A Quick Guide to Spring MVC Matrix Variables](http://www.baeldung.com/spring-mvc-matrix-variables)
+- [Intro to WebSockets with Spring](http://www.baeldung.com/websockets-spring)
+- [File Upload with Spring MVC](http://www.baeldung.com/spring-file-upload)
+- [Spring MVC Content Negotiation](http://www.baeldung.com/spring-mvc-content-negotiation-json-xml)
diff --git a/spring-mvc-java/src/main/README.md b/spring-mvc-java/src/main/README.md
new file mode 100644
index 0000000000..20ee1918af
--- /dev/null
+++ b/spring-mvc-java/src/main/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Circular Dependencies in Spring](http://www.baeldung.com/circular-dependencies-in-spring)
diff --git a/spring-mvc-java/src/test/README.md b/spring-mvc-java/src/test/README.md
new file mode 100644
index 0000000000..20ee1918af
--- /dev/null
+++ b/spring-mvc-java/src/test/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Circular Dependencies in Spring](http://www.baeldung.com/circular-dependencies-in-spring)
diff --git a/spring-mvc-java/src/test/java/com/baeldung/web/controller/README.md b/spring-mvc-java/src/test/java/com/baeldung/web/controller/README.md
new file mode 100644
index 0000000000..9923962dde
--- /dev/null
+++ b/spring-mvc-java/src/test/java/com/baeldung/web/controller/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [WebAppConfiguration in Spring Tests](http://www.baeldung.com/spring-webappconfiguration)
diff --git a/spring-mvc-velocity/README.md b/spring-mvc-velocity/README.md
new file mode 100644
index 0000000000..401e135f75
--- /dev/null
+++ b/spring-mvc-velocity/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Quick Guide to Spring MVC with Velocity](http://www.baeldung.com/spring-mvc-with-velocity)
diff --git a/spring-mvc-web-vs-initializer/README.MD b/spring-mvc-web-vs-initializer/README.MD
index 8b13789179..4759cf6137 100644
--- a/spring-mvc-web-vs-initializer/README.MD
+++ b/spring-mvc-web-vs-initializer/README.MD
@@ -1 +1,2 @@
-
+### Relevant Articles:
+- [web.xml vs Initializer with Spring](http://www.baeldung.com/spring-xml-vs-java-config)
diff --git a/spring-mvc-web-vs-initializer/pom.xml b/spring-mvc-web-vs-initializer/pom.xml
index 0d735e7188..b448673ef8 100644
--- a/spring-mvc-web-vs-initializer/pom.xml
+++ b/spring-mvc-web-vs-initializer/pom.xml
@@ -146,17 +146,64 @@
-
- spring-mvc-web-vs-initializer
-
-
- src/main/resources
- true
-
-
-
-
+
+ spring-mvc-web-vs-initializer
+
+
+ src/main/resources
+ true
+
+
+
+
+ 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
+
+
+
+
+
+
+
+
4.3.1.RELEASE
diff --git a/spring-mvc-web-vs-initializer/src/test/java/org/baeldung/controller/JavaServletTest.java b/spring-mvc-web-vs-initializer/src/test/java/org/baeldung/controller/JavaServletIntegrationTest.java
similarity index 97%
rename from spring-mvc-web-vs-initializer/src/test/java/org/baeldung/controller/JavaServletTest.java
rename to spring-mvc-web-vs-initializer/src/test/java/org/baeldung/controller/JavaServletIntegrationTest.java
index 99b5ef8c2f..0461cc8fcc 100644
--- a/spring-mvc-web-vs-initializer/src/test/java/org/baeldung/controller/JavaServletTest.java
+++ b/spring-mvc-web-vs-initializer/src/test/java/org/baeldung/controller/JavaServletIntegrationTest.java
@@ -20,7 +20,7 @@ import org.springframework.web.servlet.ModelAndView;
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(loader=AnnotationConfigWebContextLoader.class, classes = MvcConfig.class)
-public class JavaServletTest {
+public class JavaServletIntegrationTest {
private MockMvc mockMvc;
diff --git a/spring-mvc-web-vs-initializer/src/test/java/org/baeldung/controller/XmlServletTest.java b/spring-mvc-web-vs-initializer/src/test/java/org/baeldung/controller/XmlServletIntegrationTest.java
similarity index 97%
rename from spring-mvc-web-vs-initializer/src/test/java/org/baeldung/controller/XmlServletTest.java
rename to spring-mvc-web-vs-initializer/src/test/java/org/baeldung/controller/XmlServletIntegrationTest.java
index e7695e36c0..e1273f8f88 100644
--- a/spring-mvc-web-vs-initializer/src/test/java/org/baeldung/controller/XmlServletTest.java
+++ b/spring-mvc-web-vs-initializer/src/test/java/org/baeldung/controller/XmlServletIntegrationTest.java
@@ -19,7 +19,7 @@ import org.springframework.web.servlet.ModelAndView;
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(loader=GenericXmlWebContextLoader.class, locations = "classpath*:mvc-configuration.xml")
-public class XmlServletTest {
+public class XmlServletIntegrationTest {
private MockMvc mockMvc;
diff --git a/spring-mvc-xml/README.md b/spring-mvc-xml/README.md
index ce823a9682..783bbb2ef4 100644
--- a/spring-mvc-xml/README.md
+++ b/spring-mvc-xml/README.md
@@ -11,3 +11,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Spring MVC Tutorial](http://www.baeldung.com/spring-mvc-tutorial)
- [Servlet Session Timeout](http://www.baeldung.com/servlet-session-timeout)
- [Basic Forms with Spring MVC](http://www.baeldung.com/spring-mvc-form-tutorial)
+- [Returning Image/Media Data with Spring MVC](http://www.baeldung.com/spring-mvc-image-media-data)
diff --git a/spring-protobuf/README.md b/spring-protobuf/README.md
new file mode 100644
index 0000000000..dad0e3f54a
--- /dev/null
+++ b/spring-protobuf/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Spring REST API with Protocol Buffers](http://www.baeldung.com/spring-rest-api-with-protocol-buffers)
diff --git a/spring-protobuf/pom.xml b/spring-protobuf/pom.xml
index 1275d72edf..a080d51221 100644
--- a/spring-protobuf/pom.xml
+++ b/spring-protobuf/pom.xml
@@ -37,7 +37,6 @@
org.apache.httpcomponents
httpclient
- 4.5.2
@@ -47,12 +46,57 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.3
1.8
1.8
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ **/*IntegrationTest.java
+ **/*LiveTest.java
+
+
+
+
+
+
+ integration
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ integration-test
+
+ test
+
+
+
+ **/*LiveTest.java
+
+
+ **/*IntegrationTest.java
+
+
+
+
+
+
+ json
+
+
+
+
+
+
+
diff --git a/spring-protobuf/src/test/java/com/baeldung/protobuf/ApplicationTest.java b/spring-protobuf/src/test/java/com/baeldung/protobuf/ApplicationIntegrationTest.java
similarity index 98%
rename from spring-protobuf/src/test/java/com/baeldung/protobuf/ApplicationTest.java
rename to spring-protobuf/src/test/java/com/baeldung/protobuf/ApplicationIntegrationTest.java
index a17082cea7..914cf18627 100644
--- a/spring-protobuf/src/test/java/com/baeldung/protobuf/ApplicationTest.java
+++ b/spring-protobuf/src/test/java/com/baeldung/protobuf/ApplicationIntegrationTest.java
@@ -24,7 +24,7 @@ import static org.junit.Assert.assertThat;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Application.class)
@WebIntegrationTest
-public class ApplicationTest {
+public class ApplicationIntegrationTest {
private static final String COURSE1_URL = "http://localhost:8080/courses/1";
diff --git a/spring-rest-angular/pom.xml b/spring-rest-angular/pom.xml
index 981ee9dabc..ce496df742 100644
--- a/spring-rest-angular/pom.xml
+++ b/spring-rest-angular/pom.xml
@@ -71,30 +71,75 @@
-
- angular-spring-rest-sample
-
+
+ angular-spring-rest-sample
+
-
- 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
-
- false
-
-
+
+ org.apache.maven.plugins
+ maven-war-plugin
+
+ false
+
+
-
-
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ **/*IntegrationTest.java
+ **/*LiveTest.java
+
+
+
+
+
+
+
+ integration
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ integration-test
+
+ test
+
+
+
+ **/*LiveTest.java
+
+
+ **/*IntegrationTest.java
+
+
+
+
+
+
+ json
+
+
+
+
+
+
+
+
19.0
diff --git a/spring-rest-angular/src/test/java/org/baeldung/web/service/StudentServiceTest.java b/spring-rest-angular/src/test/java/org/baeldung/web/service/StudentServiceIntegrationTest.java
similarity index 98%
rename from spring-rest-angular/src/test/java/org/baeldung/web/service/StudentServiceTest.java
rename to spring-rest-angular/src/test/java/org/baeldung/web/service/StudentServiceIntegrationTest.java
index 1199f15ab3..6ad80e5caf 100644
--- a/spring-rest-angular/src/test/java/org/baeldung/web/service/StudentServiceTest.java
+++ b/spring-rest-angular/src/test/java/org/baeldung/web/service/StudentServiceIntegrationTest.java
@@ -18,7 +18,7 @@ import static org.hamcrest.core.IsEqual.*;
@SpringApplicationConfiguration(classes = Application.class)
@WebAppConfiguration
@IntegrationTest("server.port:8888")
-public class StudentServiceTest {
+public class StudentServiceIntegrationTest {
private static final String ENDPOINT = "http://localhost:8888/student/get";
diff --git a/spring-rest-docs/README.MD b/spring-rest-docs/README.MD
index 2a87b46021..f5d001d126 100644
--- a/spring-rest-docs/README.MD
+++ b/spring-rest-docs/README.MD
@@ -1,2 +1,5 @@
###The Course
The "REST With Spring" Classes: http://bit.ly/restwithspring
+
+###Relevant Articles:
+- [Introduction to Spring REST Docs](http://www.baeldung.com/spring-rest-docs)
diff --git a/spring-rest/README.md b/spring-rest/README.md
index 7d993b38b8..671fa4996b 100644
--- a/spring-rest/README.md
+++ b/spring-rest/README.md
@@ -1,12 +1,12 @@
-=========
-
## Spring REST Example Project
###The Course
The "REST With Spring" Classes: http://bit.ly/restwithspring
-### Relevant Articles:
+### Relevant Articles:
- [Spring @RequestMapping](http://www.baeldung.com/spring-requestmapping)
- [Http Message Converters with the Spring Framework](http://www.baeldung.com/spring-httpmessageconverter-rest)
- [Redirect in Spring](http://www.baeldung.com/spring-redirect-and-forward)
- [Returning Custom Status Codes from Spring Controllers](http://www.baeldung.com/spring-mvc-controller-custom-http-status-code)
+- [A Guide to OkHttp](http://www.baeldung.com/guide-to-okhttp)
+- [Binary Data Formats in a Spring REST API](http://www.baeldung.com/spring-rest-api-with-binary-data-formats)
diff --git a/spring-rest/pom.xml b/spring-rest/pom.xml
index 18cb1dc72a..69ab4ed361 100644
--- a/spring-rest/pom.xml
+++ b/spring-rest/pom.xml
@@ -15,7 +15,7 @@
-
+
org.springframework.boot
spring-boot-starter-thymeleaf
@@ -71,7 +71,7 @@
com.fasterxml.jackson.core
jackson-databind
-
+
com.fasterxml.jackson.dataformat
jackson-dataformat-xml
@@ -118,6 +118,14 @@
log4j-over-slf4j
+
+
+
+ com.squareup.okhttp3
+ okhttp
+ ${com.squareup.okhttp3.version}
+
+
@@ -153,14 +161,14 @@
rest-assured
${rest-assured.version}
-
+
com.google.protobuf
protobuf-java
2.6.1
-
+
com.esotericsoftware
kryo
@@ -198,7 +206,7 @@
maven-surefire-plugin
- **/*LiveTest.java
+ **/*LiveTest.java
@@ -285,7 +293,7 @@
-
+
@@ -320,6 +328,9 @@
2.19.1
1.6.0
+
+ 3.4.1
+
diff --git a/okhttp/src/main/java/org/baeldung/okhttp/DefaultContentTypeInterceptor.java b/spring-rest/src/test/java/org/baeldung/okhttp/DefaultContentTypeInterceptor.java
similarity index 100%
rename from okhttp/src/main/java/org/baeldung/okhttp/DefaultContentTypeInterceptor.java
rename to spring-rest/src/test/java/org/baeldung/okhttp/DefaultContentTypeInterceptor.java
diff --git a/okhttp/src/test/java/org/baeldung/okhttp/OkHttpFileUploadingTest.java b/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpFileUploadingLiveTest.java
similarity index 89%
rename from okhttp/src/test/java/org/baeldung/okhttp/OkHttpFileUploadingTest.java
rename to spring-rest/src/test/java/org/baeldung/okhttp/OkHttpFileUploadingLiveTest.java
index 32457fc11b..d1cc67b99a 100644
--- a/okhttp/src/test/java/org/baeldung/okhttp/OkHttpFileUploadingTest.java
+++ b/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpFileUploadingLiveTest.java
@@ -18,12 +18,12 @@ import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
-public class OkHttpFileUploadingTest {
+public class OkHttpFileUploadingLiveTest {
private static final String BASE_URL = "http://localhost:8080/spring-rest";
@Test
- public void whenUploadFileUsingOkHttp_thenCorrect() throws IOException {
+ public void whenUploadFile_thenCorrect() throws IOException {
OkHttpClient client = new OkHttpClient();
@@ -45,7 +45,7 @@ public class OkHttpFileUploadingTest {
}
@Test
- public void whenGetUploadFileProgressUsingOkHttp_thenCorrect() throws IOException {
+ public void whenGetUploadFileProgress_thenCorrect() throws IOException {
OkHttpClient client = new OkHttpClient();
diff --git a/okhttp/src/test/java/org/baeldung/okhttp/OkHttpGetTest.java b/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpGetLiveTest.java
similarity index 83%
rename from okhttp/src/test/java/org/baeldung/okhttp/OkHttpGetTest.java
rename to spring-rest/src/test/java/org/baeldung/okhttp/OkHttpGetLiveTest.java
index e8edff92df..9a49c8d9a2 100644
--- a/okhttp/src/test/java/org/baeldung/okhttp/OkHttpGetTest.java
+++ b/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpGetLiveTest.java
@@ -14,12 +14,12 @@ import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
-public class OkHttpGetTest {
+public class OkHttpGetLiveTest {
private static final String BASE_URL = "http://localhost:8080/spring-rest";
@Test
- public void whenGetRequestUsingOkHttp_thenCorrect() throws IOException {
+ public void whenGetRequest_thenCorrect() throws IOException {
OkHttpClient client = new OkHttpClient();
@@ -34,7 +34,7 @@ public class OkHttpGetTest {
}
@Test
- public void whenGetRequestWithQueryParameterUsingOkHttp_thenCorrect() throws IOException {
+ public void whenGetRequestWithQueryParameter_thenCorrect() throws IOException {
OkHttpClient client = new OkHttpClient();
@@ -54,7 +54,7 @@ public class OkHttpGetTest {
}
@Test
- public void whenAsynchronousGetRequestUsingOkHttp_thenCorrect() {
+ public void whenAsynchronousGetRequest_thenCorrect() {
OkHttpClient client = new OkHttpClient();
diff --git a/okhttp/src/test/java/org/baeldung/okhttp/OkHttpHeaderTest.java b/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpHeaderLiveTest.java
similarity index 80%
rename from okhttp/src/test/java/org/baeldung/okhttp/OkHttpHeaderTest.java
rename to spring-rest/src/test/java/org/baeldung/okhttp/OkHttpHeaderLiveTest.java
index 5b2e89eca8..8eddfcb135 100644
--- a/okhttp/src/test/java/org/baeldung/okhttp/OkHttpHeaderTest.java
+++ b/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpHeaderLiveTest.java
@@ -9,12 +9,12 @@ import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
-public class OkHttpHeaderTest {
+public class OkHttpHeaderLiveTest {
private static final String SAMPLE_URL = "http://www.github.com";
@Test
- public void whenSetHeaderUsingOkHttp_thenCorrect() throws IOException {
+ public void whenSetHeader_thenCorrect() throws IOException {
OkHttpClient client = new OkHttpClient();
@@ -29,7 +29,7 @@ public class OkHttpHeaderTest {
}
@Test
- public void whenSetDefaultHeaderUsingOkHttp_thenCorrect() throws IOException {
+ public void whenSetDefaultHeader_thenCorrect() throws IOException {
OkHttpClient client = new OkHttpClient.Builder()
.addInterceptor(new DefaultContentTypeInterceptor("application/json"))
diff --git a/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpMiscLiveTest.java b/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpMiscLiveTest.java
new file mode 100644
index 0000000000..c44500f4be
--- /dev/null
+++ b/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpMiscLiveTest.java
@@ -0,0 +1,107 @@
+package org.baeldung.okhttp;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import okhttp3.Cache;
+import okhttp3.Call;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.Response;
+
+public class OkHttpMiscLiveTest {
+
+ private static final String BASE_URL = "http://localhost:8080/spring-rest";
+ private static Logger logger = LoggerFactory.getLogger(OkHttpMiscLiveTest.class);
+
+ @Test
+ public void whenSetRequestTimeout_thenFail() throws IOException {
+
+ OkHttpClient client = new OkHttpClient.Builder()
+ .readTimeout(1, TimeUnit.SECONDS)
+ .build();
+
+ Request request = new Request.Builder()
+ .url(BASE_URL + "/delay/2") // This URL is served with a 2 second delay.
+ .build();
+
+ Call call = client.newCall(request);
+ Response response = call.execute();
+ response.close();
+ }
+
+ @Test
+ public void whenCancelRequest_thenCorrect() throws IOException {
+
+ ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
+
+ OkHttpClient client = new OkHttpClient();
+
+ Request request = new Request.Builder()
+ .url(BASE_URL + "/delay/2") // This URL is served with a 2 second delay.
+ .build();
+
+ final int seconds = 1;
+
+ final long startNanos = System.nanoTime();
+ final Call call = client.newCall(request);
+
+ // Schedule a job to cancel the call in 1 second.
+ executor.schedule(new Runnable() {
+ public void run() {
+
+ logger.debug("Canceling call: " + (System.nanoTime() - startNanos) / 1e9f);
+ call.cancel();
+ logger.debug("Canceled call: " + (System.nanoTime() - startNanos) / 1e9f);
+ }
+ }, seconds, TimeUnit.SECONDS);
+
+ try {
+
+ logger.debug("Executing call: " + (System.nanoTime() - startNanos) / 1e9f);
+ Response response = call.execute();
+ logger.debug("Call was expected to fail, but completed: " + (System.nanoTime() - startNanos) / 1e9f, response);
+
+ } catch (IOException e) {
+
+ logger.debug("Call failed as expected: " + (System.nanoTime() - startNanos) / 1e9f, e);
+ }
+ }
+
+ @Test
+ public void whenSetResponseCache_thenCorrect() throws IOException {
+
+ int cacheSize = 10 * 1024 * 1024; // 10 MiB
+ File cacheDirectory = new File("src/test/resources/cache");
+ Cache cache = new Cache(cacheDirectory, cacheSize);
+
+ OkHttpClient client = new OkHttpClient.Builder()
+ .cache(cache)
+ .build();
+
+ Request request = new Request.Builder()
+ .url("http://publicobject.com/helloworld.txt")
+ .build();
+
+ Response response1 = client.newCall(request).execute();
+ logResponse(response1);
+
+ Response response2 = client.newCall(request).execute();
+ logResponse(response2);
+ }
+
+ private void logResponse(Response response) throws IOException {
+
+ logger.debug("Response response: " + response);
+ logger.debug("Response cache response: " + response.cacheResponse());
+ logger.debug("Response network response: " + response.networkResponse());
+ logger.debug("Response responseBody: " + response.body().string());
+ }
+}
diff --git a/okhttp/src/test/java/org/baeldung/okhttp/OkHttpPostingTest.java b/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpPostingLiveTest.java
similarity index 85%
rename from okhttp/src/test/java/org/baeldung/okhttp/OkHttpPostingTest.java
rename to spring-rest/src/test/java/org/baeldung/okhttp/OkHttpPostingLiveTest.java
index 1ba2d517c5..18bd4cdcb3 100644
--- a/okhttp/src/test/java/org/baeldung/okhttp/OkHttpPostingTest.java
+++ b/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpPostingLiveTest.java
@@ -18,13 +18,13 @@ import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
-public class OkHttpPostingTest {
+public class OkHttpPostingLiveTest {
private static final String BASE_URL = "http://localhost:8080/spring-rest";
private static final String URL_SECURED_BY_BASIC_AUTHENTICATION = "http://browserspy.dk/password-ok.php";
@Test
- public void whenSendPostRequestUsingOkHttp_thenCorrect() throws IOException {
+ public void whenSendPostRequest_thenCorrect() throws IOException {
OkHttpClient client = new OkHttpClient();
@@ -45,7 +45,7 @@ public class OkHttpPostingTest {
}
@Test
- public void whenSendPostRequestWithAuthorizationUsingOkHttp_thenCorrect() throws IOException {
+ public void whenSendPostRequestWithAuthorization_thenCorrect() throws IOException {
String postBody = "test post";
@@ -64,7 +64,7 @@ public class OkHttpPostingTest {
}
@Test
- public void whenPostJsonUsingOkHttp_thenCorrect() throws IOException {
+ public void whenPostJson_thenCorrect() throws IOException {
OkHttpClient client = new OkHttpClient();
@@ -84,7 +84,7 @@ public class OkHttpPostingTest {
}
@Test
- public void whenSendMultipartRequestUsingOkHttp_thenCorrect() throws IOException {
+ public void whenSendMultipartRequest_thenCorrect() throws IOException {
OkHttpClient client = new OkHttpClient();
diff --git a/okhttp/src/test/java/org/baeldung/okhttp/OkHttpRedirectTest.java b/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpRedirectLiveTest.java
similarity index 80%
rename from okhttp/src/test/java/org/baeldung/okhttp/OkHttpRedirectTest.java
rename to spring-rest/src/test/java/org/baeldung/okhttp/OkHttpRedirectLiveTest.java
index 1582a5ff7f..d568a4fdf7 100644
--- a/okhttp/src/test/java/org/baeldung/okhttp/OkHttpRedirectTest.java
+++ b/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpRedirectLiveTest.java
@@ -12,10 +12,10 @@ import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
-public class OkHttpRedirectTest {
+public class OkHttpRedirectLiveTest {
@Test
- public void whenSetFollowRedirectsUsingOkHttp_thenNotRedirected() throws IOException {
+ public void whenSetFollowRedirects_thenNotRedirected() throws IOException {
OkHttpClient client = new OkHttpClient().newBuilder()
.followRedirects(false)
diff --git a/okhttp/src/main/java/org/baeldung/okhttp/ProgressRequestWrapper.java b/spring-rest/src/test/java/org/baeldung/okhttp/ProgressRequestWrapper.java
similarity index 89%
rename from okhttp/src/main/java/org/baeldung/okhttp/ProgressRequestWrapper.java
rename to spring-rest/src/test/java/org/baeldung/okhttp/ProgressRequestWrapper.java
index 6a98f8d20a..255d10b98a 100644
--- a/okhttp/src/main/java/org/baeldung/okhttp/ProgressRequestWrapper.java
+++ b/spring-rest/src/test/java/org/baeldung/okhttp/ProgressRequestWrapper.java
@@ -1,11 +1,16 @@
package org.baeldung.okhttp;
-import okhttp3.MediaType;
import okhttp3.RequestBody;
-import okio.*;
+import okhttp3.MediaType;
import java.io.IOException;
+import okio.Buffer;
+import okio.BufferedSink;
+import okio.ForwardingSink;
+import okio.Okio;
+import okio.Sink;
+
public class ProgressRequestWrapper extends RequestBody {
protected RequestBody delegate;
@@ -61,6 +66,7 @@ public class ProgressRequestWrapper extends RequestBody {
}
public interface ProgressListener {
+
void onRequestProgress(long bytesWritten, long contentLength);
}
diff --git a/okhttp/src/test/resources/test.txt b/spring-rest/src/test/resources/test.txt
similarity index 100%
rename from okhttp/src/test/resources/test.txt
rename to spring-rest/src/test/resources/test.txt
diff --git a/spring-security-custom-permission/README.MD b/spring-security-custom-permission/README.MD
index 5ac974203b..760cf41c63 100644
--- a/spring-security-custom-permission/README.MD
+++ b/spring-security-custom-permission/README.MD
@@ -1,2 +1,5 @@
###The Course
The "REST With Spring" Classes: http://github.learnspringsecurity.com
+
+###Relevant Articles:
+- [A Custom Security Expression with Spring Security](http://www.baeldung.com/spring-security-create-new-custom-security-expression)
diff --git a/spring-security-mvc-login/README.md b/spring-security-mvc-login/README.md
index 7cddc42e1d..d1f6b884b1 100644
--- a/spring-security-mvc-login/README.md
+++ b/spring-security-mvc-login/README.md
@@ -9,7 +9,7 @@ The "Learn Spring Security" Classes: http://github.learnspringsecurity.com
- [Spring Security Form Login](http://www.baeldung.com/spring-security-login)
- [Spring Security Logout](http://www.baeldung.com/spring-security-logout)
- [Spring Security Expressions – hasRole Example](http://www.baeldung.com/spring-security-expressions-basic)
-
+- [Spring HTTP/HTTPS Channel Security](http://www.baeldung.com/spring-channel-security-https)
### Build the Project
```
diff --git a/spring-security-rest-full/README.md b/spring-security-rest-full/README.md
index 1cbe1191a8..faeeac1ec2 100644
--- a/spring-security-rest-full/README.md
+++ b/spring-security-rest-full/README.md
@@ -25,6 +25,10 @@ The "Learn Spring Security" Classes: http://github.learnspringsecurity.com
- [REST Query Language with RSQL](http://www.baeldung.com/rest-api-search-language-rsql-fiql)
- [Spring RestTemplate Tutorial](http://www.baeldung.com/rest-template)
- [A Guide to CSRF Protection in Spring Security](http://www.baeldung.com/spring-security-csrf)
+- [Intro to Spring Security Expressions](http://www.baeldung.com/spring-security-expressions)
+- [Changing Spring Model Parameters with Handler Interceptor](http://www.baeldung.com/spring-model-parameters-with-handler-interceptor)
+- [Introduction to Spring MVC HandlerInterceptor](http://www.baeldung.com/spring-mvc-handlerinterceptor)
+- [Using a Custom Spring MVC’s Handler Interceptor to Manage Sessions](http://www.baeldung.com/spring-mvc-custom-handler-interceptor)
### Build the Project
```
diff --git a/spring-security-rest-full/pom.xml b/spring-security-rest-full/pom.xml
index b354e61b35..5cd0ed51f3 100644
--- a/spring-security-rest-full/pom.xml
+++ b/spring-security-rest-full/pom.xml
@@ -339,7 +339,7 @@
- 8080
+ 8082
@@ -386,10 +386,45 @@
- none
+ **/*LiveTest.java
**/*IntegrationTest.java
+
+
+
+
+
+
+ json
+
+
+
+
+
+
+
+
+
+ live
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ integration-test
+
+ test
+
+
+
+ **/*IntegrationTest.java
+
+
**/*LiveTest.java
diff --git a/spring-security-rest-full/src/main/java/org/baeldung/spring/Application.java b/spring-security-rest-full/src/main/java/org/baeldung/spring/Application.java
index c44e37fee8..f8bc6c0160 100644
--- a/spring-security-rest-full/src/main/java/org/baeldung/spring/Application.java
+++ b/spring-security-rest-full/src/main/java/org/baeldung/spring/Application.java
@@ -10,7 +10,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
/**
* Main Application Class - uses Spring Boot. Just run this as a normal Java
- * class to run up a Jetty Server (on http://localhost:8080)
+ * class to run up a Jetty Server (on http://localhost:8082/spring-security-rest-full)
*
*/
@EnableScheduling
diff --git a/spring-security-rest-full/src/main/java/org/baeldung/spring/PersistenceConfig.java b/spring-security-rest-full/src/main/java/org/baeldung/spring/PersistenceConfig.java
index dad4808a56..f3a87b189e 100644
--- a/spring-security-rest-full/src/main/java/org/baeldung/spring/PersistenceConfig.java
+++ b/spring-security-rest-full/src/main/java/org/baeldung/spring/PersistenceConfig.java
@@ -23,7 +23,7 @@ import com.google.common.base.Preconditions;
@Configuration
@EnableTransactionManagement
-@PropertySource({ "classpath:persistence-${envTarget:mysql}.properties" })
+@PropertySource({ "classpath:persistence-${envTarget:h2}.properties" })
@ComponentScan({ "org.baeldung.persistence" })
// @ImportResource("classpath*:springDataPersistenceConfig.xml")
@EnableJpaRepositories(basePackages = "org.baeldung.persistence.dao")
diff --git a/spring-security-rest-full/src/main/java/org/baeldung/web/hateoas/listener/PaginatedResultsRetrievedDiscoverabilityListener.java b/spring-security-rest-full/src/main/java/org/baeldung/web/hateoas/listener/PaginatedResultsRetrievedDiscoverabilityListener.java
index 312ead0ab0..603c91007d 100644
--- a/spring-security-rest-full/src/main/java/org/baeldung/web/hateoas/listener/PaginatedResultsRetrievedDiscoverabilityListener.java
+++ b/spring-security-rest-full/src/main/java/org/baeldung/web/hateoas/listener/PaginatedResultsRetrievedDiscoverabilityListener.java
@@ -77,7 +77,7 @@ class PaginatedResultsRetrievedDiscoverabilityListener implements ApplicationLis
}
final boolean hasNextPage(final int page, final int totalPages) {
- return page < totalPages - 1;
+ return page < (totalPages - 1);
}
final boolean hasPreviousPage(final int page) {
@@ -89,7 +89,7 @@ class PaginatedResultsRetrievedDiscoverabilityListener implements ApplicationLis
}
final boolean hasLastPage(final int page, final int totalPages) {
- return totalPages > 1 && hasNextPage(page, totalPages);
+ return (totalPages > 1) && hasNextPage(page, totalPages);
}
final void appendCommaIfNecessary(final StringBuilder linkHeader) {
@@ -102,7 +102,7 @@ class PaginatedResultsRetrievedDiscoverabilityListener implements ApplicationLis
protected void plural(final UriComponentsBuilder uriBuilder, final Class clazz) {
final String resourceName = clazz.getSimpleName().toLowerCase() + "s";
- uriBuilder.path("/" + resourceName);
+ uriBuilder.path("/auth/" + resourceName);
}
}
diff --git a/spring-security-rest-full/src/main/resources/application.properties b/spring-security-rest-full/src/main/resources/application.properties
new file mode 100644
index 0000000000..58c6f8eec7
--- /dev/null
+++ b/spring-security-rest-full/src/main/resources/application.properties
@@ -0,0 +1,2 @@
+server.port=8082
+server.context-path=/spring-security-rest-full
\ No newline at end of file
diff --git a/spring-security-rest-full/src/main/resources/data.sql b/spring-security-rest-full/src/main/resources/data.sql
new file mode 100644
index 0000000000..5fba12dd85
--- /dev/null
+++ b/spring-security-rest-full/src/main/resources/data.sql
@@ -0,0 +1,5 @@
+insert into User (id, firstName, lastName, email, age) values (1, 'john', 'doe', 'john@doe.com', 22);
+insert into User (id, firstName, lastName, email, age) values (2, 'tom', 'doe', 'tom@doe.com', 26);
+
+insert into MyUser (id, firstName, lastName, email, age) values (1, 'john', 'doe', 'john@doe.com', 22);
+insert into MyUser (id, firstName, lastName, email, age) values (2, 'tom', 'doe', 'tom@doe.com', 26);
diff --git a/spring-security-rest-full/src/test/resources/persistence-mysql.properties b/spring-security-rest-full/src/main/resources/persistence-h2.properties
similarity index 100%
rename from spring-security-rest-full/src/test/resources/persistence-mysql.properties
rename to spring-security-rest-full/src/main/resources/persistence-h2.properties
diff --git a/spring-security-rest-full/src/test/java/org/baeldung/Consts.java b/spring-security-rest-full/src/test/java/org/baeldung/Consts.java
index 9c44d63c4d..e5f0be160f 100644
--- a/spring-security-rest-full/src/test/java/org/baeldung/Consts.java
+++ b/spring-security-rest-full/src/test/java/org/baeldung/Consts.java
@@ -1,5 +1,5 @@
package org.baeldung;
public interface Consts {
- int APPLICATION_PORT = 8080;
+ int APPLICATION_PORT = 8082;
}
diff --git a/spring-security-rest-full/src/test/java/org/baeldung/client/RestTemplateLiveTest.java b/spring-security-rest-full/src/test/java/org/baeldung/client/RestTemplateLiveTest.java
index fb40bd9d62..a1cd9fcfe1 100644
--- a/spring-security-rest-full/src/test/java/org/baeldung/client/RestTemplateLiveTest.java
+++ b/spring-security-rest-full/src/test/java/org/baeldung/client/RestTemplateLiveTest.java
@@ -51,7 +51,7 @@ import com.google.common.base.Charsets;
public class RestTemplateLiveTest {
private RestTemplate restTemplate;
- private static final String fooResourceUrl = "http://localhost:" + APPLICATION_PORT + "/foos";
+ private static final String fooResourceUrl = "http://localhost:" + APPLICATION_PORT + "/spring-security-rest-full/auth/foos";
@Before
public void beforeTest() {
diff --git a/spring-security-rest-full/src/test/java/org/baeldung/common/web/AbstractLiveTest.java b/spring-security-rest-full/src/test/java/org/baeldung/common/web/AbstractLiveTest.java
index 95fce10e45..a2890d8643 100644
--- a/spring-security-rest-full/src/test/java/org/baeldung/common/web/AbstractLiveTest.java
+++ b/spring-security-rest-full/src/test/java/org/baeldung/common/web/AbstractLiveTest.java
@@ -57,7 +57,7 @@ public abstract class AbstractLiveTest {
//
protected String getURL() {
- return "http://localhost:" + APPLICATION_PORT + "/foos";
+ return "http://localhost:" + APPLICATION_PORT + "/spring-security-rest-full/auth/foos";
}
protected final RequestSpecification givenAuth() {
diff --git a/spring-security-rest-full/src/test/java/org/baeldung/persistence/query/JPACriteriaQueryTest.java b/spring-security-rest-full/src/test/java/org/baeldung/persistence/query/JPACriteriaQueryTest.java
index e9c8659347..1d0826e6ba 100644
--- a/spring-security-rest-full/src/test/java/org/baeldung/persistence/query/JPACriteriaQueryTest.java
+++ b/spring-security-rest-full/src/test/java/org/baeldung/persistence/query/JPACriteriaQueryTest.java
@@ -36,15 +36,15 @@ public class JPACriteriaQueryTest {
@Before
public void init() {
userJohn = new User();
- userJohn.setFirstName("John");
- userJohn.setLastName("Doe");
+ userJohn.setFirstName("john");
+ userJohn.setLastName("doe");
userJohn.setEmail("john@doe.com");
userJohn.setAge(22);
userApi.save(userJohn);
userTom = new User();
- userTom.setFirstName("Tom");
- userTom.setLastName("Doe");
+ userTom.setFirstName("tom");
+ userTom.setLastName("doe");
userTom.setEmail("tom@doe.com");
userTom.setAge(26);
userApi.save(userTom);
@@ -53,8 +53,8 @@ public class JPACriteriaQueryTest {
@Test
public void givenFirstAndLastName_whenGettingListOfUsers_thenCorrect() {
final List params = new ArrayList();
- params.add(new SearchCriteria("firstName", ":", "John"));
- params.add(new SearchCriteria("lastName", ":", "Doe"));
+ params.add(new SearchCriteria("firstName", ":", "john"));
+ params.add(new SearchCriteria("lastName", ":", "doe"));
final List results = userApi.searchUser(params);
@@ -65,7 +65,7 @@ public class JPACriteriaQueryTest {
@Test
public void givenLast_whenGettingListOfUsers_thenCorrect() {
final List params = new ArrayList();
- params.add(new SearchCriteria("lastName", ":", "Doe"));
+ params.add(new SearchCriteria("lastName", ":", "doe"));
final List results = userApi.searchUser(params);
assertThat(userJohn, isIn(results));
@@ -75,7 +75,7 @@ public class JPACriteriaQueryTest {
@Test
public void givenLastAndAge_whenGettingListOfUsers_thenCorrect() {
final List params = new ArrayList();
- params.add(new SearchCriteria("lastName", ":", "Doe"));
+ params.add(new SearchCriteria("lastName", ":", "doe"));
params.add(new SearchCriteria("age", ">", "25"));
final List results = userApi.searchUser(params);
@@ -87,8 +87,8 @@ public class JPACriteriaQueryTest {
@Test
public void givenWrongFirstAndLast_whenGettingListOfUsers_thenCorrect() {
final List params = new ArrayList();
- params.add(new SearchCriteria("firstName", ":", "Adam"));
- params.add(new SearchCriteria("lastName", ":", "Fox"));
+ params.add(new SearchCriteria("firstName", ":", "adam"));
+ params.add(new SearchCriteria("lastName", ":", "fox"));
final List results = userApi.searchUser(params);
assertThat(userJohn, not(isIn(results)));
@@ -98,7 +98,7 @@ public class JPACriteriaQueryTest {
@Test
public void givenPartialFirst_whenGettingListOfUsers_thenCorrect() {
final List params = new ArrayList();
- params.add(new SearchCriteria("firstName", ":", "Jo"));
+ params.add(new SearchCriteria("firstName", ":", "jo"));
final List results = userApi.searchUser(params);
diff --git a/spring-security-rest-full/src/test/java/org/baeldung/persistence/query/JPAQuerydslTest.java b/spring-security-rest-full/src/test/java/org/baeldung/persistence/query/JPAQuerydslTest.java
index b7b38a4fcb..d5fbc819fd 100644
--- a/spring-security-rest-full/src/test/java/org/baeldung/persistence/query/JPAQuerydslTest.java
+++ b/spring-security-rest-full/src/test/java/org/baeldung/persistence/query/JPAQuerydslTest.java
@@ -35,15 +35,15 @@ public class JPAQuerydslTest {
@Before
public void init() {
userJohn = new MyUser();
- userJohn.setFirstName("John");
- userJohn.setLastName("Doe");
+ userJohn.setFirstName("john");
+ userJohn.setLastName("doe");
userJohn.setEmail("john@doe.com");
userJohn.setAge(22);
repo.save(userJohn);
userTom = new MyUser();
- userTom.setFirstName("Tom");
- userTom.setLastName("Doe");
+ userTom.setFirstName("tom");
+ userTom.setLastName("doe");
userTom.setEmail("tom@doe.com");
userTom.setAge(26);
repo.save(userTom);
@@ -51,7 +51,7 @@ public class JPAQuerydslTest {
@Test
public void givenLast_whenGettingListOfUsers_thenCorrect() {
- final MyUserPredicatesBuilder builder = new MyUserPredicatesBuilder().with("lastName", ":", "Doe");
+ final MyUserPredicatesBuilder builder = new MyUserPredicatesBuilder().with("lastName", ":", "doe");
final Iterable results = repo.findAll(builder.build());
assertThat(results, containsInAnyOrder(userJohn, userTom));
@@ -59,7 +59,7 @@ public class JPAQuerydslTest {
@Test
public void givenFirstAndLastName_whenGettingListOfUsers_thenCorrect() {
- final MyUserPredicatesBuilder builder = new MyUserPredicatesBuilder().with("firstName", ":", "John").with("lastName", ":", "Doe");
+ final MyUserPredicatesBuilder builder = new MyUserPredicatesBuilder().with("firstName", ":", "john").with("lastName", ":", "doe");
final Iterable results = repo.findAll(builder.build());
@@ -69,7 +69,7 @@ public class JPAQuerydslTest {
@Test
public void givenLastAndAge_whenGettingListOfUsers_thenCorrect() {
- final MyUserPredicatesBuilder builder = new MyUserPredicatesBuilder().with("lastName", ":", "Doe").with("age", ">", "25");
+ final MyUserPredicatesBuilder builder = new MyUserPredicatesBuilder().with("lastName", ":", "doe").with("age", ">", "25");
final Iterable results = repo.findAll(builder.build());
@@ -79,7 +79,7 @@ public class JPAQuerydslTest {
@Test
public void givenWrongFirstAndLast_whenGettingListOfUsers_thenCorrect() {
- final MyUserPredicatesBuilder builder = new MyUserPredicatesBuilder().with("firstName", ":", "Adam").with("lastName", ":", "Fox");
+ final MyUserPredicatesBuilder builder = new MyUserPredicatesBuilder().with("firstName", ":", "adam").with("lastName", ":", "fox");
final Iterable results = repo.findAll(builder.build());
assertThat(results, emptyIterable());
diff --git a/spring-security-rest-full/src/test/java/org/baeldung/persistence/query/JPASpecificationLiveTest.java b/spring-security-rest-full/src/test/java/org/baeldung/persistence/query/JPASpecificationLiveTest.java
index 544161dfd5..3b85cfb487 100644
--- a/spring-security-rest-full/src/test/java/org/baeldung/persistence/query/JPASpecificationLiveTest.java
+++ b/spring-security-rest-full/src/test/java/org/baeldung/persistence/query/JPASpecificationLiveTest.java
@@ -3,52 +3,44 @@ package org.baeldung.persistence.query;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import org.baeldung.persistence.dao.UserRepository;
import org.baeldung.persistence.model.User;
-import org.baeldung.spring.ConfigTest;
-import org.baeldung.spring.PersistenceConfig;
import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.test.context.support.AnnotationConfigContextLoader;
import com.jayway.restassured.RestAssured;
import com.jayway.restassured.response.Response;
import com.jayway.restassured.specification.RequestSpecification;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = { ConfigTest.class, PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class)
+//@RunWith(SpringJUnit4ClassRunner.class)
+//@ContextConfiguration(classes = { ConfigTest.class, PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class)
@ActiveProfiles("test")
public class JPASpecificationLiveTest {
- @Autowired
- private UserRepository repository;
+ // @Autowired
+ // private UserRepository repository;
private User userJohn;
private User userTom;
- private final String URL_PREFIX = "http://localhost:8080/users/spec?search=";
+ private final String URL_PREFIX = "http://localhost:8082/spring-security-rest-full/auth/users/spec?search=";
@Before
public void init() {
userJohn = new User();
- userJohn.setFirstName("John");
- userJohn.setLastName("Doe");
+ userJohn.setFirstName("john");
+ userJohn.setLastName("doe");
userJohn.setEmail("john@doe.com");
userJohn.setAge(22);
- repository.save(userJohn);
+ // repository.save(userJohn);
userTom = new User();
- userTom.setFirstName("Tom");
- userTom.setLastName("Doe");
+ userTom.setFirstName("tom");
+ userTom.setLastName("doe");
userTom.setEmail("tom@doe.com");
userTom.setAge(26);
- repository.save(userTom);
+ // repository.save(userTom);
}
@Test
diff --git a/spring-security-rest-full/src/test/java/org/baeldung/persistence/query/JPASpecificationTest.java b/spring-security-rest-full/src/test/java/org/baeldung/persistence/query/JPASpecificationTest.java
index 52bd43cc8c..0d8773dd61 100644
--- a/spring-security-rest-full/src/test/java/org/baeldung/persistence/query/JPASpecificationTest.java
+++ b/spring-security-rest-full/src/test/java/org/baeldung/persistence/query/JPASpecificationTest.java
@@ -38,15 +38,15 @@ public class JPASpecificationTest {
@Before
public void init() {
userJohn = new User();
- userJohn.setFirstName("John");
- userJohn.setLastName("Doe");
+ userJohn.setFirstName("john");
+ userJohn.setLastName("doe");
userJohn.setEmail("john@doe.com");
userJohn.setAge(22);
repository.save(userJohn);
userTom = new User();
- userTom.setFirstName("Tom");
- userTom.setLastName("Doe");
+ userTom.setFirstName("tom");
+ userTom.setLastName("doe");
userTom.setEmail("tom@doe.com");
userTom.setAge(26);
repository.save(userTom);
@@ -54,8 +54,8 @@ public class JPASpecificationTest {
@Test
public void givenFirstAndLastName_whenGettingListOfUsers_thenCorrect() {
- final UserSpecification spec = new UserSpecification(new SpecSearchCriteria("firstName", SearchOperation.EQUALITY, "John"));
- final UserSpecification spec1 = new UserSpecification(new SpecSearchCriteria("lastName", SearchOperation.EQUALITY, "Doe"));
+ final UserSpecification spec = new UserSpecification(new SpecSearchCriteria("firstName", SearchOperation.EQUALITY, "john"));
+ final UserSpecification spec1 = new UserSpecification(new SpecSearchCriteria("lastName", SearchOperation.EQUALITY, "doe"));
final List results = repository.findAll(Specifications.where(spec).and(spec1));
assertThat(userJohn, isIn(results));
@@ -64,7 +64,7 @@ public class JPASpecificationTest {
@Test
public void givenFirstNameInverse_whenGettingListOfUsers_thenCorrect() {
- final UserSpecification spec = new UserSpecification(new SpecSearchCriteria("firstName", SearchOperation.NEGATION, "John"));
+ final UserSpecification spec = new UserSpecification(new SpecSearchCriteria("firstName", SearchOperation.NEGATION, "john"));
final List results = repository.findAll(Specifications.where(spec));
assertThat(userTom, isIn(results));
@@ -82,7 +82,7 @@ public class JPASpecificationTest {
@Test
public void givenFirstNamePrefix_whenGettingListOfUsers_thenCorrect() {
- final UserSpecification spec = new UserSpecification(new SpecSearchCriteria("firstName", SearchOperation.STARTS_WITH, "Jo"));
+ final UserSpecification spec = new UserSpecification(new SpecSearchCriteria("firstName", SearchOperation.STARTS_WITH, "jo"));
final List results = repository.findAll(spec);
assertThat(userJohn, isIn(results));
diff --git a/spring-security-rest-full/src/test/java/org/baeldung/security/csrf/CsrfAbstractIntegrationTest.java b/spring-security-rest-full/src/test/java/org/baeldung/security/csrf/CsrfAbstractIntegrationTest.java
index 13cb92a745..be9b7cf27e 100644
--- a/spring-security-rest-full/src/test/java/org/baeldung/security/csrf/CsrfAbstractIntegrationTest.java
+++ b/spring-security-rest-full/src/test/java/org/baeldung/security/csrf/CsrfAbstractIntegrationTest.java
@@ -23,7 +23,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@Transactional
-public class CsrfAbstractIntegrationTest {
+public abstract class CsrfAbstractIntegrationTest {
@Autowired
private WebApplicationContext context;
@@ -41,7 +41,7 @@ public class CsrfAbstractIntegrationTest {
}
protected RequestPostProcessor testUser() {
- return user("user").password("userPass").roles("USER");
+ return user("user1").password("user1Pass").roles("USER");
}
protected RequestPostProcessor testAdmin() {
diff --git a/spring-security-rest-full/src/test/java/org/baeldung/security/csrf/CsrfEnabledIntegrationTest.java b/spring-security-rest-full/src/test/java/org/baeldung/security/csrf/CsrfEnabledIntegrationTest.java
index c7caf61525..b04644f847 100644
--- a/spring-security-rest-full/src/test/java/org/baeldung/security/csrf/CsrfEnabledIntegrationTest.java
+++ b/spring-security-rest-full/src/test/java/org/baeldung/security/csrf/CsrfEnabledIntegrationTest.java
@@ -15,12 +15,12 @@ public class CsrfEnabledIntegrationTest extends CsrfAbstractIntegrationTest {
@Test
public void givenNoCsrf_whenAddFoo_thenForbidden() throws Exception {
- mvc.perform(post("/foos").contentType(MediaType.APPLICATION_JSON).content(createFoo()).with(testUser())).andExpect(status().isForbidden());
+ mvc.perform(post("/auth/foos").contentType(MediaType.APPLICATION_JSON).content(createFoo()).with(testUser())).andExpect(status().isForbidden());
}
@Test
public void givenCsrf_whenAddFoo_thenCreated() throws Exception {
- mvc.perform(post("/foos").contentType(MediaType.APPLICATION_JSON).content(createFoo()).with(testUser()).with(csrf())).andExpect(status().isCreated());
+ mvc.perform(post("/auth/foos").contentType(MediaType.APPLICATION_JSON).content(createFoo()).with(testUser()).with(csrf())).andExpect(status().isCreated());
}
}
diff --git a/spring-security-rest-full/src/test/java/org/baeldung/security/csrf/SecurityWithCsrfConfig.java b/spring-security-rest-full/src/test/java/org/baeldung/security/csrf/SecurityWithCsrfConfig.java
index 99b94cd7b5..ae4a655265 100644
--- a/spring-security-rest-full/src/test/java/org/baeldung/security/csrf/SecurityWithCsrfConfig.java
+++ b/spring-security-rest-full/src/test/java/org/baeldung/security/csrf/SecurityWithCsrfConfig.java
@@ -41,7 +41,7 @@ public class SecurityWithCsrfConfig extends WebSecurityConfigurerAdapter {
// @formatter:off
http
.authorizeRequests()
- .antMatchers("/admin/*").hasAnyRole("ROLE_ADMIN")
+ .antMatchers("/auth/admin/*").hasAnyRole("ROLE_ADMIN")
.anyRequest().authenticated()
.and()
.httpBasic()
diff --git a/spring-security-rest-full/src/test/java/org/baeldung/web/MyUserLiveTest.java b/spring-security-rest-full/src/test/java/org/baeldung/web/MyUserLiveTest.java
index 835b32c95c..16ed9db253 100644
--- a/spring-security-rest-full/src/test/java/org/baeldung/web/MyUserLiveTest.java
+++ b/spring-security-rest-full/src/test/java/org/baeldung/web/MyUserLiveTest.java
@@ -3,52 +3,28 @@ package org.baeldung.web;
import static org.junit.Assert.assertEquals;
import org.baeldung.persistence.model.MyUser;
-import org.baeldung.spring.ConfigTest;
-import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.http.MediaType;
import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.test.context.support.AnnotationConfigContextLoader;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
import com.jayway.restassured.RestAssured;
import com.jayway.restassured.response.Response;
import com.jayway.restassured.specification.RequestSpecification;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = { ConfigTest.class }, loader = AnnotationConfigContextLoader.class)
@ActiveProfiles("test")
public class MyUserLiveTest {
- private ObjectMapper mapper = new ObjectMapper();
- private MyUser userJohn = new MyUser("john", "doe", "john@test.com", 11);
- private MyUser userTom = new MyUser("tom", "doe", "tom@test.com", 20);
-
- private static boolean setupDataCreated = false;
-
- @Before
- public void setupData() throws JsonProcessingException {
- if (!setupDataCreated) {
- withRequestBody(givenAuth(), userJohn).post("http://localhost:8080/myusers");
- withRequestBody(givenAuth(), userTom).post("http://localhost:8080/myusers");
- setupDataCreated = true;
- }
- }
-
+ private final MyUser userJohn = new MyUser("john", "doe", "john@doe.com", 11);
+ private String URL_PREFIX = "http://localhost:8082/spring-security-rest-full/auth/api/myusers";
@Test
public void whenGettingListOfUsers_thenCorrect() {
- final Response response = givenAuth().get("http://localhost:8080/api/myusers");
+ final Response response = givenAuth().get(URL_PREFIX);
final MyUser[] result = response.as(MyUser[].class);
assertEquals(result.length, 2);
}
@Test
public void givenFirstName_whenGettingListOfUsers_thenCorrect() {
- final Response response = givenAuth().get("http://localhost:8080/api/myusers?firstName=john");
+ final Response response = givenAuth().get(URL_PREFIX + "?firstName=john");
final MyUser[] result = response.as(MyUser[].class);
assertEquals(result.length, 1);
assertEquals(result[0].getEmail(), userJohn.getEmail());
@@ -56,14 +32,14 @@ public class MyUserLiveTest {
@Test
public void givenPartialLastName_whenGettingListOfUsers_thenCorrect() {
- final Response response = givenAuth().get("http://localhost:8080/api/myusers?lastName=do");
+ final Response response = givenAuth().get(URL_PREFIX + "?lastName=do");
final MyUser[] result = response.as(MyUser[].class);
assertEquals(result.length, 2);
}
@Test
public void givenEmail_whenGettingListOfUsers_thenIgnored() {
- final Response response = givenAuth().get("http://localhost:8080/api/myusers?email=john");
+ final Response response = givenAuth().get(URL_PREFIX + "?email=john");
final MyUser[] result = response.as(MyUser[].class);
assertEquals(result.length, 2);
}
@@ -71,8 +47,4 @@ public class MyUserLiveTest {
private RequestSpecification givenAuth() {
return RestAssured.given().auth().preemptive().basic("user1", "user1Pass");
}
-
- private RequestSpecification withRequestBody(final RequestSpecification req, final Object obj) throws JsonProcessingException {
- return req.contentType(MediaType.APPLICATION_JSON_VALUE).body(mapper.writeValueAsString(obj));
- }
}
diff --git a/spring-security-x509/README.md b/spring-security-x509/README.md
new file mode 100644
index 0000000000..2a4b84eae6
--- /dev/null
+++ b/spring-security-x509/README.md
@@ -0,0 +1,2 @@
+Relevant Articles:
+- [X.509 Authentication in Spring Security](http://www.baeldung.com/x-509-authentication-in-spring-security)
diff --git a/spring-security-x509/spring-security-x509-basic-auth/pom.xml b/spring-security-x509/spring-security-x509-basic-auth/pom.xml
index 87fdd64727..8f460c83ec 100644
--- a/spring-security-x509/spring-security-x509-basic-auth/pom.xml
+++ b/spring-security-x509/spring-security-x509-basic-auth/pom.xml
@@ -16,12 +16,59 @@
0.0.1-SNAPSHOT
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ **/*IntegrationTest.java
+ **/*LiveTest.java
+
+
+
+
+
+
+
+
+ integration
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ integration-test
+
+ test
+
+
+
+ **/*LiveTest.java
+
+
+ **/*IntegrationTest.java
+
+
+
+
+
+
+ json
+
+
+
+
+
+
+
+
diff --git a/spring-security-x509/spring-security-x509-basic-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerTests.java b/spring-security-x509/spring-security-x509-basic-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerIntegrationTest.java
similarity index 85%
rename from spring-security-x509/spring-security-x509-basic-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerTests.java
rename to spring-security-x509/spring-security-x509-basic-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerIntegrationTest.java
index 0b9a11552a..5eb1c25ed6 100644
--- a/spring-security-x509/spring-security-x509-basic-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerTests.java
+++ b/spring-security-x509/spring-security-x509-basic-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerIntegrationTest.java
@@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
-public class X509AuthenticationServerTests {
+public class X509AuthenticationServerIntegrationTest {
@Test
public void contextLoads() {
}
diff --git a/spring-security-x509/spring-security-x509-client-auth/pom.xml b/spring-security-x509/spring-security-x509-client-auth/pom.xml
index 56cef8ea07..ffddabef40 100644
--- a/spring-security-x509/spring-security-x509-client-auth/pom.xml
+++ b/spring-security-x509/spring-security-x509-client-auth/pom.xml
@@ -16,12 +16,58 @@
0.0.1-SNAPSHOT
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ **/*IntegrationTest.java
+ **/*LiveTest.java
+
+
+
+
+
+
+
+
+ integration
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ integration-test
+
+ test
+
+
+
+ **/*LiveTest.java
+
+
+ **/*IntegrationTest.java
+
+
+
+
+
+
+ json
+
+
+
+
+
+
+
diff --git a/spring-security-x509/spring-security-x509-client-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerTests.java b/spring-security-x509/spring-security-x509-client-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerIntegrationTest.java
similarity index 85%
rename from spring-security-x509/spring-security-x509-client-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerTests.java
rename to spring-security-x509/spring-security-x509-client-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerIntegrationTest.java
index 0b9a11552a..5eb1c25ed6 100644
--- a/spring-security-x509/spring-security-x509-client-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerTests.java
+++ b/spring-security-x509/spring-security-x509-client-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerIntegrationTest.java
@@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
-public class X509AuthenticationServerTests {
+public class X509AuthenticationServerIntegrationTest {
@Test
public void contextLoads() {
}
diff --git a/spring-spel/README.md b/spring-spel/README.md
new file mode 100644
index 0000000000..d7e69e114c
--- /dev/null
+++ b/spring-spel/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Spring Expression Language Guide](http://www.baeldung.com/spring-expression-language)
diff --git a/spring-spel/pom.xml b/spring-spel/pom.xml
index 12b7164e27..add5e53348 100644
--- a/spring-spel/pom.xml
+++ b/spring-spel/pom.xml
@@ -46,7 +46,53 @@
true
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.19.1
+
+
+ **/*IntegrationTest.java
+ **/*LiveTest.java
+
+
+
+
+
+ integration
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ integration-test
+
+ test
+
+
+
+ **/*LiveTest.java
+
+
+ **/*IntegrationTest.java
+
+
+
+
+
+
+ json
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-spel/src/test/java/com/baeldung/spel/SpelTest.java b/spring-spel/src/test/java/com/baeldung/spel/SpelIntegrationTest.java
similarity index 99%
rename from spring-spel/src/test/java/com/baeldung/spel/SpelTest.java
rename to spring-spel/src/test/java/com/baeldung/spel/SpelIntegrationTest.java
index 5cf18bc1d2..bff42caead 100644
--- a/spring-spel/src/test/java/com/baeldung/spel/SpelTest.java
+++ b/spring-spel/src/test/java/com/baeldung/spel/SpelIntegrationTest.java
@@ -13,7 +13,7 @@ import static org.junit.Assert.assertThat;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext.xml"})
-public class SpelTest {
+public class SpelIntegrationTest {
@Autowired
private SpelArithmetic spelArithmetic = new SpelArithmetic();
diff --git a/spring-thymeleaf/README.md b/spring-thymeleaf/README.md
index 8cb1c2e982..a8ca755044 100644
--- a/spring-thymeleaf/README.md
+++ b/spring-thymeleaf/README.md
@@ -4,7 +4,8 @@
### Relevant Articles:
-
+- [Introduction to Using Thymeleaf in Spring](http://www.baeldung.com/thymeleaf-in-spring-mvc)
+- [CSRF Protection with Spring MVC and Thymeleaf](http://www.baeldung.com/csrf-thymeleaf-with-spring-security)
### Build the Project
diff --git a/spring-thymeleaf/pom.xml b/spring-thymeleaf/pom.xml
index 960b358fe2..d2b3be1651 100644
--- a/spring-thymeleaf/pom.xml
+++ b/spring-thymeleaf/pom.xml
@@ -166,31 +166,47 @@
${maven-surefire-plugin.version}
+ **/*IntegrationTest.java
+ **/*LiveTest.java
-
-
-
-
-
- org.codehaus.cargo
- cargo-maven2-plugin
- ${cargo-maven2-plugin.version}
-
- true
-
- jetty8x
- embedded
-
-
-
-
-
- 8082
-
-
+
+
+
+ integration
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ integration-test
+
+ test
+
+
+
+ **/*LiveTest.java
+
+
+ **/*IntegrationTest.java
+
+
+
+
+
+
+ json
+
+
+
+
+
+
+
diff --git a/spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/ExpressionUtilityObjectsControllerTest.java b/spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/ExpressionUtilityObjectsControllerIntegrationTest.java
similarity index 97%
rename from spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/ExpressionUtilityObjectsControllerTest.java
rename to spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/ExpressionUtilityObjectsControllerIntegrationTest.java
index f6a79b7570..0638dbbc11 100644
--- a/spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/ExpressionUtilityObjectsControllerTest.java
+++ b/spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/ExpressionUtilityObjectsControllerIntegrationTest.java
@@ -29,7 +29,7 @@ import com.baeldung.thymeleaf.config.WebMVCSecurity;
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(classes = { WebApp.class, WebMVCConfig.class, WebMVCSecurity.class, InitSecurity.class })
-public class ExpressionUtilityObjectsControllerTest {
+public class ExpressionUtilityObjectsControllerIntegrationTest {
@Autowired
WebApplicationContext wac;
diff --git a/spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/LayoutDialectControllerTest.java b/spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/LayoutDialectControllerIntegrationTest.java
similarity index 97%
rename from spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/LayoutDialectControllerTest.java
rename to spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/LayoutDialectControllerIntegrationTest.java
index 33731f130d..23113dc229 100644
--- a/spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/LayoutDialectControllerTest.java
+++ b/spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/LayoutDialectControllerIntegrationTest.java
@@ -29,7 +29,7 @@ import com.baeldung.thymeleaf.config.WebMVCSecurity;
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(classes = { WebApp.class, WebMVCConfig.class, WebMVCSecurity.class, InitSecurity.class })
-public class LayoutDialectControllerTest {
+public class LayoutDialectControllerIntegrationTest {
@Autowired
WebApplicationContext wac;
diff --git a/spring-userservice/pom.xml b/spring-userservice/pom.xml
index 93b01ee49c..dc0d4d295c 100644
--- a/spring-userservice/pom.xml
+++ b/spring-userservice/pom.xml
@@ -240,39 +240,52 @@
${maven-surefire-plugin.version}
-
+ **/*IntegrationTest.java
-
-
- org.codehaus.cargo
- cargo-maven2-plugin
- ${cargo-maven2-plugin.version}
-
- true
-
- jetty8x
- embedded
-
-
-
-
-
-
- 8082
-
-
-
-
-
+
+
+ integration
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ integration-test
+
+ test
+
+
+
+ **/*LiveTest.java
+
+
+ **/*IntegrationTest.java
+
+
+
+
+
+
+ json
+
+
+
+
+
+
+
+
4.1.3.RELEASE
diff --git a/spring-userservice/src/test/java/org/baeldung/userservice/CustomUserDetailsServiceTest.java b/spring-userservice/src/test/java/org/baeldung/userservice/CustomUserDetailsServiceIntegrationTest.java
similarity index 98%
rename from spring-userservice/src/test/java/org/baeldung/userservice/CustomUserDetailsServiceTest.java
rename to spring-userservice/src/test/java/org/baeldung/userservice/CustomUserDetailsServiceIntegrationTest.java
index 6e1cd67e06..79d60aa540 100644
--- a/spring-userservice/src/test/java/org/baeldung/userservice/CustomUserDetailsServiceTest.java
+++ b/spring-userservice/src/test/java/org/baeldung/userservice/CustomUserDetailsServiceIntegrationTest.java
@@ -25,7 +25,7 @@ import java.util.logging.Logger;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = { MvcConfig.class, PersistenceDerbyJPAConfig.class, SecSecurityConfig.class })
@WebAppConfiguration
-public class CustomUserDetailsServiceTest {
+public class CustomUserDetailsServiceIntegrationTest {
private static final Logger LOG = Logger.getLogger("CustomUserDetailsServiceTest");
diff --git a/spring-zuul/spring-zuul-ui/pom.xml b/spring-zuul/spring-zuul-ui/pom.xml
index 9eaf4b7c45..99df27f2f9 100644
--- a/spring-zuul/spring-zuul-ui/pom.xml
+++ b/spring-zuul/spring-zuul-ui/pom.xml
@@ -87,5 +87,18 @@
true
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ **/*LiveTest.java
+
+
+
+
+
+
\ No newline at end of file
diff --git a/xml/README.md b/xml/README.md
new file mode 100644
index 0000000000..8531f8b063
--- /dev/null
+++ b/xml/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Intro to XPath with Java](http://www.baeldung.com/java-xpath)
diff --git a/xmlunit2-tutorial/README.md b/xmlunit2-tutorial/README.md
index e69de29bb2..72b683796e 100644
--- a/xmlunit2-tutorial/README.md
+++ b/xmlunit2-tutorial/README.md
@@ -0,0 +1,2 @@
+###Relevant Articles:
+- [Introduction To XMLUnit 2.x](http://www.baeldung.com/xmlunit2)
diff --git a/xstream/README.md b/xstream/README.md
new file mode 100644
index 0000000000..e8302c14ef
--- /dev/null
+++ b/xstream/README.md
@@ -0,0 +1,4 @@
+### Relevant Articles:
+- [XStream User Guide: JSON](http://www.baeldung.com/xstream-json-processing)
+- [XStream User Guide: Converting XML to Objects](http://www.baeldung.com/xstream-deserialize-xml-to-object)
+- [XStream User Guide: Converting Objects to XML](http://www.baeldung.com/xstream-serialize-object-to-xml)