diff --git a/annotations/annotation-processing/pom.xml b/annotations/annotation-processing/pom.xml index 6d07394b87..e88e441b3e 100644 --- a/annotations/annotation-processing/pom.xml +++ b/annotations/annotation-processing/pom.xml @@ -15,7 +15,7 @@ 1.0-rc2 - 3.5.1 + 3.6.0 diff --git a/annotations/annotation-user/pom.xml b/annotations/annotation-user/pom.xml index f76f691f93..a365f35c11 100644 --- a/annotations/annotation-user/pom.xml +++ b/annotations/annotation-user/pom.xml @@ -13,6 +13,11 @@ annotation-user + + 4.12 + 3.6.0 + + @@ -24,7 +29,7 @@ junit junit - 4.12 + ${junit.version} test @@ -37,7 +42,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.5.1 + ${maven-compiler-plugin.version} 1.8 1.8 diff --git a/apache-cxf/cxf-introduction/pom.xml b/apache-cxf/cxf-introduction/pom.xml index 0902bd690e..6e0ceaba7e 100644 --- a/apache-cxf/cxf-introduction/pom.xml +++ b/apache-cxf/cxf-introduction/pom.xml @@ -4,15 +4,18 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 cxf-introduction + com.baeldung apache-cxf 0.0.1-SNAPSHOT + - 3.1.6 + 3.1.8 2.19.1 + @@ -24,7 +27,7 @@ maven-surefire-plugin - 2.19.1 + ${surefire.version} **/*LiveTest.java @@ -33,6 +36,7 @@ + org.apache.cxf diff --git a/apache-cxf/cxf-jaxrs-implementation/README.md b/apache-cxf/cxf-jaxrs-implementation/README.md new file mode 100644 index 0000000000..28c01e6e36 --- /dev/null +++ b/apache-cxf/cxf-jaxrs-implementation/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Apache CXF Support for RESTful Web Services](http://www.baeldung.com/apache-cxf-rest-api) diff --git a/apache-cxf/cxf-jaxrs-implementation/pom.xml b/apache-cxf/cxf-jaxrs-implementation/pom.xml index b3a81aef82..c3095be5a5 100644 --- a/apache-cxf/cxf-jaxrs-implementation/pom.xml +++ b/apache-cxf/cxf-jaxrs-implementation/pom.xml @@ -4,17 +4,20 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 cxf-jaxrs-implementation + com.baeldung apache-cxf 0.0.1-SNAPSHOT + UTF-8 - 3.1.7 + 3.1.8 4.5.2 2.19.1 + @@ -26,7 +29,7 @@ maven-surefire-plugin - 2.19.1 + ${surefire.version} **/*LiveTest.java @@ -35,6 +38,7 @@ + org.apache.cxf diff --git a/apache-cxf/cxf-spring/pom.xml b/apache-cxf/cxf-spring/pom.xml index 8f1dee965a..79a7650ced 100644 --- a/apache-cxf/cxf-spring/pom.xml +++ b/apache-cxf/cxf-spring/pom.xml @@ -33,7 +33,7 @@ javax.servlet javax.servlet-api - 3.1.0 + ${javax.servlet-api.version} @@ -41,7 +41,7 @@ maven-war-plugin - 2.6 + ${maven-war-plugin.version} false @@ -66,7 +66,7 @@ org.codehaus.cargo cargo-maven2-plugin - 1.4.19 + ${cargo-maven2-plugin.version} tomcat8x @@ -121,9 +121,13 @@ - 3.1.6 - 4.3.1.RELEASE + 3.1.8 + 4.3.4.RELEASE + 3.1.0 + + 2.6 2.19.1 + 1.6.1 diff --git a/apache-cxf/pom.xml b/apache-cxf/pom.xml index af7949bb6c..d407527c51 100644 --- a/apache-cxf/pom.xml +++ b/apache-cxf/pom.xml @@ -5,19 +5,28 @@ apache-cxf 0.0.1-SNAPSHOT pom + cxf-introduction cxf-spring cxf-jaxrs-implementation + + + 4.12 + 3.6.0 + 1.5.0 + + junit junit - 4.12 + ${junit.version} test + install @@ -25,7 +34,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.5.1 + ${maven-compiler-plugin.version} 1.8 1.8 @@ -34,7 +43,7 @@ org.codehaus.mojo exec-maven-plugin - 1.5.0 + ${exec-maven-plugin.version} diff --git a/apache-fop/pom.xml b/apache-fop/pom.xml index 949843a47e..4dd61d8f4e 100644 --- a/apache-fop/pom.xml +++ b/apache-fop/pom.xml @@ -67,7 +67,7 @@ org.apache.xmlgraphics fop - 1.1 + ${fop.version} org.apache.avalon.framework @@ -83,18 +83,18 @@ avalon-framework avalon-framework-api - 4.2.0 + ${avalon-framework.version} avalon-framework avalon-framework-impl - 4.2.0 + ${avalon-framework.version} org.dbdoclet dbdoclet - 8.0.2 + ${dbdoclet.version} @@ -108,7 +108,7 @@ net.sf.jtidy jtidy - r938 + ${jtidy.version} @@ -187,40 +187,22 @@ - - 4.3.11.Final - 5.1.38 - - - 2.7.2 - + 1.1 + 4.3 + 8.0.2 + r938 - 1.7.9 - 1.1.2 - - - 5.1.3.Final - - - 19.0 - 3.3.2 + 1.7.21 + 1.1.7 1.3 4.12 1.10.19 - 4.4 - 4.4 - - 2.9.0 - - 3.5.1 - 2.6 + 3.6.0 2.19.1 - 2.7 - 1.4.18 diff --git a/aspectj/pom.xml b/aspectj/pom.xml index 1c409483ec..2fca4031fb 100644 --- a/aspectj/pom.xml +++ b/aspectj/pom.xml @@ -121,12 +121,11 @@ 1.8 - 1.6.11 UTF-8 1.8.9 1.7.21 1.1.7 - 3.5.1 + 3.6.0 4.12 diff --git a/assertj/pom.xml b/assertj/pom.xml index df55ebba4b..0b3bcbacdb 100644 --- a/assertj/pom.xml +++ b/assertj/pom.xml @@ -23,13 +23,13 @@ junit junit - 4.12 + ${junit.version} test org.assertj assertj-core - 3.5.1 + ${assertj-core.version} test @@ -40,7 +40,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.3 + ${maven-compiler-plugin.version} 1.8 1.8 @@ -51,6 +51,11 @@ 19.0 + 3.1.0 + 4.12 + 3.6.1 + + 3.6.0 \ No newline at end of file diff --git a/autovalue/pom.xml b/autovalue/pom.xml index d1f8e825fc..2f6601c30d 100644 --- a/autovalue/pom.xml +++ b/autovalue/pom.xml @@ -5,12 +5,13 @@ autovalue-tutorial 1.0 AutoValue + org.apache.maven.plugins maven-compiler-plugin - 3.3 + ${maven-compiler-plugin.version} 7 7 @@ -19,19 +20,25 @@ + com.google.auto.value auto-value - 1.2 + ${auto-value.version} junit junit - 4.3 + ${junit.version} test - + + + 1.3 + 4.12 + 3.6.0 + diff --git a/cdi/pom.xml b/cdi/pom.xml index 30dd167fa8..231390ea5c 100644 --- a/cdi/pom.xml +++ b/cdi/pom.xml @@ -22,18 +22,18 @@ org.aspectj aspectjweaver - 1.8.9 + ${aspectjweaver.version} org.jboss.weld.se weld-se-core - 2.3.5.Final + ${weld-se-core.version} junit junit - 4.12 + ${junit.version} test @@ -97,7 +97,10 @@ - 4.3.1.RELEASE + 4.3.4.RELEASE + 1.8.9 + 2.4.1.Final + 4.12 2.19.1 diff --git a/core-java-9/pom.xml b/core-java-9/pom.xml index 844ad6a782..bf9325c935 100644 --- a/core-java-9/pom.xml +++ b/core-java-9/pom.xml @@ -76,9 +76,7 @@ - 1.7.13 - 1.0.13 - + 1.7.21 3.6-jigsaw-SNAPSHOT diff --git a/core-java/README.md b/core-java/README.md index 92f124d14b..36dabbef41 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -38,3 +38,6 @@ - [Guide to the Fork/Join Framework in Java](http://www.baeldung.com/java-fork-join) - [How to Print Screen in Java](http://www.baeldung.com/print-screen-in-java) - [How to Convert String to different data types in Java](http://www.baeldung.com/java-string-conversions) +- [Introduction to Java Generics](http://www.baeldung.com/java-generics) +- [Generate equals() and hashCode() with Eclipse](http://www.baeldung.com/java-eclipse-equals-and-hashcode) +- [A Guide To Java Regular Expressions API](http://www.baeldung.com/regular-expressions-java) diff --git a/core-java/pom.xml b/core-java/pom.xml index c3a9611682..0c14da2245 100644 --- a/core-java/pom.xml +++ b/core-java/pom.xml @@ -14,7 +14,7 @@ net.sourceforge.collections collections-generic - 4.01 + ${collections-generic.version} com.google.guava @@ -25,13 +25,13 @@ org.apache.commons commons-collections4 - 4.0 + ${commons-collections4.version} commons-io commons-io - 2.4 + ${commons-io.version} @@ -43,7 +43,7 @@ org.apache.commons commons-math3 - 3.3 + ${commons-math3.version} @@ -122,8 +122,6 @@ test - - org.mockito mockito-core @@ -321,44 +319,33 @@ - - 4.3.11.Final - 5.1.38 - - 2.7.8 + 2.8.5 - 1.7.13 - 1.1.3 - - - 5.1.3.Final + 1.7.21 + 1.1.7 19.0 - 3.4 + 3.5 1.55 1.10 + 3.6.1 + 2.5 + 4.1 + 4.01 1.3 4.12 1.10.19 - 6.8 - 3.5.1 - - 4.4.1 - 4.5 - - 2.9.0 + 6.10 + 3.6.1 - 3.5.1 - 2.6 + 3.6.0 2.19.1 - 2.7 - 1.4.18 diff --git a/core-java/src/main/java/com/baeldung/java/networking/README.md b/core-java/src/main/java/com/baeldung/java/networking/README.md new file mode 100644 index 0000000000..e92122f3bb --- /dev/null +++ b/core-java/src/main/java/com/baeldung/java/networking/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [A Guide To UDP In Java](http://www.baeldung.com/udp-in-java) diff --git a/core-java/src/main/java/com/baeldung/java/nio/selector/README.md b/core-java/src/main/java/com/baeldung/java/nio/selector/README.md new file mode 100644 index 0000000000..b28aae1397 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/java/nio/selector/README.md @@ -0,0 +1,2 @@ +###Relevant Articles: +- [Introduction to the Java NIO Selector](http://www.baeldung.com/java-nio-selector) diff --git a/core-java/src/main/java/com/baeldung/printscreen/README.md b/core-java/src/main/java/com/baeldung/printscreen/README.md new file mode 100644 index 0000000000..7b3b40c102 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/printscreen/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [How to Print Screen in Java](http://www.baeldung.com/print-screen-in-java) diff --git a/core-java/src/main/java/com/baeldung/threadpool/ExitingExecutorServiceExample.java b/core-java/src/main/java/com/baeldung/threadpool/ExitingExecutorServiceExample.java index 4775fde930..d14a290c46 100644 --- a/core-java/src/main/java/com/baeldung/threadpool/ExitingExecutorServiceExample.java +++ b/core-java/src/main/java/com/baeldung/threadpool/ExitingExecutorServiceExample.java @@ -16,10 +16,10 @@ public class ExitingExecutorServiceExample { public static void main(String... args) { - ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(5); - ExecutorService executorService = MoreExecutors.getExitingExecutorService(executor, 100, TimeUnit.MILLISECONDS); + final ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(5); + final ExecutorService executorService = MoreExecutors.getExitingExecutorService(executor, 100, TimeUnit.MILLISECONDS); - executorService.submit(() -> { + executorService.submit((Runnable) () -> { while (true) { } }); diff --git a/core-java/src/test/java/com/baeldung/encoderdecoder/EncoderDecoderUnitTest.java b/core-java/src/test/java/com/baeldung/encoderdecoder/EncoderDecoderUnitTest.java index c944dfa6fe..08f4e0b4bd 100644 --- a/core-java/src/test/java/com/baeldung/encoderdecoder/EncoderDecoderUnitTest.java +++ b/core-java/src/test/java/com/baeldung/encoderdecoder/EncoderDecoderUnitTest.java @@ -7,20 +7,21 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.UnsupportedEncodingException; -import java.net.URL; -import java.net.URLDecoder; -import java.net.URLEncoder; +import java.net.*; import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import static java.util.stream.Collectors.joining; +import static org.hamcrest.CoreMatchers.*; public class EncoderDecoderUnitTest { private static final Logger LOGGER = LoggerFactory.getLogger(EncoderDecoderUnitTest.class); private static final String testUrl = "http://www.baeldung.com?key1=value+1&key2=value%40%21%242&key3=value%253"; + private static final String testUrlWithPath = "http://www.baeldung.com/path+1?key1=value+1&key2=value%40%21%242&key3=value%253"; + private String encodeValue(String value) { String encoded = null; @@ -46,9 +47,9 @@ public class EncoderDecoderUnitTest { public void givenURL_whenAnalyze_thenCorrect() throws Exception { URL url = new URL(testUrl); - Assert.assertThat(url.getProtocol(), CoreMatchers.is("http")); - Assert.assertThat(url.getHost(), CoreMatchers.is("www.baeldung.com")); - Assert.assertThat(url.getQuery(), CoreMatchers.is("key1=value+1&key2=value%40%21%242&key3=value%253")); + Assert.assertThat(url.getProtocol(), is("http")); + Assert.assertThat(url.getHost(), is("www.baeldung.com")); + Assert.assertThat(url.getQuery(), is("key1=value+1&key2=value%40%21%242&key3=value%253")); } @Test @@ -58,9 +59,11 @@ public class EncoderDecoderUnitTest { requestParams.put("key2", "value@!$2"); requestParams.put("key3", "value%3"); - String encodedURL = requestParams.keySet().stream().map(key -> key + "=" + encodeValue(requestParams.get(key))).collect(joining("&", "http://www.baeldung.com?", "")); + String encodedURL = requestParams.keySet().stream() + .map(key -> key + "=" + encodeValue(requestParams.get(key))) + .collect(joining("&", "http://www.baeldung.com?", "")); - Assert.assertThat(testUrl, CoreMatchers.is(encodedURL)); + Assert.assertThat(testUrl, is(encodedURL)); } @Test @@ -74,4 +77,38 @@ public class EncoderDecoderUnitTest { Assert.assertEquals("http://www.baeldung.com?key1=value 1&key2=value@!$2&key3=value%3", url.getProtocol() + "://" + url.getHost() + "?" + decodedQuery); } + private String encodePath(String path) { + try { + path = new URI(null, null, path, null).getPath(); + } catch (URISyntaxException e) { + LOGGER.error("Error encoding parameter {}", e.getMessage(), e); + } + return path; + } + + @Test + public void givenPath_thenEncodeDecodePath() throws URISyntaxException { + URI uri = new URI(null, null, "/Path 1/Path+2", null); + + Assert.assertEquals("/Path 1/Path+2", uri.getPath()); + Assert.assertEquals("/Path%201/Path+2", uri.getRawPath()); + } + + @Test + public void givenPathAndRequestParam_whenUTF8Scheme_thenEncode() throws Exception { + Map requestParams = new HashMap<>(); + requestParams.put("key1", "value 1"); + requestParams.put("key2", "value@!$2"); + requestParams.put("key3", "value%3"); + + String path = "path+1"; + + String encodedURL = requestParams.keySet().stream() + .map(key -> key + "=" + encodeValue(requestParams.get(key))) + .collect(joining("&", "http://www.baeldung.com/" + encodePath(path) + "?", "")); + + Assert.assertThat(testUrlWithPath, is(encodedURL)); + } + + } diff --git a/core-java/src/test/java/com/baeldung/java8/Java8CollectionCleanupUnitTest.java b/core-java/src/test/java/com/baeldung/java8/Java8CollectionCleanupUnitTest.java index ef4b80c6e8..4b900c31a7 100644 --- a/core-java/src/test/java/com/baeldung/java8/Java8CollectionCleanupUnitTest.java +++ b/core-java/src/test/java/com/baeldung/java8/Java8CollectionCleanupUnitTest.java @@ -4,6 +4,7 @@ import com.google.common.collect.Lists; import org.junit.Test; import java.util.List; +import java.util.Objects; import java.util.stream.Collectors; import static org.hamcrest.Matchers.hasSize; @@ -16,7 +17,9 @@ public class Java8CollectionCleanupUnitTest { @Test public void givenListContainsNulls_whenFilteringParallel_thenCorrect() { final List list = Lists.newArrayList(null, 1, 2, null, 3, null); - final List listWithoutNulls = list.parallelStream().filter(i -> i != null).collect(Collectors.toList()); + final List listWithoutNulls = list.parallelStream() + .filter(Objects::nonNull) + .collect(Collectors.toList()); assertThat(listWithoutNulls, hasSize(3)); } @@ -24,7 +27,9 @@ public class Java8CollectionCleanupUnitTest { @Test public void givenListContainsNulls_whenFilteringSerial_thenCorrect() { final List list = Lists.newArrayList(null, 1, 2, null, 3, null); - final List listWithoutNulls = list.stream().filter(i -> i != null).collect(Collectors.toList()); + final List listWithoutNulls = list.stream() + .filter(Objects::nonNull) + .collect(Collectors.toList()); assertThat(listWithoutNulls, hasSize(3)); } @@ -32,7 +37,7 @@ public class Java8CollectionCleanupUnitTest { @Test public void givenListContainsNulls_whenRemovingNullsWithRemoveIf_thenCorrect() { final List listWithoutNulls = Lists.newArrayList(null, 1, 2, null, 3, null); - listWithoutNulls.removeIf(p -> p == null); + listWithoutNulls.removeIf(Objects::isNull); assertThat(listWithoutNulls, hasSize(3)); } @@ -40,7 +45,9 @@ public class Java8CollectionCleanupUnitTest { @Test public void givenListContainsDuplicates_whenRemovingDuplicatesWithJava8_thenCorrect() { final List listWithDuplicates = Lists.newArrayList(1, 1, 2, 2, 3, 3); - final List listWithoutDuplicates = listWithDuplicates.parallelStream().distinct().collect(Collectors.toList()); + final List listWithoutDuplicates = listWithDuplicates.parallelStream() + .distinct() + .collect(Collectors.toList()); assertThat(listWithoutDuplicates, hasSize(3)); } diff --git a/core-java/src/test/java/com/baeldung/java8/JavaTryWithResourcesUnitTest.java b/core-java/src/test/java/com/baeldung/java8/JavaTryWithResourcesLongRunningUnitTest.java similarity index 98% rename from core-java/src/test/java/com/baeldung/java8/JavaTryWithResourcesUnitTest.java rename to core-java/src/test/java/com/baeldung/java8/JavaTryWithResourcesLongRunningUnitTest.java index 4c843ccaaf..b5281f5bf4 100644 --- a/core-java/src/test/java/com/baeldung/java8/JavaTryWithResourcesUnitTest.java +++ b/core-java/src/test/java/com/baeldung/java8/JavaTryWithResourcesLongRunningUnitTest.java @@ -8,7 +8,7 @@ import java.io.StringWriter; import java.util.Date; import java.util.Scanner; -public class JavaTryWithResourcesUnitTest { +public class JavaTryWithResourcesLongRunningUnitTest { private static final String TEST_STRING_HELLO_WORLD = "Hello World"; private Date resource1Date, resource2Date; diff --git a/core-java/src/test/java/com/baeldung/java8/optional/OptionalTest.java b/core-java/src/test/java/com/baeldung/java8/optional/OptionalTest.java index 8aeaf2b9f7..c0538931b0 100644 --- a/core-java/src/test/java/com/baeldung/java8/optional/OptionalTest.java +++ b/core-java/src/test/java/com/baeldung/java8/optional/OptionalTest.java @@ -99,6 +99,7 @@ public class OptionalTest { assertFalse(priceIsInRange1(new Modem(9.9))); assertFalse(priceIsInRange1(new Modem(null))); assertFalse(priceIsInRange1(new Modem(15.5))); + assertFalse(priceIsInRange1(null)); } @@ -108,6 +109,7 @@ public class OptionalTest { assertFalse(priceIsInRange2(new Modem(9.9))); assertFalse(priceIsInRange2(new Modem(null))); assertFalse(priceIsInRange2(new Modem(15.5))); + assertFalse(priceIsInRange1(null)); } public boolean priceIsInRange1(Modem modem) { diff --git a/core-java/src/test/java/org/baeldung/java/collections/JoinSplitCollectionsUnitTest.java b/core-java/src/test/java/org/baeldung/java/collections/JoinSplitCollectionsUnitTest.java index 78f79f646b..16b3509925 100644 --- a/core-java/src/test/java/org/baeldung/java/collections/JoinSplitCollectionsUnitTest.java +++ b/core-java/src/test/java/org/baeldung/java/collections/JoinSplitCollectionsUnitTest.java @@ -15,85 +15,99 @@ public class JoinSplitCollectionsUnitTest { public void whenJoiningTwoArrays_thenJoined() { String[] animals1 = new String[] { "Dog", "Cat" }; String[] animals2 = new String[] { "Bird", "Cow" }; - String[] result = Stream.concat(Arrays.stream(animals1), Arrays.stream(animals2)).toArray(String[]::new); + String[] result = Stream.concat( + Arrays.stream(animals1), Arrays.stream(animals2)).toArray(String[]::new); assertArrayEquals(result, new String[] { "Dog", "Cat", "Bird", "Cow" }); } @Test public void whenJoiningTwoCollections_thenJoined() { - Collection collection1 = Arrays.asList(7, 8, 9); - Collection collection2 = Arrays.asList(10, 11, 12); - Collection result = Stream.concat(collection1.stream(), collection2.stream()).collect(Collectors.toList()); + Collection collection1 = Arrays.asList("Dog", "Cat"); + Collection collection2 = Arrays.asList("Bird", "Cow", "Moose"); + Collection result = Stream.concat( + collection1.stream(), collection2.stream()) + .collect(Collectors.toList()); - assertTrue(result.equals(Arrays.asList(7, 8, 9, 10, 11, 12))); + assertTrue(result.equals(Arrays.asList("Dog", "Cat", "Bird", "Cow", "Moose"))); } @Test public void whenJoiningTwoCollectionsWithFilter_thenJoined() { - Collection collection1 = Arrays.asList(7, 8, 11); - Collection collection2 = Arrays.asList(9, 12, 10); - Collection result = Stream.concat(collection1.stream(), collection2.stream()).filter(next -> next <= 10).collect(Collectors.toList()); + Collection collection1 = Arrays.asList("Dog", "Cat"); + Collection collection2 = Arrays.asList("Bird", "Cow", "Moose"); + Collection result = Stream.concat( + collection1.stream(), collection2.stream()) + .filter(e -> e.length() == 3) + .collect(Collectors.toList()); - assertTrue(result.equals(Arrays.asList(7, 8, 9, 10))); + assertTrue(result.equals(Arrays.asList("Dog", "Cat", "Cow"))); } @Test public void whenConvertArrayToString_thenConverted() { - String[] colors = new String[] { "Red", "Blue", "Green", "Yellow" }; - String result = Arrays.stream(colors).collect(Collectors.joining(", ")); + String[] animals = new String[] { "Dog", "Cat", "Bird", "Cow" }; + String result = Arrays.stream(animals).collect(Collectors.joining(", ")); - assertEquals(result, "Red, Blue, Green, Yellow"); + assertEquals(result, "Dog, Cat, Bird, Cow"); } @Test public void whenConvertCollectionToString_thenConverted() { - Collection directions = Arrays.asList("Left", "Right", "Top", "Bottom"); - String result = directions.stream().collect(Collectors.joining(", ")); + Collection animals = Arrays.asList("Dog", "Cat", "Bird", "Cow"); + String result = animals.stream().collect(Collectors.joining(", ")); - assertEquals(result, "Left, Right, Top, Bottom"); + assertEquals(result, "Dog, Cat, Bird, Cow"); } @Test public void whenConvertMapToString_thenConverted() { - Map users = new HashMap<>(); - users.put(1, "John Doe"); - users.put(2, "Paul Smith"); - users.put(3, "Susan Anderson"); + Map animals = new HashMap<>(); + animals.put(1, "Dog"); + animals.put(2, "Cat"); + animals.put(3, "Cow"); - String result = users.entrySet().stream().map(entry -> entry.getKey() + " = " + entry.getValue()).collect(Collectors.joining(", ")); + String result = animals.entrySet().stream() + .map(entry -> entry.getKey() + " = " + entry.getValue()) + .collect(Collectors.joining(", ")); - assertEquals(result, "1 = John Doe, 2 = Paul Smith, 3 = Susan Anderson"); + assertEquals(result, "1 = Dog, 2 = Cat, 3 = Cow"); } @Test public void whenConvertNestedCollectionToString_thenConverted() { Collection> nested = new ArrayList<>(); - nested.add(Arrays.asList("Left", "Right", "Top", "Bottom")); - nested.add(Arrays.asList("Red", "Blue", "Green", "Yellow")); + nested.add(Arrays.asList("Dog", "Cat")); + nested.add(Arrays.asList("Cow", "Pig")); - String result = nested.stream().map(nextList -> nextList.stream().collect(Collectors.joining("-"))).collect(Collectors.joining("; ")); + String result = nested.stream().map( + nextList -> nextList.stream() + .collect(Collectors.joining("-"))) + .collect(Collectors.joining("; ")); - assertEquals(result, "Left-Right-Top-Bottom; Red-Blue-Green-Yellow"); + assertEquals(result, "Dog-Cat; Cow-Pig"); } @Test public void whenConvertCollectionToStringAndSkipNull_thenConverted() { - Collection fruits = Arrays.asList("Apple", "Orange", null, "Grape"); - String result = fruits.stream().filter(Objects::nonNull).collect(Collectors.joining(", ")); + Collection animals = Arrays.asList("Dog", "Cat", null, "Moose"); + String result = animals.stream() + .filter(Objects::nonNull) + .collect(Collectors.joining(", ")); - assertEquals(result, "Apple, Orange, Grape"); + assertEquals(result, "Dog, Cat, Moose"); } @Test public void whenSplitCollectionHalf_thenConverted() { - Collection numbers = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - Collection result1 = new ArrayList<>(); - Collection result2 = new ArrayList<>(); + Collection animals = Arrays.asList( + "Dog", "Cat", "Cow", "Bird", "Moose", "Pig"); + Collection result1 = new ArrayList<>(); + Collection result2 = new ArrayList<>(); AtomicInteger count = new AtomicInteger(); - int midpoint = Math.round(numbers.size() / 2); + int midpoint = Math.round(animals.size() / 2); - numbers.forEach(next -> { + animals.forEach(next -> { int index = count.getAndIncrement(); if (index < midpoint) { result1.add(next); @@ -102,53 +116,59 @@ public class JoinSplitCollectionsUnitTest { } }); - assertTrue(result1.equals(Arrays.asList(1, 2, 3, 4, 5))); - assertTrue(result2.equals(Arrays.asList(6, 7, 8, 9, 10))); + assertTrue(result1.equals(Arrays.asList("Dog", "Cat", "Cow"))); + assertTrue(result2.equals(Arrays.asList("Bird", "Moose", "Pig"))); } @Test public void whenSplitArrayByWordLength_thenConverted() { - String[] words = new String[] { "bye", "cold", "it", "and", "my", "word" }; - Map> result = Arrays.stream(words).collect(Collectors.groupingBy(String::length)); + String[] animals = new String[] { "Dog", "Cat", "Bird", "Cow", "Pig", "Moose"}; + Map> result = Arrays.stream(animals) + .collect(Collectors.groupingBy(String::length)); - assertTrue(result.get(2).equals(Arrays.asList("it", "my"))); - assertTrue(result.get(3).equals(Arrays.asList("bye", "and"))); - assertTrue(result.get(4).equals(Arrays.asList("cold", "word"))); + assertTrue(result.get(3).equals(Arrays.asList("Dog", "Cat", "Cow", "Pig"))); + assertTrue(result.get(4).equals(Arrays.asList("Bird"))); + assertTrue(result.get(5).equals(Arrays.asList("Moose"))); } @Test public void whenConvertStringToArray_thenConverted() { - String colors = "Red, Blue, Green, Yellow"; - String[] result = colors.split(", "); + String animals = "Dog, Cat, Bird, Cow"; + String[] result = animals.split(", "); - assertArrayEquals(result, new String[] { "Red", "Blue", "Green", "Yellow" }); + assertArrayEquals(result, new String[] { "Dog", "Cat", "Bird", "Cow" }); } @Test public void whenConvertStringToCollection_thenConverted() { - String colors = "Left, Right, Top, Bottom"; - Collection result = Arrays.asList(colors.split(", ")); + String animals = "Dog, Cat, Bird, Cow"; + Collection result = Arrays.asList(animals.split(", ")); - assertTrue(result.equals(Arrays.asList("Left", "Right", "Top", "Bottom"))); + assertTrue(result.equals(Arrays.asList("Dog", "Cat", "Bird", "Cow"))); } @Test public void whenConvertStringToMap_thenConverted() { - String users = "1 = John Doe, 2 = Paul Smith, 3 = Susan Anderson"; + String animals = "1 = Dog, 2 = Cat, 3 = Bird"; - Map result = Arrays.stream(users.split(", ")).map(next -> next.split(" = ")).collect(Collectors.toMap(entry -> Integer.parseInt(entry[0]), entry -> entry[1])); + Map result = Arrays.stream( + animals.split(", ")).map(next -> next.split(" = ")) + .collect(Collectors.toMap(entry -> Integer.parseInt(entry[0]), entry -> entry[1])); - assertEquals(result.get(1), "John Doe"); - assertEquals(result.get(2), "Paul Smith"); - assertEquals(result.get(3), "Susan Anderson"); + assertEquals(result.get(1), "Dog"); + assertEquals(result.get(2), "Cat"); + assertEquals(result.get(3), "Bird"); } @Test public void whenConvertCollectionToStringMultipleSeparators_thenConverted() { - String fruits = "Apple. , Orange, Grape. Lemon"; + String animals = "Dog. , Cat, Bird. Cow"; - Collection result = Arrays.stream(fruits.split("[,|.]")).map(String::trim).filter(next -> !next.isEmpty()).collect(Collectors.toList()); + Collection result = Arrays.stream(animals.split("[,|.]")) + .map(String::trim) + .filter(next -> !next.isEmpty()) + .collect(Collectors.toList()); - assertTrue(result.equals(Arrays.asList("Apple", "Orange", "Grape", "Lemon"))); + assertTrue(result.equals(Arrays.asList("Dog", "Cat", "Bird", "Cow"))); } } diff --git a/couchbase-sdk/pom.xml b/couchbase-sdk/pom.xml index b7b3d1788f..6462cfb57a 100644 --- a/couchbase-sdk/pom.xml +++ b/couchbase-sdk/pom.xml @@ -79,10 +79,10 @@ maven-compiler-plugin - 2.3.2 + ${maven-compiler-plugin.version} - 1.7 - 1.7 + ${java.version} + ${java.version} @@ -100,14 +100,15 @@ - 1.7 + 1.8 UTF-8 - 2.2.6 - 4.2.4.RELEASE - 1.1.3 - 1.7.12 - 4.11 - 3.4 + 2.3.6 + 4.3.4.RELEASE + 1.1.7 + 1.7.21 + 4.12 + 3.5 + 3.6.0 2.19.1 diff --git a/deltaspike/pom.xml b/deltaspike/pom.xml index 22cf8f935c..b4a7657e97 100644 --- a/deltaspike/pom.xml +++ b/deltaspike/pom.xml @@ -25,17 +25,22 @@ resources, i.e. build is platform dependent! --> UTF-8 + 1.7.21 + 3.7.4 + 1.7.2 + - 1.0.2.Final + 1.0.2.Final - 8.2.1.Final + 8.2.2.Final - 3.1 - 2.16 - 2.5 + 3.6.0 + 2.19.1 + 2.6 + 1.1.3 1.7 @@ -56,14 +61,14 @@ org.wildfly.bom jboss-javaee-7.0-with-tools - ${version.jboss.bom} + ${jboss.bom.version} pom import org.wildfly.bom jboss-javaee-7.0-with-hibernate - ${version.jboss.bom} + ${jboss.bom.version} pom import @@ -187,14 +192,14 @@ org.apache.deltaspike.modules deltaspike-data-module-api - 1.7.1 + ${deltaspike.version} compile org.apache.deltaspike.modules deltaspike-data-module-impl - 1.7.1 + ${deltaspike.version} runtime @@ -202,20 +207,20 @@ com.mysema.querydsl querydsl-apt - 3.7.4 + ${querydsl.version} provided com.mysema.querydsl querydsl-jpa - 3.7.4 + ${querydsl.version} org.slf4j slf4j-log4j12 - 1.6.1 + ${slf4j.version} @@ -226,7 +231,7 @@ maven-war-plugin - ${version.war.plugin} + ${war.plugin.version} false @@ -235,7 +240,7 @@ com.mysema.maven apt-maven-plugin - 1.0.9 + ${apt-maven-plugin.version} @@ -253,7 +258,7 @@ org.wildfly.plugins wildfly-maven-plugin - ${version.wildfly.maven.plugin} + ${wildfly.maven.plugin.version} @@ -272,7 +277,7 @@ maven-surefire-plugin - ${version.surefire.plugin} + ${surefire.plugin.version} true diff --git a/dozer/pom.xml b/dozer/pom.xml index 35ac2394a6..363285f619 100644 --- a/dozer/pom.xml +++ b/dozer/pom.xml @@ -13,7 +13,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.3 + ${maven-compiler-plugin.version} 7 7 @@ -26,33 +26,41 @@ org.slf4j slf4j-api - 1.7.5 + ${slf4j.version} org.slf4j jcl-over-slf4j - 1.7.5 + ${slf4j.version} org.apache.commons commons-lang3 - 3.2.1 + ${commons-lang3.version} net.sf.dozer dozer - 5.5.1 + ${dozer.version} junit junit - 4.3 + ${junit.version} test + + 1.7.21 + 3.5 + 5.5.1 + 4.12 + 3.6.0 + + diff --git a/ejb/ejb-client/pom.xml b/ejb/ejb-client/pom.xml index 6ece63572d..84656b40c5 100755 --- a/ejb/ejb-client/pom.xml +++ b/ejb/ejb-client/pom.xml @@ -44,4 +44,10 @@ + + + 4.12 + 2.19.1 + + \ No newline at end of file diff --git a/ejb/ejb-remote/pom.xml b/ejb/ejb-remote/pom.xml index d102edd8e3..601ad69447 100755 --- a/ejb/ejb-remote/pom.xml +++ b/ejb/ejb-remote/pom.xml @@ -15,7 +15,7 @@ javax javaee-api - 7.0 + ${javaee-api.version} provided @@ -25,7 +25,7 @@ org.wildfly.plugins wildfly-maven-plugin - 1.1.0.Alpha5 + ${wildfly-maven-plugin.version} 127.0.0.1 9990 @@ -37,4 +37,9 @@ + + + 7.0 + 1.1.0.Beta1 + \ No newline at end of file diff --git a/ejb/pom.xml b/ejb/pom.xml index 8176de7936..7676165b8b 100755 --- a/ejb/pom.xml +++ b/ejb/pom.xml @@ -38,14 +38,14 @@ javax javaee-api - 7.0 + ${javaee-api.version} provided org.wildfly wildfly-ejb-client-bom - 10.1.0.Final + ${wildfly.version} pom import @@ -57,7 +57,7 @@ maven-compiler-plugin - 3.1 + ${maven-compiler-plugin.version} 1.8 1.8 @@ -66,7 +66,7 @@ maven-ejb-plugin - 2.4 + ${maven-ejb-plugin.version} 3.2 @@ -79,4 +79,11 @@ ejb-remote ejb-client + + + 7.0 + 10.1.0.Final + 3.6.0 + 2.5.1 + \ No newline at end of file diff --git a/enterprise-patterns/pom.xml b/enterprise-patterns/pom.xml index 036a61c44a..763227e45b 100644 --- a/enterprise-patterns/pom.xml +++ b/enterprise-patterns/pom.xml @@ -23,7 +23,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.5.1 + ${maven-compiler-plugin.version} 1.8 1.8 @@ -32,4 +32,8 @@ + + + 3.6.0 + diff --git a/feign/pom.xml b/feign/pom.xml index af61883f1b..721fa76682 100644 --- a/feign/pom.xml +++ b/feign/pom.xml @@ -16,54 +16,62 @@ UTF-8 + 9.4.0 + 1.7.21 + 2.7 + 1.16.12 + 4.12 + 3.6.0 + 2.19.1 + 1.4.2.RELEASE io.github.openfeign feign-core - 9.3.1 + ${feign.version} io.github.openfeign feign-okhttp - 9.3.1 + ${feign.version} io.github.openfeign feign-gson - 9.3.1 + ${feign.version} io.github.openfeign feign-slf4j - 9.3.1 + ${feign.version} org.slf4j slf4j-api - 1.7.21 + ${slf4j.version} org.apache.logging.log4j log4j-core - 2.6.2 + ${log4j.version} org.apache.logging.log4j log4j-slf4j-impl - 2.6.2 + ${log4j.version} org.projectlombok lombok - 1.16.10 + ${lombok.version} provided junit junit - 4.12 + ${junit.version} test @@ -74,7 +82,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.5.1 + ${maven-compiler-plugin.version} 1.8 1.8 @@ -83,7 +91,7 @@ org.apache.maven.plugins maven-surefire-plugin - 2.19.1 + ${maven-surefire-plugin.version} true @@ -91,9 +99,10 @@ org.springframework.boot spring-boot-maven-plugin - 1.4.0.RELEASE + ${spring-boot-maven-plugin.version} + diff --git a/flyway/pom.xml b/flyway/pom.xml index d53bc7dc41..155390b218 100644 --- a/flyway/pom.xml +++ b/flyway/pom.xml @@ -10,7 +10,7 @@ mysql mysql-connector-java - 6.0.3 + ${mysql.version} @@ -18,12 +18,12 @@ org.flywaydb flyway-maven-plugin - 4.0.3 + ${flyway-maven-plugin.version} org.apache.maven.plugins maven-compiler-plugin - 3.5.1 + ${maven-compiler-plugin.version} 1.8 1.8 @@ -31,4 +31,9 @@ + + 6.0.5 + 4.0.3 + 3.6.0 + \ No newline at end of file diff --git a/gson/pom.xml b/gson/pom.xml index d864c289c2..f2a2f4f930 100644 --- a/gson/pom.xml +++ b/gson/pom.xml @@ -13,7 +13,7 @@ joda-time joda-time - 2.4 + ${joda-time.version} @@ -24,13 +24,13 @@ commons-io commons-io - 2.4 + ${commons-io.version} org.apache.commons commons-collections4 - 4.0 + ${commons-collections4.version} @@ -39,8 +39,6 @@ ${commons-lang3.version} - - @@ -112,40 +110,24 @@ - - 4.3.11.Final - 5.1.38 - - 2.3 - - - 1.7.13 - 1.1.3 - - - 5.1.3.Final + 2.8.0 19.0 - 3.4 + 3.5 + 4.1 + 2.5 + 2.9.6 1.3 4.12 1.10.19 - 4.4.1 - 4.5 - - 2.9.0 - - 3.5.1 - 2.6 + 3.6.0 2.19.1 - 2.7 - 1.4.18 diff --git a/guava/pom.xml b/guava/pom.xml index 59ca3aa1bb..a7b4e79e34 100644 --- a/guava/pom.xml +++ b/guava/pom.xml @@ -19,7 +19,7 @@ org.apache.commons commons-collections4 - 4.0 + ${commons-collections4.version} @@ -28,8 +28,6 @@ ${commons-lang3.version} - - @@ -93,37 +91,19 @@ - - 4.3.11.Final - 5.1.38 - - - 1.7.13 - 1.1.3 - - - 5.1.3.Final - 19.0 - 3.4 + 3.5 + 4.1 1.3 4.12 1.10.19 - 4.4.1 - 4.5 - - 2.9.0 - - 3.5.1 - 2.6 + 3.6.0 2.19.1 - 2.7 - 1.4.18 diff --git a/guava18/pom.xml b/guava18/pom.xml index 413e9c35b8..1118a13e07 100644 --- a/guava18/pom.xml +++ b/guava18/pom.xml @@ -11,13 +11,13 @@ com.google.guava guava - 18.0 + ${guava.version} junit junit - 4.12 + ${junit.version} test @@ -26,7 +26,7 @@ maven-compiler-plugin - 3.3 + ${maven-compiler-plugin.version} true true @@ -39,5 +39,10 @@ - + + + 18.0 + 4.12 + 3.6.0 + \ No newline at end of file diff --git a/guava19/pom.xml b/guava19/pom.xml index 61fbf38575..75f87ccf4f 100644 --- a/guava19/pom.xml +++ b/guava19/pom.xml @@ -17,13 +17,13 @@ junit junit - 4.12 + ${junit.version} test org.hamcrest hamcrest-all - 1.3 + ${hamcrest.version} test @@ -32,7 +32,7 @@ maven-compiler-plugin - 3.3 + ${maven-compiler-plugin.version} true true @@ -48,6 +48,9 @@ 19.0 + 4.12 + 1.3 + 3.6.0 \ No newline at end of file diff --git a/handling-spring-static-resources/pom.xml b/handling-spring-static-resources/pom.xml index 6dd0c95026..9a14ce9372 100644 --- a/handling-spring-static-resources/pom.xml +++ b/handling-spring-static-resources/pom.xml @@ -91,14 +91,14 @@ javax.inject javax.inject - 1 + ${inject.version} javax.servlet javax.servlet-api - 3.1.0 + ${javax.servlet-api.version} javax.servlet.jsp @@ -108,7 +108,7 @@ javax.servlet jstl - 1.2 + ${jstl.version} com.fasterxml.jackson.core @@ -126,14 +126,14 @@ joda-time joda-time - 2.6 + ${joda-time.version} com.github.jknack handlebars - 1.3.2 + ${handlebars.version} @@ -175,7 +175,7 @@ net.alchim31.maven yuicompressor-maven-plugin - 1.5.1 + ${yuicompressor-maven-plugin.version} @@ -210,46 +210,29 @@ 1.8 - 4.2.5.RELEASE - 4.0.4.RELEASE + 4.3.4.RELEASE + 4.2.0.RELEASE - 1.8.1 - 2.3.2-b01 - - - 4.3.11.Final - 5.1.38 - 1.9.2.RELEASE + 1.8.9 + 2.3.2-b02 - 2.7.8 + 2.8.5 - 1.7.13 - 1.1.3 + 1.7.21 + 1.1.7 - - 5.2.2.Final - - - 19.0 - 3.4 - - - 1.3 - 4.12 - 1.10.19 - - 4.4.1 - 4.5 - - 2.9.0 + + 5.3.3.Final + 4.0.6 + 2.9.6 + 1.2 + 3.1.0 + 1 - 3.5.1 - 2.6 - 2.19.1 - 1.4.18 + 1.5.1 \ No newline at end of file diff --git a/handling-spring-static-resources/src/main/resources/webSecurityConfig.xml b/handling-spring-static-resources/src/main/resources/webSecurityConfig.xml index 76b5015e7b..cf944804db 100644 --- a/handling-spring-static-resources/src/main/resources/webSecurityConfig.xml +++ b/handling-spring-static-resources/src/main/resources/webSecurityConfig.xml @@ -2,10 +2,10 @@ diff --git a/hazelcast/README.md b/hazelcast/README.md new file mode 100644 index 0000000000..b90f66a8d0 --- /dev/null +++ b/hazelcast/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Guide to Hazelcast with Java](http://www.baeldung.com/java-hazelcast) diff --git a/hazelcast/pom.xml b/hazelcast/pom.xml index 00960eadd2..91e2cd2c61 100644 --- a/hazelcast/pom.xml +++ b/hazelcast/pom.xml @@ -64,14 +64,14 @@ - 3.7.2 + 3.7.4 1.7.21 1.1.7 - 3.5.1 + 3.6.0 \ No newline at end of file diff --git a/httpclient/pom.xml b/httpclient/pom.xml index cac363c414..be0daae995 100644 --- a/httpclient/pom.xml +++ b/httpclient/pom.xml @@ -51,13 +51,13 @@ commons-codec commons-codec - 1.9 + ${commons-codec.version} org.apache.httpcomponents httpasyncclient - 4.1-beta1 + ${httpasyncclient.version} @@ -188,37 +188,28 @@ - - 4.3.11.Final - 5.1.38 - - 1.7.13 - 1.1.3 - - - 5.1.3.Final + 1.7.21 + 1.1.7 19.0 - 3.4 + 3.5 + 1.10 + 4.1.2 1.3 4.12 1.10.19 - 4.4.1 - 4.5 - - 2.9.0 + 4.4.5 + 4.5.2 - 3.5.1 - 2.6 + 3.6.0 2.19.1 - 2.7 - 1.4.18 + 1.6.1 diff --git a/httpclient/src/test/java/org/baeldung/httpclient/HttpAsyncClientLiveTest.java b/httpclient/src/test/java/org/baeldung/httpclient/HttpAsyncClientLiveTest.java index b1399dcab8..f2086f2633 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/HttpAsyncClientLiveTest.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/HttpAsyncClientLiveTest.java @@ -37,7 +37,7 @@ public class HttpAsyncClientLiveTest { private static final String HOST = "http://www.google.com"; private static final String HOST_WITH_SSL = "https://mms.nw.ru/"; - private static final String HOST_WITH_PROXY = "https://issues.apache.org/"; + private static final String HOST_WITH_PROXY = "http://httpbin.org/"; private static final String URL_SECURED_BY_BASIC_AUTHENTICATION = "http://browserspy.dk/password-ok.php";// "http://localhost:8080/spring-security-rest-basic-auth/api/foos/1"; private static final String DEFAULT_USER = "test";// "user1"; private static final String DEFAULT_PASS = "test";// "user1Pass"; @@ -89,7 +89,7 @@ public class HttpAsyncClientLiveTest { public void whenUseProxyWithHttpClient_thenCorrect() throws Exception { final CloseableHttpAsyncClient client = HttpAsyncClients.createDefault(); client.start(); - final HttpHost proxy = new HttpHost("74.50.126.248", 3127); + final HttpHost proxy = new HttpHost("127.0.0.1", 8080); final RequestConfig config = RequestConfig.custom().setProxy(proxy).build(); final HttpGet request = new HttpGet(HOST_WITH_PROXY); request.setConfig(config); diff --git a/httpclient/src/test/java/org/baeldung/httpclient/conn/HttpClientConnectionManagementLiveTest.java b/httpclient/src/test/java/org/baeldung/httpclient/conn/HttpClientConnectionManagementLiveTest.java index e9db8c1e16..e04cd32d65 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/conn/HttpClientConnectionManagementLiveTest.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/conn/HttpClientConnectionManagementLiveTest.java @@ -218,7 +218,7 @@ public class HttpClientConnectionManagementLiveTest { final HeaderElement he = it.nextElement(); final String param = he.getName(); final String value = he.getValue(); - if (value != null && param.equalsIgnoreCase("timeout")) { + if ((value != null) && param.equalsIgnoreCase("timeout")) { return Long.parseLong(value) * 1000; } } @@ -251,9 +251,9 @@ public class HttpClientConnectionManagementLiveTest { basicConnManager.connect(conn, route, 1000, context); basicConnManager.routeComplete(conn, route, context); final HttpRequestExecutor exeRequest = new HttpRequestExecutor(); - context.setTargetHost((new HttpHost("www.baeldung.com", 80))); + context.setTargetHost((new HttpHost("http://httpbin.org", 80))); - final HttpGet get = new HttpGet("http://www.baeldung.com"); + final HttpGet get = new HttpGet("http://httpbin.org"); exeRequest.execute(get, conn, context); conn.isResponseAvailable(1000); basicConnManager.releaseConnection(conn, null, 1, TimeUnit.SECONDS); @@ -282,8 +282,9 @@ public class HttpClientConnectionManagementLiveTest { for (final MultiHttpClientConnThread thread : threads) { thread.join(10000); countConnMade++; - if (countConnMade == 0) + if (countConnMade == 0) { assertTrue(thread.getLeasedConn() == 5); + } } } @@ -356,7 +357,7 @@ public class HttpClientConnectionManagementLiveTest { // @Ignore // 8.2 ARTICLE VERSION public final void whenCustomizedIdleConnMonitor_thenNoExceptions() throws InterruptedException, IOException { - final HttpGet get = new HttpGet("http://google.com"); + new HttpGet("http://google.com"); poolingConnManager = new PoolingHttpClientConnectionManager(); client = HttpClients.custom().setConnectionManager(poolingConnManager).build(); final IdleConnectionMonitorThread staleMonitor = new IdleConnectionMonitorThread(poolingConnManager); diff --git a/hystrix/pom.xml b/hystrix/pom.xml index 54c17f1487..5e050d726e 100644 --- a/hystrix/pom.xml +++ b/hystrix/pom.xml @@ -11,7 +11,7 @@ org.springframework.boot spring-boot-starter-parent - 1.4.0.RELEASE + 1.4.2.RELEASE @@ -21,7 +21,7 @@ 1.8 - 1.5.4 + 1.5.8 0.20.7 @@ -29,13 +29,13 @@ 4.12 - 3.5.1 + 3.6.0 2.6 2.19.1 2.7 - 1.3.16 - 1.4.3 - 1.4.0.RELEASE + 1.5.8 + 1.5.8 + 1.4.2.RELEASE diff --git a/hystrix/src/test/java/com/baeldung/hystrix/HystrixTimeoutTest.java b/hystrix/src/test/java/com/baeldung/hystrix/HystrixTimeoutIntegrationTest.java similarity index 99% rename from hystrix/src/test/java/com/baeldung/hystrix/HystrixTimeoutTest.java rename to hystrix/src/test/java/com/baeldung/hystrix/HystrixTimeoutIntegrationTest.java index d72895aab9..bf0c542980 100644 --- a/hystrix/src/test/java/com/baeldung/hystrix/HystrixTimeoutTest.java +++ b/hystrix/src/test/java/com/baeldung/hystrix/HystrixTimeoutIntegrationTest.java @@ -10,7 +10,7 @@ import org.junit.Test; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; -public class HystrixTimeoutTest { +public class HystrixTimeoutIntegrationTest { @Test public void givenInputBobAndDefaultSettings_whenCommandExecuted_thenReturnHelloBob(){ diff --git a/immutables/pom.xml b/immutables/pom.xml index 2b4aba59b1..054763b3d4 100644 --- a/immutables/pom.xml +++ b/immutables/pom.xml @@ -12,24 +12,24 @@ org.immutables value - 2.2.10 + ${immutables.version} junit junit - 4.12 + ${junit.version} test org.assertj assertj-core - 3.5.2 + ${assertj.version} test org.mutabilitydetector MutabilityDetector - 0.9.5 + ${mutabilitydetector.version} test @@ -39,7 +39,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.3 + ${maven-compiler-plugin.version} 1.8 1.8 @@ -47,4 +47,13 @@ + + + 2.3.10 + 4.12 + 3.6.1 + 0.9.6 + + 3.6.0 + \ No newline at end of file diff --git a/jackson-annotations/pom.xml b/jackson-annotations/pom.xml index 4da0522a5b..559ef5709b 100644 --- a/jackson-annotations/pom.xml +++ b/jackson-annotations/pom.xml @@ -88,28 +88,28 @@ io.rest-assured rest-assured - 3.0.1 + ${rest-assured.version} test io.rest-assured json-schema-validator - 3.0.0 + ${rest-assured.version} test io.rest-assured json-path - 3.0.1 + ${rest-assured.version} test com.github.fge json-schema-validator - 2.2.6 + ${json-schema-validator.version} test @@ -123,7 +123,7 @@ org.assertj assertj-core - 3.6.1 + ${assertj.version} test @@ -187,11 +187,6 @@ - - - 4.3.11.Final - 5.1.38 - 2.8.5 @@ -200,7 +195,6 @@ 1.1.7 - 5.1.3.Final 2.9.6 2.8.0 4.1 @@ -211,21 +205,14 @@ 2.5 - 1.3 4.12 - 2.2.26 - - 4.4.1 - 4.5 - - 2.9.0 + 3.0.1 + 2.2.6 + 3.6.1 - 3.5.1 - 2.6 + 3.6.0 2.19.1 - 2.7 - 1.4.18 UTF-8 1.8 diff --git a/jackson/pom.xml b/jackson/pom.xml index e795ad11a2..9996af10f2 100644 --- a/jackson/pom.xml +++ b/jackson/pom.xml @@ -20,19 +20,19 @@ commons-io commons-io - 2.4 + ${commons-io.version} com.fasterxml.jackson.dataformat jackson-dataformat-xml - 2.7.4 + ${jackson.version} org.apache.commons commons-collections4 - 4.0 + ${commons-collections4.version} @@ -41,8 +41,6 @@ ${commons-lang3.version} - - @@ -66,19 +64,19 @@ com.fasterxml.jackson.module jackson-module-jsonSchema - 2.7.2 + ${jackson.version} joda-time joda-time - 2.9.2 + ${joda-time.version} com.google.code.gson gson - 2.6.2 + ${gson.version} @@ -169,40 +167,30 @@ - - 4.3.11.Final - 5.1.38 - - 2.7.8 + 2.8.5 - 1.7.13 - 1.1.3 - - - 5.1.3.Final + 1.7.21 + 1.1.7 19.0 - 3.4 + 3.5 + 2.5 + 2.9.6 + 2.8.0 + 4.1 1.3 4.12 1.10.19 - - 4.4.1 - 4.5 - 2.9.0 - 3.5.1 - 2.6 + 3.6.0 2.19.1 - 2.7 - 1.4.18 diff --git a/java-cassandra/README.md b/java-cassandra/README.md new file mode 100644 index 0000000000..3ab6f5f099 --- /dev/null +++ b/java-cassandra/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [A Guide to Cassandra with Java](http://www.baeldung.com/cassandra-with-java) diff --git a/java-cassandra/pom.xml b/java-cassandra/pom.xml index 92d3a8ede6..5796043b95 100644 --- a/java-cassandra/pom.xml +++ b/java-cassandra/pom.xml @@ -20,7 +20,7 @@ org.cassandraunit cassandra-unit - 3.0.0.1 + ${cassandra-unit.version} @@ -135,18 +135,15 @@ 1.1.7 - 1.3 4.12 - 1.10.19 - 6.8 - 3.5.1 - 3.5.1 + 3.6.0 2.19.1 - 3.1.0 + 3.1.2 + 3.1.1.0 diff --git a/javax-servlets/.gitignore b/javax-servlets/.gitignore index a51a433798..dfbd063287 100644 --- a/javax-servlets/.gitignore +++ b/javax-servlets/.gitignore @@ -2,4 +2,5 @@ .idea classes target -*.iml \ No newline at end of file +*.iml +out \ No newline at end of file diff --git a/javax-servlets/pom.xml b/javax-servlets/pom.xml index 4fe4575e48..a01a80077f 100644 --- a/javax-servlets/pom.xml +++ b/javax-servlets/pom.xml @@ -7,6 +7,28 @@ com.root ServletmavenExample 1.0-SNAPSHOT + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*IntegrationTest.java + **/*LiveTest.java + + + + + @@ -33,7 +55,7 @@ 3.1.0 4.12 - 4.5 + 4.5.2 \ No newline at end of file diff --git a/javax-servlets/src/main/java/com/root/FormServlet.java b/javax-servlets/src/main/java/com/baeldung.servlets/FormServlet.java similarity index 97% rename from javax-servlets/src/main/java/com/root/FormServlet.java rename to javax-servlets/src/main/java/com/baeldung.servlets/FormServlet.java index 4f55a02745..fcd9143dff 100644 --- a/javax-servlets/src/main/java/com/root/FormServlet.java +++ b/javax-servlets/src/main/java/com/baeldung.servlets/FormServlet.java @@ -1,4 +1,4 @@ -package com.root; +package com.baeldung.servlets; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; diff --git a/javax-servlets/src/test/java/com/root/FormServletTest.java b/javax-servlets/src/test/java/com/baeldung.servlets/FormServletLiveTest.java similarity index 89% rename from javax-servlets/src/test/java/com/root/FormServletTest.java rename to javax-servlets/src/test/java/com/baeldung.servlets/FormServletLiveTest.java index 437741e12d..45f5e83c87 100644 --- a/javax-servlets/src/test/java/com/root/FormServletTest.java +++ b/javax-servlets/src/test/java/com/baeldung.servlets/FormServletLiveTest.java @@ -1,4 +1,4 @@ -package com.root; +package com.baeldung.servlets; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; @@ -13,7 +13,7 @@ import java.util.List; import static org.junit.Assert.assertEquals; -public class FormServletTest { +public class FormServletLiveTest { @Test public void whenPostRequestUsingHttpClient_thenCorrect() throws Exception { @@ -21,10 +21,11 @@ public class FormServletTest { HttpClient client = new DefaultHttpClient(); HttpPost method = new HttpPost("http://localhost:8080/calculateServlet"); - List nvps = new ArrayList(); + List nvps = new ArrayList<>(); nvps.add(new BasicNameValuePair("height", String.valueOf(2))); nvps.add(new BasicNameValuePair("weight", String.valueOf(80))); + method.setEntity(new UrlEncodedFormEntity(nvps)); HttpResponse httpResponse = client.execute(method); diff --git a/javaxval/pom.xml b/javaxval/pom.xml index 493119d92e..1503ca49a6 100644 --- a/javaxval/pom.xml +++ b/javaxval/pom.xml @@ -4,42 +4,50 @@ javaxval 0.1-SNAPSHOT + + 4.12 + 1.1.0.Final + 5.3.4.Final + 3.0.0 + 2.2.6 + + junit junit - 4.12 + ${junit.version} javax.validation validation-api - 1.1.0.Final + ${validation-api.version} org.hibernate hibernate-validator - 5.2.1.Final + ${hibernate-validator.version} org.hibernate hibernate-validator-annotation-processor - 5.2.1.Final + ${hibernate-validator.version} javax.el javax.el-api - 2.2.4 + ${javax.el-api.version} org.glassfish.web javax.el - 2.2.4 + ${javax.el.version} diff --git a/jaxb/pom.xml b/jaxb/pom.xml index cce40c55d4..6c36956913 100644 --- a/jaxb/pom.xml +++ b/jaxb/pom.xml @@ -23,7 +23,7 @@ com.sun.istack istack-commons-runtime - 3.0.2 + ${istack.version} @@ -60,7 +60,7 @@ org.eclipse.m2e lifecycle-mapping - 1.0.0 + ${lifecycle-mapping.version} @@ -158,12 +158,15 @@ 2.2.11 + 3.0.2 + 1.7.21 1.1.7 - 3.5.1 + 1.0.0 + 3.6.0 2.3 diff --git a/jee7/pom.xml b/jee7/pom.xml index 627b8723e3..66991d03a8 100644 --- a/jee7/pom.xml +++ b/jee7/pom.xml @@ -1,311 +1,335 @@ - - 4.0.0 + + 4.0.0 - com.baeldung - jee7schedule - 1.0-SNAPSHOT - JavaEE 7 Arquillian Archetype Sample - war + com.baeldung + jee7schedule + 1.0-SNAPSHOT + JavaEE 7 Arquillian Archetype Sample + war - - 1.7 - 3.0.0 + + 1.7 + 3.0.0 - 4.11 - 7.0 + 4.12 + 7.0 + 1.1.11.Final + 8.2.1.Final + 1.7.0 + 1.4.6.Final + 3.0.19.Final + 4.1.1 + 1.0.4 + 1.13 + 2.25 + 1.0.0.Final - 1.1.4.Final + 3.6.0 + 2.6 + - 8.0.0.Final - + + ${maven.min.version} + - - ${maven.min.version} - - - - - - org.jboss.arquillian - arquillian-bom - ${version.arquillian_core} - import - pom - - - - - - - javax - javaee-api - ${version.javaee_api} - provided - - - - junit - junit - ${version.junit} - test - - - org.jboss.arquillian.junit - arquillian-junit-container - test - - - com.jayway.awaitility - awaitility - 1.6.0 - test - - - - org.jboss.shrinkwrap.resolver - shrinkwrap-resolver-impl-maven - test - jar - - - - org.jboss.shrinkwrap.resolver - shrinkwrap-resolver-impl-maven-archive - test - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - ${java.min.version} - ${java.min.version} - - - - org.apache.maven.plugins - maven-war-plugin - 2.1.1 - - false - - - - - - - - - wildfly-managed-arquillian - - true - - - standalone-full.xml - ${project.build.directory}/wildfly-${version.wildfly} - - + + - io.undertow - undertow-websockets-jsr - 1.0.0.Beta25 - test + org.jboss.arquillian + arquillian-bom + ${arquillian_core.version} + import + pom - - org.jboss.resteasy - resteasy-client - 3.0.5.Final - test - - - org.jboss.resteasy - resteasy-jaxb-provider - 3.0.5.Final - test - - - org.jboss.resteasy - resteasy-json-p-provider - 3.0.5.Final - test - - - org.wildfly - wildfly-arquillian-container-managed - ${version.wildfly} - test - - - - - - maven-dependency-plugin - 2.8 - - ${maven.test.skip} - - - - unpack - process-test-classes - - unpack - + + + + + + javax + javaee-api + ${javaee_api.version} + provided + + + + junit + junit + ${junit.version} + test + + + org.jboss.arquillian.junit + arquillian-junit-container + test + + + com.jayway.awaitility + awaitility + ${awaitility.version} + test + + + + org.jboss.shrinkwrap.resolver + shrinkwrap-resolver-impl-maven + test + jar + + + + org.jboss.shrinkwrap.resolver + shrinkwrap-resolver-impl-maven-archive + test + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${java.min.version} + ${java.min.version} + + + + + org.apache.maven.plugins + maven-war-plugin + ${maven-war-plugin.version} + + false + + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + **/*IntegrationTest.java + **/*LongRunningUnitTest.java + **/*ManualTest.java + + + + + + + + + + wildfly-managed-arquillian + + true + + + standalone-full.xml + ${project.build.directory}/wildfly-${version.wildfly} + + + + io.undertow + undertow-websockets-jsr + ${undertow-websockets-jsr.version} + test + + + org.jboss.resteasy + resteasy-client + ${resteasy.version} + test + + + org.jboss.resteasy + resteasy-jaxb-provider + ${resteasy.version} + test + + + org.jboss.resteasy + resteasy-json-p-provider + ${resteasy.version} + test + + + org.wildfly + wildfly-arquillian-container-managed + ${wildfly.version} + test + + + + + + maven-dependency-plugin + 2.8 - - - org.wildfly - wildfly-dist - ${version.wildfly} - zip - false - ${project.build.directory} - - + ${maven.test.skip} - - - - - maven-surefire-plugin - 2.17 - - - ${project.build.directory}/wildfly-${version.wildfly} - - - - - - - - wildfly-remote-arquillian - - - io.undertow - undertow-websockets-jsr - 1.0.0.Beta25 - test - - - org.jboss.resteasy - resteasy-client - 3.0.5.Final - test - - - org.jboss.resteasy - resteasy-jaxb-provider - 3.0.5.Final - test - - - org.jboss.resteasy - resteasy-json-p-provider - 3.0.5.Final - test - - - org.wildfly - wildfly-arquillian-container-remote - ${version.wildfly} - test - - - - - glassfish-embedded-arquillian - - - org.glassfish.main.extras - glassfish-embedded-all - 4.0 - test - - - org.glassfish - javax.json - 1.0.4 - test - - - org.glassfish.tyrus - tyrus-client - 1.3 - test - - - org.glassfish.tyrus - tyrus-container-grizzly-client - 1.3 - test - - - org.glassfish.jersey.core - jersey-client - 2.4 - test - - - org.jboss.arquillian.container - arquillian-glassfish-embedded-3.1 - 1.0.0.CR4 - test - - - - - glassfish-remote-arquillian - - - org.glassfish - javax.json - 1.0.4 - test - - - org.glassfish.tyrus - tyrus-client - 1.3 - test - - - org.glassfish.tyrus - tyrus-container-grizzly-client - 1.3 - test - - - org.glassfish.jersey.core - jersey-client - 2.4 - test - - - org.glassfish.jersey.media - jersey-media-json-jackson - 2.4 - test - - - org.glassfish.jersey.media - jersey-media-json-processing - 2.4 - test - - - org.jboss.arquillian.container - arquillian-glassfish-remote-3.1 - 1.0.0.CR4 - test - - - - + + + unpack + process-test-classes + + unpack + + + + + org.wildfly + wildfly-dist + ${wildfly.version} + zip + false + ${project.build.directory} + + + + + + + + maven-surefire-plugin + 2.17 + + + ${project.build.directory}/wildfly-${wildfly.version} + + + + + + + + wildfly-remote-arquillian + + + io.undertow + undertow-websockets-jsr + ${undertow-websockets-jsr.version} + test + + + org.jboss.resteasy + resteasy-client + ${resteasy.version} + test + + + org.jboss.resteasy + resteasy-jaxb-provider + ${resteasy.version} + test + + + org.jboss.resteasy + resteasy-json-p-provider + ${resteasy.version} + test + + + org.wildfly + wildfly-arquillian-container-remote + ${wildfly.version} + test + + + + + glassfish-embedded-arquillian + + + org.glassfish.main.extras + glassfish-embedded-all + ${glassfish-embedded-all.version} + test + + + org.glassfish + javax.json + ${javax.json.version} + test + + + org.glassfish.tyrus + tyrus-client + ${tyrus.version} + test + + + org.glassfish.tyrus + tyrus-container-grizzly-client + ${tyrus.version} + test + + + org.glassfish.jersey.core + jersey-client + ${jersey.version} + test + + + org.jboss.arquillian.container + arquillian-glassfish-embedded-3.1 + ${arquillian-glassfish.version} + test + + + + + glassfish-remote-arquillian + + + org.glassfish + javax.json + ${javax.json.version} + test + + + org.glassfish.tyrus + tyrus-client + ${tyrus.version} + test + + + org.glassfish.tyrus + tyrus-container-grizzly-client + ${tyrus.version} + test + + + org.glassfish.jersey.core + jersey-client + ${jersey.version} + test + + + org.glassfish.jersey.media + jersey-media-json-jackson + ${jersey.version} + test + + + org.glassfish.jersey.media + jersey-media-json-processing + ${jersey.version} + test + + + org.jboss.arquillian.container + arquillian-glassfish-remote-3.1 + ${arquillian-glassfish.version} + test + + + + diff --git a/jee7/src/test/java/com/baeldung/timer/AutomaticTimerBeanTest.java b/jee7/src/test/java/com/baeldung/timer/AutomaticTimerBeanIntegrationTest.java similarity index 98% rename from jee7/src/test/java/com/baeldung/timer/AutomaticTimerBeanTest.java rename to jee7/src/test/java/com/baeldung/timer/AutomaticTimerBeanIntegrationTest.java index df922b28df..0e4c91ad67 100644 --- a/jee7/src/test/java/com/baeldung/timer/AutomaticTimerBeanTest.java +++ b/jee7/src/test/java/com/baeldung/timer/AutomaticTimerBeanIntegrationTest.java @@ -21,7 +21,7 @@ import static org.hamcrest.Matchers.equalTo; @RunWith(Arquillian.class) -public class AutomaticTimerBeanTest { +public class AutomaticTimerBeanIntegrationTest { //the @AutomaticTimerBean has a method called every 10 seconds //testing the difference ==> 100000 diff --git a/jee7/src/test/java/com/baeldung/timer/ProgrammaticAtFixedRateTimerBeanTest.java b/jee7/src/test/java/com/baeldung/timer/ProgrammaticAtFixedRateTimerBeanIntegrationTest.java similarity index 96% rename from jee7/src/test/java/com/baeldung/timer/ProgrammaticAtFixedRateTimerBeanTest.java rename to jee7/src/test/java/com/baeldung/timer/ProgrammaticAtFixedRateTimerBeanIntegrationTest.java index 76c0e3e5b8..13cd1729db 100644 --- a/jee7/src/test/java/com/baeldung/timer/ProgrammaticAtFixedRateTimerBeanTest.java +++ b/jee7/src/test/java/com/baeldung/timer/ProgrammaticAtFixedRateTimerBeanIntegrationTest.java @@ -21,7 +21,7 @@ import static org.hamcrest.Matchers.is; @RunWith(Arquillian.class) -public class ProgrammaticAtFixedRateTimerBeanTest { +public class ProgrammaticAtFixedRateTimerBeanIntegrationTest { final static long TIMEOUT = 1000; final static long TOLERANCE = 500l; diff --git a/jee7/src/test/java/com/baeldung/timer/ProgrammaticTimerBeanTest.java b/jee7/src/test/java/com/baeldung/timer/ProgrammaticTimerBeanIntegrationTest.java similarity index 97% rename from jee7/src/test/java/com/baeldung/timer/ProgrammaticTimerBeanTest.java rename to jee7/src/test/java/com/baeldung/timer/ProgrammaticTimerBeanIntegrationTest.java index f93ba61fe3..b90cb6d909 100644 --- a/jee7/src/test/java/com/baeldung/timer/ProgrammaticTimerBeanTest.java +++ b/jee7/src/test/java/com/baeldung/timer/ProgrammaticTimerBeanIntegrationTest.java @@ -19,7 +19,7 @@ import static org.hamcrest.Matchers.is; @RunWith(Arquillian.class) -public class ProgrammaticTimerBeanTest { +public class ProgrammaticTimerBeanIntegrationTest { final static long TIMEOUT = 5000l; final static long TOLERANCE = 1000l; diff --git a/jee7/src/test/java/com/baeldung/timer/ProgrammaticWithFixedDelayTimerBeanTest.java b/jee7/src/test/java/com/baeldung/timer/ProgrammaticWithFixedDelayTimerBeanIntegrationTest.java similarity index 97% rename from jee7/src/test/java/com/baeldung/timer/ProgrammaticWithFixedDelayTimerBeanTest.java rename to jee7/src/test/java/com/baeldung/timer/ProgrammaticWithFixedDelayTimerBeanIntegrationTest.java index 6764aa386d..e2e660f79b 100644 --- a/jee7/src/test/java/com/baeldung/timer/ProgrammaticWithFixedDelayTimerBeanTest.java +++ b/jee7/src/test/java/com/baeldung/timer/ProgrammaticWithFixedDelayTimerBeanIntegrationTest.java @@ -21,7 +21,7 @@ import static org.hamcrest.Matchers.is; @RunWith(Arquillian.class) -public class ProgrammaticWithFixedDelayTimerBeanTest { +public class ProgrammaticWithFixedDelayTimerBeanIntegrationTest { final static long TIMEOUT = 15000l; final static long TOLERANCE = 1000l; diff --git a/jee7/src/test/java/com/baeldung/timer/ScheduleTimerBeanTest.java b/jee7/src/test/java/com/baeldung/timer/ScheduleTimerBeanIntegrationTest.java similarity index 97% rename from jee7/src/test/java/com/baeldung/timer/ScheduleTimerBeanTest.java rename to jee7/src/test/java/com/baeldung/timer/ScheduleTimerBeanIntegrationTest.java index 7a5b043101..c3c5ad44de 100644 --- a/jee7/src/test/java/com/baeldung/timer/ScheduleTimerBeanTest.java +++ b/jee7/src/test/java/com/baeldung/timer/ScheduleTimerBeanIntegrationTest.java @@ -21,7 +21,7 @@ import static org.hamcrest.Matchers.equalTo; @RunWith(Arquillian.class) -public class ScheduleTimerBeanTest { +public class ScheduleTimerBeanIntegrationTest { final static long TIMEOUT = 5000l; final static long TOLERANCE = 1000l; diff --git a/jjwt/pom.xml b/jjwt/pom.xml index d2a3f1cdd8..c1332fa2d7 100644 --- a/jjwt/pom.xml +++ b/jjwt/pom.xml @@ -14,13 +14,14 @@ org.springframework.boot spring-boot-starter-parent - 1.3.5.RELEASE + 1.4.2.RELEASE UTF-8 1.8 + 0.7.0 @@ -48,7 +49,7 @@ io.jsonwebtoken jjwt - 0.6.0 + ${jjwt.version} diff --git a/jpa-storedprocedure/pom.xml b/jpa-storedprocedure/pom.xml index b5a2e8693c..797303dc29 100644 --- a/jpa-storedprocedure/pom.xml +++ b/jpa-storedprocedure/pom.xml @@ -9,8 +9,10 @@ 7.0 - 5.1.0.Final - 5.1.38 + 5.2.5.Final + 6.0.5 + 4.12 + 2.5 2.19.1 @@ -69,7 +71,7 @@ mysql mysql-connector-java - 5.1.38 + ${mysql.version} @@ -77,13 +79,13 @@ junit junit - 4.4 + ${junit.version} commons-io commons-io - 2.4 + ${commons-io.version} diff --git a/jsf/pom.xml b/jsf/pom.xml index 6a4b358252..271a869576 100644 --- a/jsf/pom.xml +++ b/jsf/pom.xml @@ -36,7 +36,7 @@ javax.servlet jstl - 1.2 + ${jstl.version} @@ -123,21 +123,23 @@ - 4.2.5.RELEASE + 4.3.4.RELEASE - 2.2.13 + 2.2.14 3.0.0 - 1.7.13 - 1.1.3 + 1.7.21 + 1.1.7 3.1.0 + + 1.2 - 3.5.1 + 3.6.0 2.6 diff --git a/json-path/pom.xml b/json-path/pom.xml index c03385cf1d..491120d635 100644 --- a/json-path/pom.xml +++ b/json-path/pom.xml @@ -42,7 +42,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.5.1 + ${maven-compiler-plugin.version} 1.8 1.8 @@ -53,13 +53,15 @@ - 2.1.0 + 2.2.0 4.12 - 1.7.14 - 1.1.3 + 1.7.21 + 1.1.7 + + 3.6.0 \ No newline at end of file diff --git a/json/pom.xml b/json/pom.xml index 4d9efe56e4..2b2f80e987 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -10,22 +10,27 @@ org.everit.json org.everit.json.schema - 1.3.0 + ${everit.json.schema.version} com.alibaba fastjson - 1.2.13 + ${fastjson.version} junit junit - 4.12 + ${junit.version} test + + 1.4.1 + 1.2.21 + 4.12 + diff --git a/junit5/pom.xml b/junit5/pom.xml index 84d64e7b42..14aa51dbe2 100644 --- a/junit5/pom.xml +++ b/junit5/pom.xml @@ -13,15 +13,18 @@ UTF-8 1.8 - 5.0.0-M2 - 1.0.0-M2 + 5.0.0-M3 + 1.0.0-M3 + + 3.6.0 + 2.19.1 maven-compiler-plugin - 3.1 + ${maven-compiler-plugin.version} ${java.version} ${java.version} @@ -29,7 +32,7 @@ maven-surefire-plugin - 2.19 + ${maven-surefire-plugin.version} org.junit.platform diff --git a/log-mdc/pom.xml b/log-mdc/pom.xml index 7d68049cde..4cabce502e 100644 --- a/log-mdc/pom.xml +++ b/log-mdc/pom.xml @@ -12,19 +12,19 @@ org.springframework spring-context - 4.3.3.RELEASE + ${springframework.version} org.springframework spring-webmvc - 4.3.3.RELEASE + ${springframework.version} log4j log4j - 1.2.17 + ${log4j.version} @@ -36,31 +36,38 @@ org.apache.logging.log4j log4j-core - 2.7 + ${log4j-api.version} com.lmax disruptor - 3.3.4 + ${disruptor.version} ch.qos.logback logback-classic - 1.1.7 + ${logback.version} junit junit - 4.12 + ${junit.version} test - + + 4.3.4.RELEASE + 1.2.17 + 2.7 + 3.3.6 + 1.1.7 + 4.12 + \ No newline at end of file diff --git a/log4j/README.md b/log4j/README.md index 7355372f23..de07d0c5b7 100644 --- a/log4j/README.md +++ b/log4j/README.md @@ -1,2 +1,6 @@ ### Relevant Articles: - [Introduction to Java Logging](http://www.baeldung.com/java-logging-intro) +- [Introduction to SLF4J](http://www.baeldung.com/slf4j-with-log4j2-logback) +- [Generate equals() and hashCode() with Eclipse](http://www.baeldung.com/java-eclipse-equals-and-hashcode) +- [A Guide To Java Regular Expressions API](http://www.baeldung.com/regular-expressions-java) +- [Introduction to SLF4J](http://www.baeldung.com/slf4j-with-log4j2-logback) diff --git a/log4j/pom.xml b/log4j/pom.xml index ab384d4dd1..9b87c131b9 100644 --- a/log4j/pom.xml +++ b/log4j/pom.xml @@ -13,39 +13,39 @@ log4j log4j - 1.2.17 + ${log4j.version} org.apache.logging.log4j log4j-api - 2.7 + ${log4j-api.version} org.apache.logging.log4j log4j-core - 2.7 + ${log4j-core.version} com.lmax disruptor - 3.3.4 + ${disruptor.version} ch.qos.logback logback-classic - 1.1.7 + ${logback.version} maven-compiler-plugin - 3.3 + ${maven-compiler-plugin.version} true true @@ -58,5 +58,15 @@ + + + 1.2.17 + 2.7 + 2.7 + 3.3.6 + 1.1.7 + + 3.6.0 + \ No newline at end of file diff --git a/log4j2/pom.xml b/log4j2/pom.xml index 83904f2075..124b19330f 100644 --- a/log4j2/pom.xml +++ b/log4j2/pom.xml @@ -18,47 +18,47 @@ org.apache.logging.log4j log4j-core - 2.7 + ${log4j-core.version} com.fasterxml.jackson.core jackson-databind - 2.8.4 + ${jackson.version} com.fasterxml.jackson.dataformat jackson-dataformat-xml - 2.8.4 + ${jackson.version} com.h2database h2 - 1.4.192 + ${h2.version} org.apache.commons commons-dbcp2 - 2.1.1 + ${commons-dbcp2.version} org.apache.logging.log4j log4j-core - 2.7 + ${log4j-core.version} test-jar test junit junit - 4.12 + ${junit.version} test @@ -68,7 +68,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.5.1 + ${maven-compiler-plugin.version} 1.8 1.8 @@ -76,4 +76,13 @@ + + + 2.8.5 + 1.4.193 + 2.1.1 + 2.7 + 4.12 + 3.6.0 + diff --git a/lombok/pom.xml b/lombok/pom.xml index b816642165..24c5722db9 100644 --- a/lombok/pom.xml +++ b/lombok/pom.xml @@ -128,24 +128,24 @@ 1.8 - 1.16.8 + 1.16.12 1.0.0.Final - 1.7.13 - 1.1.3 + 1.7.21 + 1.1.7 4.12 - 3.5.1 + 3.6.0 2.19.1 - ${lombok.version}.0 + 1.16.10.0 diff --git a/mapstruct/README.md b/mapstruct/README.md new file mode 100644 index 0000000000..e279a48f7a --- /dev/null +++ b/mapstruct/README.md @@ -0,0 +1,2 @@ +###Relevant Articles: +- [Quick Guide to MapStruct](http://www.baeldung.com/mapstruct) diff --git a/mapstruct/pom.xml b/mapstruct/pom.xml index aaa3e95f8c..72a67d19db 100644 --- a/mapstruct/pom.xml +++ b/mapstruct/pom.xml @@ -10,7 +10,11 @@ jar - 1.0.0.Final + 1.1.0.Final + 4.12 + 4.3.4.RELEASE + 3.6.0 + 2.19.1 @@ -21,18 +25,18 @@ junit junit - 4.12 + ${junit.version} test org.springframework spring-context - 4.3.2.RELEASE + ${springframework.version} org.springframework spring-test - 4.3.2.RELEASE + ${springframework.version} test @@ -42,7 +46,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.5.1 + ${maven-compiler-plugin.version} 1.8 1.8 @@ -56,10 +60,10 @@ - + org.apache.maven.plugins maven-surefire-plugin - 2.19.1 + ${maven-surefire-plugin.version} **/*IntegrationTest.java diff --git a/mockito/pom.xml b/mockito/pom.xml index 16c7cb0dd8..83005668f3 100644 --- a/mockito/pom.xml +++ b/mockito/pom.xml @@ -101,42 +101,19 @@ - - 4.1.5.RELEASE - 3.2.5.RELEASE - - - 4.3.10.Final - 5.1.35 - - - 1.7.13 - 1.1.3 - - - 5.1.3.Final - 19.0 - 3.4 + 3.5 1.3 4.12 1.10.19 - 1.6.4 - - 4.4.1 - 4.5 - - 2.4.1 + 1.6.6 - 3.3 - 2.6 + 3.6.0 2.18.1 - 2.7 - 1.4.14 diff --git a/mocks/jmockit/pom.xml b/mocks/jmockit/pom.xml index 8b03313a51..44e886ec24 100644 --- a/mocks/jmockit/pom.xml +++ b/mocks/jmockit/pom.xml @@ -17,8 +17,8 @@ 1.24 - 3.3 - 2.18.1 + 3.6.0 + 2.19.1 diff --git a/mocks/mock-comparisons/pom.xml b/mocks/mock-comparisons/pom.xml index 692bfffd53..aa143dac66 100644 --- a/mocks/mock-comparisons/pom.xml +++ b/mocks/mock-comparisons/pom.xml @@ -16,13 +16,13 @@ 4.12 1.10.19 3.4 - 1.24 + 1.29 UTF-8 - 3.3 - 2.18.1 + 3.6.0 + 2.19.1 diff --git a/orika/pom.xml b/orika/pom.xml index c335b0dc22..e8ef696301 100644 --- a/orika/pom.xml +++ b/orika/pom.xml @@ -6,13 +6,15 @@ 1.0 - 1.7.5 - 1.7.5 - 1.4.6 - 4.3 + 1.7.21 + 1.7.21 + 1.5.0 + 4.12 + + 3.6.0 - Orika + orika @@ -48,7 +50,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.3 + ${maven-compiler-plugin.version} 7 7 diff --git a/orika/src/test/java/com/baeldung/orika/OrikaTest.java b/orika/src/test/java/com/baeldung/orika/OrikaTest.java index 18dfcfa44e..f7f14a5f2d 100644 --- a/orika/src/test/java/com/baeldung/orika/OrikaTest.java +++ b/orika/src/test/java/com/baeldung/orika/OrikaTest.java @@ -4,31 +4,31 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; import java.util.Arrays; -import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.junit.Before; +import org.junit.Test; + import ma.glasnost.orika.BoundMapperFacade; import ma.glasnost.orika.CustomMapper; import ma.glasnost.orika.MapperFacade; import ma.glasnost.orika.MapperFactory; -import ma.glasnost.orika.MappingContext; import ma.glasnost.orika.impl.DefaultMapperFactory; -import org.junit.Before; -import org.junit.Test; - public class OrikaTest { + MapperFactory mapperFactory; + CustomMapper customMapper; + // constant to help us cover time zone differences private final long GMT_DIFFERENCE = 46800000; + // + @Before public void before() { mapperFactory = new DefaultMapperFactory.Builder().build(); @@ -68,8 +68,7 @@ public class OrikaTest { @Test public void givenSrcAndDest_whenMapsUsingBoundMapper_thenCorrect() { - BoundMapperFacade boundMapper = mapperFactory - .getMapperFacade(Source.class, Dest.class); + BoundMapperFacade boundMapper = mapperFactory.getMapperFacade(Source.class, Dest.class); Source src = new Source("baeldung", 10); Dest dest = boundMapper.map(src); assertEquals(dest.getAge(), src.getAge()); @@ -78,8 +77,7 @@ public class OrikaTest { @Test public void givenSrcAndDest_whenMapsUsingBoundMapperInReverse_thenCorrect() { - BoundMapperFacade boundMapper = mapperFactory - .getMapperFacade(Source.class, Dest.class); + BoundMapperFacade boundMapper = mapperFactory.getMapperFacade(Source.class, Dest.class); Dest src = new Dest("baeldung", 10); Source dest = boundMapper.mapReverse(src); assertEquals(dest.getAge(), src.getAge()); @@ -88,8 +86,7 @@ public class OrikaTest { @Test public void givenSrcAndDest_whenMapsUsingBoundMapperByObject_thenCorrect() { - BoundMapperFacade boundMapper = mapperFactory - .getMapperFacade(Source.class, Dest.class); + BoundMapperFacade boundMapper = mapperFactory.getMapperFacade(Source.class, Dest.class); Source src = new Source("baeldung", 10); Dest dest = new Dest(); boundMapper.map(src, dest); @@ -99,8 +96,7 @@ public class OrikaTest { @Test public void givenSrcAndDest_whenMapsUsingBoundMapperByObjectInReverse_thenCorrect() { - BoundMapperFacade boundMapper = mapperFactory - .getMapperFacade(Source.class, Dest.class); + BoundMapperFacade boundMapper = mapperFactory.getMapperFacade(Source.class, Dest.class); Dest src = new Dest("baeldung", 10); Source dest = new Source(); boundMapper.mapReverse(src, dest); @@ -110,9 +106,7 @@ public class OrikaTest { @Test public void givenSrcAndDestWithDifferentFieldNames_whenMaps_thenCorrect() { - mapperFactory.classMap(Personne.class, Person.class) - .field("nom", "name").field("surnom", "nickname") - .field("age", "age").register(); + mapperFactory.classMap(Personne.class, Person.class).field("nom", "name").field("surnom", "nickname").field("age", "age").register(); MapperFacade mapper = mapperFactory.getMapperFacade(); @@ -127,8 +121,7 @@ public class OrikaTest { @Test public void givenBothDifferentAndSameFieldNames_whenFailsToMapSameNameFieldAutomatically_thenCorrect() { - mapperFactory.classMap(Personne.class, Person.class) - .field("nom", "name").field("surnom", "nickname").register(); + mapperFactory.classMap(Personne.class, Person.class).field("nom", "name").field("surnom", "nickname").register(); MapperFacade mapper = mapperFactory.getMapperFacade(); Personne frenchPerson = new Personne("Claire", "cla", 25); @@ -139,9 +132,7 @@ public class OrikaTest { @Test public void givenBothDifferentAndSameFieldNames_whenMapsSameNameFieldByDefault_thenCorrect() { - mapperFactory.classMap(Personne.class, Person.class) - .field("nom", "name").field("surnom", "nickname").byDefault() - .register(); + mapperFactory.classMap(Personne.class, Person.class).field("nom", "name").field("surnom", "nickname").byDefault().register(); MapperFacade mapper = mapperFactory.getMapperFacade(); Personne frenchPerson = new Personne("Claire", "cla", 25); @@ -155,9 +146,7 @@ public class OrikaTest { @Test public void givenUnidirectionalMappingSetup_whenMapsUnidirectionally_thenCorrect() { - mapperFactory.classMap(Personne.class, Person.class) - .fieldAToB("nom", "name").fieldAToB("surnom", "nickname") - .fieldAToB("age", "age").register(); + mapperFactory.classMap(Personne.class, Person.class).fieldAToB("nom", "name").fieldAToB("surnom", "nickname").fieldAToB("age", "age").register(); ; MapperFacade mapper = mapperFactory.getMapperFacade(); Personne frenchPerson = new Personne("Claire", "cla", 25); @@ -169,11 +158,9 @@ public class OrikaTest { } - @Test public void givenSrcAndDest_whenCanExcludeField_thenCorrect() { - mapperFactory.classMap(Personne.class, Person.class).exclude("nom") - .field("surnom", "nickname").field("age", "age").register(); + mapperFactory.classMap(Personne.class, Person.class).exclude("nom").field("surnom", "nickname").field("age", "age").register(); MapperFacade mapper = mapperFactory.getMapperFacade(); Personne frenchPerson = new Personne("Claire", "cla", 25); @@ -186,9 +173,7 @@ public class OrikaTest { @Test public void givenSpecificConstructorToUse_whenMaps_thenCorrect() { - mapperFactory.classMap(Personne.class, Person.class).constructorB() - .field("nom", "name").field("surnom", "nickname") - .field("age", "age").register(); + mapperFactory.classMap(Personne.class, Person.class).constructorB().field("nom", "name").field("surnom", "nickname").field("age", "age").register(); ; MapperFacade mapper = mapperFactory.getMapperFacade(); Personne frenchPerson = new Personne("Claire", "cla", 25); @@ -202,12 +187,9 @@ public class OrikaTest { @Test public void givenSrcWithListAndDestWithPrimitiveAttributes_whenMaps_thenCorrect() { - mapperFactory.classMap(PersonNameList.class, PersonNameParts.class) - .field("nameList[0]", "firstName") - .field("nameList[1]", "lastName").register(); + mapperFactory.classMap(PersonNameList.class, PersonNameParts.class).field("nameList[0]", "firstName").field("nameList[1]", "lastName").register(); MapperFacade mapper = mapperFactory.getMapperFacade(); - List nameList = Arrays.asList(new String[]{"Sylvester", - "Stallone"}); + List nameList = Arrays.asList(new String[] { "Sylvester", "Stallone" }); PersonNameList src = new PersonNameList(nameList); PersonNameParts dest = mapper.map(src, PersonNameParts.class); assertEquals(dest.getFirstName(), "Sylvester"); @@ -216,11 +198,9 @@ public class OrikaTest { @Test public void givenSrcWithArrayAndDestWithPrimitiveAttributes_whenMaps_thenCorrect() { - mapperFactory.classMap(PersonNameArray.class, PersonNameParts.class) - .field("nameArray[0]", "firstName") - .field("nameArray[1]", "lastName").register(); + mapperFactory.classMap(PersonNameArray.class, PersonNameParts.class).field("nameArray[0]", "firstName").field("nameArray[1]", "lastName").register(); MapperFacade mapper = mapperFactory.getMapperFacade(); - String[] nameArray = new String[]{"Vin", "Diesel"}; + String[] nameArray = new String[] { "Vin", "Diesel" }; PersonNameArray src = new PersonNameArray(nameArray); PersonNameParts dest = mapper.map(src, PersonNameParts.class); assertEquals(dest.getFirstName(), "Vin"); @@ -229,9 +209,7 @@ public class OrikaTest { @Test public void givenSrcWithMapAndDestWithPrimitiveAttributes_whenMaps_thenCorrect() { - mapperFactory.classMap(PersonNameMap.class, PersonNameParts.class) - .field("nameMap['first']", "firstName") - .field("nameMap[\"last\"]", "lastName").register(); + mapperFactory.classMap(PersonNameMap.class, PersonNameParts.class).field("nameMap['first']", "firstName").field("nameMap[\"last\"]", "lastName").register(); MapperFacade mapper = mapperFactory.getMapperFacade(); Map nameMap = new HashMap<>(); nameMap.put("first", "Leornado"); @@ -244,9 +222,7 @@ public class OrikaTest { @Test public void givenSrcWithNestedFields_whenMaps_thenCorrect() { - mapperFactory.classMap(PersonContainer.class, PersonNameParts.class) - .field("name.firstName", "firstName") - .field("name.lastName", "lastName").register(); + mapperFactory.classMap(PersonContainer.class, PersonNameParts.class).field("name.firstName", "firstName").field("name.lastName", "lastName").register(); MapperFacade mapper = mapperFactory.getMapperFacade(); PersonContainer src = new PersonContainer(new Name("Nick", "Canon")); PersonNameParts dest = mapper.map(src, PersonNameParts.class); @@ -266,8 +242,7 @@ public class OrikaTest { @Test public void givenSrcWithNullAndGlobalConfigForNoNull_whenFailsToMap_ThenCorrect() { - MapperFactory mapperFactory = new DefaultMapperFactory.Builder() - .mapNulls(false).build(); + MapperFactory mapperFactory = new DefaultMapperFactory.Builder().mapNulls(false).build(); mapperFactory.classMap(Source.class, Dest.class); MapperFacade mapper = mapperFactory.getMapperFacade(); Source src = new Source(null, 10); @@ -279,8 +254,7 @@ public class OrikaTest { @Test public void givenSrcWithNullAndLocalConfigForNoNull_whenFailsToMap_ThenCorrect() { - mapperFactory.classMap(Source.class, Dest.class).field("age", "age") - .mapNulls(false).field("name", "name").byDefault().register(); + mapperFactory.classMap(Source.class, Dest.class).field("age", "age").mapNulls(false).field("name", "name").byDefault().register(); MapperFacade mapper = mapperFactory.getMapperFacade(); Source src = new Source(null, 10); Dest dest = new Dest("Clinton", 55); @@ -302,9 +276,7 @@ public class OrikaTest { @Test public void givenDestWithNullReverseMappedToSourceAndLocalConfigForNoNull_whenFailsToMap_thenCorrect() { - mapperFactory.classMap(Source.class, Dest.class).field("age", "age") - .mapNullsInReverse(false).field("name", "name").byDefault() - .register(); + mapperFactory.classMap(Source.class, Dest.class).field("age", "age").mapNullsInReverse(false).field("name", "name").byDefault().register(); MapperFacade mapper = mapperFactory.getMapperFacade(); Dest src = new Dest(null, 10); Source dest = new Source("Vin", 44); @@ -315,9 +287,7 @@ public class OrikaTest { @Test public void givenSrcWithNullAndFieldLevelConfigForNoNull_whenFailsToMap_ThenCorrect() { - mapperFactory.classMap(Source.class, Dest.class).field("age", "age") - .fieldMap("name", "name").mapNulls(false).add().byDefault() - .register(); + mapperFactory.classMap(Source.class, Dest.class).field("age", "age").fieldMap("name", "name").mapNulls(false).add().byDefault().register(); MapperFacade mapper = mapperFactory.getMapperFacade(); Source src = new Source(null, 10); Dest dest = new Dest("Clinton", 55); @@ -328,8 +298,7 @@ public class OrikaTest { @Test public void givenSrcAndDest_whenCustomMapperWorks_thenCorrect() { - mapperFactory.classMap(Personne3.class, Person3.class) - .customize(customMapper).register(); + mapperFactory.classMap(Personne3.class, Person3.class).customize(customMapper).register(); MapperFacade mapper = mapperFactory.getMapperFacade(); long timestamp = new Long("1182882159000"); Personne3 personne3 = new Personne3("Leornardo", timestamp); @@ -339,14 +308,12 @@ public class OrikaTest { // since different timezones will resolve the timestamp to a different // datetime string, it suffices to check only for format rather than // specific date - assertTrue(timestampTest.charAt(10) == 'T' - && timestampTest.charAt(19) == 'Z'); + assertTrue(timestampTest.charAt(10) == 'T' && timestampTest.charAt(19) == 'Z'); } @Test public void givenSrcAndDest_whenCustomMapperWorksBidirectionally_thenCorrect() { - mapperFactory.classMap(Personne3.class, Person3.class) - .customize(customMapper).register(); + mapperFactory.classMap(Personne3.class, Person3.class).customize(customMapper).register(); MapperFacade mapper = mapperFactory.getMapperFacade(); String dateTime = "2007-06-26T21:22:39Z"; @@ -355,12 +322,10 @@ public class OrikaTest { Personne3 personne3 = mapper.map(person3, Personne3.class); long timestampToTest = personne3.getDtob(); /* - * since different timezones will resolve the datetime to a different - * unix timestamp, we must provide a range of tolerance - */ - assertTrue(timestampToTest == timestamp - || timestampToTest >= timestamp - GMT_DIFFERENCE - || timestampToTest <= timestamp + GMT_DIFFERENCE); + * since different timezones will resolve the datetime to a different + * unix timestamp, we must provide a range of tolerance + */ + assertTrue(timestampToTest == timestamp || timestampToTest >= timestamp - GMT_DIFFERENCE || timestampToTest <= timestamp + GMT_DIFFERENCE); } diff --git a/patterns/README.md b/patterns/README.md new file mode 100644 index 0000000000..e5d8334a3e --- /dev/null +++ b/patterns/README.md @@ -0,0 +1,2 @@ +###Relevant Articles: +- [A Guide to the Front Controller Pattern in Java](http://www.baeldung.com/java-front-controller-pattern) diff --git a/patterns/intercepting-filter/pom.xml b/patterns/intercepting-filter/pom.xml index 2cf89246f9..c497307869 100644 --- a/patterns/intercepting-filter/pom.xml +++ b/patterns/intercepting-filter/pom.xml @@ -22,7 +22,7 @@ org.slf4j slf4j-api - 1.7.21 + ${slf4j.version} provided @@ -51,4 +51,8 @@ + + + 1.7.21 + diff --git a/patterns/pom.xml b/patterns/pom.xml index 6797891353..c18b0b3862 100644 --- a/patterns/pom.xml +++ b/patterns/pom.xml @@ -24,7 +24,7 @@ javax.servlet javax.servlet-api - 3.1.0 + ${javax.servlet-api.version} provided @@ -36,7 +36,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.5.1 + ${maven-compiler-plugin.version} 1.8 1.8 @@ -45,14 +45,22 @@ org.apache.maven.plugins maven-war-plugin - 3.0.0 + ${maven-war-plugin.version} org.eclipse.jetty jetty-maven-plugin - 9.3.12.v20160915 + ${jetty-maven-plugin.version} + + + 3.1.0 + + 3.6.0 + 3.0.0 + 9.4.0.v20161208 + diff --git a/pdf/pom.xml b/pdf/pom.xml index c6404c6b30..332e1f5244 100644 --- a/pdf/pom.xml +++ b/pdf/pom.xml @@ -14,6 +14,15 @@ UTF-8 + 4.12 + 2.0.3 + 1.6 + 5.5.10 + 5.5.10 + 3.15 + 1.8 + 3.15 + 3.5.1 @@ -21,43 +30,43 @@ junit junit - 3.8.1 + ${junit.version} test org.apache.pdfbox pdfbox-tools - 2.0.3 + ${pdfbox-tools.version} net.sf.cssbox pdf2dom - 1.6 + ${pdf2dom.version} com.itextpdf itextpdf - 5.5.10 + ${itextpdf.version} com.itextpdf.tool xmlworker - 5.5.10 + ${xmlworker.version} org.apache.poi poi-scratchpad - 3.15 + ${poi-scratchpad.version} org.apache.xmlgraphics batik-transcoder - 1.8 + ${batik-transcoder.version} org.apache.poi poi-ooxml - 3.15 + ${poi-ooxml.version} diff --git a/play-framework/README.md b/play-framework/README.md new file mode 100644 index 0000000000..0fd13fba27 --- /dev/null +++ b/play-framework/README.md @@ -0,0 +1,4 @@ +###Relevant Articles: +- [REST API with Play Framework in Java](http://www.baeldung.com/rest-api-with-play) +- [Routing In Play Applications in Java](http://www.baeldung.com/routing-in-play) +- [Introduction To Play In Java](http://www.baeldung.com/java-intro-to-the-play-framework) diff --git a/querydsl/pom.xml b/querydsl/pom.xml index 13528526ea..a9218e7751 100644 --- a/querydsl/pom.xml +++ b/querydsl/pom.xml @@ -16,10 +16,19 @@ UTF-8 1.8 4.12 - 4.3.1.RELEASE - 5.2.1.Final - 4.1.3 + 4.3.4.RELEASE + 5.2.5.Final + 1.0.0.Final + 4.1.4 + 2.3.4 + 1.6 + 1.4 + 1.7.21 + 1.1.7 + + 3.6.0 + 1.1.3 2.19.1 @@ -50,14 +59,14 @@ org.hibernate.javax.persistence hibernate-jpa-2.1-api - 1.0.0.Final + ${hibernate-jpa.version} compile commons-dbcp commons-dbcp - 1.4 + ${commons-dbcp.version} jar compile @@ -65,7 +74,7 @@ commons-pool commons-pool - 1.6 + ${commons-pool.version} jar compile @@ -74,7 +83,7 @@ org.hsqldb hsqldb - 2.3.4 + ${hsqldb.version} @@ -116,7 +125,7 @@ ch.qos.logback logback-classic - 1.1.7 + ${logback.version} org.slf4j @@ -142,7 +151,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.5.1 + ${maven-compiler-plugin.version} ${java.version} ${java.version} @@ -154,7 +163,7 @@ com.mysema.maven apt-maven-plugin - 1.1.3 + ${apt-maven-plugin.version} diff --git a/redis/pom.xml b/redis/pom.xml index a5d3af8097..8443564ffd 100644 --- a/redis/pom.xml +++ b/redis/pom.xml @@ -15,13 +15,13 @@ redis.clients jedis - 2.8.1 + ${jedis.version} com.github.kstyrc embedded-redis - 0.6 + ${embedded-redis.version} @@ -38,7 +38,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.5.1 + ${maven-compiler-plugin.version} 1.8 1.8 @@ -50,7 +50,13 @@ UTF-8 + + 2.9.0 + 0.6 + 4.12 + + 3.6.0 diff --git a/rest-assured/pom.xml b/rest-assured/pom.xml index e2a2af9cd9..3d1abefeb1 100644 --- a/rest-assured/pom.xml +++ b/rest-assured/pom.xml @@ -10,106 +10,106 @@ javax.servlet javax.servlet-api - 3.1-b06 + ${javax.servlet-api.version} javax.servlet servlet-api - 2.5 + ${servlet-api.version} org.eclipse.jetty jetty-security - 9.2.0.M1 + ${jetty.version} org.eclipse.jetty jetty-servlet - 9.2.0.M1 + ${jetty.version} org.eclipse.jetty jetty-servlets - 9.2.0.M1 + ${jetty.version} org.eclipse.jetty jetty-io - 9.2.0.M1 + ${jetty.version} org.eclipse.jetty jetty-http - 9.2.0.M1 + ${jetty.version} org.eclipse.jetty jetty-server - 9.2.0.M1 + ${jetty.version} org.eclipse.jetty jetty-util - 9.2.0.M1 + ${jetty.version} org.slf4j slf4j-api - 1.7.21 + ${slf4j.version} log4j log4j - 1.2.17 + ${log4j.version} org.slf4j slf4j-log4j12 - 1.7.21 + ${slf4j.version} commons-logging commons-logging - 1.2 + ${commons-logging.version} org.apache.httpcomponents httpcore - 4.4.5 + ${httpcore.version} org.apache.commons commons-lang3 - 3.4 + ${commons-lang3.version} com.github.fge uri-template - 0.9 + ${uri-template.version} com.googlecode.libphonenumber libphonenumber - 7.4.5 + ${libphonenumber.version} javax.mail mail - 1.4.7 + ${javax.mail.version} joda-time joda-time - 2.9.4 + ${joda-time.version} @@ -126,13 +126,13 @@ com.github.fge msg-simple - 1.1 + ${msg-simple.version} com.github.fge jackson-coreutils - 1.8 + ${jackson-coreutils.version} @@ -143,63 +143,63 @@ com.github.fge btf - 1.2 + ${btf.version} org.apache.httpcomponents httpclient - 4.5.2 + ${httpclient.version} org.codehaus.groovy groovy-all - 2.4.7 + ${groovy.version} com.github.tomakehurst wiremock - 2.1.7 + ${wiremock.version} io.rest-assured rest-assured - 3.0.0 + ${rest-assured.version} test io.rest-assured json-schema-validator - 3.0.0 + ${rest-assured-json-schema-validator.version} com.github.fge json-schema-validator - 2.2.6 + ${github-json-schema-validator.version} com.github.fge json-schema-core - 1.2.5 + ${json-schema-core.version} junit junit - 4.3 + ${junit.version} test org.hamcrest hamcrest-all - 1.3 + ${hamcrest.version} commons-collections commons-collections - 3.2.2 + ${commons-collections.version} @@ -209,7 +209,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.3 + ${maven-compiler-plugin.version} 8 8 @@ -219,8 +219,42 @@ - 2.8.3 + 2.8.5 + 1.8 19.0 + + 3.1.0 + 2.5 + 1.4.7 + 9.4.0.v20161208 + + 1.2.17 + 1.7.21 + + 3.5 + 1.2 + 3.2.2 + + 4.4.5 + 4.5.2 + + 0.9 + 8.0.0 + 2.9.6 + 1.1 + 1.2 + 2.4.7 + 2.4.1 + + 2.2.6 + 1.2.5 + + 1.3 + 3.0.1 + 3.0.1 + 4.12 + + 3.6.0 diff --git a/rest-testing/pom.xml b/rest-testing/pom.xml index 90c160af15..f7f94a49a6 100644 --- a/rest-testing/pom.xml +++ b/rest-testing/pom.xml @@ -20,7 +20,7 @@ commons-io commons-io - 2.4 + ${commons-io.version} @@ -106,20 +106,20 @@ com.github.tomakehurst wiremock - 1.58 + ${wiremock.version} test info.cukes cucumber-java - 1.2.4 + ${cucumber.version} test info.cukes cucumber-junit - 1.2.4 + ${cucumber.version} @@ -198,35 +198,33 @@ - 2.7.8 + 2.8.5 - 1.7.13 - 1.1.3 - - - 5.1.3.Final + 1.7.21 + 1.1.7 19.0 - 3.4 + 3.5 + 2.5 1.3 4.12 1.10.19 + 2.9.0 + 1.2.5 + 2.4.1 - 4.4.1 - 4.5 + 4.4.5 + 4.5.2 - 2.9.0 - 3.5.1 + 3.6.0 2.6 2.19.1 - 2.7 - 1.4.18 diff --git a/resteasy/pom.xml b/resteasy/pom.xml index 04e8576e1f..f0bd8298f5 100644 --- a/resteasy/pom.xml +++ b/resteasy/pom.xml @@ -9,9 +9,11 @@ war - 3.0.14.Final + 3.0.19.Final + 4.12 + 2.5 2.19.1 - 1.6.0 + 1.6.1 @@ -93,13 +95,13 @@ junit junit - 4.4 + ${junit.version} commons-io commons-io - 2.4 + ${commons-io.version} diff --git a/selenium-junit-testng/pom.xml b/selenium-junit-testng/pom.xml index 754bf679b5..b4490f779b 100644 --- a/selenium-junit-testng/pom.xml +++ b/selenium-junit-testng/pom.xml @@ -9,7 +9,7 @@ maven-compiler-plugin - 3.1 + ${maven-compiler-plugin.version} 1.8 1.8 @@ -18,7 +18,7 @@ org.apache.maven.plugins maven-surefire-plugin - 2.19.1 + ${maven-surefire-plugin.version} true @@ -38,7 +38,7 @@ org.apache.maven.plugins maven-surefire-plugin - 2.19.1 + ${maven-surefire-plugin.version} **/*LiveTest.java @@ -55,17 +55,26 @@ org.seleniumhq.selenium selenium-java - 3.0.1 + ${selenium-java.version} junit junit - 4.12 + ${junit.version} org.testng testng - 6.9.13.6 + ${testng.version} + + + 4.12 + 6.10 + 3.0.1 + + 2.19.1 + 3.6.0 + \ No newline at end of file diff --git a/spring-akka/pom.xml b/spring-akka/pom.xml index eb33ca4848..1a273b0fed 100644 --- a/spring-akka/pom.xml +++ b/spring-akka/pom.xml @@ -115,11 +115,11 @@ - 4.3.2.RELEASE - 2.4.8 + 4.3.4.RELEASE + 2.4.14 4.12 - 3.5.1 + 3.6.0 2.19.1 diff --git a/spring-all/pom.xml b/spring-all/pom.xml index 23f2531b51..e77bf0b284 100644 --- a/spring-all/pom.xml +++ b/spring-all/pom.xml @@ -11,7 +11,7 @@ org.springframework.boot spring-boot-starter-parent - 1.3.6.RELEASE + 1.4.2.RELEASE @@ -134,7 +134,7 @@ org.assertj assertj-core - 3.5.1 + ${assertj.version} test @@ -158,13 +158,13 @@ org.easymock easymock - 3.4 + ${easymock.version} test org.ehcache ehcache - 3.1.3 + ${ehcache.version} @@ -273,42 +273,17 @@ - 4.3.1.RELEASE - 4.0.4.RELEASE - 3.20.0-GA - 1.2 + 4.3.4.RELEASE + 4.2.0.RELEASE - 4.3.11.Final - 5.1.38 - - - 1.7.13 - 1.1.3 - - - 5.2.2.Final + 5.2.5.Final 19.0 - 3.4 - - - 1.3 - 4.12 - 1.10.19 - - 4.4.1 - 4.5 - - 2.9.0 - - - 3.5.1 - 2.6 - 2.19.1 - 2.7 - 1.4.18 + 3.1.3 + 3.4 + 3.6.1 diff --git a/spring-apache-camel/pom.xml b/spring-apache-camel/pom.xml index 6cd4f136e0..4daa3c1e9a 100644 --- a/spring-apache-camel/pom.xml +++ b/spring-apache-camel/pom.xml @@ -10,9 +10,9 @@ 2.16.1 - 4.2.4.RELEASE - 2.19.1 - 1.7 + 4.3.4.RELEASE + 2.19.1 + 1.8 4.12 @@ -48,7 +48,11 @@ spring-context ${env.spring.version} - + + org.slf4j + slf4j-log4j12 + 1.7.21 + diff --git a/spring-apache-camel/src/main/java/com/baeldung/camel/file/ContentBasedFileRouter.java b/spring-apache-camel/src/main/java/com/baeldung/camel/file/ContentBasedFileRouter.java new file mode 100644 index 0000000000..9106e996c3 --- /dev/null +++ b/spring-apache-camel/src/main/java/com/baeldung/camel/file/ContentBasedFileRouter.java @@ -0,0 +1,16 @@ +package com.baeldung.camel.file; + +import org.apache.camel.builder.RouteBuilder; + +public class ContentBasedFileRouter extends RouteBuilder { + + private static final String SOURCE_FOLDER = "src/test/source-folder"; + private static final String DESTINATION_FOLDER_TXT = "src/test/destination-folder-txt"; + private static final String DESTINATION_FOLDER_OTHER = "src/test/destination-folder-other"; + + @Override + public void configure() throws Exception { + from("file://" + SOURCE_FOLDER + "?delete=true").choice().when(simple("${file:ext} == 'txt'")).to("file://" + DESTINATION_FOLDER_TXT).otherwise().to("file://" + DESTINATION_FOLDER_OTHER); + } + +} diff --git a/spring-apache-camel/src/main/java/com/baeldung/camel/file/DeadLetterChannelFileRouter.java b/spring-apache-camel/src/main/java/com/baeldung/camel/file/DeadLetterChannelFileRouter.java new file mode 100644 index 0000000000..fdcad99f02 --- /dev/null +++ b/spring-apache-camel/src/main/java/com/baeldung/camel/file/DeadLetterChannelFileRouter.java @@ -0,0 +1,18 @@ +package com.baeldung.camel.file; + +import org.apache.camel.LoggingLevel; +import org.apache.camel.builder.RouteBuilder; + +public class DeadLetterChannelFileRouter extends RouteBuilder { + private static final String SOURCE_FOLDER = "src/test/source-folder"; + + @Override + public void configure() throws Exception { + errorHandler(deadLetterChannel("log:dead?level=ERROR").maximumRedeliveries(3) + .redeliveryDelay(1000).retryAttemptedLogLevel(LoggingLevel.ERROR)); + + from("file://" + SOURCE_FOLDER + "?delete=true").process((exchange) -> { + throw new IllegalArgumentException("Exception thrown!"); + }); + } +} diff --git a/spring-apache-camel/src/main/java/com/baeldung/camel/file/MessageTranslatorFileRouter.java b/spring-apache-camel/src/main/java/com/baeldung/camel/file/MessageTranslatorFileRouter.java new file mode 100644 index 0000000000..b99de99dac --- /dev/null +++ b/spring-apache-camel/src/main/java/com/baeldung/camel/file/MessageTranslatorFileRouter.java @@ -0,0 +1,14 @@ +package com.baeldung.camel.file; + +import org.apache.camel.Exchange; +import org.apache.camel.builder.RouteBuilder; + +public class MessageTranslatorFileRouter extends RouteBuilder { + private static final String SOURCE_FOLDER = "src/test/source-folder"; + private static final String DESTINATION_FOLDER = "src/test/destination-folder"; + + @Override + public void configure() throws Exception { + from("file://" + SOURCE_FOLDER + "?delete=true").transform(body().append(header(Exchange.FILE_NAME))).to("file://" + DESTINATION_FOLDER); + } +} diff --git a/spring-apache-camel/src/main/java/com/baeldung/camel/file/MulticastFileRouter.java b/spring-apache-camel/src/main/java/com/baeldung/camel/file/MulticastFileRouter.java new file mode 100644 index 0000000000..75a6e81d45 --- /dev/null +++ b/spring-apache-camel/src/main/java/com/baeldung/camel/file/MulticastFileRouter.java @@ -0,0 +1,18 @@ +package com.baeldung.camel.file; + +import org.apache.camel.builder.RouteBuilder; + +public class MulticastFileRouter extends RouteBuilder { + private static final String SOURCE_FOLDER = "src/test/source-folder"; + private static final String DESTINATION_FOLDER_WORLD = "src/test/destination-folder-world"; + private static final String DESTINATION_FOLDER_HELLO = "src/test/destination-folder-hello"; + + @Override + public void configure() throws Exception { + from("file://" + SOURCE_FOLDER + "?delete=true").multicast().to("direct:append", "direct:prepend").end(); + + from("direct:append").transform(body().append("World")).to("file://" + DESTINATION_FOLDER_WORLD); + + from("direct:prepend").transform(body().prepend("Hello")).to("file://" + DESTINATION_FOLDER_HELLO); + } +} diff --git a/spring-apache-camel/src/main/java/com/baeldung/camel/file/SplitterFileRouter.java b/spring-apache-camel/src/main/java/com/baeldung/camel/file/SplitterFileRouter.java new file mode 100644 index 0000000000..551f9c9685 --- /dev/null +++ b/spring-apache-camel/src/main/java/com/baeldung/camel/file/SplitterFileRouter.java @@ -0,0 +1,15 @@ +package com.baeldung.camel.file; + +import org.apache.camel.Exchange; +import org.apache.camel.builder.RouteBuilder; + +public class SplitterFileRouter extends RouteBuilder { + private static final String SOURCE_FOLDER = "src/test/source-folder"; + private static final String DESTINATION_FOLDER = "src/test/destination-folder"; + + @Override + public void configure() throws Exception { + + from("file://" + SOURCE_FOLDER + "?delete=true").split(body().convertToString().tokenize("\n")).setHeader(Exchange.FILE_NAME, body()).to("file://" + DESTINATION_FOLDER); + } +} diff --git a/spring-apache-camel/src/main/resources/camel-context-ContentBasedFileRouterTest.xml b/spring-apache-camel/src/main/resources/camel-context-ContentBasedFileRouterTest.xml new file mode 100644 index 0000000000..d6d3e62f1c --- /dev/null +++ b/spring-apache-camel/src/main/resources/camel-context-ContentBasedFileRouterTest.xml @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/spring-apache-camel/src/main/resources/camel-context-DeadLetterChannelFileRouter.xml b/spring-apache-camel/src/main/resources/camel-context-DeadLetterChannelFileRouter.xml new file mode 100644 index 0000000000..ef61174b32 --- /dev/null +++ b/spring-apache-camel/src/main/resources/camel-context-DeadLetterChannelFileRouter.xml @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/spring-apache-camel/src/main/resources/camel-context-MessageTranslatorFileRouterTest.xml b/spring-apache-camel/src/main/resources/camel-context-MessageTranslatorFileRouterTest.xml new file mode 100644 index 0000000000..7ab988ca8a --- /dev/null +++ b/spring-apache-camel/src/main/resources/camel-context-MessageTranslatorFileRouterTest.xml @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/spring-apache-camel/src/main/resources/camel-context-MulticastFileRouterTest.xml b/spring-apache-camel/src/main/resources/camel-context-MulticastFileRouterTest.xml new file mode 100644 index 0000000000..6f7e7cbb60 --- /dev/null +++ b/spring-apache-camel/src/main/resources/camel-context-MulticastFileRouterTest.xml @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/spring-apache-camel/src/main/resources/camel-context-SplitterFileRouter.xml b/spring-apache-camel/src/main/resources/camel-context-SplitterFileRouter.xml new file mode 100644 index 0000000000..9d4a890cc6 --- /dev/null +++ b/spring-apache-camel/src/main/resources/camel-context-SplitterFileRouter.xml @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/spring-apache-camel/src/main/resources/log4j.xml b/spring-apache-camel/src/main/resources/log4j.xml new file mode 100644 index 0000000000..4a86fb2357 --- /dev/null +++ b/spring-apache-camel/src/main/resources/log4j.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-apache-camel/src/test/destination-folder/2016-12-14 23-33-25File1.txt b/spring-apache-camel/src/test/destination-folder/2016-12-14 23-33-25File1.txt new file mode 100755 index 0000000000..e69de29bb2 diff --git a/spring-apache-camel/src/test/destination-folder/2016-12-14 23-33-25File2.txt b/spring-apache-camel/src/test/destination-folder/2016-12-14 23-33-25File2.txt new file mode 100755 index 0000000000..e69de29bb2 diff --git a/spring-apache-camel/src/test/java/com/apache/camel/file/processor/ContentBasedFileRouterIntegrationTest.java b/spring-apache-camel/src/test/java/com/apache/camel/file/processor/ContentBasedFileRouterIntegrationTest.java new file mode 100644 index 0000000000..b0920fe3b5 --- /dev/null +++ b/spring-apache-camel/src/test/java/com/apache/camel/file/processor/ContentBasedFileRouterIntegrationTest.java @@ -0,0 +1,56 @@ +package com.apache.camel.file.processor; + +import java.io.File; + +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +@RunWith(JUnit4.class) +public class ContentBasedFileRouterIntegrationTest { + + private static final long DURATION_MILIS = 10000; + private static final String SOURCE_FOLDER = "src/test/source-folder"; + private static final String DESTINATION_FOLDER_TXT = "src/test/destination-folder-txt"; + private static final String DESTINATION_FOLDER_OTHER = "src/test/destination-folder-other"; + + @Before + public void setUp() throws Exception { + File sourceFolder = new File(SOURCE_FOLDER); + File destinationFolderTxt = new File(DESTINATION_FOLDER_TXT); + File destinationFolderOther = new File(DESTINATION_FOLDER_OTHER); + + cleanFolder(sourceFolder); + cleanFolder(destinationFolderTxt); + cleanFolder(destinationFolderOther); + + sourceFolder.mkdirs(); + File file1 = new File(SOURCE_FOLDER + "/File1.txt"); + File file2 = new File(SOURCE_FOLDER + "/File2.csv"); + file1.createNewFile(); + file2.createNewFile(); + } + + private void cleanFolder(File folder) { + File[] files = folder.listFiles(); + if (files != null) { + for (File file : files) { + if (file.isFile()) { + file.delete(); + } + } + } + } + + @Test + @Ignore + public void routeTest() throws InterruptedException { + ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("camel-context-ContentBasedFileRouterTest.xml"); + Thread.sleep(DURATION_MILIS); + applicationContext.close(); + + } +} \ No newline at end of file diff --git a/spring-apache-camel/src/test/java/com/apache/camel/file/processor/DeadLetterChannelFileRouterIntegrationTest.java b/spring-apache-camel/src/test/java/com/apache/camel/file/processor/DeadLetterChannelFileRouterIntegrationTest.java new file mode 100644 index 0000000000..eb684230c9 --- /dev/null +++ b/spring-apache-camel/src/test/java/com/apache/camel/file/processor/DeadLetterChannelFileRouterIntegrationTest.java @@ -0,0 +1,43 @@ +package com.apache.camel.file.processor; + +import java.io.File; + +import org.junit.Before; +import org.junit.Test; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class DeadLetterChannelFileRouterIntegrationTest { + + private static final long DURATION_MILIS = 10000; + private static final String SOURCE_FOLDER = "src/test/source-folder"; + + @Before + public void setUp() throws Exception { + File sourceFolder = new File(SOURCE_FOLDER); + + cleanFolder(sourceFolder); + + sourceFolder.mkdirs(); + File file = new File(SOURCE_FOLDER + "/File.txt"); + file.createNewFile(); + } + + private void cleanFolder(File folder) { + File[] files = folder.listFiles(); + if (files != null) { + for (File file : files) { + if (file.isFile()) { + file.delete(); + } + } + } + } + + @Test + public void routeTest() throws InterruptedException { + ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("camel-context-DeadLetterChannelFileRouter.xml"); + Thread.sleep(DURATION_MILIS); + applicationContext.close(); + + } +} diff --git a/spring-apache-camel/src/test/java/org/apache/camel/file/processor/FileProcessorIntegrationTest.java b/spring-apache-camel/src/test/java/com/apache/camel/file/processor/FileProcessorIntegrationTest.java similarity index 98% rename from spring-apache-camel/src/test/java/org/apache/camel/file/processor/FileProcessorIntegrationTest.java rename to spring-apache-camel/src/test/java/com/apache/camel/file/processor/FileProcessorIntegrationTest.java index e73ad1e4a4..1d88e8aeb4 100644 --- a/spring-apache-camel/src/test/java/org/apache/camel/file/processor/FileProcessorIntegrationTest.java +++ b/spring-apache-camel/src/test/java/com/apache/camel/file/processor/FileProcessorIntegrationTest.java @@ -1,4 +1,4 @@ -package org.apache.camel.file.processor; +package com.apache.camel.file.processor; import java.io.File; diff --git a/spring-apache-camel/src/test/java/org/apache/camel/file/processor/FileProcessorTest.java b/spring-apache-camel/src/test/java/com/apache/camel/file/processor/FileProcessorTest.java similarity index 98% rename from spring-apache-camel/src/test/java/org/apache/camel/file/processor/FileProcessorTest.java rename to spring-apache-camel/src/test/java/com/apache/camel/file/processor/FileProcessorTest.java index 3d63f614e0..c4a3ced84f 100644 --- a/spring-apache-camel/src/test/java/org/apache/camel/file/processor/FileProcessorTest.java +++ b/spring-apache-camel/src/test/java/com/apache/camel/file/processor/FileProcessorTest.java @@ -1,4 +1,4 @@ -package org.apache.camel.file.processor; +package com.apache.camel.file.processor; import java.io.File; diff --git a/spring-apache-camel/src/test/java/com/apache/camel/file/processor/MessageTranslatorFileRouterIntegrationTest.java b/spring-apache-camel/src/test/java/com/apache/camel/file/processor/MessageTranslatorFileRouterIntegrationTest.java new file mode 100644 index 0000000000..bcd382dd6c --- /dev/null +++ b/spring-apache-camel/src/test/java/com/apache/camel/file/processor/MessageTranslatorFileRouterIntegrationTest.java @@ -0,0 +1,50 @@ +package com.apache.camel.file.processor; + +import java.io.File; + +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class MessageTranslatorFileRouterIntegrationTest { + + private static final long DURATION_MILIS = 10000; + private static final String SOURCE_FOLDER = "src/test/source-folder"; + private static final String DESTINATION_FOLDER = "src/test/destination-folder"; + + @Before + public void setUp() throws Exception { + File sourceFolder = new File(SOURCE_FOLDER); + File destinationFolder = new File(DESTINATION_FOLDER); + + cleanFolder(sourceFolder); + cleanFolder(destinationFolder); + + sourceFolder.mkdirs(); + File file1 = new File(SOURCE_FOLDER + "/File1.txt"); + File file2 = new File(SOURCE_FOLDER + "/File2.txt"); + file1.createNewFile(); + file2.createNewFile(); + } + + private void cleanFolder(File folder) { + File[] files = folder.listFiles(); + if (files != null) { + for (File file : files) { + if (file.isFile()) { + file.delete(); + } + } + } + } + + @Test + @Ignore + public void routeTest() throws InterruptedException { + ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("camel-context-MessageTranslatorFileRouterTest.xml"); + Thread.sleep(DURATION_MILIS); + applicationContext.close(); + + } +} diff --git a/spring-apache-camel/src/test/java/com/apache/camel/file/processor/MulticastFileRouterIntegrationTest.java b/spring-apache-camel/src/test/java/com/apache/camel/file/processor/MulticastFileRouterIntegrationTest.java new file mode 100644 index 0000000000..137480ac8e --- /dev/null +++ b/spring-apache-camel/src/test/java/com/apache/camel/file/processor/MulticastFileRouterIntegrationTest.java @@ -0,0 +1,53 @@ +package com.apache.camel.file.processor; + +import java.io.File; + +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class MulticastFileRouterIntegrationTest { + + private static final long DURATION_MILIS = 10000; + private static final String SOURCE_FOLDER = "src/test/source-folder"; + private static final String DESTINATION_FOLDER_WORLD = "src/test/destination-folder-world"; + private static final String DESTINATION_FOLDER_HELLO = "src/test/destination-folder-hello"; + + @Before + public void setUp() throws Exception { + File sourceFolder = new File(SOURCE_FOLDER); + File destinationFolderWorld = new File(DESTINATION_FOLDER_WORLD); + File destinationFolderHello = new File(DESTINATION_FOLDER_HELLO); + + cleanFolder(sourceFolder); + cleanFolder(destinationFolderWorld); + cleanFolder(destinationFolderHello); + + sourceFolder.mkdirs(); + File file1 = new File(SOURCE_FOLDER + "/File1.txt"); + File file2 = new File(SOURCE_FOLDER + "/File2.txt"); + file1.createNewFile(); + file2.createNewFile(); + } + + private void cleanFolder(File folder) { + File[] files = folder.listFiles(); + if (files != null) { + for (File file : files) { + if (file.isFile()) { + file.delete(); + } + } + } + } + + @Test + @Ignore + public void routeTest() throws InterruptedException { + ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("camel-context-MulticastFileRouterTest.xml"); + Thread.sleep(DURATION_MILIS); + applicationContext.close(); + + } +} diff --git a/spring-apache-camel/src/test/java/com/apache/camel/file/processor/SplitterFileRouterIntegrationTest.java b/spring-apache-camel/src/test/java/com/apache/camel/file/processor/SplitterFileRouterIntegrationTest.java new file mode 100644 index 0000000000..1991dd8d21 --- /dev/null +++ b/spring-apache-camel/src/test/java/com/apache/camel/file/processor/SplitterFileRouterIntegrationTest.java @@ -0,0 +1,52 @@ +package com.apache.camel.file.processor; + +import java.io.File; +import java.io.FileWriter; + +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class SplitterFileRouterIntegrationTest { + + private static final long DURATION_MILIS = 10000; + private static final String SOURCE_FOLDER = "src/test/source-folder"; + private static final String DESTINATION_FOLDER = "src/test/destination-folder"; + + @Before + public void setUp() throws Exception { + File sourceFolder = new File(SOURCE_FOLDER); + File destinationFolder = new File(DESTINATION_FOLDER); + + cleanFolder(sourceFolder); + cleanFolder(destinationFolder); + + sourceFolder.mkdirs(); + File file = new File(SOURCE_FOLDER + "/File.txt"); + FileWriter fileWriter = new FileWriter(file, false); + fileWriter.write("Hello\nWorld"); + file.createNewFile(); + fileWriter.close(); + } + + private void cleanFolder(File folder) { + File[] files = folder.listFiles(); + if (files != null) { + for (File file : files) { + if (file.isFile()) { + file.delete(); + } + } + } + } + + @Test + @Ignore + public void routeTests() throws InterruptedException { + ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("camel-context-SplitterFileRouter.xml"); + Thread.sleep(DURATION_MILIS); + applicationContext.close(); + + } +} diff --git a/spring-apache-camel/src/test/java/org/apache/camel/main/AppIntegrationTest.java b/spring-apache-camel/src/test/java/com/apache/camel/main/AppIntegrationTest.java similarity index 96% rename from spring-apache-camel/src/test/java/org/apache/camel/main/AppIntegrationTest.java rename to spring-apache-camel/src/test/java/com/apache/camel/main/AppIntegrationTest.java index fc7fa9653b..b33e6a3b29 100644 --- a/spring-apache-camel/src/test/java/org/apache/camel/main/AppIntegrationTest.java +++ b/spring-apache-camel/src/test/java/com/apache/camel/main/AppIntegrationTest.java @@ -1,4 +1,4 @@ -package org.apache.camel.main; +package com.apache.camel.main; import com.baeldung.camel.main.App; import junit.framework.TestCase; diff --git a/spring-autowire/pom.xml b/spring-autowire/pom.xml index fd03c77605..391cfc018e 100644 --- a/spring-autowire/pom.xml +++ b/spring-autowire/pom.xml @@ -12,8 +12,9 @@ UTF-8 - 4.2.5.RELEASE - 3.5.1 + 4.3.4.RELEASE + 4.12 + 3.6.0 2.19.1 @@ -21,7 +22,7 @@ junit junit - 4.11 + ${junit.version} org.springframework diff --git a/spring-batch/pom.xml b/spring-batch/pom.xml index 5538dd912f..a92a0e8323 100644 --- a/spring-batch/pom.xml +++ b/spring-batch/pom.xml @@ -11,9 +11,9 @@ UTF-8 - 4.2.0.RELEASE - 3.0.5.RELEASE - 3.8.11.2 + 4.3.4.RELEASE + 3.0.7.RELEASE + 3.15.1 diff --git a/spring-boot/README.MD b/spring-boot/README.MD index 1610d77e81..19203d2b8d 100644 --- a/spring-boot/README.MD +++ b/spring-boot/README.MD @@ -5,3 +5,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Quick Guide to @RestClientTest in Spring Boot](http://www.baeldung.com/restclienttest-in-spring-boot) - [Intro to Spring Boot Starters](http://www.baeldung.com/spring-boot-starters) - [A Guide to Spring in Eclipse STS](http://www.baeldung.com/eclipse-sts-spring) +- [Introduction to WebJars](http://www.baeldung.com/maven-webjars) diff --git a/spring-boot/pom.xml b/spring-boot/pom.xml index a2555259b0..68a5857865 100644 --- a/spring-boot/pom.xml +++ b/spring-boot/pom.xml @@ -1,136 +1,128 @@ - 4.0.0 - com.baeldung - spring-boot - 0.0.1-SNAPSHOT - war - Spring Boot Actuator - This is simple boot application for Spring boot actuator test + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + com.baeldung + spring-boot + 0.0.1-SNAPSHOT + war + spring-boot + This is simple boot application for Spring boot actuator test - - - org.springframework.boot - spring-boot-starter-parent - 1.4.0.RC1 - - + + + org.springframework.boot + spring-boot-starter-parent + 1.4.2.RELEASE + + - - - org.baeldung.boot.DemoApplication - UTF-8 - 1.8 - 4.3.1.RELEASE - + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-web + - - - org.springframework.boot - spring-boot-starter-thymeleaf - - - org.springframework.boot - spring-boot-starter-web - + + org.springframework.boot + spring-boot-starter-data-jpa + - - org.springframework.boot - spring-boot-starter-data-jpa - + + org.springframework.boot + spring-boot-starter-actuator + - - org.springframework.boot - spring-boot-starter-actuator - + + org.springframework.boot + spring-boot-starter-security + - - org.springframework.boot - spring-boot-starter-security - + + io.dropwizard.metrics + metrics-core + - - io.dropwizard.metrics - metrics-core - + + com.h2database + h2 + - - com.h2database - h2 - + + org.springframework.boot + spring-boot-starter-test + test + - - org.springframework.boot - spring-boot-starter-test - test - + + org.springframework.boot + spring-boot-starter + + + com.jayway.jsonpath + json-path + test + + + org.springframework.boot + spring-boot-starter-mail + + + org.subethamail + subethasmtp + ${subethasmtp.version} + test + - - org.springframework.boot - spring-boot-starter - - - com.jayway.jsonpath - json-path - test - - - org.springframework.boot - spring-boot-starter-mail - - - org.subethamail - subethasmtp - 3.1.7 - test - - - - org.webjars - bootstrap - 3.3.7-1 - - - org.webjars - jquery - 3.1.1 - - + + org.webjars + bootstrap + ${bootstrap.version} + + + org.webjars + jquery + ${jquery.version} + + - - spring-boot - - - src/main/resources - true - - + + spring-boot + + + src/main/resources + true + + - + - - org.springframework.boot - spring-boot-maven-plugin - + + org.springframework.boot + spring-boot-maven-plugin + - - org.apache.maven.plugins - maven-compiler-plugin - - 1.8 - 1.8 - - + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + - - org.apache.maven.plugins - maven-war-plugin - + + org.apache.maven.plugins + maven-war-plugin + pl.project13.maven git-commit-id-plugin - 2.2.1 + ${git-commit-id-plugin.version} @@ -143,10 +135,10 @@ - + - + @@ -182,42 +174,18 @@ - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - + + + + + org.baeldung.boot.DemoApplication + UTF-8 + 1.8 + 4.3.4.RELEASE + 2.2.1 + 3.1.1 + 3.3.7-1 + 3.1.7 + diff --git a/spring-cloud-data-flow/batch-job/pom.xml b/spring-cloud-data-flow/batch-job/pom.xml index 99e57d4c20..3d05732027 100644 --- a/spring-cloud-data-flow/batch-job/pom.xml +++ b/spring-cloud-data-flow/batch-job/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 1.4.0.RELEASE + 1.4.2.RELEASE @@ -22,13 +22,14 @@ UTF-8 UTF-8 1.8 + 1.0.3.RELEASE org.springframework.cloud spring-cloud-task-starter - 1.0.1.RELEASE + ${spring-cloud-task-starter.version} diff --git a/spring-cloud-data-flow/data-flow-server/pom.xml b/spring-cloud-data-flow/data-flow-server/pom.xml index 451a58e12a..05684008c6 100644 --- a/spring-cloud-data-flow/data-flow-server/pom.xml +++ b/spring-cloud-data-flow/data-flow-server/pom.xml @@ -1,68 +1,70 @@ - 4.0.0 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 - org.baeldung.spring.cloud - data-flow-server - 0.0.1-SNAPSHOT - jar + org.baeldung.spring.cloud + data-flow-server + 0.0.1-SNAPSHOT + jar - data-flow-server - Demo project for Spring Boot + data-flow-server + Demo project for Spring Boot - - org.springframework.boot - spring-boot-starter-parent - 1.4.0.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.cloud - spring-cloud-starter-dataflow-server-local - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.cloud - spring-cloud-dataflow-dependencies - 1.0.0.BUILD-SNAPSHOT - pom - import - - - org.springframework.cloud - spring-cloud-dependencies - Brixton.SR5 - pom - import - - - - - - - + org.springframework.boot - spring-boot-maven-plugin - - + spring-boot-starter-parent + 1.4.2.RELEASE + + + + + UTF-8 + UTF-8 + 1.8 + 1.1.0.RELEASE + Brixton.SR7 + + + + + org.springframework.cloud + spring-cloud-starter-dataflow-server-local + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.cloud + spring-cloud-dataflow-dependencies + ${spring-cloud-dataflow-dependencies.version} + pom + import + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud-dependencies.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + org.apache.maven.plugins maven-surefire-plugin @@ -110,23 +112,23 @@ - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + diff --git a/spring-cloud-data-flow/data-flow-shell/pom.xml b/spring-cloud-data-flow/data-flow-shell/pom.xml index 31d3dce507..6711edcb42 100644 --- a/spring-cloud-data-flow/data-flow-shell/pom.xml +++ b/spring-cloud-data-flow/data-flow-shell/pom.xml @@ -1,67 +1,69 @@ - 4.0.0 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 - org.baeldung.spring.cloud - data-flow-shell - 0.0.1-SNAPSHOT - jar + org.baeldung.spring.cloud + data-flow-shell + 0.0.1-SNAPSHOT + jar - data-flow-shell - Demo project for Spring Boot + data-flow-shell + Demo project for Spring Boot - - org.springframework.boot - spring-boot-starter-parent - 1.4.0.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.cloud - spring-cloud-dataflow-shell - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.cloud - spring-cloud-dataflow-dependencies - 1.0.0.BUILD-SNAPSHOT - pom - import - - - org.springframework.cloud - spring-cloud-dependencies - Brixton.SR5 - pom - import - - - - - - - + org.springframework.boot - spring-boot-maven-plugin - + spring-boot-starter-parent + 1.4.2.RELEASE + + + + + UTF-8 + UTF-8 + 1.8 + Brixton.SR7 + 1.1.0.RELEASE + + + + + org.springframework.cloud + spring-cloud-dataflow-shell + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.cloud + spring-cloud-dataflow-dependencies + ${spring-cloud-dataflow-dependencies.version} + pom + import + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud-dependencies.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + org.apache.maven.plugins maven-surefire-plugin @@ -75,23 +77,23 @@ - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + diff --git a/spring-cloud-data-flow/log-sink/pom.xml b/spring-cloud-data-flow/log-sink/pom.xml index db488c05ef..6443ed88c8 100644 --- a/spring-cloud-data-flow/log-sink/pom.xml +++ b/spring-cloud-data-flow/log-sink/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 1.4.0.RELEASE + 1.4.2.RELEASE @@ -22,6 +22,7 @@ UTF-8 UTF-8 1.8 + Brixton.SR7 @@ -42,7 +43,7 @@ org.springframework.cloud spring-cloud-dependencies - Brixton.SR5 + ${spring-cloud-dependencies.version} pom import diff --git a/spring-cloud-data-flow/time-processor/pom.xml b/spring-cloud-data-flow/time-processor/pom.xml index 8277c9c836..d7553b110f 100644 --- a/spring-cloud-data-flow/time-processor/pom.xml +++ b/spring-cloud-data-flow/time-processor/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 1.4.0.RELEASE + 1.4.2.RELEASE @@ -22,6 +22,7 @@ UTF-8 UTF-8 1.8 + Brixton.SR7 @@ -42,7 +43,7 @@ org.springframework.cloud spring-cloud-dependencies - Brixton.SR5 + ${spring-cloud-dependencies.version} pom import diff --git a/spring-cloud-data-flow/time-source/pom.xml b/spring-cloud-data-flow/time-source/pom.xml index 086d761f78..2523dfabea 100644 --- a/spring-cloud-data-flow/time-source/pom.xml +++ b/spring-cloud-data-flow/time-source/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 1.4.0.RELEASE + 1.4.2.RELEASE @@ -22,6 +22,7 @@ UTF-8 UTF-8 1.8 + Brixton.SR7 @@ -42,7 +43,7 @@ org.springframework.cloud spring-cloud-dependencies - Brixton.SR5 + ${spring-cloud-dependencies.version} pom import diff --git a/spring-cloud/pom.xml b/spring-cloud/pom.xml index 455a5b876b..299115634e 100644 --- a/spring-cloud/pom.xml +++ b/spring-cloud/pom.xml @@ -26,6 +26,16 @@ UTF-8 + 1.2.2.RELEASE + Brixton.SR7 + 1.2.2.RELEASE + 1.2.2.RELEASE + 1.2.3.RELEASE + 1.2.3.RELEASE + 1.2.3.RELEASE + 1.4.2.RELEASE + 3.6.0 + 1.4.2.RELEASE @@ -34,7 +44,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.5.1 + ${maven-compiler-plugin.version} 1.8 1.8 @@ -43,7 +53,7 @@ org.springframework.boot spring-boot-maven-plugin - 1.4.0.RELEASE + ${spring-boot-maven-plugin.version} diff --git a/spring-cloud/spring-cloud-bootstrap/config/pom.xml b/spring-cloud/spring-cloud-bootstrap/config/pom.xml index bcb40ac062..24d054a87b 100644 --- a/spring-cloud/spring-cloud-bootstrap/config/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/config/pom.xml @@ -10,7 +10,7 @@ org.springframework.boot spring-boot-starter-parent - 1.4.0.RELEASE + 1.4.2.RELEASE @@ -39,7 +39,7 @@ org.springframework.cloud spring-cloud-dependencies - Brixton.RELEASE + ${spring-cloud-dependencies.version} pom import @@ -55,7 +55,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.3 + ${maven-compiler-plugin.version} 1.8 1.8 @@ -64,4 +64,8 @@ + + Brixton.SR7 + 3.6.0 + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml b/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml index f3cb3be2af..6d5d2cfe0b 100644 --- a/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml @@ -10,7 +10,7 @@ org.springframework.boot spring-boot-starter-parent - 1.4.0.RELEASE + 1.4.2.RELEASE @@ -36,7 +36,7 @@ org.springframework.session spring-session - 1.2.1.RELEASE + ${spring-session.version} org.springframework.boot @@ -49,7 +49,7 @@ org.springframework.cloud spring-cloud-dependencies - Brixton.RELEASE + ${spring-cloud-dependencies.version} pom import @@ -65,7 +65,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.3 + ${maven-compiler-plugin.version} 1.8 1.8 @@ -73,4 +73,10 @@ + + + 1.2.2.RELEASE + Brixton.SR7 + 3.6.0 + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml b/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml index add551ff95..fb075e1e2c 100644 --- a/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml @@ -10,7 +10,7 @@ org.springframework.boot spring-boot-starter-parent - 1.4.0.RELEASE + 1.4.2.RELEASE @@ -35,7 +35,7 @@ org.springframework.session spring-session - 1.2.1.RELEASE + ${spring-session.version} org.springframework.boot @@ -54,7 +54,7 @@ org.springframework.cloud spring-cloud-dependencies - Brixton.RELEASE + ${spring-cloud-dependencies.version} pom import @@ -70,7 +70,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.3 + ${maven-compiler-plugin.version} 1.8 1.8 @@ -78,4 +78,10 @@ + + + 1.2.2.RELEASE + Brixton.SR7 + 3.6.0 + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/resource/pom.xml b/spring-cloud/spring-cloud-bootstrap/resource/pom.xml index 8940ca71da..b1ea652be4 100644 --- a/spring-cloud/spring-cloud-bootstrap/resource/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/resource/pom.xml @@ -10,7 +10,7 @@ org.springframework.boot spring-boot-starter-parent - 1.4.0.RELEASE + 1.4.2.RELEASE @@ -35,7 +35,7 @@ org.springframework.session spring-session - 1.2.1.RELEASE + ${spring-session.version} org.springframework.boot @@ -54,7 +54,7 @@ org.springframework.cloud spring-cloud-dependencies - Brixton.RELEASE + ${spring-cloud-dependencies.version} pom import @@ -70,7 +70,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.3 + ${maven-compiler-plugin.version} 1.8 1.8 @@ -78,4 +78,9 @@ + + 1.2.2.RELEASE + Brixton.SR7 + 3.6.0 + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-config/client/pom.xml b/spring-cloud/spring-cloud-config/client/pom.xml index 2c4b748e8a..24da043515 100644 --- a/spring-cloud/spring-cloud-config/client/pom.xml +++ b/spring-cloud/spring-cloud-config/client/pom.xml @@ -14,7 +14,7 @@ org.springframework.cloud spring-cloud-starter-config - 1.2.0.RELEASE + ${spring-cloud-starter-config.version} org.springframework.boot @@ -38,4 +38,9 @@ + + + 1.2.2.RELEASE + 1.4.2.RELEASE + diff --git a/spring-cloud/spring-cloud-config/pom.xml b/spring-cloud/spring-cloud-config/pom.xml index 7d9fd97ee4..d25037a49f 100644 --- a/spring-cloud/spring-cloud-config/pom.xml +++ b/spring-cloud/spring-cloud-config/pom.xml @@ -16,7 +16,7 @@ org.springframework.boot spring-boot-starter-parent - 1.4.1.RELEASE + 1.4.2.RELEASE @@ -25,7 +25,7 @@ org.springframework.cloud spring-cloud-dependencies - Camden.SR1 + ${spring-cloud-dependencies.version} pom import @@ -52,7 +52,8 @@ UTF-8 UTF-8 1.8 - 1.4.1.RELEASE + 1.4.2.RELEASE 2.19.1 + Brixton.SR7 diff --git a/spring-cloud/spring-cloud-config/server/pom.xml b/spring-cloud/spring-cloud-config/server/pom.xml index 33fac435b1..fff6b0f3ee 100644 --- a/spring-cloud/spring-cloud-config/server/pom.xml +++ b/spring-cloud/spring-cloud-config/server/pom.xml @@ -14,7 +14,7 @@ org.springframework.cloud spring-cloud-config-server - 1.2.0.RELEASE + ${spring-cloud-config-server.version} org.springframework.boot @@ -44,4 +44,10 @@ + + + 1.2.2.RELEASE + 1.4.2.RELEASE + + diff --git a/spring-cloud/spring-cloud-eureka/pom.xml b/spring-cloud/spring-cloud-eureka/pom.xml index f02bf7ad9c..2c3b4032af 100644 --- a/spring-cloud/spring-cloud-eureka/pom.xml +++ b/spring-cloud/spring-cloud-eureka/pom.xml @@ -25,6 +25,8 @@ UTF-8 + 3.6.0 + 1.4.2.RELEASE @@ -33,7 +35,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.5.1 + ${maven-compiler-plugin.version} 1.8 1.8 @@ -42,7 +44,7 @@ org.springframework.boot spring-boot-maven-plugin - 1.4.0.RELEASE + ${spring-boot-maven-plugin.version} diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml index 720b49ddc2..a56c732e40 100644 --- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml +++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml @@ -21,12 +21,12 @@ org.springframework.cloud spring-cloud-starter-eureka - 1.1.5.RELEASE + ${spring-cloud-starter-eureka.version} org.springframework.boot spring-boot-starter-web - 1.4.0.RELEASE + ${spring-boot-starter-web.version} @@ -35,7 +35,7 @@ org.springframework.cloud spring-cloud-starter-parent - Brixton.SR4 + ${spring-cloud-dependencies.version} pom import @@ -54,4 +54,10 @@ + + + Brixton.SR7 + 1.2.3.RELEASE + 1.4.2.RELEASE + diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/pom.xml b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/pom.xml index 9e639c666a..cb3c6fc289 100644 --- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/pom.xml +++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/pom.xml @@ -26,17 +26,17 @@ org.springframework.cloud spring-cloud-starter-feign - 1.1.5.RELEASE + ${spring-cloud-starter-feign.version} org.springframework.boot spring-boot-starter-web - 1.4.0.RELEASE + ${spring-boot-starter-web.version} org.springframework.boot spring-boot-starter-thymeleaf - 1.4.0.RELEASE + ${spring-boot-starter-web.version} @@ -45,7 +45,7 @@ org.springframework.cloud spring-cloud-starter-parent - Brixton.SR4 + ${spring-cloud-dependencies.version} pom import @@ -64,4 +64,11 @@ + + + Brixton.SR7 + 1.2.3.RELEASE + 1.2.3.RELEASE + 1.4.2.RELEASE + diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/pom.xml b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/pom.xml index f4d655f708..a728712ead 100644 --- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/pom.xml +++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/pom.xml @@ -21,7 +21,7 @@ org.springframework.cloud spring-cloud-starter-eureka-server - 1.1.5.RELEASE + ${spring-cloud-starter-eureka.version} @@ -30,7 +30,7 @@ org.springframework.cloud spring-cloud-starter-parent - Brixton.SR4 + ${spring-cloud-dependencies.version} pom import @@ -49,4 +49,9 @@ + + + Brixton.SR7 + 1.2.3.RELEASE + diff --git a/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml b/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml index 8209dc8c67..9c8d88ae8e 100644 --- a/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml +++ b/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml @@ -25,32 +25,32 @@ org.springframework.cloud spring-cloud-starter-hystrix - 1.1.5.RELEASE + ${spring-cloud-starter-hystrix.version} org.springframework.cloud spring-cloud-starter-hystrix-dashboard - 1.1.5.RELEASE + ${spring-cloud-starter-hystrix.version} org.springframework.cloud spring-cloud-starter-feign - 1.1.5.RELEASE + ${spring-cloud-starter-feign.version} org.springframework.boot spring-boot-starter-web - 1.4.0.RELEASE + ${spring-boot-starter-web.version} org.springframework.boot spring-boot-starter-thymeleaf - 1.4.0.RELEASE + ${spring-boot-starter-web.version} org.springframework.boot spring-boot-starter-actuator - 1.4.0.RELEASE + ${spring-boot-starter-web.version} @@ -59,7 +59,7 @@ org.springframework.cloud spring-cloud-starter-parent - Brixton.SR4 + ${spring-cloud-dependencies.version} pom import @@ -78,4 +78,10 @@ + + + 1.2.3.RELEASE + 1.2.3.RELEASE + 1.4.2.RELEASE + diff --git a/spring-cloud/spring-cloud-hystrix/pom.xml b/spring-cloud/spring-cloud-hystrix/pom.xml index b992ce3846..67f50e3a91 100644 --- a/spring-cloud/spring-cloud-hystrix/pom.xml +++ b/spring-cloud/spring-cloud-hystrix/pom.xml @@ -24,6 +24,8 @@ UTF-8 + 3.6.0 + 1.4.2.RELEASE @@ -32,7 +34,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.5.1 + ${maven-compiler-plugin.version} 1.8 1.8 @@ -41,7 +43,7 @@ org.springframework.boot spring-boot-maven-plugin - 1.4.0.RELEASE + ${spring-boot-maven-plugin.version} diff --git a/spring-cloud/spring-cloud-hystrix/rest-consumer/pom.xml b/spring-cloud/spring-cloud-hystrix/rest-consumer/pom.xml index 649ca88eb3..02c009510e 100644 --- a/spring-cloud/spring-cloud-hystrix/rest-consumer/pom.xml +++ b/spring-cloud/spring-cloud-hystrix/rest-consumer/pom.xml @@ -20,27 +20,27 @@ org.springframework.cloud spring-cloud-starter-hystrix - 1.1.5.RELEASE + ${spring-cloud-starter-hystrix.version} org.springframework.cloud spring-cloud-starter-hystrix-dashboard - 1.1.5.RELEASE + ${spring-cloud-starter-hystrix.version} org.springframework.boot spring-boot-starter-web - 1.4.0.RELEASE + ${spring-boot-starter-web.version} org.springframework.boot spring-boot-starter-thymeleaf - 1.4.0.RELEASE + ${spring-boot-starter-web.version} org.springframework.boot spring-boot-starter-actuator - 1.4.0.RELEASE + ${spring-boot-starter-web.version} @@ -49,7 +49,7 @@ org.springframework.cloud spring-cloud-starter-parent - Brixton.SR4 + ${spring-cloud-dependencies.version} pom import @@ -68,4 +68,10 @@ + + + Brixton.SR7 + 1.2.3.RELEASE + 1.4.2.RELEASE + diff --git a/spring-cloud/spring-cloud-hystrix/rest-producer/pom.xml b/spring-cloud/spring-cloud-hystrix/rest-producer/pom.xml index 726d18d2c3..85d5a4a11e 100644 --- a/spring-cloud/spring-cloud-hystrix/rest-producer/pom.xml +++ b/spring-cloud/spring-cloud-hystrix/rest-producer/pom.xml @@ -20,7 +20,7 @@ org.springframework.boot spring-boot-starter-web - 1.4.0.RELEASE + ${spring-boot-starter-web.version} @@ -36,4 +36,8 @@ + + + Brixton.SR7 + diff --git a/spring-cloud/spring-cloud-ribbon-client/pom.xml b/spring-cloud/spring-cloud-ribbon-client/pom.xml index c597c5ab8e..d4862fc4e8 100644 --- a/spring-cloud/spring-cloud-ribbon-client/pom.xml +++ b/spring-cloud/spring-cloud-ribbon-client/pom.xml @@ -11,14 +11,15 @@ org.springframework.boot spring-boot-starter-parent - 1.4.1.RELEASE + 1.4.2.RELEASE UTF-8 1.8 - + Brixton.SR7 + @@ -42,7 +43,7 @@ org.springframework.cloud spring-cloud-dependencies - Camden.SR1 + ${spring-cloud-dependencies.version} pom import diff --git a/spring-core/pom.xml b/spring-core/pom.xml index bf8c8f3ebc..cca6e7f08f 100644 --- a/spring-core/pom.xml +++ b/spring-core/pom.xml @@ -14,43 +14,43 @@ org.mockito mockito-all - 1.10.19 + ${mockito.version} org.springframework spring-test - 4.2.6.RELEASE + ${spring.version} org.springframework spring-core - 4.2.6.RELEASE + ${spring.version} org.springframework spring-beans - 4.2.6.RELEASE + ${spring.version} org.springframework spring-context - 4.2.6.RELEASE + ${spring.version} javax.inject javax.inject - 1 + ${javax.inject.version} junit junit - 4.12 + ${junit.version} test com.google.guava guava - 20.0 + ${guava.version} @@ -124,6 +124,11 @@ + 1.10.19 + 4.3.4.RELEASE + 1 + 4.12 + 20.0 2.6 diff --git a/spring-core/src/main/java/com/baeldung/applicationcontext/Course.java b/spring-core/src/main/java/com/baeldung/applicationcontext/Course.java new file mode 100644 index 0000000000..e67d99efb4 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/applicationcontext/Course.java @@ -0,0 +1,21 @@ +package com.baeldung.applicationcontext; + +public class Course { + + private String name; + + public Course() { + } + + public Course(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/spring-core/src/main/java/com/baeldung/applicationcontext/Dialog.java b/spring-core/src/main/java/com/baeldung/applicationcontext/Dialog.java new file mode 100644 index 0000000000..53688598da --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/applicationcontext/Dialog.java @@ -0,0 +1,43 @@ +package com.baeldung.applicationcontext; + +import java.util.Locale; + +public class Dialog { + + private Locale locale; + private String hello; + private String thanks; + + public Dialog() { + } + + public Dialog(Locale locale, String hello, String thanks) { + this.locale = locale; + this.hello = hello; + this.thanks = thanks; + } + + public Locale getLocale() { + return locale; + } + + public void setLocale(Locale locale) { + this.locale = locale; + } + + public String getHello() { + return hello; + } + + public void setHello(String hello) { + this.hello = hello; + } + + public String getThanks() { + return thanks; + } + + public void setThanks(String thanks) { + this.thanks = thanks; + } +} diff --git a/spring-core/src/main/java/com/baeldung/applicationcontext/Student.java b/spring-core/src/main/java/com/baeldung/applicationcontext/Student.java new file mode 100644 index 0000000000..fcfcb6f386 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/applicationcontext/Student.java @@ -0,0 +1,35 @@ +package com.baeldung.applicationcontext; + +public class Student { + + private int no; + private String name; + + public Student() { + } + + public Student(int no, String name) { + this.no = no; + this.name = name; + } + + public int getNo() { + return no; + } + + public void setNo(int no) { + this.no = no; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public void destroy() { + System.out.println("Student(no: " + no + ") is destroyed"); + } +} diff --git a/spring-core/src/main/java/com/baeldung/applicationcontext/Teacher.java b/spring-core/src/main/java/com/baeldung/applicationcontext/Teacher.java new file mode 100644 index 0000000000..7ef802a3d6 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/applicationcontext/Teacher.java @@ -0,0 +1,39 @@ +package com.baeldung.applicationcontext; + +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.PostConstruct; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; + +public class Teacher { + + @Autowired + private ApplicationContext context; + private List courses = new ArrayList<>(); + + public Teacher() { + } + + @PostConstruct + public void addCourse() { + if (context.containsBean("math")) { + Course math = context.getBean("math", Course.class); + courses.add(math); + } + if (context.containsBean("physics")) { + Course physics = context.getBean("physics", Course.class); + courses.add(physics); + } + } + + public List getCourses() { + return courses; + } + + public void setCourses(List courses) { + this.courses = courses; + } +} diff --git a/spring-core/src/main/resources/classpathxmlapplicationcontext-example.xml b/spring-core/src/main/resources/classpathxmlapplicationcontext-example.xml new file mode 100644 index 0000000000..d0ba03cec8 --- /dev/null +++ b/spring-core/src/main/resources/classpathxmlapplicationcontext-example.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-core/src/main/resources/classpathxmlapplicationcontext-internationalization.xml b/spring-core/src/main/resources/classpathxmlapplicationcontext-internationalization.xml new file mode 100644 index 0000000000..f68d623be7 --- /dev/null +++ b/spring-core/src/main/resources/classpathxmlapplicationcontext-internationalization.xml @@ -0,0 +1,14 @@ + + + + + + + dialog/dialog + + + + \ No newline at end of file diff --git a/spring-core/src/main/resources/dialog/dialog_en.properties b/spring-core/src/main/resources/dialog/dialog_en.properties new file mode 100644 index 0000000000..cf65b8990e --- /dev/null +++ b/spring-core/src/main/resources/dialog/dialog_en.properties @@ -0,0 +1,3 @@ +hello=hello +you=you +thanks=thank {0} \ No newline at end of file diff --git a/spring-core/src/main/resources/dialog/dialog_zh_CN.properties b/spring-core/src/main/resources/dialog/dialog_zh_CN.properties new file mode 100644 index 0000000000..ab09c8b39f --- /dev/null +++ b/spring-core/src/main/resources/dialog/dialog_zh_CN.properties @@ -0,0 +1,3 @@ +hello=\u4f60\u597d +you=\u4f60 +thanks=\u8c22\u8c22{0} \ No newline at end of file diff --git a/spring-core/src/test/java/com/baeldung/applicationcontext/ClasspathXmlApplicationContextTest.java b/spring-core/src/test/java/com/baeldung/applicationcontext/ClasspathXmlApplicationContextTest.java new file mode 100644 index 0000000000..8ee280a2e8 --- /dev/null +++ b/spring-core/src/test/java/com/baeldung/applicationcontext/ClasspathXmlApplicationContextTest.java @@ -0,0 +1,59 @@ +package com.baeldung.applicationcontext; + +import static org.hamcrest.core.IsEqual.equalTo; +import static org.junit.Assert.assertThat; + +import java.util.List; +import java.util.Locale; + +import org.junit.Test; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.context.MessageSource; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class ClasspathXmlApplicationContextTest { + @Test + public void testBasicUsage() { + ApplicationContext context = new ClassPathXmlApplicationContext("classpathxmlapplicationcontext-example.xml"); + Student student = (Student) context.getBean("student"); + assertThat(student.getNo(), equalTo(15)); + assertThat(student.getName(), equalTo("Tom")); + + Student sameStudent = context.getBean("student", Student.class);// do not need cast class + assertThat(sameStudent.getNo(), equalTo(15)); + assertThat(sameStudent.getName(), equalTo("Tom")); + } + + @Test + public void testRegisterShutdownHook() { + ConfigurableApplicationContext context = new ClassPathXmlApplicationContext("classpathxmlapplicationcontext-example.xml"); + context.registerShutdownHook(); + } + + @Test + public void testInternationalization() { + MessageSource resources = new ClassPathXmlApplicationContext("classpathxmlapplicationcontext-internationalization.xml"); + + String enHello = resources.getMessage("hello", null, "Default", Locale.ENGLISH); + String enYou = resources.getMessage("you", null, Locale.ENGLISH); + String enThanks = resources.getMessage("thanks", new Object[] { enYou }, Locale.ENGLISH); + assertThat(enHello, equalTo("hello")); + assertThat(enThanks, equalTo("thank you")); + + String chHello = resources.getMessage("hello", null, "Default", Locale.SIMPLIFIED_CHINESE); + String chYou = resources.getMessage("you", null, Locale.SIMPLIFIED_CHINESE); + String chThanks = resources.getMessage("thanks", new Object[] { chYou }, Locale.SIMPLIFIED_CHINESE); + assertThat(chHello, equalTo("你好")); + assertThat(chThanks, equalTo("谢谢你")); + } + + @Test + public void testApplicationContextAware() { + ApplicationContext context = new ClassPathXmlApplicationContext("classpathxmlapplicationcontext-example.xml"); + Teacher teacher = context.getBean("teacher", Teacher.class); + List courses = teacher.getCourses(); + assertThat(courses.size(), equalTo(1)); + assertThat(courses.get(0).getName(), equalTo("math")); + } +} diff --git a/spring-cucumber/pom.xml b/spring-cucumber/pom.xml index b493962a75..644ddff1d8 100644 --- a/spring-cucumber/pom.xml +++ b/spring-cucumber/pom.xml @@ -14,14 +14,15 @@ org.springframework.boot spring-boot-starter-parent - 1.3.5.RELEASE + 1.4.2.RELEASE UTF-8 1.8 - 1.2.4 + 1.2.5 + 1.3.2 @@ -68,14 +69,11 @@ org.apache.commons commons-io - 1.3.2 + ${commons-io.version} - - - @@ -130,6 +128,5 @@ - diff --git a/spring-data-cassandra/pom.xml b/spring-data-cassandra/pom.xml index 5c1a42b8bd..ef664fef79 100644 --- a/spring-data-cassandra/pom.xml +++ b/spring-data-cassandra/pom.xml @@ -11,19 +11,20 @@ UTF-8 - - 4.2.5.RELEASE - + + 4.3.4.RELEASE 1.3.2.RELEASE - - 4.11 - 1.7.12 - 1.1.3 + + 4.12 + 1.7.21 + 1.1.7 2.1.5 2.1.9.2 - 2.1.9.2 + 2.1.9.2 2.0-0 - 2.19.1 + 19.0 + 3.6.0 + 2.19.1 @@ -39,7 +40,7 @@ junit - junit-dep + junit ${junit.version} test @@ -64,7 +65,7 @@ org.cassandraunit cassandra-unit-shaded - ${cassandra-unit-shaded} + ${cassandra-unit-shaded.version} test @@ -103,58 +104,58 @@ maven-compiler-plugin - 2.3.2 + ${maven-compiler-plugin.version} - 1.7 - 1.7 + 1.8 + 1.8 - - org.apache.maven.plugins - maven-surefire-plugin - ${maven-surefire-plugin.version} - - - **/*IntegrationTest.java - **/*LiveTest.java - - - - - + + 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 - - - - - - - + + + integration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + **/*LiveTest.java + + + **/*IntegrationTest.java + + + + + + + json + + + + + + + diff --git a/spring-data-couchbase-2/pom.xml b/spring-data-couchbase-2/pom.xml index 6716f82246..9284234638 100644 --- a/spring-data-couchbase-2/pom.xml +++ b/spring-data-couchbase-2/pom.xml @@ -1,13 +1,14 @@ - + 4.0.0 org.baeldung spring-data-couchbase-2 0.1-SNAPSHOT spring-data-couchbase-2 jar - + - + org.springframework @@ -20,9 +21,9 @@ ${spring-framework.version} - org.springframework.data - spring-data-couchbase - ${spring-data-couchbase.version} + org.springframework.data + spring-data-couchbase + ${spring-data-couchbase.version} @@ -45,21 +46,21 @@ ${org.slf4j.version} compile - - ch.qos.logback - logback-classic - ${logback.version} - - - org.slf4j - jcl-over-slf4j - ${org.slf4j.version} - - - org.slf4j - log4j-over-slf4j - ${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} + @@ -74,43 +75,44 @@ ${junit.version} test - + maven-compiler-plugin - 2.3.2 + ${maven-compiler-plugin.version} - 1.7 - 1.7 + 1.8 + 1.8 - org.apache.maven.plugins - maven-surefire-plugin - ${maven-surefire-plugin.version} - - - **/*IntegrationTest.java - **/*LiveTest.java - - - + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + **/*IntegrationTest.java + **/*LiveTest.java + + + - 1.7 + 1.8 UTF-8 - 4.2.4.RELEASE - 2.1.1.RELEASE - 5.2.4.Final - 2.9.2 - 1.1.3 - 1.7.12 - 4.11 - 2.19.1 + 4.3.4.RELEASE + 2.1.5.RELEASE + 5.3.3.Final + 2.9.6 + 1.1.7 + 1.7.21 + 4.12 + 3.6.0 + 2.19.1 - + diff --git a/spring-data-dynamodb/README.MD b/spring-data-dynamodb/README.MD index 8b13789179..9a6855ea0b 100644 --- a/spring-data-dynamodb/README.MD +++ b/spring-data-dynamodb/README.MD @@ -1 +1,2 @@ - +### Relevant Articles: +- [DynamoDB in a Spring Boot Application Using Spring Data](http://www.baeldung.com/spring-data-dynamodb) diff --git a/spring-data-dynamodb/pom.xml b/spring-data-dynamodb/pom.xml index 11e1366f3e..0ce9b3a399 100644 --- a/spring-data-dynamodb/pom.xml +++ b/spring-data-dynamodb/pom.xml @@ -11,7 +11,7 @@ spring-boot-starter-parent org.springframework.boot - 1.2.3.RELEASE + 1.4.2.RELEASE @@ -20,7 +20,11 @@ com.baeldung.Application UTF-8 1.8 - 4.3.1.RELEASE + 4.3.4.RELEASE + 4.5.2 + 4.4.1 + 1.11.64 + 3.3.7-1 @@ -83,23 +87,23 @@ org.webjars bootstrap - 3.3.4 + ${bootstrap.version} com.amazonaws aws-java-sdk-dynamodb - 1.11.34 + ${aws-java-sdk-dynamodb.version} com.github.derjust spring-data-dynamodb - 4.3.1 + ${spring-data-dynamodb.version} org.apache.httpcomponents httpclient - 4.5.2 + ${httpclient.version} diff --git a/spring-data-elasticsearch/pom.xml b/spring-data-elasticsearch/pom.xml index dcb702ab16..b38a6a10bc 100644 --- a/spring-data-elasticsearch/pom.xml +++ b/spring-data-elasticsearch/pom.xml @@ -14,12 +14,14 @@ 1.8 1.8 - 4.2.5.RELEASE - - 4.11 - 1.7.12 - 1.1.3 - 2.0.1.RELEASE + 4.3.4.RELEASE + 2.0.5.RELEASE + 4.12 + 1.7.21 + 1.1.7 + 4.2.2 + 2.4.2 + 1.2.21 2.19.1 @@ -32,12 +34,12 @@ org.springframework.data spring-data-elasticsearch - ${elasticsearch.version} + ${spring-data-elasticsearch.version} junit - junit-dep + junit ${junit.version} test @@ -50,7 +52,7 @@ net.java.dev.jna jna - 4.1.0 + ${jna.version} test @@ -78,12 +80,12 @@ org.elasticsearch elasticsearch - 2.3.5 + ${elasticsearch.version} com.alibaba fastjson - 1.2.13 + ${fastjson.version} diff --git a/spring-data-mongodb/pom.xml b/spring-data-mongodb/pom.xml index fd212548d0..7d7c9cd590 100644 --- a/spring-data-mongodb/pom.xml +++ b/spring-data-mongodb/pom.xml @@ -23,7 +23,7 @@ junit - junit-dep + junit ${junit.version} test @@ -106,7 +106,7 @@ maven-compiler-plugin - 2.3.2 + ${maven-compiler-plugin.version} 1.8 1.8 @@ -164,18 +164,19 @@ UTF-8 - 4.2.5.RELEASE + 4.3.4.RELEASE - 1.7.1.RELEASE + 1.8.6.RELEASE 1.3 - 4.11 + 4.12 2.9.0 - 3.6.6 + 3.7.4 1.1.3 - 1.7.12 - 1.1.3 + 1.7.21 + 1.1.7 + 3.6.0 2.19.1 diff --git a/spring-data-neo4j/pom.xml b/spring-data-neo4j/pom.xml index 653dd6b2f6..a151d129a7 100644 --- a/spring-data-neo4j/pom.xml +++ b/spring-data-neo4j/pom.xml @@ -11,8 +11,13 @@ 1.8 UTF-8 UTF-8 - 3.0.1 - 4.1.1.RELEASE + 3.0.7 + 4.1.5.RELEASE + 1.1 + 1.4.2.RELEASE + 4.3.4.RELEASE + 2.0.5 + 4.12 2.19.1 @@ -26,14 +31,14 @@ com.voodoodyne.jackson.jsog jackson-jsog - 1.1 + ${jackson-jsog.version} compile org.springframework.boot spring-boot-starter-test - 1.3.6.RELEASE + ${spring-boot.version} test @@ -61,7 +66,7 @@ org.neo4j neo4j-ogm-test - 2.0.2 + ${neo4j-ogm-test.version} test @@ -74,12 +79,12 @@ junit junit - 4.12 + ${junit.version} org.springframework spring-test - 4.2.3.RELEASE + ${spring-test.version} diff --git a/spring-data-redis/pom.xml b/spring-data-redis/pom.xml index 6f1fc9294d..9700dd7091 100644 --- a/spring-data-redis/pom.xml +++ b/spring-data-redis/pom.xml @@ -9,9 +9,13 @@ UTF-8 - 4.2.5.RELEASE - 1.6.2.RELEASE - 0.8.0 + 4.3.4.RELEASE + 1.7.5.RELEASE + 3.2.4 + 2.9.0 + 1.2.17 + 4.12 + 0.10.0 2.19.1 @@ -25,19 +29,19 @@ cglib cglib-nodep - 2.2 + ${cglib.version} log4j log4j - 1.2.16 + ${log4j.version} redis.clients jedis - 2.5.1 + ${jedis.version} jar @@ -56,7 +60,7 @@ junit junit - 4.12 + ${junit.version} test diff --git a/spring-data-rest/pom.xml b/spring-data-rest/pom.xml index 5ae694a04f..da5d844211 100644 --- a/spring-data-rest/pom.xml +++ b/spring-data-rest/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 1.3.3.RELEASE + 1.4.2.RELEASE diff --git a/spring-data-solr/pom.xml b/spring-data-solr/pom.xml index ec6eb7bf46..e43b3ff774 100644 --- a/spring-data-solr/pom.xml +++ b/spring-data-solr/pom.xml @@ -11,9 +11,11 @@ UTF-8 - 4.2.5.RELEASE + 4.3.4.RELEASE 2.19.1 - 2.0.4.RELEASE + 2.0.5.RELEASE + 1.2.17 + 4.12 @@ -25,7 +27,7 @@ org.springframework.data spring-data-solr - ${spring-data-solr} + ${spring-data-solr.version} org.springframework @@ -35,12 +37,12 @@ log4j log4j - 1.2.16 + ${log4j.version} junit junit - 4.12 + ${junit.version} test diff --git a/spring-dispatcher-servlet/pom.xml b/spring-dispatcher-servlet/pom.xml index 646db663db..13ad062195 100644 --- a/spring-dispatcher-servlet/pom.xml +++ b/spring-dispatcher-servlet/pom.xml @@ -18,33 +18,33 @@ javax.servlet javax.servlet-api - 3.1.0 + ${javax.servlet.version} provided org.springframework spring-webmvc - 4.3.3.RELEASE + ${org.springframework.version} org.thymeleaf thymeleaf-spring4 - 3.0.2.RELEASE + ${thymeleaf.version} org.slf4j slf4j-api - 1.7.21 + ${org.slf4j.version} org.apache.logging.log4j log4j-core - 2.7 + ${log4j.version} org.apache.logging.log4j log4j-slf4j-impl - 2.7 + ${log4j.version} @@ -53,7 +53,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.5.1 + ${maven-compiler-plugin.version} 1.8 1.8 @@ -62,7 +62,7 @@ org.apache.maven.plugins maven-war-plugin - 3.0.0 + ${maven-war-plugin.version} false @@ -70,7 +70,7 @@ org.eclipse.jetty jetty-maven-plugin - 9.3.12.v20160915 + ${jetty-maven-plugin.version} / @@ -79,4 +79,22 @@ + + + + 4.3.4.RELEASE + 3.0.2.RELEASE + + + 1.7.21 + 2.7 + + + 3.1.0 + + + 3.6.0 + 3.0.0 + 9.3.14.v20161028 + diff --git a/spring-exceptions/pom.xml b/spring-exceptions/pom.xml index 6994a518fe..a8254151aa 100644 --- a/spring-exceptions/pom.xml +++ b/spring-exceptions/pom.xml @@ -69,7 +69,7 @@ javax.servlet javax.servlet-api - 3.0.1 + ${javax.servlet-api.version} provided @@ -133,28 +133,28 @@ javax.el el-api - 2.2 + ${javax.el.version} org.apache.derby derby - 10.12.1.1 + ${derby.version} org.apache.derby derbyclient - 10.12.1.1 + ${derby.version} org.apache.derby derbynet - 10.12.1.1 + ${derby.version} org.apache.derby derbytools - 10.12.1.1 + ${derby.version} @@ -208,44 +208,46 @@ - 4.3.2.RELEASE - 4.1.1.RELEASE - 3.20.0-GA + 4.3.4.RELEASE + 4.2.0.RELEASE + 3.21.0-GA 1.2 - 4.3.11.Final - 5.1.38 - 7.0.42 + 5.2.5.Final + 5.1.40 + 7.0.73 + 10.13.1.1 - 1.7.13 - 1.1.3 + 1.7.21 + 1.1.7 - 5.2.2.Final + 5.3.3.Final + 3.1.0 + 2.2 19.0 - 3.4 + 3.5 1.3 4.12 1.10.19 - 4.4.1 - 4.5 + 4.4.5 + 4.5.2 2.9.0 - 1.8.9 - 3.5.1 + 3.6.0 2.6 2.19.1 2.7 - 1.4.18 + 1.6.1 diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause4MappingExceptionManualTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause4MappingExceptionManualTest.java index 760d082f54..ea90b3d6cc 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause4MappingExceptionManualTest.java +++ b/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause4MappingExceptionManualTest.java @@ -7,9 +7,9 @@ import java.util.Properties; import org.baeldung.ex.mappingexception.cause4.persistence.model.Foo; import org.hibernate.Session; import org.hibernate.SessionFactory; +import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.cfg.Configuration; import org.hibernate.service.ServiceRegistry; -import org.hibernate.service.ServiceRegistryBuilder; import org.junit.Test; public class Cause4MappingExceptionManualTest { @@ -35,7 +35,7 @@ public class Cause4MappingExceptionManualTest { configuration.addAnnotatedClass(Foo.class); - final ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).build(); + final ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build(); final SessionFactory sessionFactory = configuration.buildSessionFactory(serviceRegistry); return sessionFactory; } diff --git a/spring-freemarker/pom.xml b/spring-freemarker/pom.xml index 51df4e6647..7e61a3f081 100644 --- a/spring-freemarker/pom.xml +++ b/spring-freemarker/pom.xml @@ -9,12 +9,13 @@ 1.8 - 4.2.4.RELEASE + 4.3.4.RELEASE 2.3.23 - 1.1.3 - 1.7.12 + 1.1.7 + 1.7.21 3.1.0 false + 3.6.0 @@ -73,7 +74,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.3 + ${maven-compiler-plugin.version} ${jdk.version} ${jdk.version} diff --git a/spring-hibernate3/pom.xml b/spring-hibernate3/pom.xml index 9f99d83a42..f7b198a2b1 100644 --- a/spring-hibernate3/pom.xml +++ b/spring-hibernate3/pom.xml @@ -181,42 +181,42 @@ - 4.2.5.RELEASE - 4.0.4.RELEASE - 3.20.0-GA + 4.3.4.RELEASE + 4.2.0.RELEASE + 3.21.0-GA 3.6.10.Final - 5.1.38 - 7.0.47 - 1.4.191 + 5.1.40 + 7.0.73 + 1.4.193 - 1.7.13 - 1.1.3 + 1.7.21 + 1.1.7 - 5.2.2.Final + 5.3.3.Final 19.0 - 3.4 + 3.5 1.3 4.12 1.10.19 - 4.4.1 - 4.5 + 4.4.5 + 4.5.2 2.9.0 - 3.5.1 + 3.6.0 2.19.1 2.7 - 1.4.18 + 1.6.1 diff --git a/spring-hibernate4/pom.xml b/spring-hibernate4/pom.xml index d4dabcc274..ead46fa02a 100644 --- a/spring-hibernate4/pom.xml +++ b/spring-hibernate4/pom.xml @@ -53,11 +53,6 @@ jta ${jta.version} - - javax.el - javax.el-api - ${el-api.version} - mysql mysql-connector-java @@ -80,7 +75,7 @@ javax.el javax.el-api - 2.2.5 + ${javax.el-api.version} @@ -152,7 +147,7 @@ org.hsqldb hsqldb - 2.3.4 + ${hsqldb.version} test @@ -199,29 +194,29 @@ - 4.2.5.RELEASE - 4.0.4.RELEASE - 1.9.2.RELEASE - 3.20.0-GA + 4.3.4.RELEASE + 4.2.0.RELEASE + 1.10.5.RELEASE 4.3.11.Final ${hibernate.version} - 5.1.38 - 8.0.30 + 5.1.40 + 8.5.8 1.1 - 2.2.4 + 2.3.4 - 1.7.13 - 1.1.3 + 1.7.21 + 1.1.7 - 5.2.2.Final + 5.3.3.Final + 2.2.5 19.0 - 3.4 + 3.5 1.3 @@ -234,10 +229,10 @@ 2.9.0 - 3.5.1 + 3.6.0 2.19.1 2.7 - 1.4.18 + 1.6.1 diff --git a/spring-hibernate4/src/main/resources/webSecurityConfig.xml b/spring-hibernate4/src/main/resources/webSecurityConfig.xml index d9423d31e7..e5c19a4ad7 100644 --- a/spring-hibernate4/src/main/resources/webSecurityConfig.xml +++ b/spring-hibernate4/src/main/resources/webSecurityConfig.xml @@ -1,8 +1,8 @@ diff --git a/spring-integration/pom.xml b/spring-integration/pom.xml index b33f8bd740..6083afcf76 100644 --- a/spring-integration/pom.xml +++ b/spring-integration/pom.xml @@ -16,9 +16,16 @@ UTF-8 - 2.2.4.RELEASE + 4.3.5.RELEASE + 1.1.4.RELEASE + 1.4.7 + 1.1.1 1.2.17 - 4.11 + 4.12 + + 2.10 + 3.6.0 + 1.5.0 @@ -33,7 +40,7 @@ maven-eclipse-plugin - 2.9 + ${maven-eclipse-plugin.version} org.springframework.ide.eclipse.core.springnature @@ -48,10 +55,10 @@ org.apache.maven.plugins maven-compiler-plugin - 3.1 + ${maven-compiler-plugin.version} - 1.6 - 1.6 + 1.8 + 1.8 -Xlint:all true true @@ -60,7 +67,7 @@ org.codehaus.mojo exec-maven-plugin - 1.2.1 + ${exec-maven-plugin.version} com.baeldung.samples.Main @@ -81,18 +88,18 @@ org.springframework.integration spring-integration-core - 4.3.4.RELEASE + ${spring.integration.version} javax.activation activation - 1.1.1 + ${javax-activation.version} true javax.mail mail - 1.4.7 + ${javax-mail.version} log4j @@ -102,32 +109,27 @@ org.springframework.integration spring-integration-twitter - 4.3.4.RELEASE + ${spring.integration.version} org.springframework.integration spring-integration-mail - 4.3.4.RELEASE + ${spring.integration.version} org.springframework.integration spring-integration-ftp - 4.3.4.RELEASE + ${spring.integration.version} org.springframework.social spring-social-core - 1.1.4.RELEASE + ${spring-social.version} org.springframework.integration spring-integration-file - 4.3.4.RELEASE - - - junit - junit - 4.12 + ${spring.integration.version} diff --git a/spring-jms/README.md b/spring-jms/README.md new file mode 100644 index 0000000000..9093937f44 --- /dev/null +++ b/spring-jms/README.md @@ -0,0 +1,2 @@ +###Relevant Articles: +- [An Introduction To Spring JMS](http://www.baeldung.com/spring-jms) diff --git a/spring-jms/pom.xml b/spring-jms/pom.xml index 8e83f82f38..de7c734316 100644 --- a/spring-jms/pom.xml +++ b/spring-jms/pom.xml @@ -9,9 +9,12 @@ Introduction to Spring JMS - 4.3.2.RELEASE - 5.12.0 + 4.3.4.RELEASE + 5.14.1 4.12 + + 3.6.0 + 2.6 @@ -41,7 +44,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.2 + ${maven-compiler-plugin.version} 1.8 1.8 @@ -50,7 +53,7 @@ org.apache.maven.plugins maven-war-plugin - 2.4 + ${maven-war-plugin.version} src/main/webapp spring-jms diff --git a/spring-jooq/pom.xml b/spring-jooq/pom.xml index bf60acd6f6..bf0dffd68c 100644 --- a/spring-jooq/pom.xml +++ b/spring-jooq/pom.xml @@ -11,7 +11,7 @@ org.springframework.boot spring-boot-dependencies - 1.3.5.RELEASE + 1.4.2.RELEASE pom import @@ -23,14 +23,12 @@ org.jooq jooq - ${org.jooq.version} com.h2database h2 - ${com.h2database.version} @@ -70,6 +68,11 @@ spring-test test + + org.springframework.boot + spring-boot-starter-test + + @@ -77,7 +80,7 @@ org.codehaus.mojo properties-maven-plugin - 1.0.0 + ${properties-maven-plugin.version} initialize @@ -96,7 +99,7 @@ org.codehaus.mojo sql-maven-plugin - 1.5 + ${sql-maven-plugin.version} initialize @@ -179,7 +182,7 @@ org.eclipse.m2e lifecycle-mapping - 1.0.0 + ${lifecycle-mapping.version} @@ -244,15 +247,19 @@ - 3.7.3 - 1.4.191 - 4.2.5.RELEASE - 1.7.18 - 1.1.3 + 3.8.6 + 1.4.193 + 4.3.4.RELEASE + 1.7.21 + 1.1.7 4.12 - 3.5.1 - 2.19.1 + 3.6.0 + 2.19.1 + 1.0.0 + 1.5 + 1.0.0 + \ No newline at end of file diff --git a/spring-jooq/src/test/java/com/baeldung/jooq/springboot/SpringBootIntegrationTest.java b/spring-jooq/src/test/java/com/baeldung/jooq/springboot/SpringBootIntegrationTest.java index fa3f342ecd..25317309ee 100644 --- a/spring-jooq/src/test/java/com/baeldung/jooq/springboot/SpringBootIntegrationTest.java +++ b/spring-jooq/src/test/java/com/baeldung/jooq/springboot/SpringBootIntegrationTest.java @@ -1,5 +1,10 @@ package com.baeldung.jooq.springboot; +import static com.baeldung.jooq.introduction.db.public_.tables.Author.AUTHOR; +import static com.baeldung.jooq.introduction.db.public_.tables.AuthorBook.AUTHOR_BOOK; +import static com.baeldung.jooq.introduction.db.public_.tables.Book.BOOK; +import static org.junit.Assert.assertEquals; + import org.jooq.DSLContext; import org.jooq.Record3; import org.jooq.Result; @@ -7,19 +12,14 @@ import org.jooq.impl.DSL; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.dao.DataAccessException; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit4.SpringRunner; import org.springframework.transaction.annotation.Transactional; -import static com.baeldung.jooq.introduction.db.public_.tables.Author.AUTHOR; -import static com.baeldung.jooq.introduction.db.public_.tables.AuthorBook.AUTHOR_BOOK; -import static com.baeldung.jooq.introduction.db.public_.tables.Book.BOOK; -import static org.junit.Assert.assertEquals; - -@SpringApplicationConfiguration(Application.class) +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) @Transactional("transactionManager") -@RunWith(SpringJUnit4ClassRunner.class) public class SpringBootIntegrationTest { @Autowired diff --git a/spring-mvc-handlers/pom.xml b/spring-mvc-handlers/pom.xml new file mode 100644 index 0000000000..0074898767 --- /dev/null +++ b/spring-mvc-handlers/pom.xml @@ -0,0 +1,70 @@ + + 4.0.0 + com.baeldung + SpringMVCHandlers + war + 0.0.1-SNAPSHOT + SpringMVCHandlers Maven Webapp + http://maven.apache.org + + + 4.3.4.RELEASE + 3.5.1 + 2.6 + + + + + javax.servlet + javax.servlet-api + 3.1.0 + + + commons-logging + commons-logging + 1.2 + + + org.springframework + spring-webmvc + ${springframework.version} + + + org.springframework + spring-context + ${springframework.version} + + + org.springframework + spring-core + ${springframework.version} + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + 1.7 + 1.7 + + + + org.apache.maven.plugins + maven-war-plugin + ${maven-war-plugin.version} + + src/main/webapp + springMVCHandlers + false + + + + + springMVCHandlers + + diff --git a/spring-mvc-handlers/src/main/java/com/baeldung/spring/controller/AnnotationMethodHandlerAdapterExample.java b/spring-mvc-handlers/src/main/java/com/baeldung/spring/controller/AnnotationMethodHandlerAdapterExample.java new file mode 100644 index 0000000000..164830cd6a --- /dev/null +++ b/spring-mvc-handlers/src/main/java/com/baeldung/spring/controller/AnnotationMethodHandlerAdapterExample.java @@ -0,0 +1,15 @@ +package com.baeldung.spring.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.ModelAndView; + +@Controller +public class AnnotationMethodHandlerAdapterExample { + @RequestMapping("/annotedName") + public ModelAndView getEmployeeName() { + ModelAndView model = new ModelAndView("Greeting"); + model.addObject("message", "Dinesh"); + return model; + } +} \ No newline at end of file diff --git a/spring-mvc-handlers/src/main/java/com/baeldung/spring/controller/RequestMappingHandlerAdapterExample.java b/spring-mvc-handlers/src/main/java/com/baeldung/spring/controller/RequestMappingHandlerAdapterExample.java new file mode 100644 index 0000000000..76ac3e2806 --- /dev/null +++ b/spring-mvc-handlers/src/main/java/com/baeldung/spring/controller/RequestMappingHandlerAdapterExample.java @@ -0,0 +1,15 @@ +package com.baeldung.spring.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.ModelAndView; + +@Controller +public class RequestMappingHandlerAdapterExample { + @RequestMapping("/requestName") + public ModelAndView getEmployeeName() { + ModelAndView model = new ModelAndView("Greeting"); + model.addObject("message", "Madhwal"); + return model; + } +} \ No newline at end of file diff --git a/spring-mvc-handlers/src/main/java/com/baeldung/spring/controller/SimpleControllerHandlerAdapterExample.java b/spring-mvc-handlers/src/main/java/com/baeldung/spring/controller/SimpleControllerHandlerAdapterExample.java new file mode 100644 index 0000000000..bac091ffeb --- /dev/null +++ b/spring-mvc-handlers/src/main/java/com/baeldung/spring/controller/SimpleControllerHandlerAdapterExample.java @@ -0,0 +1,18 @@ +package com.baeldung.spring.controller; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.AbstractController; + +public class SimpleControllerHandlerAdapterExample extends + AbstractController { + @Override + protected ModelAndView handleRequestInternal(HttpServletRequest request, + HttpServletResponse response) throws Exception { + ModelAndView model = new ModelAndView("Greeting"); + model.addObject("message", "Dinesh Madhwal"); + return model; + } +} \ No newline at end of file diff --git a/spring-mvc-handlers/src/main/resources/spring-servlet_AnnotationMethodHandlerAdapter.xml b/spring-mvc-handlers/src/main/resources/spring-servlet_AnnotationMethodHandlerAdapter.xml new file mode 100644 index 0000000000..a8071a622f --- /dev/null +++ b/spring-mvc-handlers/src/main/resources/spring-servlet_AnnotationMethodHandlerAdapter.xml @@ -0,0 +1,26 @@ + + + + + + + + + + \ No newline at end of file diff --git a/spring-mvc-handlers/src/main/resources/spring-servlet_RequestMappingHandlerAdapter.xml b/spring-mvc-handlers/src/main/resources/spring-servlet_RequestMappingHandlerAdapter.xml new file mode 100644 index 0000000000..b32a213eb3 --- /dev/null +++ b/spring-mvc-handlers/src/main/resources/spring-servlet_RequestMappingHandlerAdapter.xml @@ -0,0 +1,28 @@ + + + + + + + + + + \ No newline at end of file diff --git a/spring-mvc-handlers/src/main/resources/spring-servlet_SimpleControllerHandlerAdapter.xml b/spring-mvc-handlers/src/main/resources/spring-servlet_SimpleControllerHandlerAdapter.xml new file mode 100644 index 0000000000..60c9b9e3df --- /dev/null +++ b/spring-mvc-handlers/src/main/resources/spring-servlet_SimpleControllerHandlerAdapter.xml @@ -0,0 +1,25 @@ + + + + + + + + + \ No newline at end of file diff --git a/spring-mvc-handlers/src/main/webapp/WEB-INF/Greeting.jsp b/spring-mvc-handlers/src/main/webapp/WEB-INF/Greeting.jsp new file mode 100644 index 0000000000..820d2f380f --- /dev/null +++ b/spring-mvc-handlers/src/main/webapp/WEB-INF/Greeting.jsp @@ -0,0 +1,5 @@ + + +

Hello ${message}

+ + \ No newline at end of file diff --git a/spring-mvc-handlers/src/main/webapp/WEB-INF/web.xml b/spring-mvc-handlers/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..b6f1065cad --- /dev/null +++ b/spring-mvc-handlers/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,19 @@ + + + + spring + org.springframework.web.servlet.DispatcherServlet + + contextConfigLocation + classpath*:spring-servlet_RequestMappingHandlerAdapter.xml + + 1 + + + spring + / + + \ No newline at end of file diff --git a/spring-mvc-java/README.md b/spring-mvc-java/README.md index 996a7d96b1..3da7b42fa3 100644 --- a/spring-mvc-java/README.md +++ b/spring-mvc-java/README.md @@ -16,3 +16,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [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) +- [Circular Dependencies in Spring](http://www.baeldung.com/circular-dependencies-in-spring) diff --git a/spring-mvc-java/src/main/README.md b/spring-mvc-java/src/main/README.md deleted file mode 100644 index 20ee1918af..0000000000 --- a/spring-mvc-java/src/main/README.md +++ /dev/null @@ -1,2 +0,0 @@ -### 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 deleted file mode 100644 index 20ee1918af..0000000000 --- a/spring-mvc-java/src/test/README.md +++ /dev/null @@ -1,2 +0,0 @@ -### 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/htmlunit/HtmlUnitAndSpringTest.java b/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitAndSpringTest.java index 45e441f47f..da1b0e484a 100644 --- a/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitAndSpringTest.java +++ b/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitAndSpringTest.java @@ -1,10 +1,7 @@ package com.baeldung.htmlunit; -import java.io.IOException; - import org.junit.Assert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -14,7 +11,6 @@ import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.htmlunit.MockMvcWebClientBuilder; import org.springframework.web.context.WebApplicationContext; -import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.html.HtmlForm; import com.gargoylesoftware.htmlunit.html.HtmlPage; @@ -33,8 +29,7 @@ public class HtmlUnitAndSpringTest { @Before public void setup() { - webClient = MockMvcWebClientBuilder - .webAppContextSetup(wac).build(); + webClient = MockMvcWebClientBuilder.webAppContextSetup(wac).build(); } @Test @@ -44,18 +39,16 @@ public class HtmlUnitAndSpringTest { String url = "http://localhost/message/showForm"; page = webClient.getPage(url); - + HtmlTextInput messageText = page.getHtmlElementById("message"); messageText.setValueAttribute(text); HtmlForm form = page.getForms().get(0); - HtmlSubmitInput submit = form.getOneHtmlElementByAttribute( - "input", "type", "submit"); + HtmlSubmitInput submit = form.getOneHtmlElementByAttribute("input", "type", "submit"); HtmlPage newPage = submit.click(); - String receivedText = newPage.getHtmlElementById("received") - .getTextContent(); + String receivedText = newPage.getHtmlElementById("received").getTextContent(); - Assert.assertEquals(receivedText, text); + Assert.assertEquals(receivedText, text); } } diff --git a/spring-mvc-tiles/README.md b/spring-mvc-tiles/README.md new file mode 100644 index 0000000000..58991005f5 --- /dev/null +++ b/spring-mvc-tiles/README.md @@ -0,0 +1,2 @@ +###Relevant Articles: +- [Apache Tiles Integration with Spring MVC](http://www.baeldung.com/spring-mvc-apache-tiles) diff --git a/spring-mvc-xml/README.md b/spring-mvc-xml/README.md index e96a8d0392..097353c88c 100644 --- a/spring-mvc-xml/README.md +++ b/spring-mvc-xml/README.md @@ -13,3 +13,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [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) - [Geolocation by IP in Java](http://www.baeldung.com/geolocation-by-ip-with-maxmind) +- [Guide to JSP](http://www.baeldung.com/guide-to-jsp) \ No newline at end of file diff --git a/spring-mvc-xml/src/main/java/com/baeldung/jsp/ExampleOne.java b/spring-mvc-xml/src/main/java/com/baeldung/jsp/ExampleOne.java new file mode 100644 index 0000000000..0b153bf8ec --- /dev/null +++ b/spring-mvc-xml/src/main/java/com/baeldung/jsp/ExampleOne.java @@ -0,0 +1,31 @@ +package com.baeldung.jsp; + +import java.io.IOException; +import java.io.PrintWriter; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class ExampleOne extends HttpServlet { + + private static final long serialVersionUID = 1L; + + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + response.setContentType("text/html"); + PrintWriter out = response.getWriter(); + out.println( + "" + + "" + + "" + + "HTML Rendered by Servlet" + + "" + + "" + + "

HTML Rendered by Servlet


" + + "

This page was rendered by the ExampleOne Servlet!

" + + "" + + "" + ); + } +} \ No newline at end of file diff --git a/spring-mvc-xml/src/main/java/com/baeldung/jsp/ExampleThree.java b/spring-mvc-xml/src/main/java/com/baeldung/jsp/ExampleThree.java new file mode 100644 index 0000000000..49fefcffde --- /dev/null +++ b/spring-mvc-xml/src/main/java/com/baeldung/jsp/ExampleThree.java @@ -0,0 +1,24 @@ +package com.baeldung.jsp; + +import java.io.IOException; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet( + name = "ExampleThree", + description = "JSP Servlet With Annotations", + urlPatterns = {"/ExampleThree"} +) +public class ExampleThree extends HttpServlet { + private static final long serialVersionUID = 1L; + + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + String message = request.getParameter("message"); + request.setAttribute("text", message); + request.getRequestDispatcher("/jsp/ExampleThree.jsp").forward(request, response); + } +} diff --git a/spring-mvc-xml/src/main/resources/contentManagementWebMvcConfig.xml b/spring-mvc-xml/src/main/resources/contentManagementWebMvcConfig.xml index e68c88d19d..41422d8954 100644 --- a/spring-mvc-xml/src/main/resources/contentManagementWebMvcConfig.xml +++ b/spring-mvc-xml/src/main/resources/contentManagementWebMvcConfig.xml @@ -11,7 +11,7 @@ http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd"> - + diff --git a/spring-mvc-xml/src/main/webapp/WEB-INF/web.xml b/spring-mvc-xml/src/main/webapp/WEB-INF/web.xml index 2240ac0a22..1ea3051426 100644 --- a/spring-mvc-xml/src/main/webapp/WEB-INF/web.xml +++ b/spring-mvc-xml/src/main/webapp/WEB-INF/web.xml @@ -34,6 +34,25 @@ / + + + + ExampleOne + com.baeldung.jsp.ExampleOne + + + ExampleOne + /jsp/ExampleOne + + + ExampleThree + com.baeldung.jsp.ExampleThree + + + ExampleThree + /jsp/ExampleThree + + diff --git a/spring-mvc-xml/src/main/webapp/jsp/ExampleThree.jsp b/spring-mvc-xml/src/main/webapp/jsp/ExampleThree.jsp new file mode 100644 index 0000000000..665eb86a30 --- /dev/null +++ b/spring-mvc-xml/src/main/webapp/jsp/ExampleThree.jsp @@ -0,0 +1,10 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + Java Binding Example + + +

Bound Value

+

You said: ${text}

+ + \ No newline at end of file diff --git a/spring-mvc-xml/src/main/webapp/jsp/ExampleTwo.jsp b/spring-mvc-xml/src/main/webapp/jsp/ExampleTwo.jsp new file mode 100644 index 0000000000..7b2247638d --- /dev/null +++ b/spring-mvc-xml/src/main/webapp/jsp/ExampleTwo.jsp @@ -0,0 +1,13 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + Java in Static Page Example + + +

Java in Static Page Example

+ <% String[] arr = {"What's up?", "Hello", "It's a nice day today!"}; + String greetings = arr[(int)(Math.random() * arr.length)]; + %> +

<%= greetings %>

+ + \ No newline at end of file diff --git a/spring-mvc-xml/src/main/webapp/jsp/index.jsp b/spring-mvc-xml/src/main/webapp/jsp/index.jsp new file mode 100644 index 0000000000..58c464125d --- /dev/null +++ b/spring-mvc-xml/src/main/webapp/jsp/index.jsp @@ -0,0 +1,12 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + JSP Examples + + +

Simple JSP Examples

+

Invoke HTML rendered by Servlet: here

+

Java in static page: here

+

Java injected by Servlet: here

+ + \ No newline at end of file diff --git a/spring-rest/pom.xml b/spring-rest/pom.xml index 3c23f1bca7..ec4b50bfa8 100644 --- a/spring-rest/pom.xml +++ b/spring-rest/pom.xml @@ -54,7 +54,7 @@ commons-fileupload commons-fileupload - 1.3.2 + ${commons-fileupload.version} @@ -85,7 +85,7 @@ com.thoughtworks.xstream xstream - 1.4.8 + ${xstream.version} @@ -99,7 +99,7 @@ org.apache.commons commons-lang3 - 3.5 + ${commons-lang3.version} @@ -171,18 +171,18 @@ com.google.protobuf protobuf-java - 3.1.0 + ${protobuf-java.version} com.googlecode.protobuf-java-format protobuf-java-format - 1.4 + ${protobuf-java-format.version} com.esotericsoftware kryo - 4.0.0 + ${kryo.version} @@ -337,38 +337,20 @@ - - - - 4.3.11.Final - 5.1.40 - - - 5.2.2.Final - + 1.3.2 + 4.0.0 + 1.4 + 3.1.0 + 3.5 + 1.4.9 + 20.0 - 3.4 - - - 1.3 - 4.12 - 1.10.19 - - 4.4.1 - 4.5 - 2.9.0 - - 1.7.13 - 1.1.3 - - 3.6.0 - 2.6 - 2.19.1 1.6.0 + 3.0.4 3.4.1 @@ -380,7 +362,7 @@ org.codehaus.mojo findbugs-maven-plugin - 3.0.4 + ${findbugs-maven-plugin.version} Max FindDeadLocalStores,FindNullDeref diff --git a/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpMiscLiveTest.java b/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpMiscLiveTest.java index e6b3cc87b0..6ab485ee14 100644 --- a/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpMiscLiveTest.java +++ b/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpMiscLiveTest.java @@ -4,6 +4,7 @@ import static org.baeldung.client.Consts.APPLICATION_PORT; import java.io.File; import java.io.IOException; +import java.net.SocketTimeoutException; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; @@ -32,7 +33,7 @@ public class OkHttpMiscLiveTest { client = new OkHttpClient(); } - @Test + @Test(expected = SocketTimeoutException.class) public void whenSetRequestTimeout_thenFail() throws IOException { final OkHttpClient clientWithTimeout = new OkHttpClient.Builder().readTimeout(1, TimeUnit.SECONDS).build(); diff --git a/spring-rest/src/test/java/org/baeldung/web/controller/redirect/RedirectControllerIntegrationTest.java b/spring-rest/src/test/java/org/baeldung/web/controller/redirect/RedirectControllerIntegrationTest.java index b31bfcf5ec..c604db596a 100644 --- a/spring-rest/src/test/java/org/baeldung/web/controller/redirect/RedirectControllerIntegrationTest.java +++ b/spring-rest/src/test/java/org/baeldung/web/controller/redirect/RedirectControllerIntegrationTest.java @@ -1,7 +1,6 @@ package org.baeldung.web.controller.redirect; import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.nullValue; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.flash; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.forwardedUrl; @@ -51,7 +50,7 @@ public class RedirectControllerIntegrationTest { @Test public void whenRedirectOnUrlWithUsingRedirectAttributes_thenStatusRedirectionAndRedirectedOnUrlAndAddedAttributeToFlashScope() throws Exception { mockMvc.perform(get("/redirectWithRedirectAttributes")).andExpect(status().is3xxRedirection()).andExpect(flash().attribute("flashAttribute", equalTo("redirectWithRedirectAttributes"))) - .andExpect(model().attribute("attribute", equalTo("redirectWithRedirectAttributes"))).andExpect(model().attribute("flashAttribute", equalTo(nullValue()))).andExpect(redirectedUrl("redirectedUrl?attribute=redirectWithRedirectAttributes")); + .andExpect(model().attribute("attribute", equalTo("redirectWithRedirectAttributes"))).andExpect(model().attribute("flashAttribute", equalTo(null))).andExpect(redirectedUrl("redirectedUrl?attribute=redirectWithRedirectAttributes")); } @Test diff --git a/spring-security-basic-auth/README.md b/spring-security-basic-auth/README.md index 37ea545a9b..54d09dbf32 100644 --- a/spring-security-basic-auth/README.md +++ b/spring-security-basic-auth/README.md @@ -8,6 +8,7 @@ The "Learn Spring Security" Classes: http://github.learnspringsecurity.com ### Relevant Article: - [Spring Security - security none, filters none, access permitAll](http://www.baeldung.com/security-none-filters-none-access-permitAll) - [Spring Security Basic Authentication](http://www.baeldung.com/spring-security-basic-authentication) +- [Writing a Custom Filter in Spring Security](http://www.baeldung.com/spring-security-custom-filter) ### Notes diff --git a/spring-security-custom-permission/README.MD b/spring-security-custom-permission/README.MD index 0812a73090..d59aea97b4 100644 --- a/spring-security-custom-permission/README.MD +++ b/spring-security-custom-permission/README.MD @@ -3,4 +3,5 @@ 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) -- [Custom AccessDecisionVoters in Spring Security](http://www.baeldung.com/spring-security-custom-voter) \ No newline at end of file +- [Custom AccessDecisionVoters in Spring Security](http://www.baeldung.com/spring-security-custom-voter) +- [Spring Security: Authentication with a Database-backed UserDetailsService](http://www.baeldung.com/spring-security-authentication-with-a-database) 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 f8bc6c0160..a43b21c2b7 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 @@ -1,12 +1,18 @@ package org.baeldung.spring; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; + import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.support.SpringBootServletInitializer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.web.context.request.RequestContextListener; import org.springframework.web.filter.ShallowEtagHeaderFilter; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; /** * Main Application Class - uses Spring Boot. Just run this as a normal Java @@ -16,7 +22,19 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter @EnableScheduling @EnableAutoConfiguration @ComponentScan("org.baeldung") -public class Application extends WebMvcConfigurerAdapter { +@SpringBootApplication +public class Application extends SpringBootServletInitializer { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(Application.class); + } + + @Override + public void onStartup(ServletContext sc) throws ServletException { + // Manages the lifecycle of the root application context + sc.addListener(new RequestContextListener()); + } public static void main(final String[] args) { SpringApplication.run(Application.class, args); diff --git a/spring-security-rest-full/src/main/java/org/baeldung/spring/ListenerConfig.java b/spring-security-rest-full/src/main/java/org/baeldung/spring/ListenerConfig.java deleted file mode 100644 index 3d727fc19f..0000000000 --- a/spring-security-rest-full/src/main/java/org/baeldung/spring/ListenerConfig.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.baeldung.spring; - -import javax.servlet.ServletContext; -import javax.servlet.ServletException; - -import org.springframework.web.WebApplicationInitializer; -import org.springframework.web.context.request.RequestContextListener; - -public class ListenerConfig implements WebApplicationInitializer { - - @Override - public void onStartup(ServletContext sc) throws ServletException { - // Manages the lifecycle of the root application context - sc.addListener(new RequestContextListener()); - } -} \ No newline at end of file diff --git a/spring-security-rest-full/src/main/resources/application.properties b/spring-security-rest-full/src/main/resources/application.properties index 58c6f8eec7..c3e1f0b4bb 100644 --- a/spring-security-rest-full/src/main/resources/application.properties +++ b/spring-security-rest-full/src/main/resources/application.properties @@ -1,2 +1,3 @@ server.port=8082 -server.context-path=/spring-security-rest-full \ No newline at end of file +server.context-path=/spring-security-rest-full +endpoints.metrics.enabled=true \ No newline at end of file diff --git a/spring-session/README.md b/spring-session/README.md new file mode 100644 index 0000000000..0d802a4715 --- /dev/null +++ b/spring-session/README.md @@ -0,0 +1,6 @@ +========= + +## Spring Session Examples + +### Relevant Articles: +- [Introduction to Spring Session](http://www.baeldung.com/spring-session) diff --git a/spring-session/src/test/java/com/baeldung/spring/session/SessionControllerTest.java b/spring-session/src/test/java/com/baeldung/spring/session/SessionControllerTest.java index 42d12112a2..f08fec3a1f 100644 --- a/spring-session/src/test/java/com/baeldung/spring/session/SessionControllerTest.java +++ b/spring-session/src/test/java/com/baeldung/spring/session/SessionControllerTest.java @@ -1,86 +1,64 @@ package com.baeldung.spring.session; -import org.apache.tomcat.util.codec.binary.Base64; import org.junit.Before; import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.data.redis.connection.RedisConnection; -import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; import org.springframework.http.*; -import org.springframework.test.context.junit4.SpringRunner; +import redis.clients.jedis.Jedis; import java.util.Set; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class SessionControllerTest { - @Autowired - private TestRestTemplate restTemplate; - @Autowired - private JedisConnectionFactory jedisConnectionFactory; - - private RedisConnection connection; + private Jedis jedis; + private TestRestTemplate testRestTemplate; + private TestRestTemplate testRestTemplateWithAuth; + private String testUrl = "http://localhost:8080/"; @Before public void clearRedisData() { - connection = jedisConnectionFactory.getConnection(); - connection.flushAll(); + testRestTemplate = new TestRestTemplate(); + testRestTemplateWithAuth = new TestRestTemplate("admin", "password", null); + + jedis = new Jedis("localhost", 6379); + jedis.flushAll(); } @Test public void testRedisIsEmpty() { - Set result = connection.keys("*".getBytes()); + Set result = jedis.keys("*"); assertEquals(0, result.size()); } @Test public void testUnauthenticatedCantAccess() { - ResponseEntity result = restTemplate.getForEntity("/", String.class); + ResponseEntity result = testRestTemplate.getForEntity(testUrl, String.class); assertEquals(HttpStatus.UNAUTHORIZED, result.getStatusCode()); } @Test public void testRedisControlsSession() { - ResponseEntity result = restTemplate.exchange("/", HttpMethod.GET, makeAuthRequest(), String.class); + ResponseEntity result = testRestTemplateWithAuth.getForEntity(testUrl, String.class); assertEquals("hello admin", result.getBody()); //login worked - Set redisResult = connection.keys("*".getBytes()); + Set redisResult = jedis.keys("*"); assertTrue(redisResult.size() > 0); //redis is populated with session data String sessionCookie = result.getHeaders().get("Set-Cookie").get(0).split(";")[0]; - result = restTemplate.exchange("/", HttpMethod.GET, makeRequestWithCookie(sessionCookie), String.class); + HttpHeaders headers = new HttpHeaders(); + headers.add("Cookie", sessionCookie); + HttpEntity httpEntity = new HttpEntity<>(headers); + + result = testRestTemplate.exchange(testUrl, HttpMethod.GET, httpEntity, String.class); assertEquals("hello admin", result.getBody()); //access with session works worked - connection.flushAll(); //clear all keys in redis + jedis.flushAll(); //clear all keys in redis - result = restTemplate.exchange("/", HttpMethod.GET, makeRequestWithCookie(sessionCookie), String.class); + result = testRestTemplate.exchange(testUrl, HttpMethod.GET, httpEntity, String.class); assertEquals(HttpStatus.UNAUTHORIZED, result.getStatusCode());//access denied after sessions are removed in redis } - - private HttpEntity makeRequestWithCookie(String sessionCookie) { - HttpHeaders headers = new HttpHeaders(); - headers.add("Cookie", sessionCookie); - - return new HttpEntity<>(headers); - } - - private HttpEntity makeAuthRequest() { - String plainCreds = "admin:password"; - byte[] plainCredsBytes = plainCreds.getBytes(); - byte[] base64CredsBytes = Base64.encodeBase64(plainCredsBytes); - String base64Creds = new String(base64CredsBytes); - - HttpHeaders headers = new HttpHeaders(); - headers.add("Authorization", "Basic " + base64Creds); - - return new HttpEntity<>(headers); - } } \ No newline at end of file diff --git a/spring-thymeleaf/README.md b/spring-thymeleaf/README.md index 98fb4b043b..6b12bb676c 100644 --- a/spring-thymeleaf/README.md +++ b/spring-thymeleaf/README.md @@ -5,7 +5,9 @@ ### 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) - +- [Thymeleaf: Custom Layout Dialect](http://www.baeldung.com/thymeleaf-spring-layouts) +- [Spring and Thymeleaf 3: Expressions](http://www.baeldung.com/spring-thymeleaf-3-expressions) +- [Spring MVC + Thymeleaf 3.0: New Features](http://www.baeldung.com/spring-thymeleaf-3) ### Build the Project diff --git a/wicket/README.md b/wicket/README.md index 614446e7ba..e873ee1ba1 100644 --- a/wicket/README.md +++ b/wicket/README.md @@ -2,3 +2,7 @@ From the same directory where pom.xml is, execute the following command to run the project: mvn jetty:run + + +###Relevant Articles: +- [Introduction to the Wicket Framework](http://www.baeldung.com/intro-to-the-wicket-framework)