From 3a4cddb740638446496efc906e2d71d2b0d74c4a Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Sat, 19 Aug 2017 20:41:55 +0100 Subject: [PATCH 01/50] Different types of bean injection in Spring --- pom.xml | 1 + spring-types-bean-injection/README.md | 3 + spring-types-bean-injection/pom.xml | 81 +++++++++++++++++++ .../java/com/baeldung/config/AppConfig.java | 25 ++++++ .../com/baeldung/service/MegaTestService.java | 22 +++++ .../baeldung/service/SuperTestService.java | 22 +++++ .../com/baeldung/service/TestService.java | 14 ++++ .../MegaTestServiceIntegrationTest.java | 32 ++++++++ .../SuperTestServiceIntegrationTest.java | 32 ++++++++ .../service/TestServiceIntegrationTest.java | 32 ++++++++ 10 files changed, 264 insertions(+) create mode 100644 spring-types-bean-injection/README.md create mode 100644 spring-types-bean-injection/pom.xml create mode 100644 spring-types-bean-injection/src/main/java/com/baeldung/config/AppConfig.java create mode 100644 spring-types-bean-injection/src/main/java/com/baeldung/service/MegaTestService.java create mode 100644 spring-types-bean-injection/src/main/java/com/baeldung/service/SuperTestService.java create mode 100644 spring-types-bean-injection/src/main/java/com/baeldung/service/TestService.java create mode 100644 spring-types-bean-injection/src/test/java/com/baeldung/service/MegaTestServiceIntegrationTest.java create mode 100644 spring-types-bean-injection/src/test/java/com/baeldung/service/SuperTestServiceIntegrationTest.java create mode 100644 spring-types-bean-injection/src/test/java/com/baeldung/service/TestServiceIntegrationTest.java diff --git a/pom.xml b/pom.xml index b76c9b8ddd..eef32f884e 100644 --- a/pom.xml +++ b/pom.xml @@ -170,6 +170,7 @@ spring-social-login spring-spel spring-thymeleaf + spring-types-bean-injection spring-userservice spring-zuul spring-reactor diff --git a/spring-types-bean-injection/README.md b/spring-types-bean-injection/README.md new file mode 100644 index 0000000000..45f8216849 --- /dev/null +++ b/spring-types-bean-injection/README.md @@ -0,0 +1,3 @@ +## Relevant articles: + +- [Constructor Dependency Injection in Spring](http://www.baeldung.com/constructor-injection-in-spring) \ No newline at end of file diff --git a/spring-types-bean-injection/pom.xml b/spring-types-bean-injection/pom.xml new file mode 100644 index 0000000000..75fee65d80 --- /dev/null +++ b/spring-types-bean-injection/pom.xml @@ -0,0 +1,81 @@ + + + 4.0.0 + + com.baeldung + spring-types-bean-injection + 0.0.1-SNAPSHOT + jar + + spring-types-bean-injection + Types of bean injection in spring + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + + org.springframework + spring-context + ${spring.version} + + + org.springframework + spring-test + ${spring.version} + test + + + junit + junit + ${junit.version} + test + + + + + + integration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + **/*LiveTest.java + + + **/*IntegrationTest.java + + + + + + + json + + + + + + + + + + 1.8 + 4.3.10.RELEASE + 4.12 + + + diff --git a/spring-types-bean-injection/src/main/java/com/baeldung/config/AppConfig.java b/spring-types-bean-injection/src/main/java/com/baeldung/config/AppConfig.java new file mode 100644 index 0000000000..45be32fa06 --- /dev/null +++ b/spring-types-bean-injection/src/main/java/com/baeldung/config/AppConfig.java @@ -0,0 +1,25 @@ +package com.baeldung.config; + +import com.baeldung.service.MegaTestService; +import com.baeldung.service.SuperTestService; +import com.baeldung.service.TestService; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class AppConfig { + @Bean + public TestService TestService() { + return new TestService(); + } + + @Bean + public SuperTestService SuperTestService() { + return new SuperTestService(new TestService()); + } + + @Bean + public MegaTestService MegaTestService() { + return new MegaTestService(); + } +} diff --git a/spring-types-bean-injection/src/main/java/com/baeldung/service/MegaTestService.java b/spring-types-bean-injection/src/main/java/com/baeldung/service/MegaTestService.java new file mode 100644 index 0000000000..45deeb8592 --- /dev/null +++ b/spring-types-bean-injection/src/main/java/com/baeldung/service/MegaTestService.java @@ -0,0 +1,22 @@ +package com.baeldung.service; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class MegaTestService { + private TestService testService; + + @Autowired + public void setTestService(TestService testService) { + this.testService = testService; + } + + public String getMegaTestOne() { + return "Mega" + testService.getTestOne(); + } + + public String getMegaTestTwo() { + return "Mega" + testService.getTestTwo(); + } +} diff --git a/spring-types-bean-injection/src/main/java/com/baeldung/service/SuperTestService.java b/spring-types-bean-injection/src/main/java/com/baeldung/service/SuperTestService.java new file mode 100644 index 0000000000..edf1f2b1c5 --- /dev/null +++ b/spring-types-bean-injection/src/main/java/com/baeldung/service/SuperTestService.java @@ -0,0 +1,22 @@ +package com.baeldung.service; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class SuperTestService { + private TestService testService; + + @Autowired + public SuperTestService(TestService testService) { + this.testService = testService; + } + + public String getSuperTestOne() { + return "Super" + testService.getTestOne(); + } + + public String getSuperTestTwo() { + return "Super" + testService.getTestTwo(); + } +} diff --git a/spring-types-bean-injection/src/main/java/com/baeldung/service/TestService.java b/spring-types-bean-injection/src/main/java/com/baeldung/service/TestService.java new file mode 100644 index 0000000000..3e7c327dbd --- /dev/null +++ b/spring-types-bean-injection/src/main/java/com/baeldung/service/TestService.java @@ -0,0 +1,14 @@ +package com.baeldung.service; + +import org.springframework.stereotype.Service; + +@Service +public class TestService { + public String getTestOne() { + return "TestOne"; + } + + public String getTestTwo() { + return "TestTwo"; + } +} diff --git a/spring-types-bean-injection/src/test/java/com/baeldung/service/MegaTestServiceIntegrationTest.java b/spring-types-bean-injection/src/test/java/com/baeldung/service/MegaTestServiceIntegrationTest.java new file mode 100644 index 0000000000..ced897c70c --- /dev/null +++ b/spring-types-bean-injection/src/test/java/com/baeldung/service/MegaTestServiceIntegrationTest.java @@ -0,0 +1,32 @@ +package com.baeldung.service; + +import com.baeldung.config.AppConfig; +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.SpringRunner; + +import static org.hamcrest.CoreMatchers.is; + +@RunWith(SpringRunner.class) +@ContextConfiguration(classes = {AppConfig.class}) +public class MegaTestServiceIntegrationTest { + @Autowired + MegaTestService megaTestService; + + @Test + public void whenCallingGetMegaTestOne_thenWeGetMegaTestOneString() { + String resultOne = megaTestService.getMegaTestOne(); + + Assert.assertThat(resultOne, is("MegaTestOne")); + } + + @Test + public void whenCallingGetMegaTestTwo_thenWeGetMegaTestTwoString() { + String resultTwo = megaTestService.getMegaTestTwo(); + + Assert.assertThat(resultTwo, is("MegaTestTwo")); + } +} diff --git a/spring-types-bean-injection/src/test/java/com/baeldung/service/SuperTestServiceIntegrationTest.java b/spring-types-bean-injection/src/test/java/com/baeldung/service/SuperTestServiceIntegrationTest.java new file mode 100644 index 0000000000..a037d70c40 --- /dev/null +++ b/spring-types-bean-injection/src/test/java/com/baeldung/service/SuperTestServiceIntegrationTest.java @@ -0,0 +1,32 @@ +package com.baeldung.service; + +import com.baeldung.config.AppConfig; +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.SpringRunner; + +import static org.hamcrest.CoreMatchers.is; + +@RunWith(SpringRunner.class) +@ContextConfiguration(classes = {AppConfig.class}) +public class SuperTestServiceIntegrationTest { + @Autowired + SuperTestService superTestService; + + @Test + public void whenCallingGetSuperTestOne_thenWeGetSuperTestOneString() { + String resultOne = superTestService.getSuperTestOne(); + + Assert.assertThat(resultOne, is("SuperTestOne")); + } + + @Test + public void whenCallingGetSuperTestTwo_thenWeGetSuperTestTwoString() { + String resultTwo = superTestService.getSuperTestTwo(); + + Assert.assertThat(resultTwo, is("SuperTestTwo")); + } +} diff --git a/spring-types-bean-injection/src/test/java/com/baeldung/service/TestServiceIntegrationTest.java b/spring-types-bean-injection/src/test/java/com/baeldung/service/TestServiceIntegrationTest.java new file mode 100644 index 0000000000..2059e87e04 --- /dev/null +++ b/spring-types-bean-injection/src/test/java/com/baeldung/service/TestServiceIntegrationTest.java @@ -0,0 +1,32 @@ +package com.baeldung.service; + +import com.baeldung.config.AppConfig; +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.SpringRunner; + +import static org.hamcrest.CoreMatchers.is; + +@RunWith(SpringRunner.class) +@ContextConfiguration(classes = { AppConfig.class }) +public class TestServiceIntegrationTest { + @Autowired + TestService testService; + + @Test + public void whenCallingGetTestOne_thenWeGetTestOneString() { + String resultOne = testService.getTestOne(); + + Assert.assertThat(resultOne, is("TestOne")); + } + + @Test + public void whenCallingGetTestTwo_thenWeGetTestTwoString() { + String resultTwo = testService.getTestTwo(); + + Assert.assertThat(resultTwo, is("TestTwo")); + } +} \ No newline at end of file From 28bb7fc8d3ed564e3260d339a830797d09b7bb51 Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Thu, 24 Aug 2017 21:04:23 +0100 Subject: [PATCH 02/50] Difference between two dates in java --- java-difference-date/README.md | 3 + java-difference-date/pom.xml | 58 ++++++++++++++++++ .../src/main/java/com/baeldung/DateDiff.java | 30 ++++++++++ .../test/java/com/baeldung/DateDiffTest.java | 60 +++++++++++++++++++ pom.xml | 1 + 5 files changed, 152 insertions(+) create mode 100644 java-difference-date/README.md create mode 100644 java-difference-date/pom.xml create mode 100644 java-difference-date/src/main/java/com/baeldung/DateDiff.java create mode 100644 java-difference-date/src/test/java/com/baeldung/DateDiffTest.java diff --git a/java-difference-date/README.md b/java-difference-date/README.md new file mode 100644 index 0000000000..45f8216849 --- /dev/null +++ b/java-difference-date/README.md @@ -0,0 +1,3 @@ +## Relevant articles: + +- [Constructor Dependency Injection in Spring](http://www.baeldung.com/constructor-injection-in-spring) \ No newline at end of file diff --git a/java-difference-date/pom.xml b/java-difference-date/pom.xml new file mode 100644 index 0000000000..388753de90 --- /dev/null +++ b/java-difference-date/pom.xml @@ -0,0 +1,58 @@ + + + 4.0.0 + + com.baeldung + java-difference-date + 0.0.1-SNAPSHOT + jar + + java-difference-date + Difference between two dates in java + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + + joda-time + joda-time + ${joda-time.version} + + + com.darwinsys + hirondelle-date4j + ${hirondelle-date4j.version} + + + junit + junit + ${junit.version} + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + + + + 1.8 + 4.12 + 2.9.9 + 1.5.1 + + diff --git a/java-difference-date/src/main/java/com/baeldung/DateDiff.java b/java-difference-date/src/main/java/com/baeldung/DateDiff.java new file mode 100644 index 0000000000..08fc02fab7 --- /dev/null +++ b/java-difference-date/src/main/java/com/baeldung/DateDiff.java @@ -0,0 +1,30 @@ +package com.baeldung; + +import org.joda.time.DateTime; + +import java.time.Duration; +import java.time.ZonedDateTime; +import java.util.Date; +import java.util.concurrent.TimeUnit; + +public class DateDiff { + public long beforeJava8diff(Date firstDate, Date secondDate){ + long diffInMillies = Math.abs(secondDate.getTime() - firstDate.getTime()); + return TimeUnit.DAYS.convert(diffInMillies, TimeUnit.MILLISECONDS); + } + + public long fromJava8Diff(ZonedDateTime firstDate, ZonedDateTime secondDate){ + Duration duration = Duration.between(firstDate, secondDate); + return Math.abs(duration.toDays()); + } + + public long fromJodaTime(DateTime firstDate, DateTime secondDate){ + org.joda.time.Duration duration = new org.joda.time.Duration(firstDate, secondDate); + return Math.abs(duration.getStandardDays()); + } + + public long fromDate4j(hirondelle.date4j.DateTime firstDate, hirondelle.date4j.DateTime secondDate){ + long diff = firstDate.numDaysFrom(secondDate); + return Math.abs(diff); + } +} \ No newline at end of file diff --git a/java-difference-date/src/test/java/com/baeldung/DateDiffTest.java b/java-difference-date/src/test/java/com/baeldung/DateDiffTest.java new file mode 100644 index 0000000000..fe2b507cf3 --- /dev/null +++ b/java-difference-date/src/test/java/com/baeldung/DateDiffTest.java @@ -0,0 +1,60 @@ +package com.baeldung; + +import org.joda.time.DateTime; +import org.junit.Test; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.ZonedDateTime; +import java.util.Date; +import java.util.Locale; +import java.util.TimeZone; + +import static org.junit.Assert.assertEquals; + +public class DateDiffTest { + @Test + public void givenTwoDatesBeforeJava8SeparatedBySixDays_whenCallingDiffOnThem_thenWeGetSix() throws ParseException { + SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy", Locale.ENGLISH); + Date firstDate = sdf.parse("06/24/2017"); + Date secondDate = sdf.parse("06/30/2017"); + + DateDiff dateDiff = new DateDiff(); + long diff = dateDiff.beforeJava8diff(firstDate, secondDate); + + assertEquals(diff, 6); + } + + @Test + public void givenTheCurrentDateAndSixDaysBehindInJava8_whenCallingDiffOnThem_thenWeGetSix() { + ZonedDateTime now = ZonedDateTime.now(); + ZonedDateTime sixDaysBehind = now.minusDays(6); + + DateDiff dateDiff = new DateDiff(); + long diff = dateDiff.fromJava8Diff(now, sixDaysBehind); + + assertEquals(diff, 6); + } + + @Test + public void givenTheCurrentDateAndSixDaysBehindInJodaTime_whenCallingDiffOnThem_thenWeGetSix() { + DateTime now = DateTime.now(); + DateTime sixDaysBehind = now.minusDays(6); + + DateDiff dateDiff = new DateDiff(); + long diff = dateDiff.fromJodaTime(now, sixDaysBehind); + + assertEquals(diff, 6); + } + + @Test + public void givenTheCurrentDateAndSixDaysBehindInDate4j_whenCallingDiffOnThem_thenWeGetSix() { + hirondelle.date4j.DateTime now = hirondelle.date4j.DateTime.now(TimeZone.getDefault()); + hirondelle.date4j.DateTime sixDaysBehind = now.minusDays(6); + + DateDiff dateDiff = new DateDiff(); + long diff = dateDiff.fromDate4j(now, sixDaysBehind); + + assertEquals(diff, 6); + } +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index eef32f884e..d2d9ae3987 100644 --- a/pom.xml +++ b/pom.xml @@ -55,6 +55,7 @@ immutables jackson + java-difference-date java-cassandra javaslang javax-servlets From 348ff5d403c3ebae00ea8ef7e5a681d1cdb5cb03 Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Thu, 24 Aug 2017 21:36:52 +0100 Subject: [PATCH 03/50] Update README.md --- java-difference-date/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/java-difference-date/README.md b/java-difference-date/README.md index 45f8216849..2a024c27a2 100644 --- a/java-difference-date/README.md +++ b/java-difference-date/README.md @@ -1,3 +1,5 @@ ## Relevant articles: -- [Constructor Dependency Injection in Spring](http://www.baeldung.com/constructor-injection-in-spring) \ No newline at end of file +- [Period and Duration in Java](http://www.baeldung.com/java-period-duration) +- [Introduction to the Java 8 Date/Time API](http://www.baeldung.com/java-8-date-time-intro) +- [Migrating to the New Java 8 Date Time API](http://www.baeldung.com/migrating-to-java-8-date-time-api) \ No newline at end of file From a663b3ccde9fdbab1c8d2f8f3e0d13d11294b0d8 Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Fri, 25 Aug 2017 09:46:35 +0100 Subject: [PATCH 04/50] Simple clean of difference between dates --- core-java/README.md | 3 + core-java/pom.xml | 14 ++++- .../java/com/baeldung/DateDiffUnitTest.java | 63 +++++++++++++++++++ .../src/main/java/com/baeldung/DateDiff.java | 30 --------- .../test/java/com/baeldung/DateDiffTest.java | 25 ++++---- pom.xml | 1 - 6 files changed, 92 insertions(+), 44 deletions(-) create mode 100644 core-java/src/test/java/com/baeldung/DateDiffUnitTest.java delete mode 100644 java-difference-date/src/main/java/com/baeldung/DateDiff.java diff --git a/core-java/README.md b/core-java/README.md index dabf6f39be..a4b5127e98 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -141,3 +141,6 @@ - [Guide to UUID in Java](http://www.baeldung.com/java-uuid) - [How to Get the Last Element of a Stream in Java?](http://www.baeldung.com/java-stream-last-element) - [Guide to Escaping Characters in Java RegExps](http://www.baeldung.com/java-regexp-escape-char) +- [Period and Duration in Java](http://www.baeldung.com/java-period-duration) +- [Introduction to the Java 8 Date/Time API](http://www.baeldung.com/java-8-date-time-intro) +- [Migrating to the New Java 8 Date Time API](http://www.baeldung.com/migrating-to-java-8-date-time-api) diff --git a/core-java/pom.xml b/core-java/pom.xml index 422965a0ed..586486027a 100644 --- a/core-java/pom.xml +++ b/core-java/pom.xml @@ -186,6 +186,16 @@ fscontext ${fscontext.version} + + joda-time + joda-time + ${joda-time.version} + + + com.darwinsys + hirondelle-date4j + ${hirondelle-date4j.version} + @@ -408,6 +418,8 @@ 1.8.7 1.16.12 4.6-b01 + 2.9.9 + 1.5.1 1.3 @@ -416,9 +428,9 @@ 3.6.1 1.7.0 + 3.6.0 2.19.1 - diff --git a/core-java/src/test/java/com/baeldung/DateDiffUnitTest.java b/core-java/src/test/java/com/baeldung/DateDiffUnitTest.java new file mode 100644 index 0000000000..40b7fac30d --- /dev/null +++ b/core-java/src/test/java/com/baeldung/DateDiffUnitTest.java @@ -0,0 +1,63 @@ +package com.baeldung; + +import org.joda.time.DateTime; +import org.junit.Test; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.Duration; +import java.time.ZonedDateTime; +import java.util.Date; +import java.util.Locale; +import java.util.TimeZone; +import java.util.concurrent.TimeUnit; + +import static org.junit.Assert.assertEquals; + +public class DateDiffUnitTest { + + @Test + public void givenTwoDatesBeforeJava8_whenDifferentiating_thenWeGetSix() throws ParseException { + SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy", Locale.ENGLISH); + Date firstDate = sdf.parse("06/24/2017"); + Date secondDate = sdf.parse("06/30/2017"); + + long diffInMillies = Math.abs(secondDate.getTime() - firstDate.getTime()); + long diff = TimeUnit.DAYS.convert(diffInMillies, TimeUnit.MILLISECONDS); + + assertEquals(diff, 6); + } + + @Test + public void givenTwoDatesInJava8_whenDifferentiating_thenWeGetSix() { + ZonedDateTime now = ZonedDateTime.now(); + ZonedDateTime sixDaysBehind = now.minusDays(6); + + Duration duration = Duration.between(now, sixDaysBehind); + long diff = Math.abs(duration.toDays()); + + assertEquals(diff, 6); + } + + @Test + public void givenTwoDatesInJodaTime_whenDifferentiating_thenWeGetSix() { + DateTime now = DateTime.now(); + DateTime sixDaysBehind = now.minusDays(6); + + org.joda.time.Duration duration = new org.joda.time.Duration(now, sixDaysBehind); + long diff = Math.abs(duration.getStandardDays()); + + assertEquals(diff, 6); + } + + @Test + public void givenTwoDatesInDate4j_whenDifferentiating_thenWeGetSix() { + hirondelle.date4j.DateTime now = hirondelle.date4j.DateTime.now(TimeZone.getDefault()); + hirondelle.date4j.DateTime sixDaysBehind = now.minusDays(6); + + long diff = Math.abs(now.numDaysFrom(sixDaysBehind)); + + assertEquals(diff, 6); + } + +} \ No newline at end of file diff --git a/java-difference-date/src/main/java/com/baeldung/DateDiff.java b/java-difference-date/src/main/java/com/baeldung/DateDiff.java deleted file mode 100644 index 08fc02fab7..0000000000 --- a/java-difference-date/src/main/java/com/baeldung/DateDiff.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.baeldung; - -import org.joda.time.DateTime; - -import java.time.Duration; -import java.time.ZonedDateTime; -import java.util.Date; -import java.util.concurrent.TimeUnit; - -public class DateDiff { - public long beforeJava8diff(Date firstDate, Date secondDate){ - long diffInMillies = Math.abs(secondDate.getTime() - firstDate.getTime()); - return TimeUnit.DAYS.convert(diffInMillies, TimeUnit.MILLISECONDS); - } - - public long fromJava8Diff(ZonedDateTime firstDate, ZonedDateTime secondDate){ - Duration duration = Duration.between(firstDate, secondDate); - return Math.abs(duration.toDays()); - } - - public long fromJodaTime(DateTime firstDate, DateTime secondDate){ - org.joda.time.Duration duration = new org.joda.time.Duration(firstDate, secondDate); - return Math.abs(duration.getStandardDays()); - } - - public long fromDate4j(hirondelle.date4j.DateTime firstDate, hirondelle.date4j.DateTime secondDate){ - long diff = firstDate.numDaysFrom(secondDate); - return Math.abs(diff); - } -} \ No newline at end of file diff --git a/java-difference-date/src/test/java/com/baeldung/DateDiffTest.java b/java-difference-date/src/test/java/com/baeldung/DateDiffTest.java index fe2b507cf3..4203f7ef38 100644 --- a/java-difference-date/src/test/java/com/baeldung/DateDiffTest.java +++ b/java-difference-date/src/test/java/com/baeldung/DateDiffTest.java @@ -5,55 +5,56 @@ import org.junit.Test; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.time.Duration; import java.time.ZonedDateTime; import java.util.Date; import java.util.Locale; import java.util.TimeZone; +import java.util.concurrent.TimeUnit; import static org.junit.Assert.assertEquals; public class DateDiffTest { @Test - public void givenTwoDatesBeforeJava8SeparatedBySixDays_whenCallingDiffOnThem_thenWeGetSix() throws ParseException { + public void givenTwoDatesBeforeJava8_whenDifferentiating_thenWeGetSix() throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy", Locale.ENGLISH); Date firstDate = sdf.parse("06/24/2017"); Date secondDate = sdf.parse("06/30/2017"); - DateDiff dateDiff = new DateDiff(); - long diff = dateDiff.beforeJava8diff(firstDate, secondDate); + long diffInMillies = Math.abs(secondDate.getTime() - firstDate.getTime()); + long diff = TimeUnit.DAYS.convert(diffInMillies, TimeUnit.MILLISECONDS); assertEquals(diff, 6); } @Test - public void givenTheCurrentDateAndSixDaysBehindInJava8_whenCallingDiffOnThem_thenWeGetSix() { + public void givenTwoDatesInJava8_whenDifferentiating_thenWeGetSix() { ZonedDateTime now = ZonedDateTime.now(); ZonedDateTime sixDaysBehind = now.minusDays(6); - DateDiff dateDiff = new DateDiff(); - long diff = dateDiff.fromJava8Diff(now, sixDaysBehind); + Duration duration = Duration.between(now, sixDaysBehind); + long diff = Math.abs(duration.toDays()); assertEquals(diff, 6); } @Test - public void givenTheCurrentDateAndSixDaysBehindInJodaTime_whenCallingDiffOnThem_thenWeGetSix() { + public void givenTwoDatesInJodaTime_whenDifferentiating_thenWeGetSix() { DateTime now = DateTime.now(); DateTime sixDaysBehind = now.minusDays(6); - DateDiff dateDiff = new DateDiff(); - long diff = dateDiff.fromJodaTime(now, sixDaysBehind); + org.joda.time.Duration duration = new org.joda.time.Duration(now, sixDaysBehind); + long diff = Math.abs(duration.getStandardDays()); assertEquals(diff, 6); } @Test - public void givenTheCurrentDateAndSixDaysBehindInDate4j_whenCallingDiffOnThem_thenWeGetSix() { + public void givenTwoDatesInDate4j_whenDifferentiating_thenWeGetSix() { hirondelle.date4j.DateTime now = hirondelle.date4j.DateTime.now(TimeZone.getDefault()); hirondelle.date4j.DateTime sixDaysBehind = now.minusDays(6); - DateDiff dateDiff = new DateDiff(); - long diff = dateDiff.fromDate4j(now, sixDaysBehind); + long diff = Math.abs(now.numDaysFrom(sixDaysBehind)); assertEquals(diff, 6); } diff --git a/pom.xml b/pom.xml index 40e7fda4a3..b5dee350ca 100644 --- a/pom.xml +++ b/pom.xml @@ -76,7 +76,6 @@ immutables jackson - java-difference-date vavr javax-servlets From 4f827b93ed171cfa26035d8a9e7897489111abed Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Fri, 25 Aug 2017 12:36:28 +0100 Subject: [PATCH 05/50] Clean my test article --- pom.xml | 1 - spring-types-bean-injection/README.md | 3 - spring-types-bean-injection/pom.xml | 81 ------------------- .../java/com/baeldung/config/AppConfig.java | 25 ------ .../com/baeldung/service/MegaTestService.java | 22 ----- .../baeldung/service/SuperTestService.java | 22 ----- .../com/baeldung/service/TestService.java | 14 ---- .../MegaTestServiceIntegrationTest.java | 32 -------- .../SuperTestServiceIntegrationTest.java | 32 -------- .../service/TestServiceIntegrationTest.java | 32 -------- 10 files changed, 264 deletions(-) delete mode 100644 spring-types-bean-injection/README.md delete mode 100644 spring-types-bean-injection/pom.xml delete mode 100644 spring-types-bean-injection/src/main/java/com/baeldung/config/AppConfig.java delete mode 100644 spring-types-bean-injection/src/main/java/com/baeldung/service/MegaTestService.java delete mode 100644 spring-types-bean-injection/src/main/java/com/baeldung/service/SuperTestService.java delete mode 100644 spring-types-bean-injection/src/main/java/com/baeldung/service/TestService.java delete mode 100644 spring-types-bean-injection/src/test/java/com/baeldung/service/MegaTestServiceIntegrationTest.java delete mode 100644 spring-types-bean-injection/src/test/java/com/baeldung/service/SuperTestServiceIntegrationTest.java delete mode 100644 spring-types-bean-injection/src/test/java/com/baeldung/service/TestServiceIntegrationTest.java diff --git a/pom.xml b/pom.xml index b5dee350ca..f2dd0ae48c 100644 --- a/pom.xml +++ b/pom.xml @@ -212,7 +212,6 @@ spring-spel spring-state-machine spring-thymeleaf - spring-types-bean-injection spring-userservice spring-zuul spring-reactor diff --git a/spring-types-bean-injection/README.md b/spring-types-bean-injection/README.md deleted file mode 100644 index 45f8216849..0000000000 --- a/spring-types-bean-injection/README.md +++ /dev/null @@ -1,3 +0,0 @@ -## Relevant articles: - -- [Constructor Dependency Injection in Spring](http://www.baeldung.com/constructor-injection-in-spring) \ No newline at end of file diff --git a/spring-types-bean-injection/pom.xml b/spring-types-bean-injection/pom.xml deleted file mode 100644 index 75fee65d80..0000000000 --- a/spring-types-bean-injection/pom.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - 4.0.0 - - com.baeldung - spring-types-bean-injection - 0.0.1-SNAPSHOT - jar - - spring-types-bean-injection - Types of bean injection in spring - - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - - - - - org.springframework - spring-context - ${spring.version} - - - org.springframework - spring-test - ${spring.version} - test - - - junit - junit - ${junit.version} - test - - - - - - integration - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration-test - - test - - - - **/*LiveTest.java - - - **/*IntegrationTest.java - - - - - - - json - - - - - - - - - - 1.8 - 4.3.10.RELEASE - 4.12 - - - diff --git a/spring-types-bean-injection/src/main/java/com/baeldung/config/AppConfig.java b/spring-types-bean-injection/src/main/java/com/baeldung/config/AppConfig.java deleted file mode 100644 index 45be32fa06..0000000000 --- a/spring-types-bean-injection/src/main/java/com/baeldung/config/AppConfig.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.baeldung.config; - -import com.baeldung.service.MegaTestService; -import com.baeldung.service.SuperTestService; -import com.baeldung.service.TestService; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration -public class AppConfig { - @Bean - public TestService TestService() { - return new TestService(); - } - - @Bean - public SuperTestService SuperTestService() { - return new SuperTestService(new TestService()); - } - - @Bean - public MegaTestService MegaTestService() { - return new MegaTestService(); - } -} diff --git a/spring-types-bean-injection/src/main/java/com/baeldung/service/MegaTestService.java b/spring-types-bean-injection/src/main/java/com/baeldung/service/MegaTestService.java deleted file mode 100644 index 45deeb8592..0000000000 --- a/spring-types-bean-injection/src/main/java/com/baeldung/service/MegaTestService.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baeldung.service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class MegaTestService { - private TestService testService; - - @Autowired - public void setTestService(TestService testService) { - this.testService = testService; - } - - public String getMegaTestOne() { - return "Mega" + testService.getTestOne(); - } - - public String getMegaTestTwo() { - return "Mega" + testService.getTestTwo(); - } -} diff --git a/spring-types-bean-injection/src/main/java/com/baeldung/service/SuperTestService.java b/spring-types-bean-injection/src/main/java/com/baeldung/service/SuperTestService.java deleted file mode 100644 index edf1f2b1c5..0000000000 --- a/spring-types-bean-injection/src/main/java/com/baeldung/service/SuperTestService.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baeldung.service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class SuperTestService { - private TestService testService; - - @Autowired - public SuperTestService(TestService testService) { - this.testService = testService; - } - - public String getSuperTestOne() { - return "Super" + testService.getTestOne(); - } - - public String getSuperTestTwo() { - return "Super" + testService.getTestTwo(); - } -} diff --git a/spring-types-bean-injection/src/main/java/com/baeldung/service/TestService.java b/spring-types-bean-injection/src/main/java/com/baeldung/service/TestService.java deleted file mode 100644 index 3e7c327dbd..0000000000 --- a/spring-types-bean-injection/src/main/java/com/baeldung/service/TestService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.service; - -import org.springframework.stereotype.Service; - -@Service -public class TestService { - public String getTestOne() { - return "TestOne"; - } - - public String getTestTwo() { - return "TestTwo"; - } -} diff --git a/spring-types-bean-injection/src/test/java/com/baeldung/service/MegaTestServiceIntegrationTest.java b/spring-types-bean-injection/src/test/java/com/baeldung/service/MegaTestServiceIntegrationTest.java deleted file mode 100644 index ced897c70c..0000000000 --- a/spring-types-bean-injection/src/test/java/com/baeldung/service/MegaTestServiceIntegrationTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.baeldung.service; - -import com.baeldung.config.AppConfig; -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.SpringRunner; - -import static org.hamcrest.CoreMatchers.is; - -@RunWith(SpringRunner.class) -@ContextConfiguration(classes = {AppConfig.class}) -public class MegaTestServiceIntegrationTest { - @Autowired - MegaTestService megaTestService; - - @Test - public void whenCallingGetMegaTestOne_thenWeGetMegaTestOneString() { - String resultOne = megaTestService.getMegaTestOne(); - - Assert.assertThat(resultOne, is("MegaTestOne")); - } - - @Test - public void whenCallingGetMegaTestTwo_thenWeGetMegaTestTwoString() { - String resultTwo = megaTestService.getMegaTestTwo(); - - Assert.assertThat(resultTwo, is("MegaTestTwo")); - } -} diff --git a/spring-types-bean-injection/src/test/java/com/baeldung/service/SuperTestServiceIntegrationTest.java b/spring-types-bean-injection/src/test/java/com/baeldung/service/SuperTestServiceIntegrationTest.java deleted file mode 100644 index a037d70c40..0000000000 --- a/spring-types-bean-injection/src/test/java/com/baeldung/service/SuperTestServiceIntegrationTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.baeldung.service; - -import com.baeldung.config.AppConfig; -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.SpringRunner; - -import static org.hamcrest.CoreMatchers.is; - -@RunWith(SpringRunner.class) -@ContextConfiguration(classes = {AppConfig.class}) -public class SuperTestServiceIntegrationTest { - @Autowired - SuperTestService superTestService; - - @Test - public void whenCallingGetSuperTestOne_thenWeGetSuperTestOneString() { - String resultOne = superTestService.getSuperTestOne(); - - Assert.assertThat(resultOne, is("SuperTestOne")); - } - - @Test - public void whenCallingGetSuperTestTwo_thenWeGetSuperTestTwoString() { - String resultTwo = superTestService.getSuperTestTwo(); - - Assert.assertThat(resultTwo, is("SuperTestTwo")); - } -} diff --git a/spring-types-bean-injection/src/test/java/com/baeldung/service/TestServiceIntegrationTest.java b/spring-types-bean-injection/src/test/java/com/baeldung/service/TestServiceIntegrationTest.java deleted file mode 100644 index 2059e87e04..0000000000 --- a/spring-types-bean-injection/src/test/java/com/baeldung/service/TestServiceIntegrationTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.baeldung.service; - -import com.baeldung.config.AppConfig; -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.SpringRunner; - -import static org.hamcrest.CoreMatchers.is; - -@RunWith(SpringRunner.class) -@ContextConfiguration(classes = { AppConfig.class }) -public class TestServiceIntegrationTest { - @Autowired - TestService testService; - - @Test - public void whenCallingGetTestOne_thenWeGetTestOneString() { - String resultOne = testService.getTestOne(); - - Assert.assertThat(resultOne, is("TestOne")); - } - - @Test - public void whenCallingGetTestTwo_thenWeGetTestTwoString() { - String resultTwo = testService.getTestTwo(); - - Assert.assertThat(resultTwo, is("TestTwo")); - } -} \ No newline at end of file From c4fd005da4d41ea4efffecb8a0ac7b1a93d6cc8f Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Mon, 28 Aug 2017 05:23:07 +0100 Subject: [PATCH 06/50] Improve dates diff: for dates and datetimes --- .../java/com/baeldung/DateDiffUnitTest.java | 40 +++++++++++++++---- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/core-java/src/test/java/com/baeldung/DateDiffUnitTest.java b/core-java/src/test/java/com/baeldung/DateDiffUnitTest.java index 40b7fac30d..ae9bae0050 100644 --- a/core-java/src/test/java/com/baeldung/DateDiffUnitTest.java +++ b/core-java/src/test/java/com/baeldung/DateDiffUnitTest.java @@ -1,12 +1,14 @@ package com.baeldung; import org.joda.time.DateTime; +import org.joda.time.Interval; import org.junit.Test; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.Duration; -import java.time.ZonedDateTime; +import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.Date; import java.util.Locale; import java.util.TimeZone; @@ -30,8 +32,8 @@ public class DateDiffUnitTest { @Test public void givenTwoDatesInJava8_whenDifferentiating_thenWeGetSix() { - ZonedDateTime now = ZonedDateTime.now(); - ZonedDateTime sixDaysBehind = now.minusDays(6); + LocalDate now = LocalDate.now(); + LocalDate sixDaysBehind = now.minusDays(6); Duration duration = Duration.between(now, sixDaysBehind); long diff = Math.abs(duration.toDays()); @@ -40,12 +42,34 @@ public class DateDiffUnitTest { } @Test - public void givenTwoDatesInJodaTime_whenDifferentiating_thenWeGetSix() { - DateTime now = DateTime.now(); - DateTime sixDaysBehind = now.minusDays(6); + public void givenTwoDateTimesInJava8_whenDifferentiating_thenWeGetSix() { + LocalDateTime now = LocalDateTime.now(); + LocalDateTime sixMinutesBehind = now.minusMinutes(6); - org.joda.time.Duration duration = new org.joda.time.Duration(now, sixDaysBehind); - long diff = Math.abs(duration.getStandardDays()); + Duration duration = Duration.between(now, sixMinutesBehind); + long diff = Math.abs(duration.toMinutes()); + + assertEquals(diff, 6); + } + + @Test + public void givenTwoDatesInJodaTime_whenDifferentiating_thenWeGetSix() { + org.joda.time.LocalDate now = org.joda.time.LocalDate.now(); + org.joda.time.LocalDate sixDaysBehind = now.minusDays(6); + + org.joda.time.Period period = new org.joda.time.Period(now, sixDaysBehind); + long diff = Math.abs(period.getDays()); + + assertEquals(diff, 6); + } + + @Test + public void givenTwoDateTimesInJodaTime_whenDifferentiating_thenWeGetSix() { + org.joda.time.LocalDateTime now = org.joda.time.LocalDateTime.now(); + org.joda.time.LocalDateTime sixMinutesBehind = now.minusMinutes(6); + + org.joda.time.Period period = new org.joda.time.Period(now, sixMinutesBehind); + long diff = Math.abs(period.getDays()); assertEquals(diff, 6); } From 82ed9489e51c85a7a623491c3be9d1090a2b4af0 Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Wed, 30 Aug 2017 14:35:38 +0100 Subject: [PATCH 07/50] Move difference between dates from core-java to libraries --- core-java/pom.xml | 13 ------------- libraries/pom.xml | 18 ++++++++++++++++++ .../com/baeldung/date}/DateDiffUnitTest.java | 2 +- 3 files changed, 19 insertions(+), 14 deletions(-) rename {core-java/src/test/java/com/baeldung => libraries/src/test/java/com/baeldung/date}/DateDiffUnitTest.java (99%) diff --git a/core-java/pom.xml b/core-java/pom.xml index 586486027a..25029c237f 100644 --- a/core-java/pom.xml +++ b/core-java/pom.xml @@ -186,16 +186,6 @@ fscontext ${fscontext.version} - - joda-time - joda-time - ${joda-time.version} - - - com.darwinsys - hirondelle-date4j - ${hirondelle-date4j.version} - @@ -418,9 +408,6 @@ 1.8.7 1.16.12 4.6-b01 - 2.9.9 - 1.5.1 - 1.3 4.12 diff --git a/libraries/pom.xml b/libraries/pom.xml index 6d1098246e..ee92642b62 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -498,6 +498,22 @@ gt-swing ${geotools.version} + + com.darwinsys + hirondelle-date4j + RELEASE + test + + + joda-time + joda-time + ${joda-time.version} + + + com.darwinsys + hirondelle-date4j + ${hirondelle-date4j.version} + @@ -564,5 +580,7 @@ 0.6.5 0.9.0 15.2 + 2.9.9 + 1.5.1 \ No newline at end of file diff --git a/core-java/src/test/java/com/baeldung/DateDiffUnitTest.java b/libraries/src/test/java/com/baeldung/date/DateDiffUnitTest.java similarity index 99% rename from core-java/src/test/java/com/baeldung/DateDiffUnitTest.java rename to libraries/src/test/java/com/baeldung/date/DateDiffUnitTest.java index 324a0d4587..6046781619 100644 --- a/core-java/src/test/java/com/baeldung/DateDiffUnitTest.java +++ b/libraries/src/test/java/com/baeldung/date/DateDiffUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung; +package com.baeldung.date; import org.junit.Test; From cccaa8c4ad6c65d7567a9ffad6f08acffb72ae89 Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Thu, 7 Sep 2017 23:44:30 +0100 Subject: [PATCH 08/50] BAEL-890 - Kotlin-Allopen with Spring example --- spring-mvc-kotlin/pom.xml | 21 +++++++++++++++++-- .../kotlin/allopen/SimpleConfiguration.kt | 7 +++++++ .../kotlin/allopen/SimpleConfigurationTest.kt | 19 +++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 spring-mvc-kotlin/src/main/kotlin/com/baeldung/kotlin/allopen/SimpleConfiguration.kt create mode 100644 spring-mvc-kotlin/src/test/kotlin/com/baeldung/kotlin/allopen/SimpleConfigurationTest.kt diff --git a/spring-mvc-kotlin/pom.xml b/spring-mvc-kotlin/pom.xml index 264cf49817..2d1dac5e29 100644 --- a/spring-mvc-kotlin/pom.xml +++ b/spring-mvc-kotlin/pom.xml @@ -45,6 +45,12 @@ thymeleaf-spring4 3.0.7.RELEASE + + org.springframework + spring-test + 4.3.10.RELEASE + test + @@ -55,7 +61,12 @@ kotlin-maven-plugin org.jetbrains.kotlin 1.1.4 - + + + spring + + 1.8 + compile @@ -64,7 +75,6 @@ compile - test-compile test-compile @@ -73,6 +83,13 @@ + + + org.jetbrains.kotlin + kotlin-maven-allopen + 1.1.4-3 + + diff --git a/spring-mvc-kotlin/src/main/kotlin/com/baeldung/kotlin/allopen/SimpleConfiguration.kt b/spring-mvc-kotlin/src/main/kotlin/com/baeldung/kotlin/allopen/SimpleConfiguration.kt new file mode 100644 index 0000000000..5d0a3e13bf --- /dev/null +++ b/spring-mvc-kotlin/src/main/kotlin/com/baeldung/kotlin/allopen/SimpleConfiguration.kt @@ -0,0 +1,7 @@ +package com.baeldung.kotlin.allopen + +import org.springframework.context.annotation.Configuration + +@Configuration +class SimpleConfiguration { +} \ No newline at end of file diff --git a/spring-mvc-kotlin/src/test/kotlin/com/baeldung/kotlin/allopen/SimpleConfigurationTest.kt b/spring-mvc-kotlin/src/test/kotlin/com/baeldung/kotlin/allopen/SimpleConfigurationTest.kt new file mode 100644 index 0000000000..65a60c7157 --- /dev/null +++ b/spring-mvc-kotlin/src/test/kotlin/com/baeldung/kotlin/allopen/SimpleConfigurationTest.kt @@ -0,0 +1,19 @@ +package com.baeldung.kotlin.allopen + +import org.junit.Test +import org.junit.runner.RunWith +import org.springframework.test.context.ContextConfiguration +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner +import org.springframework.test.context.support.AnnotationConfigContextLoader + +@RunWith(SpringJUnit4ClassRunner::class) +@ContextConfiguration( + loader = AnnotationConfigContextLoader::class, + classes = arrayOf(SimpleConfiguration::class)) +class SimpleConfigurationTest { + + @Test + fun contextLoads() { + } + +} \ No newline at end of file From 28ad804484b59e7952566989f5284fa220595661 Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Wed, 20 Sep 2017 07:01:45 +0100 Subject: [PATCH 09/50] BAEL-1107 - Introduction to Apache Cayenne Orm --- apache-cayenne/pom.xml | 59 ++++++++ .../apachecayenne/persistent/Article.java | 9 ++ .../apachecayenne/persistent/Author.java | 9 ++ .../persistent/auto/_Article.java | 47 ++++++ .../persistent/auto/_Author.java | 52 +++++++ .../src/main/resources/cayenne-project.xml | 17 +++ .../src/main/resources/datamap.map.xml | 34 +++++ .../apachecayenne/CayenneOperationTests.java | 140 ++++++++++++++++++ pom.xml | 1 + 9 files changed, 368 insertions(+) create mode 100644 apache-cayenne/pom.xml create mode 100644 apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/Article.java create mode 100644 apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/Author.java create mode 100644 apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/auto/_Article.java create mode 100644 apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/auto/_Author.java create mode 100644 apache-cayenne/src/main/resources/cayenne-project.xml create mode 100644 apache-cayenne/src/main/resources/datamap.map.xml create mode 100644 apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneOperationTests.java diff --git a/apache-cayenne/pom.xml b/apache-cayenne/pom.xml new file mode 100644 index 0000000000..23837d7019 --- /dev/null +++ b/apache-cayenne/pom.xml @@ -0,0 +1,59 @@ + + + 4.0.0 + + apache-cayenne + 0.0.1-SNAPSHOT + jar + + apache-cayenne + Introduction to Apache Cayenne + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + UTF-8 + UTF-8 + 1.8 + 5.1.31 + 4.0.M5 + 4.12 + + + + + org.apache.cayenne + cayenne-server + ${cayenne.version} + + + mysql + mysql-connector-java + ${mysql.connector.version} + runtime + + + + junit + junit + ${junit.version} + test + + + + + + + org.apache.cayenne.plugins + cayenne-modeler-maven-plugin + ${cayenne.version} + + + + + diff --git a/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/Article.java b/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/Article.java new file mode 100644 index 0000000000..303c180887 --- /dev/null +++ b/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/Article.java @@ -0,0 +1,9 @@ +package com.baeldung.apachecayenne.persistent; + +import com.baeldung.apachecayenne.persistent.auto._Article; + +public class Article extends _Article { + + private static final long serialVersionUID = 1L; + +} diff --git a/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/Author.java b/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/Author.java new file mode 100644 index 0000000000..5a8df57c6e --- /dev/null +++ b/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/Author.java @@ -0,0 +1,9 @@ +package com.baeldung.apachecayenne.persistent; + +import com.baeldung.apachecayenne.persistent.auto._Author; + +public class Author extends _Author { + + private static final long serialVersionUID = 1L; + +} diff --git a/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/auto/_Article.java b/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/auto/_Article.java new file mode 100644 index 0000000000..f6c179fcfd --- /dev/null +++ b/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/auto/_Article.java @@ -0,0 +1,47 @@ +package com.baeldung.apachecayenne.persistent.auto; + +import org.apache.cayenne.CayenneDataObject; +import org.apache.cayenne.exp.Property; + +import com.baeldung.apachecayenne.persistent.Author; + +/** + * Class _Article was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _Article extends CayenneDataObject { + + private static final long serialVersionUID = 1L; + + public static final String ID_PK_COLUMN = "id"; + + public static final Property CONTENT = Property.create("content", String.class); + public static final Property TITLE = Property.create("title", String.class); + public static final Property AUTHOR = Property.create("author", Author.class); + + public void setContent(String content) { + writeProperty("content", content); + } + public String getContent() { + return (String)readProperty("content"); + } + + public void setTitle(String title) { + writeProperty("title", title); + } + public String getTitle() { + return (String)readProperty("title"); + } + + public void setAuthor(Author author) { + setToOneTarget("author", author, true); + } + + public Author getAuthor() { + return (Author)readProperty("author"); + } + + +} diff --git a/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/auto/_Author.java b/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/auto/_Author.java new file mode 100644 index 0000000000..3d068423c8 --- /dev/null +++ b/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/auto/_Author.java @@ -0,0 +1,52 @@ +package com.baeldung.apachecayenne.persistent.auto; + +import java.util.List; + +import org.apache.cayenne.CayenneDataObject; +import org.apache.cayenne.exp.Property; + +import com.baeldung.apachecayenne.persistent.Article; + +/** + * Class _Author was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _Author extends CayenneDataObject { + + private static final long serialVersionUID = 1L; + + public static final String ID_PK_COLUMN = "id"; + + public static final Property FIRSTNAME = Property.create("firstname", String.class); + public static final Property LASTNAME = Property.create("lastname", String.class); + public static final Property> ARTICLES = Property.create("articles", List.class); + + public void setFirstname(String firstname) { + writeProperty("firstname", firstname); + } + public String getFirstname() { + return (String)readProperty("firstname"); + } + + public void setLastname(String lastname) { + writeProperty("lastname", lastname); + } + public String getLastname() { + return (String)readProperty("lastname"); + } + + public void addToArticles(Article obj) { + addToManyTarget("articles", obj, true); + } + public void removeFromArticles(Article obj) { + removeToManyTarget("articles", obj, true); + } + @SuppressWarnings("unchecked") + public List
getArticles() { + return (List
)readProperty("articles"); + } + + +} diff --git a/apache-cayenne/src/main/resources/cayenne-project.xml b/apache-cayenne/src/main/resources/cayenne-project.xml new file mode 100644 index 0000000000..3f3c59e0e9 --- /dev/null +++ b/apache-cayenne/src/main/resources/cayenne-project.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + diff --git a/apache-cayenne/src/main/resources/datamap.map.xml b/apache-cayenne/src/main/resources/datamap.map.xml new file mode 100644 index 0000000000..dc78ad4348 --- /dev/null +++ b/apache-cayenne/src/main/resources/datamap.map.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneOperationTests.java b/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneOperationTests.java new file mode 100644 index 0000000000..da9667b029 --- /dev/null +++ b/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneOperationTests.java @@ -0,0 +1,140 @@ +package com.baeldung.apachecayenne; + +import com.baeldung.apachecayenne.persistent.Article; +import com.baeldung.apachecayenne.persistent.Author; +import org.apache.cayenne.ObjectContext; +import org.apache.cayenne.configuration.server.ServerRuntime; +import org.apache.cayenne.query.ObjectSelect; +import org.apache.cayenne.query.SQLTemplate; +import org.junit.After; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.util.List; + +import static junit.framework.Assert.assertEquals; +import static org.junit.Assert.assertNull; + + +public class CayenneOperationTests { + private static ObjectContext context = null; + + @BeforeClass + public static void setupTheCayenneContext(){ + ServerRuntime cayenneRuntime = ServerRuntime.builder() + .addConfig("cayenne-project.xml") + .build(); + context = cayenneRuntime.newContext(); + } + + @After + public void deleteAllRecords(){ + SQLTemplate deleteArticles = new SQLTemplate(Article.class, "delete from article"); + SQLTemplate deleteAuthors = new SQLTemplate(Author.class, "delete from author"); + + context.performGenericQuery(deleteArticles); + context.performGenericQuery(deleteAuthors); + } + + @Test + public void givenAuthor_whenInsert_thenWeGetOneRecordInTheDatabase(){ + Author author = context.newObject(Author.class); + author.setFirstname("Paul"); + author.setLastname("Smith"); + + context.commitChanges(); + + long records = ObjectSelect.dataRowQuery(Author.class).selectCount(context); + assertEquals(1, records); + } + + @Test + public void givenAuthor_whenInsert_andQueryByFirstName_thenWeGetTheAuthor(){ + Author author = context.newObject(Author.class); + author.setFirstname("Paul"); + author.setLastname("Smith"); + + context.commitChanges(); + + Author expectedAuthor = ObjectSelect.query(Author.class) + .where(Author.FIRSTNAME.eq("Paul")) + .selectOne(context); + + assertEquals("Paul", expectedAuthor.getFirstname()); + assertEquals("Smith", expectedAuthor.getLastname()); + } + + @Test + public void givenTwoAuthor_whenInsert_andQueryAll_thenWeGetTwoAuthors(){ + Author firstAuthor = context.newObject(Author.class); + firstAuthor.setFirstname("Paul"); + firstAuthor.setLastname("Smith"); + + Author secondAuthor = context.newObject(Author.class); + secondAuthor.setFirstname("Ludovic"); + secondAuthor.setLastname("Garcia"); + + context.commitChanges(); + + List authors = ObjectSelect.query(Author.class).select(context); + assertEquals(2, authors.size()); + } + + @Test + public void givenAuthor_whenUpdating_thenWeGetAnUpatedeAuthor(){ + Author author = context.newObject(Author.class); + author.setFirstname("Paul"); + author.setLastname("Smith"); + context.commitChanges(); + + Author expectedAuthor = ObjectSelect.query(Author.class) + .where(Author.FIRSTNAME.eq("Paul")) + .selectOne(context); + expectedAuthor.setLastname("Smith 2"); + context.commitChanges(); + + assertEquals(author.getFirstname(), expectedAuthor.getFirstname()); + assertEquals(author.getLastname(), expectedAuthor.getLastname()); + } + + @Test + public void givenAuthor_whenDeleting_thenWeLostHisDetails(){ + Author author = context.newObject(Author.class); + author.setFirstname("Paul"); + author.setLastname("Smith"); + context.commitChanges(); + + Author savedAuthor = ObjectSelect.query(Author.class) + .where(Author.FIRSTNAME.eq("Paul")).selectOne(context); + if(savedAuthor != null) { + context.deleteObjects(author); + context.commitChanges(); + } + + Author expectedAuthor = ObjectSelect.query(Author.class) + .where(Author.FIRSTNAME.eq("Paul")).selectOne(context); + assertNull(expectedAuthor); + } + + @Test + public void givenAuthor_whenAttachingToArticle_thenTheRelationIsMade(){ + Author author = context.newObject(Author.class); + author.setFirstname("Paul"); + author.setLastname("Smith"); + + Article article = context.newObject(Article.class); + article.setTitle("My post title"); + article.setContent("The content"); + article.setAuthor(author); + + context.commitChanges(); + + Author expectedAuthor = ObjectSelect.query(Author.class) + .where(Author.LASTNAME.eq("Smith")) + .selectOne(context); + + Article expectedArticle = (expectedAuthor.getArticles()).get(0); + assertEquals(article.getTitle(), expectedArticle.getTitle()); + } + +} diff --git a/pom.xml b/pom.xml index dfa7e09acc..083cee017b 100644 --- a/pom.xml +++ b/pom.xml @@ -28,6 +28,7 @@ + apache-cayenne aws akka-streams algorithms From 8b9037ff0a30d0f045a24d9173eca4b28c4085bf Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Sat, 23 Sep 2017 00:24:55 +0100 Subject: [PATCH 10/50] BAEL-1107: update formating and version of libs --- apache-cayenne/pom.xml | 2 +- .../apachecayenne/CayenneOperationTests.java | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/apache-cayenne/pom.xml b/apache-cayenne/pom.xml index 23837d7019..52631e8594 100644 --- a/apache-cayenne/pom.xml +++ b/apache-cayenne/pom.xml @@ -20,7 +20,7 @@ UTF-8 UTF-8 1.8 - 5.1.31 + 5.1.44 4.0.M5 4.12 diff --git a/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneOperationTests.java b/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneOperationTests.java index da9667b029..b92096c0fa 100644 --- a/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneOperationTests.java +++ b/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneOperationTests.java @@ -20,7 +20,7 @@ public class CayenneOperationTests { private static ObjectContext context = null; @BeforeClass - public static void setupTheCayenneContext(){ + public static void setupTheCayenneContext() { ServerRuntime cayenneRuntime = ServerRuntime.builder() .addConfig("cayenne-project.xml") .build(); @@ -28,7 +28,7 @@ public class CayenneOperationTests { } @After - public void deleteAllRecords(){ + public void deleteAllRecords() { SQLTemplate deleteArticles = new SQLTemplate(Article.class, "delete from article"); SQLTemplate deleteAuthors = new SQLTemplate(Author.class, "delete from author"); @@ -37,7 +37,7 @@ public class CayenneOperationTests { } @Test - public void givenAuthor_whenInsert_thenWeGetOneRecordInTheDatabase(){ + public void givenAuthor_whenInsert_thenWeGetOneRecordInTheDatabase() { Author author = context.newObject(Author.class); author.setFirstname("Paul"); author.setLastname("Smith"); @@ -49,7 +49,7 @@ public class CayenneOperationTests { } @Test - public void givenAuthor_whenInsert_andQueryByFirstName_thenWeGetTheAuthor(){ + public void givenAuthor_whenInsert_andQueryByFirstName_thenWeGetTheAuthor() { Author author = context.newObject(Author.class); author.setFirstname("Paul"); author.setLastname("Smith"); @@ -65,7 +65,7 @@ public class CayenneOperationTests { } @Test - public void givenTwoAuthor_whenInsert_andQueryAll_thenWeGetTwoAuthors(){ + public void givenTwoAuthor_whenInsert_andQueryAll_thenWeGetTwoAuthors() { Author firstAuthor = context.newObject(Author.class); firstAuthor.setFirstname("Paul"); firstAuthor.setLastname("Smith"); @@ -81,7 +81,7 @@ public class CayenneOperationTests { } @Test - public void givenAuthor_whenUpdating_thenWeGetAnUpatedeAuthor(){ + public void givenAuthor_whenUpdating_thenWeGetAnUpatedeAuthor() { Author author = context.newObject(Author.class); author.setFirstname("Paul"); author.setLastname("Smith"); @@ -98,7 +98,7 @@ public class CayenneOperationTests { } @Test - public void givenAuthor_whenDeleting_thenWeLostHisDetails(){ + public void givenAuthor_whenDeleting_thenWeLostHisDetails() { Author author = context.newObject(Author.class); author.setFirstname("Paul"); author.setLastname("Smith"); @@ -117,7 +117,7 @@ public class CayenneOperationTests { } @Test - public void givenAuthor_whenAttachingToArticle_thenTheRelationIsMade(){ + public void givenAuthor_whenAttachingToArticle_thenTheRelationIsMade() { Author author = context.newObject(Author.class); author.setFirstname("Paul"); author.setLastname("Smith"); From 44d5a03c0dfcc9a50b8e6f89aaeac7364eb4a2c9 Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Sun, 24 Sep 2017 14:15:12 +0100 Subject: [PATCH 11/50] BAEL-1107: update properties of Author --- .../persistent/auto/_Author.java | 18 +++------ .../src/main/resources/datamap.map.xml | 6 +-- .../apachecayenne/CayenneOperationTests.java | 39 +++++++------------ 3 files changed, 22 insertions(+), 41 deletions(-) diff --git a/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/auto/_Author.java b/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/auto/_Author.java index 3d068423c8..4d3bb090ca 100644 --- a/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/auto/_Author.java +++ b/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/auto/_Author.java @@ -19,22 +19,14 @@ public abstract class _Author extends CayenneDataObject { public static final String ID_PK_COLUMN = "id"; - public static final Property FIRSTNAME = Property.create("firstname", String.class); - public static final Property LASTNAME = Property.create("lastname", String.class); + public static final Property NAME = Property.create("name", String.class); public static final Property> ARTICLES = Property.create("articles", List.class); - public void setFirstname(String firstname) { - writeProperty("firstname", firstname); + public void setName(String name) { + writeProperty("name", name); } - public String getFirstname() { - return (String)readProperty("firstname"); - } - - public void setLastname(String lastname) { - writeProperty("lastname", lastname); - } - public String getLastname() { - return (String)readProperty("lastname"); + public String getName() { + return (String)readProperty("name"); } public void addToArticles(Article obj) { diff --git a/apache-cayenne/src/main/resources/datamap.map.xml b/apache-cayenne/src/main/resources/datamap.map.xml index dc78ad4348..3305649669 100644 --- a/apache-cayenne/src/main/resources/datamap.map.xml +++ b/apache-cayenne/src/main/resources/datamap.map.xml @@ -11,17 +11,15 @@ - - + - - + diff --git a/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneOperationTests.java b/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneOperationTests.java index b92096c0fa..8a0d210d8d 100644 --- a/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneOperationTests.java +++ b/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneOperationTests.java @@ -39,8 +39,7 @@ public class CayenneOperationTests { @Test public void givenAuthor_whenInsert_thenWeGetOneRecordInTheDatabase() { Author author = context.newObject(Author.class); - author.setFirstname("Paul"); - author.setLastname("Smith"); + author.setName("Paul"); context.commitChanges(); @@ -51,28 +50,24 @@ public class CayenneOperationTests { @Test public void givenAuthor_whenInsert_andQueryByFirstName_thenWeGetTheAuthor() { Author author = context.newObject(Author.class); - author.setFirstname("Paul"); - author.setLastname("Smith"); + author.setName("Paul"); context.commitChanges(); Author expectedAuthor = ObjectSelect.query(Author.class) - .where(Author.FIRSTNAME.eq("Paul")) + .where(Author.NAME.eq("Paul")) .selectOne(context); - assertEquals("Paul", expectedAuthor.getFirstname()); - assertEquals("Smith", expectedAuthor.getLastname()); + assertEquals("Paul", expectedAuthor.getName()); } @Test public void givenTwoAuthor_whenInsert_andQueryAll_thenWeGetTwoAuthors() { Author firstAuthor = context.newObject(Author.class); - firstAuthor.setFirstname("Paul"); - firstAuthor.setLastname("Smith"); + firstAuthor.setName("Paul"); Author secondAuthor = context.newObject(Author.class); - secondAuthor.setFirstname("Ludovic"); - secondAuthor.setLastname("Garcia"); + secondAuthor.setName("Ludovic"); context.commitChanges(); @@ -83,44 +78,40 @@ public class CayenneOperationTests { @Test public void givenAuthor_whenUpdating_thenWeGetAnUpatedeAuthor() { Author author = context.newObject(Author.class); - author.setFirstname("Paul"); - author.setLastname("Smith"); + author.setName("Paul"); context.commitChanges(); Author expectedAuthor = ObjectSelect.query(Author.class) - .where(Author.FIRSTNAME.eq("Paul")) + .where(Author.NAME.eq("Paul")) .selectOne(context); - expectedAuthor.setLastname("Smith 2"); + expectedAuthor.setName("Garcia"); context.commitChanges(); - assertEquals(author.getFirstname(), expectedAuthor.getFirstname()); - assertEquals(author.getLastname(), expectedAuthor.getLastname()); + assertEquals(author.getName(), expectedAuthor.getName()); } @Test public void givenAuthor_whenDeleting_thenWeLostHisDetails() { Author author = context.newObject(Author.class); - author.setFirstname("Paul"); - author.setLastname("Smith"); + author.setName("Paul"); context.commitChanges(); Author savedAuthor = ObjectSelect.query(Author.class) - .where(Author.FIRSTNAME.eq("Paul")).selectOne(context); + .where(Author.NAME.eq("Paul")).selectOne(context); if(savedAuthor != null) { context.deleteObjects(author); context.commitChanges(); } Author expectedAuthor = ObjectSelect.query(Author.class) - .where(Author.FIRSTNAME.eq("Paul")).selectOne(context); + .where(Author.NAME.eq("Paul")).selectOne(context); assertNull(expectedAuthor); } @Test public void givenAuthor_whenAttachingToArticle_thenTheRelationIsMade() { Author author = context.newObject(Author.class); - author.setFirstname("Paul"); - author.setLastname("Smith"); + author.setName("Paul"); Article article = context.newObject(Article.class); article.setTitle("My post title"); @@ -130,7 +121,7 @@ public class CayenneOperationTests { context.commitChanges(); Author expectedAuthor = ObjectSelect.query(Author.class) - .where(Author.LASTNAME.eq("Smith")) + .where(Author.NAME.eq("Paul")) .selectOne(context); Article expectedArticle = (expectedAuthor.getArticles()).get(0); From 5672ec1f2dfa511c2a2b58ac12e65cbc971b7d9e Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Thu, 5 Oct 2017 03:14:25 +0100 Subject: [PATCH 12/50] BAEL-1157: Apache Cayenne - Advanced Querying --- .../CayenneAdvancedOperationTests.java | 255 ++++++++++++++++++ 1 file changed, 255 insertions(+) create mode 100644 apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneAdvancedOperationTests.java diff --git a/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneAdvancedOperationTests.java b/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneAdvancedOperationTests.java new file mode 100644 index 0000000000..613ef757b4 --- /dev/null +++ b/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneAdvancedOperationTests.java @@ -0,0 +1,255 @@ +package com.baeldung.apachecayenne; + +import com.baeldung.apachecayenne.persistent.Article; +import com.baeldung.apachecayenne.persistent.Author; +import org.apache.cayenne.ObjectContext; +import org.apache.cayenne.configuration.server.ServerRuntime; +import org.apache.cayenne.query.ObjectSelect; +import org.apache.cayenne.query.SQLTemplate; +import org.apache.cayenne.query.SelectQuery; +import org.junit.After; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +import java.util.List; + +import static junit.framework.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class CayenneAdvancedOperationTests { + private static ObjectContext context = null; + + @BeforeClass + public static void setupTheCayenneContext() { + ServerRuntime cayenneRuntime = ServerRuntime.builder() + .addConfig("cayenne-project.xml") + .build(); + context = cayenneRuntime.newContext(); + } + + @Before + public void saveThreeAuthors() { + Author authorOne = context.newObject(Author.class); + authorOne.setName("Paul Xavier"); + Author authorTwo = context.newObject(Author.class); + authorTwo.setName("pAuL Smith"); + Author authorThree = context.newObject(Author.class); + authorThree.setName("Vicky Sarra"); + context.commitChanges(); + } + + @After + public void deleteAllAuthors() { + SQLTemplate deleteAuthors = new SQLTemplate(Author.class, "delete from author"); + context.performGenericQuery(deleteAuthors); + } + + @Test + public void givenAuthors_whenFindAllSQLTmplt_thenWeGetThreeAuthors() { + SQLTemplate select = new SQLTemplate(Author.class, "select * from Author"); + List authors = context.performQuery(select); + + assertEquals(authors.size(), 3); + } + + @Test + public void givenAuthors_whenFindByNameSQLTmplt_thenWeGetOneAuthor() { + SQLTemplate select = new SQLTemplate(Author.class, "select * from Author where name = 'Vicky Sarra'"); + List authors = context.performQuery(select); + Author author = authors.get(0); + + assertEquals(authors.size(), 1); + assertEquals(author.getName(), "Vicky Sarra"); + } + + @Test + public void givenAuthors_whenLikeSltQry_thenWeGetOneAuthor() { + Expression qualifier = ExpressionFactory.likeExp(Author.NAME.getName(), "Paul%"); + SelectQuery query = new SelectQuery(Author.class, qualifier); + List authorsTwo = context.performQuery(query); + + assertEquals(authorsTwo.size(), 1); + } + + @Test + public void givenAuthors_whenCtnsIgnorCaseSltQry_thenWeGetTwoAuthors() { + Expression qualifier = ExpressionFactory.containsIgnoreCaseExp(Author.NAME.getName(), "Paul"); + SelectQuery query = new SelectQuery(Author.class, qualifier); + List authors = context.performQuery(query); + + assertEquals(authors.size(), 2); + } + + @Test + public void givenAuthors_whenCtnsIgnorCaseEndsWSltQry_thenWeGetTwoAuthors() { + Expression qualifier = ExpressionFactory.containsIgnoreCaseExp(Author.NAME.getName(), "Paul") + .andExp(ExpressionFactory.endsWithExp(Author.NAME.getName(), "h")); + SelectQuery query = new SelectQuery(Author.class, qualifier); + List authors = context.performQuery(query); + + Author author = authors.get(0); + + assertEquals(authors.size(), 1); + assertEquals(author.getName(), "pAuL Smith"); + } + + @Test + public void givenAuthors_whenAscOrderingSltQry_thenWeGetOrderedAuthors() { + SelectQuery query = new SelectQuery(Author.class); + query.addOrdering(Author.NAME.asc()); + + List authors = query.select(context); + Author firstAuthor = authors.get(0); + + assertEquals(authors.size(), 3); + assertEquals(firstAuthor.getName(), "Paul Xavier"); + } + + @Test + public void givenAuthors_whenDescOrderingSltQry_thenWeGetOrderedAuthors() { + SelectQuery query = new SelectQuery(Author.class); + query.addOrdering(Author.NAME.desc()); + + List authors = query.select(context); + Author firstAuthor = authors.get(0); + + assertEquals(authors.size(), 3); + assertEquals(firstAuthor.getName(), "pAuL Smith"); + } + + @Test + public void givenAuthors_onContainsObjS_thenWeGetOneRecord() { + List authors = ObjectSelect.query(Author.class) + .where(Author.NAME.contains("Paul")) + .select(context); + + assertEquals(authors.size(), 1); + } + + @Test + public void givenAuthors_whenLikeObjS_thenWeGetTwoAuthors() { + List authors = ObjectSelect.query(Author.class) + .where(Author.NAME.likeIgnoreCase("Paul%")) + .select(context); + + assertEquals(authors.size(), 2); + } + + @Test + public void givenTwoAuthor_whenEndsWithObjS_thenWeGetOrderedAuthors() { + List authors = ObjectSelect.query(Author.class) + .where(Author.NAME.endsWith("Sarra")) + .select(context); + Author firstAuthor = authors.get(0); + + assertEquals(authors.size(), 1); + assertEquals(firstAuthor.getName(), "Vicky Sarra"); + } + + @Test + public void givenTwoAuthor_whenInObjS_thenWeGetAuthors() { + String [] args = {"Paul Xavier", "pAuL Smith", "Vicky Sarra"}; + List authors = ObjectSelect.query(Author.class) + .where(Author.NAME.in(Arrays.asList(args))) + .select(context); + + assertEquals(authors.size(), 3); + } + + @Test + public void givenTwoAuthor_whenNinObjS_thenWeGetAuthors() { + String [] args = {"Paul Xavier", "pAuL Smith"}; + List authors = ObjectSelect.query(Author.class) + .where(Author.NAME.nin(Arrays.asList(args))) + .select(context); + Author author = authors.get(0); + + assertEquals(authors.size(), 1); + assertEquals(author.getName(), "Vicky Sarra"); + } + + @Test + public void givenTwoAuthor_whenIsNotNullObjS_thenWeGetAuthors() { + List authors = ObjectSelect.query(Author.class) + .where(Author.NAME.isNotNull()) + .select(context); + + assertEquals(authors.size(), 3); + } + + @Test + public void givenAuthors_whenFindAllEJBQL_thenWeGetThreeAuthors() { + EJBQLQuery query = new EJBQLQuery("select a FROM Author a"); + List authors = context.performQuery(query); + + assertEquals(authors.size(), 3); + } + + @Test + public void givenAuthors_whenFindByNameEJBQL_thenWeGetOneAuthor() { + EJBQLQuery query = new EJBQLQuery("select a FROM Author a WHERE a.name = 'Vicky Sarra'"); + List authors = context.performQuery(query); + Author author = authors.get(0); + + assertEquals(authors.size(), 1); + assertEquals(author.getName(), "Vicky Sarra"); + } + + @Test + public void givenAuthors_whenUpdadingByNameEJBQL_thenWeGetTheUpdatedAuthor() { + EJBQLQuery query = new EJBQLQuery("UPDATE Author AS a SET a.name = 'Vicky Edison' WHERE a.name = 'Vicky Sarra'"); + QueryResponse queryResponse = context.performGenericQuery(query); + + EJBQLQuery queryUpdatedAuthor = new EJBQLQuery("select a FROM Author a WHERE a.name = 'Vicky Edison'"); + List authors = context.performQuery(queryUpdatedAuthor); + Author author = authors.get(0); + + assertNotNull(author); + } + + @Test + public void givenAuthors_whenSeletingNamesEJBQL_thenWeGetListWithSizeThree() { + String [] args = {"Paul Xavier", "pAuL Smith", "Vicky Sarra"}; + List names = Arrays.asList(args); + EJBQLQuery query = new EJBQLQuery("select a.name FROM Author a"); + List nameList = context.performQuery(query); + + Collections.sort(names); + Collections.sort(nameList); + + assertEquals(names.size(), 3); + assertEquals(nameList.size(), 3); + assertEquals(names, nameList); + } + + @Test + public void givenAuthors_whenDeletingAllWithEJB_thenWeGetNoAuthor() { + EJBQLQuery deleteQuery = new EJBQLQuery("delete FROM Author"); + EJBQLQuery findAllQuery = new EJBQLQuery("select a FROM Author a"); + + context.performQuery(deleteQuery); + List objects = context.performQuery(findAllQuery); + + assertEquals(objects.size(), 0); + } + + @Test + public void givenAuthors_whenInsertingSQLExec_thenWeGetNewAuthor() { + int inserted = SQLExec + .query("INSERT INTO Author (name) VALUES ('Baeldung')") + .update(context); + + assertEquals(inserted, 1); + } + + @Test + public void givenAuthors_whenUpdatingSQLExec_thenItsUpdated() { + int updated = SQLExec + .query("UPDATE Author SET name = 'Baeldung' WHERE name = 'Vicky Sarra'") + .update(context); + + assertEquals(updated, 1); + } +} From 0dbfa53ae074e42cf354cd3939e97edab50872f5 Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Thu, 5 Oct 2017 03:47:28 +0100 Subject: [PATCH 13/50] BAEL-1157: Fix imports --- .../CayenneAdvancedOperationTests.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneAdvancedOperationTests.java b/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneAdvancedOperationTests.java index 613ef757b4..ea10b59dd2 100644 --- a/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneAdvancedOperationTests.java +++ b/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneAdvancedOperationTests.java @@ -1,22 +1,23 @@ package com.baeldung.apachecayenne; -import com.baeldung.apachecayenne.persistent.Article; import com.baeldung.apachecayenne.persistent.Author; import org.apache.cayenne.ObjectContext; +import org.apache.cayenne.QueryResponse; import org.apache.cayenne.configuration.server.ServerRuntime; -import org.apache.cayenne.query.ObjectSelect; -import org.apache.cayenne.query.SQLTemplate; -import org.apache.cayenne.query.SelectQuery; +import org.apache.cayenne.exp.Expression; +import org.apache.cayenne.exp.ExpressionFactory; +import org.apache.cayenne.query.*; import org.junit.After; +import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; +import java.util.Arrays; +import java.util.Collections; import java.util.List; import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertNotNull; public class CayenneAdvancedOperationTests { private static ObjectContext context = null; From 3f825c5b96cbd7105820616774c988c1359eb344 Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Thu, 5 Oct 2017 04:17:56 +0100 Subject: [PATCH 14/50] BAEL-1157: code indentation --- .../CayenneAdvancedOperationTests.java | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneAdvancedOperationTests.java b/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneAdvancedOperationTests.java index ea10b59dd2..ddfe9325d3 100644 --- a/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneAdvancedOperationTests.java +++ b/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneAdvancedOperationTests.java @@ -25,8 +25,8 @@ public class CayenneAdvancedOperationTests { @BeforeClass public static void setupTheCayenneContext() { ServerRuntime cayenneRuntime = ServerRuntime.builder() - .addConfig("cayenne-project.xml") - .build(); + .addConfig("cayenne-project.xml") + .build(); context = cayenneRuntime.newContext(); } @@ -123,8 +123,8 @@ public class CayenneAdvancedOperationTests { @Test public void givenAuthors_onContainsObjS_thenWeGetOneRecord() { List authors = ObjectSelect.query(Author.class) - .where(Author.NAME.contains("Paul")) - .select(context); + .where(Author.NAME.contains("Paul")) + .select(context); assertEquals(authors.size(), 1); } @@ -132,8 +132,8 @@ public class CayenneAdvancedOperationTests { @Test public void givenAuthors_whenLikeObjS_thenWeGetTwoAuthors() { List authors = ObjectSelect.query(Author.class) - .where(Author.NAME.likeIgnoreCase("Paul%")) - .select(context); + .where(Author.NAME.likeIgnoreCase("Paul%")) + .select(context); assertEquals(authors.size(), 2); } @@ -141,8 +141,8 @@ public class CayenneAdvancedOperationTests { @Test public void givenTwoAuthor_whenEndsWithObjS_thenWeGetOrderedAuthors() { List authors = ObjectSelect.query(Author.class) - .where(Author.NAME.endsWith("Sarra")) - .select(context); + .where(Author.NAME.endsWith("Sarra")) + .select(context); Author firstAuthor = authors.get(0); assertEquals(authors.size(), 1); @@ -153,8 +153,8 @@ public class CayenneAdvancedOperationTests { public void givenTwoAuthor_whenInObjS_thenWeGetAuthors() { String [] args = {"Paul Xavier", "pAuL Smith", "Vicky Sarra"}; List authors = ObjectSelect.query(Author.class) - .where(Author.NAME.in(Arrays.asList(args))) - .select(context); + .where(Author.NAME.in(Arrays.asList(args))) + .select(context); assertEquals(authors.size(), 3); } @@ -163,8 +163,8 @@ public class CayenneAdvancedOperationTests { public void givenTwoAuthor_whenNinObjS_thenWeGetAuthors() { String [] args = {"Paul Xavier", "pAuL Smith"}; List authors = ObjectSelect.query(Author.class) - .where(Author.NAME.nin(Arrays.asList(args))) - .select(context); + .where(Author.NAME.nin(Arrays.asList(args))) + .select(context); Author author = authors.get(0); assertEquals(authors.size(), 1); @@ -174,8 +174,8 @@ public class CayenneAdvancedOperationTests { @Test public void givenTwoAuthor_whenIsNotNullObjS_thenWeGetAuthors() { List authors = ObjectSelect.query(Author.class) - .where(Author.NAME.isNotNull()) - .select(context); + .where(Author.NAME.isNotNull()) + .select(context); assertEquals(authors.size(), 3); } @@ -239,8 +239,8 @@ public class CayenneAdvancedOperationTests { @Test public void givenAuthors_whenInsertingSQLExec_thenWeGetNewAuthor() { int inserted = SQLExec - .query("INSERT INTO Author (name) VALUES ('Baeldung')") - .update(context); + .query("INSERT INTO Author (name) VALUES ('Baeldung')") + .update(context); assertEquals(inserted, 1); } @@ -248,8 +248,8 @@ public class CayenneAdvancedOperationTests { @Test public void givenAuthors_whenUpdatingSQLExec_thenItsUpdated() { int updated = SQLExec - .query("UPDATE Author SET name = 'Baeldung' WHERE name = 'Vicky Sarra'") - .update(context); + .query("UPDATE Author SET name = 'Baeldung' WHERE name = 'Vicky Sarra'") + .update(context); assertEquals(updated, 1); } From efc58b5b79d25b0a3624da95a9ef6c200bd6d830 Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Mon, 9 Oct 2017 17:31:54 +0100 Subject: [PATCH 15/50] BAEL-1157: Update list of author names --- .../apachecayenne/CayenneAdvancedOperationTests.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneAdvancedOperationTests.java b/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneAdvancedOperationTests.java index ddfe9325d3..cd563b6270 100644 --- a/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneAdvancedOperationTests.java +++ b/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneAdvancedOperationTests.java @@ -151,20 +151,20 @@ public class CayenneAdvancedOperationTests { @Test public void givenTwoAuthor_whenInObjS_thenWeGetAuthors() { - String [] args = {"Paul Xavier", "pAuL Smith", "Vicky Sarra"}; + List names = Arrays.asList("Paul Xavier", "pAuL Smith", "Vicky Sarra"); List authors = ObjectSelect.query(Author.class) - .where(Author.NAME.in(Arrays.asList(args))) - .select(context); + .where(Author.NAME.in(names)) + .select(context); assertEquals(authors.size(), 3); } @Test public void givenTwoAuthor_whenNinObjS_thenWeGetAuthors() { - String [] args = {"Paul Xavier", "pAuL Smith"}; + List names = Arrays.asList("Paul Xavier", "pAuL Smith"); List authors = ObjectSelect.query(Author.class) - .where(Author.NAME.nin(Arrays.asList(args))) - .select(context); + .where(Author.NAME.nin(names)) + .select(context); Author author = authors.get(0); assertEquals(authors.size(), 1); From c3a2179b9bcfb07fb3603cfc76be735e8924e41c Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Sun, 22 Oct 2017 03:45:08 +0100 Subject: [PATCH 16/50] BAEL-132: Configure Jenkins to Run and Show Jmeter Tests --- pom.xml | 1 + spring-jmeter-jenkins | 1 + 2 files changed, 2 insertions(+) create mode 160000 spring-jmeter-jenkins diff --git a/pom.xml b/pom.xml index c3915e4fce..996ca91f2e 100644 --- a/pom.xml +++ b/pom.xml @@ -168,6 +168,7 @@ spring-hibernate5 spring-integration spring-jersey + spring-jmeter-jenkins spring-jms spring-jooq spring-jpa diff --git a/spring-jmeter-jenkins b/spring-jmeter-jenkins new file mode 160000 index 0000000000..a1b44b4c48 --- /dev/null +++ b/spring-jmeter-jenkins @@ -0,0 +1 @@ +Subproject commit a1b44b4c487164577be3c7eb4bf215d39a0700df From 0623fb5b172c5637b93627d02b4ad218d83d8075 Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Sun, 22 Oct 2017 16:14:18 +0100 Subject: [PATCH 17/50] Removed submodule spring-jmeter-jenkins --- spring-jmeter-jenkins | 1 - 1 file changed, 1 deletion(-) delete mode 160000 spring-jmeter-jenkins diff --git a/spring-jmeter-jenkins b/spring-jmeter-jenkins deleted file mode 160000 index a1b44b4c48..0000000000 --- a/spring-jmeter-jenkins +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a1b44b4c487164577be3c7eb4bf215d39a0700df From 3d0fe787cfaee47105b1b1305bc376afec6aeabd Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Sun, 22 Oct 2017 16:15:50 +0100 Subject: [PATCH 18/50] Commit again spring-jmeter-jenkins --- spring-jmeter-jenkins/.gitignore | 24 ++ .../.mvn/wrapper/maven-wrapper.jar | Bin 0 -> 49502 bytes .../.mvn/wrapper/maven-wrapper.properties | 1 + spring-jmeter-jenkins/README.md | 55 +++++ spring-jmeter-jenkins/mvnw | 233 ++++++++++++++++++ spring-jmeter-jenkins/mvnw.cmd | 145 +++++++++++ spring-jmeter-jenkins/pom.xml | 52 ++++ .../SpringJMeterJenkinsApplication.java | 13 + .../java/com/baeldung/domain/Student.java | 66 +++++ .../repository/StudentRepository.java | 7 + .../src/main/resources/JMeter-Jenkins.jmx | 96 ++++++++ .../src/main/resources/application.properties | 14 ++ .../SpringJMeterJenkinsApplicationTests.java | 16 ++ 13 files changed, 722 insertions(+) create mode 100644 spring-jmeter-jenkins/.gitignore create mode 100644 spring-jmeter-jenkins/.mvn/wrapper/maven-wrapper.jar create mode 100644 spring-jmeter-jenkins/.mvn/wrapper/maven-wrapper.properties create mode 100644 spring-jmeter-jenkins/README.md create mode 100755 spring-jmeter-jenkins/mvnw create mode 100644 spring-jmeter-jenkins/mvnw.cmd create mode 100644 spring-jmeter-jenkins/pom.xml create mode 100644 spring-jmeter-jenkins/src/main/java/com/baeldung/SpringJMeterJenkinsApplication.java create mode 100644 spring-jmeter-jenkins/src/main/java/com/baeldung/domain/Student.java create mode 100644 spring-jmeter-jenkins/src/main/java/com/baeldung/repository/StudentRepository.java create mode 100644 spring-jmeter-jenkins/src/main/resources/JMeter-Jenkins.jmx create mode 100644 spring-jmeter-jenkins/src/main/resources/application.properties create mode 100644 spring-jmeter-jenkins/src/test/java/com/baeldung/SpringJMeterJenkinsApplicationTests.java diff --git a/spring-jmeter-jenkins/.gitignore b/spring-jmeter-jenkins/.gitignore new file mode 100644 index 0000000000..2af7cefb0a --- /dev/null +++ b/spring-jmeter-jenkins/.gitignore @@ -0,0 +1,24 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +nbproject/private/ +build/ +nbbuild/ +dist/ +nbdist/ +.nb-gradle/ \ No newline at end of file diff --git a/spring-jmeter-jenkins/.mvn/wrapper/maven-wrapper.jar b/spring-jmeter-jenkins/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..5fd4d5023f1463b5ba3970e33c460c1eb26d748d GIT binary patch literal 49502 zcmb@tV|1n6wzeBvGe*U>ZQHh;%-Bg)Y}={WHY%yuwkkF%MnzxVwRUS~wY|@J_gP;% z^VfXZ{5793?z><89(^dufT2xlYVOQnYG>@?lA@vQF|UF0&X7tk8BUf?wq2J& zZe&>>paKUg4@;fwk0yeUPvM$yk)=f>TSFFB^a8f|_@mbE#MaBnd5qf6;hXq}c%IeK zn7gB0Kldbedq-vl@2wxJi{$%lufroKUjQLSFmt|<;M8~<5otM5ur#Dgc@ivmwRiYZW(Oco7kb8DWmo|a{coqYMU2raB9r6e9viK6MI3c&%jp05-Tf*O#6@8Ra=egYy01 z-V!G;_omANEvU-8!*>*)lWka9M<+IkNsrsenbXOfLc6qrYe`;lpst;vfs*70$z9UM zq%L>pFCOr$X*|9&3L2h;?VA9-IU*iR6FiGlJ=b~DzE5s^thxXUs4%~*zD#K&k>wZAU8 zpaa!M+Z-zjkfGK15N!&o<3=cgbZV7%ex@j^)Q9V`q^i;Fsbkbe6eHJ;dx{QbdCCs1 zdxq^WxoPsr`eiK3D0Ep}k$ank-0G&+lY!ZHDZBYEx%% z2FyE?Lb0cflLB)kDIj;G=m`^UO<4h(RWdF-DT>p{1J5J90!K!AgC0)?jxPbm$KUjg zJED+#7xQmAmr`(S%BQTV-c97As~r3zD$E;3S)@}p5udA@m6pLgRL5h-;m>LvCq?&Q zokC7Vnk-zBEaa;=Y;6(LJHS>mOJV&%0YfRdUOqbKZy~b z(905jIW0Pg;y`Yv2t+RnDvL4yGEUX*tK)JT6TWn4ik~L)fX#tAV!d8)+A)qWtSjcr z7s|f%f;*%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Zvn2mk*LWvgsJNdYFw~S!X4cFe+Q;Q-_W%N z9+%cg5D+rIfU$v>NB;`!-|$Y|w(+s#2VpgER|yU}|IL~d1DHEF1OAnnMj?dmwqP?|!Tm)27hExl-^LX;b^(CT z!UODGtX!?!0czl=9(xOLEjt>6{g40iN!)JVBc;&q!{D7LBTNX0>kPC%g@yXJ??CR3 z^oF;AH}dO}OTni1fx&;Ra!+t5|8G{gf|ZL4*w`O!41NfJAE&N>zi#R(&V#)+FzyN% z_g90{z|?BLiTfv@hp{u@$1u7B_-1N#iJ#RBzM2BR!2c8QKQ->n9NpJB+kXlz_@(`y zApg-W%GVs=-$=u6Jp_Mfr34rf;5=qxnT`lG`0>Z&B#n)_ODW`1+jPPicN} zhgOBZJau)7R=(j9e&@_!Y{d>iX#+|6|i>`&Q={(}Kji+O zpFcjFOMd9Ss|3O?C362PVeDvZY6)PztKhZE=cg?HTJXn${I25H4xgVwR(eM*+@Z8Irh^0H1^@(vM%fLB8x9<0IcS*cf20Th OJOEd-=rxTO#Qy`$*1Hh^ literal 0 HcmV?d00001 diff --git a/spring-jmeter-jenkins/.mvn/wrapper/maven-wrapper.properties b/spring-jmeter-jenkins/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000..c954cec91c --- /dev/null +++ b/spring-jmeter-jenkins/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip diff --git a/spring-jmeter-jenkins/README.md b/spring-jmeter-jenkins/README.md new file mode 100644 index 0000000000..49c18122a2 --- /dev/null +++ b/spring-jmeter-jenkins/README.md @@ -0,0 +1,55 @@ +BASIC CRUD API with Spring Boot +================================ + +This is the code of a simple API for some CRUD operations realised for a seminar at [FGI](www.fgi-ud.org) using Spring Boot. + +### Demo +* API: The online version **is**/**will be** hosted here: https://fgi-tcheck.herokuapp.com +* Mobile version is also opensource and located here: https://github.com/valdesekamdem/tcheck-mobile + +### Features +#### Currently Implemented +* CRUD + * Student + +#### To DO +* Validations of input with: [Spring Data Rest Validators](http://docs.spring.io/spring-data/rest/docs/2.1.0.RELEASE/reference/html/validation-chapter.html) + + +### Requirements + +- Maven +- JDK 8 +- MongoDB + +### Running + +To build and start the server simply type + +```bash +$ mvn clean install +$ mvn spring-boot:run -Dserver.port=8989 +``` + +### Available CRUD + +You can see what crud operation are available using curl: + +```bash +$ curl localhost:8080 +``` +You can view existing student objects with this command: + +```bash +$ curl localhost:8080/students +``` +Or create a new one via a POST: + +```bash +$ curl -X POST -H "Content-Type:application/json" -d '{ "firstName" : "Dassi", "lastName" : "Orleando", "phoneNumber": "+237 545454545", "email": "mymail@yahoo.fr" }' localhost:8080/students +``` + + +Now with default configurations it will be available at: [http://localhost:8080](http://localhost:8080) + +Enjoy it :) \ No newline at end of file diff --git a/spring-jmeter-jenkins/mvnw b/spring-jmeter-jenkins/mvnw new file mode 100755 index 0000000000..a1ba1bf554 --- /dev/null +++ b/spring-jmeter-jenkins/mvnw @@ -0,0 +1,233 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven2 Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # + # Look for the Apple JDKs first to preserve the existing behaviour, and then look + # for the new JDKs provided by Oracle. + # + if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then + # + # Apple JDKs + # + export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then + # + # Apple JDKs + # + export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then + # + # Oracle JDKs + # + export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then + # + # Apple JDKs + # + export JAVA_HOME=`/usr/libexec/java_home` + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Migwn, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" + # TODO classpath? +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` +fi + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + local basedir=$(pwd) + local wdir=$(pwd) + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + wdir=$(cd "$wdir/.."; pwd) + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} "$@" diff --git a/spring-jmeter-jenkins/mvnw.cmd b/spring-jmeter-jenkins/mvnw.cmd new file mode 100644 index 0000000000..2b934e89dd --- /dev/null +++ b/spring-jmeter-jenkins/mvnw.cmd @@ -0,0 +1,145 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven2 Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +set MAVEN_CMD_LINE_ARGS=%* + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" + +set WRAPPER_JAR="".\.mvn\wrapper\maven-wrapper.jar"" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% \ No newline at end of file diff --git a/spring-jmeter-jenkins/pom.xml b/spring-jmeter-jenkins/pom.xml new file mode 100644 index 0000000000..38b5f98e45 --- /dev/null +++ b/spring-jmeter-jenkins/pom.xml @@ -0,0 +1,52 @@ + + + 4.0.0 + + spring-jmeter-jenkins + 0.0.1-SNAPSHOT + jar + + spring-jmeter-jenkins + Run and Show JMeter test with Jenkins + + + parent-boot-5 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-5 + + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-data-mongodb + + + org.springframework.boot + spring-boot-starter-data-rest + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + diff --git a/spring-jmeter-jenkins/src/main/java/com/baeldung/SpringJMeterJenkinsApplication.java b/spring-jmeter-jenkins/src/main/java/com/baeldung/SpringJMeterJenkinsApplication.java new file mode 100644 index 0000000000..3bc1f64f41 --- /dev/null +++ b/spring-jmeter-jenkins/src/main/java/com/baeldung/SpringJMeterJenkinsApplication.java @@ -0,0 +1,13 @@ +package com.baeldung; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; + +@SpringBootApplication +@EnableMongoRepositories +public class SpringJMeterJenkinsApplication { + public static void main(String[] args) { + SpringApplication.run(SpringJMeterJenkinsApplication.class, args); + } +} diff --git a/spring-jmeter-jenkins/src/main/java/com/baeldung/domain/Student.java b/spring-jmeter-jenkins/src/main/java/com/baeldung/domain/Student.java new file mode 100644 index 0000000000..0f6150fc48 --- /dev/null +++ b/spring-jmeter-jenkins/src/main/java/com/baeldung/domain/Student.java @@ -0,0 +1,66 @@ +package com.baeldung.domain; + +import javax.validation.constraints.NotNull; +import org.springframework.data.annotation.Id; +import org.springframework.data.mongodb.core.mapping.Document; + +import java.io.Serializable; + +@Document(collection = "STUDENT") +public class Student implements Serializable { + + @Id + private String id; + @NotNull + private String firstName; + private String lastName; + @NotNull + private String phoneNumber; + private String email; + + public String getId() { + return id; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + @Override + public String toString() { + return "Student{" + + "firstName='" + firstName + '\'' + + ", lastName='" + lastName + '\'' + + ", phoneNumber='" + phoneNumber + '\'' + + ", email='" + email + '\'' + + '}'; + } +} diff --git a/spring-jmeter-jenkins/src/main/java/com/baeldung/repository/StudentRepository.java b/spring-jmeter-jenkins/src/main/java/com/baeldung/repository/StudentRepository.java new file mode 100644 index 0000000000..d0ca7d8510 --- /dev/null +++ b/spring-jmeter-jenkins/src/main/java/com/baeldung/repository/StudentRepository.java @@ -0,0 +1,7 @@ +package com.baeldung.repository; + +import org.springframework.data.mongodb.repository.MongoRepository; +import com.baeldung.domain.Student; + +public interface StudentRepository extends MongoRepository { +} diff --git a/spring-jmeter-jenkins/src/main/resources/JMeter-Jenkins.jmx b/spring-jmeter-jenkins/src/main/resources/JMeter-Jenkins.jmx new file mode 100644 index 0000000000..49ce2dec1d --- /dev/null +++ b/spring-jmeter-jenkins/src/main/resources/JMeter-Jenkins.jmx @@ -0,0 +1,96 @@ + + + + + + false + false + + + + + + + + continue + + false + 1 + + 5 + 1 + 1507776008000 + 1507776008000 + false + + + + + + + + + localhost + 8989 + + + /students + GET + true + false + true + false + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + 10 + + + + + + + true + + + + diff --git a/spring-jmeter-jenkins/src/main/resources/application.properties b/spring-jmeter-jenkins/src/main/resources/application.properties new file mode 100644 index 0000000000..c7d86e14b0 --- /dev/null +++ b/spring-jmeter-jenkins/src/main/resources/application.properties @@ -0,0 +1,14 @@ +# the db host +spring.data.mongodb.host=localhost +# the connection port (defaults to 27107) +spring.data.mongodb.port=27017 +# The database's name +spring.data.mongodb.database=JMeter-Jenkins + +# Or this +# spring.data.mongodb.uri=mongodb://localhost/JMeter-Jenkins + +# spring.data.mongodb.username= +# spring.data.mongodb.password= + +spring.data.mongodb.repositories.enabled=true \ No newline at end of file diff --git a/spring-jmeter-jenkins/src/test/java/com/baeldung/SpringJMeterJenkinsApplicationTests.java b/spring-jmeter-jenkins/src/test/java/com/baeldung/SpringJMeterJenkinsApplicationTests.java new file mode 100644 index 0000000000..b39a5605b1 --- /dev/null +++ b/spring-jmeter-jenkins/src/test/java/com/baeldung/SpringJMeterJenkinsApplicationTests.java @@ -0,0 +1,16 @@ +package com.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class SpringJMeterJenkinsApplicationTests { + + @Test + public void contextLoads() { + } + +} From 29fe38bfdeea959588886487c3728573c2b0bb66 Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Wed, 15 Nov 2017 05:09:41 +0100 Subject: [PATCH 19/50] BAEL-1190: JUnit 5 upgrade --- testing-modules/junit-5/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing-modules/junit-5/pom.xml b/testing-modules/junit-5/pom.xml index 229703ccf5..2be8937d04 100644 --- a/testing-modules/junit-5/pom.xml +++ b/testing-modules/junit-5/pom.xml @@ -20,7 +20,7 @@ UTF-8 1.8 - 5.0.1 + 5.0.2 1.0.1 4.12.1 2.8.2 @@ -127,4 +127,4 @@ - \ No newline at end of file + From 4bf7fb23f665f4b29883ad0df53e0c86bb540fc0 Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Wed, 29 Nov 2017 04:30:45 +0100 Subject: [PATCH 20/50] BAEL-720: Intro to Jenkins 2 and the power of pipelines --- pom.xml | 1 + spring-jenkins-pipeline/.gitignore | 24 ++ .../.mvn/wrapper/maven-wrapper.jar | Bin 0 -> 49502 bytes .../.mvn/wrapper/maven-wrapper.properties | 1 + spring-jenkins-pipeline/README.md | 23 ++ spring-jenkins-pipeline/mvnw | 233 ++++++++++++++++++ spring-jenkins-pipeline/mvnw.cmd | 145 +++++++++++ spring-jenkins-pipeline/pom.xml | 97 ++++++++ .../SpringJenkinsPipelineApplication.java | 13 + .../java/com/baeldung/domain/Student.java | 73 ++++++ .../repository/StudentRepository.java | 7 + .../src/main/resources/application.properties | 14 ++ .../com/baeldung/SomeIntegrationTest.java | 37 +++ .../test/java/com/baeldung/SomeUnitTest.java | 11 + spring-jmeter-jenkins/README.md | 16 +- 15 files changed, 680 insertions(+), 15 deletions(-) create mode 100644 spring-jenkins-pipeline/.gitignore create mode 100644 spring-jenkins-pipeline/.mvn/wrapper/maven-wrapper.jar create mode 100644 spring-jenkins-pipeline/.mvn/wrapper/maven-wrapper.properties create mode 100644 spring-jenkins-pipeline/README.md create mode 100755 spring-jenkins-pipeline/mvnw create mode 100644 spring-jenkins-pipeline/mvnw.cmd create mode 100644 spring-jenkins-pipeline/pom.xml create mode 100644 spring-jenkins-pipeline/src/main/java/com/baeldung/SpringJenkinsPipelineApplication.java create mode 100644 spring-jenkins-pipeline/src/main/java/com/baeldung/domain/Student.java create mode 100644 spring-jenkins-pipeline/src/main/java/com/baeldung/repository/StudentRepository.java create mode 100644 spring-jenkins-pipeline/src/main/resources/application.properties create mode 100644 spring-jenkins-pipeline/src/test/java/com/baeldung/SomeIntegrationTest.java create mode 100644 spring-jenkins-pipeline/src/test/java/com/baeldung/SomeUnitTest.java diff --git a/pom.xml b/pom.xml index 20f7c4ffad..827c4ee4cf 100644 --- a/pom.xml +++ b/pom.xml @@ -173,6 +173,7 @@ spring-hibernate4 persistence-modules/spring-hibernate-5 spring-integration + spring-jenkins-pipeline spring-jersey spring-jmeter-jenkins spring-jms diff --git a/spring-jenkins-pipeline/.gitignore b/spring-jenkins-pipeline/.gitignore new file mode 100644 index 0000000000..2af7cefb0a --- /dev/null +++ b/spring-jenkins-pipeline/.gitignore @@ -0,0 +1,24 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +nbproject/private/ +build/ +nbbuild/ +dist/ +nbdist/ +.nb-gradle/ \ No newline at end of file diff --git a/spring-jenkins-pipeline/.mvn/wrapper/maven-wrapper.jar b/spring-jenkins-pipeline/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..5fd4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??CR3 z^oF;AH}dO}OTni1fx&;Ra!+t5|8G{gf|ZL4*w`O!41NfJAE&N>zi#R(&V#)+FzyN% z_g90{z|?BLiTfv@hp{u@$1u7B_-1N#iJ#RBzM2BR!2c8QKQ->n9NpJB+kXlz_@(`y zApg-W%GVs=-$=u6Jp_Mfr34rf;5=qxnT`lG`0>Z&B#n)_ODW`1+jPPicN} zhgOBZJau)7R=(j9e&@_!Y{d>iX#+|6|i>`&Q={(}Kji+O zpFcjFOMd9Ss|3O?C362PVeDvZY6)PztKhZE=cg?HTJXn${I25H4xgVwR(eM*+@Z8Irh^0H1^@(vM%fLB8x9<0IcS*cf20Th OJOEd-=rxTO#Qy`$*1Hh^ literal 0 HcmV?d00001 diff --git a/spring-jenkins-pipeline/.mvn/wrapper/maven-wrapper.properties b/spring-jenkins-pipeline/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000..c954cec91c --- /dev/null +++ b/spring-jenkins-pipeline/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip diff --git a/spring-jenkins-pipeline/README.md b/spring-jenkins-pipeline/README.md new file mode 100644 index 0000000000..7e562664e6 --- /dev/null +++ b/spring-jenkins-pipeline/README.md @@ -0,0 +1,23 @@ +BASIC CRUD API with Spring Boot +================================ + +This is the code of a simple API for some CRUD operations build using Spring Boot. + +### Requirements + +- Maven +- JDK 8 +- MongoDB + +### Running + +To build and start the server simply type + +```bash +$ mvn clean install +$ mvn spring-boot:run -Dserver.port=8989 +``` + +Now with default configurations it will be available at: [http://localhost:8080](http://localhost:8080) + +Enjoy it :) \ No newline at end of file diff --git a/spring-jenkins-pipeline/mvnw b/spring-jenkins-pipeline/mvnw new file mode 100755 index 0000000000..a1ba1bf554 --- /dev/null +++ b/spring-jenkins-pipeline/mvnw @@ -0,0 +1,233 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven2 Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # + # Look for the Apple JDKs first to preserve the existing behaviour, and then look + # for the new JDKs provided by Oracle. + # + if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then + # + # Apple JDKs + # + export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then + # + # Apple JDKs + # + export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then + # + # Oracle JDKs + # + export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then + # + # Apple JDKs + # + export JAVA_HOME=`/usr/libexec/java_home` + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Migwn, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" + # TODO classpath? +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` +fi + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + local basedir=$(pwd) + local wdir=$(pwd) + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + wdir=$(cd "$wdir/.."; pwd) + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} "$@" diff --git a/spring-jenkins-pipeline/mvnw.cmd b/spring-jenkins-pipeline/mvnw.cmd new file mode 100644 index 0000000000..2b934e89dd --- /dev/null +++ b/spring-jenkins-pipeline/mvnw.cmd @@ -0,0 +1,145 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven2 Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +set MAVEN_CMD_LINE_ARGS=%* + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" + +set WRAPPER_JAR="".\.mvn\wrapper\maven-wrapper.jar"" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% \ No newline at end of file diff --git a/spring-jenkins-pipeline/pom.xml b/spring-jenkins-pipeline/pom.xml new file mode 100644 index 0000000000..1c35f0f73b --- /dev/null +++ b/spring-jenkins-pipeline/pom.xml @@ -0,0 +1,97 @@ + + + 4.0.0 + + spring-jenkins-pipeline + 0.0.1-SNAPSHOT + jar + + spring-jenkins-pipeline + Intro to Jenkins 2 and the power of pipelines + + + parent-boot-5 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-5 + + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-data-mongodb + + + org.springframework.boot + spring-boot-starter-data-rest + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-checkstyle-plugin + 2.17 + + + + + + + integration + + + + maven-surefire-plugin + + + **/*UnitTest.java + + + + **/*IntegrationTest.java + + + + + + + + + unit + + + + maven-surefire-plugin + + + **/*IntegrationTest.java + + + + **/*UnitTest.java + + + + + + + + diff --git a/spring-jenkins-pipeline/src/main/java/com/baeldung/SpringJenkinsPipelineApplication.java b/spring-jenkins-pipeline/src/main/java/com/baeldung/SpringJenkinsPipelineApplication.java new file mode 100644 index 0000000000..fcf4fde414 --- /dev/null +++ b/spring-jenkins-pipeline/src/main/java/com/baeldung/SpringJenkinsPipelineApplication.java @@ -0,0 +1,13 @@ +package com.baeldung; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; + +@SpringBootApplication +@EnableMongoRepositories +public class SpringJenkinsPipelineApplication { + public static void main(String[] args) { + SpringApplication.run(SpringJenkinsPipelineApplication.class, args); + } +} diff --git a/spring-jenkins-pipeline/src/main/java/com/baeldung/domain/Student.java b/spring-jenkins-pipeline/src/main/java/com/baeldung/domain/Student.java new file mode 100644 index 0000000000..3d1dd27b0e --- /dev/null +++ b/spring-jenkins-pipeline/src/main/java/com/baeldung/domain/Student.java @@ -0,0 +1,73 @@ +package com.baeldung.domain; + +import javax.validation.constraints.NotNull; +import org.springframework.data.annotation.Id; +import org.springframework.data.mongodb.core.mapping.Document; + +import java.io.Serializable; + +@Document(collection = "STUDENT") +public class Student implements Serializable { + + @Id + private String id; + @NotNull + private String firstName; + private String lastName; + @NotNull + private String phoneNumber; + private String email; + + public Student(String firstName, String lastName, String phoneNumber, String email) { + this.firstName = firstName; + this.lastName = lastName; + this.phoneNumber = phoneNumber; + this.email = email; + } + + public String getId() { + return id; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + @Override + public String toString() { + return "Student{" + + "firstName='" + firstName + '\'' + + ", lastName='" + lastName + '\'' + + ", phoneNumber='" + phoneNumber + '\'' + + ", email='" + email + '\'' + + '}'; + } +} diff --git a/spring-jenkins-pipeline/src/main/java/com/baeldung/repository/StudentRepository.java b/spring-jenkins-pipeline/src/main/java/com/baeldung/repository/StudentRepository.java new file mode 100644 index 0000000000..d0ca7d8510 --- /dev/null +++ b/spring-jenkins-pipeline/src/main/java/com/baeldung/repository/StudentRepository.java @@ -0,0 +1,7 @@ +package com.baeldung.repository; + +import org.springframework.data.mongodb.repository.MongoRepository; +import com.baeldung.domain.Student; + +public interface StudentRepository extends MongoRepository { +} diff --git a/spring-jenkins-pipeline/src/main/resources/application.properties b/spring-jenkins-pipeline/src/main/resources/application.properties new file mode 100644 index 0000000000..b6bfd8f6f3 --- /dev/null +++ b/spring-jenkins-pipeline/src/main/resources/application.properties @@ -0,0 +1,14 @@ +# the db host +spring.data.mongodb.host=localhost +# the connection port (defaults to 27107) +spring.data.mongodb.port=27017 +# The database's name +spring.data.mongodb.database=Jenkins-Pipeline + +# Or this +# spring.data.mongodb.uri=mongodb://localhost/Jenkins-Pipeline + +# spring.data.mongodb.username= +# spring.data.mongodb.password= + +spring.data.mongodb.repositories.enabled=true \ No newline at end of file diff --git a/spring-jenkins-pipeline/src/test/java/com/baeldung/SomeIntegrationTest.java b/spring-jenkins-pipeline/src/test/java/com/baeldung/SomeIntegrationTest.java new file mode 100644 index 0000000000..dd8a234d1d --- /dev/null +++ b/spring-jenkins-pipeline/src/test/java/com/baeldung/SomeIntegrationTest.java @@ -0,0 +1,37 @@ +package com.baeldung; + +import com.baeldung.domain.Student; +import com.baeldung.repository.StudentRepository; +import org.junit.After; +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.test.context.junit4.SpringJUnit4ClassRunner; +import static org.junit.Assert.*; + +@RunWith(SpringJUnit4ClassRunner.class) +@SpringBootTest +public class SomeIntegrationTest { + @Autowired + private StudentRepository studentRepository; + + @Before + public void setup() { + Student student = new Student("Paul", "Smith", "64377473774", "me@mymail.com"); + studentRepository.save(student); + } + + @Test + public void testDB() { + long count = studentRepository.count(); + + assertNotEquals(0, count); + } + + @After + public void clean() { + studentRepository.deleteAll(); + } +} diff --git a/spring-jenkins-pipeline/src/test/java/com/baeldung/SomeUnitTest.java b/spring-jenkins-pipeline/src/test/java/com/baeldung/SomeUnitTest.java new file mode 100644 index 0000000000..ea317ed7cd --- /dev/null +++ b/spring-jenkins-pipeline/src/test/java/com/baeldung/SomeUnitTest.java @@ -0,0 +1,11 @@ +package com.baeldung; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class SomeUnitTest { + @Test + public void init() { + assertEquals(1, 1); + } +} diff --git a/spring-jmeter-jenkins/README.md b/spring-jmeter-jenkins/README.md index 49c18122a2..dec8364647 100644 --- a/spring-jmeter-jenkins/README.md +++ b/spring-jmeter-jenkins/README.md @@ -1,20 +1,7 @@ BASIC CRUD API with Spring Boot ================================ -This is the code of a simple API for some CRUD operations realised for a seminar at [FGI](www.fgi-ud.org) using Spring Boot. - -### Demo -* API: The online version **is**/**will be** hosted here: https://fgi-tcheck.herokuapp.com -* Mobile version is also opensource and located here: https://github.com/valdesekamdem/tcheck-mobile - -### Features -#### Currently Implemented -* CRUD - * Student - -#### To DO -* Validations of input with: [Spring Data Rest Validators](http://docs.spring.io/spring-data/rest/docs/2.1.0.RELEASE/reference/html/validation-chapter.html) - +This is the code of a simple API for some CRUD operations build using Spring Boot. ### Requirements @@ -49,7 +36,6 @@ Or create a new one via a POST: $ curl -X POST -H "Content-Type:application/json" -d '{ "firstName" : "Dassi", "lastName" : "Orleando", "phoneNumber": "+237 545454545", "email": "mymail@yahoo.fr" }' localhost:8080/students ``` - Now with default configurations it will be available at: [http://localhost:8080](http://localhost:8080) Enjoy it :) \ No newline at end of file From eb33074a0ee4a31c538e4523367a80a9c3c63cc6 Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Wed, 29 Nov 2017 05:30:56 +0100 Subject: [PATCH 21/50] Simulate false unit test --- .../src/test/java/com/baeldung/SomeUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-jenkins-pipeline/src/test/java/com/baeldung/SomeUnitTest.java b/spring-jenkins-pipeline/src/test/java/com/baeldung/SomeUnitTest.java index ea317ed7cd..1e0fc985c3 100644 --- a/spring-jenkins-pipeline/src/test/java/com/baeldung/SomeUnitTest.java +++ b/spring-jenkins-pipeline/src/test/java/com/baeldung/SomeUnitTest.java @@ -6,6 +6,6 @@ import static org.junit.Assert.*; public class SomeUnitTest { @Test public void init() { - assertEquals(1, 1); + assertEquals(1, 0); } } From 3d49c4a4b6d5c7eeeab9f5203701b19e198873b4 Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Thu, 30 Nov 2017 04:58:55 +0100 Subject: [PATCH 22/50] Disable failded build for unsuccesful test --- spring-jenkins-pipeline/pom.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spring-jenkins-pipeline/pom.xml b/spring-jenkins-pipeline/pom.xml index 1c35f0f73b..5ebc7540d6 100644 --- a/spring-jenkins-pipeline/pom.xml +++ b/spring-jenkins-pipeline/pom.xml @@ -50,6 +50,13 @@ maven-checkstyle-plugin 2.17 + + org.apache.maven.plugins + maven-surefire-plugin + + true + + From 138e7fd492bbd611603ef2423c272a260563a2e8 Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Thu, 30 Nov 2017 05:52:28 +0100 Subject: [PATCH 23/50] Let the build failed if the test is not Ok --- spring-jenkins-pipeline/pom.xml | 7 ------- .../src/test/java/com/baeldung/SomeUnitTest.java | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/spring-jenkins-pipeline/pom.xml b/spring-jenkins-pipeline/pom.xml index 5ebc7540d6..1c35f0f73b 100644 --- a/spring-jenkins-pipeline/pom.xml +++ b/spring-jenkins-pipeline/pom.xml @@ -50,13 +50,6 @@ maven-checkstyle-plugin 2.17 - - org.apache.maven.plugins - maven-surefire-plugin - - true - - diff --git a/spring-jenkins-pipeline/src/test/java/com/baeldung/SomeUnitTest.java b/spring-jenkins-pipeline/src/test/java/com/baeldung/SomeUnitTest.java index 1e0fc985c3..ea317ed7cd 100644 --- a/spring-jenkins-pipeline/src/test/java/com/baeldung/SomeUnitTest.java +++ b/spring-jenkins-pipeline/src/test/java/com/baeldung/SomeUnitTest.java @@ -6,6 +6,6 @@ import static org.junit.Assert.*; public class SomeUnitTest { @Test public void init() { - assertEquals(1, 0); + assertEquals(1, 1); } } From 235ea3eb782e2bc2ba3587cbc836268263d7d294 Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Fri, 1 Dec 2017 06:31:30 +0100 Subject: [PATCH 24/50] Formating --- .../src/test/java/com/baeldung/SomeIntegrationTest.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spring-jenkins-pipeline/src/test/java/com/baeldung/SomeIntegrationTest.java b/spring-jenkins-pipeline/src/test/java/com/baeldung/SomeIntegrationTest.java index dd8a234d1d..092ebb93fd 100644 --- a/spring-jenkins-pipeline/src/test/java/com/baeldung/SomeIntegrationTest.java +++ b/spring-jenkins-pipeline/src/test/java/com/baeldung/SomeIntegrationTest.java @@ -9,7 +9,8 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import static org.junit.Assert.*; + +import static org.junit.Assert.assertNotEquals; @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest @@ -19,12 +20,12 @@ public class SomeIntegrationTest { @Before public void setup() { - Student student = new Student("Paul", "Smith", "64377473774", "me@mymail.com"); + Student student = new Student("Paul", "Smith", "64377473774", "me@mailprovider.com"); studentRepository.save(student); } @Test - public void testDB() { + public void whenInserting_andCount_thenWeDontGetZero() { long count = studentRepository.count(); assertNotEquals(0, count); From c067162a5676a59fb8f2b9520111e6fb14a15991 Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Tue, 5 Dec 2017 05:29:10 +0100 Subject: [PATCH 25/50] Jenkins pipeline script for unix and non-unix OS --- spring-jenkins-pipeline/pom.xml | 3 +- .../scripted-pipeline-unix-nonunix | 91 +++++++++++++++++++ 2 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 spring-jenkins-pipeline/scripted-pipeline-unix-nonunix diff --git a/spring-jenkins-pipeline/pom.xml b/spring-jenkins-pipeline/pom.xml index 1c35f0f73b..9b4727a235 100644 --- a/spring-jenkins-pipeline/pom.xml +++ b/spring-jenkins-pipeline/pom.xml @@ -21,6 +21,7 @@ UTF-8 UTF-8 1.8 + 2.17 @@ -48,7 +49,7 @@ org.apache.maven.plugins maven-checkstyle-plugin - 2.17 + ${checkstyle.version} diff --git a/spring-jenkins-pipeline/scripted-pipeline-unix-nonunix b/spring-jenkins-pipeline/scripted-pipeline-unix-nonunix new file mode 100644 index 0000000000..861c38c8a2 --- /dev/null +++ b/spring-jenkins-pipeline/scripted-pipeline-unix-nonunix @@ -0,0 +1,91 @@ +node { + stage 'Clone the project' + git 'https://github.com/dassiorleando/tutorials.git' + + dir('spring-jenkins-pipeline') { + stage("Compilation and Analysis") { + parallel 'Compilation': { + if (isUnix()) { + sh "./mvnw clean install -DskipTests" + } else { + bat "./mvnw.cmd clean install -DskipTests" + } + }, 'Static Analysis': { + stage("Checkstyle") { + if (isUnix()) { + sh "./mvnw checkstyle:checkstyle" + + step([$class: 'CheckStylePublisher', + canRunOnFailed: true, + defaultEncoding: '', + healthy: '100', + pattern: '**/target/checkstyle-result.xml', + unHealthy: '90', + useStableBuildAsReference: true + ]) + } else { + bat "./mvnw.cmd checkstyle:checkstyle" + + step([$class: 'CheckStylePublisher', + canRunOnFailed: true, + defaultEncoding: '', + healthy: '100', + pattern: '**\target\checkstyle-result.xml', + unHealthy: '90', + useStableBuildAsReference: true + ]) + } + } + } + } + + stage("Tests and Deployment") { + parallel 'Unit tests': { + stage("Runing unit tests") { + if (isUnix()) { + sh "./mvnw test -Punit" + + step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*UnitTest.xml']) + } else { + bat "./mvnw.cmd test -Punit" + + step([$class: 'JUnitResultArchiver', testResults: '**\target\surefire-reports\TEST-*UnitTest.xml']) + } + } + }, 'Integration tests': { + stage("Runing integration tests") { + if (isUnix()) { + sh "./mvnw test -Pintegration" + + step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*IntegrationTest.xml']) + } else { + bat "./mvnw.cmd test -Pintegration" + + step([$class: 'JUnitResultArchiver', testResults: '**\target\surefire-reports\TEST-*IntegrationTest.xml']) + } + } + }, 'Deployment': { + stage("Staging") { + if (isUnix()) { + sh "pid=\$(lsof -i:8989 -t); kill -TERM \$pid || kill -KILL \$pid" + } else { + bat "FOR /F 'tokens=5 delims= ' %%P IN ('netstat -ano ^| findstr :8989') DO TaskKill.exe /PID %%P" + } + + withEnv(['JENKINS_NODE_COOKIE=dontkill']) { + if (isUnix()) { + sh 'nohup ./mvnw spring-boot:run -Dserver.port=8989 &' + sh "while ! httping -qc1 http://localhost:8989 ; do sleep 1 ; done" + sh "curl http://localhost:8989" + } else { + bat 'start ./mvnw.cmd spring-boot:run -Dserver.port=8989' + // Here we need to check(loop) if localhost:8989 is up + // Once it's we continue de script + bat "curl.exe http://localhost:8989" + } + } + } + } + } + } +} \ No newline at end of file From 1e0f0c1849036b6403629911e1e21212950079ba Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Tue, 5 Dec 2017 07:51:37 +0100 Subject: [PATCH 26/50] BAEL-1408: Intro to Performance Testing using JMeter --- spring-jmeter-jenkins/pom.xml | 21 +++++++++++++++++-- .../resources/20171205-JMeter-Jenkins.csv | 6 ++++++ 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 spring-jmeter-jenkins/src/main/resources/20171205-JMeter-Jenkins.csv diff --git a/spring-jmeter-jenkins/pom.xml b/spring-jmeter-jenkins/pom.xml index 38b5f98e45..dcf1c6d3e5 100644 --- a/spring-jmeter-jenkins/pom.xml +++ b/spring-jmeter-jenkins/pom.xml @@ -21,6 +21,7 @@ UTF-8 UTF-8 1.8 + 2.6.0 @@ -45,8 +46,24 @@ org.springframework.boot spring-boot-maven-plugin + + + com.lazerycode.jmeter + jmeter-maven-plugin + ${jmeter.version} + + + jmeter-tests + + jmeter + + + + + ${project.basedir}/src/main/resources + ${project.basedir}/src/main/resources + + - - diff --git a/spring-jmeter-jenkins/src/main/resources/20171205-JMeter-Jenkins.csv b/spring-jmeter-jenkins/src/main/resources/20171205-JMeter-Jenkins.csv new file mode 100644 index 0000000000..719fc18f41 --- /dev/null +++ b/spring-jmeter-jenkins/src/main/resources/20171205-JMeter-Jenkins.csv @@ -0,0 +1,6 @@ +timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,Latency,IdleTime,Connect +1512454361862,181,HTTP Request,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused (Connection refused),Thread Group 1-2,text,false,"The operation lasted too long: It took 181 milliseconds, but should not have lasted longer than 10 milliseconds.",2058,0,3,3,0,0,181 +1512454361926,116,HTTP Request,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused (Connection refused),Thread Group 1-3,text,false,"The operation lasted too long: It took 116 milliseconds, but should not have lasted longer than 10 milliseconds.",2058,0,3,3,0,0,116 +1512454361862,181,HTTP Request,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused (Connection refused),Thread Group 1-1,text,false,"The operation lasted too long: It took 181 milliseconds, but should not have lasted longer than 10 milliseconds.",2058,0,3,3,0,0,181 +1512454362126,2,HTTP Request,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused (Connection refused),Thread Group 1-4,text,false,,2058,0,1,1,0,0,2 +1512454362326,2,HTTP Request,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused (Connection refused),Thread Group 1-5,text,false,,2058,0,1,1,0,0,2 From 0d37e8831602fadff7816174f5a4bbc11f262514 Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Tue, 5 Dec 2017 18:45:09 +0100 Subject: [PATCH 27/50] Fix indents --- spring-jenkins-pipeline/pom.xml | 174 ++++++++++++++++---------------- spring-jmeter-jenkins/pom.xml | 118 +++++++++++----------- 2 files changed, 146 insertions(+), 146 deletions(-) diff --git a/spring-jenkins-pipeline/pom.xml b/spring-jenkins-pipeline/pom.xml index 9b4727a235..071f6e6e36 100644 --- a/spring-jenkins-pipeline/pom.xml +++ b/spring-jenkins-pipeline/pom.xml @@ -1,98 +1,98 @@ - 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 - spring-jenkins-pipeline - 0.0.1-SNAPSHOT - jar + spring-jenkins-pipeline + 0.0.1-SNAPSHOT + jar - spring-jenkins-pipeline - Intro to Jenkins 2 and the power of pipelines + spring-jenkins-pipeline + Intro to Jenkins 2 and the power of pipelines - - parent-boot-5 - com.baeldung - 0.0.1-SNAPSHOT - ../parent-boot-5 - + + parent-boot-5 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-5 + - - UTF-8 - UTF-8 - 1.8 - 2.17 - + + UTF-8 + UTF-8 + 1.8 + 2.17 + - - - org.springframework.boot - spring-boot-starter-data-mongodb - - - org.springframework.boot - spring-boot-starter-data-rest - - - org.springframework.boot - spring-boot-starter-test - test - - + + + org.springframework.boot + spring-boot-starter-data-mongodb + + + org.springframework.boot + spring-boot-starter-data-rest + + + org.springframework.boot + spring-boot-starter-test + test + + - - - - org.springframework.boot - spring-boot-maven-plugin - - - org.apache.maven.plugins - maven-checkstyle-plugin - ${checkstyle.version} - - - + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-checkstyle-plugin + ${checkstyle.version} + + + - - - integration - - - - maven-surefire-plugin - - - **/*UnitTest.java - - - - **/*IntegrationTest.java - - - - - - + + + integration + + + + maven-surefire-plugin + + + **/*UnitTest.java + + + + **/*IntegrationTest.java + + + + + + - - unit - - - - maven-surefire-plugin - - - **/*IntegrationTest.java - - - - **/*UnitTest.java - - - - - - - + + unit + + + + maven-surefire-plugin + + + **/*IntegrationTest.java + + + + **/*UnitTest.java + + + + + + + diff --git a/spring-jmeter-jenkins/pom.xml b/spring-jmeter-jenkins/pom.xml index dcf1c6d3e5..daef45b6d4 100644 --- a/spring-jmeter-jenkins/pom.xml +++ b/spring-jmeter-jenkins/pom.xml @@ -1,69 +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 - spring-jmeter-jenkins - 0.0.1-SNAPSHOT - jar + spring-jmeter-jenkins + 0.0.1-SNAPSHOT + jar - spring-jmeter-jenkins - Run and Show JMeter test with Jenkins + spring-jmeter-jenkins + Run and Show JMeter test with Jenkins - - parent-boot-5 - com.baeldung - 0.0.1-SNAPSHOT - ../parent-boot-5 - + + parent-boot-5 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-5 + - - UTF-8 - UTF-8 - 1.8 - 2.6.0 - + + UTF-8 + UTF-8 + 1.8 + 2.6.0 + - - - org.springframework.boot - spring-boot-starter-data-mongodb - - - org.springframework.boot - spring-boot-starter-data-rest - - - org.springframework.boot - spring-boot-starter-test - test - - + + + org.springframework.boot + spring-boot-starter-data-mongodb + + + org.springframework.boot + spring-boot-starter-data-rest + + + org.springframework.boot + spring-boot-starter-test + test + + - - - - org.springframework.boot - spring-boot-maven-plugin - + + + + org.springframework.boot + spring-boot-maven-plugin + - - com.lazerycode.jmeter - jmeter-maven-plugin - ${jmeter.version} - - - jmeter-tests - - jmeter - - - - - ${project.basedir}/src/main/resources - ${project.basedir}/src/main/resources - - - - + + com.lazerycode.jmeter + jmeter-maven-plugin + ${jmeter.version} + + + jmeter-tests + + jmeter + + + + + ${project.basedir}/src/main/resources + ${project.basedir}/src/main/resources + + + + From 080d1a942542a0d90d0f4b1d4f8217fd7e9c52ce Mon Sep 17 00:00:00 2001 From: k0l0ssus Date: Mon, 11 Dec 2017 06:25:25 -0500 Subject: [PATCH 28/50] Updated readme.md (#3215) * Update pom.xml Corrected main class and added JUnit dependency * Update README.md * Update README.md --- spring-integration/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spring-integration/README.md b/spring-integration/README.md index e5b0f601ce..750ad994eb 100644 --- a/spring-integration/README.md +++ b/spring-integration/README.md @@ -1,2 +1,5 @@ ### Relevant Articles: - [Introduction to Spring Integration](http://www.baeldung.com/spring-integration) + +### Running the Sample +Executing the `mvn exec:java` maven command (either from the command line or from an IDE) will start up the application. Follow the command prompt for further instructions. From 904695519788ef6e5121ace6fa614881148e3e92 Mon Sep 17 00:00:00 2001 From: Wosin Date: Mon, 11 Dec 2017 16:32:04 +0100 Subject: [PATCH 29/50] BAEL-1349: Custom plugin added to Gradle (#3145) --- gradle/plugin/build.gradle | 14 ++++++++++++ .../java/com/baeldung/GreetingPlugin.java | 17 ++++++++++++++ .../com/baeldung/GreetingPluginExtension.java | 22 +++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 gradle/plugin/build.gradle create mode 100644 gradle/plugin/buildSrc/src/main/java/com/baeldung/GreetingPlugin.java create mode 100644 gradle/plugin/buildSrc/src/main/java/com/baeldung/GreetingPluginExtension.java diff --git a/gradle/plugin/build.gradle b/gradle/plugin/build.gradle new file mode 100644 index 0000000000..8d7329c1b0 --- /dev/null +++ b/gradle/plugin/build.gradle @@ -0,0 +1,14 @@ + repositories{ + mavenCentral() + } + apply plugin: 'java' + apply plugin: 'maven' + apply plugin: com.baeldung.GreetingPlugin + dependencies { + compile gradleApi() + } + + greeting { + greeter = "Stranger" + message = "Message from the build script!" + } \ No newline at end of file diff --git a/gradle/plugin/buildSrc/src/main/java/com/baeldung/GreetingPlugin.java b/gradle/plugin/buildSrc/src/main/java/com/baeldung/GreetingPlugin.java new file mode 100644 index 0000000000..ad32ecfe91 --- /dev/null +++ b/gradle/plugin/buildSrc/src/main/java/com/baeldung/GreetingPlugin.java @@ -0,0 +1,17 @@ +package com.baeldung; + +import org.gradle.api.Plugin; +import org.gradle.api.Project; + +public class GreetingPlugin implements Plugin { + @Override + public void apply(Project project) { + + GreetingPluginExtension extension = project.getExtensions().create("greeting", GreetingPluginExtension.class); + + project.task("hello").doLast(task -> { + System.out.println("Hello, " + extension.getGreeter()); + System.out.println("I have a message for You: " + extension.getMessage()); } + ); + } +} \ No newline at end of file diff --git a/gradle/plugin/buildSrc/src/main/java/com/baeldung/GreetingPluginExtension.java b/gradle/plugin/buildSrc/src/main/java/com/baeldung/GreetingPluginExtension.java new file mode 100644 index 0000000000..2ff64a43f5 --- /dev/null +++ b/gradle/plugin/buildSrc/src/main/java/com/baeldung/GreetingPluginExtension.java @@ -0,0 +1,22 @@ +package com.baeldung; + +public class GreetingPluginExtension { + private String greeter = "Baeldung"; + private String message = "Message from Plugin!"; + + public String getGreeter() { + return greeter; + } + + public void setGreeter(String greeter) { + this.greeter = greeter; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} From b2ea831d83849609401461fe90282f8384256745 Mon Sep 17 00:00:00 2001 From: bahti Date: Mon, 11 Dec 2017 20:31:52 +0300 Subject: [PATCH 30/50] inner interface examples added (#3151) --- .../interfaces/CommaSeparatedCustomers.java | 21 +++++++++++++++++++ .../com/baeldung/interfaces/Customer.java | 19 +++++++++++++++++ .../interfaces/InnerInterfaceTests.java | 18 ++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 core-java/src/main/java/com/baeldung/interfaces/CommaSeparatedCustomers.java create mode 100644 core-java/src/main/java/com/baeldung/interfaces/Customer.java create mode 100644 core-java/src/test/java/com/baeldung/interfaces/InnerInterfaceTests.java diff --git a/core-java/src/main/java/com/baeldung/interfaces/CommaSeparatedCustomers.java b/core-java/src/main/java/com/baeldung/interfaces/CommaSeparatedCustomers.java new file mode 100644 index 0000000000..29ed2d3d26 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/interfaces/CommaSeparatedCustomers.java @@ -0,0 +1,21 @@ +package com.baeldung.interfaces; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +public class CommaSeparatedCustomers implements Customer.List { + + private List customers = new ArrayList(); + + @Override + public void Add(Customer customer) { + customers.add(customer); + } + + @Override + public String getCustomerNames() { + return customers.stream().map(customer -> customer.getName()).collect(Collectors.joining(",")); + } + +} diff --git a/core-java/src/main/java/com/baeldung/interfaces/Customer.java b/core-java/src/main/java/com/baeldung/interfaces/Customer.java new file mode 100644 index 0000000000..d2f2b48074 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/interfaces/Customer.java @@ -0,0 +1,19 @@ +package com.baeldung.interfaces; + +public class Customer { + public interface List { + void Add(Customer customer); + + String getCustomerNames(); + } + + private String name; + + public Customer(String name) { + this.name = name; + } + + String getName() { + return name; + } +} diff --git a/core-java/src/test/java/com/baeldung/interfaces/InnerInterfaceTests.java b/core-java/src/test/java/com/baeldung/interfaces/InnerInterfaceTests.java new file mode 100644 index 0000000000..b19ed76189 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/interfaces/InnerInterfaceTests.java @@ -0,0 +1,18 @@ +package com.baeldung.interfaces; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +@RunWith(JUnit4.class) +public class InnerInterfaceTests { + @Test + public void whenCustomerListJoined_thenReturnsJoinedNames() { + Customer.List customerList = new CommaSeparatedCustomers(); + customerList.Add(new Customer("customer1")); + customerList.Add(new Customer("customer2")); + assertEquals("customer1,customer2", customerList.getCustomerNames()); + } +} From c787414dd954e44d51cba00ae6babbcaa9cfbf75 Mon Sep 17 00:00:00 2001 From: ericgoebelbecker <@592Gbetz> Date: Mon, 11 Dec 2017 22:27:04 -0500 Subject: [PATCH 31/50] BAEL-1374 - move JMH settings to class-level annotations. --- .../com/baeldung/array/SearchArrayTest.java | 21 +++---------------- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/core-java/src/main/java/com/baeldung/array/SearchArrayTest.java b/core-java/src/main/java/com/baeldung/array/SearchArrayTest.java index fd11e49373..8b44138b32 100644 --- a/core-java/src/main/java/com/baeldung/array/SearchArrayTest.java +++ b/core-java/src/main/java/com/baeldung/array/SearchArrayTest.java @@ -5,12 +5,12 @@ import org.openjdk.jmh.annotations.*; import java.util.*; import java.util.concurrent.TimeUnit; +@BenchmarkMode(Mode.AverageTime) +@Warmup(iterations = 5) +@OutputTimeUnit(TimeUnit.MICROSECONDS) public class SearchArrayTest { @Benchmark - @BenchmarkMode(Mode.AverageTime) - @Warmup(iterations = 5) - @OutputTimeUnit(TimeUnit.MICROSECONDS) public void searchArrayLoop() { int count = 1000; @@ -21,9 +21,6 @@ public class SearchArrayTest { } @Benchmark - @BenchmarkMode(Mode.AverageTime) - @Warmup(iterations = 5) - @OutputTimeUnit(TimeUnit.MICROSECONDS) public void searchArrayAllocNewList() { int count = 1000; @@ -35,9 +32,6 @@ public class SearchArrayTest { } @Benchmark - @BenchmarkMode(Mode.AverageTime) - @Warmup(iterations = 5) - @OutputTimeUnit(TimeUnit.MICROSECONDS) public void searchArrayAllocNewSet() { int count = 1000; @@ -49,9 +43,6 @@ public class SearchArrayTest { @Benchmark - @BenchmarkMode(Mode.AverageTime) - @Warmup(iterations = 5) - @OutputTimeUnit(TimeUnit.MICROSECONDS) public void searchArrayReuseList() { int count = 1000; @@ -66,9 +57,6 @@ public class SearchArrayTest { @Benchmark - @BenchmarkMode(Mode.AverageTime) - @Warmup(iterations = 5) - @OutputTimeUnit(TimeUnit.MICROSECONDS) public void searchArrayReuseSet() { int count = 1000; @@ -81,9 +69,6 @@ public class SearchArrayTest { @Benchmark - @BenchmarkMode(Mode.AverageTime) - @Warmup(iterations = 5) - @OutputTimeUnit(TimeUnit.MICROSECONDS) public void searchArrayBinarySearch() { int count = 1000; From 339cf6a7d0202513090a49bec23aee00c67046aa Mon Sep 17 00:00:00 2001 From: Hany Ahmed Date: Tue, 12 Dec 2017 06:39:39 +0200 Subject: [PATCH 32/50] BAEL-1278 (#3214) * BAEL-1278 * Rename methods names --- testing-modules/testing/pom.xml | 6 + .../main/java/com/baeldung/jspec/Animal.java | 41 ++++++ .../main/java/com/baeldung/jspec/Cage.java | 48 +++++++ .../src/main/java/com/baeldung/jspec/Cat.java | 14 ++ .../src/main/java/com/baeldung/jspec/Dog.java | 14 ++ .../java/com/baeldung/jspec/CageUnitTest.java | 126 ++++++++++++++++++ .../com/baeldung/jspec/JSpecUnitTest.java | 57 ++++++++ 7 files changed, 306 insertions(+) create mode 100644 testing-modules/testing/src/main/java/com/baeldung/jspec/Animal.java create mode 100644 testing-modules/testing/src/main/java/com/baeldung/jspec/Cage.java create mode 100644 testing-modules/testing/src/main/java/com/baeldung/jspec/Cat.java create mode 100644 testing-modules/testing/src/main/java/com/baeldung/jspec/Dog.java create mode 100644 testing-modules/testing/src/test/java/com/baeldung/jspec/CageUnitTest.java create mode 100644 testing-modules/testing/src/test/java/com/baeldung/jspec/JSpecUnitTest.java diff --git a/testing-modules/testing/pom.xml b/testing-modules/testing/pom.xml index 7aff0a93e0..1fd6357b87 100644 --- a/testing-modules/testing/pom.xml +++ b/testing-modules/testing/pom.xml @@ -94,6 +94,11 @@ 1.5 test + + org.javalite + javalite-common + ${javalite.version} + @@ -162,5 +167,6 @@ 0.32 1.1.0 0.12 + 1.4.13 diff --git a/testing-modules/testing/src/main/java/com/baeldung/jspec/Animal.java b/testing-modules/testing/src/main/java/com/baeldung/jspec/Animal.java new file mode 100644 index 0000000000..efb4c62bde --- /dev/null +++ b/testing-modules/testing/src/main/java/com/baeldung/jspec/Animal.java @@ -0,0 +1,41 @@ +package com.baeldung.jspec; + +public abstract class Animal { + + protected String name; + + public Animal(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((name == null) ? 0 : name.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Animal other = (Animal) obj; + if (name == null) { + if (other.name != null) + return false; + } else if (!name.equals(other.name)) + return false; + return true; + } + + +} diff --git a/testing-modules/testing/src/main/java/com/baeldung/jspec/Cage.java b/testing-modules/testing/src/main/java/com/baeldung/jspec/Cage.java new file mode 100644 index 0000000000..73ea343600 --- /dev/null +++ b/testing-modules/testing/src/main/java/com/baeldung/jspec/Cage.java @@ -0,0 +1,48 @@ +package com.baeldung.jspec; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +public class Cage { + + private Set animals = new HashSet<>(); + + public void put(Animal animal) { + animals.add(animal); + } + + public void put(Animal... animals) { + this.animals.addAll(Arrays.asList(animals)); + } + + public Animal release(Animal animal) { + return animals.remove(animal) ? animal : null; + } + + public void open() { + animals.clear(); + } + + public boolean hasAnimals() { + return animals.size() > 0; + } + + public boolean isEmpty() { + return animals.isEmpty(); + } + + public Set getAnimals() { + return this.animals; + } + + public int size() { + return animals.size(); + } + + @Override + public String toString() { + return "Cage [animals=" + animals + "]"; + } + +} diff --git a/testing-modules/testing/src/main/java/com/baeldung/jspec/Cat.java b/testing-modules/testing/src/main/java/com/baeldung/jspec/Cat.java new file mode 100644 index 0000000000..5021a1481c --- /dev/null +++ b/testing-modules/testing/src/main/java/com/baeldung/jspec/Cat.java @@ -0,0 +1,14 @@ +package com.baeldung.jspec; + +public class Cat extends Animal { + + public Cat(String name) { + super(name); + } + + @Override + public String toString() { + return "Cat [name=" + name + "]"; + } + +} diff --git a/testing-modules/testing/src/main/java/com/baeldung/jspec/Dog.java b/testing-modules/testing/src/main/java/com/baeldung/jspec/Dog.java new file mode 100644 index 0000000000..43626941e3 --- /dev/null +++ b/testing-modules/testing/src/main/java/com/baeldung/jspec/Dog.java @@ -0,0 +1,14 @@ +package com.baeldung.jspec; + +public class Dog extends Animal { + + public Dog(String name) { + super(name); + } + + @Override + public String toString() { + return "Dog [name=" + name + "]"; + } + +} diff --git a/testing-modules/testing/src/test/java/com/baeldung/jspec/CageUnitTest.java b/testing-modules/testing/src/test/java/com/baeldung/jspec/CageUnitTest.java new file mode 100644 index 0000000000..33ef986588 --- /dev/null +++ b/testing-modules/testing/src/test/java/com/baeldung/jspec/CageUnitTest.java @@ -0,0 +1,126 @@ +package com.baeldung.jspec; + +import static org.javalite.test.jspec.JSpec.$; +import static org.javalite.test.jspec.JSpec.expect; +import static org.javalite.test.jspec.JSpec.the; + +import java.util.Set; + +import org.javalite.test.jspec.DifferenceExpectation; +import org.junit.Test; + +public class CageUnitTest { + + Cat tomCat = new Cat("Tom"); + Cat felixCat = new Cat("Felix"); + Dog boltDog = new Dog("Bolt"); + Cage cage = new Cage(); + + + @Test + public void puttingAnimals_shouldIncreaseCageSize() { + // When + cage.put(tomCat, boltDog); + + // Then + the(cage.size()).shouldEqual(2); + } + + @Test + public void releasingAnimals_shouldDecreaseCageSize() { + // When + cage.put(tomCat, boltDog); + cage.release(tomCat); + + // Then + the(cage.size()).shouldEqual(1); + } + + @Test + public void puttingAnimals_shouldLeaveThemInsideTheCage() { + // When + cage.put(tomCat, boltDog); + + // Then + the(cage).shouldHave("animals"); + } + + @Test + public void openingTheCage_shouldReleaseAllAnimals() { + // When + cage.put(tomCat, boltDog); + + // Then + the(cage).shouldNotBe("empty"); + + // When + cage.open(); + + // Then + the(cage).shouldBe("empty"); + the(cage.isEmpty()).shouldBeTrue(); + } + + @Test + public void comparingTwoDogs() { + // When + Dog firstDog = new Dog("Rex"); + Dog secondDog = new Dog("Rex"); + + // Then + $(firstDog).shouldEqual(secondDog); + $(firstDog).shouldNotBeTheSameAs(secondDog); + } + + @Test + public void puttingCatsOnly_shouldLetCageAnimalsToContainCats() { + // When + cage.put(tomCat, felixCat); + + // Then + Set animals = cage.getAnimals(); + the(animals).shouldContain(tomCat); + the(animals).shouldContain(felixCat); + the(animals).shouldNotContain(boltDog); + } + + @Test + public void puttingCatsOnly_shouldLetCageToContainCats() { + // When + cage.put(tomCat, felixCat); + + // Then + // Check with toString of the tested objects + the(cage).shouldContain(tomCat); + the(cage).shouldContain(felixCat); + the(cage).shouldNotContain(boltDog); + } + + @Test + public void puttingMoreAnimals_shouldChangeSize() { + // When + cage.put(tomCat, boltDog); + + // Then + expect( new DifferenceExpectation(cage.size()) { + + @Override + public Integer exec() { + cage.release(tomCat); + return cage.size(); + } + } ); + } + + + @Test + public void releasingTheDog_shouldReleaseAnAnimalOfDogType() { + // When + cage.put(boltDog); + Animal releasedAnimal = cage.release(boltDog); + + // Then + the(releasedAnimal).shouldNotBeNull(); + the(releasedAnimal).shouldBeA(Dog.class); + } +} diff --git a/testing-modules/testing/src/test/java/com/baeldung/jspec/JSpecUnitTest.java b/testing-modules/testing/src/test/java/com/baeldung/jspec/JSpecUnitTest.java new file mode 100644 index 0000000000..0e35e26728 --- /dev/null +++ b/testing-modules/testing/src/test/java/com/baeldung/jspec/JSpecUnitTest.java @@ -0,0 +1,57 @@ +package com.baeldung.jspec; + +import static org.javalite.test.jspec.JSpec.$; +import static org.javalite.test.jspec.JSpec.a; +import static org.javalite.test.jspec.JSpec.expect; +import static org.javalite.test.jspec.JSpec.it; +import static org.javalite.test.jspec.JSpec.the; + +import java.util.Arrays; +import java.util.List; + +import org.javalite.test.jspec.ExceptionExpectation; +import org.junit.Test; + +public class JSpecUnitTest { + + @Test + public void onePlusTwo_shouldEqualThree() { + $(1 + 2).shouldEqual(3); + a(1 + 2).shouldEqual(3); + the(1 + 2).shouldEqual(3); + it(1 + 2).shouldEqual(3); + } + + @Test + public void messageShouldContainJSpec() { + String message = "Welcome to JSpec demo"; + // The message should not be empty + the(message).shouldNotBe("empty"); + // The message should contain JSpec + the(message).shouldContain("JSpec"); + } + + public void colorsListShouldContainRed() { + List colorsList = Arrays.asList("red", "green", "blue"); + $(colorsList).shouldContain("red"); + } + + public void guessedNumberShouldEqualHiddenNumber() { + Integer guessedNumber = 11; + Integer hiddenNumber = 11; + + $(guessedNumber).shouldEqual(hiddenNumber); + $(guessedNumber).shouldNotBeTheSameAs(hiddenNumber); + } + + @Test + public void dividingByThero_shouldThrowArithmeticException() { + expect(new ExceptionExpectation(ArithmeticException.class) { + @Override + public void exec() throws ArithmeticException { + System.out.println(1 / 0); + } + } ); + } + +} From b59226a68cd90250c13f416806445234db23c3f9 Mon Sep 17 00:00:00 2001 From: Rokon Uddin Ahmed Date: Tue, 12 Dec 2017 12:32:35 +0600 Subject: [PATCH 33/50] 12.12 (#3219) * Create README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Create README.md * Update README.md * Update README.md * Update README.md * Update README.MD * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Create README.md * Update README.MD * Create README.md * Update readme.md * Update README.md * Update README.md * Update README.md --- cas/cas-secured-app/README.md | 2 ++ core-java-8/README.md | 1 + core-java-9/README.md | 1 + core-java-concurrency/README.md | 2 ++ core-java/README.md | 6 +++++- drools/README.MD | 1 + gradle/README.md | 1 + hibernate5/README.md | 2 ++ jsonb/README.md | 3 +++ junit5/README.md | 2 ++ osgi/readme.md | 3 +++ patterns/README.md | 3 ++- persistence-modules/spring-jpa/README.md | 1 + spring-5/README.md | 2 ++ spring-aop/README.md | 3 ++- spring-boot-keycloak/README.md | 2 ++ spring-boot/README.MD | 2 +- spring-cloud-cli/README.md | 2 +- spring-core/README.md | 2 ++ spring-hibernate3/README.md | 2 ++ testing-modules/mockito-2/README.md | 1 + testing-modules/mockito/README.md | 2 ++ 22 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 cas/cas-secured-app/README.md create mode 100644 junit5/README.md create mode 100644 spring-boot-keycloak/README.md create mode 100644 spring-hibernate3/README.md diff --git a/cas/cas-secured-app/README.md b/cas/cas-secured-app/README.md new file mode 100644 index 0000000000..01c5f91988 --- /dev/null +++ b/cas/cas-secured-app/README.md @@ -0,0 +1,2 @@ +## Relevant articles: +- [CAS SSO With Spring Security](http://www.baeldung.com/spring-security-cas-sso) diff --git a/core-java-8/README.md b/core-java-8/README.md index 540a32b0ba..61f8df8f49 100644 --- a/core-java-8/README.md +++ b/core-java-8/README.md @@ -32,3 +32,4 @@ - [“Stream has already been operated upon or closed” Exception in Java](http://www.baeldung.com/java-stream-operated-upon-or-closed-exception) - [Display All Time Zones With GMT And UTC in Java](http://www.baeldung.com/java-time-zones) - [Copy a File with Java](http://www.baeldung.com/java-copy-file) +- [Generating Prime Numbers in Java](http://www.baeldung.com/java-generate-prime-numbers) diff --git a/core-java-9/README.md b/core-java-9/README.md index 98c855caea..ce8a140dc0 100644 --- a/core-java-9/README.md +++ b/core-java-9/README.md @@ -18,3 +18,4 @@ - [How to Get All Dates Between Two Dates?](http://www.baeldung.com/java-between-dates) - [Java 9 java.util.Objects Additions](http://www.baeldung.com/java-9-objects-new) - [Compact Strings in Java 9](http://www.baeldung.com/java-9-compact-string) +- [Convert Date to LocalDate or LocalDateTime and Back](http://www.baeldung.com/java-date-to-localdate-and-localdatetime) diff --git a/core-java-concurrency/README.md b/core-java-concurrency/README.md index 48c5f2a50c..23509013d5 100644 --- a/core-java-concurrency/README.md +++ b/core-java-concurrency/README.md @@ -31,3 +31,5 @@ - [Overview of the java.util.concurrent](http://www.baeldung.com/java-util-concurrent) - [Semaphores in Java](http://www.baeldung.com/java-semaphore) - [Daemon Threads in Java](http://www.baeldung.com/java-daemon-thread) +- [Implementing a Runnable vs Extending a Thread](http://www.baeldung.com/java-runnable-vs-extending-thread) +- [How to Kill a Java Thread](http://www.baeldung.com/java-thread-stop) diff --git a/core-java/README.md b/core-java/README.md index 8287a21d1e..ae9e0d96c4 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -121,4 +121,8 @@ - [Copy a File with Java](http://www.baeldung.com/java-copy-file) - [Introduction to Creational Design Patterns](http://www.baeldung.com/creational-design-patterns) - [Quick Example - Comparator vs Comparable in Java](http://www.baeldung.com/java-comparator-comparable) - +- [Quick Guide to Java Stack](http://www.baeldung.com/java-stack) +- [The Java continue and break Keywords](http://www.baeldung.com/java-continue-and-break) +- [Java – Append Data to a File](http://www.baeldung.com/java-append-to-file) +- [Introduction to the Java ArrayDeque](http://www.baeldung.com/java-array-deque) +- [Guide to java.util.Formatter](http://www.baeldung.com/java-string-formatter) diff --git a/drools/README.MD b/drools/README.MD index b2259e2878..5efbe0d3c3 100644 --- a/drools/README.MD +++ b/drools/README.MD @@ -1,3 +1,4 @@ ### Relevant Articles: - [Introduction to Drools](http://www.baeldung.com/drools) - [Drools Using Rules from Excel Files](http://www.baeldung.com/drools-excel) +- [An Example of Backward Chaining in Drools](http://www.baeldung.com/drools-backward-chaining) diff --git a/gradle/README.md b/gradle/README.md index ff12555376..dd5ea03a18 100644 --- a/gradle/README.md +++ b/gradle/README.md @@ -1 +1,2 @@ ## Relevant articles: +- [Introduction to Gradle](http://www.baeldung.com/gradle) diff --git a/hibernate5/README.md b/hibernate5/README.md index 4690ebbe76..d480a7455c 100644 --- a/hibernate5/README.md +++ b/hibernate5/README.md @@ -2,3 +2,5 @@ - [Dynamic Mapping with Hibernate](http://www.baeldung.com/hibernate-dynamic-mapping) - [An Overview of Identifiers in Hibernate](http://www.baeldung.com/hibernate-identifiers) +- [Hibernate – Mapping Date and Time](http://www.baeldung.com/hibernate-date-time) +- [Hibernate Inheritance Mapping](http://www.baeldung.com/hibernate-inheritance) diff --git a/jsonb/README.md b/jsonb/README.md index a638f0355c..9293a44808 100644 --- a/jsonb/README.md +++ b/jsonb/README.md @@ -1 +1,4 @@ ## JSON B + +## Relevant articles: +- [Introduction to the JSON Binding API (JSR 367) in Java](http://www.baeldung.com/java-json-binding-api) diff --git a/junit5/README.md b/junit5/README.md new file mode 100644 index 0000000000..fb1685fdd5 --- /dev/null +++ b/junit5/README.md @@ -0,0 +1,2 @@ +## Relevant articles: +- [The Order of Tests in JUnit](http://www.baeldung.com/junit-5-test-order) diff --git a/osgi/readme.md b/osgi/readme.md index ea4a411c7b..e380ae06c3 100644 --- a/osgi/readme.md +++ b/osgi/readme.md @@ -86,6 +86,9 @@ org.eclipse.osgi_3.12.1.v20170821-1548.jar = = NOT GOOD = = + ## Relevant articles: + - [Introduction to OSGi](http://www.baeldung.com/osgi) + diff --git a/patterns/README.md b/patterns/README.md index 67d84154cb..26099ae34f 100644 --- a/patterns/README.md +++ b/patterns/README.md @@ -1,4 +1,5 @@ ###Relevant Articles: - [A Guide to the Front Controller Pattern in Java](http://www.baeldung.com/java-front-controller-pattern) - [Introduction to Intercepting Filter Pattern in Java](http://www.baeldung.com/intercepting-filter-pattern-in-java) -- [Implementing the Template Method Pattern in Java](http://www.baeldung.com/template-method-pattern-in-java) +- [Implementing the Template Method Pattern in Java](http://www.baeldung.com/java-template-method-pattern) + diff --git a/persistence-modules/spring-jpa/README.md b/persistence-modules/spring-jpa/README.md index d93271164c..4bfe2a1d25 100644 --- a/persistence-modules/spring-jpa/README.md +++ b/persistence-modules/spring-jpa/README.md @@ -15,6 +15,7 @@ - [Deleting Objects with Hibernate](http://www.baeldung.com/delete-with-hibernate) - [Self-Contained Testing Using an In-Memory Database](http://www.baeldung.com/spring-jpa-test-in-memory-database) - [Spring Data JPA – Adding a Method in All Repositories](http://www.baeldung.com/spring-data-jpa-method-in-all-repositories) +- [A Guide to Spring AbstractRoutingDatasource](http://www.baeldung.com/spring-abstract-routing-data-source) ### Eclipse Config After importing the project into Eclipse, you may see the following error: diff --git a/spring-5/README.md b/spring-5/README.md index 1b65d01811..400e343263 100644 --- a/spring-5/README.md +++ b/spring-5/README.md @@ -11,3 +11,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Spring 5 WebClient](http://www.baeldung.com/spring-5-webclient) - [Spring 5 Functional Bean Registration](http://www.baeldung.com/spring-5-functional-beans) - [The SpringJUnitConfig and SpringJUnitWebConfig Annotations in Spring 5](http://www.baeldung.com/spring-5-junit-config) +- [Spring Security 5 for Reactive Applications](http://www.baeldung.com/spring-security-5-reactive) +- [Spring 5 Testing with @EnabledIf Annotation](https://github.com/eugenp/tutorials/tree/master/spring-5) diff --git a/spring-aop/README.md b/spring-aop/README.md index 03d5d8f429..af8ab71da0 100644 --- a/spring-aop/README.md +++ b/spring-aop/README.md @@ -2,4 +2,5 @@ - [Implementing a Custom Spring AOP Annotation](http://www.baeldung.com/spring-aop-annotation) - [Intro to AspectJ](http://www.baeldung.com/aspectj) -- [Spring Performance Logging](http://www.baeldung.com/spring-performance-logging) \ No newline at end of file +- [Spring Performance Logging](http://www.baeldung.com/spring-performance-logging) +- [Introduction to Spring AOP](http://www.baeldung.com/spring-aop) diff --git a/spring-boot-keycloak/README.md b/spring-boot-keycloak/README.md new file mode 100644 index 0000000000..cfe82c6cf7 --- /dev/null +++ b/spring-boot-keycloak/README.md @@ -0,0 +1,2 @@ +## Relevant articles: +- [A Quick Guide to Using Keycloak with Spring Boot](http://www.baeldung.com/spring-boot-keycloak) diff --git a/spring-boot/README.MD b/spring-boot/README.MD index f126df00af..7b5fb3c880 100644 --- a/spring-boot/README.MD +++ b/spring-boot/README.MD @@ -28,4 +28,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Spring Boot and Togglz Aspect](http://www.baeldung.com/spring-togglz) - [Getting Started with GraphQL and Spring Boot](http://www.baeldung.com/spring-graphql) - [Guide to Spring Type Conversions](http://www.baeldung.com/spring-type-conversions) - +- [Quick Guide on data.sql and schema.sql Files in Spring Boot](http://www.baeldung.com/spring-boot-data-sql-and-schema-sql) diff --git a/spring-cloud-cli/README.md b/spring-cloud-cli/README.md index 5f83ab06fa..7f29be3f07 100644 --- a/spring-cloud-cli/README.md +++ b/spring-cloud-cli/README.md @@ -3,4 +3,4 @@ ## Spring Cloud CLI ### Relevant Articles: -- [Introduction to Spring Cloud CLI](http://www.baeldung.com/introduction-to-spring-cloud-cli/) \ No newline at end of file +- [Introduction to Spring Cloud CLI](http://www.baeldung.com/spring-cloud-cli) diff --git a/spring-core/README.md b/spring-core/README.md index 81a7aaa952..dc3bb1c9f0 100644 --- a/spring-core/README.md +++ b/spring-core/README.md @@ -8,3 +8,5 @@ - [Spring YAML Configuration](http://www.baeldung.com/spring-yaml) - [Introduction to Spring’s StreamUtils](http://www.baeldung.com/spring-stream-utils) - [Using Spring @Value with Defaults](http://www.baeldung.com/spring-value-defaults) +- [Groovy Bean Definitions](http://www.baeldung.com/spring-groovy-beans) +- [XML-Based Injection in Spring](http://www.baeldung.com/spring-xml-injection) diff --git a/spring-hibernate3/README.md b/spring-hibernate3/README.md new file mode 100644 index 0000000000..02928dfb51 --- /dev/null +++ b/spring-hibernate3/README.md @@ -0,0 +1,2 @@ +## Relevant articles: +- [HibernateException: No Hibernate Session Bound to Thread in Hibernate 3](http://www.baeldung.com/no-hibernate-session-bound-to-thread-exception) diff --git a/testing-modules/mockito-2/README.md b/testing-modules/mockito-2/README.md index 49741c66d1..ee443df81a 100644 --- a/testing-modules/mockito-2/README.md +++ b/testing-modules/mockito-2/README.md @@ -1,6 +1,7 @@ ### Relevant articles - [Mockito’s Java 8 Features](http://www.baeldung.com/mockito-2-java-8) +- [Lazy Verification with Mockito 2](http://www.baeldung.com/mockito-2-lazy-verification) ## Mockito 2 and Java 8 Tips diff --git a/testing-modules/mockito/README.md b/testing-modules/mockito/README.md index 0d6f69a64f..4bbc083d8c 100644 --- a/testing-modules/mockito/README.md +++ b/testing-modules/mockito/README.md @@ -12,3 +12,5 @@ - [Introduction to PowerMock](http://www.baeldung.com/intro-to-powermock) - [Mocking Exception Throwing using Mockito](http://www.baeldung.com/mockito-exceptions) - [Mocking Void Methods with Mockito](http://www.baeldung.com/mockito-void-methods) +- [Mocking of Private Methods Using PowerMock](http://www.baeldung.com/powermock-private-method) +- [Mock Final Classes and Methods with Mockito](http://www.baeldung.com/mockito-final) From 30f78fc3cae32201f20804708429dc364cec57c2 Mon Sep 17 00:00:00 2001 From: hugosama1 Date: Tue, 12 Dec 2017 08:01:06 -0500 Subject: [PATCH 34/50] BAEL-1345 - Apachefileupload (#3185) * Added code for file upload controller * changed to spring module --- libraries/pom.xml | 10 +-- spring-rest-simple/pom.xml | 2 +- .../apachefileupload/UploadController.java | 73 +++++++++++++++++++ 3 files changed, 79 insertions(+), 6 deletions(-) create mode 100644 spring-rest-simple/src/main/java/com/baeldung/apachefileupload/UploadController.java diff --git a/libraries/pom.xml b/libraries/pom.xml index 27d867b68b..eaa2d9d38f 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -630,13 +630,13 @@ com.google.http-client google-http-client-jackson2 - ${googleclient.version} + ${googleclient.version} - com.google.http-client - google-http-client-gson - ${googleclient.version} - + com.google.http-client + google-http-client-gson + ${googleclient.version} + diff --git a/spring-rest-simple/pom.xml b/spring-rest-simple/pom.xml index f3fdd78ff4..7314785731 100644 --- a/spring-rest-simple/pom.xml +++ b/spring-rest-simple/pom.xml @@ -346,7 +346,7 @@ - 1.3.2 + 1.3.3 4.0.0 1.4 3.1.0 diff --git a/spring-rest-simple/src/main/java/com/baeldung/apachefileupload/UploadController.java b/spring-rest-simple/src/main/java/com/baeldung/apachefileupload/UploadController.java new file mode 100644 index 0000000000..b9b6739898 --- /dev/null +++ b/spring-rest-simple/src/main/java/com/baeldung/apachefileupload/UploadController.java @@ -0,0 +1,73 @@ +package com.baeldung.apachefileupload; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Iterator; +import java.util.List; +import javax.servlet.http.HttpServletRequest; +import org.apache.commons.fileupload.FileItem; +import org.apache.commons.fileupload.FileItemIterator; +import org.apache.commons.fileupload.FileItemStream; +import org.apache.commons.fileupload.FileUploadException; +import org.apache.commons.fileupload.disk.DiskFileItemFactory; +import org.apache.commons.fileupload.servlet.ServletFileUpload; +import org.apache.commons.fileupload.util.Streams; +import org.apache.commons.io.IOUtils; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class UploadController { + + @RequestMapping(value = "/upload", method = RequestMethod.POST) + public String handleUpload(HttpServletRequest request) { + System.out.println(System.getProperty("java.io.tmpdir")); + boolean isMultipart = ServletFileUpload.isMultipartContent(request); + // Create a factory for disk-based file items + DiskFileItemFactory factory = new DiskFileItemFactory(); + factory.setRepository(new File(System.getProperty("java.io.tmpdir"))); + factory.setSizeThreshold(DiskFileItemFactory.DEFAULT_SIZE_THRESHOLD); + factory.setFileCleaningTracker(null); + // Configure a repository (to ensure a secure temp location is used) + ServletFileUpload upload = new ServletFileUpload(factory); + try { + // Parse the request + List items = upload.parseRequest(request); + // Process the uploaded items + Iterator iter = items.iterator(); + while (iter.hasNext()) { + FileItem item = iter.next(); + + if (!item.isFormField()) { + try (InputStream uploadedStream = item.getInputStream(); + OutputStream out = new FileOutputStream("file.mov");) { + IOUtils.copy(uploadedStream, out); + out.close(); + } + } + } + // Parse the request with Streaming API + upload = new ServletFileUpload(); + FileItemIterator iterStream = upload.getItemIterator(request); + while (iterStream.hasNext()) { + FileItemStream item = iterStream.next(); + String name = item.getFieldName(); + InputStream stream = item.openStream(); + if (!item.isFormField()) { + //Process the InputStream + } else { + //process form fields + String formFieldValue = Streams.asString(stream); + } + } + return "success!"; + } catch (IOException | FileUploadException ex) { + return "failed: " + ex.getMessage(); + } + } + +} From e5c9d8144b1a49107c49c8a7d165c41b1af81c02 Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Wed, 13 Dec 2017 04:00:58 +0100 Subject: [PATCH 35/50] Edit jmeter module name --- {spring-jmeter-jenkins => jmeter}/.gitignore | 0 .../.mvn/wrapper/maven-wrapper.jar | Bin .../.mvn/wrapper/maven-wrapper.properties | 0 {spring-jmeter-jenkins => jmeter}/README.md | 0 {spring-jmeter-jenkins => jmeter}/mvnw | 0 {spring-jmeter-jenkins => jmeter}/mvnw.cmd | 0 {spring-jmeter-jenkins => jmeter}/pom.xml | 6 +++--- .../baeldung/SpringJMeterJenkinsApplication.java | 0 .../src/main/java/com/baeldung/domain/Student.java | 0 .../com/baeldung/repository/StudentRepository.java | 0 .../src/main/resources/20171205-JMeter-Jenkins.csv | 0 .../src/main/resources/20171213-JMeter-Jenkins.csv | 6 ++++++ .../src/main/resources/JMeter-Jenkins.jmx | 0 .../src/main/resources/application.properties | 0 ...ringJMeterJenkinsApplicationIntegrationTest.java | 0 pom.xml | 2 +- 16 files changed, 10 insertions(+), 4 deletions(-) rename {spring-jmeter-jenkins => jmeter}/.gitignore (100%) rename {spring-jmeter-jenkins => jmeter}/.mvn/wrapper/maven-wrapper.jar (100%) rename {spring-jmeter-jenkins => jmeter}/.mvn/wrapper/maven-wrapper.properties (100%) rename {spring-jmeter-jenkins => jmeter}/README.md (100%) rename {spring-jmeter-jenkins => jmeter}/mvnw (100%) rename {spring-jmeter-jenkins => jmeter}/mvnw.cmd (100%) rename {spring-jmeter-jenkins => jmeter}/pom.xml (93%) rename {spring-jmeter-jenkins => jmeter}/src/main/java/com/baeldung/SpringJMeterJenkinsApplication.java (100%) rename {spring-jmeter-jenkins => jmeter}/src/main/java/com/baeldung/domain/Student.java (100%) rename {spring-jmeter-jenkins => jmeter}/src/main/java/com/baeldung/repository/StudentRepository.java (100%) rename {spring-jmeter-jenkins => jmeter}/src/main/resources/20171205-JMeter-Jenkins.csv (100%) create mode 100644 jmeter/src/main/resources/20171213-JMeter-Jenkins.csv rename {spring-jmeter-jenkins => jmeter}/src/main/resources/JMeter-Jenkins.jmx (100%) rename {spring-jmeter-jenkins => jmeter}/src/main/resources/application.properties (100%) rename {spring-jmeter-jenkins => jmeter}/src/test/java/com/baeldung/SpringJMeterJenkinsApplicationIntegrationTest.java (100%) diff --git a/spring-jmeter-jenkins/.gitignore b/jmeter/.gitignore similarity index 100% rename from spring-jmeter-jenkins/.gitignore rename to jmeter/.gitignore diff --git a/spring-jmeter-jenkins/.mvn/wrapper/maven-wrapper.jar b/jmeter/.mvn/wrapper/maven-wrapper.jar similarity index 100% rename from spring-jmeter-jenkins/.mvn/wrapper/maven-wrapper.jar rename to jmeter/.mvn/wrapper/maven-wrapper.jar diff --git a/spring-jmeter-jenkins/.mvn/wrapper/maven-wrapper.properties b/jmeter/.mvn/wrapper/maven-wrapper.properties similarity index 100% rename from spring-jmeter-jenkins/.mvn/wrapper/maven-wrapper.properties rename to jmeter/.mvn/wrapper/maven-wrapper.properties diff --git a/spring-jmeter-jenkins/README.md b/jmeter/README.md similarity index 100% rename from spring-jmeter-jenkins/README.md rename to jmeter/README.md diff --git a/spring-jmeter-jenkins/mvnw b/jmeter/mvnw similarity index 100% rename from spring-jmeter-jenkins/mvnw rename to jmeter/mvnw diff --git a/spring-jmeter-jenkins/mvnw.cmd b/jmeter/mvnw.cmd similarity index 100% rename from spring-jmeter-jenkins/mvnw.cmd rename to jmeter/mvnw.cmd diff --git a/spring-jmeter-jenkins/pom.xml b/jmeter/pom.xml similarity index 93% rename from spring-jmeter-jenkins/pom.xml rename to jmeter/pom.xml index daef45b6d4..977e3bbc94 100644 --- a/spring-jmeter-jenkins/pom.xml +++ b/jmeter/pom.xml @@ -3,12 +3,12 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - spring-jmeter-jenkins + jmeter 0.0.1-SNAPSHOT jar - spring-jmeter-jenkins - Run and Show JMeter test with Jenkins + jmeter + Intro to Performance testing using JMeter parent-boot-5 diff --git a/spring-jmeter-jenkins/src/main/java/com/baeldung/SpringJMeterJenkinsApplication.java b/jmeter/src/main/java/com/baeldung/SpringJMeterJenkinsApplication.java similarity index 100% rename from spring-jmeter-jenkins/src/main/java/com/baeldung/SpringJMeterJenkinsApplication.java rename to jmeter/src/main/java/com/baeldung/SpringJMeterJenkinsApplication.java diff --git a/spring-jmeter-jenkins/src/main/java/com/baeldung/domain/Student.java b/jmeter/src/main/java/com/baeldung/domain/Student.java similarity index 100% rename from spring-jmeter-jenkins/src/main/java/com/baeldung/domain/Student.java rename to jmeter/src/main/java/com/baeldung/domain/Student.java diff --git a/spring-jmeter-jenkins/src/main/java/com/baeldung/repository/StudentRepository.java b/jmeter/src/main/java/com/baeldung/repository/StudentRepository.java similarity index 100% rename from spring-jmeter-jenkins/src/main/java/com/baeldung/repository/StudentRepository.java rename to jmeter/src/main/java/com/baeldung/repository/StudentRepository.java diff --git a/spring-jmeter-jenkins/src/main/resources/20171205-JMeter-Jenkins.csv b/jmeter/src/main/resources/20171205-JMeter-Jenkins.csv similarity index 100% rename from spring-jmeter-jenkins/src/main/resources/20171205-JMeter-Jenkins.csv rename to jmeter/src/main/resources/20171205-JMeter-Jenkins.csv diff --git a/jmeter/src/main/resources/20171213-JMeter-Jenkins.csv b/jmeter/src/main/resources/20171213-JMeter-Jenkins.csv new file mode 100644 index 0000000000..92650ea36f --- /dev/null +++ b/jmeter/src/main/resources/20171213-JMeter-Jenkins.csv @@ -0,0 +1,6 @@ +timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,Latency,IdleTime,Connect +1513133869106,1150,HTTP Request,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused (Connection refused),Thread Group 1-2,text,false,"The operation lasted too long: It took 1,150 milliseconds, but should not have lasted longer than 10 milliseconds.",2058,0,5,5,0,0,1150 +1513133869106,1152,HTTP Request,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused (Connection refused),Thread Group 1-5,text,false,"The operation lasted too long: It took 1,152 milliseconds, but should not have lasted longer than 10 milliseconds.",2058,0,5,5,0,0,1152 +1513133869106,1150,HTTP Request,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused (Connection refused),Thread Group 1-4,text,false,"The operation lasted too long: It took 1,150 milliseconds, but should not have lasted longer than 10 milliseconds.",2058,0,5,5,0,0,1150 +1513133869106,1152,HTTP Request,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused (Connection refused),Thread Group 1-1,text,false,"The operation lasted too long: It took 1,152 milliseconds, but should not have lasted longer than 10 milliseconds.",2058,0,5,5,0,0,1152 +1513133869104,1153,HTTP Request,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused (Connection refused),Thread Group 1-3,text,false,"The operation lasted too long: It took 1,153 milliseconds, but should not have lasted longer than 10 milliseconds.",2058,0,5,5,0,0,1153 diff --git a/spring-jmeter-jenkins/src/main/resources/JMeter-Jenkins.jmx b/jmeter/src/main/resources/JMeter-Jenkins.jmx similarity index 100% rename from spring-jmeter-jenkins/src/main/resources/JMeter-Jenkins.jmx rename to jmeter/src/main/resources/JMeter-Jenkins.jmx diff --git a/spring-jmeter-jenkins/src/main/resources/application.properties b/jmeter/src/main/resources/application.properties similarity index 100% rename from spring-jmeter-jenkins/src/main/resources/application.properties rename to jmeter/src/main/resources/application.properties diff --git a/spring-jmeter-jenkins/src/test/java/com/baeldung/SpringJMeterJenkinsApplicationIntegrationTest.java b/jmeter/src/test/java/com/baeldung/SpringJMeterJenkinsApplicationIntegrationTest.java similarity index 100% rename from spring-jmeter-jenkins/src/test/java/com/baeldung/SpringJMeterJenkinsApplicationIntegrationTest.java rename to jmeter/src/test/java/com/baeldung/SpringJMeterJenkinsApplicationIntegrationTest.java diff --git a/pom.xml b/pom.xml index 8aa9afc6b3..462d70741e 100644 --- a/pom.xml +++ b/pom.xml @@ -177,7 +177,7 @@ spring-integration spring-jenkins-pipeline spring-jersey - spring-jmeter-jenkins + jmeter spring-jms spring-jooq persistence-modules/spring-jpa From 9eb7a54316856c56ec0b3c6d2f980039774e746c Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Wed, 13 Dec 2017 04:51:20 +0100 Subject: [PATCH 36/50] Update JMeter tests --- jmeter/jmeter.log | 68 +++++++++++++++++++ .../resources/20171205-JMeter-Jenkins.csv | 6 -- .../resources/20171213-JMeter-Jenkins.csv | 6 -- jmeter/src/main/resources/20171213-JMeter.csv | 6 ++ .../{JMeter-Jenkins.jmx => JMeter.jmx} | 2 +- jmeter/src/main/resources/JMeter.jtl | 43 ++++++++++++ 6 files changed, 118 insertions(+), 13 deletions(-) create mode 100644 jmeter/jmeter.log delete mode 100644 jmeter/src/main/resources/20171205-JMeter-Jenkins.csv delete mode 100644 jmeter/src/main/resources/20171213-JMeter-Jenkins.csv create mode 100644 jmeter/src/main/resources/20171213-JMeter.csv rename jmeter/src/main/resources/{JMeter-Jenkins.jmx => JMeter.jmx} (99%) create mode 100644 jmeter/src/main/resources/JMeter.jtl diff --git a/jmeter/jmeter.log b/jmeter/jmeter.log new file mode 100644 index 0000000000..ce55007e74 --- /dev/null +++ b/jmeter/jmeter.log @@ -0,0 +1,68 @@ +2017-12-13 04:50:16,291 INFO o.a.j.u.JMeterUtils: Setting Locale to en_US +2017-12-13 04:50:16,319 INFO o.a.j.JMeter: Loading user properties from: /Users/dassiorleando/projects/biz/baeldung/jmeter/apache-jmeter-3.3/bin/user.properties +2017-12-13 04:50:16,392 INFO o.a.j.JMeter: Loading system properties from: /Users/dassiorleando/projects/biz/baeldung/jmeter/apache-jmeter-3.3/bin/system.properties +2017-12-13 04:50:16,406 INFO o.a.j.JMeter: Setting JMeter property: jmeter.save.saveservice.output_format=xml +2017-12-13 04:50:16,451 INFO o.a.j.JMeter: Copyright (c) 1998-2017 The Apache Software Foundation +2017-12-13 04:50:16,451 INFO o.a.j.JMeter: Version 3.3 r1808647 +2017-12-13 04:50:16,451 INFO o.a.j.JMeter: java.version=1.8.0_152 +2017-12-13 04:50:16,451 INFO o.a.j.JMeter: java.vm.name=Java HotSpot(TM) 64-Bit Server VM +2017-12-13 04:50:16,451 INFO o.a.j.JMeter: os.name=Mac OS X +2017-12-13 04:50:16,451 INFO o.a.j.JMeter: os.arch=x86_64 +2017-12-13 04:50:16,452 INFO o.a.j.JMeter: os.version=10.12.6 +2017-12-13 04:50:16,452 INFO o.a.j.JMeter: file.encoding=UTF-8 +2017-12-13 04:50:16,452 INFO o.a.j.JMeter: Max memory =536870912 +2017-12-13 04:50:16,452 INFO o.a.j.JMeter: Available Processors =4 +2017-12-13 04:50:16,461 INFO o.a.j.JMeter: Default Locale=English (United States) +2017-12-13 04:50:16,462 INFO o.a.j.JMeter: JMeter Locale=English (United States) +2017-12-13 04:50:16,462 INFO o.a.j.JMeter: JMeterHome=/Users/dassiorleando/projects/biz/baeldung/jmeter/apache-jmeter-3.3 +2017-12-13 04:50:16,462 INFO o.a.j.JMeter: user.dir =/Users/dassiorleando/projects/biz/baeldung/tutorials/jmeter +2017-12-13 04:50:16,462 INFO o.a.j.JMeter: PWD =/Users/dassiorleando/projects/biz/baeldung/tutorials/jmeter +2017-12-13 04:50:16,466 INFO o.a.j.JMeter: IP: 192.168.10.100 Name: MBP FullName: 192.168.10.100 +2017-12-13 04:50:16,472 INFO o.a.j.s.FileServer: Default base='/Users/dassiorleando/projects/biz/baeldung/tutorials/jmeter' +2017-12-13 04:50:16,473 INFO o.a.j.s.FileServer: Set new base='/Users/dassiorleando/projects/biz/baeldung/tutorials/jmeter/src/main/resources' +2017-12-13 04:50:17,022 INFO o.a.j.s.SaveService: Testplan (JMX) version: 2.2. Testlog (JTL) version: 2.2 +2017-12-13 04:50:17,134 INFO o.a.j.s.SaveService: Using SaveService properties file encoding UTF-8 +2017-12-13 04:50:17,142 INFO o.a.j.s.SaveService: Using SaveService properties version 3.2 +2017-12-13 04:50:17,168 INFO o.a.j.s.SaveService: Loading file: src/main/resources/JMeter.jmx +2017-12-13 04:50:17,340 INFO o.a.j.p.h.s.HTTPSamplerBase: Parser for text/html is org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser +2017-12-13 04:50:17,351 INFO o.a.j.p.h.s.HTTPSamplerBase: Parser for application/xhtml+xml is org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser +2017-12-13 04:50:17,352 INFO o.a.j.p.h.s.HTTPSamplerBase: Parser for application/xml is org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser +2017-12-13 04:50:17,352 INFO o.a.j.p.h.s.HTTPSamplerBase: Parser for text/xml is org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser +2017-12-13 04:50:17,353 INFO o.a.j.p.h.s.HTTPSamplerBase: Parser for text/vnd.wap.wml is org.apache.jmeter.protocol.http.parser.RegexpHTMLParser +2017-12-13 04:50:17,353 INFO o.a.j.p.h.s.HTTPSamplerBase: Parser for text/css is org.apache.jmeter.protocol.http.parser.CssParser +2017-12-13 04:50:17,552 INFO o.a.j.JMeter: Creating summariser +2017-12-13 04:50:17,580 INFO o.a.j.e.StandardJMeterEngine: Running the test! +2017-12-13 04:50:17,581 INFO o.a.j.s.SampleEvent: List of sample_variables: [] +2017-12-13 04:50:17,582 INFO o.a.j.s.SampleEvent: List of sample_variables: [] +2017-12-13 04:50:17,590 INFO o.a.j.e.u.CompoundVariable: Note: Function class names must contain the string: '.functions.' +2017-12-13 04:50:17,590 INFO o.a.j.e.u.CompoundVariable: Note: Function class names must not contain the string: '.gui.' +2017-12-13 04:50:18,640 INFO o.a.j.JMeter: Running test (1513137018640) +2017-12-13 04:50:18,728 INFO o.a.j.e.StandardJMeterEngine: Starting ThreadGroup: 1 : Thread Group +2017-12-13 04:50:18,737 INFO o.a.j.e.StandardJMeterEngine: Starting 5 threads for group Thread Group. +2017-12-13 04:50:18,737 INFO o.a.j.e.StandardJMeterEngine: Thread will continue on error +2017-12-13 04:50:18,738 INFO o.a.j.t.ThreadGroup: Starting thread group... number=1 threads=5 ramp-up=1 perThread=200.0 delayedStart=false +2017-12-13 04:50:18,751 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-1 +2017-12-13 04:50:18,753 INFO o.a.j.t.ThreadGroup: Started thread group number 1 +2017-12-13 04:50:18,753 INFO o.a.j.e.StandardJMeterEngine: All thread groups have been started +2017-12-13 04:50:18,786 INFO o.a.j.p.h.s.HTTPHCAbstractImpl: Local host = MBP +2017-12-13 04:50:18,797 INFO o.a.j.p.h.s.HTTPHC4Impl: HTTP request retry count = 0 +2017-12-13 04:50:18,812 INFO o.a.j.s.SampleResult: Note: Sample TimeStamps are START times +2017-12-13 04:50:18,812 INFO o.a.j.s.SampleResult: sampleresult.default.encoding is set to ISO-8859-1 +2017-12-13 04:50:18,812 INFO o.a.j.s.SampleResult: sampleresult.useNanoTime=true +2017-12-13 04:50:18,812 INFO o.a.j.s.SampleResult: sampleresult.nanoThreadSleep=5000 +2017-12-13 04:50:18,954 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-2 +2017-12-13 04:50:19,152 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-3 +2017-12-13 04:50:19,257 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-3 +2017-12-13 04:50:19,257 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-3 +2017-12-13 04:50:19,264 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-2 +2017-12-13 04:50:19,264 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-1 +2017-12-13 04:50:19,264 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-2 +2017-12-13 04:50:19,265 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-1 +2017-12-13 04:50:19,353 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-4 +2017-12-13 04:50:19,365 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-4 +2017-12-13 04:50:19,365 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-4 +2017-12-13 04:50:19,557 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-5 +2017-12-13 04:50:19,573 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-5 +2017-12-13 04:50:19,573 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-5 +2017-12-13 04:50:19,573 INFO o.a.j.e.StandardJMeterEngine: Notifying test listeners of end of test +2017-12-13 04:50:19,575 INFO o.a.j.r.Summariser: summary = 5 in 00:00:01 = 5.4/s Avg: 155 Min: 10 Max: 388 Err: 4 (80.00%) diff --git a/jmeter/src/main/resources/20171205-JMeter-Jenkins.csv b/jmeter/src/main/resources/20171205-JMeter-Jenkins.csv deleted file mode 100644 index 719fc18f41..0000000000 --- a/jmeter/src/main/resources/20171205-JMeter-Jenkins.csv +++ /dev/null @@ -1,6 +0,0 @@ -timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,Latency,IdleTime,Connect -1512454361862,181,HTTP Request,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused (Connection refused),Thread Group 1-2,text,false,"The operation lasted too long: It took 181 milliseconds, but should not have lasted longer than 10 milliseconds.",2058,0,3,3,0,0,181 -1512454361926,116,HTTP Request,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused (Connection refused),Thread Group 1-3,text,false,"The operation lasted too long: It took 116 milliseconds, but should not have lasted longer than 10 milliseconds.",2058,0,3,3,0,0,116 -1512454361862,181,HTTP Request,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused (Connection refused),Thread Group 1-1,text,false,"The operation lasted too long: It took 181 milliseconds, but should not have lasted longer than 10 milliseconds.",2058,0,3,3,0,0,181 -1512454362126,2,HTTP Request,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused (Connection refused),Thread Group 1-4,text,false,,2058,0,1,1,0,0,2 -1512454362326,2,HTTP Request,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused (Connection refused),Thread Group 1-5,text,false,,2058,0,1,1,0,0,2 diff --git a/jmeter/src/main/resources/20171213-JMeter-Jenkins.csv b/jmeter/src/main/resources/20171213-JMeter-Jenkins.csv deleted file mode 100644 index 92650ea36f..0000000000 --- a/jmeter/src/main/resources/20171213-JMeter-Jenkins.csv +++ /dev/null @@ -1,6 +0,0 @@ -timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,Latency,IdleTime,Connect -1513133869106,1150,HTTP Request,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused (Connection refused),Thread Group 1-2,text,false,"The operation lasted too long: It took 1,150 milliseconds, but should not have lasted longer than 10 milliseconds.",2058,0,5,5,0,0,1150 -1513133869106,1152,HTTP Request,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused (Connection refused),Thread Group 1-5,text,false,"The operation lasted too long: It took 1,152 milliseconds, but should not have lasted longer than 10 milliseconds.",2058,0,5,5,0,0,1152 -1513133869106,1150,HTTP Request,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused (Connection refused),Thread Group 1-4,text,false,"The operation lasted too long: It took 1,150 milliseconds, but should not have lasted longer than 10 milliseconds.",2058,0,5,5,0,0,1150 -1513133869106,1152,HTTP Request,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused (Connection refused),Thread Group 1-1,text,false,"The operation lasted too long: It took 1,152 milliseconds, but should not have lasted longer than 10 milliseconds.",2058,0,5,5,0,0,1152 -1513133869104,1153,HTTP Request,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused (Connection refused),Thread Group 1-3,text,false,"The operation lasted too long: It took 1,153 milliseconds, but should not have lasted longer than 10 milliseconds.",2058,0,5,5,0,0,1153 diff --git a/jmeter/src/main/resources/20171213-JMeter.csv b/jmeter/src/main/resources/20171213-JMeter.csv new file mode 100644 index 0000000000..6eb1a37cb0 --- /dev/null +++ b/jmeter/src/main/resources/20171213-JMeter.csv @@ -0,0 +1,6 @@ +timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,Latency,IdleTime,Connect +1513134869133,1075,HTTP Request,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused (Connection refused),Thread Group 1-4,text,false,"The operation lasted too long: It took 1,075 milliseconds, but should not have lasted longer than 10 milliseconds.",2058,0,5,5,0,0,1075 +1513134869272,935,HTTP Request,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused (Connection refused),Thread Group 1-1,text,false,"The operation lasted too long: It took 935 milliseconds, but should not have lasted longer than 10 milliseconds.",2058,0,5,5,0,0,935 +1513134869133,1075,HTTP Request,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused (Connection refused),Thread Group 1-3,text,false,"The operation lasted too long: It took 1,075 milliseconds, but should not have lasted longer than 10 milliseconds.",2058,0,5,5,0,0,1075 +1513134869272,935,HTTP Request,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused (Connection refused),Thread Group 1-2,text,false,"The operation lasted too long: It took 935 milliseconds, but should not have lasted longer than 10 milliseconds.",2058,0,5,5,0,0,934 +1513134869133,1074,HTTP Request,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused (Connection refused),Thread Group 1-5,text,false,"The operation lasted too long: It took 1,074 milliseconds, but should not have lasted longer than 10 milliseconds.",2058,0,5,5,0,0,1074 diff --git a/jmeter/src/main/resources/JMeter-Jenkins.jmx b/jmeter/src/main/resources/JMeter.jmx similarity index 99% rename from jmeter/src/main/resources/JMeter-Jenkins.jmx rename to jmeter/src/main/resources/JMeter.jmx index 49ce2dec1d..77bccb2b24 100644 --- a/jmeter/src/main/resources/JMeter-Jenkins.jmx +++ b/jmeter/src/main/resources/JMeter.jmx @@ -1,7 +1,7 @@ - + false false diff --git a/jmeter/src/main/resources/JMeter.jtl b/jmeter/src/main/resources/JMeter.jtl new file mode 100644 index 0000000000..f9259ef739 --- /dev/null +++ b/jmeter/src/main/resources/JMeter.jtl @@ -0,0 +1,43 @@ + + + + + Duration Assertion + true + false + The operation lasted too long: It took 83 milliseconds, but should not have lasted longer than 10 milliseconds. + + + + + Duration Assertion + true + false + The operation lasted too long: It took 388 milliseconds, but should not have lasted longer than 10 milliseconds. + + + + + Duration Assertion + true + false + The operation lasted too long: It took 281 milliseconds, but should not have lasted longer than 10 milliseconds. + + + + + Duration Assertion + false + false + + + + + Duration Assertion + true + false + The operation lasted too long: It took 13 milliseconds, but should not have lasted longer than 10 milliseconds. + + + + From c194284dddd5f79bd444b03e986a43aabe6d93f1 Mon Sep 17 00:00:00 2001 From: Dassi Orleando Date: Wed, 13 Dec 2017 04:59:11 +0100 Subject: [PATCH 37/50] Update spring jenkins module --- spring-jenkins-pipeline/scripted-pipeline-unix-nonunix | 5 ----- 1 file changed, 5 deletions(-) diff --git a/spring-jenkins-pipeline/scripted-pipeline-unix-nonunix b/spring-jenkins-pipeline/scripted-pipeline-unix-nonunix index 861c38c8a2..6b775b6e56 100644 --- a/spring-jenkins-pipeline/scripted-pipeline-unix-nonunix +++ b/spring-jenkins-pipeline/scripted-pipeline-unix-nonunix @@ -75,13 +75,8 @@ node { withEnv(['JENKINS_NODE_COOKIE=dontkill']) { if (isUnix()) { sh 'nohup ./mvnw spring-boot:run -Dserver.port=8989 &' - sh "while ! httping -qc1 http://localhost:8989 ; do sleep 1 ; done" - sh "curl http://localhost:8989" } else { bat 'start ./mvnw.cmd spring-boot:run -Dserver.port=8989' - // Here we need to check(loop) if localhost:8989 is up - // Once it's we continue de script - bat "curl.exe http://localhost:8989" } } } From 112f33acb9a0fd45fc640091ab836d9a0bbdfae0 Mon Sep 17 00:00:00 2001 From: Grzegorz Piwowarek Date: Wed, 13 Dec 2017 11:25:47 +0100 Subject: [PATCH 38/50] Optimize build (#3227) * Exclude NeurophTest * Fix build --- ...itoryInitialMigrationIntegrationTest.java} | 2 +- ...rRepositoryInsertDataIntegrationTest.java} | 2 +- ...llConstraintMigrationIntegrationTest.java} | 2 +- ...nstraintJavaMigrationIntegrationTest.java} | 2 +- ...ueConstraintMigrationIntegrationTest.java} | 2 +- .../{XORTest.java => XORIntegrationTest.java} | 2 +- pom.xml | 3 +- spring-acl/pom.xml | 66 ---------- .../org/baeldung/acl/config/ACLContext.java | 80 ------------ .../AclMethodSecurityConfiguration.java | 21 ---- .../acl/config/JPAPersistenceConfig.java | 16 --- .../dao/NoticeMessageRepository.java | 24 ---- .../acl/persistence/entity/NoticeMessage.java | 29 ----- spring-acl/src/main/resources/acl-data.sql | 28 ----- spring-acl/src/main/resources/acl-schema.sql | 58 --------- .../org.baeldung.acl.datasource.properties | 12 -- .../java/org/baeldung/acl/SpringAclTest.java | 119 ------------------ ...est.java => SpringACLIntegrationTest.java} | 2 +- 18 files changed, 8 insertions(+), 462 deletions(-) rename flyway/spring-flyway/src/test/java/com/baeldung/springflyway/{CustomerRepositoryInitialMigrationTest.java => CustomerRepositoryInitialMigrationIntegrationTest.java} (92%) rename flyway/spring-flyway/src/test/java/com/baeldung/springflyway/{CustomerRepositoryInsertDataMigrationTest.java => CustomerRepositoryInsertDataIntegrationTest.java} (94%) rename flyway/spring-flyway/src/test/java/com/baeldung/springflyway/{CustomerRepositoryNotNullConstraintMigrationTest.java => CustomerRepositoryNotNullConstraintMigrationIntegrationTest.java} (91%) rename flyway/spring-flyway/src/test/java/com/baeldung/springflyway/{CustomerRepositoryUniqueConstraintJavaMigrationTest.java => CustomerRepositoryUniqueConstraintJavaMigrationIntegrationTest.java} (92%) rename flyway/spring-flyway/src/test/java/com/baeldung/springflyway/{CustomerRepositoryUniqueConstraintMigrationTest.java => CustomerRepositoryUniqueConstraintMigrationIntegrationTest.java} (92%) rename libraries/src/test/java/com/baeldung/neuroph/{XORTest.java => XORIntegrationTest.java} (97%) delete mode 100644 spring-acl/pom.xml delete mode 100644 spring-acl/src/main/java/org/baeldung/acl/config/ACLContext.java delete mode 100644 spring-acl/src/main/java/org/baeldung/acl/config/AclMethodSecurityConfiguration.java delete mode 100644 spring-acl/src/main/java/org/baeldung/acl/config/JPAPersistenceConfig.java delete mode 100644 spring-acl/src/main/java/org/baeldung/acl/persistence/dao/NoticeMessageRepository.java delete mode 100644 spring-acl/src/main/java/org/baeldung/acl/persistence/entity/NoticeMessage.java delete mode 100644 spring-acl/src/main/resources/acl-data.sql delete mode 100644 spring-acl/src/main/resources/acl-schema.sql delete mode 100644 spring-acl/src/main/resources/org.baeldung.acl.datasource.properties delete mode 100644 spring-acl/src/test/java/org/baeldung/acl/SpringAclTest.java rename spring-security-acl/src/test/java/org/baeldung/acl/{SpringAclTest.java => SpringACLIntegrationTest.java} (98%) diff --git a/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryInitialMigrationTest.java b/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryInitialMigrationIntegrationTest.java similarity index 92% rename from flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryInitialMigrationTest.java rename to flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryInitialMigrationIntegrationTest.java index b3f2cb29e1..59ef5820d7 100644 --- a/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryInitialMigrationTest.java +++ b/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryInitialMigrationIntegrationTest.java @@ -12,7 +12,7 @@ import static org.junit.Assert.assertNotNull; @RunWith(SpringRunner.class) @SpringBootTest -public class CustomerRepositoryInitialMigrationTest { +public class CustomerRepositoryInitialMigrationIntegrationTest { @Autowired CustomerRepository customerRepository; diff --git a/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryInsertDataMigrationTest.java b/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryInsertDataIntegrationTest.java similarity index 94% rename from flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryInsertDataMigrationTest.java rename to flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryInsertDataIntegrationTest.java index 369e61d98f..3feedf2fd9 100644 --- a/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryInsertDataMigrationTest.java +++ b/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryInsertDataIntegrationTest.java @@ -15,7 +15,7 @@ import static org.junit.Assert.*; @RunWith(SpringRunner.class) @SpringBootTest -public class CustomerRepositoryInsertDataMigrationTest { +public class CustomerRepositoryInsertDataIntegrationTest { @Autowired CustomerRepository customerRepository; diff --git a/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryNotNullConstraintMigrationTest.java b/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryNotNullConstraintMigrationIntegrationTest.java similarity index 91% rename from flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryNotNullConstraintMigrationTest.java rename to flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryNotNullConstraintMigrationIntegrationTest.java index 90517c9225..9ec5d4d77e 100644 --- a/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryNotNullConstraintMigrationTest.java +++ b/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryNotNullConstraintMigrationIntegrationTest.java @@ -11,7 +11,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest -public class CustomerRepositoryNotNullConstraintMigrationTest { +public class CustomerRepositoryNotNullConstraintMigrationIntegrationTest { @Autowired CustomerRepository customerRepository; diff --git a/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryUniqueConstraintJavaMigrationTest.java b/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryUniqueConstraintJavaMigrationIntegrationTest.java similarity index 92% rename from flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryUniqueConstraintJavaMigrationTest.java rename to flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryUniqueConstraintJavaMigrationIntegrationTest.java index e5ba782fda..f615f477bc 100644 --- a/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryUniqueConstraintJavaMigrationTest.java +++ b/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryUniqueConstraintJavaMigrationIntegrationTest.java @@ -13,7 +13,7 @@ import org.springframework.test.context.junit4.SpringRunner; @SpringBootTest(properties = { "flyway.locations[0]=db/migration", "flyway.locations[1]=com/baeldung/springflyway/migration" }) -public class CustomerRepositoryUniqueConstraintJavaMigrationTest { +public class CustomerRepositoryUniqueConstraintJavaMigrationIntegrationTest { @Autowired CustomerRepository customerRepository; diff --git a/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryUniqueConstraintMigrationTest.java b/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryUniqueConstraintMigrationIntegrationTest.java similarity index 92% rename from flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryUniqueConstraintMigrationTest.java rename to flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryUniqueConstraintMigrationIntegrationTest.java index 9fa2dee42d..e9ac34b384 100644 --- a/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryUniqueConstraintMigrationTest.java +++ b/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryUniqueConstraintMigrationIntegrationTest.java @@ -11,7 +11,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest -public class CustomerRepositoryUniqueConstraintMigrationTest { +public class CustomerRepositoryUniqueConstraintMigrationIntegrationTest { @Autowired CustomerRepository customerRepository; diff --git a/libraries/src/test/java/com/baeldung/neuroph/XORTest.java b/libraries/src/test/java/com/baeldung/neuroph/XORIntegrationTest.java similarity index 97% rename from libraries/src/test/java/com/baeldung/neuroph/XORTest.java rename to libraries/src/test/java/com/baeldung/neuroph/XORIntegrationTest.java index 4a6ecf8e46..5da1d166f6 100644 --- a/libraries/src/test/java/com/baeldung/neuroph/XORTest.java +++ b/libraries/src/test/java/com/baeldung/neuroph/XORIntegrationTest.java @@ -7,7 +7,7 @@ import org.neuroph.core.NeuralNetwork; import static org.junit.Assert.*; -public class XORTest { +public class XORIntegrationTest { private NeuralNetwork ann = null; private void print(String input, double output, double actual) { diff --git a/pom.xml b/pom.xml index cf01712cba..b3da4655d6 100644 --- a/pom.xml +++ b/pom.xml @@ -142,7 +142,6 @@ spark-java spring-5-mvc - spring-acl spring-activiti spring-akka spring-amqp @@ -152,7 +151,7 @@ spring-batch spring-bom spring-boot - spring-boot-keycloak + spring-boot-keycloak spring-boot-bootstrap spring-cloud-data-flow spring-cloud diff --git a/spring-acl/pom.xml b/spring-acl/pom.xml deleted file mode 100644 index 3bcc0cf596..0000000000 --- a/spring-acl/pom.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - 4.0.0 - - com.baeldung - spring-acl - 0.0.1-SNAPSHOT - war - - spring-acl - Spring ACL - - - parent-boot-5 - com.baeldung - 0.0.1-SNAPSHOT - ../parent-boot-5 - - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - - com.h2database - h2 - - - - org.springframework - spring-test - test - - - - org.springframework.security - spring-security-test - test - - - - org.springframework.security - spring-security-acl - - - org.springframework.security - spring-security-config - - - org.springframework - spring-context-support - - - net.sf.ehcache - ehcache-core - 2.6.11 - jar - - - - - diff --git a/spring-acl/src/main/java/org/baeldung/acl/config/ACLContext.java b/spring-acl/src/main/java/org/baeldung/acl/config/ACLContext.java deleted file mode 100644 index 63a4ea58ef..0000000000 --- a/spring-acl/src/main/java/org/baeldung/acl/config/ACLContext.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.baeldung.acl.config; - -import javax.sql.DataSource; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.cache.ehcache.EhCacheFactoryBean; -import org.springframework.cache.ehcache.EhCacheManagerFactoryBean; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler; -import org.springframework.security.access.expression.method.MethodSecurityExpressionHandler; -import org.springframework.security.acls.AclPermissionCacheOptimizer; -import org.springframework.security.acls.AclPermissionEvaluator; -import org.springframework.security.acls.domain.AclAuthorizationStrategy; -import org.springframework.security.acls.domain.AclAuthorizationStrategyImpl; -import org.springframework.security.acls.domain.ConsoleAuditLogger; -import org.springframework.security.acls.domain.DefaultPermissionGrantingStrategy; -import org.springframework.security.acls.domain.EhCacheBasedAclCache; -import org.springframework.security.acls.jdbc.BasicLookupStrategy; -import org.springframework.security.acls.jdbc.JdbcMutableAclService; -import org.springframework.security.acls.jdbc.LookupStrategy; -import org.springframework.security.acls.model.PermissionGrantingStrategy; -import org.springframework.security.core.authority.SimpleGrantedAuthority; - -@Configuration -@EnableAutoConfiguration -public class ACLContext { - - @Autowired - DataSource dataSource; - - @Bean - public EhCacheBasedAclCache aclCache() { - return new EhCacheBasedAclCache(aclEhCacheFactoryBean().getObject(), permissionGrantingStrategy(), aclAuthorizationStrategy()); - } - - @Bean - public EhCacheFactoryBean aclEhCacheFactoryBean() { - EhCacheFactoryBean ehCacheFactoryBean = new EhCacheFactoryBean(); - ehCacheFactoryBean.setCacheManager(aclCacheManager().getObject()); - ehCacheFactoryBean.setCacheName("aclCache"); - return ehCacheFactoryBean; - } - - @Bean - public EhCacheManagerFactoryBean aclCacheManager() { - return new EhCacheManagerFactoryBean(); - } - - @Bean - public PermissionGrantingStrategy permissionGrantingStrategy() { - return new DefaultPermissionGrantingStrategy(new ConsoleAuditLogger()); - } - - @Bean - public AclAuthorizationStrategy aclAuthorizationStrategy() { - return new AclAuthorizationStrategyImpl(new SimpleGrantedAuthority("ROLE_ADMIN")); - } - - @Bean - public MethodSecurityExpressionHandler defaultMethodSecurityExpressionHandler() { - DefaultMethodSecurityExpressionHandler expressionHandler = new DefaultMethodSecurityExpressionHandler(); - AclPermissionEvaluator permissionEvaluator = new AclPermissionEvaluator(aclService()); - expressionHandler.setPermissionEvaluator(permissionEvaluator); - expressionHandler.setPermissionCacheOptimizer(new AclPermissionCacheOptimizer(aclService())); - return expressionHandler; - } - - @Bean - public LookupStrategy lookupStrategy() { - return new BasicLookupStrategy(dataSource, aclCache(), aclAuthorizationStrategy(), new ConsoleAuditLogger()); - } - - @Bean - public JdbcMutableAclService aclService() { - return new JdbcMutableAclService(dataSource, lookupStrategy(), aclCache()); - } - -} \ No newline at end of file diff --git a/spring-acl/src/main/java/org/baeldung/acl/config/AclMethodSecurityConfiguration.java b/spring-acl/src/main/java/org/baeldung/acl/config/AclMethodSecurityConfiguration.java deleted file mode 100644 index 110c4a6d24..0000000000 --- a/spring-acl/src/main/java/org/baeldung/acl/config/AclMethodSecurityConfiguration.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.baeldung.acl.config; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.access.expression.method.MethodSecurityExpressionHandler; -import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; -import org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration; - -@Configuration -@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) -public class AclMethodSecurityConfiguration extends GlobalMethodSecurityConfiguration { - - @Autowired - MethodSecurityExpressionHandler defaultMethodSecurityExpressionHandler; - - @Override - protected MethodSecurityExpressionHandler createExpressionHandler() { - return defaultMethodSecurityExpressionHandler; - } - -} diff --git a/spring-acl/src/main/java/org/baeldung/acl/config/JPAPersistenceConfig.java b/spring-acl/src/main/java/org/baeldung/acl/config/JPAPersistenceConfig.java deleted file mode 100644 index 9b87efa92c..0000000000 --- a/spring-acl/src/main/java/org/baeldung/acl/config/JPAPersistenceConfig.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.baeldung.acl.config; - -import org.springframework.boot.autoconfigure.domain.EntityScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -@Configuration -@EnableTransactionManagement -@EnableJpaRepositories(basePackages = "org.baeldung.acl.persistence.dao") -@PropertySource("classpath:org.baeldung.acl.datasource.properties") -@EntityScan(basePackages={ "org.baeldung.acl.persistence.entity" }) -public class JPAPersistenceConfig { - -} diff --git a/spring-acl/src/main/java/org/baeldung/acl/persistence/dao/NoticeMessageRepository.java b/spring-acl/src/main/java/org/baeldung/acl/persistence/dao/NoticeMessageRepository.java deleted file mode 100644 index 8662c88d6c..0000000000 --- a/spring-acl/src/main/java/org/baeldung/acl/persistence/dao/NoticeMessageRepository.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.baeldung.acl.persistence.dao; - -import java.util.List; - -import org.baeldung.acl.persistence.entity.NoticeMessage; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.repository.query.Param; -import org.springframework.security.access.prepost.PostAuthorize; -import org.springframework.security.access.prepost.PostFilter; -import org.springframework.security.access.prepost.PreAuthorize; - -public interface NoticeMessageRepository extends JpaRepository{ - - @PostFilter("hasPermission(filterObject, 'READ')") - List findAll(); - - @PostAuthorize("hasPermission(returnObject, 'READ')") - NoticeMessage findById(Integer id); - - @SuppressWarnings("unchecked") - @PreAuthorize("hasPermission(#noticeMessage, 'WRITE')") - NoticeMessage save(@Param("noticeMessage")NoticeMessage noticeMessage); - -} diff --git a/spring-acl/src/main/java/org/baeldung/acl/persistence/entity/NoticeMessage.java b/spring-acl/src/main/java/org/baeldung/acl/persistence/entity/NoticeMessage.java deleted file mode 100644 index 23f01a8edb..0000000000 --- a/spring-acl/src/main/java/org/baeldung/acl/persistence/entity/NoticeMessage.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.baeldung.acl.persistence.entity; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -@Entity -@Table(name="system_message") -public class NoticeMessage { - - @Id - @Column - private Integer id; - @Column - private String content; - public Integer getId() { - return id; - } - public void setId(Integer id) { - this.id = id; - } - public String getContent() { - return content; - } - public void setContent(String content) { - this.content = content; - } -} \ No newline at end of file diff --git a/spring-acl/src/main/resources/acl-data.sql b/spring-acl/src/main/resources/acl-data.sql deleted file mode 100644 index 6c01eaacc2..0000000000 --- a/spring-acl/src/main/resources/acl-data.sql +++ /dev/null @@ -1,28 +0,0 @@ -INSERT INTO system_message(id,content) VALUES (1,'First Level Message'); -INSERT INTO system_message(id,content) VALUES (2,'Second Level Message'); -INSERT INTO system_message(id,content) VALUES (3,'Third Level Message'); - -INSERT INTO acl_class (id, class) VALUES -(1, 'org.baeldung.acl.persistence.entity.NoticeMessage'); - -INSERT INTO acl_sid (id, principal, sid) VALUES -(1, 1, 'manager'), -(2, 1, 'hr'), -(3, 1, 'admin'), -(4, 0, 'ROLE_EDITOR'); - -INSERT INTO acl_object_identity (id, object_id_class, object_id_identity, parent_object, owner_sid, entries_inheriting) VALUES -(1, 1, 1, NULL, 3, 0), -(2, 1, 2, NULL, 3, 0), -(3, 1, 3, NULL, 3, 0) -; - -INSERT INTO acl_entry (id, acl_object_identity, ace_order, sid, mask, granting, audit_success, audit_failure) VALUES -(1, 1, 1, 1, 1, 1, 1, 1), -(2, 1, 2, 1, 2, 1, 1, 1), -(3, 1, 3, 4, 1, 1, 1, 1), -(4, 2, 1, 2, 1, 1, 1, 1), -(5, 2, 2, 4, 1, 1, 1, 1), -(6, 3, 1, 4, 1, 1, 1, 1), -(7, 3, 2, 4, 2, 1, 1, 1) -; \ No newline at end of file diff --git a/spring-acl/src/main/resources/acl-schema.sql b/spring-acl/src/main/resources/acl-schema.sql deleted file mode 100644 index 58e9394b2b..0000000000 --- a/spring-acl/src/main/resources/acl-schema.sql +++ /dev/null @@ -1,58 +0,0 @@ -create table system_message (id integer not null, content varchar(255), primary key (id)); - -CREATE TABLE IF NOT EXISTS acl_sid ( - id bigint(20) NOT NULL AUTO_INCREMENT, - principal tinyint(1) NOT NULL, - sid varchar(100) NOT NULL, - PRIMARY KEY (id), - UNIQUE KEY unique_uk_1 (sid,principal) -); - -CREATE TABLE IF NOT EXISTS acl_class ( - id bigint(20) NOT NULL AUTO_INCREMENT, - class varchar(255) NOT NULL, - PRIMARY KEY (id), - UNIQUE KEY unique_uk_2 (class) -); - -CREATE TABLE IF NOT EXISTS acl_entry ( - id bigint(20) NOT NULL AUTO_INCREMENT, - acl_object_identity bigint(20) NOT NULL, - ace_order int(11) NOT NULL, - sid bigint(20) NOT NULL, - mask int(11) NOT NULL, - granting tinyint(1) NOT NULL, - audit_success tinyint(1) NOT NULL, - audit_failure tinyint(1) NOT NULL, - PRIMARY KEY (id), - UNIQUE KEY unique_uk_4 (acl_object_identity,ace_order) -); - -CREATE TABLE IF NOT EXISTS acl_object_identity ( - id bigint(20) NOT NULL AUTO_INCREMENT, - object_id_class bigint(20) NOT NULL, - object_id_identity bigint(20) NOT NULL, - parent_object bigint(20) DEFAULT NULL, - owner_sid bigint(20) DEFAULT NULL, - entries_inheriting tinyint(1) NOT NULL, - PRIMARY KEY (id), - UNIQUE KEY unique_uk_3 (object_id_class,object_id_identity) -); - -ALTER TABLE acl_entry -ADD FOREIGN KEY (acl_object_identity) REFERENCES acl_object_identity(id); - -ALTER TABLE acl_entry -ADD FOREIGN KEY (sid) REFERENCES acl_sid(id); - --- --- Constraints for table acl_object_identity --- -ALTER TABLE acl_object_identity -ADD FOREIGN KEY (parent_object) REFERENCES acl_object_identity (id); - -ALTER TABLE acl_object_identity -ADD FOREIGN KEY (object_id_class) REFERENCES acl_class (id); - -ALTER TABLE acl_object_identity -ADD FOREIGN KEY (owner_sid) REFERENCES acl_sid (id); \ No newline at end of file diff --git a/spring-acl/src/main/resources/org.baeldung.acl.datasource.properties b/spring-acl/src/main/resources/org.baeldung.acl.datasource.properties deleted file mode 100644 index 739dd3f07c..0000000000 --- a/spring-acl/src/main/resources/org.baeldung.acl.datasource.properties +++ /dev/null @@ -1,12 +0,0 @@ -spring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_ON_EXIT=FALSE -spring.datasource.username=sa -spring.datasource.password= -spring.datasource.driverClassName=org.h2.Driver -spring.jpa.hibernate.ddl-auto=update -spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect - -spring.h2.console.path=/myconsole -spring.h2.console.enabled=true -spring.datasource.initialize=true -spring.datasource.schema=classpath:acl-schema.sql -spring.datasource.data=classpath:acl-data.sql \ No newline at end of file diff --git a/spring-acl/src/test/java/org/baeldung/acl/SpringAclTest.java b/spring-acl/src/test/java/org/baeldung/acl/SpringAclTest.java deleted file mode 100644 index fd9069d9bc..0000000000 --- a/spring-acl/src/test/java/org/baeldung/acl/SpringAclTest.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.baeldung.acl; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.List; - -import org.baeldung.acl.persistence.dao.NoticeMessageRepository; -import org.baeldung.acl.persistence.entity.NoticeMessage; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.access.AccessDeniedException; -import org.springframework.security.test.context.support.WithMockUser; -import org.springframework.security.test.context.support.WithSecurityContextTestExecutionListener; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.TestExecutionListeners; -import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; -import org.springframework.test.context.support.DirtiesContextTestExecutionListener; -import org.springframework.test.context.transaction.TransactionalTestExecutionListener; -import org.springframework.test.context.web.ServletTestExecutionListener; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration -@TestExecutionListeners(listeners={ServletTestExecutionListener.class, - DependencyInjectionTestExecutionListener.class, - DirtiesContextTestExecutionListener.class, - TransactionalTestExecutionListener.class, - WithSecurityContextTestExecutionListener.class}) -public class SpringAclTest extends AbstractJUnit4SpringContextTests{ - - private static Integer FIRST_MESSAGE_ID = 1; - private static Integer SECOND_MESSAGE_ID = 2; - private static Integer THIRD_MESSAGE_ID = 3; - private static String EDITTED_CONTENT = "EDITED"; - - @Configuration - @ComponentScan("org.baeldung.acl.*") - public static class SpringConfig { - - } - - @Autowired - NoticeMessageRepository repo; - - @Test - @WithMockUser(username="manager") - public void givenUsernameManager_whenFindAllMessage_thenReturnFirstMessage(){ - List details = repo.findAll(); - assertNotNull(details); - assertEquals(1,details.size()); - assertEquals(FIRST_MESSAGE_ID,details.get(0).getId()); - } - - @Test - @WithMockUser(username="manager") - public void givenUsernameManager_whenFindFirstMessageByIdAndUpdateFirstMessageContent_thenOK(){ - NoticeMessage firstMessage = repo.findById(FIRST_MESSAGE_ID); - assertNotNull(firstMessage); - assertEquals(FIRST_MESSAGE_ID,firstMessage.getId()); - - firstMessage.setContent(EDITTED_CONTENT); - repo.save(firstMessage); - - NoticeMessage editedFirstMessage = repo.findById(FIRST_MESSAGE_ID); - assertNotNull(editedFirstMessage); - assertEquals(FIRST_MESSAGE_ID,editedFirstMessage.getId()); - assertEquals(EDITTED_CONTENT,editedFirstMessage.getContent()); - } - - @Test - @WithMockUser(username="hr") - public void givenUsernameHr_whenFindMessageById2_thenOK(){ - NoticeMessage secondMessage = repo.findById(SECOND_MESSAGE_ID); - assertNotNull(secondMessage); - assertEquals(SECOND_MESSAGE_ID,secondMessage.getId()); - } - - @Test(expected=AccessDeniedException.class) - @WithMockUser(username="hr") - public void givenUsernameHr_whenUpdateMessageWithId2_thenFail(){ - NoticeMessage secondMessage = new NoticeMessage(); - secondMessage.setId(SECOND_MESSAGE_ID); - secondMessage.setContent(EDITTED_CONTENT); - repo.save(secondMessage); - } - - @Test - @WithMockUser(roles={"EDITOR"}) - public void givenRoleEditor_whenFindAllMessage_thenReturnThreeMessage(){ - List details = repo.findAll(); - assertNotNull(details); - assertEquals(3,details.size()); - } - - @Test - @WithMockUser(roles={"EDITOR"}) - public void givenRoleEditor_whenUpdateThirdMessage_thenOK(){ - NoticeMessage thirdMessage = new NoticeMessage(); - thirdMessage.setId(THIRD_MESSAGE_ID); - thirdMessage.setContent(EDITTED_CONTENT); - repo.save(thirdMessage); - } - - @Test(expected=AccessDeniedException.class) - @WithMockUser(roles={"EDITOR"}) - public void givenRoleEditor_whenFindFirstMessageByIdAndUpdateFirstMessageContent_thenFail(){ - NoticeMessage firstMessage = repo.findById(FIRST_MESSAGE_ID); - assertNotNull(firstMessage); - assertEquals(FIRST_MESSAGE_ID,firstMessage.getId()); - firstMessage.setContent(EDITTED_CONTENT); - repo.save(firstMessage); - } -} - \ No newline at end of file diff --git a/spring-security-acl/src/test/java/org/baeldung/acl/SpringAclTest.java b/spring-security-acl/src/test/java/org/baeldung/acl/SpringACLIntegrationTest.java similarity index 98% rename from spring-security-acl/src/test/java/org/baeldung/acl/SpringAclTest.java rename to spring-security-acl/src/test/java/org/baeldung/acl/SpringACLIntegrationTest.java index b864639d74..1460d4f47b 100644 --- a/spring-security-acl/src/test/java/org/baeldung/acl/SpringAclTest.java +++ b/spring-security-acl/src/test/java/org/baeldung/acl/SpringACLIntegrationTest.java @@ -31,7 +31,7 @@ import org.springframework.test.context.web.ServletTestExecutionListener; DirtiesContextTestExecutionListener.class, TransactionalTestExecutionListener.class, WithSecurityContextTestExecutionListener.class}) -public class SpringAclTest extends AbstractJUnit4SpringContextTests{ +public class SpringACLIntegrationTest extends AbstractJUnit4SpringContextTests{ private static Integer FIRST_MESSAGE_ID = 1; private static Integer SECOND_MESSAGE_ID = 2; From cee5dcf7b26ee7a7125c0c36e129deca19470c92 Mon Sep 17 00:00:00 2001 From: Eugen Paraschiv Date: Wed, 13 Dec 2017 14:08:18 +0200 Subject: [PATCH 39/50] adding new module --- pom.xml | 1 + spring-5-reactive/.gitignore | 12 ++ spring-5-reactive/README.md | 15 ++ spring-5-reactive/pom.xml | 203 ++++++++++++++++++ .../java/com/baeldung/Spring5Application.java | 15 ++ .../baeldung/SpringSecurity5Application.java | 34 +++ .../java/com/baeldung/functional/Actor.java | 23 ++ ...Spring5URLPatternUsingRouterFunctions.java | 61 ++++++ .../com/baeldung/functional/FormHandler.java | 41 ++++ .../FunctionalSpringBootApplication.java | 87 ++++++++ .../functional/FunctionalWebApplication.java | 80 +++++++ .../functional/IndexRewriteFilter.java | 27 +++ .../com/baeldung/functional/MyService.java | 11 + .../com/baeldung/functional/RootServlet.java | 82 +++++++ .../main/java/com/baeldung/jsonb/Person.java | 127 +++++++++++ .../com/baeldung/jsonb/PersonController.java | 58 +++++ .../baeldung/jsonb/Spring5Application.java | 30 +++ .../jupiter/MethodParameterFactory.java | 46 ++++ .../jupiter/ParameterAutowireUtils.java | 44 ++++ .../com/baeldung/jupiter/SpringExtension.java | 94 ++++++++ .../baeldung/jupiter/SpringJUnit5Config.java | 39 ++++ .../java/com/baeldung/jupiter/TestConfig.java | 20 ++ .../baeldung/persistence/DataSetupBean.java | 27 +++ .../baeldung/persistence/FooRepository.java | 10 + .../baeldung/security/GreetController.java | 37 ++++ .../com/baeldung/security/GreetService.java | 15 ++ .../com/baeldung/security/SecurityConfig.java | 42 ++++ .../src/main/java/com/baeldung/web/Foo.java | 84 ++++++++ .../java/com/baeldung/web/FooController.java | 53 +++++ .../baeldung/web/PathPatternController.java | 39 ++++ .../java/com/baeldung/web/reactive/Task.java | 28 +++ .../reactive/client/WebClientController.java | 85 ++++++++ .../src/main/resources/application.properties | 3 + .../src/main/resources/files/hello.txt | 1 + .../src/main/resources/files/test/test.txt | 1 + .../src/main/webapp/WEB-INF/web.xml | 21 ++ .../com/baeldung/Example1IntegrationTest.java | 29 +++ .../com/baeldung/Example2IntegrationTest.java | 29 +++ .../com/baeldung/ParallelIntegrationTest.java | 24 +++ .../Spring5ApplicationIntegrationTest.java | 16 ++ ...pring5JUnit4ConcurrentIntegrationTest.java | 52 +++++ .../functional/BeanRegistrationTest.java | 42 ++++ ...ng5URLPatternUsingRouterFunctionsTest.java | 110 ++++++++++ ...nctionalWebApplicationIntegrationTest.java | 141 ++++++++++++ .../baeldung/jsonb/JsonbIntegrationTest.java | 43 ++++ .../com/baeldung/jupiter/EnabledOnJava8.java | 18 ++ .../jupiter/Spring5EnabledAnnotationTest.java | 50 +++++ ...nit5ComposedAnnotationIntegrationTest.java | 38 ++++ .../jupiter/Spring5JUnit5IntegrationTest.java | 25 +++ .../Spring5JUnit5ParallelIntegrationTest.java | 25 +++ ...pring5Java8NewFeaturesIntegrationTest.java | 31 +++ ...g5ReactiveServerClientIntegrationTest.java | 94 ++++++++ .../jupiter/SpringJUnitConfigTest.java | 33 +++ .../jupiter/SpringJUnitWebConfigTest.java | 34 +++ .../com/baeldung/security/SecurityTest.java | 48 +++++ ...ernsUsingHandlerMethodIntegrationTest.java | 101 +++++++++ .../web/client/WebTestClientTest.java | 60 ++++++ .../src/test/resources/baeldung-weekly.png | Bin 0 -> 22275 bytes .../baeldung/web/PathPatternController.java | 1 - 59 files changed, 2639 insertions(+), 1 deletion(-) create mode 100644 spring-5-reactive/.gitignore create mode 100644 spring-5-reactive/README.md create mode 100644 spring-5-reactive/pom.xml create mode 100644 spring-5-reactive/src/main/java/com/baeldung/Spring5Application.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/SpringSecurity5Application.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/functional/Actor.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/functional/ExploreSpring5URLPatternUsingRouterFunctions.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/functional/FormHandler.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalSpringBootApplication.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalWebApplication.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/functional/IndexRewriteFilter.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/functional/MyService.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/functional/RootServlet.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/jsonb/Person.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/jsonb/PersonController.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/jsonb/Spring5Application.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/jupiter/MethodParameterFactory.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/jupiter/ParameterAutowireUtils.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/jupiter/SpringExtension.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/jupiter/SpringJUnit5Config.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/jupiter/TestConfig.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/persistence/DataSetupBean.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/persistence/FooRepository.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/security/GreetController.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/security/GreetService.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/security/SecurityConfig.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/web/Foo.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/web/FooController.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/web/PathPatternController.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/web/reactive/Task.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/web/reactive/client/WebClientController.java create mode 100644 spring-5-reactive/src/main/resources/application.properties create mode 100644 spring-5-reactive/src/main/resources/files/hello.txt create mode 100644 spring-5-reactive/src/main/resources/files/test/test.txt create mode 100644 spring-5-reactive/src/main/webapp/WEB-INF/web.xml create mode 100644 spring-5-reactive/src/test/java/com/baeldung/Example1IntegrationTest.java create mode 100644 spring-5-reactive/src/test/java/com/baeldung/Example2IntegrationTest.java create mode 100644 spring-5-reactive/src/test/java/com/baeldung/ParallelIntegrationTest.java create mode 100644 spring-5-reactive/src/test/java/com/baeldung/Spring5ApplicationIntegrationTest.java create mode 100644 spring-5-reactive/src/test/java/com/baeldung/Spring5JUnit4ConcurrentIntegrationTest.java create mode 100644 spring-5-reactive/src/test/java/com/baeldung/functional/BeanRegistrationTest.java create mode 100644 spring-5-reactive/src/test/java/com/baeldung/functional/ExploreSpring5URLPatternUsingRouterFunctionsTest.java create mode 100644 spring-5-reactive/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java create mode 100644 spring-5-reactive/src/test/java/com/baeldung/jsonb/JsonbIntegrationTest.java create mode 100644 spring-5-reactive/src/test/java/com/baeldung/jupiter/EnabledOnJava8.java create mode 100644 spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5EnabledAnnotationTest.java create mode 100644 spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5JUnit5ComposedAnnotationIntegrationTest.java create mode 100644 spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5JUnit5IntegrationTest.java create mode 100644 spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5JUnit5ParallelIntegrationTest.java create mode 100644 spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5Java8NewFeaturesIntegrationTest.java create mode 100644 spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5ReactiveServerClientIntegrationTest.java create mode 100644 spring-5-reactive/src/test/java/com/baeldung/jupiter/SpringJUnitConfigTest.java create mode 100644 spring-5-reactive/src/test/java/com/baeldung/jupiter/SpringJUnitWebConfigTest.java create mode 100644 spring-5-reactive/src/test/java/com/baeldung/security/SecurityTest.java create mode 100644 spring-5-reactive/src/test/java/com/baeldung/web/PathPatternsUsingHandlerMethodIntegrationTest.java create mode 100644 spring-5-reactive/src/test/java/com/baeldung/web/client/WebTestClientTest.java create mode 100644 spring-5-reactive/src/test/resources/baeldung-weekly.png diff --git a/pom.xml b/pom.xml index b3da4655d6..88f54be629 100644 --- a/pom.xml +++ b/pom.xml @@ -141,6 +141,7 @@ persistence-modules/solr spark-java + spring-5-reactive spring-5-mvc spring-activiti spring-akka diff --git a/spring-5-reactive/.gitignore b/spring-5-reactive/.gitignore new file mode 100644 index 0000000000..dec013dfa4 --- /dev/null +++ b/spring-5-reactive/.gitignore @@ -0,0 +1,12 @@ +#folders# +.idea +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* + +# Packaged files # +*.jar +*.war +*.ear \ No newline at end of file diff --git a/spring-5-reactive/README.md b/spring-5-reactive/README.md new file mode 100644 index 0000000000..400e343263 --- /dev/null +++ b/spring-5-reactive/README.md @@ -0,0 +1,15 @@ +## Spring REST Example Project + +### The Course +The "REST With Spring" Classes: http://bit.ly/restwithspring + +### Relevant Articles + +- [Concurrent Test Execution in Spring 5](http://www.baeldung.com/spring-5-concurrent-tests) +- [Introduction to the Functional Web Framework in Spring 5](http://www.baeldung.com/spring-5-functional-web) +- [Exploring the Spring 5 MVC URL Matching Improvements](http://www.baeldung.com/spring-5-mvc-url-matching) +- [Spring 5 WebClient](http://www.baeldung.com/spring-5-webclient) +- [Spring 5 Functional Bean Registration](http://www.baeldung.com/spring-5-functional-beans) +- [The SpringJUnitConfig and SpringJUnitWebConfig Annotations in Spring 5](http://www.baeldung.com/spring-5-junit-config) +- [Spring Security 5 for Reactive Applications](http://www.baeldung.com/spring-security-5-reactive) +- [Spring 5 Testing with @EnabledIf Annotation](https://github.com/eugenp/tutorials/tree/master/spring-5) diff --git a/spring-5-reactive/pom.xml b/spring-5-reactive/pom.xml new file mode 100644 index 0000000000..43d9a5ed94 --- /dev/null +++ b/spring-5-reactive/pom.xml @@ -0,0 +1,203 @@ + + + 4.0.0 + + com.baeldung + spring-5-reactive + 0.0.1-SNAPSHOT + jar + + spring-5 + spring 5 sample project about new features + + + org.springframework.boot + spring-boot-starter-parent + 2.0.0.M7 + + + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-validation + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-webflux + + + org.projectreactor + reactor-spring + ${reactor-spring.version} + + + javax.json.bind + javax.json.bind-api + ${jsonb-api.version} + + + + + + + + + + + + + + + org.apache.geronimo.specs + geronimo-json_1.1_spec + ${geronimo-json_1.1_spec.version} + + + org.apache.johnzon + johnzon-jsonb + ${johnzon.version} + + + + org.apache.commons + commons-lang3 + + + + + + org.springframework.boot + spring-boot-devtools + runtime + + + com.h2database + h2 + runtime + + + + org.springframework + spring-test + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.security + spring-security-test + test + + + + org.apache.commons + commons-collections4 + 4.1 + test + + + + org.junit.jupiter + junit-jupiter-api + ${junit.jupiter.version} + + + org.junit.jupiter + junit-jupiter-engine + ${junit.jupiter.version} + test + + + org.junit.platform + junit-platform-surefire-provider + ${junit.platform.version} + test + + + org.junit.platform + junit-platform-runner + ${junit.platform.version} + test + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + com.baeldung.Spring5Application + JAR + + + + + org.apache.maven.plugins + maven-surefire-plugin + + 3 + true + methods + true + + **/*IntegrationTest.java + **/*LiveTest.java + + + + + + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + + + UTF-8 + UTF-8 + 1.8 + 1.0.0 + 5.0.0 + 2.20 + 5.0.1.RELEASE + 1.0.1.RELEASE + 1.1.3 + 1.0 + 1.0 + + + diff --git a/spring-5-reactive/src/main/java/com/baeldung/Spring5Application.java b/spring-5-reactive/src/main/java/com/baeldung/Spring5Application.java new file mode 100644 index 0000000000..f321871646 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/Spring5Application.java @@ -0,0 +1,15 @@ +package com.baeldung; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; + +@SpringBootApplication +@ComponentScan(basePackages = { "com.baeldung.web" }) +public class Spring5Application { + + public static void main(String[] args) { + SpringApplication.run(Spring5Application.class, args); + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/SpringSecurity5Application.java b/spring-5-reactive/src/main/java/com/baeldung/SpringSecurity5Application.java new file mode 100644 index 0000000000..02c91a1879 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/SpringSecurity5Application.java @@ -0,0 +1,34 @@ +package com.baeldung; + +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.http.server.reactive.HttpHandler; +import org.springframework.http.server.reactive.ReactorHttpHandlerAdapter; +import org.springframework.web.reactive.config.EnableWebFlux; +import org.springframework.web.server.adapter.WebHttpHandlerBuilder; +import reactor.ipc.netty.NettyContext; +import reactor.ipc.netty.http.server.HttpServer; + +@ComponentScan(basePackages = {"com.baeldung.security"}) +@EnableWebFlux +public class SpringSecurity5Application { + + public static void main(String[] args) { + try (AnnotationConfigApplicationContext context = + new AnnotationConfigApplicationContext(SpringSecurity5Application.class)) { + context.getBean(NettyContext.class).onClose().block(); + } + } + + @Bean + public NettyContext nettyContext(ApplicationContext context) { + HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context) + .build(); + ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler); + HttpServer httpServer = HttpServer.create("localhost", 8080); + return httpServer.newHandler(adapter).block(); + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/functional/Actor.java b/spring-5-reactive/src/main/java/com/baeldung/functional/Actor.java new file mode 100644 index 0000000000..23c88b89e1 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/functional/Actor.java @@ -0,0 +1,23 @@ +package com.baeldung.functional; + +class Actor { + private String firstname; + private String lastname; + + public Actor() { + } + + public Actor(String firstname, String lastname) { + this.firstname = firstname; + this.lastname = lastname; + } + + public String getFirstname() { + return firstname; + } + + public String getLastname() { + return lastname; + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/functional/ExploreSpring5URLPatternUsingRouterFunctions.java b/spring-5-reactive/src/main/java/com/baeldung/functional/ExploreSpring5URLPatternUsingRouterFunctions.java new file mode 100644 index 0000000000..2a6d04538c --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/functional/ExploreSpring5URLPatternUsingRouterFunctions.java @@ -0,0 +1,61 @@ +package com.baeldung.functional; + +import static org.springframework.web.reactive.function.BodyInserters.fromObject; +import static org.springframework.web.reactive.function.server.RequestPredicates.GET; +import static org.springframework.web.reactive.function.server.RouterFunctions.route; +import static org.springframework.web.reactive.function.server.RouterFunctions.toHttpHandler; +import static org.springframework.web.reactive.function.server.ServerResponse.ok; + +import org.apache.catalina.Context; +import org.apache.catalina.startup.Tomcat; +import org.springframework.boot.web.embedded.tomcat.TomcatWebServer; +import org.springframework.boot.web.server.WebServer; +import org.springframework.core.io.ClassPathResource; +import org.springframework.http.server.reactive.HttpHandler; +import org.springframework.http.server.reactive.ServletHttpHandlerAdapter; +import org.springframework.web.reactive.function.server.RouterFunction; +import org.springframework.web.reactive.function.server.RouterFunctions; +import org.springframework.web.reactive.function.server.ServerResponse; +import org.springframework.web.server.WebHandler; +import org.springframework.web.server.adapter.WebHttpHandlerBuilder; + +public class ExploreSpring5URLPatternUsingRouterFunctions { + + private RouterFunction routingFunction() { + + return route(GET("/p?ths"), serverRequest -> ok().body(fromObject("/p?ths"))).andRoute(GET("/test/{*id}"), serverRequest -> ok().body(fromObject(serverRequest.pathVariable("id")))) + .andRoute(GET("/*card"), serverRequest -> ok().body(fromObject("/*card path was accessed"))) + .andRoute(GET("/{var1}_{var2}"), serverRequest -> ok().body(fromObject(serverRequest.pathVariable("var1") + " , " + serverRequest.pathVariable("var2")))) + .andRoute(GET("/{baeldung:[a-z]+}"), serverRequest -> ok().body(fromObject("/{baeldung:[a-z]+} was accessed and baeldung=" + serverRequest.pathVariable("baeldung")))) + .and(RouterFunctions.resources("/files/{*filepaths}", new ClassPathResource("files/"))); + } + + WebServer start() throws Exception { + WebHandler webHandler = (WebHandler) toHttpHandler(routingFunction()); + HttpHandler httpHandler = WebHttpHandlerBuilder.webHandler(webHandler) + .filter(new IndexRewriteFilter()) + .build(); + + Tomcat tomcat = new Tomcat(); + tomcat.setHostname("localhost"); + tomcat.setPort(9090); + Context rootContext = tomcat.addContext("", System.getProperty("java.io.tmpdir")); + ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler); + Tomcat.addServlet(rootContext, "httpHandlerServlet", servlet); + rootContext.addServletMappingDecoded("/", "httpHandlerServlet"); + + TomcatWebServer server = new TomcatWebServer(tomcat); + server.start(); + return server; + + } + + public static void main(String[] args) { + try { + new FunctionalWebApplication().start(); + } catch (Exception e) { + e.printStackTrace(); + } + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/functional/FormHandler.java b/spring-5-reactive/src/main/java/com/baeldung/functional/FormHandler.java new file mode 100644 index 0000000000..05069735bb --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/functional/FormHandler.java @@ -0,0 +1,41 @@ +package com.baeldung.functional; + +import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.util.MultiValueMap; +import org.springframework.web.reactive.function.server.ServerRequest; +import org.springframework.web.reactive.function.server.ServerResponse; +import reactor.core.publisher.Mono; + +import java.util.List; +import java.util.concurrent.atomic.AtomicLong; + +import static org.springframework.web.reactive.function.BodyExtractors.toDataBuffers; +import static org.springframework.web.reactive.function.BodyExtractors.toFormData; +import static org.springframework.web.reactive.function.BodyInserters.fromObject; +import static org.springframework.web.reactive.function.server.ServerResponse.ok; + +public class FormHandler { + + Mono handleLogin(ServerRequest request) { + return request.body(toFormData()) + .map(MultiValueMap::toSingleValueMap) + .filter(formData -> "baeldung".equals(formData.get("user"))) + .filter(formData -> "you_know_what_to_do".equals(formData.get("token"))) + .flatMap(formData -> ok().body(Mono.just("welcome back!"), String.class)) + .switchIfEmpty(ServerResponse.badRequest() + .build()); + } + + Mono handleUpload(ServerRequest request) { + return request.body(toDataBuffers()) + .collectList() + .flatMap(dataBuffers -> ok().body(fromObject(extractData(dataBuffers).toString()))); + } + + private AtomicLong extractData(List dataBuffers) { + AtomicLong atomicLong = new AtomicLong(0); + dataBuffers.forEach(d -> atomicLong.addAndGet(d.asByteBuffer() + .array().length)); + return atomicLong; + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalSpringBootApplication.java b/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalSpringBootApplication.java new file mode 100644 index 0000000000..402b607b19 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalSpringBootApplication.java @@ -0,0 +1,87 @@ +package com.baeldung.functional; + +import static org.springframework.web.reactive.function.BodyInserters.fromObject; +import static org.springframework.web.reactive.function.server.RequestPredicates.GET; +import static org.springframework.web.reactive.function.server.RequestPredicates.POST; +import static org.springframework.web.reactive.function.server.RequestPredicates.path; +import static org.springframework.web.reactive.function.server.RouterFunctions.route; +import static org.springframework.web.reactive.function.server.RouterFunctions.toHttpHandler; +import static org.springframework.web.reactive.function.server.ServerResponse.ok; + +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import org.springframework.core.io.ClassPathResource; +import org.springframework.http.server.reactive.HttpHandler; +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.web.reactive.function.server.RouterFunction; +import org.springframework.web.reactive.function.server.RouterFunctions; +import org.springframework.web.reactive.function.server.ServerResponse; +import org.springframework.web.server.WebHandler; +import org.springframework.web.server.adapter.WebHttpHandlerBuilder; + +import reactor.core.publisher.Flux; + +@SpringBootApplication +@ComponentScan(basePackages = { "com.baeldung.functional" }) +public class FunctionalSpringBootApplication { + + private static final Actor BRAD_PITT = new Actor("Brad", "Pitt"); + private static final Actor TOM_HANKS = new Actor("Tom", "Hanks"); + private static final List actors = new CopyOnWriteArrayList<>(Arrays.asList(BRAD_PITT, TOM_HANKS)); + + private RouterFunction routingFunction() { + FormHandler formHandler = new FormHandler(); + + RouterFunction restfulRouter = route(GET("/"), serverRequest -> ok().body(Flux.fromIterable(actors), Actor.class)).andRoute(POST("/"), serverRequest -> serverRequest.bodyToMono(Actor.class) + .doOnNext(actors::add) + .then(ok().build())); + + return route(GET("/test"), serverRequest -> ok().body(fromObject("helloworld"))).andRoute(POST("/login"), formHandler::handleLogin) + .andRoute(POST("/upload"), formHandler::handleUpload) + .and(RouterFunctions.resources("/files/**", new ClassPathResource("files/"))) + .andNest(path("/actor"), restfulRouter) + .filter((request, next) -> { + System.out.println("Before handler invocation: " + request.path()); + return next.handle(request); + }); + } + + @Bean + public ServletRegistrationBean servletRegistrationBean() throws Exception { + HttpHandler httpHandler = WebHttpHandlerBuilder.webHandler((WebHandler) toHttpHandler(routingFunction())) + .filter(new IndexRewriteFilter()) + .build(); + ServletRegistrationBean registrationBean = new ServletRegistrationBean<>(new RootServlet(httpHandler), "/"); + registrationBean.setLoadOnStartup(1); + registrationBean.setAsyncSupported(true); + return registrationBean; + } + + @Configuration + @EnableWebSecurity + @Profile("!https") + static class SecurityConfig extends WebSecurityConfigurerAdapter { + @Override + protected void configure(final HttpSecurity http) throws Exception { + http.authorizeRequests() + .anyRequest() + .permitAll(); + } + } + + public static void main(String[] args) { + SpringApplication.run(FunctionalSpringBootApplication.class, args); + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalWebApplication.java b/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalWebApplication.java new file mode 100644 index 0000000000..5a7d70d3db --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalWebApplication.java @@ -0,0 +1,80 @@ +package com.baeldung.functional; + +import static org.springframework.web.reactive.function.BodyInserters.fromObject; +import static org.springframework.web.reactive.function.server.RequestPredicates.GET; +import static org.springframework.web.reactive.function.server.RequestPredicates.POST; +import static org.springframework.web.reactive.function.server.RequestPredicates.path; +import static org.springframework.web.reactive.function.server.RouterFunctions.route; +import static org.springframework.web.reactive.function.server.RouterFunctions.toHttpHandler; +import static org.springframework.web.reactive.function.server.ServerResponse.ok; + +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; + +import org.apache.catalina.Context; +import org.apache.catalina.startup.Tomcat; +import org.springframework.boot.web.embedded.tomcat.TomcatWebServer; +import org.springframework.boot.web.server.WebServer; +import org.springframework.core.io.ClassPathResource; +import org.springframework.http.server.reactive.HttpHandler; +import org.springframework.http.server.reactive.ServletHttpHandlerAdapter; +import org.springframework.web.reactive.function.server.RouterFunction; +import org.springframework.web.reactive.function.server.RouterFunctions; +import org.springframework.web.reactive.function.server.ServerResponse; +import org.springframework.web.server.WebHandler; +import org.springframework.web.server.adapter.WebHttpHandlerBuilder; + +import reactor.core.publisher.Flux; + +public class FunctionalWebApplication { + + private static final Actor BRAD_PITT = new Actor("Brad", "Pitt"); + private static final Actor TOM_HANKS = new Actor("Tom", "Hanks"); + private static final List actors = new CopyOnWriteArrayList<>(Arrays.asList(BRAD_PITT, TOM_HANKS)); + + private RouterFunction routingFunction() { + FormHandler formHandler = new FormHandler(); + + RouterFunction restfulRouter = route(GET("/"), serverRequest -> ok().body(Flux.fromIterable(actors), Actor.class)).andRoute(POST("/"), serverRequest -> serverRequest.bodyToMono(Actor.class) + .doOnNext(actors::add) + .then(ok().build())); + + return route(GET("/test"), serverRequest -> ok().body(fromObject("helloworld"))).andRoute(POST("/login"), formHandler::handleLogin) + .andRoute(POST("/upload"), formHandler::handleUpload) + .and(RouterFunctions.resources("/files/**", new ClassPathResource("files/"))) + .andNest(path("/actor"), restfulRouter) + .filter((request, next) -> { + System.out.println("Before handler invocation: " + request.path()); + return next.handle(request); + }); + } + + WebServer start() throws Exception { + WebHandler webHandler = (WebHandler) toHttpHandler(routingFunction()); + HttpHandler httpHandler = WebHttpHandlerBuilder.webHandler(webHandler) + .filter(new IndexRewriteFilter()) + .build(); + + Tomcat tomcat = new Tomcat(); + tomcat.setHostname("localhost"); + tomcat.setPort(9090); + Context rootContext = tomcat.addContext("", System.getProperty("java.io.tmpdir")); + ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler); + Tomcat.addServlet(rootContext, "httpHandlerServlet", servlet); + rootContext.addServletMappingDecoded("/", "httpHandlerServlet"); + + TomcatWebServer server = new TomcatWebServer(tomcat); + server.start(); + return server; + + } + + public static void main(String[] args) { + try { + new FunctionalWebApplication().start(); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/functional/IndexRewriteFilter.java b/spring-5-reactive/src/main/java/com/baeldung/functional/IndexRewriteFilter.java new file mode 100644 index 0000000000..3e91a0354b --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/functional/IndexRewriteFilter.java @@ -0,0 +1,27 @@ +package com.baeldung.functional; + +import org.springframework.http.server.reactive.ServerHttpRequest; +import org.springframework.web.server.ServerWebExchange; +import org.springframework.web.server.WebFilter; +import org.springframework.web.server.WebFilterChain; +import reactor.core.publisher.Mono; + +class IndexRewriteFilter implements WebFilter { + + @Override + public Mono filter(ServerWebExchange serverWebExchange, WebFilterChain webFilterChain) { + ServerHttpRequest request = serverWebExchange.getRequest(); + if (request.getURI() + .getPath() + .equals("/")) { + return webFilterChain.filter(serverWebExchange.mutate() + .request(builder -> builder.method(request.getMethod()) + .contextPath(request.getPath() + .toString()) + .path("/test")) + .build()); + } + return webFilterChain.filter(serverWebExchange); + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/functional/MyService.java b/spring-5-reactive/src/main/java/com/baeldung/functional/MyService.java new file mode 100644 index 0000000000..b7b8b13d8b --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/functional/MyService.java @@ -0,0 +1,11 @@ +package com.baeldung.functional; + +import java.util.Random; + +public class MyService { + + public int getRandomNumber() { + return (new Random().nextInt(10)); + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/functional/RootServlet.java b/spring-5-reactive/src/main/java/com/baeldung/functional/RootServlet.java new file mode 100644 index 0000000000..8fe24821de --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/functional/RootServlet.java @@ -0,0 +1,82 @@ +package com.baeldung.functional; + +import static org.springframework.web.reactive.function.BodyExtractors.toDataBuffers; +import static org.springframework.web.reactive.function.BodyExtractors.toFormData; +import static org.springframework.web.reactive.function.BodyInserters.fromObject; +import static org.springframework.web.reactive.function.server.RequestPredicates.GET; +import static org.springframework.web.reactive.function.server.RequestPredicates.POST; +import static org.springframework.web.reactive.function.server.RequestPredicates.path; +import static org.springframework.web.reactive.function.server.RouterFunctions.route; +import static org.springframework.web.reactive.function.server.RouterFunctions.toHttpHandler; +import static org.springframework.web.reactive.function.server.ServerResponse.ok; + +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.atomic.AtomicLong; + +import org.springframework.core.io.ClassPathResource; +import org.springframework.http.server.reactive.HttpHandler; +import org.springframework.http.server.reactive.ServletHttpHandlerAdapter; +import org.springframework.util.MultiValueMap; +import org.springframework.web.reactive.function.server.RouterFunction; +import org.springframework.web.reactive.function.server.RouterFunctions; +import org.springframework.web.reactive.function.server.ServerResponse; +import org.springframework.web.server.WebHandler; +import org.springframework.web.server.adapter.WebHttpHandlerBuilder; + +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public class RootServlet extends ServletHttpHandlerAdapter { + + public RootServlet() { + this(WebHttpHandlerBuilder.webHandler((WebHandler) toHttpHandler(routingFunction())) + .filter(new IndexRewriteFilter()) + .build()); + } + + RootServlet(HttpHandler httpHandler) { + super(httpHandler); + } + + private static final Actor BRAD_PITT = new Actor("Brad", "Pitt"); + private static final Actor TOM_HANKS = new Actor("Tom", "Hanks"); + private static final List actors = new CopyOnWriteArrayList<>(Arrays.asList(BRAD_PITT, TOM_HANKS)); + + private static RouterFunction routingFunction() { + + return route(GET("/test"), serverRequest -> ok().body(fromObject("helloworld"))).andRoute(POST("/login"), serverRequest -> serverRequest.body(toFormData()) + .map(MultiValueMap::toSingleValueMap) + .map(formData -> { + System.out.println("form data: " + formData.toString()); + if ("baeldung".equals(formData.get("user")) && "you_know_what_to_do".equals(formData.get("token"))) { + return ok().body(Mono.just("welcome back!"), String.class) + .block(); + } + return ServerResponse.badRequest() + .build() + .block(); + })) + .andRoute(POST("/upload"), serverRequest -> serverRequest.body(toDataBuffers()) + .collectList() + .map(dataBuffers -> { + AtomicLong atomicLong = new AtomicLong(0); + dataBuffers.forEach(d -> atomicLong.addAndGet(d.asByteBuffer() + .array().length)); + System.out.println("data length:" + atomicLong.get()); + return ok().body(fromObject(atomicLong.toString())) + .block(); + })) + .and(RouterFunctions.resources("/files/**", new ClassPathResource("files/"))) + .andNest(path("/actor"), route(GET("/"), serverRequest -> ok().body(Flux.fromIterable(actors), Actor.class)).andRoute(POST("/"), serverRequest -> serverRequest.bodyToMono(Actor.class) + .doOnNext(actors::add) + .then(ok().build()))) + .filter((request, next) -> { + System.out.println("Before handler invocation: " + request.path()); + return next.handle(request); + }); + + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/jsonb/Person.java b/spring-5-reactive/src/main/java/com/baeldung/jsonb/Person.java new file mode 100644 index 0000000000..7a54b37574 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/jsonb/Person.java @@ -0,0 +1,127 @@ +package com.baeldung.jsonb; + +import java.math.BigDecimal; +import java.time.LocalDate; + +import javax.json.bind.annotation.JsonbDateFormat; +import javax.json.bind.annotation.JsonbNumberFormat; +import javax.json.bind.annotation.JsonbProperty; +import javax.json.bind.annotation.JsonbTransient; + +public class Person { + + private int id; + @JsonbProperty("person-name") + private String name; + @JsonbProperty(nillable = true) + private String email; + @JsonbTransient + private int age; + @JsonbDateFormat("dd-MM-yyyy") + private LocalDate registeredDate; + private BigDecimal salary; + + public Person() { + } + + public Person(int id, String name, String email, int age, LocalDate registeredDate, BigDecimal salary) { + super(); + this.id = id; + this.name = name; + this.email = email; + this.age = age; + this.registeredDate = registeredDate; + this.salary = salary; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @JsonbNumberFormat(locale = "en_US", value = "#0.0") + public BigDecimal getSalary() { + return salary; + } + + public void setSalary(BigDecimal salary) { + this.salary = salary; + } + + public LocalDate getRegisteredDate() { + return registeredDate; + } + + public void setRegisteredDate(LocalDate registeredDate) { + this.registeredDate = registeredDate; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("Person [id="); + builder.append(id); + builder.append(", name="); + builder.append(name); + builder.append(", email="); + builder.append(email); + builder.append(", age="); + builder.append(age); + builder.append(", registeredDate="); + builder.append(registeredDate); + builder.append(", salary="); + builder.append(salary); + builder.append("]"); + return builder.toString(); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + id; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Person other = (Person) obj; + if (id != other.id) + return false; + return true; + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/jsonb/PersonController.java b/spring-5-reactive/src/main/java/com/baeldung/jsonb/PersonController.java new file mode 100644 index 0000000000..e216a282eb --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/jsonb/PersonController.java @@ -0,0 +1,58 @@ +package com.baeldung.jsonb; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.PostConstruct; + +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestController; + +@RestController("/person") +public class PersonController { + + List personRepository; + + @PostConstruct + public void init() { + // @formatter:off + personRepository = new ArrayList<>(Arrays.asList( + new Person(1, "Jhon", "jhon@test.com", 20, LocalDate.of(2019, 9, 9), BigDecimal.valueOf(1000)), + new Person(2, "Jhon", "jhon1@test.com", 20, LocalDate.of(2019, 9, 9), BigDecimal.valueOf(1500)), + new Person(3, "Jhon", null, 20, LocalDate.of(2019, 9, 9), BigDecimal.valueOf(1000)), + new Person(4, "Tom", "tom@test.com", 21, LocalDate.of(2019, 9, 9), BigDecimal.valueOf(1500)), + new Person(5, "Mark", "mark@test.com", 21, LocalDate.of(2019, 9, 9), BigDecimal.valueOf(1200)), + new Person(6, "Julia", "jhon@test.com", 20, LocalDate.of(2019, 9, 9), BigDecimal.valueOf(1000)))); + // @formatter:on + + } + + @GetMapping("/person/{id}") + @ResponseBody + public Person findById(@PathVariable final int id) { + return personRepository.get(id); + } + + @PostMapping("/person") + @ResponseStatus(HttpStatus.OK) + @ResponseBody + public boolean insertPerson(@RequestBody final Person person) { + return personRepository.add(person); + } + + @GetMapping("/person") + @ResponseBody + public List findAll() { + return personRepository; + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/jsonb/Spring5Application.java b/spring-5-reactive/src/main/java/com/baeldung/jsonb/Spring5Application.java new file mode 100644 index 0000000000..00fce06834 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/jsonb/Spring5Application.java @@ -0,0 +1,30 @@ +package com.baeldung.jsonb; + +import java.util.ArrayList; +import java.util.Collection; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.http.HttpMessageConverters; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.converter.json.JsonbHttpMessageConverter; + +@SpringBootApplication +@ComponentScan(basePackages = { "com.baeldung.jsonb" }) +public class Spring5Application { + + public static void main(String[] args) { + SpringApplication.run(Spring5Application.class, args); + } + + @Bean + public HttpMessageConverters customConverters() { + Collection> messageConverters = new ArrayList<>(); + JsonbHttpMessageConverter jsonbHttpMessageConverter = new JsonbHttpMessageConverter(); + messageConverters.add(jsonbHttpMessageConverter); + return new HttpMessageConverters(true, messageConverters); + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/jupiter/MethodParameterFactory.java b/spring-5-reactive/src/main/java/com/baeldung/jupiter/MethodParameterFactory.java new file mode 100644 index 0000000000..85bd505d11 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/jupiter/MethodParameterFactory.java @@ -0,0 +1,46 @@ +package com.baeldung.jupiter; + +import org.springframework.core.MethodParameter; +import org.springframework.core.annotation.SynthesizingMethodParameter; +import org.springframework.util.Assert; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Executable; +import java.lang.reflect.Method; +import java.lang.reflect.Parameter; + +abstract class MethodParameterFactory { + + private MethodParameterFactory() { + } + + public static MethodParameter createMethodParameter(Parameter parameter) { + Assert.notNull(parameter, "Parameter must not be null"); + Executable executable = parameter.getDeclaringExecutable(); + if (executable instanceof Method) { + return new MethodParameter((Method) executable, getIndex(parameter)); + } + return new MethodParameter((Constructor) executable, getIndex(parameter)); + } + + public static SynthesizingMethodParameter createSynthesizingMethodParameter(Parameter parameter) { + Assert.notNull(parameter, "Parameter must not be null"); + Executable executable = parameter.getDeclaringExecutable(); + if (executable instanceof Method) { + return new SynthesizingMethodParameter((Method) executable, getIndex(parameter)); + } + throw new UnsupportedOperationException("Cannot create a SynthesizingMethodParameter for a constructor parameter: " + parameter); + } + + private static int getIndex(Parameter parameter) { + Assert.notNull(parameter, "Parameter must not be null"); + Executable executable = parameter.getDeclaringExecutable(); + Parameter[] parameters = executable.getParameters(); + for (int i = 0; i < parameters.length; i++) { + if (parameters[i] == parameter) { + return i; + } + } + throw new IllegalStateException(String.format("Failed to resolve index of parameter [%s] in executable [%s]", parameter, executable.toGenericString())); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/jupiter/ParameterAutowireUtils.java b/spring-5-reactive/src/main/java/com/baeldung/jupiter/ParameterAutowireUtils.java new file mode 100644 index 0000000000..d1a4cc8b29 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/jupiter/ParameterAutowireUtils.java @@ -0,0 +1,44 @@ +package com.baeldung.jupiter; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.beans.factory.config.DependencyDescriptor; +import org.springframework.context.ApplicationContext; +import org.springframework.core.MethodParameter; +import org.springframework.core.annotation.AnnotatedElementUtils; + +import java.lang.annotation.Annotation; +import java.lang.reflect.AnnotatedElement; +import java.lang.reflect.Method; +import java.lang.reflect.Parameter; +import java.util.Optional; + +import static org.springframework.core.annotation.AnnotatedElementUtils.hasAnnotation; + +abstract class ParameterAutowireUtils { + + private ParameterAutowireUtils() { + } + + public static boolean isAutowirable(Parameter parameter) { + return ApplicationContext.class.isAssignableFrom(parameter.getType()) || hasAnnotation(parameter, Autowired.class) || hasAnnotation(parameter, Qualifier.class) || hasAnnotation(parameter, Value.class); + } + + public static Object resolveDependency(Parameter parameter, Class containingClass, ApplicationContext applicationContext) { + + boolean required = findMergedAnnotation(parameter, Autowired.class).map(Autowired::required) + .orElse(true); + MethodParameter methodParameter = (parameter.getDeclaringExecutable() instanceof Method ? MethodParameterFactory.createSynthesizingMethodParameter(parameter) : MethodParameterFactory.createMethodParameter(parameter)); + DependencyDescriptor descriptor = new DependencyDescriptor(methodParameter, required); + descriptor.setContainingClass(containingClass); + + return applicationContext.getAutowireCapableBeanFactory() + .resolveDependency(descriptor, null); + } + + private static Optional findMergedAnnotation(AnnotatedElement element, Class annotationType) { + + return Optional.ofNullable(AnnotatedElementUtils.findMergedAnnotation(element, annotationType)); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/jupiter/SpringExtension.java b/spring-5-reactive/src/main/java/com/baeldung/jupiter/SpringExtension.java new file mode 100644 index 0000000000..7218d984ef --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/jupiter/SpringExtension.java @@ -0,0 +1,94 @@ +package com.baeldung.jupiter; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Executable; +import java.lang.reflect.Method; +import java.lang.reflect.Parameter; + +import org.junit.jupiter.api.extension.AfterAllCallback; +import org.junit.jupiter.api.extension.AfterEachCallback; +import org.junit.jupiter.api.extension.BeforeAllCallback; +import org.junit.jupiter.api.extension.BeforeEachCallback; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.ParameterContext; +import org.junit.jupiter.api.extension.ParameterResolutionException; +import org.junit.jupiter.api.extension.ParameterResolver; +import org.junit.jupiter.api.extension.TestInstancePostProcessor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.core.annotation.AnnotatedElementUtils; +import org.springframework.test.context.TestContextManager; +import org.springframework.util.Assert; + +public class SpringExtension implements BeforeAllCallback, AfterAllCallback, TestInstancePostProcessor, BeforeEachCallback, AfterEachCallback, ParameterResolver { + + private static final ExtensionContext.Namespace namespace = ExtensionContext.Namespace.create(SpringExtension.class); + + @Override + public void beforeAll(ExtensionContext context) throws Exception { + getTestContextManager(context).beforeTestClass(); + } + + @Override + public void afterAll(ExtensionContext context) throws Exception { + try { + getTestContextManager(context).afterTestClass(); + } finally { + context.getStore(namespace) + .remove(context.getTestClass() + .get()); + } + } + + @Override + public void postProcessTestInstance(Object testInstance, ExtensionContext context) throws Exception { + getTestContextManager(context).prepareTestInstance(testInstance); + } + + @Override + public void beforeEach(ExtensionContext context) throws Exception { + Object testInstance = context.getTestInstance(); + Method testMethod = context.getTestMethod() + .get(); + getTestContextManager(context).beforeTestMethod(testInstance, testMethod); + } + + @Override + public void afterEach(ExtensionContext context) throws Exception { + Object testInstance = context.getTestInstance(); + Method testMethod = context.getTestMethod() + .get(); + Throwable testException = context.getExecutionException() + .orElse(null); + getTestContextManager(context).afterTestMethod(testInstance, testMethod, testException); + } + + @Override + public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException { + Parameter parameter = parameterContext.getParameter(); + Executable executable = parameter.getDeclaringExecutable(); + return ((executable instanceof Constructor) && AnnotatedElementUtils.hasAnnotation(executable, Autowired.class)) || ParameterAutowireUtils.isAutowirable(parameter); + } + + @Override + public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException { + Parameter parameter = parameterContext.getParameter(); + Class testClass = extensionContext.getTestClass() + .get(); + ApplicationContext applicationContext = getApplicationContext(extensionContext); + return ParameterAutowireUtils.resolveDependency(parameter, testClass, applicationContext); + } + + private ApplicationContext getApplicationContext(ExtensionContext context) { + return getTestContextManager(context).getTestContext() + .getApplicationContext(); + } + + private TestContextManager getTestContextManager(ExtensionContext context) { + Assert.notNull(context, "ExtensionContext must not be null"); + Class testClass = context.getTestClass() + .get(); + ExtensionContext.Store store = context.getStore(namespace); + return store.getOrComputeIfAbsent(testClass, TestContextManager::new, TestContextManager.class); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/jupiter/SpringJUnit5Config.java b/spring-5-reactive/src/main/java/com/baeldung/jupiter/SpringJUnit5Config.java new file mode 100644 index 0000000000..8f02d71d49 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/jupiter/SpringJUnit5Config.java @@ -0,0 +1,39 @@ +package com.baeldung.jupiter; + +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.context.ApplicationContextInitializer; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.core.annotation.AliasFor; +import org.springframework.test.context.ContextConfiguration; + +import java.lang.annotation.*; + +@ExtendWith(SpringExtension.class) +@ContextConfiguration +@Documented +@Inherited +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface SpringJUnit5Config { + + @AliasFor(annotation = ContextConfiguration.class, attribute = "classes") + Class[] value() default {}; + + @AliasFor(annotation = ContextConfiguration.class) + Class[] classes() default {}; + + @AliasFor(annotation = ContextConfiguration.class) + String[] locations() default {}; + + @AliasFor(annotation = ContextConfiguration.class) + Class>[] initializers() default {}; + + @AliasFor(annotation = ContextConfiguration.class) + boolean inheritLocations() default true; + + @AliasFor(annotation = ContextConfiguration.class) + boolean inheritInitializers() default true; + + @AliasFor(annotation = ContextConfiguration.class) + String name() default ""; +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/jupiter/TestConfig.java b/spring-5-reactive/src/main/java/com/baeldung/jupiter/TestConfig.java new file mode 100644 index 0000000000..a29f77c5df --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/jupiter/TestConfig.java @@ -0,0 +1,20 @@ +package com.baeldung.jupiter; + +import com.baeldung.web.reactive.Task; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; + +@Configuration +public class TestConfig { + + @Bean + static PropertySourcesPlaceholderConfigurer placeholderConfigurer() { + return new PropertySourcesPlaceholderConfigurer(); + } + + @Bean + Task taskName() { + return new Task("taskName", 1); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/persistence/DataSetupBean.java b/spring-5-reactive/src/main/java/com/baeldung/persistence/DataSetupBean.java new file mode 100644 index 0000000000..9f5d9ff6c2 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/persistence/DataSetupBean.java @@ -0,0 +1,27 @@ +package com.baeldung.persistence; + +import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; + +import java.util.stream.IntStream; + +import org.springframework.beans.factory.InitializingBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.baeldung.web.Foo; + +@Component +public class DataSetupBean implements InitializingBean { + + @Autowired + private FooRepository repo; + + // + + @Override + public void afterPropertiesSet() throws Exception { + IntStream.range(1, 20) + .forEach(i -> repo.save(new Foo(randomAlphabetic(8)))); + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/persistence/FooRepository.java b/spring-5-reactive/src/main/java/com/baeldung/persistence/FooRepository.java new file mode 100644 index 0000000000..1f1e071158 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/persistence/FooRepository.java @@ -0,0 +1,10 @@ +package com.baeldung.persistence; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +import com.baeldung.web.Foo; + +public interface FooRepository extends JpaRepository, JpaSpecificationExecutor { + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/security/GreetController.java b/spring-5-reactive/src/main/java/com/baeldung/security/GreetController.java new file mode 100644 index 0000000000..6b69e3bc9b --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/security/GreetController.java @@ -0,0 +1,37 @@ +package com.baeldung.security; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import reactor.core.publisher.Mono; + +import java.security.Principal; + +@RestController +public class GreetController { + + private GreetService greetService; + + public GreetController(GreetService greetService) { + this.greetService = greetService; + } + + @GetMapping("/") + public Mono greet(Mono principal) { + return principal + .map(Principal::getName) + .map(name -> String.format("Hello, %s", name)); + } + + @GetMapping("/admin") + public Mono greetAdmin(Mono principal) { + return principal + .map(Principal::getName) + .map(name -> String.format("Admin access: %s", name)); + } + + @GetMapping("/greetService") + public Mono greetService() { + return greetService.greet(); + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/security/GreetService.java b/spring-5-reactive/src/main/java/com/baeldung/security/GreetService.java new file mode 100644 index 0000000000..7622b360be --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/security/GreetService.java @@ -0,0 +1,15 @@ +package com.baeldung.security; + +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.stereotype.Service; +import reactor.core.publisher.Mono; + +@Service +public class GreetService { + + @PreAuthorize("hasRole('ADMIN')") + public Mono greet() { + return Mono.just("Hello from service!"); + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/security/SecurityConfig.java b/spring-5-reactive/src/main/java/com/baeldung/security/SecurityConfig.java new file mode 100644 index 0000000000..a9e44a2eee --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/security/SecurityConfig.java @@ -0,0 +1,42 @@ +package com.baeldung.security; + +import org.springframework.context.annotation.Bean; +import org.springframework.security.config.annotation.method.configuration.EnableReactiveMethodSecurity; +import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity; +import org.springframework.security.config.web.server.ServerHttpSecurity; +import org.springframework.security.core.userdetails.MapReactiveUserDetailsService; +import org.springframework.security.core.userdetails.User; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.web.server.SecurityWebFilterChain; + +@EnableWebFluxSecurity +@EnableReactiveMethodSecurity +public class SecurityConfig { + + @Bean + public SecurityWebFilterChain securitygWebFilterChain(ServerHttpSecurity http) { + return http.authorizeExchange() + .pathMatchers("/admin").hasAuthority("ROLE_ADMIN") + .anyExchange().authenticated() + .and().formLogin() + .and().build(); + } + + @Bean + public MapReactiveUserDetailsService userDetailsService() { + UserDetails user = User.withDefaultPasswordEncoder() + .username("user") + .password("password") + .roles("USER") + .build(); + + UserDetails admin = User.withDefaultPasswordEncoder() + .username("admin") + .password("password") + .roles("ADMIN") + .build(); + + return new MapReactiveUserDetailsService(user, admin); + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/web/Foo.java b/spring-5-reactive/src/main/java/com/baeldung/web/Foo.java new file mode 100644 index 0000000000..c4868a9958 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/web/Foo.java @@ -0,0 +1,84 @@ +package com.baeldung.web; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +@Entity +public class Foo { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private long id; + + private String name; + + public Foo() { + super(); + } + + public Foo(final String name) { + super(); + + this.name = name; + } + + public Foo(final long id, final String name) { + super(); + + this.id = id; + this.name = name; + } + + // API + + public long getId() { + return id; + } + + public void setId(final long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + + // + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((name == null) ? 0 : name.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Foo other = (Foo) obj; + if (name == null) { + if (other.name != null) + return false; + } else if (!name.equals(other.name)) + return false; + return true; + } + + @Override + public String toString() { + return "Foo [name=" + name + "]"; + } + +} \ No newline at end of file diff --git a/spring-5-reactive/src/main/java/com/baeldung/web/FooController.java b/spring-5-reactive/src/main/java/com/baeldung/web/FooController.java new file mode 100644 index 0000000000..925f2b49f4 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/web/FooController.java @@ -0,0 +1,53 @@ +package com.baeldung.web; + +import com.baeldung.persistence.FooRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.PageRequest; +import org.springframework.http.HttpStatus; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import java.util.List; + +@RestController("/foos") +public class FooController { + + @Autowired + private FooRepository repo; + + // API - read + + @GetMapping("/foos/{id}") + @ResponseBody + @Validated + public Foo findById(@PathVariable @Min(0) final long id) { + return repo.findById(id) + .orElse(null); + } + + @GetMapping + @ResponseBody + public List findAll() { + return repo.findAll(); + } + + @GetMapping(params = { "page", "size" }) + @ResponseBody + @Validated + public List findPaginated(@RequestParam("page") @Min(0) final int page, @Max(100) @RequestParam("size") final int size) { + return repo.findAll(PageRequest.of(page, size)) + .getContent(); + } + + // API - write + + @PutMapping("/foos/{id}") + @ResponseStatus(HttpStatus.OK) + @ResponseBody + public Foo update(@PathVariable("id") final String id, @RequestBody final Foo foo) { + return foo; + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/web/PathPatternController.java b/spring-5-reactive/src/main/java/com/baeldung/web/PathPatternController.java new file mode 100644 index 0000000000..fa413e4f00 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/web/PathPatternController.java @@ -0,0 +1,39 @@ +package com.baeldung.web; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class PathPatternController { + + @GetMapping("/spring5/{*id}") + public String URIVariableHandler(@PathVariable String id) { + return id; + } + + @GetMapping("/s?ring5") + public String wildcardTakingExactlyOneChar() { + return "/s?ring5"; + } + + @GetMapping("/spring5/*id") + public String wildcardTakingZeroOrMoreChar() { + return "/spring5/*id"; + } + + @GetMapping("/resources/**") + public String wildcardTakingZeroOrMorePathSegments() { + return "/resources/**"; + } + + @GetMapping("/{baeldung:[a-z]+}") + public String regexInPathVariable(@PathVariable String baeldung) { + return baeldung; + } + + @GetMapping("/{var1}_{var2}") + public String multiplePathVariablesInSameSegment(@PathVariable String var1, @PathVariable String var2) { + return "Two variables are var1=" + var1 + " and var2=" + var2; + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/web/reactive/Task.java b/spring-5-reactive/src/main/java/com/baeldung/web/reactive/Task.java new file mode 100644 index 0000000000..725fd931e1 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/web/reactive/Task.java @@ -0,0 +1,28 @@ +package com.baeldung.web.reactive; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Task { + + private final String name; + + private final int id; + + public Task(@JsonProperty("name") String name, @JsonProperty("id") int id) { + this.name = name; + this.id = id; + } + + public String getName() { + return this.name; + } + + public int getId() { + return this.id; + } + + @Override + public String toString() { + return "Task{" + "name='" + name + '\'' + ", id=" + id + '}'; + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/web/reactive/client/WebClientController.java b/spring-5-reactive/src/main/java/com/baeldung/web/reactive/client/WebClientController.java new file mode 100644 index 0000000000..a218c6b7cf --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/web/reactive/client/WebClientController.java @@ -0,0 +1,85 @@ +package com.baeldung.web.reactive.client; + +import org.reactivestreams.Publisher; +import org.reactivestreams.Subscriber; +import org.springframework.http.*; +import org.springframework.http.client.reactive.ClientHttpRequest; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.reactive.function.BodyInserter; +import org.springframework.web.reactive.function.BodyInserters; +import org.springframework.web.reactive.function.client.WebClient; +import reactor.core.publisher.Mono; + +import java.net.URI; +import java.nio.charset.Charset; +import java.time.ZonedDateTime; +import java.util.Collections; + +@RestController +public class WebClientController { + + @ResponseStatus(HttpStatus.OK) + @GetMapping("/resource") + public void getResource() { + } + + public void demonstrateWebClient() { + // request + WebClient.UriSpec request1 = createWebClientWithServerURLAndDefaultValues().method(HttpMethod.POST); + WebClient.UriSpec request2 = createWebClientWithServerURLAndDefaultValues().post(); + + // request body specifications + WebClient.RequestBodySpec uri1 = createWebClientWithServerURLAndDefaultValues().method(HttpMethod.POST) + .uri("/resource"); + WebClient.RequestBodySpec uri2 = createWebClientWithServerURLAndDefaultValues().post() + .uri(URI.create("/resource")); + + // request header specification + WebClient.RequestHeadersSpec requestSpec1 = uri1.body(BodyInserters.fromPublisher(Mono.just("data"), String.class)); + WebClient.RequestHeadersSpec requestSpec2 = uri2.body(BodyInserters.fromObject("data")); + + // inserters + BodyInserter, ReactiveHttpOutputMessage> inserter1 = BodyInserters + .fromPublisher(Subscriber::onComplete, String.class); + + LinkedMultiValueMap map = new LinkedMultiValueMap<>(); + map.add("key1", "value1"); + map.add("key2", "value2"); + + BodyInserter, ClientHttpRequest> inserter2 = BodyInserters.fromMultipartData(map); + BodyInserter inserter3 = BodyInserters.fromObject("body"); + + // responses + WebClient.ResponseSpec response1 = uri1.body(inserter3) + .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) + .accept(MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML) + .acceptCharset(Charset.forName("UTF-8")) + .ifNoneMatch("*") + .ifModifiedSince(ZonedDateTime.now()) + .retrieve(); + WebClient.ResponseSpec response2 = requestSpec2.retrieve(); + + } + + private WebClient createWebClient() { + return WebClient.create(); + } + + private WebClient createWebClientWithServerURL() { + return WebClient.create("http://localhost:8081"); + } + + private WebClient createWebClientWithServerURLAndDefaultValues() { + return WebClient.builder() + .baseUrl("http://localhost:8081") + .defaultCookie("cookieKey", "cookieValue") + .defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) + .defaultUriVariables(Collections.singletonMap("url", "http://localhost:8080")) + .build(); + } + +} diff --git a/spring-5-reactive/src/main/resources/application.properties b/spring-5-reactive/src/main/resources/application.properties new file mode 100644 index 0000000000..ccec014c2b --- /dev/null +++ b/spring-5-reactive/src/main/resources/application.properties @@ -0,0 +1,3 @@ +server.port=8081 + +logging.level.root=INFO \ No newline at end of file diff --git a/spring-5-reactive/src/main/resources/files/hello.txt b/spring-5-reactive/src/main/resources/files/hello.txt new file mode 100644 index 0000000000..b6fc4c620b --- /dev/null +++ b/spring-5-reactive/src/main/resources/files/hello.txt @@ -0,0 +1 @@ +hello \ No newline at end of file diff --git a/spring-5-reactive/src/main/resources/files/test/test.txt b/spring-5-reactive/src/main/resources/files/test/test.txt new file mode 100644 index 0000000000..30d74d2584 --- /dev/null +++ b/spring-5-reactive/src/main/resources/files/test/test.txt @@ -0,0 +1 @@ +test \ No newline at end of file diff --git a/spring-5-reactive/src/main/webapp/WEB-INF/web.xml b/spring-5-reactive/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..bfcf43dad2 --- /dev/null +++ b/spring-5-reactive/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,21 @@ + + + + Spring Functional Application + + + functional + com.baeldung.functional.RootServlet + 1 + true + + + functional + / + + + + \ No newline at end of file diff --git a/spring-5-reactive/src/test/java/com/baeldung/Example1IntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/Example1IntegrationTest.java new file mode 100644 index 0000000000..8b9e66213f --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/Example1IntegrationTest.java @@ -0,0 +1,29 @@ +package com.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class Example1IntegrationTest { + + @Test + public void test1a() { + block(3000); + } + + @Test + public void test1b() { + block(3000); + } + + public static void block(long ms) { + try { + Thread.sleep(ms); + } catch (InterruptedException e) { + System.out.println("Thread interrupted"); + } + } +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/Example2IntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/Example2IntegrationTest.java new file mode 100644 index 0000000000..6ed53ca4e9 --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/Example2IntegrationTest.java @@ -0,0 +1,29 @@ +package com.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class Example2IntegrationTest { + + @Test + public void test1a() { + block(3000); + } + + @Test + public void test1b() { + block(3000); + } + + public static void block(long ms) { + try { + Thread.sleep(ms); + } catch (InterruptedException e) { + System.out.println("Thread Interrupted"); + } + } +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/ParallelIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/ParallelIntegrationTest.java new file mode 100644 index 0000000000..1ce96de4ef --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/ParallelIntegrationTest.java @@ -0,0 +1,24 @@ +package com.baeldung; + +import org.junit.Test; +import org.junit.experimental.ParallelComputer; +import org.junit.runner.Computer; +import org.junit.runner.JUnitCore; + +public class ParallelIntegrationTest { + + @Test + public void runTests() { + final Class[] classes = { Example1IntegrationTest.class, Example2IntegrationTest.class }; + + JUnitCore.runClasses(new Computer(), classes); + } + + @Test + public void runTestsInParallel() { + final Class[] classes = { Example1IntegrationTest.class, Example2IntegrationTest.class }; + + JUnitCore.runClasses(new ParallelComputer(true, true), classes); + } + +} \ No newline at end of file diff --git a/spring-5-reactive/src/test/java/com/baeldung/Spring5ApplicationIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/Spring5ApplicationIntegrationTest.java new file mode 100644 index 0000000000..af288c3c2d --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/Spring5ApplicationIntegrationTest.java @@ -0,0 +1,16 @@ +package com.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class Spring5ApplicationIntegrationTest { + + @Test + public void contextLoads() { + } + +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/Spring5JUnit4ConcurrentIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/Spring5JUnit4ConcurrentIntegrationTest.java new file mode 100644 index 0000000000..7e494465b2 --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/Spring5JUnit4ConcurrentIntegrationTest.java @@ -0,0 +1,52 @@ +package com.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.context.annotation.Configuration; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +import java.util.concurrent.TimeUnit; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +@RunWith(SpringRunner.class) +@ContextConfiguration(classes = Spring5JUnit4ConcurrentIntegrationTest.SimpleConfiguration.class) +public class Spring5JUnit4ConcurrentIntegrationTest implements ApplicationContextAware, InitializingBean { + + @Configuration + public static class SimpleConfiguration { + } + + private ApplicationContext applicationContext; + + private boolean beanInitialized = false; + + @Override + public final void afterPropertiesSet() throws Exception { + this.beanInitialized = true; + } + + @Override + public final void setApplicationContext(final ApplicationContext applicationContext) throws BeansException { + this.applicationContext = applicationContext; + } + + @Test + public final void verifyApplicationContextSet() throws InterruptedException { + TimeUnit.SECONDS.sleep(2); + assertNotNull("The application context should have been set due to ApplicationContextAware semantics.", this.applicationContext); + } + + @Test + public final void verifyBeanInitialized() throws InterruptedException { + TimeUnit.SECONDS.sleep(2); + assertTrue("This test bean should have been initialized due to InitializingBean semantics.", this.beanInitialized); + } + +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/functional/BeanRegistrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/functional/BeanRegistrationTest.java new file mode 100644 index 0000000000..0b1542dbbc --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/functional/BeanRegistrationTest.java @@ -0,0 +1,42 @@ +package com.baeldung.functional; + +import static org.junit.Assert.*; + +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.test.context.junit4.SpringRunner; +import org.springframework.web.context.support.GenericWebApplicationContext; + +import com.baeldung.Spring5Application; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Spring5Application.class) +public class BeanRegistrationTest { + + @Autowired + private GenericWebApplicationContext context; + + @Test + public void whenRegisterBean_thenOk() { + context.registerBean(MyService.class, () -> new MyService()); + MyService myService = (MyService) context.getBean("com.baeldung.functional.MyService"); + assertTrue(myService.getRandomNumber() < 10); + } + + @Test + public void whenRegisterBeanWithName_thenOk() { + context.registerBean("mySecondService", MyService.class, () -> new MyService()); + MyService mySecondService = (MyService) context.getBean("mySecondService"); + assertTrue(mySecondService.getRandomNumber() < 10); + } + + @Test + public void whenRegisterBeanWithCallback_thenOk() { + context.registerBean("myCallbackService", MyService.class, () -> new MyService(), bd -> bd.setAutowireCandidate(false)); + MyService myCallbackService = (MyService) context.getBean("myCallbackService"); + assertTrue(myCallbackService.getRandomNumber() < 10); + } + +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/functional/ExploreSpring5URLPatternUsingRouterFunctionsTest.java b/spring-5-reactive/src/test/java/com/baeldung/functional/ExploreSpring5URLPatternUsingRouterFunctionsTest.java new file mode 100644 index 0000000000..7a38fa697f --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/functional/ExploreSpring5URLPatternUsingRouterFunctionsTest.java @@ -0,0 +1,110 @@ +package com.baeldung.functional; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.springframework.boot.web.server.WebServer; +import org.springframework.test.web.reactive.server.WebTestClient; + +public class ExploreSpring5URLPatternUsingRouterFunctionsTest { + + private static WebTestClient client; + private static WebServer server; + + @BeforeClass + public static void setup() throws Exception { + server = new ExploreSpring5URLPatternUsingRouterFunctions().start(); + client = WebTestClient.bindToServer() + .baseUrl("http://localhost:" + server.getPort()) + .build(); + } + + @AfterClass + public static void destroy() { + server.stop(); + } + + @Test + public void givenRouter_whenGetPathWithSingleCharWildcard_thenGotPathPattern() throws Exception { + client.get() + .uri("/paths") + .exchange() + .expectStatus() + .isOk() + .expectBody(String.class) + .isEqualTo("/p?ths"); + } + + @Test + public void givenRouter_whenMultipleURIVariablePattern_thenGotPathVariable() throws Exception { + client.get() + .uri("/test/ab/cd") + .exchange() + .expectStatus() + .isOk() + .expectBody(String.class) + .isEqualTo("/ab/cd"); + } + + @Test + public void givenRouter_whenGetMultipleCharWildcard_thenGotPathPattern() throws Exception { + + client.get() + .uri("/wildcard") + .exchange() + .expectStatus() + .isOk() + .expectBody(String.class) + .isEqualTo("/*card path was accessed"); + } + + @Test + public void givenRouter_whenGetMultiplePathVaribleInSameSegment_thenGotPathVariables() throws Exception { + + client.get() + .uri("/baeldung_tutorial") + .exchange() + .expectStatus() + .isOk() + .expectBody(String.class) + .isEqualTo("baeldung , tutorial"); + } + + @Test + public void givenRouter_whenGetRegexInPathVarible_thenGotPathVariable() throws Exception { + + client.get() + .uri("/abcd") + .exchange() + .expectStatus() + .isOk() + .expectBody(String.class) + .isEqualTo("/{baeldung:[a-z]+} was accessed and baeldung=abcd"); + + client.get() + .uri("/1234") + .exchange() + .expectStatus() + .is4xxClientError(); + } + + @Test + public void givenResources_whenAccess_thenGot() throws Exception { + client.get() + .uri("/files/test/test.txt") + .exchange() + .expectStatus() + .isOk() + .expectBody(String.class) + .isEqualTo("test"); + + client.get() + .uri("/files/hello.txt") + .exchange() + .expectStatus() + .isOk() + .expectBody(String.class) + .isEqualTo("hello"); + } + +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java new file mode 100644 index 0000000000..a7b951b930 --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java @@ -0,0 +1,141 @@ +package com.baeldung.functional; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.springframework.boot.web.server.WebServer; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; +import org.springframework.http.MediaType; +import org.springframework.test.web.reactive.server.WebTestClient; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.reactive.function.BodyInserters; + +import static org.springframework.web.reactive.function.BodyInserters.fromObject; +import static org.springframework.web.reactive.function.BodyInserters.fromResource; + +public class FunctionalWebApplicationIntegrationTest { + + private static WebTestClient client; + private static WebServer server; + + @BeforeClass + public static void setup() throws Exception { + server = new FunctionalWebApplication().start(); + client = WebTestClient.bindToServer() + .baseUrl("http://localhost:" + server.getPort()) + .build(); + } + + @AfterClass + public static void destroy() { + server.stop(); + } + + @Test + public void givenRouter_whenGetTest_thenGotHelloWorld() throws Exception { + client.get() + .uri("/test") + .exchange() + .expectStatus() + .isOk() + .expectBody(String.class) + .isEqualTo("helloworld"); + } + + @Test + public void givenIndexFilter_whenRequestRoot_thenRewrittenToTest() throws Exception { + client.get() + .uri("/") + .exchange() + .expectStatus() + .isOk() + .expectBody(String.class) + .isEqualTo("helloworld"); + } + + @Test + public void givenLoginForm_whenPostValidToken_thenSuccess() throws Exception { + MultiValueMap formData = new LinkedMultiValueMap<>(1); + formData.add("user", "baeldung"); + formData.add("token", "you_know_what_to_do"); + + client.post() + .uri("/login") + .contentType(MediaType.APPLICATION_FORM_URLENCODED) + .body(BodyInserters.fromFormData(formData)) + .exchange() + .expectStatus() + .isOk() + .expectBody(String.class) + .isEqualTo("welcome back!"); + } + + @Test + public void givenLoginForm_whenRequestWithInvalidToken_thenFail() throws Exception { + MultiValueMap formData = new LinkedMultiValueMap<>(2); + formData.add("user", "baeldung"); + formData.add("token", "try_again"); + + client.post() + .uri("/login") + .contentType(MediaType.APPLICATION_FORM_URLENCODED) + .body(BodyInserters.fromFormData(formData)) + .exchange() + .expectStatus() + .isBadRequest(); + } + + @Test + public void givenUploadForm_whenRequestWithMultipartData_thenSuccess() throws Exception { + Resource resource = new ClassPathResource("/baeldung-weekly.png"); + client.post() + .uri("/upload") + .contentType(MediaType.MULTIPART_FORM_DATA) + .body(fromResource(resource)) + .exchange() + .expectStatus() + .isOk() + .expectBody(String.class) + .isEqualTo(String.valueOf(resource.contentLength())); + } + + @Test + public void givenActors_whenAddActor_thenAdded() throws Exception { + client.get() + .uri("/actor") + .exchange() + .expectStatus() + .isOk() + .expectBodyList(Actor.class) + .hasSize(2); + + client.post() + .uri("/actor") + .body(fromObject(new Actor("Clint", "Eastwood"))) + .exchange() + .expectStatus() + .isOk(); + + client.get() + .uri("/actor") + .exchange() + .expectStatus() + .isOk() + .expectBodyList(Actor.class) + .hasSize(3); + } + + @Test + public void givenResources_whenAccess_thenGot() throws Exception { + client.get() + .uri("/files/hello.txt") + .exchange() + .expectStatus() + .isOk() + .expectBody(String.class) + .isEqualTo("hello"); + } + +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/jsonb/JsonbIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/jsonb/JsonbIntegrationTest.java new file mode 100644 index 0000000000..756b303f3b --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/jsonb/JsonbIntegrationTest.java @@ -0,0 +1,43 @@ +package com.baeldung.jsonb; + +import static org.junit.Assert.assertTrue; + +import java.math.BigDecimal; +import java.time.LocalDate; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.http.ResponseEntity; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Spring5Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +public class JsonbIntegrationTest { + @Value("${security.user.name}") + private String username; + @Value("${security.user.password}") + private String password; + + @Autowired + private TestRestTemplate template; + + @Test + public void givenId_whenUriIsPerson_thenGetPerson() { + ResponseEntity response = template.withBasicAuth(username, password) + .getForEntity("/person/1", Person.class); + Person person = response.getBody(); + assertTrue(person.equals(new Person(2, "Jhon", "jhon1@test.com", 0, LocalDate.of(2019, 9, 9), BigDecimal.valueOf(1500.0)))); + } + + @Test + public void whenSendPostAPerson_thenGetOkStatus() { + ResponseEntity response = template.withBasicAuth(username, password) + .postForEntity("/person", "{\"birthDate\":\"07-09-2017\",\"email\":\"jhon1@test.com\",\"person-name\":\"Jhon\",\"id\":10}", Boolean.class); + assertTrue(response.getBody()); + } + +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/jupiter/EnabledOnJava8.java b/spring-5-reactive/src/test/java/com/baeldung/jupiter/EnabledOnJava8.java new file mode 100644 index 0000000000..c6d3b7ff10 --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/jupiter/EnabledOnJava8.java @@ -0,0 +1,18 @@ +package com.baeldung.jupiter; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.springframework.test.context.junit.jupiter.EnabledIf; + +@Target({ ElementType.TYPE, ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +@EnabledIf( + expression = "#{systemProperties['java.version'].startsWith('1.8')}", + reason = "Enabled on Java 8" +) +public @interface EnabledOnJava8 { + +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5EnabledAnnotationTest.java b/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5EnabledAnnotationTest.java new file mode 100644 index 0000000000..ae058bc8ba --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5EnabledAnnotationTest.java @@ -0,0 +1,50 @@ +package com.baeldung.jupiter; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; +import org.springframework.context.annotation.Configuration; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.junit.jupiter.DisabledIf; +import org.springframework.test.context.junit.jupiter.EnabledIf; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; + +@SpringJUnitConfig(Spring5EnabledAnnotationTest.Config.class) +@TestPropertySource(properties = { "tests.enabled=true" }) +public class Spring5EnabledAnnotationTest { + + @Configuration + static class Config { + } + + @EnabledIf("true") + @Test + void givenEnabledIfLiteral_WhenTrue_ThenTestExecuted() { + assertTrue(true); + } + + @EnabledIf(expression = "${tests.enabled}", loadContext = true) + @Test + void givenEnabledIfExpression_WhenTrue_ThenTestExecuted() { + assertTrue(true); + } + + @EnabledIf("#{systemProperties['java.version'].startsWith('1.8')}") + @Test + void givenEnabledIfSpel_WhenTrue_ThenTestExecuted() { + assertTrue(true); + } + + @EnabledOnJava8 + @Test + void givenEnabledOnJava8_WhenTrue_ThenTestExecuted() { + assertTrue(true); + } + + @DisabledIf("#{systemProperties['java.version'].startsWith('1.7')}") + @Test + void givenDisabledIf_WhenTrue_ThenTestNotExecuted() { + assertTrue(true); + } + +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5JUnit5ComposedAnnotationIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5JUnit5ComposedAnnotationIntegrationTest.java new file mode 100644 index 0000000000..42d27b90f4 --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5JUnit5ComposedAnnotationIntegrationTest.java @@ -0,0 +1,38 @@ +package com.baeldung.jupiter; + +import com.baeldung.web.reactive.Task; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; + +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +@SpringJUnit5Config(TestConfig.class) +@DisplayName("@SpringJUnit5Config Tests") +class Spring5JUnit5ComposedAnnotationIntegrationTest { + + @Autowired + private Task task; + + @Autowired + private List tasks; + + @Test + @DisplayName("ApplicationContext injected into method") + void givenAMethodName_whenInjecting_thenApplicationContextInjectedIntoMethod(ApplicationContext applicationContext) { + assertNotNull(applicationContext, "ApplicationContext should have been injected into method by Spring"); + assertEquals(this.task, applicationContext.getBean("taskName", Task.class)); + } + + @Test + @DisplayName("Spring @Beans injected into fields") + void givenAnObject_whenInjecting_thenSpringBeansInjected() { + assertNotNull(task, "Task should have been @Autowired by Spring"); + assertEquals("taskName", task.getName(), "Task's name"); + assertEquals(1, tasks.size(), "Number of Tasks in context"); + } +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5JUnit5IntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5JUnit5IntegrationTest.java new file mode 100644 index 0000000000..0f00a85832 --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5JUnit5IntegrationTest.java @@ -0,0 +1,25 @@ +package com.baeldung.jupiter; + +import com.baeldung.web.reactive.Task; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.test.context.ContextConfiguration; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +@ExtendWith(SpringExtension.class) +@ContextConfiguration(classes = TestConfig.class) +class Spring5JUnit5IntegrationTest { + + @Autowired + private Task task; + + @Test + void givenAMethodName_whenInjecting_thenApplicationContextInjectedIntoMetho(ApplicationContext applicationContext) { + assertNotNull(applicationContext, "ApplicationContext should have been injected by Spring"); + assertEquals(this.task, applicationContext.getBean("taskName", Task.class)); + } +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5JUnit5ParallelIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5JUnit5ParallelIntegrationTest.java new file mode 100644 index 0000000000..55b0fcf267 --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5JUnit5ParallelIntegrationTest.java @@ -0,0 +1,25 @@ +package com.baeldung.jupiter; + +import com.baeldung.Example1IntegrationTest; +import com.baeldung.Example2IntegrationTest; +import org.junit.experimental.ParallelComputer; +import org.junit.jupiter.api.Test; +import org.junit.runner.Computer; +import org.junit.runner.JUnitCore; + +class Spring5JUnit5ParallelIntegrationTest { + + @Test + void givenTwoTestClasses_whenJUnitRunParallel_thenTheTestsExecutingParallel() { + final Class[] classes = { Example1IntegrationTest.class, Example2IntegrationTest.class }; + + JUnitCore.runClasses(new ParallelComputer(true, true), classes); + } + + @Test + void givenTwoTestClasses_whenJUnitRunParallel_thenTheTestsExecutingLinear() { + final Class[] classes = { Example1IntegrationTest.class, Example2IntegrationTest.class }; + + JUnitCore.runClasses(new Computer(), classes); + } +} \ No newline at end of file diff --git a/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5Java8NewFeaturesIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5Java8NewFeaturesIntegrationTest.java new file mode 100644 index 0000000000..f58bf9f3cd --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5Java8NewFeaturesIntegrationTest.java @@ -0,0 +1,31 @@ +package com.baeldung.jupiter; + +import org.junit.jupiter.api.Test; + +import java.util.function.Supplier; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +class Spring5Java8NewFeaturesIntegrationTest { + + @FunctionalInterface + public interface FunctionalInterfaceExample { + Result reverseString(Input input); + } + + public class StringUtils { + FunctionalInterfaceExample functionLambdaString = s -> Pattern.compile(" +") + .splitAsStream(s) + .map(word -> new StringBuilder(word).reverse()) + .collect(Collectors.joining(" ")); + } + + @Test + void givenStringUtil_whenSupplierCall_thenFunctionalInterfaceReverseString() throws Exception { + Supplier stringUtilsSupplier = StringUtils::new; + + assertEquals(stringUtilsSupplier.get().functionLambdaString.reverseString("hello"), "olleh"); + } +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5ReactiveServerClientIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5ReactiveServerClientIntegrationTest.java new file mode 100644 index 0000000000..bbd852d625 --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5ReactiveServerClientIntegrationTest.java @@ -0,0 +1,94 @@ +package com.baeldung.jupiter; + +import com.baeldung.web.reactive.Task; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.springframework.http.server.reactive.HttpHandler; +import org.springframework.http.server.reactive.ReactorHttpHandlerAdapter; +import org.springframework.web.reactive.function.server.RouterFunction; +import org.springframework.web.reactive.function.server.RouterFunctions; +import org.springframework.web.reactive.function.server.ServerResponse; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.ipc.netty.NettyContext; +import reactor.ipc.netty.http.server.HttpServer; + +import java.time.Duration; + +import static org.springframework.web.reactive.function.server.RequestPredicates.GET; +import static org.springframework.web.reactive.function.server.RequestPredicates.POST; + +public class Spring5ReactiveServerClientIntegrationTest { + + private static NettyContext nettyContext; + + @BeforeAll + public static void setUp() throws Exception { + HttpServer server = HttpServer.create("localhost", 8080); + RouterFunction route = RouterFunctions.route(POST("/task/process"), request -> ServerResponse.ok() + .body(request.bodyToFlux(Task.class) + .map(ll -> new Task("TaskName", 1)), Task.class)) + .and(RouterFunctions.route(GET("/task"), request -> ServerResponse.ok() + .body(Mono.just("server is alive"), String.class))); + HttpHandler httpHandler = RouterFunctions.toHttpHandler(route); + ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(httpHandler); + nettyContext = server.newHandler(adapter) + .block(); + } + + @AfterAll + public static void shutDown() { + nettyContext.dispose(); + } + + // @Test + // public void givenCheckTask_whenServerHandle_thenServerResponseALiveString() throws Exception { + // WebClient client = WebClient.create("http://localhost:8080"); + // Mono result = client + // .get() + // .uri("/task") + // .exchange() + // .then(response -> response.bodyToMono(String.class)); + // + // assertThat(result.block()).isInstanceOf(String.class); + // } + + // @Test + // public void givenThreeTasks_whenServerHandleTheTasks_thenServerResponseATask() throws Exception { + // URI uri = URI.create("http://localhost:8080/task/process"); + // ExchangeFunction exchange = ExchangeFunctions.create(new ReactorClientHttpConnector()); + // ClientRequest request = ClientRequest + // .method(HttpMethod.POST, uri) + // .body(BodyInserters.fromPublisher(getLatLngs(), Task.class)) + // .build(); + // + // Flux taskResponse = exchange + // .exchange(request) + // .flatMap(response -> response.bodyToFlux(Task.class)); + // + // assertThat(taskResponse.blockFirst()).isInstanceOf(Task.class); + // } + + // @Test + // public void givenCheckTask_whenServerHandle_thenOragicServerResponseALiveString() throws Exception { + // URI uri = URI.create("http://localhost:8080/task"); + // ExchangeFunction exchange = ExchangeFunctions.create(new ReactorClientHttpConnector()); + // ClientRequest request = ClientRequest + // .method(HttpMethod.GET, uri) + // .body(BodyInserters.fromPublisher(getLatLngs(), Task.class)) + // .build(); + // + // Flux taskResponse = exchange + // .exchange(request) + // .flatMap(response -> response.bodyToFlux(String.class)); + // + // assertThat(taskResponse.blockFirst()).isInstanceOf(String.class); + // } + + private static Flux getLatLngs() { + return Flux.range(0, 3) + .zipWith(Flux.interval(Duration.ofSeconds(1))) + .map(x -> new Task("taskname", 1)) + .doOnNext(ll -> System.out.println("Produced: {}" + ll)); + } +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/jupiter/SpringJUnitConfigTest.java b/spring-5-reactive/src/test/java/com/baeldung/jupiter/SpringJUnitConfigTest.java new file mode 100644 index 0000000000..6b0a6f9808 --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/jupiter/SpringJUnitConfigTest.java @@ -0,0 +1,33 @@ +package com.baeldung.jupiter; + +import static org.junit.Assert.assertNotNull; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Configuration; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; + +/** + * @SpringJUnitConfig(SpringJUnitConfigTest.Config.class) is equivalent to: + * + * @ExtendWith(SpringExtension.class) + * @ContextConfiguration(classes = SpringJUnitConfigTest.Config.class ) + * + */ +@SpringJUnitConfig(SpringJUnitConfigTest.Config.class) +public class SpringJUnitConfigTest { + + @Configuration + static class Config { + } + + @Autowired + private ApplicationContext applicationContext; + + @Test + void givenAppContext_WhenInjected_ThenItShouldNotBeNull() { + assertNotNull(applicationContext); + } + +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/jupiter/SpringJUnitWebConfigTest.java b/spring-5-reactive/src/test/java/com/baeldung/jupiter/SpringJUnitWebConfigTest.java new file mode 100644 index 0000000000..c679dce77f --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/jupiter/SpringJUnitWebConfigTest.java @@ -0,0 +1,34 @@ +package com.baeldung.jupiter; + +import static org.junit.Assert.assertNotNull; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; +import org.springframework.web.context.WebApplicationContext; + +/** + * @SpringJUnitWebConfig(SpringJUnitWebConfigTest.Config.class) is equivalent to: + * + * @ExtendWith(SpringExtension.class) + * @WebAppConfiguration + * @ContextConfiguration(classes = SpringJUnitWebConfigTest.Config.class ) + * + */ +@SpringJUnitWebConfig(SpringJUnitWebConfigTest.Config.class) +public class SpringJUnitWebConfigTest { + + @Configuration + static class Config { + } + + @Autowired + private WebApplicationContext webAppContext; + + @Test + void givenWebAppContext_WhenInjected_ThenItShouldNotBeNull() { + assertNotNull(webAppContext); + } + +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/security/SecurityTest.java b/spring-5-reactive/src/test/java/com/baeldung/security/SecurityTest.java new file mode 100644 index 0000000000..a1c940a17a --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/security/SecurityTest.java @@ -0,0 +1,48 @@ +package com.baeldung.security; + +import com.baeldung.SpringSecurity5Application; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.reactive.server.WebTestClient; + +@RunWith(SpringRunner.class) +@ContextConfiguration(classes = SpringSecurity5Application.class) +public class SecurityTest { + + @Autowired + ApplicationContext context; + + private WebTestClient rest; + + @Before + public void setup() { + this.rest = WebTestClient + .bindToApplicationContext(this.context) + .configureClient() + .build(); + } + + @Test + public void whenNoCredentials_thenRedirectToLogin() { + this.rest.get() + .uri("/") + .exchange() + .expectStatus().is3xxRedirection(); + } + + @Test + @WithMockUser + public void whenHasCredentials_thenSeesGreeting() { + this.rest.get() + .uri("/") + .exchange() + .expectStatus().isOk() + .expectBody(String.class).isEqualTo("Hello, user"); + } +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/web/PathPatternsUsingHandlerMethodIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/web/PathPatternsUsingHandlerMethodIntegrationTest.java new file mode 100644 index 0000000000..c2ed8ff071 --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/web/PathPatternsUsingHandlerMethodIntegrationTest.java @@ -0,0 +1,101 @@ +package com.baeldung.web; + +import com.baeldung.Spring5Application; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.reactive.server.WebTestClient; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Spring5Application.class) +public class PathPatternsUsingHandlerMethodIntegrationTest { + + private static WebTestClient client; + + @BeforeClass + public static void setUp() { + client = WebTestClient.bindToController(new PathPatternController()) + .build(); + } + + @Test + public void givenHandlerMethod_whenMultipleURIVariablePattern_then200() { + + client.get() + .uri("/spring5/ab/cd") + .exchange() + .expectStatus() + .is2xxSuccessful() + .expectBody() + .equals("/ab/cd"); + } + + @Test + public void givenHandlerMethod_whenURLWithWildcardTakingZeroOrMoreChar_then200() { + + client.get() + .uri("/spring5/userid") + .exchange() + .expectStatus() + .is2xxSuccessful() + .expectBody() + .equals("/spring5/*id"); + } + + @Test + public void givenHandlerMethod_whenURLWithWildcardTakingExactlyOneChar_then200() { + + client.get() + .uri("/string5") + .exchange() + .expectStatus() + .is2xxSuccessful() + .expectBody() + .equals("/s?ring5"); + } + + @Test + public void givenHandlerMethod_whenURLWithWildcardTakingZeroOrMorePathSegments_then200() { + + client.get() + .uri("/resources/baeldung") + .exchange() + .expectStatus() + .is2xxSuccessful() + .expectBody() + .equals("/resources/**"); + } + + @Test + public void givenHandlerMethod_whenURLWithRegexInPathVariable_thenExpectedOutput() { + + client.get() + .uri("/abc") + .exchange() + .expectStatus() + .is2xxSuccessful() + .expectBody() + .equals("abc"); + + client.get() + .uri("/123") + .exchange() + .expectStatus() + .is4xxClientError(); + } + + @Test + public void givenHandlerMethod_whenURLWithMultiplePathVariablesInSameSegment_then200() { + + client.get() + .uri("/baeldung_tutorial") + .exchange() + .expectStatus() + .is2xxSuccessful() + .expectBody() + .equals("Two variables are var1=baeldung and var2=tutorial"); + } + +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/web/client/WebTestClientTest.java b/spring-5-reactive/src/test/java/com/baeldung/web/client/WebTestClientTest.java new file mode 100644 index 0000000000..43114b5b50 --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/web/client/WebTestClientTest.java @@ -0,0 +1,60 @@ +package com.baeldung.web.client; + +import com.baeldung.Spring5Application; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.reactive.server.WebTestClient; +import org.springframework.web.reactive.function.server.RequestPredicates; +import org.springframework.web.reactive.function.server.RouterFunction; +import org.springframework.web.reactive.function.server.RouterFunctions; +import org.springframework.web.reactive.function.server.ServerResponse; +import org.springframework.web.server.WebHandler; +import reactor.core.publisher.Mono; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Spring5Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +public class WebTestClientTest { + + @LocalServerPort + private int port; + + private final RouterFunction ROUTER_FUNCTION = RouterFunctions.route(RequestPredicates.GET("/resource"), request -> ServerResponse.ok() + .build()); + private final WebHandler WEB_HANDLER = exchange -> Mono.empty(); + + @Test + public void testWebTestClientWithServerWebHandler() { + WebTestClient.bindToWebHandler(WEB_HANDLER) + .build(); + } + + @Test + public void testWebTestClientWithRouterFunction() { + WebTestClient.bindToRouterFunction(ROUTER_FUNCTION) + .build() + .get() + .uri("/resource") + .exchange() + .expectStatus() + .isOk() + .expectBody() + .isEmpty(); + } + + @Test + public void testWebTestClientWithServerURL() { + WebTestClient.bindToServer() + .baseUrl("http://localhost:" + port) + .build() + .get() + .uri("/resource") + .exchange() + .expectStatus() + .is3xxRedirection() + .expectBody(); + } + +} diff --git a/spring-5-reactive/src/test/resources/baeldung-weekly.png b/spring-5-reactive/src/test/resources/baeldung-weekly.png new file mode 100644 index 0000000000000000000000000000000000000000..5a27d61dae718016a947083e01411ed1bc14f90e GIT binary patch literal 22275 zcmV*KKxMy)P)4Tx062|}Rb6NtRTMtEb7vzY&QokOg>Hg1+lHrgWS zWcKdPn90sKGrRqvPeo9CG3uKX#J{(IASm?@+di}}l?o-=)F3E6wD^Ni=!>T7nL9I? zX}YoAW$t|Qo$sD|?zw001?ah|SeB6#0T!CBEf+H4bBB+JJu8rehoBb*p;u8ID_yBf z0ya+zcePvJL&AGs+11_tpRKn>9TgyPA7ZoSs0)aX0r00)%XR^J`jH<$>RKN5V(7Oq zK*TS4xZz{h!*f1C3ECFkK$#7nA@pGN!$;%jYvwjAKwmYb0gKL(K8 z-kPtb5${A?tlI~wzMrJ6wTdBr=Y%%%EaEMQ&o}4FQ^DA)s*}Z>!FI&AHCpoWI|RUq zx?7s@$8!5^Q=anY%X@i5{QA6kNcMelpE>R6eCYFpmMsVT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$fH&5^IUqP@=<(yntFx>eITqem zXIu*-SXcE}R>JtBsi}!>z4cbbju5C5%jrT6h=(7t8kRPmWiO^0k%OqYtzF+NZ`+k4 zUm|e4FMHgCxU;tnCsd2zxLo*kw+xoogMIL@Zmw=3l?Ctg~|Uq)8Z1 zXIzueW}chC>jGR{TtxbnlF|}!4BK2+S63m47AI`@4>sO#i-TG#itUVHUI;^e6>N(E zb;h+V{yVjfY;Z^-_3}$E3x8r5ZeW(PHXP49E^N1F&Ya1C_>$mz?j@I8Vv$)Go=qoDo)oh@3@5hl*e;gF z*azW4)uV!aVL+X6?dy4T=?(Z`NT4Cfedd{G1mV8(_B#|66(u}mV07P|J+yYE;8}BX zb4Av}fhhy&`|rLN(L&&SzV!D?sp4#f@Kcr?(Y5bak8O_ub;h;*Gcec#@WGEf`iSt3 zL6k!1PLCfyPW$)o7s4zoumAFwzlf~pk38~-kWwQ>DFDPhW$F~d(iakJM2A4|c-;HZ zM;{S#6aOjYPc&xC7)=UE+!qiSfQ<@vi~*H!?fBuyyC&tffphtD|9MV0n6u+zOQw2)DMjmWqms$d5z20FZ Date: Wed, 13 Dec 2017 13:10:46 +0100 Subject: [PATCH 40/50] Update pom.xml (#3232) --- pom.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pom.xml b/pom.xml index 88f54be629..2c611e6efe 100644 --- a/pom.xml +++ b/pom.xml @@ -49,8 +49,6 @@ core-java-8 core-java-concurrency couchbase - cas/cas-server - cas/cas-secured-app deltaspike dozer From df8b6bea54252e476327480cd769799d47abf710 Mon Sep 17 00:00:00 2001 From: Eugen Paraschiv Date: Wed, 13 Dec 2017 15:15:46 +0200 Subject: [PATCH 41/50] reactive work --- spring-5-reactive/pom.xml | 24 ++- .../java/com/baeldung/Spring5Application.java | 15 -- .../baeldung/SpringSecurity5Application.java | 34 ----- .../java/com/baeldung/functional/Actor.java | 23 --- ...Spring5URLPatternUsingRouterFunctions.java | 61 -------- .../com/baeldung/functional/FormHandler.java | 41 ----- .../FunctionalSpringBootApplication.java | 87 ----------- .../functional/FunctionalWebApplication.java | 80 ---------- .../functional/IndexRewriteFilter.java | 27 ---- .../com/baeldung/functional/MyService.java | 11 -- .../com/baeldung/functional/RootServlet.java | 82 ---------- .../main/java/com/baeldung/jsonb/Person.java | 127 ---------------- .../com/baeldung/jsonb/PersonController.java | 58 ------- .../baeldung/jsonb/Spring5Application.java | 30 ---- .../jupiter/MethodParameterFactory.java | 46 ------ .../jupiter/ParameterAutowireUtils.java | 44 ------ .../com/baeldung/jupiter/SpringExtension.java | 94 ------------ .../baeldung/jupiter/SpringJUnit5Config.java | 39 ----- .../java/com/baeldung/jupiter/TestConfig.java | 20 --- .../baeldung/persistence/DataSetupBean.java | 27 ---- .../baeldung/persistence/FooRepository.java | 10 -- .../reactive/Spring5ReactiveApplication.java | 13 ++ .../com/baeldung/reactive/controller/Foo.java | 13 ++ .../controller/FooReactiveController.java | 34 +++++ .../baeldung/security/GreetController.java | 37 ----- .../com/baeldung/security/GreetService.java | 15 -- .../com/baeldung/security/SecurityConfig.java | 42 ------ .../src/main/java/com/baeldung/web/Foo.java | 84 ----------- .../java/com/baeldung/web/FooController.java | 53 ------- .../baeldung/web/PathPatternController.java | 39 ----- .../java/com/baeldung/web/reactive/Task.java | 28 ---- .../reactive/client/WebClientController.java | 85 ----------- .../src/main/resources/application.properties | 2 - .../com/baeldung/Example1IntegrationTest.java | 29 ---- .../com/baeldung/Example2IntegrationTest.java | 29 ---- .../com/baeldung/ParallelIntegrationTest.java | 24 --- .../Spring5ApplicationIntegrationTest.java | 16 -- ...pring5JUnit4ConcurrentIntegrationTest.java | 52 ------- .../functional/BeanRegistrationTest.java | 42 ------ ...ng5URLPatternUsingRouterFunctionsTest.java | 110 -------------- ...nctionalWebApplicationIntegrationTest.java | 141 ------------------ .../baeldung/jsonb/JsonbIntegrationTest.java | 43 ------ .../com/baeldung/jupiter/EnabledOnJava8.java | 18 --- .../jupiter/Spring5EnabledAnnotationTest.java | 50 ------- ...nit5ComposedAnnotationIntegrationTest.java | 38 ----- .../jupiter/Spring5JUnit5IntegrationTest.java | 25 ---- .../Spring5JUnit5ParallelIntegrationTest.java | 25 ---- ...pring5Java8NewFeaturesIntegrationTest.java | 31 ---- ...g5ReactiveServerClientIntegrationTest.java | 94 ------------ .../jupiter/SpringJUnitConfigTest.java | 33 ---- .../jupiter/SpringJUnitWebConfigTest.java | 34 ----- .../com/baeldung/security/SecurityTest.java | 48 ------ ...ernsUsingHandlerMethodIntegrationTest.java | 101 ------------- .../web/client/WebTestClientTest.java | 60 -------- .../src/test/resources/baeldung-weekly.png | Bin 22275 -> 0 bytes 55 files changed, 71 insertions(+), 2397 deletions(-) delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/Spring5Application.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/SpringSecurity5Application.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/functional/Actor.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/functional/ExploreSpring5URLPatternUsingRouterFunctions.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/functional/FormHandler.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalSpringBootApplication.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalWebApplication.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/functional/IndexRewriteFilter.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/functional/MyService.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/functional/RootServlet.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/jsonb/Person.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/jsonb/PersonController.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/jsonb/Spring5Application.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/jupiter/MethodParameterFactory.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/jupiter/ParameterAutowireUtils.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/jupiter/SpringExtension.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/jupiter/SpringJUnit5Config.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/jupiter/TestConfig.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/persistence/DataSetupBean.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/persistence/FooRepository.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/reactive/Spring5ReactiveApplication.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/reactive/controller/Foo.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/reactive/controller/FooReactiveController.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/security/GreetController.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/security/GreetService.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/security/SecurityConfig.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/web/Foo.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/web/FooController.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/web/PathPatternController.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/web/reactive/Task.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/web/reactive/client/WebClientController.java delete mode 100644 spring-5-reactive/src/test/java/com/baeldung/Example1IntegrationTest.java delete mode 100644 spring-5-reactive/src/test/java/com/baeldung/Example2IntegrationTest.java delete mode 100644 spring-5-reactive/src/test/java/com/baeldung/ParallelIntegrationTest.java delete mode 100644 spring-5-reactive/src/test/java/com/baeldung/Spring5ApplicationIntegrationTest.java delete mode 100644 spring-5-reactive/src/test/java/com/baeldung/Spring5JUnit4ConcurrentIntegrationTest.java delete mode 100644 spring-5-reactive/src/test/java/com/baeldung/functional/BeanRegistrationTest.java delete mode 100644 spring-5-reactive/src/test/java/com/baeldung/functional/ExploreSpring5URLPatternUsingRouterFunctionsTest.java delete mode 100644 spring-5-reactive/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java delete mode 100644 spring-5-reactive/src/test/java/com/baeldung/jsonb/JsonbIntegrationTest.java delete mode 100644 spring-5-reactive/src/test/java/com/baeldung/jupiter/EnabledOnJava8.java delete mode 100644 spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5EnabledAnnotationTest.java delete mode 100644 spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5JUnit5ComposedAnnotationIntegrationTest.java delete mode 100644 spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5JUnit5IntegrationTest.java delete mode 100644 spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5JUnit5ParallelIntegrationTest.java delete mode 100644 spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5Java8NewFeaturesIntegrationTest.java delete mode 100644 spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5ReactiveServerClientIntegrationTest.java delete mode 100644 spring-5-reactive/src/test/java/com/baeldung/jupiter/SpringJUnitConfigTest.java delete mode 100644 spring-5-reactive/src/test/java/com/baeldung/jupiter/SpringJUnitWebConfigTest.java delete mode 100644 spring-5-reactive/src/test/java/com/baeldung/security/SecurityTest.java delete mode 100644 spring-5-reactive/src/test/java/com/baeldung/web/PathPatternsUsingHandlerMethodIntegrationTest.java delete mode 100644 spring-5-reactive/src/test/java/com/baeldung/web/client/WebTestClientTest.java delete mode 100644 spring-5-reactive/src/test/resources/baeldung-weekly.png diff --git a/spring-5-reactive/pom.xml b/spring-5-reactive/pom.xml index 43d9a5ed94..c1c18fbc82 100644 --- a/spring-5-reactive/pom.xml +++ b/spring-5-reactive/pom.xml @@ -22,10 +22,6 @@ org.springframework.boot spring-boot-starter-data-jpa - - org.springframework.boot - spring-boot-starter-security - org.springframework.boot spring-boot-starter-validation @@ -46,8 +42,8 @@ javax.json.bind javax.json.bind-api - ${jsonb-api.version} + @@ -60,6 +56,7 @@ + org.apache.geronimo.specs geronimo-json_1.1_spec @@ -68,7 +65,6 @@ org.apache.johnzon johnzon-jsonb - ${johnzon.version} @@ -98,11 +94,6 @@ spring-boot-starter-test test - - org.springframework.security - spring-security-test - test - org.apache.commons @@ -114,12 +105,10 @@ org.junit.jupiter junit-jupiter-api - ${junit.jupiter.version} org.junit.jupiter junit-jupiter-engine - ${junit.jupiter.version} test @@ -135,6 +124,15 @@ test + + org.projectlombok + lombok + + + org.apache.commons + commons-lang3 + + diff --git a/spring-5-reactive/src/main/java/com/baeldung/Spring5Application.java b/spring-5-reactive/src/main/java/com/baeldung/Spring5Application.java deleted file mode 100644 index f321871646..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/Spring5Application.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.ComponentScan; - -@SpringBootApplication -@ComponentScan(basePackages = { "com.baeldung.web" }) -public class Spring5Application { - - public static void main(String[] args) { - SpringApplication.run(Spring5Application.class, args); - } - -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/SpringSecurity5Application.java b/spring-5-reactive/src/main/java/com/baeldung/SpringSecurity5Application.java deleted file mode 100644 index 02c91a1879..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/SpringSecurity5Application.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.baeldung; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.http.server.reactive.HttpHandler; -import org.springframework.http.server.reactive.ReactorHttpHandlerAdapter; -import org.springframework.web.reactive.config.EnableWebFlux; -import org.springframework.web.server.adapter.WebHttpHandlerBuilder; -import reactor.ipc.netty.NettyContext; -import reactor.ipc.netty.http.server.HttpServer; - -@ComponentScan(basePackages = {"com.baeldung.security"}) -@EnableWebFlux -public class SpringSecurity5Application { - - public static void main(String[] args) { - try (AnnotationConfigApplicationContext context = - new AnnotationConfigApplicationContext(SpringSecurity5Application.class)) { - context.getBean(NettyContext.class).onClose().block(); - } - } - - @Bean - public NettyContext nettyContext(ApplicationContext context) { - HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context) - .build(); - ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler); - HttpServer httpServer = HttpServer.create("localhost", 8080); - return httpServer.newHandler(adapter).block(); - } - -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/functional/Actor.java b/spring-5-reactive/src/main/java/com/baeldung/functional/Actor.java deleted file mode 100644 index 23c88b89e1..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/functional/Actor.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.baeldung.functional; - -class Actor { - private String firstname; - private String lastname; - - public Actor() { - } - - public Actor(String firstname, String lastname) { - this.firstname = firstname; - this.lastname = lastname; - } - - public String getFirstname() { - return firstname; - } - - public String getLastname() { - return lastname; - } - -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/functional/ExploreSpring5URLPatternUsingRouterFunctions.java b/spring-5-reactive/src/main/java/com/baeldung/functional/ExploreSpring5URLPatternUsingRouterFunctions.java deleted file mode 100644 index 2a6d04538c..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/functional/ExploreSpring5URLPatternUsingRouterFunctions.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.baeldung.functional; - -import static org.springframework.web.reactive.function.BodyInserters.fromObject; -import static org.springframework.web.reactive.function.server.RequestPredicates.GET; -import static org.springframework.web.reactive.function.server.RouterFunctions.route; -import static org.springframework.web.reactive.function.server.RouterFunctions.toHttpHandler; -import static org.springframework.web.reactive.function.server.ServerResponse.ok; - -import org.apache.catalina.Context; -import org.apache.catalina.startup.Tomcat; -import org.springframework.boot.web.embedded.tomcat.TomcatWebServer; -import org.springframework.boot.web.server.WebServer; -import org.springframework.core.io.ClassPathResource; -import org.springframework.http.server.reactive.HttpHandler; -import org.springframework.http.server.reactive.ServletHttpHandlerAdapter; -import org.springframework.web.reactive.function.server.RouterFunction; -import org.springframework.web.reactive.function.server.RouterFunctions; -import org.springframework.web.reactive.function.server.ServerResponse; -import org.springframework.web.server.WebHandler; -import org.springframework.web.server.adapter.WebHttpHandlerBuilder; - -public class ExploreSpring5URLPatternUsingRouterFunctions { - - private RouterFunction routingFunction() { - - return route(GET("/p?ths"), serverRequest -> ok().body(fromObject("/p?ths"))).andRoute(GET("/test/{*id}"), serverRequest -> ok().body(fromObject(serverRequest.pathVariable("id")))) - .andRoute(GET("/*card"), serverRequest -> ok().body(fromObject("/*card path was accessed"))) - .andRoute(GET("/{var1}_{var2}"), serverRequest -> ok().body(fromObject(serverRequest.pathVariable("var1") + " , " + serverRequest.pathVariable("var2")))) - .andRoute(GET("/{baeldung:[a-z]+}"), serverRequest -> ok().body(fromObject("/{baeldung:[a-z]+} was accessed and baeldung=" + serverRequest.pathVariable("baeldung")))) - .and(RouterFunctions.resources("/files/{*filepaths}", new ClassPathResource("files/"))); - } - - WebServer start() throws Exception { - WebHandler webHandler = (WebHandler) toHttpHandler(routingFunction()); - HttpHandler httpHandler = WebHttpHandlerBuilder.webHandler(webHandler) - .filter(new IndexRewriteFilter()) - .build(); - - Tomcat tomcat = new Tomcat(); - tomcat.setHostname("localhost"); - tomcat.setPort(9090); - Context rootContext = tomcat.addContext("", System.getProperty("java.io.tmpdir")); - ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler); - Tomcat.addServlet(rootContext, "httpHandlerServlet", servlet); - rootContext.addServletMappingDecoded("/", "httpHandlerServlet"); - - TomcatWebServer server = new TomcatWebServer(tomcat); - server.start(); - return server; - - } - - public static void main(String[] args) { - try { - new FunctionalWebApplication().start(); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/functional/FormHandler.java b/spring-5-reactive/src/main/java/com/baeldung/functional/FormHandler.java deleted file mode 100644 index 05069735bb..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/functional/FormHandler.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.baeldung.functional; - -import org.springframework.core.io.buffer.DataBuffer; -import org.springframework.util.MultiValueMap; -import org.springframework.web.reactive.function.server.ServerRequest; -import org.springframework.web.reactive.function.server.ServerResponse; -import reactor.core.publisher.Mono; - -import java.util.List; -import java.util.concurrent.atomic.AtomicLong; - -import static org.springframework.web.reactive.function.BodyExtractors.toDataBuffers; -import static org.springframework.web.reactive.function.BodyExtractors.toFormData; -import static org.springframework.web.reactive.function.BodyInserters.fromObject; -import static org.springframework.web.reactive.function.server.ServerResponse.ok; - -public class FormHandler { - - Mono handleLogin(ServerRequest request) { - return request.body(toFormData()) - .map(MultiValueMap::toSingleValueMap) - .filter(formData -> "baeldung".equals(formData.get("user"))) - .filter(formData -> "you_know_what_to_do".equals(formData.get("token"))) - .flatMap(formData -> ok().body(Mono.just("welcome back!"), String.class)) - .switchIfEmpty(ServerResponse.badRequest() - .build()); - } - - Mono handleUpload(ServerRequest request) { - return request.body(toDataBuffers()) - .collectList() - .flatMap(dataBuffers -> ok().body(fromObject(extractData(dataBuffers).toString()))); - } - - private AtomicLong extractData(List dataBuffers) { - AtomicLong atomicLong = new AtomicLong(0); - dataBuffers.forEach(d -> atomicLong.addAndGet(d.asByteBuffer() - .array().length)); - return atomicLong; - } -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalSpringBootApplication.java b/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalSpringBootApplication.java deleted file mode 100644 index 402b607b19..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalSpringBootApplication.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.baeldung.functional; - -import static org.springframework.web.reactive.function.BodyInserters.fromObject; -import static org.springframework.web.reactive.function.server.RequestPredicates.GET; -import static org.springframework.web.reactive.function.server.RequestPredicates.POST; -import static org.springframework.web.reactive.function.server.RequestPredicates.path; -import static org.springframework.web.reactive.function.server.RouterFunctions.route; -import static org.springframework.web.reactive.function.server.RouterFunctions.toHttpHandler; -import static org.springframework.web.reactive.function.server.ServerResponse.ok; - -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.web.servlet.ServletRegistrationBean; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; -import org.springframework.core.io.ClassPathResource; -import org.springframework.http.server.reactive.HttpHandler; -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.web.reactive.function.server.RouterFunction; -import org.springframework.web.reactive.function.server.RouterFunctions; -import org.springframework.web.reactive.function.server.ServerResponse; -import org.springframework.web.server.WebHandler; -import org.springframework.web.server.adapter.WebHttpHandlerBuilder; - -import reactor.core.publisher.Flux; - -@SpringBootApplication -@ComponentScan(basePackages = { "com.baeldung.functional" }) -public class FunctionalSpringBootApplication { - - private static final Actor BRAD_PITT = new Actor("Brad", "Pitt"); - private static final Actor TOM_HANKS = new Actor("Tom", "Hanks"); - private static final List actors = new CopyOnWriteArrayList<>(Arrays.asList(BRAD_PITT, TOM_HANKS)); - - private RouterFunction routingFunction() { - FormHandler formHandler = new FormHandler(); - - RouterFunction restfulRouter = route(GET("/"), serverRequest -> ok().body(Flux.fromIterable(actors), Actor.class)).andRoute(POST("/"), serverRequest -> serverRequest.bodyToMono(Actor.class) - .doOnNext(actors::add) - .then(ok().build())); - - return route(GET("/test"), serverRequest -> ok().body(fromObject("helloworld"))).andRoute(POST("/login"), formHandler::handleLogin) - .andRoute(POST("/upload"), formHandler::handleUpload) - .and(RouterFunctions.resources("/files/**", new ClassPathResource("files/"))) - .andNest(path("/actor"), restfulRouter) - .filter((request, next) -> { - System.out.println("Before handler invocation: " + request.path()); - return next.handle(request); - }); - } - - @Bean - public ServletRegistrationBean servletRegistrationBean() throws Exception { - HttpHandler httpHandler = WebHttpHandlerBuilder.webHandler((WebHandler) toHttpHandler(routingFunction())) - .filter(new IndexRewriteFilter()) - .build(); - ServletRegistrationBean registrationBean = new ServletRegistrationBean<>(new RootServlet(httpHandler), "/"); - registrationBean.setLoadOnStartup(1); - registrationBean.setAsyncSupported(true); - return registrationBean; - } - - @Configuration - @EnableWebSecurity - @Profile("!https") - static class SecurityConfig extends WebSecurityConfigurerAdapter { - @Override - protected void configure(final HttpSecurity http) throws Exception { - http.authorizeRequests() - .anyRequest() - .permitAll(); - } - } - - public static void main(String[] args) { - SpringApplication.run(FunctionalSpringBootApplication.class, args); - } - -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalWebApplication.java b/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalWebApplication.java deleted file mode 100644 index 5a7d70d3db..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalWebApplication.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.baeldung.functional; - -import static org.springframework.web.reactive.function.BodyInserters.fromObject; -import static org.springframework.web.reactive.function.server.RequestPredicates.GET; -import static org.springframework.web.reactive.function.server.RequestPredicates.POST; -import static org.springframework.web.reactive.function.server.RequestPredicates.path; -import static org.springframework.web.reactive.function.server.RouterFunctions.route; -import static org.springframework.web.reactive.function.server.RouterFunctions.toHttpHandler; -import static org.springframework.web.reactive.function.server.ServerResponse.ok; - -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; - -import org.apache.catalina.Context; -import org.apache.catalina.startup.Tomcat; -import org.springframework.boot.web.embedded.tomcat.TomcatWebServer; -import org.springframework.boot.web.server.WebServer; -import org.springframework.core.io.ClassPathResource; -import org.springframework.http.server.reactive.HttpHandler; -import org.springframework.http.server.reactive.ServletHttpHandlerAdapter; -import org.springframework.web.reactive.function.server.RouterFunction; -import org.springframework.web.reactive.function.server.RouterFunctions; -import org.springframework.web.reactive.function.server.ServerResponse; -import org.springframework.web.server.WebHandler; -import org.springframework.web.server.adapter.WebHttpHandlerBuilder; - -import reactor.core.publisher.Flux; - -public class FunctionalWebApplication { - - private static final Actor BRAD_PITT = new Actor("Brad", "Pitt"); - private static final Actor TOM_HANKS = new Actor("Tom", "Hanks"); - private static final List actors = new CopyOnWriteArrayList<>(Arrays.asList(BRAD_PITT, TOM_HANKS)); - - private RouterFunction routingFunction() { - FormHandler formHandler = new FormHandler(); - - RouterFunction restfulRouter = route(GET("/"), serverRequest -> ok().body(Flux.fromIterable(actors), Actor.class)).andRoute(POST("/"), serverRequest -> serverRequest.bodyToMono(Actor.class) - .doOnNext(actors::add) - .then(ok().build())); - - return route(GET("/test"), serverRequest -> ok().body(fromObject("helloworld"))).andRoute(POST("/login"), formHandler::handleLogin) - .andRoute(POST("/upload"), formHandler::handleUpload) - .and(RouterFunctions.resources("/files/**", new ClassPathResource("files/"))) - .andNest(path("/actor"), restfulRouter) - .filter((request, next) -> { - System.out.println("Before handler invocation: " + request.path()); - return next.handle(request); - }); - } - - WebServer start() throws Exception { - WebHandler webHandler = (WebHandler) toHttpHandler(routingFunction()); - HttpHandler httpHandler = WebHttpHandlerBuilder.webHandler(webHandler) - .filter(new IndexRewriteFilter()) - .build(); - - Tomcat tomcat = new Tomcat(); - tomcat.setHostname("localhost"); - tomcat.setPort(9090); - Context rootContext = tomcat.addContext("", System.getProperty("java.io.tmpdir")); - ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler); - Tomcat.addServlet(rootContext, "httpHandlerServlet", servlet); - rootContext.addServletMappingDecoded("/", "httpHandlerServlet"); - - TomcatWebServer server = new TomcatWebServer(tomcat); - server.start(); - return server; - - } - - public static void main(String[] args) { - try { - new FunctionalWebApplication().start(); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/functional/IndexRewriteFilter.java b/spring-5-reactive/src/main/java/com/baeldung/functional/IndexRewriteFilter.java deleted file mode 100644 index 3e91a0354b..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/functional/IndexRewriteFilter.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baeldung.functional; - -import org.springframework.http.server.reactive.ServerHttpRequest; -import org.springframework.web.server.ServerWebExchange; -import org.springframework.web.server.WebFilter; -import org.springframework.web.server.WebFilterChain; -import reactor.core.publisher.Mono; - -class IndexRewriteFilter implements WebFilter { - - @Override - public Mono filter(ServerWebExchange serverWebExchange, WebFilterChain webFilterChain) { - ServerHttpRequest request = serverWebExchange.getRequest(); - if (request.getURI() - .getPath() - .equals("/")) { - return webFilterChain.filter(serverWebExchange.mutate() - .request(builder -> builder.method(request.getMethod()) - .contextPath(request.getPath() - .toString()) - .path("/test")) - .build()); - } - return webFilterChain.filter(serverWebExchange); - } - -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/functional/MyService.java b/spring-5-reactive/src/main/java/com/baeldung/functional/MyService.java deleted file mode 100644 index b7b8b13d8b..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/functional/MyService.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.baeldung.functional; - -import java.util.Random; - -public class MyService { - - public int getRandomNumber() { - return (new Random().nextInt(10)); - } - -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/functional/RootServlet.java b/spring-5-reactive/src/main/java/com/baeldung/functional/RootServlet.java deleted file mode 100644 index 8fe24821de..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/functional/RootServlet.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.baeldung.functional; - -import static org.springframework.web.reactive.function.BodyExtractors.toDataBuffers; -import static org.springframework.web.reactive.function.BodyExtractors.toFormData; -import static org.springframework.web.reactive.function.BodyInserters.fromObject; -import static org.springframework.web.reactive.function.server.RequestPredicates.GET; -import static org.springframework.web.reactive.function.server.RequestPredicates.POST; -import static org.springframework.web.reactive.function.server.RequestPredicates.path; -import static org.springframework.web.reactive.function.server.RouterFunctions.route; -import static org.springframework.web.reactive.function.server.RouterFunctions.toHttpHandler; -import static org.springframework.web.reactive.function.server.ServerResponse.ok; - -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.atomic.AtomicLong; - -import org.springframework.core.io.ClassPathResource; -import org.springframework.http.server.reactive.HttpHandler; -import org.springframework.http.server.reactive.ServletHttpHandlerAdapter; -import org.springframework.util.MultiValueMap; -import org.springframework.web.reactive.function.server.RouterFunction; -import org.springframework.web.reactive.function.server.RouterFunctions; -import org.springframework.web.reactive.function.server.ServerResponse; -import org.springframework.web.server.WebHandler; -import org.springframework.web.server.adapter.WebHttpHandlerBuilder; - -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public class RootServlet extends ServletHttpHandlerAdapter { - - public RootServlet() { - this(WebHttpHandlerBuilder.webHandler((WebHandler) toHttpHandler(routingFunction())) - .filter(new IndexRewriteFilter()) - .build()); - } - - RootServlet(HttpHandler httpHandler) { - super(httpHandler); - } - - private static final Actor BRAD_PITT = new Actor("Brad", "Pitt"); - private static final Actor TOM_HANKS = new Actor("Tom", "Hanks"); - private static final List actors = new CopyOnWriteArrayList<>(Arrays.asList(BRAD_PITT, TOM_HANKS)); - - private static RouterFunction routingFunction() { - - return route(GET("/test"), serverRequest -> ok().body(fromObject("helloworld"))).andRoute(POST("/login"), serverRequest -> serverRequest.body(toFormData()) - .map(MultiValueMap::toSingleValueMap) - .map(formData -> { - System.out.println("form data: " + formData.toString()); - if ("baeldung".equals(formData.get("user")) && "you_know_what_to_do".equals(formData.get("token"))) { - return ok().body(Mono.just("welcome back!"), String.class) - .block(); - } - return ServerResponse.badRequest() - .build() - .block(); - })) - .andRoute(POST("/upload"), serverRequest -> serverRequest.body(toDataBuffers()) - .collectList() - .map(dataBuffers -> { - AtomicLong atomicLong = new AtomicLong(0); - dataBuffers.forEach(d -> atomicLong.addAndGet(d.asByteBuffer() - .array().length)); - System.out.println("data length:" + atomicLong.get()); - return ok().body(fromObject(atomicLong.toString())) - .block(); - })) - .and(RouterFunctions.resources("/files/**", new ClassPathResource("files/"))) - .andNest(path("/actor"), route(GET("/"), serverRequest -> ok().body(Flux.fromIterable(actors), Actor.class)).andRoute(POST("/"), serverRequest -> serverRequest.bodyToMono(Actor.class) - .doOnNext(actors::add) - .then(ok().build()))) - .filter((request, next) -> { - System.out.println("Before handler invocation: " + request.path()); - return next.handle(request); - }); - - } - -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/jsonb/Person.java b/spring-5-reactive/src/main/java/com/baeldung/jsonb/Person.java deleted file mode 100644 index 7a54b37574..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/jsonb/Person.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.baeldung.jsonb; - -import java.math.BigDecimal; -import java.time.LocalDate; - -import javax.json.bind.annotation.JsonbDateFormat; -import javax.json.bind.annotation.JsonbNumberFormat; -import javax.json.bind.annotation.JsonbProperty; -import javax.json.bind.annotation.JsonbTransient; - -public class Person { - - private int id; - @JsonbProperty("person-name") - private String name; - @JsonbProperty(nillable = true) - private String email; - @JsonbTransient - private int age; - @JsonbDateFormat("dd-MM-yyyy") - private LocalDate registeredDate; - private BigDecimal salary; - - public Person() { - } - - public Person(int id, String name, String email, int age, LocalDate registeredDate, BigDecimal salary) { - super(); - this.id = id; - this.name = name; - this.email = email; - this.age = age; - this.registeredDate = registeredDate; - this.salary = salary; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - @JsonbNumberFormat(locale = "en_US", value = "#0.0") - public BigDecimal getSalary() { - return salary; - } - - public void setSalary(BigDecimal salary) { - this.salary = salary; - } - - public LocalDate getRegisteredDate() { - return registeredDate; - } - - public void setRegisteredDate(LocalDate registeredDate) { - this.registeredDate = registeredDate; - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("Person [id="); - builder.append(id); - builder.append(", name="); - builder.append(name); - builder.append(", email="); - builder.append(email); - builder.append(", age="); - builder.append(age); - builder.append(", registeredDate="); - builder.append(registeredDate); - builder.append(", salary="); - builder.append(salary); - builder.append("]"); - return builder.toString(); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + id; - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Person other = (Person) obj; - if (id != other.id) - return false; - return true; - } - -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/jsonb/PersonController.java b/spring-5-reactive/src/main/java/com/baeldung/jsonb/PersonController.java deleted file mode 100644 index e216a282eb..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/jsonb/PersonController.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.baeldung.jsonb; - -import java.math.BigDecimal; -import java.time.LocalDate; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.annotation.PostConstruct; - -import org.springframework.http.HttpStatus; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.ResponseStatus; -import org.springframework.web.bind.annotation.RestController; - -@RestController("/person") -public class PersonController { - - List personRepository; - - @PostConstruct - public void init() { - // @formatter:off - personRepository = new ArrayList<>(Arrays.asList( - new Person(1, "Jhon", "jhon@test.com", 20, LocalDate.of(2019, 9, 9), BigDecimal.valueOf(1000)), - new Person(2, "Jhon", "jhon1@test.com", 20, LocalDate.of(2019, 9, 9), BigDecimal.valueOf(1500)), - new Person(3, "Jhon", null, 20, LocalDate.of(2019, 9, 9), BigDecimal.valueOf(1000)), - new Person(4, "Tom", "tom@test.com", 21, LocalDate.of(2019, 9, 9), BigDecimal.valueOf(1500)), - new Person(5, "Mark", "mark@test.com", 21, LocalDate.of(2019, 9, 9), BigDecimal.valueOf(1200)), - new Person(6, "Julia", "jhon@test.com", 20, LocalDate.of(2019, 9, 9), BigDecimal.valueOf(1000)))); - // @formatter:on - - } - - @GetMapping("/person/{id}") - @ResponseBody - public Person findById(@PathVariable final int id) { - return personRepository.get(id); - } - - @PostMapping("/person") - @ResponseStatus(HttpStatus.OK) - @ResponseBody - public boolean insertPerson(@RequestBody final Person person) { - return personRepository.add(person); - } - - @GetMapping("/person") - @ResponseBody - public List findAll() { - return personRepository; - } - -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/jsonb/Spring5Application.java b/spring-5-reactive/src/main/java/com/baeldung/jsonb/Spring5Application.java deleted file mode 100644 index 00fce06834..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/jsonb/Spring5Application.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.baeldung.jsonb; - -import java.util.ArrayList; -import java.util.Collection; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.http.HttpMessageConverters; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.http.converter.HttpMessageConverter; -import org.springframework.http.converter.json.JsonbHttpMessageConverter; - -@SpringBootApplication -@ComponentScan(basePackages = { "com.baeldung.jsonb" }) -public class Spring5Application { - - public static void main(String[] args) { - SpringApplication.run(Spring5Application.class, args); - } - - @Bean - public HttpMessageConverters customConverters() { - Collection> messageConverters = new ArrayList<>(); - JsonbHttpMessageConverter jsonbHttpMessageConverter = new JsonbHttpMessageConverter(); - messageConverters.add(jsonbHttpMessageConverter); - return new HttpMessageConverters(true, messageConverters); - } - -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/jupiter/MethodParameterFactory.java b/spring-5-reactive/src/main/java/com/baeldung/jupiter/MethodParameterFactory.java deleted file mode 100644 index 85bd505d11..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/jupiter/MethodParameterFactory.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.baeldung.jupiter; - -import org.springframework.core.MethodParameter; -import org.springframework.core.annotation.SynthesizingMethodParameter; -import org.springframework.util.Assert; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Executable; -import java.lang.reflect.Method; -import java.lang.reflect.Parameter; - -abstract class MethodParameterFactory { - - private MethodParameterFactory() { - } - - public static MethodParameter createMethodParameter(Parameter parameter) { - Assert.notNull(parameter, "Parameter must not be null"); - Executable executable = parameter.getDeclaringExecutable(); - if (executable instanceof Method) { - return new MethodParameter((Method) executable, getIndex(parameter)); - } - return new MethodParameter((Constructor) executable, getIndex(parameter)); - } - - public static SynthesizingMethodParameter createSynthesizingMethodParameter(Parameter parameter) { - Assert.notNull(parameter, "Parameter must not be null"); - Executable executable = parameter.getDeclaringExecutable(); - if (executable instanceof Method) { - return new SynthesizingMethodParameter((Method) executable, getIndex(parameter)); - } - throw new UnsupportedOperationException("Cannot create a SynthesizingMethodParameter for a constructor parameter: " + parameter); - } - - private static int getIndex(Parameter parameter) { - Assert.notNull(parameter, "Parameter must not be null"); - Executable executable = parameter.getDeclaringExecutable(); - Parameter[] parameters = executable.getParameters(); - for (int i = 0; i < parameters.length; i++) { - if (parameters[i] == parameter) { - return i; - } - } - throw new IllegalStateException(String.format("Failed to resolve index of parameter [%s] in executable [%s]", parameter, executable.toGenericString())); - } -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/jupiter/ParameterAutowireUtils.java b/spring-5-reactive/src/main/java/com/baeldung/jupiter/ParameterAutowireUtils.java deleted file mode 100644 index d1a4cc8b29..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/jupiter/ParameterAutowireUtils.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.baeldung.jupiter; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.beans.factory.config.DependencyDescriptor; -import org.springframework.context.ApplicationContext; -import org.springframework.core.MethodParameter; -import org.springframework.core.annotation.AnnotatedElementUtils; - -import java.lang.annotation.Annotation; -import java.lang.reflect.AnnotatedElement; -import java.lang.reflect.Method; -import java.lang.reflect.Parameter; -import java.util.Optional; - -import static org.springframework.core.annotation.AnnotatedElementUtils.hasAnnotation; - -abstract class ParameterAutowireUtils { - - private ParameterAutowireUtils() { - } - - public static boolean isAutowirable(Parameter parameter) { - return ApplicationContext.class.isAssignableFrom(parameter.getType()) || hasAnnotation(parameter, Autowired.class) || hasAnnotation(parameter, Qualifier.class) || hasAnnotation(parameter, Value.class); - } - - public static Object resolveDependency(Parameter parameter, Class containingClass, ApplicationContext applicationContext) { - - boolean required = findMergedAnnotation(parameter, Autowired.class).map(Autowired::required) - .orElse(true); - MethodParameter methodParameter = (parameter.getDeclaringExecutable() instanceof Method ? MethodParameterFactory.createSynthesizingMethodParameter(parameter) : MethodParameterFactory.createMethodParameter(parameter)); - DependencyDescriptor descriptor = new DependencyDescriptor(methodParameter, required); - descriptor.setContainingClass(containingClass); - - return applicationContext.getAutowireCapableBeanFactory() - .resolveDependency(descriptor, null); - } - - private static Optional findMergedAnnotation(AnnotatedElement element, Class annotationType) { - - return Optional.ofNullable(AnnotatedElementUtils.findMergedAnnotation(element, annotationType)); - } -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/jupiter/SpringExtension.java b/spring-5-reactive/src/main/java/com/baeldung/jupiter/SpringExtension.java deleted file mode 100644 index 7218d984ef..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/jupiter/SpringExtension.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.baeldung.jupiter; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Executable; -import java.lang.reflect.Method; -import java.lang.reflect.Parameter; - -import org.junit.jupiter.api.extension.AfterAllCallback; -import org.junit.jupiter.api.extension.AfterEachCallback; -import org.junit.jupiter.api.extension.BeforeAllCallback; -import org.junit.jupiter.api.extension.BeforeEachCallback; -import org.junit.jupiter.api.extension.ExtensionContext; -import org.junit.jupiter.api.extension.ParameterContext; -import org.junit.jupiter.api.extension.ParameterResolutionException; -import org.junit.jupiter.api.extension.ParameterResolver; -import org.junit.jupiter.api.extension.TestInstancePostProcessor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; -import org.springframework.core.annotation.AnnotatedElementUtils; -import org.springframework.test.context.TestContextManager; -import org.springframework.util.Assert; - -public class SpringExtension implements BeforeAllCallback, AfterAllCallback, TestInstancePostProcessor, BeforeEachCallback, AfterEachCallback, ParameterResolver { - - private static final ExtensionContext.Namespace namespace = ExtensionContext.Namespace.create(SpringExtension.class); - - @Override - public void beforeAll(ExtensionContext context) throws Exception { - getTestContextManager(context).beforeTestClass(); - } - - @Override - public void afterAll(ExtensionContext context) throws Exception { - try { - getTestContextManager(context).afterTestClass(); - } finally { - context.getStore(namespace) - .remove(context.getTestClass() - .get()); - } - } - - @Override - public void postProcessTestInstance(Object testInstance, ExtensionContext context) throws Exception { - getTestContextManager(context).prepareTestInstance(testInstance); - } - - @Override - public void beforeEach(ExtensionContext context) throws Exception { - Object testInstance = context.getTestInstance(); - Method testMethod = context.getTestMethod() - .get(); - getTestContextManager(context).beforeTestMethod(testInstance, testMethod); - } - - @Override - public void afterEach(ExtensionContext context) throws Exception { - Object testInstance = context.getTestInstance(); - Method testMethod = context.getTestMethod() - .get(); - Throwable testException = context.getExecutionException() - .orElse(null); - getTestContextManager(context).afterTestMethod(testInstance, testMethod, testException); - } - - @Override - public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException { - Parameter parameter = parameterContext.getParameter(); - Executable executable = parameter.getDeclaringExecutable(); - return ((executable instanceof Constructor) && AnnotatedElementUtils.hasAnnotation(executable, Autowired.class)) || ParameterAutowireUtils.isAutowirable(parameter); - } - - @Override - public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException { - Parameter parameter = parameterContext.getParameter(); - Class testClass = extensionContext.getTestClass() - .get(); - ApplicationContext applicationContext = getApplicationContext(extensionContext); - return ParameterAutowireUtils.resolveDependency(parameter, testClass, applicationContext); - } - - private ApplicationContext getApplicationContext(ExtensionContext context) { - return getTestContextManager(context).getTestContext() - .getApplicationContext(); - } - - private TestContextManager getTestContextManager(ExtensionContext context) { - Assert.notNull(context, "ExtensionContext must not be null"); - Class testClass = context.getTestClass() - .get(); - ExtensionContext.Store store = context.getStore(namespace); - return store.getOrComputeIfAbsent(testClass, TestContextManager::new, TestContextManager.class); - } -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/jupiter/SpringJUnit5Config.java b/spring-5-reactive/src/main/java/com/baeldung/jupiter/SpringJUnit5Config.java deleted file mode 100644 index 8f02d71d49..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/jupiter/SpringJUnit5Config.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.baeldung.jupiter; - -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.context.ApplicationContextInitializer; -import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.core.annotation.AliasFor; -import org.springframework.test.context.ContextConfiguration; - -import java.lang.annotation.*; - -@ExtendWith(SpringExtension.class) -@ContextConfiguration -@Documented -@Inherited -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface SpringJUnit5Config { - - @AliasFor(annotation = ContextConfiguration.class, attribute = "classes") - Class[] value() default {}; - - @AliasFor(annotation = ContextConfiguration.class) - Class[] classes() default {}; - - @AliasFor(annotation = ContextConfiguration.class) - String[] locations() default {}; - - @AliasFor(annotation = ContextConfiguration.class) - Class>[] initializers() default {}; - - @AliasFor(annotation = ContextConfiguration.class) - boolean inheritLocations() default true; - - @AliasFor(annotation = ContextConfiguration.class) - boolean inheritInitializers() default true; - - @AliasFor(annotation = ContextConfiguration.class) - String name() default ""; -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/jupiter/TestConfig.java b/spring-5-reactive/src/main/java/com/baeldung/jupiter/TestConfig.java deleted file mode 100644 index a29f77c5df..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/jupiter/TestConfig.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.baeldung.jupiter; - -import com.baeldung.web.reactive.Task; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; - -@Configuration -public class TestConfig { - - @Bean - static PropertySourcesPlaceholderConfigurer placeholderConfigurer() { - return new PropertySourcesPlaceholderConfigurer(); - } - - @Bean - Task taskName() { - return new Task("taskName", 1); - } -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/persistence/DataSetupBean.java b/spring-5-reactive/src/main/java/com/baeldung/persistence/DataSetupBean.java deleted file mode 100644 index 9f5d9ff6c2..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/persistence/DataSetupBean.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baeldung.persistence; - -import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; - -import java.util.stream.IntStream; - -import org.springframework.beans.factory.InitializingBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.baeldung.web.Foo; - -@Component -public class DataSetupBean implements InitializingBean { - - @Autowired - private FooRepository repo; - - // - - @Override - public void afterPropertiesSet() throws Exception { - IntStream.range(1, 20) - .forEach(i -> repo.save(new Foo(randomAlphabetic(8)))); - } - -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/persistence/FooRepository.java b/spring-5-reactive/src/main/java/com/baeldung/persistence/FooRepository.java deleted file mode 100644 index 1f1e071158..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/persistence/FooRepository.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.baeldung.persistence; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.JpaSpecificationExecutor; - -import com.baeldung.web.Foo; - -public interface FooRepository extends JpaRepository, JpaSpecificationExecutor { - -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/Spring5ReactiveApplication.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/Spring5ReactiveApplication.java new file mode 100644 index 0000000000..a9308124fa --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/Spring5ReactiveApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.reactive; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Spring5ReactiveApplication { + + public static void main(String[] args) { + SpringApplication.run(Spring5ReactiveApplication.class, args); + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/controller/Foo.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/controller/Foo.java new file mode 100644 index 0000000000..480782a551 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/controller/Foo.java @@ -0,0 +1,13 @@ +package com.baeldung.reactive.controller; + +import lombok.AllArgsConstructor; +import lombok.Data; + +@AllArgsConstructor +@Data +public class Foo { + + private long id; + private String name; + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/controller/FooReactiveController.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/controller/FooReactiveController.java new file mode 100644 index 0000000000..d82692619d --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/controller/FooReactiveController.java @@ -0,0 +1,34 @@ +package com.baeldung.reactive.controller; + +import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; + +import java.time.Duration; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RestController; + +import reactor.core.publisher.ConnectableFlux; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +@RestController("/foos") +public class FooReactiveController { + + @GetMapping("/{id}") + public Mono getFoo(@PathVariable("id") long id) { + return Mono.just(new Foo(id, randomAlphabetic(6))); + } + + @GetMapping("/") + public Flux getAllFoos() { + final ConnectableFlux flux = Flux. create(fluxSink -> { + while (true) { + fluxSink.next(new Foo(System.currentTimeMillis(), randomAlphabetic(6))); + } + }).sample(Duration.ofSeconds(1)).publish(); + + return flux; + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/security/GreetController.java b/spring-5-reactive/src/main/java/com/baeldung/security/GreetController.java deleted file mode 100644 index 6b69e3bc9b..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/security/GreetController.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.baeldung.security; - -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RestController; -import reactor.core.publisher.Mono; - -import java.security.Principal; - -@RestController -public class GreetController { - - private GreetService greetService; - - public GreetController(GreetService greetService) { - this.greetService = greetService; - } - - @GetMapping("/") - public Mono greet(Mono principal) { - return principal - .map(Principal::getName) - .map(name -> String.format("Hello, %s", name)); - } - - @GetMapping("/admin") - public Mono greetAdmin(Mono principal) { - return principal - .map(Principal::getName) - .map(name -> String.format("Admin access: %s", name)); - } - - @GetMapping("/greetService") - public Mono greetService() { - return greetService.greet(); - } - -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/security/GreetService.java b/spring-5-reactive/src/main/java/com/baeldung/security/GreetService.java deleted file mode 100644 index 7622b360be..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/security/GreetService.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.security; - -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.stereotype.Service; -import reactor.core.publisher.Mono; - -@Service -public class GreetService { - - @PreAuthorize("hasRole('ADMIN')") - public Mono greet() { - return Mono.just("Hello from service!"); - } - -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/security/SecurityConfig.java b/spring-5-reactive/src/main/java/com/baeldung/security/SecurityConfig.java deleted file mode 100644 index a9e44a2eee..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/security/SecurityConfig.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.baeldung.security; - -import org.springframework.context.annotation.Bean; -import org.springframework.security.config.annotation.method.configuration.EnableReactiveMethodSecurity; -import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity; -import org.springframework.security.config.web.server.ServerHttpSecurity; -import org.springframework.security.core.userdetails.MapReactiveUserDetailsService; -import org.springframework.security.core.userdetails.User; -import org.springframework.security.core.userdetails.UserDetails; -import org.springframework.security.web.server.SecurityWebFilterChain; - -@EnableWebFluxSecurity -@EnableReactiveMethodSecurity -public class SecurityConfig { - - @Bean - public SecurityWebFilterChain securitygWebFilterChain(ServerHttpSecurity http) { - return http.authorizeExchange() - .pathMatchers("/admin").hasAuthority("ROLE_ADMIN") - .anyExchange().authenticated() - .and().formLogin() - .and().build(); - } - - @Bean - public MapReactiveUserDetailsService userDetailsService() { - UserDetails user = User.withDefaultPasswordEncoder() - .username("user") - .password("password") - .roles("USER") - .build(); - - UserDetails admin = User.withDefaultPasswordEncoder() - .username("admin") - .password("password") - .roles("ADMIN") - .build(); - - return new MapReactiveUserDetailsService(user, admin); - } - -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/web/Foo.java b/spring-5-reactive/src/main/java/com/baeldung/web/Foo.java deleted file mode 100644 index c4868a9958..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/web/Foo.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.baeldung.web; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; - -@Entity -public class Foo { - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - private long id; - - private String name; - - public Foo() { - super(); - } - - public Foo(final String name) { - super(); - - this.name = name; - } - - public Foo(final long id, final String name) { - super(); - - this.id = id; - this.name = name; - } - - // API - - public long getId() { - return id; - } - - public void setId(final long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(final String name) { - this.name = name; - } - - // - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Foo other = (Foo) obj; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - return true; - } - - @Override - public String toString() { - return "Foo [name=" + name + "]"; - } - -} \ No newline at end of file diff --git a/spring-5-reactive/src/main/java/com/baeldung/web/FooController.java b/spring-5-reactive/src/main/java/com/baeldung/web/FooController.java deleted file mode 100644 index 925f2b49f4..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/web/FooController.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.baeldung.web; - -import com.baeldung.persistence.FooRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.PageRequest; -import org.springframework.http.HttpStatus; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.validation.constraints.Max; -import javax.validation.constraints.Min; -import java.util.List; - -@RestController("/foos") -public class FooController { - - @Autowired - private FooRepository repo; - - // API - read - - @GetMapping("/foos/{id}") - @ResponseBody - @Validated - public Foo findById(@PathVariable @Min(0) final long id) { - return repo.findById(id) - .orElse(null); - } - - @GetMapping - @ResponseBody - public List findAll() { - return repo.findAll(); - } - - @GetMapping(params = { "page", "size" }) - @ResponseBody - @Validated - public List findPaginated(@RequestParam("page") @Min(0) final int page, @Max(100) @RequestParam("size") final int size) { - return repo.findAll(PageRequest.of(page, size)) - .getContent(); - } - - // API - write - - @PutMapping("/foos/{id}") - @ResponseStatus(HttpStatus.OK) - @ResponseBody - public Foo update(@PathVariable("id") final String id, @RequestBody final Foo foo) { - return foo; - } - -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/web/PathPatternController.java b/spring-5-reactive/src/main/java/com/baeldung/web/PathPatternController.java deleted file mode 100644 index fa413e4f00..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/web/PathPatternController.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.baeldung.web; - -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RestController; - -@RestController -public class PathPatternController { - - @GetMapping("/spring5/{*id}") - public String URIVariableHandler(@PathVariable String id) { - return id; - } - - @GetMapping("/s?ring5") - public String wildcardTakingExactlyOneChar() { - return "/s?ring5"; - } - - @GetMapping("/spring5/*id") - public String wildcardTakingZeroOrMoreChar() { - return "/spring5/*id"; - } - - @GetMapping("/resources/**") - public String wildcardTakingZeroOrMorePathSegments() { - return "/resources/**"; - } - - @GetMapping("/{baeldung:[a-z]+}") - public String regexInPathVariable(@PathVariable String baeldung) { - return baeldung; - } - - @GetMapping("/{var1}_{var2}") - public String multiplePathVariablesInSameSegment(@PathVariable String var1, @PathVariable String var2) { - return "Two variables are var1=" + var1 + " and var2=" + var2; - } -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/web/reactive/Task.java b/spring-5-reactive/src/main/java/com/baeldung/web/reactive/Task.java deleted file mode 100644 index 725fd931e1..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/web/reactive/Task.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.baeldung.web.reactive; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class Task { - - private final String name; - - private final int id; - - public Task(@JsonProperty("name") String name, @JsonProperty("id") int id) { - this.name = name; - this.id = id; - } - - public String getName() { - return this.name; - } - - public int getId() { - return this.id; - } - - @Override - public String toString() { - return "Task{" + "name='" + name + '\'' + ", id=" + id + '}'; - } -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/web/reactive/client/WebClientController.java b/spring-5-reactive/src/main/java/com/baeldung/web/reactive/client/WebClientController.java deleted file mode 100644 index a218c6b7cf..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/web/reactive/client/WebClientController.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.baeldung.web.reactive.client; - -import org.reactivestreams.Publisher; -import org.reactivestreams.Subscriber; -import org.springframework.http.*; -import org.springframework.http.client.reactive.ClientHttpRequest; -import org.springframework.util.LinkedMultiValueMap; -import org.springframework.util.MultiValueMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.ResponseStatus; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.reactive.function.BodyInserter; -import org.springframework.web.reactive.function.BodyInserters; -import org.springframework.web.reactive.function.client.WebClient; -import reactor.core.publisher.Mono; - -import java.net.URI; -import java.nio.charset.Charset; -import java.time.ZonedDateTime; -import java.util.Collections; - -@RestController -public class WebClientController { - - @ResponseStatus(HttpStatus.OK) - @GetMapping("/resource") - public void getResource() { - } - - public void demonstrateWebClient() { - // request - WebClient.UriSpec request1 = createWebClientWithServerURLAndDefaultValues().method(HttpMethod.POST); - WebClient.UriSpec request2 = createWebClientWithServerURLAndDefaultValues().post(); - - // request body specifications - WebClient.RequestBodySpec uri1 = createWebClientWithServerURLAndDefaultValues().method(HttpMethod.POST) - .uri("/resource"); - WebClient.RequestBodySpec uri2 = createWebClientWithServerURLAndDefaultValues().post() - .uri(URI.create("/resource")); - - // request header specification - WebClient.RequestHeadersSpec requestSpec1 = uri1.body(BodyInserters.fromPublisher(Mono.just("data"), String.class)); - WebClient.RequestHeadersSpec requestSpec2 = uri2.body(BodyInserters.fromObject("data")); - - // inserters - BodyInserter, ReactiveHttpOutputMessage> inserter1 = BodyInserters - .fromPublisher(Subscriber::onComplete, String.class); - - LinkedMultiValueMap map = new LinkedMultiValueMap<>(); - map.add("key1", "value1"); - map.add("key2", "value2"); - - BodyInserter, ClientHttpRequest> inserter2 = BodyInserters.fromMultipartData(map); - BodyInserter inserter3 = BodyInserters.fromObject("body"); - - // responses - WebClient.ResponseSpec response1 = uri1.body(inserter3) - .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) - .accept(MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML) - .acceptCharset(Charset.forName("UTF-8")) - .ifNoneMatch("*") - .ifModifiedSince(ZonedDateTime.now()) - .retrieve(); - WebClient.ResponseSpec response2 = requestSpec2.retrieve(); - - } - - private WebClient createWebClient() { - return WebClient.create(); - } - - private WebClient createWebClientWithServerURL() { - return WebClient.create("http://localhost:8081"); - } - - private WebClient createWebClientWithServerURLAndDefaultValues() { - return WebClient.builder() - .baseUrl("http://localhost:8081") - .defaultCookie("cookieKey", "cookieValue") - .defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) - .defaultUriVariables(Collections.singletonMap("url", "http://localhost:8080")) - .build(); - } - -} diff --git a/spring-5-reactive/src/main/resources/application.properties b/spring-5-reactive/src/main/resources/application.properties index ccec014c2b..4b49e8e8a2 100644 --- a/spring-5-reactive/src/main/resources/application.properties +++ b/spring-5-reactive/src/main/resources/application.properties @@ -1,3 +1 @@ -server.port=8081 - logging.level.root=INFO \ No newline at end of file diff --git a/spring-5-reactive/src/test/java/com/baeldung/Example1IntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/Example1IntegrationTest.java deleted file mode 100644 index 8b9e66213f..0000000000 --- a/spring-5-reactive/src/test/java/com/baeldung/Example1IntegrationTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class Example1IntegrationTest { - - @Test - public void test1a() { - block(3000); - } - - @Test - public void test1b() { - block(3000); - } - - public static void block(long ms) { - try { - Thread.sleep(ms); - } catch (InterruptedException e) { - System.out.println("Thread interrupted"); - } - } -} diff --git a/spring-5-reactive/src/test/java/com/baeldung/Example2IntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/Example2IntegrationTest.java deleted file mode 100644 index 6ed53ca4e9..0000000000 --- a/spring-5-reactive/src/test/java/com/baeldung/Example2IntegrationTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class Example2IntegrationTest { - - @Test - public void test1a() { - block(3000); - } - - @Test - public void test1b() { - block(3000); - } - - public static void block(long ms) { - try { - Thread.sleep(ms); - } catch (InterruptedException e) { - System.out.println("Thread Interrupted"); - } - } -} diff --git a/spring-5-reactive/src/test/java/com/baeldung/ParallelIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/ParallelIntegrationTest.java deleted file mode 100644 index 1ce96de4ef..0000000000 --- a/spring-5-reactive/src/test/java/com/baeldung/ParallelIntegrationTest.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.baeldung; - -import org.junit.Test; -import org.junit.experimental.ParallelComputer; -import org.junit.runner.Computer; -import org.junit.runner.JUnitCore; - -public class ParallelIntegrationTest { - - @Test - public void runTests() { - final Class[] classes = { Example1IntegrationTest.class, Example2IntegrationTest.class }; - - JUnitCore.runClasses(new Computer(), classes); - } - - @Test - public void runTestsInParallel() { - final Class[] classes = { Example1IntegrationTest.class, Example2IntegrationTest.class }; - - JUnitCore.runClasses(new ParallelComputer(true, true), classes); - } - -} \ No newline at end of file diff --git a/spring-5-reactive/src/test/java/com/baeldung/Spring5ApplicationIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/Spring5ApplicationIntegrationTest.java deleted file mode 100644 index af288c3c2d..0000000000 --- a/spring-5-reactive/src/test/java/com/baeldung/Spring5ApplicationIntegrationTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class Spring5ApplicationIntegrationTest { - - @Test - public void contextLoads() { - } - -} diff --git a/spring-5-reactive/src/test/java/com/baeldung/Spring5JUnit4ConcurrentIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/Spring5JUnit4ConcurrentIntegrationTest.java deleted file mode 100644 index 7e494465b2..0000000000 --- a/spring-5-reactive/src/test/java/com/baeldung/Spring5JUnit4ConcurrentIntegrationTest.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.InitializingBean; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.context.annotation.Configuration; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; - -import java.util.concurrent.TimeUnit; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -@RunWith(SpringRunner.class) -@ContextConfiguration(classes = Spring5JUnit4ConcurrentIntegrationTest.SimpleConfiguration.class) -public class Spring5JUnit4ConcurrentIntegrationTest implements ApplicationContextAware, InitializingBean { - - @Configuration - public static class SimpleConfiguration { - } - - private ApplicationContext applicationContext; - - private boolean beanInitialized = false; - - @Override - public final void afterPropertiesSet() throws Exception { - this.beanInitialized = true; - } - - @Override - public final void setApplicationContext(final ApplicationContext applicationContext) throws BeansException { - this.applicationContext = applicationContext; - } - - @Test - public final void verifyApplicationContextSet() throws InterruptedException { - TimeUnit.SECONDS.sleep(2); - assertNotNull("The application context should have been set due to ApplicationContextAware semantics.", this.applicationContext); - } - - @Test - public final void verifyBeanInitialized() throws InterruptedException { - TimeUnit.SECONDS.sleep(2); - assertTrue("This test bean should have been initialized due to InitializingBean semantics.", this.beanInitialized); - } - -} diff --git a/spring-5-reactive/src/test/java/com/baeldung/functional/BeanRegistrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/functional/BeanRegistrationTest.java deleted file mode 100644 index 0b1542dbbc..0000000000 --- a/spring-5-reactive/src/test/java/com/baeldung/functional/BeanRegistrationTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.baeldung.functional; - -import static org.junit.Assert.*; - -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.test.context.junit4.SpringRunner; -import org.springframework.web.context.support.GenericWebApplicationContext; - -import com.baeldung.Spring5Application; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Spring5Application.class) -public class BeanRegistrationTest { - - @Autowired - private GenericWebApplicationContext context; - - @Test - public void whenRegisterBean_thenOk() { - context.registerBean(MyService.class, () -> new MyService()); - MyService myService = (MyService) context.getBean("com.baeldung.functional.MyService"); - assertTrue(myService.getRandomNumber() < 10); - } - - @Test - public void whenRegisterBeanWithName_thenOk() { - context.registerBean("mySecondService", MyService.class, () -> new MyService()); - MyService mySecondService = (MyService) context.getBean("mySecondService"); - assertTrue(mySecondService.getRandomNumber() < 10); - } - - @Test - public void whenRegisterBeanWithCallback_thenOk() { - context.registerBean("myCallbackService", MyService.class, () -> new MyService(), bd -> bd.setAutowireCandidate(false)); - MyService myCallbackService = (MyService) context.getBean("myCallbackService"); - assertTrue(myCallbackService.getRandomNumber() < 10); - } - -} diff --git a/spring-5-reactive/src/test/java/com/baeldung/functional/ExploreSpring5URLPatternUsingRouterFunctionsTest.java b/spring-5-reactive/src/test/java/com/baeldung/functional/ExploreSpring5URLPatternUsingRouterFunctionsTest.java deleted file mode 100644 index 7a38fa697f..0000000000 --- a/spring-5-reactive/src/test/java/com/baeldung/functional/ExploreSpring5URLPatternUsingRouterFunctionsTest.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.baeldung.functional; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.springframework.boot.web.server.WebServer; -import org.springframework.test.web.reactive.server.WebTestClient; - -public class ExploreSpring5URLPatternUsingRouterFunctionsTest { - - private static WebTestClient client; - private static WebServer server; - - @BeforeClass - public static void setup() throws Exception { - server = new ExploreSpring5URLPatternUsingRouterFunctions().start(); - client = WebTestClient.bindToServer() - .baseUrl("http://localhost:" + server.getPort()) - .build(); - } - - @AfterClass - public static void destroy() { - server.stop(); - } - - @Test - public void givenRouter_whenGetPathWithSingleCharWildcard_thenGotPathPattern() throws Exception { - client.get() - .uri("/paths") - .exchange() - .expectStatus() - .isOk() - .expectBody(String.class) - .isEqualTo("/p?ths"); - } - - @Test - public void givenRouter_whenMultipleURIVariablePattern_thenGotPathVariable() throws Exception { - client.get() - .uri("/test/ab/cd") - .exchange() - .expectStatus() - .isOk() - .expectBody(String.class) - .isEqualTo("/ab/cd"); - } - - @Test - public void givenRouter_whenGetMultipleCharWildcard_thenGotPathPattern() throws Exception { - - client.get() - .uri("/wildcard") - .exchange() - .expectStatus() - .isOk() - .expectBody(String.class) - .isEqualTo("/*card path was accessed"); - } - - @Test - public void givenRouter_whenGetMultiplePathVaribleInSameSegment_thenGotPathVariables() throws Exception { - - client.get() - .uri("/baeldung_tutorial") - .exchange() - .expectStatus() - .isOk() - .expectBody(String.class) - .isEqualTo("baeldung , tutorial"); - } - - @Test - public void givenRouter_whenGetRegexInPathVarible_thenGotPathVariable() throws Exception { - - client.get() - .uri("/abcd") - .exchange() - .expectStatus() - .isOk() - .expectBody(String.class) - .isEqualTo("/{baeldung:[a-z]+} was accessed and baeldung=abcd"); - - client.get() - .uri("/1234") - .exchange() - .expectStatus() - .is4xxClientError(); - } - - @Test - public void givenResources_whenAccess_thenGot() throws Exception { - client.get() - .uri("/files/test/test.txt") - .exchange() - .expectStatus() - .isOk() - .expectBody(String.class) - .isEqualTo("test"); - - client.get() - .uri("/files/hello.txt") - .exchange() - .expectStatus() - .isOk() - .expectBody(String.class) - .isEqualTo("hello"); - } - -} diff --git a/spring-5-reactive/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java deleted file mode 100644 index a7b951b930..0000000000 --- a/spring-5-reactive/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.baeldung.functional; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.springframework.boot.web.server.WebServer; -import org.springframework.core.io.ClassPathResource; -import org.springframework.core.io.Resource; -import org.springframework.http.MediaType; -import org.springframework.test.web.reactive.server.WebTestClient; -import org.springframework.util.LinkedMultiValueMap; -import org.springframework.util.MultiValueMap; -import org.springframework.web.reactive.function.BodyInserters; - -import static org.springframework.web.reactive.function.BodyInserters.fromObject; -import static org.springframework.web.reactive.function.BodyInserters.fromResource; - -public class FunctionalWebApplicationIntegrationTest { - - private static WebTestClient client; - private static WebServer server; - - @BeforeClass - public static void setup() throws Exception { - server = new FunctionalWebApplication().start(); - client = WebTestClient.bindToServer() - .baseUrl("http://localhost:" + server.getPort()) - .build(); - } - - @AfterClass - public static void destroy() { - server.stop(); - } - - @Test - public void givenRouter_whenGetTest_thenGotHelloWorld() throws Exception { - client.get() - .uri("/test") - .exchange() - .expectStatus() - .isOk() - .expectBody(String.class) - .isEqualTo("helloworld"); - } - - @Test - public void givenIndexFilter_whenRequestRoot_thenRewrittenToTest() throws Exception { - client.get() - .uri("/") - .exchange() - .expectStatus() - .isOk() - .expectBody(String.class) - .isEqualTo("helloworld"); - } - - @Test - public void givenLoginForm_whenPostValidToken_thenSuccess() throws Exception { - MultiValueMap formData = new LinkedMultiValueMap<>(1); - formData.add("user", "baeldung"); - formData.add("token", "you_know_what_to_do"); - - client.post() - .uri("/login") - .contentType(MediaType.APPLICATION_FORM_URLENCODED) - .body(BodyInserters.fromFormData(formData)) - .exchange() - .expectStatus() - .isOk() - .expectBody(String.class) - .isEqualTo("welcome back!"); - } - - @Test - public void givenLoginForm_whenRequestWithInvalidToken_thenFail() throws Exception { - MultiValueMap formData = new LinkedMultiValueMap<>(2); - formData.add("user", "baeldung"); - formData.add("token", "try_again"); - - client.post() - .uri("/login") - .contentType(MediaType.APPLICATION_FORM_URLENCODED) - .body(BodyInserters.fromFormData(formData)) - .exchange() - .expectStatus() - .isBadRequest(); - } - - @Test - public void givenUploadForm_whenRequestWithMultipartData_thenSuccess() throws Exception { - Resource resource = new ClassPathResource("/baeldung-weekly.png"); - client.post() - .uri("/upload") - .contentType(MediaType.MULTIPART_FORM_DATA) - .body(fromResource(resource)) - .exchange() - .expectStatus() - .isOk() - .expectBody(String.class) - .isEqualTo(String.valueOf(resource.contentLength())); - } - - @Test - public void givenActors_whenAddActor_thenAdded() throws Exception { - client.get() - .uri("/actor") - .exchange() - .expectStatus() - .isOk() - .expectBodyList(Actor.class) - .hasSize(2); - - client.post() - .uri("/actor") - .body(fromObject(new Actor("Clint", "Eastwood"))) - .exchange() - .expectStatus() - .isOk(); - - client.get() - .uri("/actor") - .exchange() - .expectStatus() - .isOk() - .expectBodyList(Actor.class) - .hasSize(3); - } - - @Test - public void givenResources_whenAccess_thenGot() throws Exception { - client.get() - .uri("/files/hello.txt") - .exchange() - .expectStatus() - .isOk() - .expectBody(String.class) - .isEqualTo("hello"); - } - -} diff --git a/spring-5-reactive/src/test/java/com/baeldung/jsonb/JsonbIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/jsonb/JsonbIntegrationTest.java deleted file mode 100644 index 756b303f3b..0000000000 --- a/spring-5-reactive/src/test/java/com/baeldung/jsonb/JsonbIntegrationTest.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.baeldung.jsonb; - -import static org.junit.Assert.assertTrue; - -import java.math.BigDecimal; -import java.time.LocalDate; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.http.ResponseEntity; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Spring5Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -public class JsonbIntegrationTest { - @Value("${security.user.name}") - private String username; - @Value("${security.user.password}") - private String password; - - @Autowired - private TestRestTemplate template; - - @Test - public void givenId_whenUriIsPerson_thenGetPerson() { - ResponseEntity response = template.withBasicAuth(username, password) - .getForEntity("/person/1", Person.class); - Person person = response.getBody(); - assertTrue(person.equals(new Person(2, "Jhon", "jhon1@test.com", 0, LocalDate.of(2019, 9, 9), BigDecimal.valueOf(1500.0)))); - } - - @Test - public void whenSendPostAPerson_thenGetOkStatus() { - ResponseEntity response = template.withBasicAuth(username, password) - .postForEntity("/person", "{\"birthDate\":\"07-09-2017\",\"email\":\"jhon1@test.com\",\"person-name\":\"Jhon\",\"id\":10}", Boolean.class); - assertTrue(response.getBody()); - } - -} diff --git a/spring-5-reactive/src/test/java/com/baeldung/jupiter/EnabledOnJava8.java b/spring-5-reactive/src/test/java/com/baeldung/jupiter/EnabledOnJava8.java deleted file mode 100644 index c6d3b7ff10..0000000000 --- a/spring-5-reactive/src/test/java/com/baeldung/jupiter/EnabledOnJava8.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung.jupiter; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.springframework.test.context.junit.jupiter.EnabledIf; - -@Target({ ElementType.TYPE, ElementType.METHOD }) -@Retention(RetentionPolicy.RUNTIME) -@EnabledIf( - expression = "#{systemProperties['java.version'].startsWith('1.8')}", - reason = "Enabled on Java 8" -) -public @interface EnabledOnJava8 { - -} diff --git a/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5EnabledAnnotationTest.java b/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5EnabledAnnotationTest.java deleted file mode 100644 index ae058bc8ba..0000000000 --- a/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5EnabledAnnotationTest.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.baeldung.jupiter; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -import org.junit.jupiter.api.Test; -import org.springframework.context.annotation.Configuration; -import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit.jupiter.DisabledIf; -import org.springframework.test.context.junit.jupiter.EnabledIf; -import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; - -@SpringJUnitConfig(Spring5EnabledAnnotationTest.Config.class) -@TestPropertySource(properties = { "tests.enabled=true" }) -public class Spring5EnabledAnnotationTest { - - @Configuration - static class Config { - } - - @EnabledIf("true") - @Test - void givenEnabledIfLiteral_WhenTrue_ThenTestExecuted() { - assertTrue(true); - } - - @EnabledIf(expression = "${tests.enabled}", loadContext = true) - @Test - void givenEnabledIfExpression_WhenTrue_ThenTestExecuted() { - assertTrue(true); - } - - @EnabledIf("#{systemProperties['java.version'].startsWith('1.8')}") - @Test - void givenEnabledIfSpel_WhenTrue_ThenTestExecuted() { - assertTrue(true); - } - - @EnabledOnJava8 - @Test - void givenEnabledOnJava8_WhenTrue_ThenTestExecuted() { - assertTrue(true); - } - - @DisabledIf("#{systemProperties['java.version'].startsWith('1.7')}") - @Test - void givenDisabledIf_WhenTrue_ThenTestNotExecuted() { - assertTrue(true); - } - -} diff --git a/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5JUnit5ComposedAnnotationIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5JUnit5ComposedAnnotationIntegrationTest.java deleted file mode 100644 index 42d27b90f4..0000000000 --- a/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5JUnit5ComposedAnnotationIntegrationTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.baeldung.jupiter; - -import com.baeldung.web.reactive.Task; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; - -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -@SpringJUnit5Config(TestConfig.class) -@DisplayName("@SpringJUnit5Config Tests") -class Spring5JUnit5ComposedAnnotationIntegrationTest { - - @Autowired - private Task task; - - @Autowired - private List tasks; - - @Test - @DisplayName("ApplicationContext injected into method") - void givenAMethodName_whenInjecting_thenApplicationContextInjectedIntoMethod(ApplicationContext applicationContext) { - assertNotNull(applicationContext, "ApplicationContext should have been injected into method by Spring"); - assertEquals(this.task, applicationContext.getBean("taskName", Task.class)); - } - - @Test - @DisplayName("Spring @Beans injected into fields") - void givenAnObject_whenInjecting_thenSpringBeansInjected() { - assertNotNull(task, "Task should have been @Autowired by Spring"); - assertEquals("taskName", task.getName(), "Task's name"); - assertEquals(1, tasks.size(), "Number of Tasks in context"); - } -} diff --git a/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5JUnit5IntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5JUnit5IntegrationTest.java deleted file mode 100644 index 0f00a85832..0000000000 --- a/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5JUnit5IntegrationTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.baeldung.jupiter; - -import com.baeldung.web.reactive.Task; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; -import org.springframework.test.context.ContextConfiguration; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -@ExtendWith(SpringExtension.class) -@ContextConfiguration(classes = TestConfig.class) -class Spring5JUnit5IntegrationTest { - - @Autowired - private Task task; - - @Test - void givenAMethodName_whenInjecting_thenApplicationContextInjectedIntoMetho(ApplicationContext applicationContext) { - assertNotNull(applicationContext, "ApplicationContext should have been injected by Spring"); - assertEquals(this.task, applicationContext.getBean("taskName", Task.class)); - } -} diff --git a/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5JUnit5ParallelIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5JUnit5ParallelIntegrationTest.java deleted file mode 100644 index 55b0fcf267..0000000000 --- a/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5JUnit5ParallelIntegrationTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.baeldung.jupiter; - -import com.baeldung.Example1IntegrationTest; -import com.baeldung.Example2IntegrationTest; -import org.junit.experimental.ParallelComputer; -import org.junit.jupiter.api.Test; -import org.junit.runner.Computer; -import org.junit.runner.JUnitCore; - -class Spring5JUnit5ParallelIntegrationTest { - - @Test - void givenTwoTestClasses_whenJUnitRunParallel_thenTheTestsExecutingParallel() { - final Class[] classes = { Example1IntegrationTest.class, Example2IntegrationTest.class }; - - JUnitCore.runClasses(new ParallelComputer(true, true), classes); - } - - @Test - void givenTwoTestClasses_whenJUnitRunParallel_thenTheTestsExecutingLinear() { - final Class[] classes = { Example1IntegrationTest.class, Example2IntegrationTest.class }; - - JUnitCore.runClasses(new Computer(), classes); - } -} \ No newline at end of file diff --git a/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5Java8NewFeaturesIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5Java8NewFeaturesIntegrationTest.java deleted file mode 100644 index f58bf9f3cd..0000000000 --- a/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5Java8NewFeaturesIntegrationTest.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.baeldung.jupiter; - -import org.junit.jupiter.api.Test; - -import java.util.function.Supplier; -import java.util.regex.Pattern; -import java.util.stream.Collectors; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -class Spring5Java8NewFeaturesIntegrationTest { - - @FunctionalInterface - public interface FunctionalInterfaceExample { - Result reverseString(Input input); - } - - public class StringUtils { - FunctionalInterfaceExample functionLambdaString = s -> Pattern.compile(" +") - .splitAsStream(s) - .map(word -> new StringBuilder(word).reverse()) - .collect(Collectors.joining(" ")); - } - - @Test - void givenStringUtil_whenSupplierCall_thenFunctionalInterfaceReverseString() throws Exception { - Supplier stringUtilsSupplier = StringUtils::new; - - assertEquals(stringUtilsSupplier.get().functionLambdaString.reverseString("hello"), "olleh"); - } -} diff --git a/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5ReactiveServerClientIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5ReactiveServerClientIntegrationTest.java deleted file mode 100644 index bbd852d625..0000000000 --- a/spring-5-reactive/src/test/java/com/baeldung/jupiter/Spring5ReactiveServerClientIntegrationTest.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.baeldung.jupiter; - -import com.baeldung.web.reactive.Task; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.springframework.http.server.reactive.HttpHandler; -import org.springframework.http.server.reactive.ReactorHttpHandlerAdapter; -import org.springframework.web.reactive.function.server.RouterFunction; -import org.springframework.web.reactive.function.server.RouterFunctions; -import org.springframework.web.reactive.function.server.ServerResponse; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import reactor.ipc.netty.NettyContext; -import reactor.ipc.netty.http.server.HttpServer; - -import java.time.Duration; - -import static org.springframework.web.reactive.function.server.RequestPredicates.GET; -import static org.springframework.web.reactive.function.server.RequestPredicates.POST; - -public class Spring5ReactiveServerClientIntegrationTest { - - private static NettyContext nettyContext; - - @BeforeAll - public static void setUp() throws Exception { - HttpServer server = HttpServer.create("localhost", 8080); - RouterFunction route = RouterFunctions.route(POST("/task/process"), request -> ServerResponse.ok() - .body(request.bodyToFlux(Task.class) - .map(ll -> new Task("TaskName", 1)), Task.class)) - .and(RouterFunctions.route(GET("/task"), request -> ServerResponse.ok() - .body(Mono.just("server is alive"), String.class))); - HttpHandler httpHandler = RouterFunctions.toHttpHandler(route); - ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(httpHandler); - nettyContext = server.newHandler(adapter) - .block(); - } - - @AfterAll - public static void shutDown() { - nettyContext.dispose(); - } - - // @Test - // public void givenCheckTask_whenServerHandle_thenServerResponseALiveString() throws Exception { - // WebClient client = WebClient.create("http://localhost:8080"); - // Mono result = client - // .get() - // .uri("/task") - // .exchange() - // .then(response -> response.bodyToMono(String.class)); - // - // assertThat(result.block()).isInstanceOf(String.class); - // } - - // @Test - // public void givenThreeTasks_whenServerHandleTheTasks_thenServerResponseATask() throws Exception { - // URI uri = URI.create("http://localhost:8080/task/process"); - // ExchangeFunction exchange = ExchangeFunctions.create(new ReactorClientHttpConnector()); - // ClientRequest request = ClientRequest - // .method(HttpMethod.POST, uri) - // .body(BodyInserters.fromPublisher(getLatLngs(), Task.class)) - // .build(); - // - // Flux taskResponse = exchange - // .exchange(request) - // .flatMap(response -> response.bodyToFlux(Task.class)); - // - // assertThat(taskResponse.blockFirst()).isInstanceOf(Task.class); - // } - - // @Test - // public void givenCheckTask_whenServerHandle_thenOragicServerResponseALiveString() throws Exception { - // URI uri = URI.create("http://localhost:8080/task"); - // ExchangeFunction exchange = ExchangeFunctions.create(new ReactorClientHttpConnector()); - // ClientRequest request = ClientRequest - // .method(HttpMethod.GET, uri) - // .body(BodyInserters.fromPublisher(getLatLngs(), Task.class)) - // .build(); - // - // Flux taskResponse = exchange - // .exchange(request) - // .flatMap(response -> response.bodyToFlux(String.class)); - // - // assertThat(taskResponse.blockFirst()).isInstanceOf(String.class); - // } - - private static Flux getLatLngs() { - return Flux.range(0, 3) - .zipWith(Flux.interval(Duration.ofSeconds(1))) - .map(x -> new Task("taskname", 1)) - .doOnNext(ll -> System.out.println("Produced: {}" + ll)); - } -} diff --git a/spring-5-reactive/src/test/java/com/baeldung/jupiter/SpringJUnitConfigTest.java b/spring-5-reactive/src/test/java/com/baeldung/jupiter/SpringJUnitConfigTest.java deleted file mode 100644 index 6b0a6f9808..0000000000 --- a/spring-5-reactive/src/test/java/com/baeldung/jupiter/SpringJUnitConfigTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.baeldung.jupiter; - -import static org.junit.Assert.assertNotNull; - -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.Configuration; -import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; - -/** - * @SpringJUnitConfig(SpringJUnitConfigTest.Config.class) is equivalent to: - * - * @ExtendWith(SpringExtension.class) - * @ContextConfiguration(classes = SpringJUnitConfigTest.Config.class ) - * - */ -@SpringJUnitConfig(SpringJUnitConfigTest.Config.class) -public class SpringJUnitConfigTest { - - @Configuration - static class Config { - } - - @Autowired - private ApplicationContext applicationContext; - - @Test - void givenAppContext_WhenInjected_ThenItShouldNotBeNull() { - assertNotNull(applicationContext); - } - -} diff --git a/spring-5-reactive/src/test/java/com/baeldung/jupiter/SpringJUnitWebConfigTest.java b/spring-5-reactive/src/test/java/com/baeldung/jupiter/SpringJUnitWebConfigTest.java deleted file mode 100644 index c679dce77f..0000000000 --- a/spring-5-reactive/src/test/java/com/baeldung/jupiter/SpringJUnitWebConfigTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.baeldung.jupiter; - -import static org.junit.Assert.assertNotNull; - -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Configuration; -import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; -import org.springframework.web.context.WebApplicationContext; - -/** - * @SpringJUnitWebConfig(SpringJUnitWebConfigTest.Config.class) is equivalent to: - * - * @ExtendWith(SpringExtension.class) - * @WebAppConfiguration - * @ContextConfiguration(classes = SpringJUnitWebConfigTest.Config.class ) - * - */ -@SpringJUnitWebConfig(SpringJUnitWebConfigTest.Config.class) -public class SpringJUnitWebConfigTest { - - @Configuration - static class Config { - } - - @Autowired - private WebApplicationContext webAppContext; - - @Test - void givenWebAppContext_WhenInjected_ThenItShouldNotBeNull() { - assertNotNull(webAppContext); - } - -} diff --git a/spring-5-reactive/src/test/java/com/baeldung/security/SecurityTest.java b/spring-5-reactive/src/test/java/com/baeldung/security/SecurityTest.java deleted file mode 100644 index a1c940a17a..0000000000 --- a/spring-5-reactive/src/test/java/com/baeldung/security/SecurityTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.baeldung.security; - -import com.baeldung.SpringSecurity5Application; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; -import org.springframework.security.test.context.support.WithMockUser; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.reactive.server.WebTestClient; - -@RunWith(SpringRunner.class) -@ContextConfiguration(classes = SpringSecurity5Application.class) -public class SecurityTest { - - @Autowired - ApplicationContext context; - - private WebTestClient rest; - - @Before - public void setup() { - this.rest = WebTestClient - .bindToApplicationContext(this.context) - .configureClient() - .build(); - } - - @Test - public void whenNoCredentials_thenRedirectToLogin() { - this.rest.get() - .uri("/") - .exchange() - .expectStatus().is3xxRedirection(); - } - - @Test - @WithMockUser - public void whenHasCredentials_thenSeesGreeting() { - this.rest.get() - .uri("/") - .exchange() - .expectStatus().isOk() - .expectBody(String.class).isEqualTo("Hello, user"); - } -} diff --git a/spring-5-reactive/src/test/java/com/baeldung/web/PathPatternsUsingHandlerMethodIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/web/PathPatternsUsingHandlerMethodIntegrationTest.java deleted file mode 100644 index c2ed8ff071..0000000000 --- a/spring-5-reactive/src/test/java/com/baeldung/web/PathPatternsUsingHandlerMethodIntegrationTest.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.baeldung.web; - -import com.baeldung.Spring5Application; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.reactive.server.WebTestClient; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Spring5Application.class) -public class PathPatternsUsingHandlerMethodIntegrationTest { - - private static WebTestClient client; - - @BeforeClass - public static void setUp() { - client = WebTestClient.bindToController(new PathPatternController()) - .build(); - } - - @Test - public void givenHandlerMethod_whenMultipleURIVariablePattern_then200() { - - client.get() - .uri("/spring5/ab/cd") - .exchange() - .expectStatus() - .is2xxSuccessful() - .expectBody() - .equals("/ab/cd"); - } - - @Test - public void givenHandlerMethod_whenURLWithWildcardTakingZeroOrMoreChar_then200() { - - client.get() - .uri("/spring5/userid") - .exchange() - .expectStatus() - .is2xxSuccessful() - .expectBody() - .equals("/spring5/*id"); - } - - @Test - public void givenHandlerMethod_whenURLWithWildcardTakingExactlyOneChar_then200() { - - client.get() - .uri("/string5") - .exchange() - .expectStatus() - .is2xxSuccessful() - .expectBody() - .equals("/s?ring5"); - } - - @Test - public void givenHandlerMethod_whenURLWithWildcardTakingZeroOrMorePathSegments_then200() { - - client.get() - .uri("/resources/baeldung") - .exchange() - .expectStatus() - .is2xxSuccessful() - .expectBody() - .equals("/resources/**"); - } - - @Test - public void givenHandlerMethod_whenURLWithRegexInPathVariable_thenExpectedOutput() { - - client.get() - .uri("/abc") - .exchange() - .expectStatus() - .is2xxSuccessful() - .expectBody() - .equals("abc"); - - client.get() - .uri("/123") - .exchange() - .expectStatus() - .is4xxClientError(); - } - - @Test - public void givenHandlerMethod_whenURLWithMultiplePathVariablesInSameSegment_then200() { - - client.get() - .uri("/baeldung_tutorial") - .exchange() - .expectStatus() - .is2xxSuccessful() - .expectBody() - .equals("Two variables are var1=baeldung and var2=tutorial"); - } - -} diff --git a/spring-5-reactive/src/test/java/com/baeldung/web/client/WebTestClientTest.java b/spring-5-reactive/src/test/java/com/baeldung/web/client/WebTestClientTest.java deleted file mode 100644 index 43114b5b50..0000000000 --- a/spring-5-reactive/src/test/java/com/baeldung/web/client/WebTestClientTest.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.baeldung.web.client; - -import com.baeldung.Spring5Application; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.web.server.LocalServerPort; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.reactive.server.WebTestClient; -import org.springframework.web.reactive.function.server.RequestPredicates; -import org.springframework.web.reactive.function.server.RouterFunction; -import org.springframework.web.reactive.function.server.RouterFunctions; -import org.springframework.web.reactive.function.server.ServerResponse; -import org.springframework.web.server.WebHandler; -import reactor.core.publisher.Mono; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Spring5Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -public class WebTestClientTest { - - @LocalServerPort - private int port; - - private final RouterFunction ROUTER_FUNCTION = RouterFunctions.route(RequestPredicates.GET("/resource"), request -> ServerResponse.ok() - .build()); - private final WebHandler WEB_HANDLER = exchange -> Mono.empty(); - - @Test - public void testWebTestClientWithServerWebHandler() { - WebTestClient.bindToWebHandler(WEB_HANDLER) - .build(); - } - - @Test - public void testWebTestClientWithRouterFunction() { - WebTestClient.bindToRouterFunction(ROUTER_FUNCTION) - .build() - .get() - .uri("/resource") - .exchange() - .expectStatus() - .isOk() - .expectBody() - .isEmpty(); - } - - @Test - public void testWebTestClientWithServerURL() { - WebTestClient.bindToServer() - .baseUrl("http://localhost:" + port) - .build() - .get() - .uri("/resource") - .exchange() - .expectStatus() - .is3xxRedirection() - .expectBody(); - } - -} diff --git a/spring-5-reactive/src/test/resources/baeldung-weekly.png b/spring-5-reactive/src/test/resources/baeldung-weekly.png deleted file mode 100644 index 5a27d61dae718016a947083e01411ed1bc14f90e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 22275 zcmV*KKxMy)P)4Tx062|}Rb6NtRTMtEb7vzY&QokOg>Hg1+lHrgWS zWcKdPn90sKGrRqvPeo9CG3uKX#J{(IASm?@+di}}l?o-=)F3E6wD^Ni=!>T7nL9I? zX}YoAW$t|Qo$sD|?zw001?ah|SeB6#0T!CBEf+H4bBB+JJu8rehoBb*p;u8ID_yBf z0ya+zcePvJL&AGs+11_tpRKn>9TgyPA7ZoSs0)aX0r00)%XR^J`jH<$>RKN5V(7Oq zK*TS4xZz{h!*f1C3ECFkK$#7nA@pGN!$;%jYvwjAKwmYb0gKL(K8 z-kPtb5${A?tlI~wzMrJ6wTdBr=Y%%%EaEMQ&o}4FQ^DA)s*}Z>!FI&AHCpoWI|RUq zx?7s@$8!5^Q=anY%X@i5{QA6kNcMelpE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I*9#RV?84c3e)5$fH&5^IUqP@=<(yntFx>eITqem zXIu*-SXcE}R>JtBsi}!>z4cbbju5C5%jrT6h=(7t8kRPmWiO^0k%OqYtzF+NZ`+k4 zUm|e4FMHgCxU;tnCsd2zxLo*kw+xoogMIL@Zmw=3l?Ctg~|Uq)8Z1 zXIzueW}chC>jGR{TtxbnlF|}!4BK2+S63m47AI`@4>sO#i-TG#itUVHUI;^e6>N(E zb;h+V{yVjfY;Z^-_3}$E3x8r5ZeW(PHXP49E^N1F&Ya1C_>$mz?j@I8Vv$)Go=qoDo)oh@3@5hl*e;gF z*azW4)uV!aVL+X6?dy4T=?(Z`NT4Cfedd{G1mV8(_B#|66(u}mV07P|J+yYE;8}BX zb4Av}fhhy&`|rLN(L&&SzV!D?sp4#f@Kcr?(Y5bak8O_ub;h;*Gcec#@WGEf`iSt3 zL6k!1PLCfyPW$)o7s4zoumAFwzlf~pk38~-kWwQ>DFDPhW$F~d(iakJM2A4|c-;HZ zM;{S#6aOjYPc&xC7)=UE+!qiSfQ<@vi~*H!?fBuyyC&tffphtD|9MV0n6u+zOQw2)DMjmWqms$d5z20FZ Date: Wed, 13 Dec 2017 14:32:44 +0100 Subject: [PATCH 42/50] Add main entry point (#3233) --- spring-security-acl/pom.xml | 1 - .../src/main/java/org/baeldung/acl/Application.java | 11 +++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 spring-security-acl/src/main/java/org/baeldung/acl/Application.java diff --git a/spring-security-acl/pom.xml b/spring-security-acl/pom.xml index 67197bc2f8..a19a54dd88 100644 --- a/spring-security-acl/pom.xml +++ b/spring-security-acl/pom.xml @@ -3,7 +3,6 @@ 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-security-acl 0.0.1-SNAPSHOT war diff --git a/spring-security-acl/src/main/java/org/baeldung/acl/Application.java b/spring-security-acl/src/main/java/org/baeldung/acl/Application.java new file mode 100644 index 0000000000..665ca64076 --- /dev/null +++ b/spring-security-acl/src/main/java/org/baeldung/acl/Application.java @@ -0,0 +1,11 @@ +package org.baeldung.acl; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } +} From c68acf03d9dd803c4f027fffa71574f7cb6d3906 Mon Sep 17 00:00:00 2001 From: Eugen Paraschiv Date: Wed, 13 Dec 2017 15:56:37 +0200 Subject: [PATCH 43/50] flux generating data on interval --- .../controller/FooReactiveController.java | 11 ++++--- .../com/baeldung/reactive/FluxUnitTest.java | 29 +++++++++++++++++++ 2 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 spring-5-reactive/src/test/java/com/baeldung/reactive/FluxUnitTest.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/controller/FooReactiveController.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/controller/FooReactiveController.java index d82692619d..1115036ad3 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/controller/FooReactiveController.java +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/controller/FooReactiveController.java @@ -8,25 +8,24 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RestController; -import reactor.core.publisher.ConnectableFlux; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -@RestController("/foos") +@RestController public class FooReactiveController { - @GetMapping("/{id}") + @GetMapping("/foos/{id}") public Mono getFoo(@PathVariable("id") long id) { return Mono.just(new Foo(id, randomAlphabetic(6))); } - @GetMapping("/") + @GetMapping("/foos") public Flux getAllFoos() { - final ConnectableFlux flux = Flux. create(fluxSink -> { + final Flux flux = Flux. create(fluxSink -> { while (true) { fluxSink.next(new Foo(System.currentTimeMillis(), randomAlphabetic(6))); } - }).sample(Duration.ofSeconds(1)).publish(); + }).sample(Duration.ofSeconds(1)).log(); return flux; } diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/FluxUnitTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/FluxUnitTest.java new file mode 100644 index 0000000000..5499e72877 --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/FluxUnitTest.java @@ -0,0 +1,29 @@ +package com.baeldung.reactive; + +import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; +import static org.junit.Assert.assertNotNull; + +import java.time.Duration; + +import org.junit.jupiter.api.Test; + +import com.baeldung.reactive.controller.Foo; + +import reactor.core.publisher.Flux; + +public class FluxUnitTest { + + @Test + public void whenFluxIsConstructed_thenCorrect() { + final Flux flux = Flux. create(fluxSink -> { + while (true) { + fluxSink.next(new Foo(System.currentTimeMillis(), randomAlphabetic(6))); + } + }).sample(Duration.ofSeconds(1)).log(); + + flux.subscribe(); + + assertNotNull(flux); + } + +} From 471ed5d99297d2acd627bf80f55948749309d29c Mon Sep 17 00:00:00 2001 From: Eugen Paraschiv Date: Wed, 13 Dec 2017 18:59:17 +0200 Subject: [PATCH 44/50] new client project, general cleanup, testing work --- spring-5-reactive-client/.gitignore | 12 ++ spring-5-reactive-client/README.md | 15 ++ spring-5-reactive-client/pom.xml | 201 ++++++++++++++++++ .../com/baeldung/reactive/model}/Foo.java | 2 +- .../src/main/resources/application.properties | 3 + .../src/main/resources/logback.xml | 16 ++ .../src/main/webapp/WEB-INF/web.xml | 21 ++ .../reactive/ReactiveIntegrationTest.java | 42 ++++ .../Spring5ReactiveTestApplication.java | 35 +++ .../src/test/resources/logback-test.xml | 16 ++ .../controller/FooReactiveController.java | 17 +- .../java/com/baeldung/reactive/model/Foo.java | 13 ++ .../src/main/resources/files/hello.txt | 1 - .../src/main/resources/files/test/test.txt | 1 - .../com/baeldung/reactive/FluxUnitTest.java | 5 +- 15 files changed, 393 insertions(+), 7 deletions(-) create mode 100644 spring-5-reactive-client/.gitignore create mode 100644 spring-5-reactive-client/README.md create mode 100644 spring-5-reactive-client/pom.xml rename {spring-5-reactive/src/main/java/com/baeldung/reactive/controller => spring-5-reactive-client/src/main/java/com/baeldung/reactive/model}/Foo.java (78%) create mode 100644 spring-5-reactive-client/src/main/resources/application.properties create mode 100644 spring-5-reactive-client/src/main/resources/logback.xml create mode 100644 spring-5-reactive-client/src/main/webapp/WEB-INF/web.xml create mode 100644 spring-5-reactive-client/src/test/java/com/baeldung/reactive/ReactiveIntegrationTest.java create mode 100644 spring-5-reactive-client/src/test/java/com/baeldung/reactive/Spring5ReactiveTestApplication.java create mode 100644 spring-5-reactive-client/src/test/resources/logback-test.xml create mode 100644 spring-5-reactive/src/main/java/com/baeldung/reactive/model/Foo.java delete mode 100644 spring-5-reactive/src/main/resources/files/hello.txt delete mode 100644 spring-5-reactive/src/main/resources/files/test/test.txt diff --git a/spring-5-reactive-client/.gitignore b/spring-5-reactive-client/.gitignore new file mode 100644 index 0000000000..dec013dfa4 --- /dev/null +++ b/spring-5-reactive-client/.gitignore @@ -0,0 +1,12 @@ +#folders# +.idea +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* + +# Packaged files # +*.jar +*.war +*.ear \ No newline at end of file diff --git a/spring-5-reactive-client/README.md b/spring-5-reactive-client/README.md new file mode 100644 index 0000000000..400e343263 --- /dev/null +++ b/spring-5-reactive-client/README.md @@ -0,0 +1,15 @@ +## Spring REST Example Project + +### The Course +The "REST With Spring" Classes: http://bit.ly/restwithspring + +### Relevant Articles + +- [Concurrent Test Execution in Spring 5](http://www.baeldung.com/spring-5-concurrent-tests) +- [Introduction to the Functional Web Framework in Spring 5](http://www.baeldung.com/spring-5-functional-web) +- [Exploring the Spring 5 MVC URL Matching Improvements](http://www.baeldung.com/spring-5-mvc-url-matching) +- [Spring 5 WebClient](http://www.baeldung.com/spring-5-webclient) +- [Spring 5 Functional Bean Registration](http://www.baeldung.com/spring-5-functional-beans) +- [The SpringJUnitConfig and SpringJUnitWebConfig Annotations in Spring 5](http://www.baeldung.com/spring-5-junit-config) +- [Spring Security 5 for Reactive Applications](http://www.baeldung.com/spring-security-5-reactive) +- [Spring 5 Testing with @EnabledIf Annotation](https://github.com/eugenp/tutorials/tree/master/spring-5) diff --git a/spring-5-reactive-client/pom.xml b/spring-5-reactive-client/pom.xml new file mode 100644 index 0000000000..8aa579b724 --- /dev/null +++ b/spring-5-reactive-client/pom.xml @@ -0,0 +1,201 @@ + + + 4.0.0 + + com.baeldung + spring-5-reactive-client + 0.0.1-SNAPSHOT + jar + + spring-5 + spring 5 sample project about new features + + + org.springframework.boot + spring-boot-starter-parent + 2.0.0.M7 + + + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-validation + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-webflux + + + org.projectreactor + reactor-spring + ${reactor-spring.version} + + + javax.json.bind + javax.json.bind-api + + + + + + + + + + + + + + + + + org.apache.geronimo.specs + geronimo-json_1.1_spec + ${geronimo-json_1.1_spec.version} + + + org.apache.johnzon + johnzon-jsonb + + + + org.apache.commons + commons-lang3 + + + + + + org.springframework.boot + spring-boot-devtools + runtime + + + com.h2database + h2 + runtime + + + + org.springframework + spring-test + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.apache.commons + commons-collections4 + 4.1 + test + + + + org.junit.jupiter + junit-jupiter-api + + + org.junit.jupiter + junit-jupiter-engine + test + + + org.junit.platform + junit-platform-surefire-provider + ${junit.platform.version} + test + + + org.junit.platform + junit-platform-runner + ${junit.platform.version} + test + + + + org.projectlombok + lombok + + + org.apache.commons + commons-lang3 + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + com.baeldung.Spring5Application + JAR + + + + + org.apache.maven.plugins + maven-surefire-plugin + + 3 + true + methods + true + + **/*IntegrationTest.java + **/*LiveTest.java + + + + + + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + + + UTF-8 + UTF-8 + 1.8 + 1.0.0 + 5.0.0 + 2.20 + 5.0.1.RELEASE + 1.0.1.RELEASE + 1.1.3 + 1.0 + 1.0 + + + diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/controller/Foo.java b/spring-5-reactive-client/src/main/java/com/baeldung/reactive/model/Foo.java similarity index 78% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/controller/Foo.java rename to spring-5-reactive-client/src/main/java/com/baeldung/reactive/model/Foo.java index 480782a551..2c49e6146a 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/controller/Foo.java +++ b/spring-5-reactive-client/src/main/java/com/baeldung/reactive/model/Foo.java @@ -1,4 +1,4 @@ -package com.baeldung.reactive.controller; +package com.baeldung.reactive.model; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/spring-5-reactive-client/src/main/resources/application.properties b/spring-5-reactive-client/src/main/resources/application.properties new file mode 100644 index 0000000000..2d93456aeb --- /dev/null +++ b/spring-5-reactive-client/src/main/resources/application.properties @@ -0,0 +1,3 @@ +logging.level.root=INFO + +server.port=8081 \ No newline at end of file diff --git a/spring-5-reactive-client/src/main/resources/logback.xml b/spring-5-reactive-client/src/main/resources/logback.xml new file mode 100644 index 0000000000..8bbe8c1d67 --- /dev/null +++ b/spring-5-reactive-client/src/main/resources/logback.xml @@ -0,0 +1,16 @@ + + + + + # Pattern of log message for console appender + %d{yyyy-MM-dd HH:mm:ss} %-5p %m%n + + + + + + + + + + \ No newline at end of file diff --git a/spring-5-reactive-client/src/main/webapp/WEB-INF/web.xml b/spring-5-reactive-client/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..bfcf43dad2 --- /dev/null +++ b/spring-5-reactive-client/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,21 @@ + + + + Spring Functional Application + + + functional + com.baeldung.functional.RootServlet + 1 + true + + + functional + / + + + + \ No newline at end of file diff --git a/spring-5-reactive-client/src/test/java/com/baeldung/reactive/ReactiveIntegrationTest.java b/spring-5-reactive-client/src/test/java/com/baeldung/reactive/ReactiveIntegrationTest.java new file mode 100644 index 0000000000..394ff42e5f --- /dev/null +++ b/spring-5-reactive-client/src/test/java/com/baeldung/reactive/ReactiveIntegrationTest.java @@ -0,0 +1,42 @@ +package com.baeldung.reactive; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.web.reactive.function.client.ClientResponse; +import org.springframework.web.reactive.function.client.WebClient; + +import com.baeldung.reactive.model.Foo; + +import reactor.core.publisher.Mono; + +@SpringBootTest +public class ReactiveIntegrationTest { + + private WebClient client; + + @BeforeEach + public void before() { + client = WebClient.create("http://localhost:8080"); + } + + // + + @Test + public void whenMonoReactiveEndpointIsConsumed_thenCorrectOutput() { + final Mono fooMono = client.get().uri("/foos/123").exchange().log(); + + System.out.println(fooMono.subscribe()); + } + + @Test + public void whenFluxReactiveEndpointIsConsumed_thenCorrectOutput() throws InterruptedException { + client.get().uri("/foos") + .retrieve() + .bodyToFlux(Foo.class).log() + .subscribe(System.out::println); + + System.out.println(); + } + +} diff --git a/spring-5-reactive-client/src/test/java/com/baeldung/reactive/Spring5ReactiveTestApplication.java b/spring-5-reactive-client/src/test/java/com/baeldung/reactive/Spring5ReactiveTestApplication.java new file mode 100644 index 0000000000..c884ace323 --- /dev/null +++ b/spring-5-reactive-client/src/test/java/com/baeldung/reactive/Spring5ReactiveTestApplication.java @@ -0,0 +1,35 @@ +package com.baeldung.reactive; + +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.web.reactive.function.client.WebClient; + +import com.baeldung.reactive.model.Foo; + +@SpringBootApplication +public class Spring5ReactiveTestApplication { + + @Bean + public WebClient client() { + return WebClient.create("http://localhost:8080"); + } + + @Bean + CommandLineRunner cmd(WebClient client) { + return args -> { + client.get().uri("/foos2") + .retrieve() + .bodyToFlux(Foo.class).log() + .subscribe(System.out::println); + }; + } + + // + + public static void main(String[] args) { + SpringApplication.run(Spring5ReactiveTestApplication.class, args); + } + +} diff --git a/spring-5-reactive-client/src/test/resources/logback-test.xml b/spring-5-reactive-client/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..8bbe8c1d67 --- /dev/null +++ b/spring-5-reactive-client/src/test/resources/logback-test.xml @@ -0,0 +1,16 @@ + + + + + # Pattern of log message for console appender + %d{yyyy-MM-dd HH:mm:ss} %-5p %m%n + + + + + + + + + + \ No newline at end of file diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/controller/FooReactiveController.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/controller/FooReactiveController.java index 1115036ad3..933d469f65 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/controller/FooReactiveController.java +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/controller/FooReactiveController.java @@ -3,13 +3,19 @@ package com.baeldung.reactive.controller; import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; import java.time.Duration; +import java.util.Random; +import java.util.stream.Stream; +import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RestController; +import com.baeldung.reactive.model.Foo; + import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import reactor.util.function.Tuple2; @RestController public class FooReactiveController { @@ -19,11 +25,18 @@ public class FooReactiveController { return Mono.just(new Foo(id, randomAlphabetic(6))); } - @GetMapping("/foos") + @GetMapping(produces = MediaType.TEXT_EVENT_STREAM_VALUE, value = "/foos") + public Flux getAllFoos2() { + final Flux foosFlux = Flux.fromStream(Stream.generate(() -> new Foo(new Random().nextLong(), randomAlphabetic(6)))); + final Flux emmitFlux = Flux.interval(Duration.ofSeconds(1)); + return Flux.zip(foosFlux, emmitFlux).map(Tuple2::getT1); + } + + @GetMapping(produces = MediaType.TEXT_EVENT_STREAM_VALUE, value = "/foos2") public Flux getAllFoos() { final Flux flux = Flux. create(fluxSink -> { while (true) { - fluxSink.next(new Foo(System.currentTimeMillis(), randomAlphabetic(6))); + fluxSink.next(new Foo(new Random().nextLong(), randomAlphabetic(6))); } }).sample(Duration.ofSeconds(1)).log(); diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/model/Foo.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/model/Foo.java new file mode 100644 index 0000000000..2c49e6146a --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/model/Foo.java @@ -0,0 +1,13 @@ +package com.baeldung.reactive.model; + +import lombok.AllArgsConstructor; +import lombok.Data; + +@AllArgsConstructor +@Data +public class Foo { + + private long id; + private String name; + +} diff --git a/spring-5-reactive/src/main/resources/files/hello.txt b/spring-5-reactive/src/main/resources/files/hello.txt deleted file mode 100644 index b6fc4c620b..0000000000 --- a/spring-5-reactive/src/main/resources/files/hello.txt +++ /dev/null @@ -1 +0,0 @@ -hello \ No newline at end of file diff --git a/spring-5-reactive/src/main/resources/files/test/test.txt b/spring-5-reactive/src/main/resources/files/test/test.txt deleted file mode 100644 index 30d74d2584..0000000000 --- a/spring-5-reactive/src/main/resources/files/test/test.txt +++ /dev/null @@ -1 +0,0 @@ -test \ No newline at end of file diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/FluxUnitTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/FluxUnitTest.java index 5499e72877..bad5fc5f22 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/reactive/FluxUnitTest.java +++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/FluxUnitTest.java @@ -4,10 +4,11 @@ import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; import static org.junit.Assert.assertNotNull; import java.time.Duration; +import java.util.Random; import org.junit.jupiter.api.Test; -import com.baeldung.reactive.controller.Foo; +import com.baeldung.reactive.model.Foo; import reactor.core.publisher.Flux; @@ -17,7 +18,7 @@ public class FluxUnitTest { public void whenFluxIsConstructed_thenCorrect() { final Flux flux = Flux. create(fluxSink -> { while (true) { - fluxSink.next(new Foo(System.currentTimeMillis(), randomAlphabetic(6))); + fluxSink.next(new Foo(new Random().nextLong(), randomAlphabetic(6))); } }).sample(Duration.ofSeconds(1)).log(); From 18c8747c98d0c89c64e1a7db8df80413737a4ef7 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Thu, 14 Dec 2017 06:26:03 +0200 Subject: [PATCH 45/50] BAEL-1248 google sheets api example (#3189) * google sheets api example * add dependencies * rename test * update test * add comment * trigger build * trigger build * Formatting to standards * Getting rid of stray tabs * Applying formatting rules to source files as well * trigger build --- libraries/pom.xml | 25 +++- .../google/sheets/GoogleAuthorizeUtil.java | 42 ++++++ .../google/sheets/SheetsServiceUtil.java | 23 +++ .../google-sheets-client-secret.json | 1 + .../sheets/GoogleSheetsIntegrationTest.java | 140 ++++++++++++++++++ 5 files changed, 228 insertions(+), 3 deletions(-) create mode 100644 libraries/src/main/java/com/baeldung/google/sheets/GoogleAuthorizeUtil.java create mode 100644 libraries/src/main/java/com/baeldung/google/sheets/SheetsServiceUtil.java create mode 100644 libraries/src/main/resources/google-sheets-client-secret.json create mode 100644 libraries/src/test/java/com/baeldung/google/sheets/GoogleSheetsIntegrationTest.java diff --git a/libraries/pom.xml b/libraries/pom.xml index eaa2d9d38f..3627e74472 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -633,9 +633,26 @@ ${googleclient.version} - com.google.http-client - google-http-client-gson - ${googleclient.version} + com.google.http-client + google-http-client-gson + ${googleclient.version} + + + + + com.google.api-client + google-api-client + ${google-api.version} + + + com.google.oauth-client + google-oauth-client-jetty + ${google-api.version} + + + com.google.apis + google-api-services-sheets + ${google-sheets.version} @@ -710,5 +727,7 @@ 1.0.0 3.8.4 2.5.5 + 1.23.0 + v4-rev493-1.21.0 \ No newline at end of file diff --git a/libraries/src/main/java/com/baeldung/google/sheets/GoogleAuthorizeUtil.java b/libraries/src/main/java/com/baeldung/google/sheets/GoogleAuthorizeUtil.java new file mode 100644 index 0000000000..650a1d084c --- /dev/null +++ b/libraries/src/main/java/com/baeldung/google/sheets/GoogleAuthorizeUtil.java @@ -0,0 +1,42 @@ +package com.baeldung.google.sheets; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.security.GeneralSecurityException; +import java.util.Arrays; +import java.util.List; + +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp; +import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver; +import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow; +import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets; +import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport; +import com.google.api.client.json.jackson2.JacksonFactory; +import com.google.api.client.util.store.MemoryDataStoreFactory; +import com.google.api.services.sheets.v4.SheetsScopes; + +public class GoogleAuthorizeUtil { + public static Credential authorize() throws IOException, GeneralSecurityException { + InputStream in = GoogleAuthorizeUtil.class.getResourceAsStream("/google-sheets-client-secret.json"); + GoogleClientSecrets clientSecrets = GoogleClientSecrets + .load(JacksonFactory.getDefaultInstance(), new InputStreamReader(in)); + + List scopes = Arrays.asList(SheetsScopes.SPREADSHEETS); + + GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow + .Builder(GoogleNetHttpTransport.newTrustedTransport(), + JacksonFactory.getDefaultInstance(), + clientSecrets, + scopes) + .setDataStoreFactory(new MemoryDataStoreFactory()) + .setAccessType("offline") + .build(); + Credential credential = new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()) + .authorize("user"); + + return credential; + } + +} diff --git a/libraries/src/main/java/com/baeldung/google/sheets/SheetsServiceUtil.java b/libraries/src/main/java/com/baeldung/google/sheets/SheetsServiceUtil.java new file mode 100644 index 0000000000..bbce96f389 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/google/sheets/SheetsServiceUtil.java @@ -0,0 +1,23 @@ +package com.baeldung.google.sheets; + +import java.io.IOException; +import java.security.GeneralSecurityException; + +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport; +import com.google.api.client.json.jackson2.JacksonFactory; +import com.google.api.services.sheets.v4.Sheets; + +public class SheetsServiceUtil { + + private static final String APPLICATION_NAME = "Google Sheets Example"; + + public static Sheets getSheetsService() throws IOException, GeneralSecurityException { + Credential credential = GoogleAuthorizeUtil.authorize(); + return new Sheets.Builder(GoogleNetHttpTransport.newTrustedTransport(), + JacksonFactory.getDefaultInstance(), credential) + .setApplicationName(APPLICATION_NAME) + .build(); + } + +} diff --git a/libraries/src/main/resources/google-sheets-client-secret.json b/libraries/src/main/resources/google-sheets-client-secret.json new file mode 100644 index 0000000000..c92ccd6b9b --- /dev/null +++ b/libraries/src/main/resources/google-sheets-client-secret.json @@ -0,0 +1 @@ +{"installed":{"client_id":"394827218507-2ev02b2ha8plt7g2lh5nqse02ee737cf.apps.googleusercontent.com","project_id":"decisive-octane-187810","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://accounts.google.com/o/oauth2/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"2MnN1DfenoCGWMay3v8Bf7eI","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}} \ No newline at end of file diff --git a/libraries/src/test/java/com/baeldung/google/sheets/GoogleSheetsIntegrationTest.java b/libraries/src/test/java/com/baeldung/google/sheets/GoogleSheetsIntegrationTest.java new file mode 100644 index 0000000000..5280073be2 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/google/sheets/GoogleSheetsIntegrationTest.java @@ -0,0 +1,140 @@ +package com.baeldung.google.sheets; + +import java.io.IOException; +import java.security.GeneralSecurityException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.junit.BeforeClass; +import org.junit.Test; + +import com.google.api.services.sheets.v4.Sheets; +import com.google.api.services.sheets.v4.model.AppendValuesResponse; +import com.google.api.services.sheets.v4.model.BatchGetValuesResponse; +import com.google.api.services.sheets.v4.model.BatchUpdateSpreadsheetRequest; +import com.google.api.services.sheets.v4.model.BatchUpdateValuesRequest; +import com.google.api.services.sheets.v4.model.BatchUpdateValuesResponse; +import com.google.api.services.sheets.v4.model.CopyPasteRequest; +import com.google.api.services.sheets.v4.model.GridRange; +import com.google.api.services.sheets.v4.model.Request; +import com.google.api.services.sheets.v4.model.Spreadsheet; +import com.google.api.services.sheets.v4.model.SpreadsheetProperties; +import com.google.api.services.sheets.v4.model.UpdateSpreadsheetPropertiesRequest; +import com.google.api.services.sheets.v4.model.UpdateValuesResponse; +import com.google.api.services.sheets.v4.model.ValueRange; + +import static org.assertj.core.api.Assertions.*; + +public class GoogleSheetsIntegrationTest { + + private static Sheets sheetsService; + + // this id can be replaced with your spreadsheet id + // otherwise be advised that multiple people may run this test and update the public spreadsheet + private static final String SPREADSHEET_ID = "1sILuxZUnyl_7-MlNThjt765oWshN3Xs-PPLfqYe4DhI"; + + @BeforeClass + public static void setup() throws GeneralSecurityException, IOException { + sheetsService = SheetsServiceUtil.getSheetsService(); + } + + @Test + public void whenWriteSheet_thenReadSheetOk() throws IOException { + ValueRange body = new ValueRange() + .setValues(Arrays.asList( + Arrays.asList("Expenses January"), + Arrays.asList("books", "30"), + Arrays.asList("pens", "10"), + Arrays.asList("Expenses February"), + Arrays.asList("clothes", "20"), + Arrays.asList("shoes", "5"))); + UpdateValuesResponse result = sheetsService.spreadsheets().values() + .update(SPREADSHEET_ID, "A1", body) + .setValueInputOption("RAW") + .execute(); + + List data = new ArrayList<>(); + data.add(new ValueRange() + .setRange("D1") + .setValues(Arrays.asList( + Arrays.asList("January Total", "=B2+B3")))); + data.add(new ValueRange() + .setRange("D4") + .setValues(Arrays.asList( + Arrays.asList("February Total", "=B5+B6")))); + + BatchUpdateValuesRequest batchBody = new BatchUpdateValuesRequest() + .setValueInputOption("USER_ENTERED") + .setData(data); + BatchUpdateValuesResponse batchResult = + sheetsService.spreadsheets().values() + .batchUpdate(SPREADSHEET_ID, batchBody) + .execute(); + + List ranges = Arrays.asList("E1","E4"); + BatchGetValuesResponse readResult = + sheetsService.spreadsheets().values() + .batchGet(SPREADSHEET_ID) + .setRanges(ranges) + .execute(); + + ValueRange januaryTotal = readResult.getValueRanges().get(0); + assertThat(januaryTotal.getValues().get(0).get(0)).isEqualTo("40"); + + ValueRange febTotal = readResult.getValueRanges().get(1); + assertThat(febTotal.getValues().get(0).get(0)).isEqualTo("25"); + + ValueRange appendBody = new ValueRange() + .setValues(Arrays.asList( + Arrays.asList("Total", "=E1+E4"))); + AppendValuesResponse appendResult = + sheetsService.spreadsheets().values() + .append(SPREADSHEET_ID, "A1", appendBody) + .setValueInputOption("USER_ENTERED") + .setInsertDataOption("INSERT_ROWS") + .setIncludeValuesInResponse(true) + .execute(); + + ValueRange total = appendResult.getUpdates().getUpdatedData(); + assertThat(total.getValues().get(0).get(1)).isEqualTo("65"); + } + + + @Test + public void whenUpdateSpreadSheetTitle_thenOk() throws IOException { + + UpdateSpreadsheetPropertiesRequest updateRequest = new UpdateSpreadsheetPropertiesRequest() + .setFields("*") + .setProperties(new SpreadsheetProperties().setTitle("Expenses")); + + CopyPasteRequest copyRequest = new CopyPasteRequest() + .setSource(new GridRange().setSheetId(0) + .setStartColumnIndex(0).setEndColumnIndex(2) + .setStartRowIndex(0).setEndRowIndex(1)) + .setDestination(new GridRange().setSheetId(1) + .setStartColumnIndex(0).setEndColumnIndex(2) + .setStartRowIndex(0).setEndRowIndex(1)) + .setPasteType("PASTE_VALUES"); + + List requests = new ArrayList<>(); + + requests.add(new Request().setCopyPaste(copyRequest)); + requests.add(new Request().setUpdateSpreadsheetProperties(updateRequest)); + + BatchUpdateSpreadsheetRequest body = + new BatchUpdateSpreadsheetRequest().setRequests(requests); + + sheetsService.spreadsheets().batchUpdate(SPREADSHEET_ID, body).execute(); + } + + @Test + public void whenCreateSpreadSheet_thenIdOk() throws IOException { + Spreadsheet spreadSheet = new Spreadsheet() + .setProperties(new SpreadsheetProperties().setTitle("My Spreadsheet")); + Spreadsheet result = sheetsService.spreadsheets().create(spreadSheet).execute(); + + assertThat(result.getSpreadsheetId()).isNotNull(); + } + +} From 04df1cfef043caec5f64a9aa4ed5e7737da74fae Mon Sep 17 00:00:00 2001 From: Grzegorz Piwowarek Date: Thu, 14 Dec 2017 17:06:17 +0100 Subject: [PATCH 46/50] Remove spring-flyway (#3240) * Remove spring-flyway * Remove spring-flyway --- ... WaitingForThreadsToFinishManualTest.java} | 66 +------------------ flyway/pom.xml | 52 --------------- flyway/spring-flyway/.gitignore | 24 ------- flyway/spring-flyway/pom.xml | 57 ---------------- .../springflyway/SpringFlywayApplication.java | 12 ---- .../springflyway/entities/Customer.java | 28 -------- .../migration/V2__uk_lastname_customer.java | 14 ---- .../repositories/CustomerRepository.java | 11 ---- ...sitoryInitialMigrationIntegrationTest.java | 28 -------- ...erRepositoryInsertDataIntegrationTest.java | 35 ---------- ...ullConstraintMigrationIntegrationTest.java | 25 ------- ...onstraintJavaMigrationIntegrationTest.java | 29 -------- ...queConstraintMigrationIntegrationTest.java | 27 -------- .../src/test/resources/application.properties | 1 - .../migration/V1_0__create_table_customer.sql | 6 -- .../db/migration/V1_1__insert_customer.sql | 6 -- .../migration/V1_2__make_email_not_null.sql | 1 - .../db/migration/V1_3__make_email_unique.sql | 1 - pom.xml | 1 - 19 files changed, 2 insertions(+), 422 deletions(-) rename core-java-concurrency/src/test/java/com/baeldung/concurrent/executorservice/{WaitingForThreadsToFinishTest.java => WaitingForThreadsToFinishManualTest.java} (72%) delete mode 100644 flyway/pom.xml delete mode 100644 flyway/spring-flyway/.gitignore delete mode 100644 flyway/spring-flyway/pom.xml delete mode 100644 flyway/spring-flyway/src/main/java/com/baeldung/springflyway/SpringFlywayApplication.java delete mode 100644 flyway/spring-flyway/src/main/java/com/baeldung/springflyway/entities/Customer.java delete mode 100644 flyway/spring-flyway/src/main/java/com/baeldung/springflyway/migration/V2__uk_lastname_customer.java delete mode 100644 flyway/spring-flyway/src/main/java/com/baeldung/springflyway/repositories/CustomerRepository.java delete mode 100644 flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryInitialMigrationIntegrationTest.java delete mode 100644 flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryInsertDataIntegrationTest.java delete mode 100644 flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryNotNullConstraintMigrationIntegrationTest.java delete mode 100644 flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryUniqueConstraintJavaMigrationIntegrationTest.java delete mode 100644 flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryUniqueConstraintMigrationIntegrationTest.java delete mode 100644 flyway/spring-flyway/src/test/resources/application.properties delete mode 100644 flyway/spring-flyway/src/test/resources/db/migration/V1_0__create_table_customer.sql delete mode 100644 flyway/spring-flyway/src/test/resources/db/migration/V1_1__insert_customer.sql delete mode 100644 flyway/spring-flyway/src/test/resources/db/migration/V1_2__make_email_not_null.sql delete mode 100644 flyway/spring-flyway/src/test/resources/db/migration/V1_3__make_email_unique.sql diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/executorservice/WaitingForThreadsToFinishTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/executorservice/WaitingForThreadsToFinishManualTest.java similarity index 72% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/executorservice/WaitingForThreadsToFinishTest.java rename to core-java-concurrency/src/test/java/com/baeldung/concurrent/executorservice/WaitingForThreadsToFinishManualTest.java index 7e2bf590fd..cd8b015be2 100644 --- a/core-java-concurrency/src/test/java/com/baeldung/concurrent/executorservice/WaitingForThreadsToFinishTest.java +++ b/core-java-concurrency/src/test/java/com/baeldung/concurrent/executorservice/WaitingForThreadsToFinishManualTest.java @@ -10,9 +10,9 @@ import java.util.concurrent.*; import static junit.framework.TestCase.assertTrue; -public class WaitingForThreadsToFinishTest { +public class WaitingForThreadsToFinishManualTest { - private static final Logger LOG = LoggerFactory.getLogger(WaitingForThreadsToFinishTest.class); + private static final Logger LOG = LoggerFactory.getLogger(WaitingForThreadsToFinishManualTest.class); private final static ExecutorService WORKER_THREAD_POOL = Executors.newFixedThreadPool(10); public void awaitTerminationAfterShutdown(ExecutorService threadPool) { @@ -142,66 +142,4 @@ public class WaitingForThreadsToFinishTest { awaitTerminationAfterShutdown(WORKER_THREAD_POOL); } } - - @Test - public void givenMultipleThreads_whenUsingCompletableFutures_thenMainThreadShouldWaitForAllToFinish() { - - CompletableFuture future1 = CompletableFuture.supplyAsync(() -> { - - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - - return "Hello"; - }); - - CompletableFuture future2 = CompletableFuture.supplyAsync(() -> { - - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - - return "Beautiful"; - }); - - CompletableFuture future3 = CompletableFuture.supplyAsync(() -> { - - try { - Thread.sleep(3000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - - return "World"; - }); - - long startProcessingTime = System.currentTimeMillis(); - CompletableFuture combinedFuture = CompletableFuture.allOf(future1, future2, future3); - combinedFuture.join(); - - long totalProcessingTime = System.currentTimeMillis() - startProcessingTime; - assertTrue(totalProcessingTime >= 5000 && totalProcessingTime < 6000); - - LOG.debug("Responses from all threads are available after " + totalProcessingTime + " milliseconds"); - - try { - String thread1Response = future1.get(); - assertTrue(thread1Response.equals("Hello")); - - String thread2Response = future2.get(); - assertTrue(thread2Response.equals("Beautiful")); - - String thread3Response = future3.get(); - assertTrue(thread3Response.equals("World")); - - } catch (InterruptedException | ExecutionException e) { - e.printStackTrace(); - } - - awaitTerminationAfterShutdown(WORKER_THREAD_POOL); - } } diff --git a/flyway/pom.xml b/flyway/pom.xml deleted file mode 100644 index 5cb8fabe67..0000000000 --- a/flyway/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - flyway - 1.0 - flyway - pom - A sample project to demonstrate Flyway migrations - - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - - - - spring-flyway - - - - - mysql - mysql-connector-java - ${mysql.version} - - - - - - org.springframework.boot - spring-boot-dependencies - ${spring.boot.version} - pom - import - - - - - - - org.flywaydb - flyway-maven-plugin - ${flyway-maven-plugin.version} - - - - - 6.0.5 - 4.0.3 - 1.5.8.RELEASE - - \ No newline at end of file diff --git a/flyway/spring-flyway/.gitignore b/flyway/spring-flyway/.gitignore deleted file mode 100644 index 2af7cefb0a..0000000000 --- a/flyway/spring-flyway/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -nbproject/private/ -build/ -nbbuild/ -dist/ -nbdist/ -.nb-gradle/ \ No newline at end of file diff --git a/flyway/spring-flyway/pom.xml b/flyway/spring-flyway/pom.xml deleted file mode 100644 index cf5703cfab..0000000000 --- a/flyway/spring-flyway/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - 4.0.0 - - spring-flyway - 0.0.1-SNAPSHOT - jar - - spring-flyway - Spring Boot Test Flyway Migrations - - - flyway - com.baeldung - 1.0 - ../../flyway - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.flywaydb - flyway-core - - - org.projectlombok - lombok - - - com.h2database - h2 - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - diff --git a/flyway/spring-flyway/src/main/java/com/baeldung/springflyway/SpringFlywayApplication.java b/flyway/spring-flyway/src/main/java/com/baeldung/springflyway/SpringFlywayApplication.java deleted file mode 100644 index 9218fbc88d..0000000000 --- a/flyway/spring-flyway/src/main/java/com/baeldung/springflyway/SpringFlywayApplication.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.baeldung.springflyway; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class SpringFlywayApplication { - - public static void main(String[] args) { - SpringApplication.run(SpringFlywayApplication.class, args); - } -} diff --git a/flyway/spring-flyway/src/main/java/com/baeldung/springflyway/entities/Customer.java b/flyway/spring-flyway/src/main/java/com/baeldung/springflyway/entities/Customer.java deleted file mode 100644 index 194b961d2d..0000000000 --- a/flyway/spring-flyway/src/main/java/com/baeldung/springflyway/entities/Customer.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.baeldung.springflyway.entities; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; - -@Entity -@Data -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class Customer { - - @Id - @GeneratedValue - private Long id; - - private String firstName; - private String lastName; - - private String email; - -} diff --git a/flyway/spring-flyway/src/main/java/com/baeldung/springflyway/migration/V2__uk_lastname_customer.java b/flyway/spring-flyway/src/main/java/com/baeldung/springflyway/migration/V2__uk_lastname_customer.java deleted file mode 100644 index 52b851546b..0000000000 --- a/flyway/spring-flyway/src/main/java/com/baeldung/springflyway/migration/V2__uk_lastname_customer.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.springflyway.migration; - -import org.flywaydb.core.api.migration.spring.SpringJdbcMigration; -import org.springframework.jdbc.core.JdbcTemplate; - -public class V2__uk_lastname_customer implements SpringJdbcMigration { - - final String CUSTOMER_LASTNAME_UK = "ALTER TABLE customer ADD CONSTRAINT uk_customer_lastname UNIQUE(last_name);"; - - @Override - public void migrate(final JdbcTemplate jdbcTemplate) throws Exception { - jdbcTemplate.execute(CUSTOMER_LASTNAME_UK); - } -} diff --git a/flyway/spring-flyway/src/main/java/com/baeldung/springflyway/repositories/CustomerRepository.java b/flyway/spring-flyway/src/main/java/com/baeldung/springflyway/repositories/CustomerRepository.java deleted file mode 100644 index 0a1fb5a146..0000000000 --- a/flyway/spring-flyway/src/main/java/com/baeldung/springflyway/repositories/CustomerRepository.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.baeldung.springflyway.repositories; - -import com.baeldung.springflyway.entities.Customer; -import org.springframework.data.jpa.repository.JpaRepository; - -import java.util.Optional; - -public interface CustomerRepository extends JpaRepository { - - Optional findByEmail(String email); -} diff --git a/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryInitialMigrationIntegrationTest.java b/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryInitialMigrationIntegrationTest.java deleted file mode 100644 index 59ef5820d7..0000000000 --- a/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryInitialMigrationIntegrationTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.baeldung.springflyway; - -import com.baeldung.springflyway.entities.Customer; -import com.baeldung.springflyway.repositories.CustomerRepository; -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.test.context.junit4.SpringRunner; - -import static org.junit.Assert.assertNotNull; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class CustomerRepositoryInitialMigrationIntegrationTest { - - @Autowired CustomerRepository customerRepository; - - @Test - public void givenSchemaCreationMigration_whenTryingToCreateACustomer_thenSuccess() { - Customer customer = customerRepository.save(Customer - .builder() - .email("customer@email.com") - .build()); - assertNotNull(customer.getId()); - } - -} diff --git a/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryInsertDataIntegrationTest.java b/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryInsertDataIntegrationTest.java deleted file mode 100644 index 3feedf2fd9..0000000000 --- a/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryInsertDataIntegrationTest.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.baeldung.springflyway; - -import com.baeldung.springflyway.entities.Customer; -import com.baeldung.springflyway.repositories.CustomerRepository; -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.test.context.junit4.SpringRunner; - -import java.util.List; -import java.util.Optional; - -import static org.junit.Assert.*; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class CustomerRepositoryInsertDataIntegrationTest { - - @Autowired CustomerRepository customerRepository; - - @Test - public void givenASetInsertData_whenRunningMigrationsWithSuccess_thenASpecificCustomerIsFound() { - Optional customerOptional = customerRepository.findByEmail("email@email.com"); - assertTrue(customerOptional.isPresent()); - } - - @Test - public void givenASetInsertData_whenRunningMigrationsWithSuccess_thenASetOfCustomersIsFound() { - List customers = customerRepository.findAll(); - assertNotNull(customers); - assertEquals(customers.size(), 6); - } - -} diff --git a/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryNotNullConstraintMigrationIntegrationTest.java b/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryNotNullConstraintMigrationIntegrationTest.java deleted file mode 100644 index 9ec5d4d77e..0000000000 --- a/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryNotNullConstraintMigrationIntegrationTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.baeldung.springflyway; - -import com.baeldung.springflyway.entities.Customer; -import com.baeldung.springflyway.repositories.CustomerRepository; -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.dao.DataIntegrityViolationException; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class CustomerRepositoryNotNullConstraintMigrationIntegrationTest { - - @Autowired CustomerRepository customerRepository; - - @Test(expected = DataIntegrityViolationException.class) - public void givenTheNotNullConstraintMigrations_whenInsertingACustomerWithNullEmail_thenThrowException() { - customerRepository.save(Customer - .builder() - .build()); - } - -} diff --git a/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryUniqueConstraintJavaMigrationIntegrationTest.java b/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryUniqueConstraintJavaMigrationIntegrationTest.java deleted file mode 100644 index f615f477bc..0000000000 --- a/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryUniqueConstraintJavaMigrationIntegrationTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.baeldung.springflyway; - -import com.baeldung.springflyway.entities.Customer; -import com.baeldung.springflyway.repositories.CustomerRepository; -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.dao.DataIntegrityViolationException; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(properties = { - "flyway.locations[0]=db/migration", "flyway.locations[1]=com/baeldung/springflyway/migration" -}) -public class CustomerRepositoryUniqueConstraintJavaMigrationIntegrationTest { - - @Autowired CustomerRepository customerRepository; - - @Test(expected = DataIntegrityViolationException.class) - public void givenTheUniqueConstraintMigrations_whenInsertingAnExistingLastNameCustomer_thenThrowException() { - customerRepository.save(Customer - .builder() - .lastName("LastName") - .build()); - - } - -} diff --git a/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryUniqueConstraintMigrationIntegrationTest.java b/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryUniqueConstraintMigrationIntegrationTest.java deleted file mode 100644 index e9ac34b384..0000000000 --- a/flyway/spring-flyway/src/test/java/com/baeldung/springflyway/CustomerRepositoryUniqueConstraintMigrationIntegrationTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baeldung.springflyway; - -import com.baeldung.springflyway.entities.Customer; -import com.baeldung.springflyway.repositories.CustomerRepository; -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.dao.DataIntegrityViolationException; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class CustomerRepositoryUniqueConstraintMigrationIntegrationTest { - - @Autowired CustomerRepository customerRepository; - - @Test(expected = DataIntegrityViolationException.class) - public void givenTheUniqueConstraintMigrations_whenInsertingAnExistingEmailCustomer_thenThrowException() { - customerRepository.save(Customer - .builder() - .email("email@email.com") - .build()); - - } - -} diff --git a/flyway/spring-flyway/src/test/resources/application.properties b/flyway/spring-flyway/src/test/resources/application.properties deleted file mode 100644 index 5656ca79ce..0000000000 --- a/flyway/spring-flyway/src/test/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ -spring.jpa.hibernate.ddl-auto=validate \ No newline at end of file diff --git a/flyway/spring-flyway/src/test/resources/db/migration/V1_0__create_table_customer.sql b/flyway/spring-flyway/src/test/resources/db/migration/V1_0__create_table_customer.sql deleted file mode 100644 index 8c65253ed8..0000000000 --- a/flyway/spring-flyway/src/test/resources/db/migration/V1_0__create_table_customer.sql +++ /dev/null @@ -1,6 +0,0 @@ -create table if not exists customer ( - id bigint AUTO_INCREMENT not null primary key, - first_name varchar(255) , - last_name varchar(255) , - email varchar(255) -); \ No newline at end of file diff --git a/flyway/spring-flyway/src/test/resources/db/migration/V1_1__insert_customer.sql b/flyway/spring-flyway/src/test/resources/db/migration/V1_1__insert_customer.sql deleted file mode 100644 index 6bba6e00a1..0000000000 --- a/flyway/spring-flyway/src/test/resources/db/migration/V1_1__insert_customer.sql +++ /dev/null @@ -1,6 +0,0 @@ -insert into customer (first_name, last_name, email) values ('FirstName', 'LastName', 'email@email.com'); -insert into customer (first_name, last_name, email) values ('FirstName1', 'LastName1', 'email1@email.com'); -insert into customer (first_name, last_name, email) values ('FirstName2', 'LastName2', 'email2@email.com'); -insert into customer (first_name, last_name, email) values ('FirstName3', 'LastName3', 'email3@email.com'); -insert into customer (first_name, last_name, email) values ('FirstName4', 'LastName4', 'email4@email.com'); -insert into customer (first_name, last_name, email) values ('FirstName5', 'LastName5', 'email5@email.com'); \ No newline at end of file diff --git a/flyway/spring-flyway/src/test/resources/db/migration/V1_2__make_email_not_null.sql b/flyway/spring-flyway/src/test/resources/db/migration/V1_2__make_email_not_null.sql deleted file mode 100644 index b1cc396741..0000000000 --- a/flyway/spring-flyway/src/test/resources/db/migration/V1_2__make_email_not_null.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE customer ALTER email SET NOT NULL; \ No newline at end of file diff --git a/flyway/spring-flyway/src/test/resources/db/migration/V1_3__make_email_unique.sql b/flyway/spring-flyway/src/test/resources/db/migration/V1_3__make_email_unique.sql deleted file mode 100644 index 19d738fe46..0000000000 --- a/flyway/spring-flyway/src/test/resources/db/migration/V1_3__make_email_unique.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE customer ADD CONSTRAINT uk_customer_email UNIQUE(email); \ No newline at end of file diff --git a/pom.xml b/pom.xml index 2c611e6efe..fa5eb83b0c 100644 --- a/pom.xml +++ b/pom.xml @@ -58,7 +58,6 @@ feign - flyway From 9627971b46c2257a0213685108d0b250b1d00038 Mon Sep 17 00:00:00 2001 From: Muhammed Almas Date: Thu, 14 Dec 2017 22:24:27 +0530 Subject: [PATCH 47/50] BAEL-1375 Using compute for every usage. (#3242) --- .../java/com/baeldung/counter/CounterUtil.java | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/core-java-8/src/test/java/com/baeldung/counter/CounterUtil.java b/core-java-8/src/test/java/com/baeldung/counter/CounterUtil.java index 647fbfb0cc..afd7202892 100644 --- a/core-java-8/src/test/java/com/baeldung/counter/CounterUtil.java +++ b/core-java-8/src/test/java/com/baeldung/counter/CounterUtil.java @@ -38,23 +38,14 @@ public class CounterUtil { public static void counterWithMutableInteger(Map counterMap) { for (String country : COUNTRY_NAMES) { - MutableInteger oldValue = counterMap.get(country); - if (oldValue != null) { - oldValue.increment(); - } else { - counterMap.put(country, new MutableInteger(1)); - } + counterMap.compute(country, (k, v) -> v == null ? new MutableInteger(0) : v) + .increment(); } } public static void counterWithPrimitiveArray(Map counterMap) { for (String country : COUNTRY_NAMES) { - int[] oldCounter = counterMap.get(country); - if (oldCounter != null) { - oldCounter[0] += 1; - } else { - counterMap.put(country, new int[] { 1 }); - } + counterMap.compute(country, (k, v) -> v == null ? new int[] { 0 } : v)[0]++; } } From 92c92ee96c49b97abbdc04e60fcef72f3b7afbcc Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Thu, 14 Dec 2017 22:24:31 +0200 Subject: [PATCH 48/50] fix windows jenkins script --- .../scripted-pipeline-unix-nonunix | 31 +++++-------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/spring-jenkins-pipeline/scripted-pipeline-unix-nonunix b/spring-jenkins-pipeline/scripted-pipeline-unix-nonunix index 6b775b6e56..e9cae64d3d 100644 --- a/spring-jenkins-pipeline/scripted-pipeline-unix-nonunix +++ b/spring-jenkins-pipeline/scripted-pipeline-unix-nonunix @@ -14,8 +14,10 @@ node { stage("Checkstyle") { if (isUnix()) { sh "./mvnw checkstyle:checkstyle" - - step([$class: 'CheckStylePublisher', + } else { + bat "./mvnw.cmd checkstyle:checkstyle" + } + step([$class: 'CheckStylePublisher', canRunOnFailed: true, defaultEncoding: '', healthy: '100', @@ -23,18 +25,6 @@ node { unHealthy: '90', useStableBuildAsReference: true ]) - } else { - bat "./mvnw.cmd checkstyle:checkstyle" - - step([$class: 'CheckStylePublisher', - canRunOnFailed: true, - defaultEncoding: '', - healthy: '100', - pattern: '**\target\checkstyle-result.xml', - unHealthy: '90', - useStableBuildAsReference: true - ]) - } } } } @@ -44,32 +34,27 @@ node { stage("Runing unit tests") { if (isUnix()) { sh "./mvnw test -Punit" - - step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*UnitTest.xml']) } else { bat "./mvnw.cmd test -Punit" - - step([$class: 'JUnitResultArchiver', testResults: '**\target\surefire-reports\TEST-*UnitTest.xml']) } + step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*UnitTest.xml']) + } }, 'Integration tests': { stage("Runing integration tests") { if (isUnix()) { sh "./mvnw test -Pintegration" - - step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*IntegrationTest.xml']) } else { bat "./mvnw.cmd test -Pintegration" - - step([$class: 'JUnitResultArchiver', testResults: '**\target\surefire-reports\TEST-*IntegrationTest.xml']) } + step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*IntegrationTest.xml']) } }, 'Deployment': { stage("Staging") { if (isUnix()) { sh "pid=\$(lsof -i:8989 -t); kill -TERM \$pid || kill -KILL \$pid" } else { - bat "FOR /F 'tokens=5 delims= ' %%P IN ('netstat -ano ^| findstr :8989') DO TaskKill.exe /PID %%P" + bat "FOR /F \"tokens=5 delims= \" %%G IN (\"netstat -a | findstr :8989\") DO TaskKill.exe /PID %%G /fi \"memusage gt 0\"" } withEnv(['JENKINS_NODE_COOKIE=dontkill']) { From 171d28a9d17c8bbb5576b78fe13773624a3e1aad Mon Sep 17 00:00:00 2001 From: ocheja Date: Fri, 15 Dec 2017 07:06:41 +0900 Subject: [PATCH 49/50] Remove verbose file info content (#3238) * Define beans for handling different message types in a lean chat app * Add class based spring beans configuration * Define spring configuration in XML for constructor based bean injection * Refactor package structure to separate constructor based bean injection code set from setter based bean injection code set * Define configuration and classes specific to setter-based bean injection. * Implement tests for constructor-based and setter-based bean injections * develop codes for explaining type erasure * Write unit tests for type erasure examples * Remove evaluation article code * Modify type erasure examples and unit tests * Modify type erasure examples and unit tests * Add expected exception in TypeErasureUnitTest * Correct grammar in class name * Implement File Manager app to demonstrate Polymorphism. Develop unit tests for Polymorphism article code * Add examples for static polymorphism * Change sysout statments to slf4j log info statements * Add assertions and expected errors check on Test * Add assertions and expected errors check on Test * Correct compile time error of symbol not found * Removed commented out non-compiling test. * Replace string concatenations with String.format * Replace string concatenations with String.format * Remove verbose file info descriptor and replace with simpler one --- .../src/main/java/com/baeldung/polymorphism/GenericFile.java | 2 +- .../src/main/java/com/baeldung/polymorphism/ImageFile.java | 2 +- core-java/src/main/java/com/baeldung/polymorphism/TextFile.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core-java/src/main/java/com/baeldung/polymorphism/GenericFile.java b/core-java/src/main/java/com/baeldung/polymorphism/GenericFile.java index 03e704f36f..85acbc5be0 100644 --- a/core-java/src/main/java/com/baeldung/polymorphism/GenericFile.java +++ b/core-java/src/main/java/com/baeldung/polymorphism/GenericFile.java @@ -54,7 +54,7 @@ public class GenericFile { } public String getFileInfo() { - return String.format("File Name: %s\n" + " Extension: %s\n" + " Date Created: %s\n" + " Version: %s\n", this.getName(), this.getExtension(), this.getDateCreated(), this.getVersion()); + return "Generic File Impl"; } public Object read() { diff --git a/core-java/src/main/java/com/baeldung/polymorphism/ImageFile.java b/core-java/src/main/java/com/baeldung/polymorphism/ImageFile.java index e237f3f826..54eb24af5e 100644 --- a/core-java/src/main/java/com/baeldung/polymorphism/ImageFile.java +++ b/core-java/src/main/java/com/baeldung/polymorphism/ImageFile.java @@ -30,7 +30,7 @@ public class ImageFile extends GenericFile { } public String getFileInfo() { - return String.format(" %s Height: %d\n Width: %d", super.getFileInfo(), this.getHeight(), this.getWidth()); + return "Image File Impl"; } public String read() { diff --git a/core-java/src/main/java/com/baeldung/polymorphism/TextFile.java b/core-java/src/main/java/com/baeldung/polymorphism/TextFile.java index 2c28c968b8..0103291c5a 100644 --- a/core-java/src/main/java/com/baeldung/polymorphism/TextFile.java +++ b/core-java/src/main/java/com/baeldung/polymorphism/TextFile.java @@ -21,7 +21,7 @@ public class TextFile extends GenericFile { } public String getFileInfo() { - return String.format(" %s Word Count: %d", super.getFileInfo(), wordCount); + return "Text File Impl"; } public String read() { From ae109dfb7cf220cc1deffb010a226bf55acc81f7 Mon Sep 17 00:00:00 2001 From: Jose Bob Santos Jr Date: Fri, 15 Dec 2017 09:50:51 +0800 Subject: [PATCH 50/50] BAEL-1330 Primitive Type Streams in Java 8 (#3106) * initial commit for first article evaluation * fixed compilation error * removed final keywords for compliance * added unit tests and refactored as needed * refactored application-context.xml to use self-closing tags * renamed tests to use UnitTest suffix * removed unnecessary annotation * added code samples for primitive streams * removed sample code and tests for evaluation article * renamed unit test to proper unit test naming * added a test to show boxed method * added the assertion to the test fox boxed * changed mapToInt test to use Arrays.asList instead of a POJO as per Grzegorz and Eugen --- .../com/baeldung/stream/PrimitiveStreams.java | 23 +++++ .../stream/PrimitiveStreamsUnitTest.java | 97 +++++++++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 core-java-8/src/main/java/com/baeldung/stream/PrimitiveStreams.java create mode 100644 core-java-8/src/test/java/com/baeldung/stream/PrimitiveStreamsUnitTest.java diff --git a/core-java-8/src/main/java/com/baeldung/stream/PrimitiveStreams.java b/core-java-8/src/main/java/com/baeldung/stream/PrimitiveStreams.java new file mode 100644 index 0000000000..b0afb65a35 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/stream/PrimitiveStreams.java @@ -0,0 +1,23 @@ +package com.baeldung.stream; + +import java.util.Arrays; +import java.util.stream.IntStream; + +class PrimitiveStreams { + + int min(int[] integers) { + return Arrays.stream(integers).min().getAsInt(); + } + + int max(int... integers) { + return IntStream.of(integers).max().getAsInt(); + } + + int sum(int... integers) { + return IntStream.of(integers).sum(); + } + + double avg(int... integers) { + return IntStream.of(integers).average().getAsDouble(); + } +} diff --git a/core-java-8/src/test/java/com/baeldung/stream/PrimitiveStreamsUnitTest.java b/core-java-8/src/test/java/com/baeldung/stream/PrimitiveStreamsUnitTest.java new file mode 100644 index 0000000000..75078d75bc --- /dev/null +++ b/core-java-8/src/test/java/com/baeldung/stream/PrimitiveStreamsUnitTest.java @@ -0,0 +1,97 @@ +package com.baeldung.stream; + +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class PrimitiveStreamsUnitTest { + + private PrimitiveStreams streams = new PrimitiveStreams(); + + @Test + public void givenAnArrayOfIntegersWhenMinIsCalledThenCorrectMinIsReturned() { + int[] integers = new int[] {20, 98, 12, 7, 35}; + int min = streams.min(integers); // returns 7 + + assertEquals(7, min); + } + + @Test + public void givenAnArrayOfIntegersWhenMaxIsCalledThenCorrectMaxIsReturned() { + int max = streams.max(20, 98, 12, 7, 35); + + assertEquals(98, max); + } + + @Test + public void givenAnArrayOfIntegersWhenSumIsCalledThenCorrectSumIsReturned() { + int sum = streams.sum(20, 98, 12, 7, 35); + + assertEquals(172, sum); + } + + @Test + public void givenAnArrayOfIntegersWhenAvgIsCalledThenCorrectAvgIsReturned() { + double avg = streams.avg(20, 98, 12, 7, 35); + + assertTrue(34.4 == avg); + } + + @Test + public void givenARangeOfIntegersWhenIntStreamSumIsCalledThenCorrectSumIsReturned() { + int sum = IntStream.range(1, 10).sum(); + + assertEquals(45, sum); + } + + @Test + public void givenARangeClosedOfIntegersWhenIntStreamSumIsCalledThenCorrectSumIsReturned() { + int sum = IntStream.rangeClosed(1, 10).sum(); + + assertEquals(55, sum); + } + + @Test + public void givenARangeWhenForEachIsCalledThenTheIndicesWillBePrinted() { + IntStream.rangeClosed(1, 5).parallel().forEach(System.out::println); + } + + @Test + public void givenAnArrayWhenSumIsCalledThenTheCorrectSumIsReturned() { + + int sum = Arrays.asList(33,45).stream().mapToInt(a -> a).sum(); + + assertEquals(78, sum); + } + + @Test + public void givenAnIntStreamThenGetTheEvenIntegers() { + List evenInts = IntStream.rangeClosed(1, 10) + .filter(i -> i % 2 == 0) + .boxed() + .collect(Collectors.toList()); + + List expected = IntStream.of(2, 4, 6, 8, 10).boxed().collect(Collectors.toList()); + + assertEquals(expected, evenInts); + } + + class Person { + private int age; + + Person(int age) { + this.age = age; + } + + int getAge() { + return age; + } + } +} \ No newline at end of file