From 05c9a4c92a40a20c0ecf9264c3bc70230b047e41 Mon Sep 17 00:00:00 2001 From: Martin Porsch Date: Thu, 18 Feb 2021 10:39:41 +0100 Subject: [PATCH 01/22] characters(...) fills StringBuilder instead of String I startet to implement an XML parser from this tutorial and ran into a problem with empty elements, e.g. . I found this SO post (https://stackoverflow.com/questions/44570604/sax-parser-is-not-working-properly-when-xml-input-is-given-as-stream-and-some-xm) and realised, that characters(...) can be called zero or multiple times, so one should fixed it conceptually by using a StringBuffer or StringBuilder. --- .../java/com/baeldung/sax/SaxParserMain.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/xml/src/main/java/com/baeldung/sax/SaxParserMain.java b/xml/src/main/java/com/baeldung/sax/SaxParserMain.java index 4908c10386..34a46fe469 100644 --- a/xml/src/main/java/com/baeldung/sax/SaxParserMain.java +++ b/xml/src/main/java/com/baeldung/sax/SaxParserMain.java @@ -28,11 +28,15 @@ public class SaxParserMain { private static final String CONTENT = "content"; private Baeldung website; - private String elementValue; + private StringBuilder elementValue; @Override public void characters(char[] ch, int start, int length) throws SAXException { - elementValue = new String(ch, start, length); + if (elementValue == null) { + elementValue = new StringBuilder(); + } else { + elementValue.append(ch, start, length); + } } @Override @@ -48,6 +52,13 @@ public class SaxParserMain { break; case ARTICLE: website.getArticleList().add(new BaeldungArticle()); + break; + case TITLE: + elementValue = new StringBuilder(); + break; + case CONTENT: + elementValue = new StringBuilder(); + break; } } @@ -55,10 +66,10 @@ public class SaxParserMain { public void endElement(String uri, String localName, String qName) throws SAXException { switch (qName) { case TITLE: - latestArticle().setTitle(elementValue); + latestArticle().setTitle(elementValue.toString()); break; case CONTENT: - latestArticle().setContent(elementValue); + latestArticle().setContent(elementValue.toString()); break; } } From 090093500091c8f9d597fd2040249f6c6ca8b724 Mon Sep 17 00:00:00 2001 From: Amitabh Tiwari Date: Mon, 1 Mar 2021 09:05:25 +0530 Subject: [PATCH 02/22] Added tests for count --- .../CountQueryIntegrationTest.java | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 persistence-modules/spring-jooq/src/test/java/com/baeldung/jooq/introduction/CountQueryIntegrationTest.java diff --git a/persistence-modules/spring-jooq/src/test/java/com/baeldung/jooq/introduction/CountQueryIntegrationTest.java b/persistence-modules/spring-jooq/src/test/java/com/baeldung/jooq/introduction/CountQueryIntegrationTest.java new file mode 100644 index 0000000000..b6f0a6a856 --- /dev/null +++ b/persistence-modules/spring-jooq/src/test/java/com/baeldung/jooq/introduction/CountQueryIntegrationTest.java @@ -0,0 +1,46 @@ +package com.baeldung.jooq.introduction; + +import static com.baeldung.jooq.introduction.db.public_.tables.Author.AUTHOR; + +import org.jooq.DSLContext; +import org.jooq.impl.DSL; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.transaction.annotation.Transactional; + +@ContextConfiguration(classes = PersistenceContextIntegrationTest.class) +@Transactional(transactionManager = "transactionManager") +@RunWith(SpringJUnit4ClassRunner.class) +public class CountQueryIntegrationTest { + + @Autowired + private DSLContext dsl; + + @Test + public void givenValidData_whenSimpleSelect_thenSucceed() { + int count = dsl.select().from(AUTHOR).execute(); + Assert.assertEquals(3, count); + } + + @Test + public void givenValidData_whenSelectCount_thenSucceed() { + int count = dsl.selectCount().from(AUTHOR).fetchOne(0, int.class); + Assert.assertEquals(3, count); + } + + @Test + public void givenValidData_whenCount_thenSucceed() { + int count = dsl.select(DSL.count()).from(AUTHOR).fetchOne(0, int.class); + Assert.assertEquals(3, count); + } + + @Test + public void givenValidData_whenFetchCount_thenSucceed() { + int count = dsl.fetchCount(DSL.selectFrom(AUTHOR)); + Assert.assertEquals(3, count); + } +} \ No newline at end of file From 2fff4d24c50ba03e1e6a2612c66f50e2389e9159 Mon Sep 17 00:00:00 2001 From: Amitabh Tiwari Date: Sun, 7 Mar 2021 16:43:52 +0530 Subject: [PATCH 03/22] Added count queries --- .../introduction/CountQueryIntegrationTest.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/persistence-modules/spring-jooq/src/test/java/com/baeldung/jooq/introduction/CountQueryIntegrationTest.java b/persistence-modules/spring-jooq/src/test/java/com/baeldung/jooq/introduction/CountQueryIntegrationTest.java index b6f0a6a856..7dfa35eb73 100644 --- a/persistence-modules/spring-jooq/src/test/java/com/baeldung/jooq/introduction/CountQueryIntegrationTest.java +++ b/persistence-modules/spring-jooq/src/test/java/com/baeldung/jooq/introduction/CountQueryIntegrationTest.java @@ -22,25 +22,30 @@ public class CountQueryIntegrationTest { @Test public void givenValidData_whenSimpleSelect_thenSucceed() { - int count = dsl.select().from(AUTHOR).execute(); + int count = dsl.select().from(AUTHOR) + .execute(); Assert.assertEquals(3, count); } @Test public void givenValidData_whenSelectCount_thenSucceed() { - int count = dsl.selectCount().from(AUTHOR).fetchOne(0, int.class); + int count = dsl.selectCount().from(AUTHOR) + .where(AUTHOR.FIRST_NAME.equalIgnoreCase("Bryan")) + .fetchOne(0, int.class); Assert.assertEquals(3, count); } @Test public void givenValidData_whenCount_thenSucceed() { - int count = dsl.select(DSL.count()).from(AUTHOR).fetchOne(0, int.class); - Assert.assertEquals(3, count); + int count = dsl.select(DSL.count()).from(AUTHOR) + .fetchOne(0, int.class); + Assert.assertEquals(1, count); } @Test public void givenValidData_whenFetchCount_thenSucceed() { - int count = dsl.fetchCount(DSL.selectFrom(AUTHOR)); - Assert.assertEquals(3, count); + int count = dsl.fetchCount(DSL.selectFrom(AUTHOR) + .where(AUTHOR.FIRST_NAME.equalIgnoreCase("Bryan"))); + Assert.assertEquals(1, count); } } \ No newline at end of file From d010629fd54a69b3ff7b318e798b6b9bf0096979 Mon Sep 17 00:00:00 2001 From: Amitabh Tiwari Date: Tue, 9 Mar 2021 20:23:15 +0530 Subject: [PATCH 04/22] Added changes to fix the tests --- .../CountQueryIntegrationTest.java | 61 ++++++++++++++++--- 1 file changed, 54 insertions(+), 7 deletions(-) diff --git a/persistence-modules/spring-jooq/src/test/java/com/baeldung/jooq/introduction/CountQueryIntegrationTest.java b/persistence-modules/spring-jooq/src/test/java/com/baeldung/jooq/introduction/CountQueryIntegrationTest.java index 7dfa35eb73..4a21459d19 100644 --- a/persistence-modules/spring-jooq/src/test/java/com/baeldung/jooq/introduction/CountQueryIntegrationTest.java +++ b/persistence-modules/spring-jooq/src/test/java/com/baeldung/jooq/introduction/CountQueryIntegrationTest.java @@ -2,7 +2,13 @@ package com.baeldung.jooq.introduction; import static com.baeldung.jooq.introduction.db.public_.tables.Author.AUTHOR; +import java.util.ArrayList; +import java.util.List; + +import org.jooq.Condition; import org.jooq.DSLContext; +import org.jooq.Record2; +import org.jooq.Result; import org.jooq.impl.DSL; import org.junit.Assert; import org.junit.Test; @@ -22,8 +28,7 @@ public class CountQueryIntegrationTest { @Test public void givenValidData_whenSimpleSelect_thenSucceed() { - int count = dsl.select().from(AUTHOR) - .execute(); + int count = dsl.select().from(AUTHOR).execute(); Assert.assertEquals(3, count); } @@ -32,20 +37,62 @@ public class CountQueryIntegrationTest { int count = dsl.selectCount().from(AUTHOR) .where(AUTHOR.FIRST_NAME.equalIgnoreCase("Bryan")) .fetchOne(0, int.class); - Assert.assertEquals(3, count); + Assert.assertEquals(1, count); } @Test public void givenValidData_whenCount_thenSucceed() { - int count = dsl.select(DSL.count()).from(AUTHOR) - .fetchOne(0, int.class); - Assert.assertEquals(1, count); + int count = dsl.select(DSL.count()) + .from(AUTHOR).fetchOne(0, int.class); + Assert.assertEquals(3, count); } @Test public void givenValidData_whenFetchCount_thenSucceed() { - int count = dsl.fetchCount(DSL.selectFrom(AUTHOR) + int count = dsl.fetchCount( + DSL.selectFrom(AUTHOR) .where(AUTHOR.FIRST_NAME.equalIgnoreCase("Bryan"))); Assert.assertEquals(1, count); } + + @Test + public void givenValidData_whenFetchCountWithoutCondition_thenSucceed() { + int count = dsl.fetchCount( + DSL.selectFrom(AUTHOR)); + Assert.assertEquals(3, count); + } + + @Test + public void givenValidData_whenFetchCountWithSingleCondition_thenSucceed() { + int count = dsl.fetchCount(AUTHOR, AUTHOR.FIRST_NAME.equalIgnoreCase("Bryan")); + Assert.assertEquals(1, count); + } + + @Test + public void givenValidData_whenFetchCountWithMultipleConditions_thenSucceed() { + Condition firstCond = AUTHOR.FIRST_NAME.equalIgnoreCase("Bryan"); + Condition secondCond = AUTHOR.ID.notEqual(1); + List conditions = new ArrayList<>(); + conditions.add(firstCond); + conditions.add(secondCond); + int count = dsl.fetchCount(AUTHOR, conditions); + Assert.assertEquals(1, count); + } + + @Test + public void givenValidData_whenFetchCountWithConditionsInVarargs_thenSucceed() { + Condition firstCond = AUTHOR.FIRST_NAME.equalIgnoreCase("Bryan"); + Condition secondCond = AUTHOR.ID.notEqual(1); + int count = dsl.fetchCount(AUTHOR, firstCond, secondCond); + Assert.assertEquals(1, count); + } + + @Test + public void givenValidData_whenCountwithGroupBy_thenSucceed() { + final Result> result = dsl.select(AUTHOR.FIRST_NAME, DSL.count()) + .from(AUTHOR).groupBy(AUTHOR.FIRST_NAME).fetch(); + Assert.assertEquals(3, result.size()); + Assert.assertEquals(result.get(0).get(0), "Bert"); + Assert.assertEquals(result.get(0).get(1), 1); + } } \ No newline at end of file From 9928946793c7f43b95372b72c23fec778fec047d Mon Sep 17 00:00:00 2001 From: Anshul BANSAL Date: Thu, 11 Mar 2021 21:39:09 +0200 Subject: [PATCH 05/22] BAEL-4790_examples --- .../StreamVsCollectionExample.java | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 core-java-modules/core-java-streams-3/src/main/java/com/baeldung/streams/streamvscollection/StreamVsCollectionExample.java diff --git a/core-java-modules/core-java-streams-3/src/main/java/com/baeldung/streams/streamvscollection/StreamVsCollectionExample.java b/core-java-modules/core-java-streams-3/src/main/java/com/baeldung/streams/streamvscollection/StreamVsCollectionExample.java new file mode 100644 index 0000000000..c10c3c5449 --- /dev/null +++ b/core-java-modules/core-java-streams-3/src/main/java/com/baeldung/streams/streamvscollection/StreamVsCollectionExample.java @@ -0,0 +1,49 @@ +package com.baeldung.streams.streamvscollection; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public class StreamVsCollectionExample { + + static ArrayList userNameSource = new ArrayList<>(); + + static { + userNameSource.add("john"); + userNameSource.add("smith"); + userNameSource.add("tom"); + userNameSource.add("rob"); + userNameSource.add("charlie"); + userNameSource.add("alfred"); + } + + public static Stream userNames() { + return userNameSource.stream(); + } + + public static List userNameList() { + return userNames().collect(Collectors.toList()); + } + + public static Stream filterUserNames() { + return userNames().filter(i -> i.length() >= 4); + } + + public static Stream sortUserNames() { + return userNames().sorted(); + } + + public static Stream limitUserNames() { + return userNames().limit(3); + } + + public static Stream sortFilterLimitUserNames() { + return filterUserNames().sorted().limit(3); + } + + public static void printStream(Stream stream) { + stream.forEach(System.out::println); + } + +} From 7078630760e83b36d26ef0ce02ddb3b11fe45aba Mon Sep 17 00:00:00 2001 From: Anshul BANSAL Date: Sun, 21 Mar 2021 10:35:34 +0200 Subject: [PATCH 06/22] BAEL-4790 - collection vs stream --- .../StreamVsCollectionExample.java | 62 ++++++++++++++++--- 1 file changed, 54 insertions(+), 8 deletions(-) diff --git a/core-java-modules/core-java-streams-3/src/main/java/com/baeldung/streams/streamvscollection/StreamVsCollectionExample.java b/core-java-modules/core-java-streams-3/src/main/java/com/baeldung/streams/streamvscollection/StreamVsCollectionExample.java index c10c3c5449..379d231bed 100644 --- a/core-java-modules/core-java-streams-3/src/main/java/com/baeldung/streams/streamvscollection/StreamVsCollectionExample.java +++ b/core-java-modules/core-java-streams-3/src/main/java/com/baeldung/streams/streamvscollection/StreamVsCollectionExample.java @@ -2,13 +2,17 @@ package com.baeldung.streams.streamvscollection; import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.SortedSet; +import java.util.TreeSet; import java.util.stream.Collectors; import java.util.stream.Stream; public class StreamVsCollectionExample { - + static ArrayList userNameSource = new ArrayList<>(); - + static { userNameSource.add("john"); userNameSource.add("smith"); @@ -17,33 +21,75 @@ public class StreamVsCollectionExample { userNameSource.add("charlie"); userNameSource.add("alfred"); } - + public static Stream userNames() { return userNameSource.stream(); } - + public static List userNameList() { return userNames().collect(Collectors.toList()); } + public static Set userNameSet() { + return userNames().collect(Collectors.toSet()); + } + + public static Map userNameMap() { + return userNames().collect(Collectors.toMap(u1 -> u1.toString(), u1 -> u1.toString())); + } + public static Stream filterUserNames() { return userNames().filter(i -> i.length() >= 4); } - + public static Stream sortUserNames() { return userNames().sorted(); } - + public static Stream limitUserNames() { return userNames().limit(3); } - + public static Stream sortFilterLimitUserNames() { return filterUserNames().sorted().limit(3); } - + public static void printStream(Stream stream) { stream.forEach(System.out::println); } + + public static void modifyList() { + userNameSource.remove(2); + } + + public static Map modifyMap() { + Map userNameMap = userNameMap(); + userNameMap.put("bob", "bob"); + userNameMap.remove("alfred"); + + return userNameMap; + } + + public static void tryStreamTraversal() { + Stream userNameStream = userNames(); + userNameStream.forEach(System.out::println); + + try { + userNameStream.forEach(System.out::println); + } catch(IllegalStateException e) { + System.out.println("stream has already been operated upon or closed"); + } + } + + public static void main(String[] args) { + System.out.println(userNameMap()); + System.out.println(modifyMap()); + tryStreamTraversal(); + + Set set = userNames().collect(Collectors.toCollection(TreeSet::new)); + set.forEach(val -> System.out.println(val)); + + } + } From f05b7b68c2684fab71b0c88bb45cce83010f4220 Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Sun, 21 Mar 2021 22:44:21 +0100 Subject: [PATCH 07/22] JAVA-3595: Upgrade jmh version in the main pom.xml --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index f202430ccf..18ca8a0e13 100644 --- a/pom.xml +++ b/pom.xml @@ -1371,8 +1371,8 @@ 1.8 1.2.17 2.2.2.0 - 1.19 - 1.19 + 1.28 + 1.28 1.6.0 2.21.0 2.8.0 From df6828772837ba75535e1221c2392f9ce9e0c8ca Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Sun, 21 Mar 2021 23:06:03 +0100 Subject: [PATCH 08/22] JAVA-3595: Use jmh version defined in the parent pom.xml --- algorithms-miscellaneous-3/pom.xml | 2 -- core-java-modules/core-java-11/pom.xml | 5 ++--- core-java-modules/core-java-arrays-guides/pom.xml | 8 ++------ .../core-java-arrays-operations-basic/pom.xml | 5 ++--- core-java-modules/core-java-arrays-sorting/pom.xml | 5 ++--- core-java-modules/core-java-char/pom.xml | 5 ++--- core-java-modules/core-java-collections-3/pom.xml | 3 +-- core-java-modules/core-java-collections-list-3/pom.xml | 2 +- core-java-modules/core-java-collections/pom.xml | 5 ++--- .../core-java-concurrency-advanced-2/pom.xml | 4 +--- .../core-java-concurrency-collections-2/pom.xml | 5 ++--- core-java-modules/core-java-lang-2/pom.xml | 2 -- core-java-modules/core-java-lang-4/pom.xml | 8 ++------ core-java-modules/core-java-lang-math-2/pom.xml | 3 +-- core-java-modules/core-java-optional/pom.xml | 2 -- .../core-java-string-algorithms-2/pom.xml | 2 +- core-java-modules/core-java-string-algorithms/pom.xml | 2 +- jmh/pom.xml | 5 ++--- libraries-5/pom.xml | 3 +-- libraries-primitive/pom.xml | 5 ++--- libraries/pom.xml | 3 +-- parent-java/pom.xml | 5 ++--- performance-tests/pom.xml | 10 +++------- persistence-modules/hibernate-jpa/pom.xml | 3 +-- persistence-modules/hibernate-queries/pom.xml | 3 +-- persistence-modules/hibernate5/pom.xml | 3 +-- xml/pom.xml | 5 ++--- 27 files changed, 38 insertions(+), 75 deletions(-) diff --git a/algorithms-miscellaneous-3/pom.xml b/algorithms-miscellaneous-3/pom.xml index 877e8bfefa..4b67a30abb 100644 --- a/algorithms-miscellaneous-3/pom.xml +++ b/algorithms-miscellaneous-3/pom.xml @@ -91,8 +91,6 @@ 4.3 28.0-jre 2.6.0 - 1.19 - 1.19 3.8.1 1.1.0 diff --git a/core-java-modules/core-java-11/pom.xml b/core-java-modules/core-java-11/pom.xml index 2f7f5a6bcf..cdb3aab2c7 100644 --- a/core-java-modules/core-java-11/pom.xml +++ b/core-java-modules/core-java-11/pom.xml @@ -32,12 +32,12 @@ org.openjdk.jmh jmh-core - ${jmh.version} + ${jmh-core.version} org.openjdk.jmh jmh-generator-annprocess - ${jmh.version} + ${jmh-generator.version} provided @@ -105,7 +105,6 @@ 27.1-jre 3.11.1 benchmarks - 1.22 10.0.0 3.2.4 diff --git a/core-java-modules/core-java-arrays-guides/pom.xml b/core-java-modules/core-java-arrays-guides/pom.xml index df8639820d..eafdb02ab8 100644 --- a/core-java-modules/core-java-arrays-guides/pom.xml +++ b/core-java-modules/core-java-arrays-guides/pom.xml @@ -17,16 +17,12 @@ org.openjdk.jmh jmh-core - ${jmh.version} + ${jmh-core.version} org.openjdk.jmh jmh-generator-annprocess - ${jmh.version} + ${jmh-generator.version} - - - 1.19 - \ No newline at end of file diff --git a/core-java-modules/core-java-arrays-operations-basic/pom.xml b/core-java-modules/core-java-arrays-operations-basic/pom.xml index dcee6547a0..9157d9deb9 100644 --- a/core-java-modules/core-java-arrays-operations-basic/pom.xml +++ b/core-java-modules/core-java-arrays-operations-basic/pom.xml @@ -24,12 +24,12 @@ org.openjdk.jmh jmh-core - ${jmh.version} + ${jmh-core.version} org.openjdk.jmh jmh-generator-annprocess - ${jmh.version} + ${jmh-generator.version} @@ -68,7 +68,6 @@ 3.2.0 - 1.19 3.10.0 \ No newline at end of file diff --git a/core-java-modules/core-java-arrays-sorting/pom.xml b/core-java-modules/core-java-arrays-sorting/pom.xml index 9b900c3de6..610582260b 100644 --- a/core-java-modules/core-java-arrays-sorting/pom.xml +++ b/core-java-modules/core-java-arrays-sorting/pom.xml @@ -31,12 +31,12 @@ org.openjdk.jmh jmh-core - ${jmh.version} + ${jmh-core.version} org.openjdk.jmh jmh-generator-annprocess - ${jmh.version} + ${jmh-generator.version} @@ -77,7 +77,6 @@ 3.2.0 28.2-jre - 1.19 3.10.0 \ No newline at end of file diff --git a/core-java-modules/core-java-char/pom.xml b/core-java-modules/core-java-char/pom.xml index 3691079482..078a829e00 100644 --- a/core-java-modules/core-java-char/pom.xml +++ b/core-java-modules/core-java-char/pom.xml @@ -25,17 +25,16 @@ org.openjdk.jmh jmh-core - ${openjdk.jmh.version} + ${jmh-core.version} org.openjdk.jmh jmh-generator-annprocess - ${openjdk.jmh.version} + ${jmh-generator.version} - 1.19 3.11.1 diff --git a/core-java-modules/core-java-collections-3/pom.xml b/core-java-modules/core-java-collections-3/pom.xml index 602fcf60f4..aa04d1cb24 100644 --- a/core-java-modules/core-java-collections-3/pom.xml +++ b/core-java-modules/core-java-collections-3/pom.xml @@ -24,7 +24,7 @@ org.openjdk.jmh jmh-core - ${openjdk.jmh.version} + ${jmh-core.version} org.assertj @@ -40,7 +40,6 @@ - 1.19 3.11.1 0.10 diff --git a/core-java-modules/core-java-collections-list-3/pom.xml b/core-java-modules/core-java-collections-list-3/pom.xml index e1cf645c8a..d1d199ec3f 100644 --- a/core-java-modules/core-java-collections-list-3/pom.xml +++ b/core-java-modules/core-java-collections-list-3/pom.xml @@ -58,7 +58,7 @@ org.openjdk.jmh jmh-generator-annprocess - ${jmh-core.version} + ${jmh-generator.version} diff --git a/core-java-modules/core-java-collections/pom.xml b/core-java-modules/core-java-collections/pom.xml index e1219c4713..fe9cf57bfb 100644 --- a/core-java-modules/core-java-collections/pom.xml +++ b/core-java-modules/core-java-collections/pom.xml @@ -25,17 +25,16 @@ org.openjdk.jmh jmh-core - ${openjdk.jmh.version} + ${jmh-core.version} org.openjdk.jmh jmh-generator-annprocess - ${openjdk.jmh.version} + ${jmh-generator.version} - 1.19 3.11.1 diff --git a/core-java-modules/core-java-concurrency-advanced-2/pom.xml b/core-java-modules/core-java-concurrency-advanced-2/pom.xml index 2f374bffac..98f159a85f 100644 --- a/core-java-modules/core-java-concurrency-advanced-2/pom.xml +++ b/core-java-modules/core-java-concurrency-advanced-2/pom.xml @@ -29,7 +29,7 @@ org.openjdk.jmh jmh-generator-annprocess - ${jmh-generator-annprocess.version} + ${jmh-generator.version} @@ -51,8 +51,6 @@ - 1.19 - 1.19 3.6.1 diff --git a/core-java-modules/core-java-concurrency-collections-2/pom.xml b/core-java-modules/core-java-concurrency-collections-2/pom.xml index f9ee41f6d5..19d43aa7dd 100644 --- a/core-java-modules/core-java-concurrency-collections-2/pom.xml +++ b/core-java-modules/core-java-concurrency-collections-2/pom.xml @@ -23,12 +23,12 @@ org.openjdk.jmh jmh-core - ${jmh.version} + ${jmh-core.version} org.openjdk.jmh jmh-generator-annprocess - ${jmh.version} + ${jmh-generator.version} org.assertj @@ -39,7 +39,6 @@ - 1.21 28.2-jre 3.6.1 diff --git a/core-java-modules/core-java-lang-2/pom.xml b/core-java-modules/core-java-lang-2/pom.xml index d395e8efb1..9da76fa168 100644 --- a/core-java-modules/core-java-lang-2/pom.xml +++ b/core-java-modules/core-java-lang-2/pom.xml @@ -65,8 +65,6 @@ - 1.19 - 1.19 3.12.2 1.9.4 29.0-jre diff --git a/core-java-modules/core-java-lang-4/pom.xml b/core-java-modules/core-java-lang-4/pom.xml index 3e92e9f9c7..f00a9318f7 100644 --- a/core-java-modules/core-java-lang-4/pom.xml +++ b/core-java-modules/core-java-lang-4/pom.xml @@ -20,12 +20,12 @@ org.openjdk.jmh jmh-core - ${jmh.version} + ${jmh-core.version} org.openjdk.jmh jmh-generator-annprocess - ${jmh.version} + ${jmh-generator.version} test @@ -39,9 +39,5 @@ - - - 1.28 - \ No newline at end of file diff --git a/core-java-modules/core-java-lang-math-2/pom.xml b/core-java-modules/core-java-lang-math-2/pom.xml index e2cced4fbf..42704c784a 100644 --- a/core-java-modules/core-java-lang-math-2/pom.xml +++ b/core-java-modules/core-java-lang-math-2/pom.xml @@ -58,7 +58,7 @@ org.openjdk.jmh jmh-generator-annprocess - ${jmh.version} + ${jmh-generator.version} @@ -83,7 +83,6 @@ 1.0.0-beta4 1.2.0 0.6.0 - 1.19 \ No newline at end of file diff --git a/core-java-modules/core-java-optional/pom.xml b/core-java-modules/core-java-optional/pom.xml index 575ccb0759..a6127f5fdd 100644 --- a/core-java-modules/core-java-optional/pom.xml +++ b/core-java-modules/core-java-optional/pom.xml @@ -67,8 +67,6 @@ 5.4.0.Final - 1.19 - 1.19 27.1-jre 3.10.0 3.1.1 diff --git a/core-java-modules/core-java-string-algorithms-2/pom.xml b/core-java-modules/core-java-string-algorithms-2/pom.xml index 2a84cebb4c..ae2685e742 100644 --- a/core-java-modules/core-java-string-algorithms-2/pom.xml +++ b/core-java-modules/core-java-string-algorithms-2/pom.xml @@ -34,7 +34,7 @@ org.openjdk.jmh jmh-generator-annprocess - ${jmh-core.version} + ${jmh-generator.version} org.assertj diff --git a/core-java-modules/core-java-string-algorithms/pom.xml b/core-java-modules/core-java-string-algorithms/pom.xml index 6ba9ae7bb3..abafd10f2b 100644 --- a/core-java-modules/core-java-string-algorithms/pom.xml +++ b/core-java-modules/core-java-string-algorithms/pom.xml @@ -39,7 +39,7 @@ org.openjdk.jmh jmh-generator-annprocess - ${jmh-core.version} + ${jmh-generator.version} com.vdurmont diff --git a/jmh/pom.xml b/jmh/pom.xml index 16a5bc54a4..ecee66f410 100644 --- a/jmh/pom.xml +++ b/jmh/pom.xml @@ -19,12 +19,12 @@ org.openjdk.jmh jmh-core - ${openjdk.jmh.version} + ${jmh-core.version} org.openjdk.jmh jmh-generator-annprocess - ${openjdk.jmh.version} + ${jmh-generator.version} org.openjdk.jol @@ -76,7 +76,6 @@ - 1.19 3.0.2 0.10 3.2.0 diff --git a/libraries-5/pom.xml b/libraries-5/pom.xml index 63347dd60d..80b39b590e 100644 --- a/libraries-5/pom.xml +++ b/libraries-5/pom.xml @@ -115,7 +115,7 @@ org.openjdk.jmh jmh-core - ${jmh.version} + ${jmh-core.version} @@ -134,7 +134,6 @@ 4.5.1 1.0 2.1.2 - 1.19 \ No newline at end of file diff --git a/libraries-primitive/pom.xml b/libraries-primitive/pom.xml index 1370468e76..ec084fedeb 100644 --- a/libraries-primitive/pom.xml +++ b/libraries-primitive/pom.xml @@ -26,13 +26,13 @@ org.openjdk.jmh jmh-core - ${jmh.version} + ${jmh-core.version} test org.openjdk.jmh jmh-generator-annprocess - ${jmh.version} + ${jmh-generator.version} test @@ -46,7 +46,6 @@ 8.2.2 4.12 - 1.19 10.0.0 1.8 1.8 diff --git a/libraries/pom.xml b/libraries/pom.xml index fee66f928d..5924ed009a 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -202,7 +202,7 @@ org.openjdk.jmh jmh-core - ${jmh.version} + ${jmh-core.version} junit @@ -395,7 +395,6 @@ 3.0.3 2.3.0 0.9.12 - 1.19 3.0.2 3.6 2.6 diff --git a/parent-java/pom.xml b/parent-java/pom.xml index 9170f45bbe..ce79b34f57 100644 --- a/parent-java/pom.xml +++ b/parent-java/pom.xml @@ -32,18 +32,17 @@ org.openjdk.jmh jmh-core - ${jmh.version} + ${jmh-core.version} org.openjdk.jmh jmh-generator-annprocess - ${jmh.version} + ${jmh-generator.version} 29.0-jre - 1.19 2.3.7 2.2 diff --git a/performance-tests/pom.xml b/performance-tests/pom.xml index fb3f82df38..e9d724aab0 100644 --- a/performance-tests/pom.xml +++ b/performance-tests/pom.xml @@ -42,12 +42,12 @@ org.openjdk.jmh jmh-core - ${jmh.version} + ${jmh-core.version} org.openjdk.jmh jmh-generator-annprocess - ${jmh.version} + ${jmh-generator.version} provided @@ -67,7 +67,7 @@ org.openjdk.jmh jmh-generator-annprocess - ${jmh.version} + ${jmh-generator.version} org.mapstruct @@ -156,10 +156,6 @@ - - 1.23 1.5.4 6.5.0 1.3.1.Final diff --git a/persistence-modules/hibernate-jpa/pom.xml b/persistence-modules/hibernate-jpa/pom.xml index 07b1ee1c51..e5056c413b 100644 --- a/persistence-modules/hibernate-jpa/pom.xml +++ b/persistence-modules/hibernate-jpa/pom.xml @@ -79,7 +79,7 @@ org.openjdk.jmh jmh-generator-annprocess - ${openjdk-jmh.version} + ${jmh-generator.version} org.postgresql @@ -94,7 +94,6 @@ 42.2.11 2.2.3 3.8.0 - 1.21 2.1.7.RELEASE diff --git a/persistence-modules/hibernate-queries/pom.xml b/persistence-modules/hibernate-queries/pom.xml index 4374c833c2..d44bc0f8ae 100644 --- a/persistence-modules/hibernate-queries/pom.xml +++ b/persistence-modules/hibernate-queries/pom.xml @@ -53,7 +53,7 @@ org.openjdk.jmh jmh-generator-annprocess - ${openjdk-jmh.version} + ${jmh-generator.version} @@ -61,7 +61,6 @@ 6.0.6 2.2.3 3.8.0 - 1.21 diff --git a/persistence-modules/hibernate5/pom.xml b/persistence-modules/hibernate5/pom.xml index 3feffc98fd..fe0e7680ab 100644 --- a/persistence-modules/hibernate5/pom.xml +++ b/persistence-modules/hibernate5/pom.xml @@ -59,7 +59,7 @@ org.openjdk.jmh jmh-generator-annprocess - ${openjdk-jmh.version} + ${jmh-generator.version} @@ -68,7 +68,6 @@ 6.0.6 2.2.3 3.8.0 - 1.21 diff --git a/xml/pom.xml b/xml/pom.xml index 837f918b46..e2731abb13 100644 --- a/xml/pom.xml +++ b/xml/pom.xml @@ -75,12 +75,12 @@ org.openjdk.jmh jmh-core - ${jmh.version} + ${jmh-core.version} org.openjdk.jmh jmh-generator-annprocess - ${jmh.version} + ${jmh-generator.version} @@ -374,7 +374,6 @@ 3.12.2 2.6.3 5.5.0 - 1.21 2.3.29 0.9.6 From b5a0a9835aa42c79e9bd9e3e23cd25b88eded110 Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Sun, 21 Mar 2021 23:14:29 +0100 Subject: [PATCH 09/22] JAVA-3595: Fix libraries-primitive's pom.xml --- libraries-primitive/pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libraries-primitive/pom.xml b/libraries-primitive/pom.xml index ec084fedeb..a3bf5e0d9d 100644 --- a/libraries-primitive/pom.xml +++ b/libraries-primitive/pom.xml @@ -49,6 +49,8 @@ 10.0.0 1.8 1.8 + 1.28 + 1.28 \ No newline at end of file From 51b15d43700584b7060607400e26e9ff8955ffbb Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Wed, 24 Mar 2021 09:19:46 +0100 Subject: [PATCH 10/22] JAVA-3295: Fix main pom.xml formatting --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f202430ccf..c016f0abbf 100644 --- a/pom.xml +++ b/pom.xml @@ -1351,7 +1351,7 @@ false false false - true + true 4.12 2.2 From df93a6b9e616501f2500ff3b94061ffaf0be3736 Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Wed, 24 Mar 2021 09:37:43 +0100 Subject: [PATCH 11/22] JAVA-3295: Use project.build.sourceEncoding and project.reporting.outputEncoding from the main pom.xml --- akka-http/pom.xml | 2 -- core-java-modules/core-java-streams-2/pom.xml | 1 - core-java-modules/multimodulemavenproject/pom.xml | 1 - custom-pmd/pom.xml | 1 - ddd-modules/pom.xml | 2 -- google-web-toolkit/pom.xml | 3 --- jhipster-5/bookstore-monolith/pom.xml | 2 -- jhipster/jhipster-uaa/gateway/pom.xml | 2 -- jhipster/jhipster-uaa/quotes/pom.xml | 2 -- jhipster/jhipster-uaa/uaa/pom.xml | 2 -- persistence-modules/sirix/pom.xml | 1 - .../greeter-spring-boot-autoconfigure/pom.xml | 1 - .../greeter-spring-boot-starter/pom.xml | 1 - .../kubernetes-selfhealing/liveness-example/pom.xml | 5 ----- .../kubernetes-selfhealing/readiness-example/pom.xml | 5 ----- .../spring-cloud-zuul-eureka-integration/bin/pom.xml | 1 - .../spring-security-web-angular/server/pom.xml | 5 ----- testing-modules/zerocode/pom.xml | 1 - 18 files changed, 38 deletions(-) diff --git a/akka-http/pom.xml b/akka-http/pom.xml index c0b460dd8e..c146e58b60 100644 --- a/akka-http/pom.xml +++ b/akka-http/pom.xml @@ -38,8 +38,6 @@ - UTF-8 - UTF-8 10.0.11 2.5.11 diff --git a/core-java-modules/core-java-streams-2/pom.xml b/core-java-modules/core-java-streams-2/pom.xml index 2a0a4348b0..323e01261f 100644 --- a/core-java-modules/core-java-streams-2/pom.xml +++ b/core-java-modules/core-java-streams-2/pom.xml @@ -47,7 +47,6 @@ - UTF-8 1.9 1.9 3.11.1 diff --git a/core-java-modules/multimodulemavenproject/pom.xml b/core-java-modules/multimodulemavenproject/pom.xml index dcf9f7311e..25f268f8b3 100644 --- a/core-java-modules/multimodulemavenproject/pom.xml +++ b/core-java-modules/multimodulemavenproject/pom.xml @@ -59,7 +59,6 @@ 3.8.0 1.9 1.9 - UTF-8 3.12.2 diff --git a/custom-pmd/pom.xml b/custom-pmd/pom.xml index e0f38199ec..50bd16e2d5 100644 --- a/custom-pmd/pom.xml +++ b/custom-pmd/pom.xml @@ -45,7 +45,6 @@ - UTF-8 3.7.0 6.0.1 1.8 diff --git a/ddd-modules/pom.xml b/ddd-modules/pom.xml index 6ab1829198..4072d93f90 100644 --- a/ddd-modules/pom.xml +++ b/ddd-modules/pom.xml @@ -75,8 +75,6 @@ - UTF-8 - 9 9 diff --git a/google-web-toolkit/pom.xml b/google-web-toolkit/pom.xml index 6fdcae4f75..cad15c8037 100644 --- a/google-web-toolkit/pom.xml +++ b/google-web-toolkit/pom.xml @@ -113,9 +113,6 @@ 1.8 1.8 - - UTF-8 - UTF-8 2.8.2 1.0-rc-8 2.17 diff --git a/jhipster-5/bookstore-monolith/pom.xml b/jhipster-5/bookstore-monolith/pom.xml index dbc46bbb97..5da3bde449 100644 --- a/jhipster-5/bookstore-monolith/pom.xml +++ b/jhipster-5/bookstore-monolith/pom.xml @@ -1099,8 +1099,6 @@ 2.12.6 v10.15.0 6.4.1 - UTF-8 - UTF-8 ${project.build.directory}/test-results yyyyMMddHHmmss ${java.version} diff --git a/jhipster/jhipster-uaa/gateway/pom.xml b/jhipster/jhipster-uaa/gateway/pom.xml index b417bd7b57..21a04a9692 100644 --- a/jhipster/jhipster-uaa/gateway/pom.xml +++ b/jhipster/jhipster-uaa/gateway/pom.xml @@ -1020,8 +1020,6 @@ 2.12.6 v8.12.0 6.4.1 - UTF-8 - UTF-8 ${project.build.directory}/test-results yyyyMMddHHmmss ${java.version} diff --git a/jhipster/jhipster-uaa/quotes/pom.xml b/jhipster/jhipster-uaa/quotes/pom.xml index f088ad2fd1..12bbf66d37 100644 --- a/jhipster/jhipster-uaa/quotes/pom.xml +++ b/jhipster/jhipster-uaa/quotes/pom.xml @@ -840,8 +840,6 @@ 2.12.6 v8.12.0 6.4.1 - UTF-8 - UTF-8 ${project.build.directory}/test-results yyyyMMddHHmmss ${java.version} diff --git a/jhipster/jhipster-uaa/uaa/pom.xml b/jhipster/jhipster-uaa/uaa/pom.xml index f9c1f226bb..d0d81aa0b3 100644 --- a/jhipster/jhipster-uaa/uaa/pom.xml +++ b/jhipster/jhipster-uaa/uaa/pom.xml @@ -842,8 +842,6 @@ 2.12.6 v8.12.0 6.4.1 - UTF-8 - UTF-8 ${project.build.directory}/test-results yyyyMMddHHmmss ${java.version} diff --git a/persistence-modules/sirix/pom.xml b/persistence-modules/sirix/pom.xml index 67de507cca..da9695081c 100644 --- a/persistence-modules/sirix/pom.xml +++ b/persistence-modules/sirix/pom.xml @@ -47,7 +47,6 @@ - UTF-8 11 0.9.3 3.8.0 diff --git a/spring-boot-modules/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/pom.xml b/spring-boot-modules/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/pom.xml index 532f45cf3e..4903f21c77 100644 --- a/spring-boot-modules/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/pom.xml +++ b/spring-boot-modules/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/pom.xml @@ -62,7 +62,6 @@ - UTF-8 2.2.6.RELEASE 0.0.1-SNAPSHOT diff --git a/spring-boot-modules/spring-boot-custom-starter/greeter-spring-boot-starter/pom.xml b/spring-boot-modules/spring-boot-custom-starter/greeter-spring-boot-starter/pom.xml index 0e8fb4cbc9..85a6721492 100644 --- a/spring-boot-modules/spring-boot-custom-starter/greeter-spring-boot-starter/pom.xml +++ b/spring-boot-modules/spring-boot-custom-starter/greeter-spring-boot-starter/pom.xml @@ -49,7 +49,6 @@ - UTF-8 0.0.1-SNAPSHOT 2.2.6.RELEASE diff --git a/spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/liveness-example/pom.xml b/spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/liveness-example/pom.xml index f0d34d2231..16e718a3be 100644 --- a/spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/liveness-example/pom.xml +++ b/spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/liveness-example/pom.xml @@ -41,9 +41,4 @@ - - UTF-8 - UTF-8 - - \ No newline at end of file diff --git a/spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/readiness-example/pom.xml b/spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/readiness-example/pom.xml index 8bfd4d305d..0ee40b6504 100644 --- a/spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/readiness-example/pom.xml +++ b/spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/readiness-example/pom.xml @@ -41,9 +41,4 @@ - - UTF-8 - UTF-8 - - \ No newline at end of file diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/bin/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/bin/pom.xml index c7b35ef934..c6658d70a2 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/bin/pom.xml +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/bin/pom.xml @@ -22,7 +22,6 @@ - UTF-8 3.7.0 1.4.2.RELEASE 1.10 diff --git a/spring-security-modules/spring-security-web-angular/server/pom.xml b/spring-security-modules/spring-security-web-angular/server/pom.xml index 19d980062c..07d5d44e8d 100644 --- a/spring-security-modules/spring-security-web-angular/server/pom.xml +++ b/spring-security-modules/spring-security-web-angular/server/pom.xml @@ -62,9 +62,4 @@ - - UTF-8 - UTF-8 - - diff --git a/testing-modules/zerocode/pom.xml b/testing-modules/zerocode/pom.xml index 9d765e6cb4..dce62df9ea 100644 --- a/testing-modules/zerocode/pom.xml +++ b/testing-modules/zerocode/pom.xml @@ -92,7 +92,6 @@ - UTF-8 8 8 2.4.2 From 5e3e710e84e9687d1a3e05f20ef8eabd085888c2 Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Wed, 24 Mar 2021 10:31:09 +0100 Subject: [PATCH 12/22] JAVA-3295: Fix pom properties in testing-modules --- .../math-test-functions/pom.xml | 6 +++++- .../string-test-functions/pom.xml | 6 +++++- testing-modules/testing-assertions/pom.xml | 18 ++++++++++++------ testing-modules/testing-libraries-2/pom.xml | 3 ++- testing-modules/testing-libraries/pom.xml | 4 ++-- testing-modules/zerocode/pom.xml | 9 ++++++--- 6 files changed, 32 insertions(+), 14 deletions(-) diff --git a/testing-modules/parallel-tests-junit/math-test-functions/pom.xml b/testing-modules/parallel-tests-junit/math-test-functions/pom.xml index fb12803333..fdd45e19d6 100644 --- a/testing-modules/parallel-tests-junit/math-test-functions/pom.xml +++ b/testing-modules/parallel-tests-junit/math-test-functions/pom.xml @@ -27,7 +27,7 @@ org.apache.maven.plugins maven-surefire-plugin - 2.22.0 + ${maven-surefire-plugin.version} all 10 @@ -45,4 +45,8 @@ + + 2.22.0 + + diff --git a/testing-modules/parallel-tests-junit/string-test-functions/pom.xml b/testing-modules/parallel-tests-junit/string-test-functions/pom.xml index 313d82c23f..727a1f814a 100644 --- a/testing-modules/parallel-tests-junit/string-test-functions/pom.xml +++ b/testing-modules/parallel-tests-junit/string-test-functions/pom.xml @@ -27,7 +27,7 @@ org.apache.maven.plugins maven-surefire-plugin - 2.22.0 + ${maven-surefire-plugin.version} all true @@ -37,4 +37,8 @@ + + 2.22.0 + + diff --git a/testing-modules/testing-assertions/pom.xml b/testing-modules/testing-assertions/pom.xml index fa0f666c7f..4f0209a484 100644 --- a/testing-modules/testing-assertions/pom.xml +++ b/testing-modules/testing-assertions/pom.xml @@ -16,36 +16,36 @@ ch.qos.logback logback-classic - 1.2.3 + ${logback.version} org.junit.jupiter junit-jupiter-engine - 5.6.2 + ${junit-jupiter.version} test org.junit.jupiter junit-jupiter-api - 5.6.2 + ${junit-jupiter.version} test org.assertj assertj-core - 3.16.1 + ${assertj-core.version} test org.hamcrest hamcrest-all - 1.3 + ${hamcrest-all.version} test org.apache.commons commons-collections4 - 4.4 + ${commons-collections4.version} test @@ -59,4 +59,10 @@ + + + 3.16.1 + 4.4 + 5.6.2 + diff --git a/testing-modules/testing-libraries-2/pom.xml b/testing-modules/testing-libraries-2/pom.xml index 42c84d0da9..7f96280cac 100644 --- a/testing-modules/testing-libraries-2/pom.xml +++ b/testing-modules/testing-libraries-2/pom.xml @@ -16,7 +16,7 @@ org.assertj assertj-core - 3.16.1 + ${assertj-core.version} test @@ -86,5 +86,6 @@ 1.0.0 1.1.0 5.6.2 + 3.16.1 diff --git a/testing-modules/testing-libraries/pom.xml b/testing-modules/testing-libraries/pom.xml index aa22a5253e..4edd13fa30 100644 --- a/testing-modules/testing-libraries/pom.xml +++ b/testing-modules/testing-libraries/pom.xml @@ -36,11 +36,10 @@ ${cucumber.version} test - org.springframework.boot spring-boot-starter-web - 2.2.0.RELEASE + ${spring-boot.version} com.github.stefanbirkner @@ -103,6 +102,7 @@ 3.0.0 1.19.0 1.0.0 + 2.4.3 diff --git a/testing-modules/zerocode/pom.xml b/testing-modules/zerocode/pom.xml index dce62df9ea..63f0dc9cbb 100644 --- a/testing-modules/zerocode/pom.xml +++ b/testing-modules/zerocode/pom.xml @@ -28,7 +28,7 @@ org.jsmart zerocode-tdd - 1.3.27 + ${zerocode-tdd.version} test @@ -68,7 +68,7 @@ org.apache.maven.plugins maven-failsafe-plugin - 3.0.0-M5 + ${maven-failsafe-plugin.version} ${skip.it} @@ -76,7 +76,7 @@ org.apache.maven.surefire surefire-junit47 - 3.0.0-M5 + ${surefire-junit47.version} @@ -92,10 +92,13 @@ + 3.0.0-M5 + 3.0.0-M5 8 8 2.4.2 true + 1.3.27 From 6ef0632df28968c89276ff266c6aba5b11e001ba Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Wed, 24 Mar 2021 12:32:33 +0100 Subject: [PATCH 13/22] JAVA-3295: Fix pom properties in persistence-modules --- persistence-modules/apache-bookkeeper/pom.xml | 3 ++- persistence-modules/java-jpa-3/pom.xml | 7 ++++--- persistence-modules/jooq/pom.xml | 16 +++++++++++----- persistence-modules/spring-data-geode/pom.xml | 3 ++- .../spring-data-jpa-enterprise/pom.xml | 5 ++--- 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/persistence-modules/apache-bookkeeper/pom.xml b/persistence-modules/apache-bookkeeper/pom.xml index 32467b9997..3ef1f50d63 100644 --- a/persistence-modules/apache-bookkeeper/pom.xml +++ b/persistence-modules/apache-bookkeeper/pom.xml @@ -31,7 +31,7 @@ org.testcontainers testcontainers - 1.14.3 + ${testcontainers.version} test @@ -39,6 +39,7 @@ 4.10.0 + 1.14.3 diff --git a/persistence-modules/java-jpa-3/pom.xml b/persistence-modules/java-jpa-3/pom.xml index 7c02cc6c8e..f931cd90b8 100644 --- a/persistence-modules/java-jpa-3/pom.xml +++ b/persistence-modules/java-jpa-3/pom.xml @@ -30,17 +30,17 @@ mysql mysql-connector-java - 8.0.21 + ${mysql.version} com.fasterxml.jackson.core jackson-databind - 2.11.3 + ${jackson.version} com.fasterxml.jackson.datatype jackson-datatype-hibernate5 - 2.9.8 + ${jackson.version} @@ -87,6 +87,7 @@ 5.4.14.Final 2.7.4 42.2.5 + 8.0.21 2.2 3.11.1 3.5.1 diff --git a/persistence-modules/jooq/pom.xml b/persistence-modules/jooq/pom.xml index f0c5a27a96..cdda860040 100644 --- a/persistence-modules/jooq/pom.xml +++ b/persistence-modules/jooq/pom.xml @@ -19,28 +19,34 @@ org.jooq jooq - 3.13.4 + ${jooq.version} org.jooq jooq-meta - 3.13.4 + ${jooq.version} org.jooq jooq-codegen - 3.13.4 + ${jooq.version} org.postgresql postgresql - 42.2.16 + ${postgresql.version} com.h2database h2 - 1.4.200 + ${h2.version} + + 3.13.4 + 42.2.16 + 1.4.200 + + diff --git a/persistence-modules/spring-data-geode/pom.xml b/persistence-modules/spring-data-geode/pom.xml index 07aa65463c..ebdb37299e 100644 --- a/persistence-modules/spring-data-geode/pom.xml +++ b/persistence-modules/spring-data-geode/pom.xml @@ -61,7 +61,7 @@ com.mysema.maven maven-apt-plugin - 1.0 + ${maven-apt-plugin.version} generate-sources @@ -88,6 +88,7 @@ com.baeldung.springdatageode.app.ClientCacheApp 1.1.1.RELEASE 2.1.9.RELEASE + 1.0 \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-enterprise/pom.xml b/persistence-modules/spring-data-jpa-enterprise/pom.xml index 7ff2f00fdf..12ffeee7f0 100644 --- a/persistence-modules/spring-data-jpa-enterprise/pom.xml +++ b/persistence-modules/spring-data-jpa-enterprise/pom.xml @@ -78,7 +78,7 @@ maven-compiler-plugin - 3.8.1 + ${maven-compiler-plugin.version} 1.8 1.8 @@ -86,7 +86,7 @@ org.mapstruct mapstruct-processor - 1.3.1.Final + ${mapstruct.version} @@ -98,7 +98,6 @@ 1.3.1.Final 21.0 1.12.2 - From 7b6ba3184734c5962a0eec3d03600f335c73165a Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Thu, 25 Mar 2021 13:12:01 +0100 Subject: [PATCH 14/22] JAVA-3295: Fix pom properties in spring-boot-modules --- .../spring-boot-autoconfiguration/pom.xml | 1 - spring-boot-modules/spring-boot-bootstrap/pom.xml | 10 ++++++---- spring-boot-modules/spring-boot-security/pom.xml | 1 - spring-boot-modules/spring-boot-swagger-jwt/pom.xml | 6 +++++- spring-boot-modules/spring-boot-swagger/pom.xml | 6 +++++- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/spring-boot-modules/spring-boot-autoconfiguration/pom.xml b/spring-boot-modules/spring-boot-autoconfiguration/pom.xml index 269d87bbb9..4990e6884c 100644 --- a/spring-boot-modules/spring-boot-autoconfiguration/pom.xml +++ b/spring-boot-modules/spring-boot-autoconfiguration/pom.xml @@ -48,7 +48,6 @@ org.springframework.boot spring-boot-configuration-processor - 2.1.6.RELEASE true diff --git a/spring-boot-modules/spring-boot-bootstrap/pom.xml b/spring-boot-modules/spring-boot-bootstrap/pom.xml index 6a1be7a2c8..5f1cd8fb65 100644 --- a/spring-boot-modules/spring-boot-bootstrap/pom.xml +++ b/spring-boot-modules/spring-boot-bootstrap/pom.xml @@ -167,7 +167,7 @@ org.springframework.cloud spring-cloud-dependencies - Greenwich.RELEASE + ${spring-cloud.version} pom import @@ -177,12 +177,12 @@ org.springframework.cloud spring-cloud-gcp-starter - 1.0.0.RELEASE + ${spring-cloud-gcp.version} org.springframework.cloud spring-cloud-gcp-starter-sql-mysql - 1.0.0.RELEASE + ${spring-cloud-gcp.version} @@ -215,7 +215,7 @@ org.springframework.cloud spring-cloud-dependencies - Greenwich.RELEASE + ${spring-cloud.version} pom import @@ -332,6 +332,8 @@ 4.0.0 + Greenwich.RELEASE + 1.0.0.RELEASE diff --git a/spring-boot-modules/spring-boot-security/pom.xml b/spring-boot-modules/spring-boot-security/pom.xml index 33b7cbfd74..3f8d2ff73f 100644 --- a/spring-boot-modules/spring-boot-security/pom.xml +++ b/spring-boot-modules/spring-boot-security/pom.xml @@ -71,7 +71,6 @@ org.springframework.boot spring-boot-autoconfigure - diff --git a/spring-boot-modules/spring-boot-swagger-jwt/pom.xml b/spring-boot-modules/spring-boot-swagger-jwt/pom.xml index d71d7342ce..6ee7db2ac9 100644 --- a/spring-boot-modules/spring-boot-swagger-jwt/pom.xml +++ b/spring-boot-modules/spring-boot-swagger-jwt/pom.xml @@ -25,7 +25,7 @@ io.springfox springfox-boot-starter - 3.0.0 + ${springfox.version} @@ -38,4 +38,8 @@ + + 3.0.0 + + diff --git a/spring-boot-modules/spring-boot-swagger/pom.xml b/spring-boot-modules/spring-boot-swagger/pom.xml index 4e0180460d..2d80cae4d5 100644 --- a/spring-boot-modules/spring-boot-swagger/pom.xml +++ b/spring-boot-modules/spring-boot-swagger/pom.xml @@ -25,7 +25,7 @@ io.springfox springfox-boot-starter - 3.0.0 + ${springfox.version} @@ -38,4 +38,8 @@ + + 3.0.0 + + From 6733a4cf15afd03489175998707f44590027e0fb Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Thu, 25 Mar 2021 13:16:01 +0100 Subject: [PATCH 15/22] JAVA-3295: Fix pom properties in spring-web-modules --- spring-web-modules/spring-rest-http-2/pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-web-modules/spring-rest-http-2/pom.xml b/spring-web-modules/spring-rest-http-2/pom.xml index 0ea3fd6840..a349ac1116 100644 --- a/spring-web-modules/spring-rest-http-2/pom.xml +++ b/spring-web-modules/spring-rest-http-2/pom.xml @@ -44,12 +44,13 @@ io.github.resilience4j resilience4j-timelimiter - 1.6.1 + ${resilience4j.version} 2.9.2 + 1.6.1 From bb8bac806a98d0821666995e8adffab52fa81375 Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Fri, 26 Mar 2021 10:57:39 +0100 Subject: [PATCH 16/22] JAVA-4529: Rename some unit tests to integration tests --- ...Test.java => AvroSerealizerDeSerealizerIntegrationTest.java} | 2 +- ...pointsUnitTest.java => ArticleEndpointsIntegrationTest.java} | 2 +- ...kPointUnitTest.java => CustomCheckPointIntegrationTest.java} | 2 +- ...JobSequenceUnitTest.java => JobSequenceIntegrationTest.java} | 2 +- ...BatchLetUnitTest.java => SimpleBatchLetIntegrationTest.java} | 2 +- ...SimpleChunkUnitTest.java => SimpleChunkIntegrationTest.java} | 2 +- ...rChunkUnitTest.java => SimpleErrorChunkIntegrationTest.java} | 2 +- ...tTest.java => SpringBootJdbiApplicationIntegrationTest.java} | 2 +- ...llerUnitTest.java => CustomerControllerIntegrationTest.java} | 2 +- ...rollerUnitTest.java => PersonControllerIntegrationTest.java} | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) rename apache-libraries/src/test/java/com/baeldung/avro/util/serealization/{AvroSerealizerDeSerealizerUnitTest.java => AvroSerealizerDeSerealizerIntegrationTest.java} (97%) rename apache-libraries/src/test/java/com/baeldung/meecrowave/{ArticleEndpointsUnitTest.java => ArticleEndpointsIntegrationTest.java} (95%) rename jee-7/src/test/java/com/baeldung/batch/understanding/{CustomCheckPointUnitTest.java => CustomCheckPointIntegrationTest.java} (96%) rename jee-7/src/test/java/com/baeldung/batch/understanding/{JobSequenceUnitTest.java => JobSequenceIntegrationTest.java} (99%) rename jee-7/src/test/java/com/baeldung/batch/understanding/{SimpleBatchLetUnitTest.java => SimpleBatchLetIntegrationTest.java} (98%) rename jee-7/src/test/java/com/baeldung/batch/understanding/{SimpleChunkUnitTest.java => SimpleChunkIntegrationTest.java} (99%) rename jee-7/src/test/java/com/baeldung/batch/understanding/{SimpleErrorChunkUnitTest.java => SimpleErrorChunkIntegrationTest.java} (97%) rename persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/boot/jdbi/{SpringBootJdbiApplicationUnitTest.java => SpringBootJdbiApplicationIntegrationTest.java} (98%) rename persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/springboothsqldb/application/tests/{CustomerControllerUnitTest.java => CustomerControllerIntegrationTest.java} (97%) rename spring-security-modules/spring-5-security/src/test/java/com/baeldung/xss/{PersonControllerUnitTest.java => PersonControllerIntegrationTest.java} (98%) diff --git a/apache-libraries/src/test/java/com/baeldung/avro/util/serealization/AvroSerealizerDeSerealizerUnitTest.java b/apache-libraries/src/test/java/com/baeldung/avro/util/serealization/AvroSerealizerDeSerealizerIntegrationTest.java similarity index 97% rename from apache-libraries/src/test/java/com/baeldung/avro/util/serealization/AvroSerealizerDeSerealizerUnitTest.java rename to apache-libraries/src/test/java/com/baeldung/avro/util/serealization/AvroSerealizerDeSerealizerIntegrationTest.java index 992ea806c3..3d413e1939 100644 --- a/apache-libraries/src/test/java/com/baeldung/avro/util/serealization/AvroSerealizerDeSerealizerUnitTest.java +++ b/apache-libraries/src/test/java/com/baeldung/avro/util/serealization/AvroSerealizerDeSerealizerIntegrationTest.java @@ -13,7 +13,7 @@ import java.util.Objects; import static org.junit.Assert.*; -public class AvroSerealizerDeSerealizerUnitTest { +public class AvroSerealizerDeSerealizerIntegrationTest { AvroSerealizer serealizer; AvroDeSerealizer deSerealizer; diff --git a/apache-libraries/src/test/java/com/baeldung/meecrowave/ArticleEndpointsUnitTest.java b/apache-libraries/src/test/java/com/baeldung/meecrowave/ArticleEndpointsIntegrationTest.java similarity index 95% rename from apache-libraries/src/test/java/com/baeldung/meecrowave/ArticleEndpointsUnitTest.java rename to apache-libraries/src/test/java/com/baeldung/meecrowave/ArticleEndpointsIntegrationTest.java index f9a06fd7b9..dbd777231c 100644 --- a/apache-libraries/src/test/java/com/baeldung/meecrowave/ArticleEndpointsUnitTest.java +++ b/apache-libraries/src/test/java/com/baeldung/meecrowave/ArticleEndpointsIntegrationTest.java @@ -17,7 +17,7 @@ import okhttp3.Request; import okhttp3.Response; @RunWith(MonoMeecrowave.Runner.class) -public class ArticleEndpointsUnitTest { +public class ArticleEndpointsIntegrationTest { @ConfigurationInject private Meecrowave.Builder config; diff --git a/jee-7/src/test/java/com/baeldung/batch/understanding/CustomCheckPointUnitTest.java b/jee-7/src/test/java/com/baeldung/batch/understanding/CustomCheckPointIntegrationTest.java similarity index 96% rename from jee-7/src/test/java/com/baeldung/batch/understanding/CustomCheckPointUnitTest.java rename to jee-7/src/test/java/com/baeldung/batch/understanding/CustomCheckPointIntegrationTest.java index c607efeb24..8190ae5afb 100644 --- a/jee-7/src/test/java/com/baeldung/batch/understanding/CustomCheckPointUnitTest.java +++ b/jee-7/src/test/java/com/baeldung/batch/understanding/CustomCheckPointIntegrationTest.java @@ -12,7 +12,7 @@ import javax.batch.runtime.StepExecution; import org.junit.jupiter.api.Test; -class CustomCheckPointUnitTest { +class CustomCheckPointIntegrationTest { @Test public void givenChunk_whenCustomCheckPoint_thenCommitCountIsThree() throws Exception { JobOperator jobOperator = BatchRuntime.getJobOperator(); diff --git a/jee-7/src/test/java/com/baeldung/batch/understanding/JobSequenceUnitTest.java b/jee-7/src/test/java/com/baeldung/batch/understanding/JobSequenceIntegrationTest.java similarity index 99% rename from jee-7/src/test/java/com/baeldung/batch/understanding/JobSequenceUnitTest.java rename to jee-7/src/test/java/com/baeldung/batch/understanding/JobSequenceIntegrationTest.java index 4b27e5f5ec..7dda13a752 100644 --- a/jee-7/src/test/java/com/baeldung/batch/understanding/JobSequenceUnitTest.java +++ b/jee-7/src/test/java/com/baeldung/batch/understanding/JobSequenceIntegrationTest.java @@ -16,7 +16,7 @@ import javax.batch.runtime.StepExecution; import org.junit.jupiter.api.Test; -class JobSequenceUnitTest { +class JobSequenceIntegrationTest { @Test public void givenTwoSteps_thenBatch_CompleteWithSuccess() throws Exception { JobOperator jobOperator = BatchRuntime.getJobOperator(); diff --git a/jee-7/src/test/java/com/baeldung/batch/understanding/SimpleBatchLetUnitTest.java b/jee-7/src/test/java/com/baeldung/batch/understanding/SimpleBatchLetIntegrationTest.java similarity index 98% rename from jee-7/src/test/java/com/baeldung/batch/understanding/SimpleBatchLetUnitTest.java rename to jee-7/src/test/java/com/baeldung/batch/understanding/SimpleBatchLetIntegrationTest.java index 788b75eb3e..dc91f747d3 100644 --- a/jee-7/src/test/java/com/baeldung/batch/understanding/SimpleBatchLetUnitTest.java +++ b/jee-7/src/test/java/com/baeldung/batch/understanding/SimpleBatchLetIntegrationTest.java @@ -11,7 +11,7 @@ import javax.batch.runtime.JobExecution; import org.junit.jupiter.api.Test; -class SimpleBatchLetUnitTest { +class SimpleBatchLetIntegrationTest { @Test public void givenBatchLet_thenBatch_CompleteWithSuccess() throws Exception { JobOperator jobOperator = BatchRuntime.getJobOperator(); diff --git a/jee-7/src/test/java/com/baeldung/batch/understanding/SimpleChunkUnitTest.java b/jee-7/src/test/java/com/baeldung/batch/understanding/SimpleChunkIntegrationTest.java similarity index 99% rename from jee-7/src/test/java/com/baeldung/batch/understanding/SimpleChunkUnitTest.java rename to jee-7/src/test/java/com/baeldung/batch/understanding/SimpleChunkIntegrationTest.java index 9010c365a2..a7884dbb32 100644 --- a/jee-7/src/test/java/com/baeldung/batch/understanding/SimpleChunkUnitTest.java +++ b/jee-7/src/test/java/com/baeldung/batch/understanding/SimpleChunkIntegrationTest.java @@ -16,7 +16,7 @@ import javax.batch.runtime.StepExecution; import org.junit.jupiter.api.Test; -class SimpleChunkUnitTest { +class SimpleChunkIntegrationTest { @Test public void givenChunk_thenBatch_CompletesWithSucess() throws Exception { JobOperator jobOperator = BatchRuntime.getJobOperator(); diff --git a/jee-7/src/test/java/com/baeldung/batch/understanding/SimpleErrorChunkUnitTest.java b/jee-7/src/test/java/com/baeldung/batch/understanding/SimpleErrorChunkIntegrationTest.java similarity index 97% rename from jee-7/src/test/java/com/baeldung/batch/understanding/SimpleErrorChunkUnitTest.java rename to jee-7/src/test/java/com/baeldung/batch/understanding/SimpleErrorChunkIntegrationTest.java index bc410aec8d..8c3beeb2f3 100644 --- a/jee-7/src/test/java/com/baeldung/batch/understanding/SimpleErrorChunkUnitTest.java +++ b/jee-7/src/test/java/com/baeldung/batch/understanding/SimpleErrorChunkIntegrationTest.java @@ -13,7 +13,7 @@ import javax.batch.runtime.StepExecution; import org.junit.jupiter.api.Test; -class SimpleErrorChunkUnitTest { +class SimpleErrorChunkIntegrationTest { @Test public void givenChunkError_thenBatch_CompletesWithFailed() throws Exception { diff --git a/persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/boot/jdbi/SpringBootJdbiApplicationUnitTest.java b/persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/boot/jdbi/SpringBootJdbiApplicationIntegrationTest.java similarity index 98% rename from persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/boot/jdbi/SpringBootJdbiApplicationUnitTest.java rename to persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/boot/jdbi/SpringBootJdbiApplicationIntegrationTest.java index 93083f6c4c..ac5661afbc 100644 --- a/persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/boot/jdbi/SpringBootJdbiApplicationUnitTest.java +++ b/persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/boot/jdbi/SpringBootJdbiApplicationIntegrationTest.java @@ -24,7 +24,7 @@ import lombok.extern.slf4j.Slf4j; @RunWith(SpringRunner.class) @SpringBootTest(classes = {SpringBootJdbiApplication.class, JdbiConfiguration.class}) @Slf4j -public class SpringBootJdbiApplicationUnitTest { +public class SpringBootJdbiApplicationIntegrationTest { @Autowired diff --git a/persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/springboothsqldb/application/tests/CustomerControllerUnitTest.java b/persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/springboothsqldb/application/tests/CustomerControllerIntegrationTest.java similarity index 97% rename from persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/springboothsqldb/application/tests/CustomerControllerUnitTest.java rename to persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/springboothsqldb/application/tests/CustomerControllerIntegrationTest.java index be16f8f563..6956df0b13 100644 --- a/persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/springboothsqldb/application/tests/CustomerControllerUnitTest.java +++ b/persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/springboothsqldb/application/tests/CustomerControllerIntegrationTest.java @@ -20,7 +20,7 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers; @RunWith(SpringRunner.class) @SpringBootTest @AutoConfigureMockMvc -public class CustomerControllerUnitTest { +public class CustomerControllerIntegrationTest { private static MediaType MEDIA_TYPE_JSON; diff --git a/spring-security-modules/spring-5-security/src/test/java/com/baeldung/xss/PersonControllerUnitTest.java b/spring-security-modules/spring-5-security/src/test/java/com/baeldung/xss/PersonControllerIntegrationTest.java similarity index 98% rename from spring-security-modules/spring-5-security/src/test/java/com/baeldung/xss/PersonControllerUnitTest.java rename to spring-security-modules/spring-5-security/src/test/java/com/baeldung/xss/PersonControllerIntegrationTest.java index 4e278ebf16..5afa3bc1dd 100644 --- a/spring-security-modules/spring-5-security/src/test/java/com/baeldung/xss/PersonControllerUnitTest.java +++ b/spring-security-modules/spring-5-security/src/test/java/com/baeldung/xss/PersonControllerIntegrationTest.java @@ -14,7 +14,7 @@ import java.io.IOException; import static org.assertj.core.api.Assertions.assertThat; @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -class PersonControllerUnitTest { +class PersonControllerIntegrationTest { @LocalServerPort int randomServerPort; From a382f77a64e7423de02187dc8fb8d4516f844610 Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Fri, 26 Mar 2021 12:55:14 +0100 Subject: [PATCH 17/22] JAVA-3295: Remove redundant java.version property --- aws-reactive/pom.xml | 1 - patterns/clean-architecture/pom.xml | 4 ---- patterns/hexagonal-architecture/pom.xml | 4 ---- persistence-modules/spring-data-cosmosdb/pom.xml | 2 -- reactive-systems/inventory-service/pom.xml | 4 ---- reactive-systems/order-service/pom.xml | 4 ---- reactive-systems/shipping-service/pom.xml | 4 ---- .../spring-boot-with-custom-parent/pom.xml | 4 ---- .../spring-boot-with-starter-parent/pom.xml | 1 - spring-boot-modules/spring-boot-properties-3/pom.xml | 3 --- spring-boot-modules/spring-boot-properties/pom.xml | 1 - spring-boot-modules/spring-boot-springdoc/pom.xml | 1 - spring-cloud/spring-cloud-bootstrap/order-service/pom.xml | 1 - .../spring-cloud-stream/spring-cloud-stream-kafka/pom.xml | 1 - spring-cloud/spring-cloud-zuul-fallback/pom.xml | 1 - spring-web-modules/spring-mvc-views/pom.xml | 1 - webrtc/pom.xml | 4 ---- wildfly/pom.xml | 4 ---- xml/pom.xml | 5 ++--- 19 files changed, 2 insertions(+), 48 deletions(-) diff --git a/aws-reactive/pom.xml b/aws-reactive/pom.xml index d4f0e5e231..6224ccbb99 100644 --- a/aws-reactive/pom.xml +++ b/aws-reactive/pom.xml @@ -100,7 +100,6 @@ - 1.8 2.2.1.RELEASE 2.10.27 diff --git a/patterns/clean-architecture/pom.xml b/patterns/clean-architecture/pom.xml index 6e7de78751..b9968095f8 100644 --- a/patterns/clean-architecture/pom.xml +++ b/patterns/clean-architecture/pom.xml @@ -15,10 +15,6 @@ ../../parent-boot-2 - - 1.8 - - com.h2database diff --git a/patterns/hexagonal-architecture/pom.xml b/patterns/hexagonal-architecture/pom.xml index 62f55c2efa..db7ee69e2e 100644 --- a/patterns/hexagonal-architecture/pom.xml +++ b/patterns/hexagonal-architecture/pom.xml @@ -15,10 +15,6 @@ ../../parent-boot-2 - - 1.8 - - org.springframework.boot diff --git a/persistence-modules/spring-data-cosmosdb/pom.xml b/persistence-modules/spring-data-cosmosdb/pom.xml index 19a66648b2..f3c913195f 100644 --- a/persistence-modules/spring-data-cosmosdb/pom.xml +++ b/persistence-modules/spring-data-cosmosdb/pom.xml @@ -14,9 +14,7 @@ - 1.8 2.3.0 - diff --git a/reactive-systems/inventory-service/pom.xml b/reactive-systems/inventory-service/pom.xml index 4c04afb5cb..b5ec210636 100644 --- a/reactive-systems/inventory-service/pom.xml +++ b/reactive-systems/inventory-service/pom.xml @@ -15,10 +15,6 @@ ../../parent-boot-2 - - 1.8 - - org.springframework.boot diff --git a/reactive-systems/order-service/pom.xml b/reactive-systems/order-service/pom.xml index c793f448b5..603f0373ba 100644 --- a/reactive-systems/order-service/pom.xml +++ b/reactive-systems/order-service/pom.xml @@ -15,10 +15,6 @@ ../../parent-boot-2 - - 1.8 - - org.springframework.boot diff --git a/reactive-systems/shipping-service/pom.xml b/reactive-systems/shipping-service/pom.xml index 72487e691e..458b91b6ce 100644 --- a/reactive-systems/shipping-service/pom.xml +++ b/reactive-systems/shipping-service/pom.xml @@ -15,10 +15,6 @@ ../../parent-boot-2 - - 1.8 - - org.springframework.boot diff --git a/spring-boot-modules/spring-boot-parent/spring-boot-with-custom-parent/pom.xml b/spring-boot-modules/spring-boot-parent/spring-boot-with-custom-parent/pom.xml index 5f5d3a9f6a..63d6078eca 100644 --- a/spring-boot-modules/spring-boot-parent/spring-boot-with-custom-parent/pom.xml +++ b/spring-boot-modules/spring-boot-parent/spring-boot-with-custom-parent/pom.xml @@ -23,8 +23,4 @@ - - 1.8 - - diff --git a/spring-boot-modules/spring-boot-parent/spring-boot-with-starter-parent/pom.xml b/spring-boot-modules/spring-boot-parent/spring-boot-with-starter-parent/pom.xml index 108e66b68e..4274f63aa3 100644 --- a/spring-boot-modules/spring-boot-parent/spring-boot-with-starter-parent/pom.xml +++ b/spring-boot-modules/spring-boot-parent/spring-boot-with-starter-parent/pom.xml @@ -39,7 +39,6 @@ - 1.8 2.2.5.RELEASE diff --git a/spring-boot-modules/spring-boot-properties-3/pom.xml b/spring-boot-modules/spring-boot-properties-3/pom.xml index 809fd6e2d4..33799b557d 100644 --- a/spring-boot-modules/spring-boot-properties-3/pom.xml +++ b/spring-boot-modules/spring-boot-properties-3/pom.xml @@ -14,9 +14,6 @@ spring-boot-properties-3 Spring Boot Properties Module - - 1.8 - org.springframework.boot diff --git a/spring-boot-modules/spring-boot-properties/pom.xml b/spring-boot-modules/spring-boot-properties/pom.xml index 40668f47fd..0a7d8a8cbf 100644 --- a/spring-boot-modules/spring-boot-properties/pom.xml +++ b/spring-boot-modules/spring-boot-properties/pom.xml @@ -134,7 +134,6 @@ - 1.8 2020.0.0-M5 1.10 20.0 diff --git a/spring-boot-modules/spring-boot-springdoc/pom.xml b/spring-boot-modules/spring-boot-springdoc/pom.xml index 259383a1d2..8442504fed 100644 --- a/spring-boot-modules/spring-boot-springdoc/pom.xml +++ b/spring-boot-modules/spring-boot-springdoc/pom.xml @@ -169,7 +169,6 @@ - 1.8 5.2.10.Final 1.5.2 1.5.6 diff --git a/spring-cloud/spring-cloud-bootstrap/order-service/pom.xml b/spring-cloud/spring-cloud-bootstrap/order-service/pom.xml index a32bd5a2d3..2ebc673ef4 100644 --- a/spring-cloud/spring-cloud-bootstrap/order-service/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/order-service/pom.xml @@ -112,7 +112,6 @@ - 1.8 2.6 0.0.2 1.8 diff --git a/spring-cloud/spring-cloud-stream/spring-cloud-stream-kafka/pom.xml b/spring-cloud/spring-cloud-stream/spring-cloud-stream-kafka/pom.xml index 52230dd1c1..32a31c3042 100644 --- a/spring-cloud/spring-cloud-stream/spring-cloud-stream-kafka/pom.xml +++ b/spring-cloud/spring-cloud-stream/spring-cloud-stream-kafka/pom.xml @@ -101,7 +101,6 @@ - 1.8 Greenwich.SR1 4.0.0 1.8.2 diff --git a/spring-cloud/spring-cloud-zuul-fallback/pom.xml b/spring-cloud/spring-cloud-zuul-fallback/pom.xml index cb762eb099..42925a6ab9 100644 --- a/spring-cloud/spring-cloud-zuul-fallback/pom.xml +++ b/spring-cloud/spring-cloud-zuul-fallback/pom.xml @@ -21,7 +21,6 @@ - 1.8 Finchley.SR2 3.1.1 diff --git a/spring-web-modules/spring-mvc-views/pom.xml b/spring-web-modules/spring-mvc-views/pom.xml index 2e80a60966..649814263c 100644 --- a/spring-web-modules/spring-mvc-views/pom.xml +++ b/spring-web-modules/spring-mvc-views/pom.xml @@ -111,7 +111,6 @@ - 1.8 2.3.3 4.0.1 5.2.1.RELEASE diff --git a/webrtc/pom.xml b/webrtc/pom.xml index f302ae97a2..191ff11dd6 100644 --- a/webrtc/pom.xml +++ b/webrtc/pom.xml @@ -31,8 +31,4 @@ - - 1.8 - - diff --git a/wildfly/pom.xml b/wildfly/pom.xml index 7b2a474c8d..6d823bb4c9 100644 --- a/wildfly/pom.xml +++ b/wildfly/pom.xml @@ -76,8 +76,4 @@ - - 1.8 - - diff --git a/xml/pom.xml b/xml/pom.xml index 837f918b46..cd337eb76e 100644 --- a/xml/pom.xml +++ b/xml/pom.xml @@ -322,8 +322,8 @@ org.apache.maven.plugins maven-compiler-plugin - ${java-version} - ${java-version} + ${java.version} + ${java.version} @@ -379,7 +379,6 @@ 0.9.6 2.4 - 1.8 1.3.1 From baa675660725552ee3152bdd0e20631906397e51 Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Fri, 26 Mar 2021 13:41:41 +0100 Subject: [PATCH 18/22] JAVA-4167: Remove spring.main.allow-bean-definition-overriding flag --- .../src/main/resources/application.properties | 3 --- 1 file changed, 3 deletions(-) diff --git a/spring-web-modules/spring-mvc-basics/src/main/resources/application.properties b/spring-web-modules/spring-mvc-basics/src/main/resources/application.properties index cf26fbfb60..b8a9be0b40 100644 --- a/spring-web-modules/spring-mvc-basics/src/main/resources/application.properties +++ b/spring-web-modules/spring-mvc-basics/src/main/resources/application.properties @@ -5,6 +5,3 @@ spring.mvc.pathmatch.use-suffix-pattern=true #spring.mvc.contentnegotiation.favor-path-extension=true #spring.mvc.contentnegotiation.favor-parameter=true #spring.mvc.contentnegotiation.parameter-name=mediaType - -# https://github.com/spring-projects/spring-boot/issues/24207 -spring.main.allow-bean-definition-overriding=true From 0b16b1440babfff2a69506e67e4adde288e27053 Mon Sep 17 00:00:00 2001 From: Amitabh Tiwari Date: Fri, 26 Mar 2021 21:03:08 +0530 Subject: [PATCH 19/22] Fixed review comments --- .../introduction/CountQueryIntegrationTest.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/persistence-modules/spring-jooq/src/test/java/com/baeldung/jooq/introduction/CountQueryIntegrationTest.java b/persistence-modules/spring-jooq/src/test/java/com/baeldung/jooq/introduction/CountQueryIntegrationTest.java index 4a21459d19..7edcc2cd4b 100644 --- a/persistence-modules/spring-jooq/src/test/java/com/baeldung/jooq/introduction/CountQueryIntegrationTest.java +++ b/persistence-modules/spring-jooq/src/test/java/com/baeldung/jooq/introduction/CountQueryIntegrationTest.java @@ -35,30 +35,28 @@ public class CountQueryIntegrationTest { @Test public void givenValidData_whenSelectCount_thenSucceed() { int count = dsl.selectCount().from(AUTHOR) - .where(AUTHOR.FIRST_NAME.equalIgnoreCase("Bryan")) - .fetchOne(0, int.class); + .where(AUTHOR.FIRST_NAME.equalIgnoreCase("Bryan")) + .fetchOne(0, int.class); Assert.assertEquals(1, count); } @Test public void givenValidData_whenCount_thenSucceed() { int count = dsl.select(DSL.count()) - .from(AUTHOR).fetchOne(0, int.class); + .from(AUTHOR).fetchOne(0, int.class); Assert.assertEquals(3, count); } @Test public void givenValidData_whenFetchCount_thenSucceed() { - int count = dsl.fetchCount( - DSL.selectFrom(AUTHOR) - .where(AUTHOR.FIRST_NAME.equalIgnoreCase("Bryan"))); + int count = dsl.fetchCount(DSL.selectFrom(AUTHOR) + .where(AUTHOR.FIRST_NAME.equalIgnoreCase("Bryan"))); Assert.assertEquals(1, count); } @Test public void givenValidData_whenFetchCountWithoutCondition_thenSucceed() { - int count = dsl.fetchCount( - DSL.selectFrom(AUTHOR)); + int count = dsl.fetchCount(DSL.selectFrom(AUTHOR)); Assert.assertEquals(3, count); } @@ -90,7 +88,7 @@ public class CountQueryIntegrationTest { @Test public void givenValidData_whenCountwithGroupBy_thenSucceed() { final Result> result = dsl.select(AUTHOR.FIRST_NAME, DSL.count()) - .from(AUTHOR).groupBy(AUTHOR.FIRST_NAME).fetch(); + .from(AUTHOR).groupBy(AUTHOR.FIRST_NAME).fetch(); Assert.assertEquals(3, result.size()); Assert.assertEquals(result.get(0).get(0), "Bert"); Assert.assertEquals(result.get(0).get(1), 1); From b7cbb5428d079cf344c2d3cfb7d8b8a4f25df0f5 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Sun, 28 Mar 2021 15:26:28 +0200 Subject: [PATCH 20/22] BAEL-4904: Keep the strong reference to the MessengerService (#10602) Co-authored-by: Krzysztof Woyke --- .../baeldung/rmi/JavaRMIIntegrationTest.java | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/java-rmi/src/test/java/com/baeldung/rmi/JavaRMIIntegrationTest.java b/java-rmi/src/test/java/com/baeldung/rmi/JavaRMIIntegrationTest.java index 5e4ecb3e76..604899de03 100644 --- a/java-rmi/src/test/java/com/baeldung/rmi/JavaRMIIntegrationTest.java +++ b/java-rmi/src/test/java/com/baeldung/rmi/JavaRMIIntegrationTest.java @@ -1,42 +1,42 @@ package com.baeldung.rmi; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; +import org.junit.Before; +import org.junit.Test; import java.rmi.NotBoundException; import java.rmi.RemoteException; import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; -import org.junit.BeforeClass; -import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; public class JavaRMIIntegrationTest { - - @BeforeClass - public static void whenRunServer_thenServerStarts() { - - try { - MessengerServiceImpl server = new MessengerServiceImpl(); - server.createStubAndBind(); - } catch (RemoteException e) { - fail("Exception Occurred: " + e); - } - } - - @Test - public void whenClientSendsMessageToServer_thenServerSendsResponseMessage() { - - try { - Registry registry = LocateRegistry.getRegistry(); - MessengerService server = (MessengerService) registry.lookup("MessengerService"); - String responseMessage = server.sendMessage("Client Message"); - - String expectedMessage = "Server Message"; - assertEquals(responseMessage, expectedMessage); - } catch (RemoteException | NotBoundException e) { - fail("Exception Occurred: " + e); - }; - } - + + private MessengerServiceImpl messengerService; + + @Before + public void init() { + try { + messengerService = new MessengerServiceImpl(); + messengerService.createStubAndBind(); + } catch (RemoteException e) { + fail("Exception Occurred: " + e); + } + } + + @Test + public void whenClientSendsMessageToServer_thenServerSendsResponseMessage() { + try { + Registry registry = LocateRegistry.getRegistry(); + MessengerService server = (MessengerService) registry.lookup("MessengerService"); + String responseMessage = server.sendMessage("Client Message"); + + String expectedMessage = "Server Message"; + assertEquals(responseMessage, expectedMessage); + } catch (RemoteException | NotBoundException e) { + fail("Exception Occurred: " + e); + } + } + } \ No newline at end of file From 945753e5dc6f8d66cbc3114627c1d51dd4277aa1 Mon Sep 17 00:00:00 2001 From: freelansam <79205526+freelansam@users.noreply.github.com> Date: Sun, 28 Mar 2021 23:00:44 +0530 Subject: [PATCH 21/22] BAEL-4642: Open API Server Implementation using OpenAPI Generator (#10598) * BAEL-4642: Open API Server Implementation using OpenAPI Generator * BAEL-4642: Open API Server Implementation using OpenAPI Generator * BAEL-4642 --- .../spring-boot-libraries-2/pom.xml | 60 ++++++++++ .../{jobrunr => }/JobRunrSpringBootApp.java | 2 +- .../src/main/resources/petstore.yml | 111 ++++++++++++++++++ .../com/baeldung/jobrunr/JobRunrLiveTest.java | 2 + .../openapi/OpenApiPetsIntegrationTest.java | 33 ++++++ 5 files changed, 207 insertions(+), 1 deletion(-) rename spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/{jobrunr => }/JobRunrSpringBootApp.java (97%) create mode 100644 spring-boot-modules/spring-boot-libraries-2/src/main/resources/petstore.yml create mode 100644 spring-boot-modules/spring-boot-libraries-2/src/test/java/com/baeldung/openapi/OpenApiPetsIntegrationTest.java diff --git a/spring-boot-modules/spring-boot-libraries-2/pom.xml b/spring-boot-modules/spring-boot-libraries-2/pom.xml index 35dec54450..629b713cb5 100644 --- a/spring-boot-modules/spring-boot-libraries-2/pom.xml +++ b/spring-boot-modules/spring-boot-libraries-2/pom.xml @@ -16,6 +16,14 @@ org.springframework.boot spring-boot-starter-web + + ch.qos.logback + logback-classic + + + org.springframework.data + spring-data-jpa + @@ -23,6 +31,23 @@ jobrunr-spring-boot-starter ${jobrunr.version} + + + + org.openapitools + openapi-generator + ${openapi-generator.version} + + + org.openapitools + jackson-databind-nullable + ${jackson-databind.version} + + + io.springfox + springfox-swagger2 + ${springfox.version} + org.springframework.boot @@ -37,10 +62,45 @@ test + + + + + org.openapitools + openapi-generator-maven-plugin + ${openapi-generator.version} + + + + generate + + + + ${project.basedir}/src/main/resources/petstore.yml + + spring + com.baeldung.openapi.api + com.baeldung.openapi.model + + ApiUtil.java + + + true + + + + + + + 1.1.0 4.0.3 + 5.1.0 + 2.4.5 + 0.2.1 + 2.9.2 diff --git a/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/jobrunr/JobRunrSpringBootApp.java b/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/JobRunrSpringBootApp.java similarity index 97% rename from spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/jobrunr/JobRunrSpringBootApp.java rename to spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/JobRunrSpringBootApp.java index d72e9464d9..77297feb92 100644 --- a/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/jobrunr/JobRunrSpringBootApp.java +++ b/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/JobRunrSpringBootApp.java @@ -1,4 +1,4 @@ -package com.baeldung.jobrunr; +package com.baeldung; import com.baeldung.jobrunr.service.SampleJobService; import org.jobrunr.jobs.mappers.JobMapper; diff --git a/spring-boot-modules/spring-boot-libraries-2/src/main/resources/petstore.yml b/spring-boot-modules/spring-boot-libraries-2/src/main/resources/petstore.yml new file mode 100644 index 0000000000..3265a18c3e --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries-2/src/main/resources/petstore.yml @@ -0,0 +1,111 @@ +openapi: "3.0.0" +info: + version: 1.0.0 + title: Swagger Petstore + license: + name: MIT +servers: + - url: http://localhost:8080/ +paths: + /pets: + get: + summary: List all pets + operationId: listPets + tags: + - pets + parameters: + - name: limit + in: query + description: How many items to return at one time (max 100) + required: false + schema: + type: integer + format: int32 + responses: + '200': + description: A paged array of pets + headers: + x-next: + description: A link to the next page of responses + schema: + type: string + content: + application/json: + schema: + $ref: "#/components/schemas/Pets" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + post: + summary: Create a pet + operationId: createPets + tags: + - pets + responses: + '201': + description: Null response + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + /pets/{petId}: + get: + summary: Info for a specific pet + operationId: showPetById + tags: + - pets + parameters: + - name: petId + in: path + required: true + description: The id of the pet to retrieve + schema: + type: string + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" +components: + schemas: + Pet: + type: object + required: + - id + - name + properties: + id: + type: integer + format: int64 + name: + type: string + tag: + type: string + Pets: + type: array + items: + $ref: "#/components/schemas/Pet" + Error: + type: object + required: + - code + - message + properties: + code: + type: integer + format: int32 + message: + type: string \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-libraries-2/src/test/java/com/baeldung/jobrunr/JobRunrLiveTest.java b/spring-boot-modules/spring-boot-libraries-2/src/test/java/com/baeldung/jobrunr/JobRunrLiveTest.java index 83222e7726..2c259b6879 100644 --- a/spring-boot-modules/spring-boot-libraries-2/src/test/java/com/baeldung/jobrunr/JobRunrLiveTest.java +++ b/spring-boot-modules/spring-boot-libraries-2/src/test/java/com/baeldung/jobrunr/JobRunrLiveTest.java @@ -10,6 +10,8 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.test.context.junit4.SpringRunner; +import com.baeldung.JobRunrSpringBootApp; + import java.net.URI; import java.util.concurrent.TimeUnit; diff --git a/spring-boot-modules/spring-boot-libraries-2/src/test/java/com/baeldung/openapi/OpenApiPetsIntegrationTest.java b/spring-boot-modules/spring-boot-libraries-2/src/test/java/com/baeldung/openapi/OpenApiPetsIntegrationTest.java new file mode 100644 index 0000000000..b14f0e11b5 --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries-2/src/test/java/com/baeldung/openapi/OpenApiPetsIntegrationTest.java @@ -0,0 +1,33 @@ +package com.baeldung.openapi; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; + +@RunWith(SpringRunner.class) +@SpringBootTest +@AutoConfigureMockMvc +public class OpenApiPetsIntegrationTest { + + private static final String PETS_PATH = "/pets/"; + + @Autowired + private MockMvc mockMvc; + + @Test + public void whenReadAll_thenStatusIsNotImplemented() throws Exception { + this.mockMvc.perform(get(PETS_PATH)).andExpect(status().isNotImplemented()); + } + + @Test + public void whenReadOne_thenStatusIsNotImplemented() throws Exception { + this.mockMvc.perform(get(PETS_PATH + 1)).andExpect(status().isNotImplemented()); + } +} \ No newline at end of file From e222f19a3c4e3647b60a329b735572e402905a42 Mon Sep 17 00:00:00 2001 From: Amy DeGregorio Date: Sun, 28 Mar 2021 16:14:17 -0400 Subject: [PATCH 22/22] BAEL-4825 (#10601) * BAEL-4825 * BAEL-4825 added integration tests --- .../spring-boot-actuator/pom.xml | 10 ++++++ .../enabling/EndpointEnablingApplication.java | 15 ++++++++ .../enabling/SecurityConfiguration.java | 36 +++++++++++++++++++ .../src/main/resources/application.properties | 3 ++ .../EndpointEnablingIntegrationTest.java | 36 +++++++++++++++++++ 5 files changed, 100 insertions(+) create mode 100644 spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/endpoints/enabling/EndpointEnablingApplication.java create mode 100644 spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/endpoints/enabling/SecurityConfiguration.java create mode 100644 spring-boot-modules/spring-boot-actuator/src/test/java/com/baeldung/endpoints/enabling/EndpointEnablingIntegrationTest.java diff --git a/spring-boot-modules/spring-boot-actuator/pom.xml b/spring-boot-modules/spring-boot-actuator/pom.xml index a808b8cb1b..3cb324a0b8 100644 --- a/spring-boot-modules/spring-boot-actuator/pom.xml +++ b/spring-boot-modules/spring-boot-actuator/pom.xml @@ -28,6 +28,10 @@ org.springframework.boot spring-boot-starter-data-jpa + + org.springframework.boot + spring-boot-starter-security + com.h2database h2 @@ -44,6 +48,11 @@ + + org.springframework.security + spring-security-test + test + @@ -53,6 +62,7 @@ spring-boot-maven-plugin com.baeldung.probes.ProbesApplication + com.baeldung.endpoints.enabling.EndpointEnablingApplication diff --git a/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/endpoints/enabling/EndpointEnablingApplication.java b/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/endpoints/enabling/EndpointEnablingApplication.java new file mode 100644 index 0000000000..2e8024dcd5 --- /dev/null +++ b/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/endpoints/enabling/EndpointEnablingApplication.java @@ -0,0 +1,15 @@ +package com.baeldung.endpoints.enabling; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; + +@SpringBootApplication(exclude = { SecurityAutoConfiguration.class, ManagementWebSecurityAutoConfiguration.class }, scanBasePackages = "com.baeldung.endpoints.enabling") +public class EndpointEnablingApplication { + + public static void main(String[] args) { + SpringApplication.run(EndpointEnablingApplication.class, args); + } + +} diff --git a/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/endpoints/enabling/SecurityConfiguration.java b/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/endpoints/enabling/SecurityConfiguration.java new file mode 100644 index 0000000000..24b78642f2 --- /dev/null +++ b/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/endpoints/enabling/SecurityConfiguration.java @@ -0,0 +1,36 @@ +package com.baeldung.endpoints.enabling; + +import org.springframework.boot.actuate.autoconfigure.security.servlet.EndpointRequest; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.crypto.factory.PasswordEncoderFactories; +import org.springframework.security.crypto.password.PasswordEncoder; + +@Configuration +@EnableWebSecurity +public class SecurityConfiguration extends WebSecurityConfigurerAdapter { + + @Override + protected void configure(AuthenticationManagerBuilder auth) throws Exception { + PasswordEncoder encoder = PasswordEncoderFactories.createDelegatingPasswordEncoder(); + auth.inMemoryAuthentication() + .withUser("user") + .password(encoder.encode("password")) + .roles("USER") + .and() + .withUser("admin") + .password(encoder.encode("admin")) + .roles("USER", "ADMIN"); + } + + @Override + protected void configure(HttpSecurity http) throws Exception { + http.requestMatcher(EndpointRequest.toAnyEndpoint()) + .authorizeRequests((requests) -> requests.anyRequest() + .hasRole("ADMIN")); + http.httpBasic(); + } +} diff --git a/spring-boot-modules/spring-boot-actuator/src/main/resources/application.properties b/spring-boot-modules/spring-boot-actuator/src/main/resources/application.properties index de7be417a8..e69c763eeb 100644 --- a/spring-boot-modules/spring-boot-actuator/src/main/resources/application.properties +++ b/spring-boot-modules/spring-boot-actuator/src/main/resources/application.properties @@ -11,3 +11,6 @@ info.app.name=Spring Sample Application info.app.description=This is my first spring boot application G1 info.app.version=1.0.0 info.java-vendor = ${java.specification.vendor} + +management.endpoints.web.exposure.include=* +management.endpoint.shutdown.enabled=true diff --git a/spring-boot-modules/spring-boot-actuator/src/test/java/com/baeldung/endpoints/enabling/EndpointEnablingIntegrationTest.java b/spring-boot-modules/spring-boot-actuator/src/test/java/com/baeldung/endpoints/enabling/EndpointEnablingIntegrationTest.java new file mode 100644 index 0000000000..8a9dd4ca72 --- /dev/null +++ b/spring-boot-modules/spring-boot-actuator/src/test/java/com/baeldung/endpoints/enabling/EndpointEnablingIntegrationTest.java @@ -0,0 +1,36 @@ +package com.baeldung.endpoints.enabling; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.web.servlet.MockMvc; + +@SpringBootTest +@AutoConfigureMockMvc +public class EndpointEnablingIntegrationTest { + @Autowired + private MockMvc mockMvc; + + @Test + @WithMockUser(username = "user", password = "password", roles = "USER") + public void givenWrongAuthentication_whenCallingActuator_thenReturns401() throws Exception { + mockMvc.perform(get("/actuator")) + .andExpect(status().isForbidden()); + } + + @Test + @WithMockUser(username = "admin", password = "admin", roles = "ADMIN") + public void givenProperAuthentication_whenCallingActuator_thenReturnsExpectedEndpoints() throws Exception { + mockMvc.perform(get("/actuator")) + .andExpect(jsonPath("$._links").exists()) + .andExpect(jsonPath("$._links.beans").exists()) + .andExpect(jsonPath("$._links.env").exists()) + .andExpect(jsonPath("$._links.shutdown").exists()); + } +}