From ae47827879d0e9396ad5de5f979f495629a35838 Mon Sep 17 00:00:00 2001 From: alv21 Date: Thu, 8 Feb 2018 19:15:56 +0100 Subject: [PATCH 001/143] Different Types of Bean Injection in Spring --- .../beansinjectiontypes/Cabriolet.java | 8 +++ .../com/baeldung/beansinjectiontypes/Car.java | 6 ++ .../DealershipTraditionalStyle.java | 9 +++ .../DealershipWithDependenciesInjection.java | 13 +++++ .../baeldung/beansinjectiontypes/Sedan.java | 10 ++++ .../constructor/Config.java | 20 +++++++ .../constructor/Dealership.java | 20 +++++++ .../constructor/HornCheckerFile.java | 15 +++++ .../constructor/HornCheckerXML.java | 15 +++++ .../beansinjectiontypes/setter/Config.java | 22 ++++++++ .../setter/Dealership.java | 19 +++++++ .../setter/HornCheckerFile.java | 15 +++++ .../setter/HornCheckerXML.java | 15 +++++ .../resources/beansinjectiontypes-ctx.xml | 10 ++++ .../BeansInjectionTypesIntegrationTest.java | 56 +++++++++++++++++++ 15 files changed, 253 insertions(+) create mode 100644 spring-core/src/main/java/com/baeldung/beansinjectiontypes/Cabriolet.java create mode 100644 spring-core/src/main/java/com/baeldung/beansinjectiontypes/Car.java create mode 100644 spring-core/src/main/java/com/baeldung/beansinjectiontypes/DealershipTraditionalStyle.java create mode 100644 spring-core/src/main/java/com/baeldung/beansinjectiontypes/DealershipWithDependenciesInjection.java create mode 100644 spring-core/src/main/java/com/baeldung/beansinjectiontypes/Sedan.java create mode 100644 spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/Config.java create mode 100644 spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/Dealership.java create mode 100644 spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/HornCheckerFile.java create mode 100644 spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/HornCheckerXML.java create mode 100644 spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/Config.java create mode 100644 spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/Dealership.java create mode 100644 spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/HornCheckerFile.java create mode 100644 spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/HornCheckerXML.java create mode 100644 spring-core/src/main/resources/beansinjectiontypes-ctx.xml create mode 100644 spring-core/src/test/java/com/baeldung/beansinjectiontypes/BeansInjectionTypesIntegrationTest.java diff --git a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/Cabriolet.java b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/Cabriolet.java new file mode 100644 index 0000000000..2bf9b8b954 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/Cabriolet.java @@ -0,0 +1,8 @@ +package com.baeldung.beansinjectiontypes; + +public class Cabriolet implements Car{ + + public void honk(){ + System.out.println("I'm a cabriolet!"); + } +} diff --git a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/Car.java b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/Car.java new file mode 100644 index 0000000000..e88e218f95 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/Car.java @@ -0,0 +1,6 @@ +package com.baeldung.beansinjectiontypes; + +public interface Car { + + public void honk(); +} diff --git a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/DealershipTraditionalStyle.java b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/DealershipTraditionalStyle.java new file mode 100644 index 0000000000..b917049e41 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/DealershipTraditionalStyle.java @@ -0,0 +1,9 @@ +package com.baeldung.beansinjectiontypes; + +public class DealershipTraditionalStyle { + private Car car = new Sedan(); + + public Car getCar() { + return car; + } +} diff --git a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/DealershipWithDependenciesInjection.java b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/DealershipWithDependenciesInjection.java new file mode 100644 index 0000000000..9b25e21dc7 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/DealershipWithDependenciesInjection.java @@ -0,0 +1,13 @@ +package com.baeldung.beansinjectiontypes; + +public class DealershipWithDependenciesInjection { + private Car car; + + public DealershipWithDependenciesInjection(Car car) { + this.car = car; + } + + public Car getCar() { + return car; + } +} diff --git a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/Sedan.java b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/Sedan.java new file mode 100644 index 0000000000..0ae4cf5a40 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/Sedan.java @@ -0,0 +1,10 @@ +package com.baeldung.beansinjectiontypes; + +import org.springframework.stereotype.Component; + +@Component +public class Sedan implements Car { + public void honk(){ + System.out.println("I'm a sedan!"); + } +} diff --git a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/Config.java b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/Config.java new file mode 100644 index 0000000000..3e2534f892 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/Config.java @@ -0,0 +1,20 @@ +package com.baeldung.beansinjectiontypes.constructor; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.baeldung.beansinjectiontypes.Car; +import com.baeldung.beansinjectiontypes.Sedan; + +@Configuration(value="constructorConfig") +public class Config { + @Bean + public Car car() { + return new Sedan(); + } + + @Bean + public Dealership dealership() { + return new Dealership(car()); + } +} diff --git a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/Dealership.java b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/Dealership.java new file mode 100644 index 0000000000..6151ec8e70 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/Dealership.java @@ -0,0 +1,20 @@ +package com.baeldung.beansinjectiontypes.constructor; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.baeldung.beansinjectiontypes.Car; + +@Component(value="constructorDealership") +public class Dealership { + private Car car; + + @Autowired + public Dealership(Car car) { + this.car = car; + } + + public Car getCar() { + return car; + } +} diff --git a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/HornCheckerFile.java b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/HornCheckerFile.java new file mode 100644 index 0000000000..924372e3df --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/HornCheckerFile.java @@ -0,0 +1,15 @@ +package com.baeldung.beansinjectiontypes.constructor; + +import org.springframework.context.annotation.AnnotationConfigApplicationContext; + +public class HornCheckerFile { + + public static void main(String[] args) { + try (AnnotationConfigApplicationContext context = + new AnnotationConfigApplicationContext(Config.class)) { + Dealership dealership = (Dealership) context.getBean("dealership"); + + dealership.getCar().honk(); + } + } +} diff --git a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/HornCheckerXML.java b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/HornCheckerXML.java new file mode 100644 index 0000000000..3c035986e6 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/HornCheckerXML.java @@ -0,0 +1,15 @@ +package com.baeldung.beansinjectiontypes.constructor; + +import org.springframework.context.support.FileSystemXmlApplicationContext; + +public class HornCheckerXML { + + public static void main(String[] args) { + try (FileSystemXmlApplicationContext context = + new FileSystemXmlApplicationContext("src/main/resources/beansinjectiontypes-ctx.xml")) { + Dealership dealership = (Dealership) context.getBean("constructorDealership"); + + dealership.getCar().honk(); + } + } +} diff --git a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/Config.java b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/Config.java new file mode 100644 index 0000000000..212d303ce7 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/Config.java @@ -0,0 +1,22 @@ +package com.baeldung.beansinjectiontypes.setter; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.baeldung.beansinjectiontypes.Car; +import com.baeldung.beansinjectiontypes.Sedan; + +@Configuration(value="setterConfig") +public class Config { + @Bean + public Car car() { + return new Sedan(); + } + + @Bean + public Dealership dealership() { + Dealership dealership = new Dealership(); + dealership.setCar(car()); + return dealership; + } +} diff --git a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/Dealership.java b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/Dealership.java new file mode 100644 index 0000000000..db9c7cbceb --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/Dealership.java @@ -0,0 +1,19 @@ +package com.baeldung.beansinjectiontypes.setter; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.baeldung.beansinjectiontypes.Car; + +@Component(value="setterDealership") +public class Dealership { + private Car car; + + @Autowired + public void setCar(Car car) { + this.car = car; + } + public Car getCar() { + return car; + } +} diff --git a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/HornCheckerFile.java b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/HornCheckerFile.java new file mode 100644 index 0000000000..3372635bd3 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/HornCheckerFile.java @@ -0,0 +1,15 @@ +package com.baeldung.beansinjectiontypes.setter; + +import org.springframework.context.annotation.AnnotationConfigApplicationContext; + +public class HornCheckerFile { + + public static void main(String[] args) { + try (AnnotationConfigApplicationContext context = + new AnnotationConfigApplicationContext(Config.class)) { + Dealership dealership = (Dealership) context.getBean("dealership"); + + dealership.getCar().honk(); + } + } +} diff --git a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/HornCheckerXML.java b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/HornCheckerXML.java new file mode 100644 index 0000000000..0863d16d86 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/HornCheckerXML.java @@ -0,0 +1,15 @@ +package com.baeldung.beansinjectiontypes.setter; + +import org.springframework.context.support.FileSystemXmlApplicationContext; + +public class HornCheckerXML { + + public static void main(String[] args) { + try (FileSystemXmlApplicationContext context = + new FileSystemXmlApplicationContext("src/main/resources/beansinjectiontypes-ctx.xml")) { + Dealership dealership = (Dealership) context.getBean("setterDealership"); + + dealership.getCar().honk(); + } + } +} diff --git a/spring-core/src/main/resources/beansinjectiontypes-ctx.xml b/spring-core/src/main/resources/beansinjectiontypes-ctx.xml new file mode 100644 index 0000000000..86131a83b1 --- /dev/null +++ b/spring-core/src/main/resources/beansinjectiontypes-ctx.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/spring-core/src/test/java/com/baeldung/beansinjectiontypes/BeansInjectionTypesIntegrationTest.java b/spring-core/src/test/java/com/baeldung/beansinjectiontypes/BeansInjectionTypesIntegrationTest.java new file mode 100644 index 0000000000..9ffa44ced7 --- /dev/null +++ b/spring-core/src/test/java/com/baeldung/beansinjectiontypes/BeansInjectionTypesIntegrationTest.java @@ -0,0 +1,56 @@ +package com.baeldung.beansinjectiontypes; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.context.support.FileSystemXmlApplicationContext; + +import com.baeldung.beansinjectiontypes.constructor.Config; +import com.baeldung.beansinjectiontypes.constructor.Dealership; + +public class BeansInjectionTypesIntegrationTest { + + @Test + public void configBean_WhenSetOnConstructor_ThenDependencyValid() { + try (AnnotationConfigApplicationContext context = + new AnnotationConfigApplicationContext(Config.class)) { + Dealership dealership = (Dealership) context.getBean("dealership"); + + assertTrue(dealership.getCar() instanceof Sedan); + } + } + + @Test + public void configBean_WhenSetOnSetter_ThenDependencyValid() { + try (AnnotationConfigApplicationContext context = + new AnnotationConfigApplicationContext(com.baeldung.beansinjectiontypes.setter.Config.class)) { + com.baeldung.beansinjectiontypes.setter.Dealership dealership = + (com.baeldung.beansinjectiontypes.setter.Dealership) context.getBean("dealership"); + + assertTrue(dealership.getCar() instanceof Sedan); + } + } + + @Test + public void annotationAndXML_WhenSetOnSetter_ThenDependencyValid() { + try (FileSystemXmlApplicationContext context = + new FileSystemXmlApplicationContext("src/main/resources/beansinjectiontypes-ctx.xml")) { + Dealership dealership = (Dealership) context.getBean("constructorDealership"); + + assertTrue(dealership.getCar() instanceof Sedan); + } + } + + @Test + public void annotationAndXML_WhenSetOnConstructor_ThenDependencyValid() { + try (FileSystemXmlApplicationContext context = + new FileSystemXmlApplicationContext("src/main/resources/beansinjectiontypes-ctx.xml")) { + com.baeldung.beansinjectiontypes.setter.Dealership dealership = + (com.baeldung.beansinjectiontypes.setter.Dealership) context.getBean("setterDealership"); + + assertTrue(dealership.getCar() instanceof Sedan); + } + } + +} From e792f17f82f863850d07884f4638c53beca7f52f Mon Sep 17 00:00:00 2001 From: alv21 Date: Fri, 2 Mar 2018 18:08:04 +0100 Subject: [PATCH 002/143] BAEL-1585 --- .../com/baeldung/java_8_features/Car.java | 31 +++++++++++++++++++ .../baeldung/java8/Java8MaxMinUnitTest.java | 26 ++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 core-java-8/src/main/java/com/baeldung/java_8_features/Car.java diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/Car.java b/core-java-8/src/main/java/com/baeldung/java_8_features/Car.java new file mode 100644 index 0000000000..139475bc25 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/java_8_features/Car.java @@ -0,0 +1,31 @@ +package com.baeldung.java_8_features; + +public class Car { + + private String model; + private int topSpeed; + + public Car(String model, int topSpeed) { + super(); + this.model = model; + this.topSpeed = topSpeed; + } + + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + public int getTopSpeed() { + return topSpeed; + } + + public void setTopSpeed(int topSpeed) { + this.topSpeed = topSpeed; + } + + +} diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8MaxMinUnitTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8MaxMinUnitTest.java index 4979338452..55caeeba5e 100644 --- a/core-java-8/src/test/java/com/baeldung/java8/Java8MaxMinUnitTest.java +++ b/core-java-8/src/test/java/com/baeldung/java8/Java8MaxMinUnitTest.java @@ -1,6 +1,7 @@ package com.baeldung.java8; import com.baeldung.java_8_features.Person; +import com.baeldung.java_8_features.Car; import org.junit.Test; import java.util.Arrays; @@ -44,4 +45,29 @@ public class Java8MaxMinUnitTest { assertEquals("Should be Alex", alex, minByAge); } + @Test + public void whenArrayIsOfIntegerThenMinCanBeDoneUsingIntegerComparator() { + int[] integers = new int[] { 20, 98, 12, 7, 35 }; + + int min = Arrays.stream(integers) + .min() + .getAsInt(); + + assertEquals(7, min); + } + + @Test + public void whenArrayIsOfPersonObjectThenMaxCanBeDoneUsingCustomComparatorThroughLambda() { + final Car porsche = new Car("Porsche 959", 319); + final Car ferrari = new Car("Ferrari 288 GTO", 303); + final Car bugatti = new Car("Bugatti Veyron 16.4 Super Sport", 415); + final Car mcLaren = new Car("McLaren F1", 355); + final Car[] fastCars = { porsche, ferrari, bugatti, mcLaren }; + + final Car maxBySpeed = Arrays.stream(fastCars) + .max(Comparator.comparing(Car::getTopSpeed)) + .orElseThrow(NoSuchElementException::new); + + assertEquals(bugatti, maxBySpeed); + } } From af542fce4092246ca65e9799260be3bd726f286f Mon Sep 17 00:00:00 2001 From: alv21 Date: Fri, 2 Mar 2018 22:32:37 +0100 Subject: [PATCH 003/143] Revert "Different Types of Bean Injection in Spring" This reverts commit ae47827879d0e9396ad5de5f979f495629a35838. --- .../beansinjectiontypes/Cabriolet.java | 8 --- .../com/baeldung/beansinjectiontypes/Car.java | 6 -- .../DealershipTraditionalStyle.java | 9 --- .../DealershipWithDependenciesInjection.java | 13 ----- .../baeldung/beansinjectiontypes/Sedan.java | 10 ---- .../constructor/Config.java | 20 ------- .../constructor/Dealership.java | 20 ------- .../constructor/HornCheckerFile.java | 15 ----- .../constructor/HornCheckerXML.java | 15 ----- .../beansinjectiontypes/setter/Config.java | 22 -------- .../setter/Dealership.java | 19 ------- .../setter/HornCheckerFile.java | 15 ----- .../setter/HornCheckerXML.java | 15 ----- .../resources/beansinjectiontypes-ctx.xml | 10 ---- .../BeansInjectionTypesIntegrationTest.java | 56 ------------------- 15 files changed, 253 deletions(-) delete mode 100644 spring-core/src/main/java/com/baeldung/beansinjectiontypes/Cabriolet.java delete mode 100644 spring-core/src/main/java/com/baeldung/beansinjectiontypes/Car.java delete mode 100644 spring-core/src/main/java/com/baeldung/beansinjectiontypes/DealershipTraditionalStyle.java delete mode 100644 spring-core/src/main/java/com/baeldung/beansinjectiontypes/DealershipWithDependenciesInjection.java delete mode 100644 spring-core/src/main/java/com/baeldung/beansinjectiontypes/Sedan.java delete mode 100644 spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/Config.java delete mode 100644 spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/Dealership.java delete mode 100644 spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/HornCheckerFile.java delete mode 100644 spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/HornCheckerXML.java delete mode 100644 spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/Config.java delete mode 100644 spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/Dealership.java delete mode 100644 spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/HornCheckerFile.java delete mode 100644 spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/HornCheckerXML.java delete mode 100644 spring-core/src/main/resources/beansinjectiontypes-ctx.xml delete mode 100644 spring-core/src/test/java/com/baeldung/beansinjectiontypes/BeansInjectionTypesIntegrationTest.java diff --git a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/Cabriolet.java b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/Cabriolet.java deleted file mode 100644 index 2bf9b8b954..0000000000 --- a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/Cabriolet.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.beansinjectiontypes; - -public class Cabriolet implements Car{ - - public void honk(){ - System.out.println("I'm a cabriolet!"); - } -} diff --git a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/Car.java b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/Car.java deleted file mode 100644 index e88e218f95..0000000000 --- a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/Car.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.baeldung.beansinjectiontypes; - -public interface Car { - - public void honk(); -} diff --git a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/DealershipTraditionalStyle.java b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/DealershipTraditionalStyle.java deleted file mode 100644 index b917049e41..0000000000 --- a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/DealershipTraditionalStyle.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.baeldung.beansinjectiontypes; - -public class DealershipTraditionalStyle { - private Car car = new Sedan(); - - public Car getCar() { - return car; - } -} diff --git a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/DealershipWithDependenciesInjection.java b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/DealershipWithDependenciesInjection.java deleted file mode 100644 index 9b25e21dc7..0000000000 --- a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/DealershipWithDependenciesInjection.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.baeldung.beansinjectiontypes; - -public class DealershipWithDependenciesInjection { - private Car car; - - public DealershipWithDependenciesInjection(Car car) { - this.car = car; - } - - public Car getCar() { - return car; - } -} diff --git a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/Sedan.java b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/Sedan.java deleted file mode 100644 index 0ae4cf5a40..0000000000 --- a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/Sedan.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.baeldung.beansinjectiontypes; - -import org.springframework.stereotype.Component; - -@Component -public class Sedan implements Car { - public void honk(){ - System.out.println("I'm a sedan!"); - } -} diff --git a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/Config.java b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/Config.java deleted file mode 100644 index 3e2534f892..0000000000 --- a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/Config.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.baeldung.beansinjectiontypes.constructor; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import com.baeldung.beansinjectiontypes.Car; -import com.baeldung.beansinjectiontypes.Sedan; - -@Configuration(value="constructorConfig") -public class Config { - @Bean - public Car car() { - return new Sedan(); - } - - @Bean - public Dealership dealership() { - return new Dealership(car()); - } -} diff --git a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/Dealership.java b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/Dealership.java deleted file mode 100644 index 6151ec8e70..0000000000 --- a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/Dealership.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.baeldung.beansinjectiontypes.constructor; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.baeldung.beansinjectiontypes.Car; - -@Component(value="constructorDealership") -public class Dealership { - private Car car; - - @Autowired - public Dealership(Car car) { - this.car = car; - } - - public Car getCar() { - return car; - } -} diff --git a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/HornCheckerFile.java b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/HornCheckerFile.java deleted file mode 100644 index 924372e3df..0000000000 --- a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/HornCheckerFile.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.beansinjectiontypes.constructor; - -import org.springframework.context.annotation.AnnotationConfigApplicationContext; - -public class HornCheckerFile { - - public static void main(String[] args) { - try (AnnotationConfigApplicationContext context = - new AnnotationConfigApplicationContext(Config.class)) { - Dealership dealership = (Dealership) context.getBean("dealership"); - - dealership.getCar().honk(); - } - } -} diff --git a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/HornCheckerXML.java b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/HornCheckerXML.java deleted file mode 100644 index 3c035986e6..0000000000 --- a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/constructor/HornCheckerXML.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.beansinjectiontypes.constructor; - -import org.springframework.context.support.FileSystemXmlApplicationContext; - -public class HornCheckerXML { - - public static void main(String[] args) { - try (FileSystemXmlApplicationContext context = - new FileSystemXmlApplicationContext("src/main/resources/beansinjectiontypes-ctx.xml")) { - Dealership dealership = (Dealership) context.getBean("constructorDealership"); - - dealership.getCar().honk(); - } - } -} diff --git a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/Config.java b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/Config.java deleted file mode 100644 index 212d303ce7..0000000000 --- a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/Config.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baeldung.beansinjectiontypes.setter; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import com.baeldung.beansinjectiontypes.Car; -import com.baeldung.beansinjectiontypes.Sedan; - -@Configuration(value="setterConfig") -public class Config { - @Bean - public Car car() { - return new Sedan(); - } - - @Bean - public Dealership dealership() { - Dealership dealership = new Dealership(); - dealership.setCar(car()); - return dealership; - } -} diff --git a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/Dealership.java b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/Dealership.java deleted file mode 100644 index db9c7cbceb..0000000000 --- a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/Dealership.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.baeldung.beansinjectiontypes.setter; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.baeldung.beansinjectiontypes.Car; - -@Component(value="setterDealership") -public class Dealership { - private Car car; - - @Autowired - public void setCar(Car car) { - this.car = car; - } - public Car getCar() { - return car; - } -} diff --git a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/HornCheckerFile.java b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/HornCheckerFile.java deleted file mode 100644 index 3372635bd3..0000000000 --- a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/HornCheckerFile.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.beansinjectiontypes.setter; - -import org.springframework.context.annotation.AnnotationConfigApplicationContext; - -public class HornCheckerFile { - - public static void main(String[] args) { - try (AnnotationConfigApplicationContext context = - new AnnotationConfigApplicationContext(Config.class)) { - Dealership dealership = (Dealership) context.getBean("dealership"); - - dealership.getCar().honk(); - } - } -} diff --git a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/HornCheckerXML.java b/spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/HornCheckerXML.java deleted file mode 100644 index 0863d16d86..0000000000 --- a/spring-core/src/main/java/com/baeldung/beansinjectiontypes/setter/HornCheckerXML.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.beansinjectiontypes.setter; - -import org.springframework.context.support.FileSystemXmlApplicationContext; - -public class HornCheckerXML { - - public static void main(String[] args) { - try (FileSystemXmlApplicationContext context = - new FileSystemXmlApplicationContext("src/main/resources/beansinjectiontypes-ctx.xml")) { - Dealership dealership = (Dealership) context.getBean("setterDealership"); - - dealership.getCar().honk(); - } - } -} diff --git a/spring-core/src/main/resources/beansinjectiontypes-ctx.xml b/spring-core/src/main/resources/beansinjectiontypes-ctx.xml deleted file mode 100644 index 86131a83b1..0000000000 --- a/spring-core/src/main/resources/beansinjectiontypes-ctx.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/spring-core/src/test/java/com/baeldung/beansinjectiontypes/BeansInjectionTypesIntegrationTest.java b/spring-core/src/test/java/com/baeldung/beansinjectiontypes/BeansInjectionTypesIntegrationTest.java deleted file mode 100644 index 9ffa44ced7..0000000000 --- a/spring-core/src/test/java/com/baeldung/beansinjectiontypes/BeansInjectionTypesIntegrationTest.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.baeldung.beansinjectiontypes; - -import static org.junit.Assert.assertTrue; - -import org.junit.Test; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.springframework.context.support.FileSystemXmlApplicationContext; - -import com.baeldung.beansinjectiontypes.constructor.Config; -import com.baeldung.beansinjectiontypes.constructor.Dealership; - -public class BeansInjectionTypesIntegrationTest { - - @Test - public void configBean_WhenSetOnConstructor_ThenDependencyValid() { - try (AnnotationConfigApplicationContext context = - new AnnotationConfigApplicationContext(Config.class)) { - Dealership dealership = (Dealership) context.getBean("dealership"); - - assertTrue(dealership.getCar() instanceof Sedan); - } - } - - @Test - public void configBean_WhenSetOnSetter_ThenDependencyValid() { - try (AnnotationConfigApplicationContext context = - new AnnotationConfigApplicationContext(com.baeldung.beansinjectiontypes.setter.Config.class)) { - com.baeldung.beansinjectiontypes.setter.Dealership dealership = - (com.baeldung.beansinjectiontypes.setter.Dealership) context.getBean("dealership"); - - assertTrue(dealership.getCar() instanceof Sedan); - } - } - - @Test - public void annotationAndXML_WhenSetOnSetter_ThenDependencyValid() { - try (FileSystemXmlApplicationContext context = - new FileSystemXmlApplicationContext("src/main/resources/beansinjectiontypes-ctx.xml")) { - Dealership dealership = (Dealership) context.getBean("constructorDealership"); - - assertTrue(dealership.getCar() instanceof Sedan); - } - } - - @Test - public void annotationAndXML_WhenSetOnConstructor_ThenDependencyValid() { - try (FileSystemXmlApplicationContext context = - new FileSystemXmlApplicationContext("src/main/resources/beansinjectiontypes-ctx.xml")) { - com.baeldung.beansinjectiontypes.setter.Dealership dealership = - (com.baeldung.beansinjectiontypes.setter.Dealership) context.getBean("setterDealership"); - - assertTrue(dealership.getCar() instanceof Sedan); - } - } - -} From c7fbcd217ce6abe93d5dabafad98cc5007adf5ed Mon Sep 17 00:00:00 2001 From: alv21 Date: Fri, 2 Mar 2018 22:38:52 +0100 Subject: [PATCH 004/143] Revert "BAEL-1585" This reverts commit e792f17f82f863850d07884f4638c53beca7f52f. --- .../com/baeldung/java_8_features/Car.java | 31 ------------------- .../baeldung/java8/Java8MaxMinUnitTest.java | 26 ---------------- 2 files changed, 57 deletions(-) delete mode 100644 core-java-8/src/main/java/com/baeldung/java_8_features/Car.java diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/Car.java b/core-java-8/src/main/java/com/baeldung/java_8_features/Car.java deleted file mode 100644 index 139475bc25..0000000000 --- a/core-java-8/src/main/java/com/baeldung/java_8_features/Car.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.baeldung.java_8_features; - -public class Car { - - private String model; - private int topSpeed; - - public Car(String model, int topSpeed) { - super(); - this.model = model; - this.topSpeed = topSpeed; - } - - public String getModel() { - return model; - } - - public void setModel(String model) { - this.model = model; - } - - public int getTopSpeed() { - return topSpeed; - } - - public void setTopSpeed(int topSpeed) { - this.topSpeed = topSpeed; - } - - -} diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8MaxMinUnitTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8MaxMinUnitTest.java index 55caeeba5e..4979338452 100644 --- a/core-java-8/src/test/java/com/baeldung/java8/Java8MaxMinUnitTest.java +++ b/core-java-8/src/test/java/com/baeldung/java8/Java8MaxMinUnitTest.java @@ -1,7 +1,6 @@ package com.baeldung.java8; import com.baeldung.java_8_features.Person; -import com.baeldung.java_8_features.Car; import org.junit.Test; import java.util.Arrays; @@ -45,29 +44,4 @@ public class Java8MaxMinUnitTest { assertEquals("Should be Alex", alex, minByAge); } - @Test - public void whenArrayIsOfIntegerThenMinCanBeDoneUsingIntegerComparator() { - int[] integers = new int[] { 20, 98, 12, 7, 35 }; - - int min = Arrays.stream(integers) - .min() - .getAsInt(); - - assertEquals(7, min); - } - - @Test - public void whenArrayIsOfPersonObjectThenMaxCanBeDoneUsingCustomComparatorThroughLambda() { - final Car porsche = new Car("Porsche 959", 319); - final Car ferrari = new Car("Ferrari 288 GTO", 303); - final Car bugatti = new Car("Bugatti Veyron 16.4 Super Sport", 415); - final Car mcLaren = new Car("McLaren F1", 355); - final Car[] fastCars = { porsche, ferrari, bugatti, mcLaren }; - - final Car maxBySpeed = Arrays.stream(fastCars) - .max(Comparator.comparing(Car::getTopSpeed)) - .orElseThrow(NoSuchElementException::new); - - assertEquals(bugatti, maxBySpeed); - } } From 8e2c1ba4000cf4e25afbfb9fb826612989b88a88 Mon Sep 17 00:00:00 2001 From: Chirag Dewan Date: Sat, 15 Dec 2018 16:05:16 +0530 Subject: [PATCH 005/143] BAEL-2100 Custom Lombok Annotation --- lombok-custom/pom.xml | 58 ++++++++ .../com/baeldung/singleton/Singleton.java | 10 ++ .../handlers/SingletonEclipseHandler.java | 124 ++++++++++++++++++ .../handlers/SingletonJavacHandler.java | 108 +++++++++++++++ pom.xml | 5 +- 5 files changed, 304 insertions(+), 1 deletion(-) create mode 100644 lombok-custom/pom.xml create mode 100644 lombok-custom/src/main/java/com/baeldung/singleton/Singleton.java create mode 100644 lombok-custom/src/main/java/com/baeldung/singleton/handlers/SingletonEclipseHandler.java create mode 100644 lombok-custom/src/main/java/com/baeldung/singleton/handlers/SingletonJavacHandler.java diff --git a/lombok-custom/pom.xml b/lombok-custom/pom.xml new file mode 100644 index 0000000000..41bd042a5e --- /dev/null +++ b/lombok-custom/pom.xml @@ -0,0 +1,58 @@ + + + + parent-modules + com.baeldung + 1.0.0-SNAPSHOT + + + 4.0.0 + lombok-custom + 0.1-SNAPSHOT + + + + org.projectlombok + lombok + 1.14.8 + provided + + + + org.kohsuke.metainf-services + metainf-services + 1.8 + + + + org.eclipse.jdt + core + 3.3.0-v_771 + + + + + + default-tools.jar + + + java.vendor + Oracle Corporation + + + + + com.sun + tools + ${java.version} + system + ${java.home}/../lib/tools.jar + + + + + + + \ No newline at end of file diff --git a/lombok-custom/src/main/java/com/baeldung/singleton/Singleton.java b/lombok-custom/src/main/java/com/baeldung/singleton/Singleton.java new file mode 100644 index 0000000000..2d2fd0ffb9 --- /dev/null +++ b/lombok-custom/src/main/java/com/baeldung/singleton/Singleton.java @@ -0,0 +1,10 @@ +package com.baeldung.singleton; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +@Target(ElementType.TYPE) +public @interface Singleton { + + +} diff --git a/lombok-custom/src/main/java/com/baeldung/singleton/handlers/SingletonEclipseHandler.java b/lombok-custom/src/main/java/com/baeldung/singleton/handlers/SingletonEclipseHandler.java new file mode 100644 index 0000000000..03cdd707a4 --- /dev/null +++ b/lombok-custom/src/main/java/com/baeldung/singleton/handlers/SingletonEclipseHandler.java @@ -0,0 +1,124 @@ +package com.baeldung.singleton.handlers; + +import com.baeldung.singleton.Singleton; +import lombok.core.AnnotationValues; +import lombok.eclipse.EclipseAnnotationHandler; +import lombok.eclipse.EclipseNode; +import lombok.eclipse.handlers.EclipseHandlerUtil; +import org.eclipse.jdt.internal.compiler.ast.AllocationExpression; +import org.eclipse.jdt.internal.compiler.ast.Annotation; +import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration; +import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration; +import org.eclipse.jdt.internal.compiler.ast.FieldReference; +import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration; +import org.eclipse.jdt.internal.compiler.ast.ReturnStatement; +import org.eclipse.jdt.internal.compiler.ast.SingleNameReference; +import org.eclipse.jdt.internal.compiler.ast.Statement; +import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; +import org.eclipse.jdt.internal.compiler.ast.TypeReference; +import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; +import org.kohsuke.MetaInfServices; + +import static lombok.eclipse.Eclipse.ECLIPSE_DO_NOT_TOUCH_FLAG; +import static org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants.AccFinal; +import static org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants.AccPrivate; +import static org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants.AccStatic; + +@MetaInfServices(EclipseAnnotationHandler.class) +public class SingletonEclipseHandler extends EclipseAnnotationHandler { + + + @Override + public void handle(AnnotationValues annotation, Annotation ast, EclipseNode annotationNode) { + + //remove annotation + EclipseHandlerUtil.unboxAndRemoveAnnotationParameter(ast, "onType", "@Singleton(onType=", annotationNode); + + //add private constructor + EclipseNode singletonClass = annotationNode.up(); + + TypeDeclaration singletonClassType = (TypeDeclaration) singletonClass.get(); + ConstructorDeclaration constructor = addConstructor(singletonClass, singletonClassType); + + TypeReference singletonTypeRef = EclipseHandlerUtil.cloneSelfType(singletonClass, singletonClassType); + + //add inner class + + //add instance field + StringBuilder sb = new StringBuilder(); + sb.append(singletonClass.getName()); + sb.append("Holder"); + String innerClassName = sb.toString(); + TypeDeclaration innerClass = new TypeDeclaration(singletonClassType.compilationResult); + innerClass.modifiers = AccPrivate | AccStatic; + innerClass.name = innerClassName.toCharArray(); + + FieldDeclaration instanceVar = addInstanceVar(constructor, singletonTypeRef, innerClass); + + FieldDeclaration[] declarations = new FieldDeclaration[]{instanceVar}; + innerClass.fields = declarations; + + EclipseHandlerUtil.injectType(singletonClass, innerClass); + + addFactoryMethod(singletonClass, singletonClassType, singletonTypeRef, innerClass, instanceVar); + + + } + + private void addFactoryMethod(EclipseNode singletonClass, TypeDeclaration astNode, TypeReference typeReference, TypeDeclaration innerClass, FieldDeclaration field) { + MethodDeclaration factoryMethod = new MethodDeclaration(astNode.compilationResult); + factoryMethod.modifiers = AccStatic | ClassFileConstants.AccPublic; + factoryMethod.returnType = typeReference; + factoryMethod.sourceStart = astNode.sourceStart; + factoryMethod.sourceEnd = astNode.sourceEnd; + factoryMethod.selector = "getInstance".toCharArray(); + factoryMethod.bits = ECLIPSE_DO_NOT_TOUCH_FLAG; + + long pS = factoryMethod.sourceStart; + long pE = factoryMethod.sourceEnd; + long p = (long) pS << 32 | pE; + + FieldReference ref = new FieldReference(field.name, p); + ref.receiver = new SingleNameReference(innerClass.name, p); + + ReturnStatement statement = new ReturnStatement(ref, astNode.sourceStart, astNode.sourceEnd); + + factoryMethod.statements = new Statement[]{statement}; + + EclipseHandlerUtil.injectMethod(singletonClass, factoryMethod); + } + + private FieldDeclaration addInstanceVar(ConstructorDeclaration constructor, TypeReference typeReference, TypeDeclaration innerClass) { + FieldDeclaration field = new FieldDeclaration(); + field.modifiers = AccPrivate | AccStatic | AccFinal; + field.name = "INSTANCE".toCharArray(); + + field.type = typeReference; + + AllocationExpression exp = new AllocationExpression(); + exp.type = typeReference; + exp.binding = constructor.binding; + exp.sourceStart = innerClass.sourceStart; + exp.sourceEnd = innerClass.sourceEnd; + + field.initialization = exp; + return field; + } + + private ConstructorDeclaration addConstructor(EclipseNode singletonClass, TypeDeclaration astNode) { + ConstructorDeclaration constructor = new ConstructorDeclaration(astNode.compilationResult); + constructor.modifiers = AccPrivate; + constructor.selector = astNode.name; + constructor.sourceStart = astNode.sourceStart; + constructor.sourceEnd = astNode.sourceEnd; + constructor.thrownExceptions = null; + constructor.typeParameters = null; + constructor.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG; + constructor.bodyStart = constructor.declarationSourceStart = constructor.sourceStart = astNode.sourceStart; + constructor.bodyEnd = constructor.declarationSourceEnd = constructor.sourceEnd = astNode.sourceEnd; + constructor.arguments = null; + + EclipseHandlerUtil.injectMethod(singletonClass, constructor); + return constructor; + } +} diff --git a/lombok-custom/src/main/java/com/baeldung/singleton/handlers/SingletonJavacHandler.java b/lombok-custom/src/main/java/com/baeldung/singleton/handlers/SingletonJavacHandler.java new file mode 100644 index 0000000000..1f4cf0ea58 --- /dev/null +++ b/lombok-custom/src/main/java/com/baeldung/singleton/handlers/SingletonJavacHandler.java @@ -0,0 +1,108 @@ +package com.baeldung.singleton.handlers; + +import com.baeldung.singleton.Singleton; +import com.sun.tools.javac.code.Flags; +import com.sun.tools.javac.tree.JCTree; +import com.sun.tools.javac.util.Context; +import com.sun.tools.javac.util.List; +import com.sun.tools.javac.util.ListBuffer; +import lombok.core.AnnotationValues; +import lombok.javac.Javac8BasedLombokOptions; +import lombok.javac.JavacAnnotationHandler; +import lombok.javac.JavacNode; +import lombok.javac.JavacTreeMaker; +import lombok.javac.handlers.JavacHandlerUtil; +import org.kohsuke.MetaInfServices; + +import static lombok.javac.handlers.JavacHandlerUtil.deleteAnnotationIfNeccessary; +import static lombok.javac.handlers.JavacHandlerUtil.deleteImportFromCompilationUnit; + +@MetaInfServices(JavacAnnotationHandler.class) +public class SingletonJavacHandler extends JavacAnnotationHandler { + + @Override + public void handle(AnnotationValues annotation, JCTree.JCAnnotation ast, JavacNode annotationNode) { + + Context context = annotationNode.getContext(); + + Javac8BasedLombokOptions options = Javac8BasedLombokOptions.replaceWithDelombokOptions(context); + options.deleteLombokAnnotations(); + + //remove annotation + deleteAnnotationIfNeccessary(annotationNode, Singleton.class); + //remove import + deleteImportFromCompilationUnit(annotationNode, "lombok.AccessLevel"); + + //private constructor + JavacNode singletonClass = annotationNode.up(); + JavacTreeMaker singletonClassTreeMaker = singletonClass.getTreeMaker(); + + addPrivateConstructor(singletonClass, singletonClassTreeMaker); + + //singleton holder + JavacNode holderInnerClass = addInnerClass(singletonClass, singletonClassTreeMaker); + + //inject static field to this + addInstanceVar(singletonClass, singletonClassTreeMaker, holderInnerClass); + + //add factory method + addFactoryMethod(singletonClass, singletonClassTreeMaker, holderInnerClass); + } + + private void addFactoryMethod(JavacNode singletonClass, JavacTreeMaker singletonClassTreeMaker, JavacNode holderInnerClass) { + JCTree.JCModifiers modifiers = singletonClassTreeMaker.Modifiers(Flags.PUBLIC | Flags.STATIC); + + JCTree.JCClassDecl singletonClassDecl = (JCTree.JCClassDecl) singletonClass.get(); + JCTree.JCIdent singletonClassType = singletonClassTreeMaker.Ident(singletonClassDecl.name); + + JCTree.JCBlock block = addReturnBlock(singletonClassTreeMaker, holderInnerClass); + + JCTree.JCMethodDecl factoryMethod = singletonClassTreeMaker.MethodDef(modifiers, singletonClass.toName("getInstance"), singletonClassType, List.nil(), List.nil(), List.nil(), block, null); + JavacHandlerUtil.injectMethod(singletonClass, factoryMethod); + } + + private JCTree.JCBlock addReturnBlock(JavacTreeMaker singletonClassTreeMaker, JavacNode holderInnerClass) { + + JCTree.JCClassDecl holderInnerClassDecl = (JCTree.JCClassDecl) holderInnerClass.get(); + JavacTreeMaker holderInnerClassTreeMaker = holderInnerClass.getTreeMaker(); + JCTree.JCIdent holderInnerClassType = holderInnerClassTreeMaker.Ident(holderInnerClassDecl.name); + + JCTree.JCFieldAccess instanceVarAccess = holderInnerClassTreeMaker.Select(holderInnerClassType, holderInnerClass.toName("INSTANCE")); + JCTree.JCReturn returnValue = singletonClassTreeMaker.Return(instanceVarAccess); + + ListBuffer statements = new ListBuffer<>(); + statements.append(returnValue); + + return singletonClassTreeMaker.Block(0L, statements.toList()); + } + + + private void addInstanceVar(JavacNode singletonClass, JavacTreeMaker singletonClassTM, JavacNode holderClass) { + JCTree.JCModifiers fieldMod = singletonClassTM.Modifiers(Flags.PRIVATE | Flags.STATIC | Flags.FINAL); + + JCTree.JCClassDecl singletonClassDecl = (JCTree.JCClassDecl) singletonClass.get(); + JCTree.JCIdent singletonClassType = singletonClassTM.Ident(singletonClassDecl.name); + + JCTree.JCNewClass newKeyword = singletonClassTM.NewClass(null, List.nil(), singletonClassType, List.nil(), null); + + JCTree.JCVariableDecl instanceVar = singletonClassTM.VarDef(fieldMod, singletonClass.toName("INSTANCE"), singletonClassType, newKeyword); + JavacHandlerUtil.injectField(holderClass, instanceVar); + } + + private JavacNode addInnerClass(JavacNode singletonClass, JavacTreeMaker singletonTM) { + JCTree.JCModifiers modifiers = singletonTM.Modifiers(Flags.PRIVATE | Flags.STATIC); + String innerClassName = singletonClass.getName() + "Holder"; + JCTree.JCClassDecl innerClassDecl = singletonTM.ClassDef(modifiers, singletonClass.toName(innerClassName), List.nil(), null, List.nil(), List.nil()); + return JavacHandlerUtil.injectType(singletonClass, innerClassDecl); + } + + private void addPrivateConstructor(JavacNode singletonClass, JavacTreeMaker singletonTM) { + JCTree.JCModifiers modifiers = singletonTM.Modifiers(Flags.PRIVATE); + JCTree.JCBlock block = singletonTM.Block(0L, List.nil()); + JCTree.JCMethodDecl constructor = singletonTM.MethodDef(modifiers, singletonClass.toName(""), null, List.nil(), List.nil(), List.nil(), block, null); + + JavacHandlerUtil.injectMethod(singletonClass, constructor); + } + + +} diff --git a/pom.xml b/pom.xml index 99dae9decb..03a66080c2 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,10 @@ com.baeldung parent-modules 1.0.0-SNAPSHOT - parent-modules + + lombok-custom + + parent-modules pom From 8880d96d3a0c6c5dcdc0f188756d89543fec7481 Mon Sep 17 00:00:00 2001 From: codehunter34 Date: Sun, 23 Dec 2018 16:41:11 -0500 Subject: [PATCH 006/143] BAEL-2399: Guice vs Spring - Dependency Injection --- .../com/baeldung/examples/common/Account.java | 27 +++++++ .../examples/common/AccountService.java | 8 +++ .../examples/common/AccountServiceImpl.java | 15 ++++ .../com/baeldung/examples/common/Address.java | 35 +++++++++ .../baeldung/examples/common/BookService.java | 9 +++ .../examples/common/BookServiceImpl.java | 12 ++++ .../com/baeldung/examples/guice/Employee.java | 32 +++++++++ .../java/com/baeldung/examples/guice/Foo.java | 5 ++ .../baeldung/examples/guice/FooGenerator.java | 11 +++ .../baeldung/examples/guice/GuiceUser.java | 32 +++++++++ .../examples/guice/GuiceUserService.java | 19 +++++ .../com/baeldung/examples/guice/Person.java | 39 ++++++++++ .../examples/guice/modules/GuiceModule.java | 47 ++++++++++++ .../baeldung/examples/spring/AppConfig.java | 19 +++++ .../baeldung/examples/spring/SpringUser.java | 35 +++++++++ .../com/baeldung/examples/spring/Student.java | 34 +++++++++ .../baeldung/examples/spring/UserService.java | 22 ++++++ .../com/baeldung/examples/GuiceTests.java | 72 +++++++++++++++++++ .../com/baeldung/examples/SpringTests.java | 58 +++++++++++++++ 19 files changed, 531 insertions(+) create mode 100644 guice/src/main/java/com/baeldung/examples/common/Account.java create mode 100644 guice/src/main/java/com/baeldung/examples/common/AccountService.java create mode 100644 guice/src/main/java/com/baeldung/examples/common/AccountServiceImpl.java create mode 100644 guice/src/main/java/com/baeldung/examples/common/Address.java create mode 100644 guice/src/main/java/com/baeldung/examples/common/BookService.java create mode 100644 guice/src/main/java/com/baeldung/examples/common/BookServiceImpl.java create mode 100644 guice/src/main/java/com/baeldung/examples/guice/Employee.java create mode 100644 guice/src/main/java/com/baeldung/examples/guice/Foo.java create mode 100644 guice/src/main/java/com/baeldung/examples/guice/FooGenerator.java create mode 100644 guice/src/main/java/com/baeldung/examples/guice/GuiceUser.java create mode 100644 guice/src/main/java/com/baeldung/examples/guice/GuiceUserService.java create mode 100644 guice/src/main/java/com/baeldung/examples/guice/Person.java create mode 100644 guice/src/main/java/com/baeldung/examples/guice/modules/GuiceModule.java create mode 100644 guice/src/main/java/com/baeldung/examples/spring/AppConfig.java create mode 100644 guice/src/main/java/com/baeldung/examples/spring/SpringUser.java create mode 100644 guice/src/main/java/com/baeldung/examples/spring/Student.java create mode 100644 guice/src/main/java/com/baeldung/examples/spring/UserService.java create mode 100644 guice/src/test/java/com/baeldung/examples/GuiceTests.java create mode 100644 guice/src/test/java/com/baeldung/examples/SpringTests.java diff --git a/guice/src/main/java/com/baeldung/examples/common/Account.java b/guice/src/main/java/com/baeldung/examples/common/Account.java new file mode 100644 index 0000000000..09a9d80b6a --- /dev/null +++ b/guice/src/main/java/com/baeldung/examples/common/Account.java @@ -0,0 +1,27 @@ +package com.baeldung.examples.common; + +import org.springframework.stereotype.Component; + +@Component +public class Account { + + private String accountNumber; + private String type; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + +} diff --git a/guice/src/main/java/com/baeldung/examples/common/AccountService.java b/guice/src/main/java/com/baeldung/examples/common/AccountService.java new file mode 100644 index 0000000000..d6a7fe1d11 --- /dev/null +++ b/guice/src/main/java/com/baeldung/examples/common/AccountService.java @@ -0,0 +1,8 @@ +package com.baeldung.examples.common; + +import java.util.List; + +public interface AccountService { + public List listAccountTypes(); + +} diff --git a/guice/src/main/java/com/baeldung/examples/common/AccountServiceImpl.java b/guice/src/main/java/com/baeldung/examples/common/AccountServiceImpl.java new file mode 100644 index 0000000000..9cecf021fe --- /dev/null +++ b/guice/src/main/java/com/baeldung/examples/common/AccountServiceImpl.java @@ -0,0 +1,15 @@ +package com.baeldung.examples.common; + +import java.util.Arrays; +import java.util.List; + +import org.springframework.stereotype.Component; + +@Component +public class AccountServiceImpl implements AccountService { + + public List listAccountTypes() { + return Arrays.asList("Checking", "Saving"); + } + +} diff --git a/guice/src/main/java/com/baeldung/examples/common/Address.java b/guice/src/main/java/com/baeldung/examples/common/Address.java new file mode 100644 index 0000000000..3b07c47011 --- /dev/null +++ b/guice/src/main/java/com/baeldung/examples/common/Address.java @@ -0,0 +1,35 @@ +package com.baeldung.examples.common; + +import org.springframework.stereotype.Component; + +@Component +public class Address { + private String city; + private String state; + private String county; + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public String getCounty() { + return county; + } + + public void setCounty(String county) { + this.county = county; + } + +} diff --git a/guice/src/main/java/com/baeldung/examples/common/BookService.java b/guice/src/main/java/com/baeldung/examples/common/BookService.java new file mode 100644 index 0000000000..3aca9d90d7 --- /dev/null +++ b/guice/src/main/java/com/baeldung/examples/common/BookService.java @@ -0,0 +1,9 @@ +package com.baeldung.examples.common; + +import java.util.List; + +public interface BookService { + + public List findBestSellerBooks(); + +} diff --git a/guice/src/main/java/com/baeldung/examples/common/BookServiceImpl.java b/guice/src/main/java/com/baeldung/examples/common/BookServiceImpl.java new file mode 100644 index 0000000000..b5499c678d --- /dev/null +++ b/guice/src/main/java/com/baeldung/examples/common/BookServiceImpl.java @@ -0,0 +1,12 @@ +package com.baeldung.examples.common; + +import java.util.Arrays; +import java.util.List; + +public class BookServiceImpl implements BookService { + + public List findBestSellerBooks() { + return Arrays.asList("Harry Potter", "Lord of The Rings"); + } + +} diff --git a/guice/src/main/java/com/baeldung/examples/guice/Employee.java b/guice/src/main/java/com/baeldung/examples/guice/Employee.java new file mode 100644 index 0000000000..b85d251a05 --- /dev/null +++ b/guice/src/main/java/com/baeldung/examples/guice/Employee.java @@ -0,0 +1,32 @@ +package com.baeldung.examples.guice; + +import com.google.inject.Inject; + +public class Employee { + + private String firstName; + private String lastName; + + @Inject + public Employee(String firstName) { + this.firstName = firstName; + this.lastName = "Default"; + } + + 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; + } + +} diff --git a/guice/src/main/java/com/baeldung/examples/guice/Foo.java b/guice/src/main/java/com/baeldung/examples/guice/Foo.java new file mode 100644 index 0000000000..a4f22a6f69 --- /dev/null +++ b/guice/src/main/java/com/baeldung/examples/guice/Foo.java @@ -0,0 +1,5 @@ +package com.baeldung.examples.guice; + + +public class Foo { +} diff --git a/guice/src/main/java/com/baeldung/examples/guice/FooGenerator.java b/guice/src/main/java/com/baeldung/examples/guice/FooGenerator.java new file mode 100644 index 0000000000..b2d3309d0e --- /dev/null +++ b/guice/src/main/java/com/baeldung/examples/guice/FooGenerator.java @@ -0,0 +1,11 @@ +package com.baeldung.examples.guice; + +import org.springframework.lang.Nullable; + +import com.google.inject.Inject; + +public class FooGenerator { + @Inject + public FooGenerator(@Nullable Foo foo) { + } +} \ No newline at end of file diff --git a/guice/src/main/java/com/baeldung/examples/guice/GuiceUser.java b/guice/src/main/java/com/baeldung/examples/guice/GuiceUser.java new file mode 100644 index 0000000000..df438add5b --- /dev/null +++ b/guice/src/main/java/com/baeldung/examples/guice/GuiceUser.java @@ -0,0 +1,32 @@ +package com.baeldung.examples.guice; + +import com.baeldung.examples.common.Account; +import com.baeldung.examples.common.Address; +import com.google.inject.Inject; + +public class GuiceUser { + + @Inject + private Account account; + + private Address address; + + public Account getAccount() { + return account; + } + + public void setAccount(Account account) { + this.account = account; + } + + public Address getAddress() { + return address; + } + + @Inject + public void setAddress(Address address) { + this.address = address; + address.setCity("Default"); + } + +} diff --git a/guice/src/main/java/com/baeldung/examples/guice/GuiceUserService.java b/guice/src/main/java/com/baeldung/examples/guice/GuiceUserService.java new file mode 100644 index 0000000000..18cb076661 --- /dev/null +++ b/guice/src/main/java/com/baeldung/examples/guice/GuiceUserService.java @@ -0,0 +1,19 @@ +package com.baeldung.examples.guice; + +import com.baeldung.examples.common.AccountService; +import com.google.inject.Inject; + +public class GuiceUserService { + + @Inject + private AccountService accountService; + + public AccountService getAccountService() { + return accountService; + } + + public void setAccountService(AccountService accountService) { + this.accountService = accountService; + } + +} diff --git a/guice/src/main/java/com/baeldung/examples/guice/Person.java b/guice/src/main/java/com/baeldung/examples/guice/Person.java new file mode 100644 index 0000000000..45ee5f4b89 --- /dev/null +++ b/guice/src/main/java/com/baeldung/examples/guice/Person.java @@ -0,0 +1,39 @@ +package com.baeldung.examples.guice; + +import com.baeldung.examples.common.Address; +import com.google.inject.Inject; + +public class Person { + private String firstName; + + private String lastName; + + private Address address; + + 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 Address getAddress() { + return address; + } + + @Inject + public void setAddress(Address address) { + this.address = address; + address.setCity("Default"); + } + +} diff --git a/guice/src/main/java/com/baeldung/examples/guice/modules/GuiceModule.java b/guice/src/main/java/com/baeldung/examples/guice/modules/GuiceModule.java new file mode 100644 index 0000000000..44b566240e --- /dev/null +++ b/guice/src/main/java/com/baeldung/examples/guice/modules/GuiceModule.java @@ -0,0 +1,47 @@ +package com.baeldung.examples.guice.modules; + +import com.baeldung.examples.common.AccountService; +import com.baeldung.examples.common.AccountServiceImpl; +import com.baeldung.examples.common.BookService; +import com.baeldung.examples.common.BookServiceImpl; +import com.baeldung.examples.guice.Foo; +import com.baeldung.examples.guice.Person; +import com.google.inject.AbstractModule; +import com.google.inject.Provider; +import com.google.inject.Provides; + +public class GuiceModule extends AbstractModule { + + @Override + protected void configure() { + try { + bind(AccountService.class).to(AccountServiceImpl.class); + bind(Foo.class).toProvider(new Provider() { + public Foo get() { + return null; + } + }); + + bind(Person.class).toConstructor(Person.class.getConstructor()); + // bind(Person.class).toProvider(new Provider() { + // public Person get() { + // Person p = new Person(); + // return p; + // } + // }); + } catch (NoSuchMethodException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (SecurityException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + @Provides + public BookService bookServiceGenerator() { + return new BookServiceImpl(); + } + +} diff --git a/guice/src/main/java/com/baeldung/examples/spring/AppConfig.java b/guice/src/main/java/com/baeldung/examples/spring/AppConfig.java new file mode 100644 index 0000000000..e5b6648e0d --- /dev/null +++ b/guice/src/main/java/com/baeldung/examples/spring/AppConfig.java @@ -0,0 +1,19 @@ +package com.baeldung.examples.spring; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +import com.baeldung.examples.common.BookService; +import com.baeldung.examples.common.BookServiceImpl; + +@Configuration +@ComponentScan("com.baeldung.examples") +public class AppConfig { + + @Bean + public BookService bookServiceGenerator() { + return new BookServiceImpl(); + } + +} diff --git a/guice/src/main/java/com/baeldung/examples/spring/SpringUser.java b/guice/src/main/java/com/baeldung/examples/spring/SpringUser.java new file mode 100644 index 0000000000..ba6aaab09b --- /dev/null +++ b/guice/src/main/java/com/baeldung/examples/spring/SpringUser.java @@ -0,0 +1,35 @@ +package com.baeldung.examples.spring; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.baeldung.examples.common.Account; +import com.baeldung.examples.common.Address; + +@Component +public class SpringUser { + + @Autowired + private Account account; + + private Address address; + + public Account getAccount() { + return account; + } + + public void setAccount(Account account) { + this.account = account; + } + + public Address getAddress() { + return address; + } + + @Autowired + public void setAddress(Address address) { + this.address = address; + address.setCity("Default"); + } + +} diff --git a/guice/src/main/java/com/baeldung/examples/spring/Student.java b/guice/src/main/java/com/baeldung/examples/spring/Student.java new file mode 100644 index 0000000000..d8b61a91ef --- /dev/null +++ b/guice/src/main/java/com/baeldung/examples/spring/Student.java @@ -0,0 +1,34 @@ +package com.baeldung.examples.spring; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +@Component +public class Student { + private String firstName; + private String lastName; + + @Autowired + public Student(@Value("Default") String firstName, @Value("Default") String lastName) { + this.firstName = firstName; + this.lastName = lastName; + } + + 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; + } + +} diff --git a/guice/src/main/java/com/baeldung/examples/spring/UserService.java b/guice/src/main/java/com/baeldung/examples/spring/UserService.java new file mode 100644 index 0000000000..91b95c100d --- /dev/null +++ b/guice/src/main/java/com/baeldung/examples/spring/UserService.java @@ -0,0 +1,22 @@ +package com.baeldung.examples.spring; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.baeldung.examples.common.AccountService; + +@Component +public class UserService { + + @Autowired + private AccountService accountService; + + public AccountService getAccountService() { + return accountService; + } + + public void setAccountService(AccountService accountService) { + this.accountService = accountService; + } + +} diff --git a/guice/src/test/java/com/baeldung/examples/GuiceTests.java b/guice/src/test/java/com/baeldung/examples/GuiceTests.java new file mode 100644 index 0000000000..b87289a1a4 --- /dev/null +++ b/guice/src/test/java/com/baeldung/examples/GuiceTests.java @@ -0,0 +1,72 @@ +package com.baeldung.examples; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; + +import com.baeldung.examples.common.BookService; +import com.baeldung.examples.guice.Employee; +import com.baeldung.examples.guice.FooGenerator; +import com.baeldung.examples.guice.GuiceUser; +import com.baeldung.examples.guice.GuiceUserService; +import com.baeldung.examples.guice.Person; +import com.baeldung.examples.guice.modules.GuiceModule; +import com.google.inject.Guice; +import com.google.inject.Injector; + +public class GuiceTests { + + @Test + public void givenAccountFieldInjectedInGuiceUser_WhenGetAccountInvoked_ThenReturnValueIsNotNull() { + Injector injector = Guice.createInjector(new GuiceModule()); + GuiceUser guiceUser = injector.getInstance(GuiceUser.class); + assertNotNull(guiceUser.getAccount()); + } + + @Test + public void givenAccountServiceInjectedInGuiceUserService_WhenGetAccountServiceInvoked_ThenReturnValueIsNotNull() { + Injector injector = Guice.createInjector(new GuiceModule()); + GuiceUserService guiceUserService = injector.getInstance(GuiceUserService.class); + assertNotNull(guiceUserService.getAccountService()); + } + + @Test + public void givenBookServiceIsRegisteredInModule_WhenBookServiceIsInjected_ThenReturnValueIsNotNull() { + Injector injector = Guice.createInjector(new GuiceModule()); + BookService bookService = injector.getInstance(BookService.class); + assertNotNull(bookService); + } + + @Test + public void givenFooGeneratorConstructorParameterIsNotNullable_WhenFooGeneratorIsInjected_ThenTestFailsByProvisionException() { + Injector injector = Guice.createInjector(new GuiceModule()); + FooGenerator fooGenerator = injector.getInstance(FooGenerator.class); + assertNotNull(fooGenerator); + } + + @Test + public void givenMultipleBindingsForPerson_WhenPersonIsInjected_ThenTestFailsByProvisionException() { + Injector injector = Guice.createInjector(new GuiceModule()); + Person person = injector.getInstance(Person.class); + assertNotNull(person); + } + + @Test + public void givenEmployeeConstructorAnnotatedByInject_WhenEmployeeIsInjected_ThenInstanceWillBeCreatedFromTheConstructor() { + Injector injector = Guice.createInjector(new GuiceModule()); + Employee employee = injector.getInstance(Employee.class); + assertNotNull(employee); + assertEquals("Default", employee.getLastName()); + } + + @Test + public void givenAddressAutowiredToGuiceUserBySetterInjection_WhenGuiceUserIsInjected_ThenAddressInitializedByTheSetter() { + Injector injector = Guice.createInjector(new GuiceModule()); + GuiceUser guiceUser = injector.getInstance(GuiceUser.class); + assertNotNull(guiceUser); + assertNotNull(guiceUser.getAddress()); + assertEquals("Default", guiceUser.getAddress().getCity()); + } + +} diff --git a/guice/src/test/java/com/baeldung/examples/SpringTests.java b/guice/src/test/java/com/baeldung/examples/SpringTests.java new file mode 100644 index 0000000000..327e409cc1 --- /dev/null +++ b/guice/src/test/java/com/baeldung/examples/SpringTests.java @@ -0,0 +1,58 @@ +package com.baeldung.examples; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.examples.common.BookService; +import com.baeldung.examples.spring.AppConfig; +import com.baeldung.examples.spring.SpringUser; +import com.baeldung.examples.spring.Student; +import com.baeldung.examples.spring.UserService; + +@RunWith(SpringRunner.class) +@ContextConfiguration(classes = { AppConfig.class }) +public class SpringTests { + @Autowired + ApplicationContext context; + + @Test + public void givenAccountFieldAutowiredToSpringUser_WhenGetAccountInvoked_ThenReturnValueIsNotNull() { + SpringUser springUser = context.getBean(SpringUser.class); + assertNotNull(springUser.getAccount()); + } + + @Test + public void givenAccountServiceFieldAutowiredToUserService_WhenGetAccountServiceInvoked_ThenReturnValueIsNotNull() { + UserService userService = context.getBean(UserService.class); + assertNotNull(userService.getAccountService()); + } + + @Test + public void givenBookServiceIsRegisteredAsBeanInContext_WhenBookServiceIsRetrievedFromContext_ThenReturnValueIsNotNull() { + BookService bookService = context.getBean(BookService.class); + assertNotNull(bookService); + } + + @Test + public void givenStudentConstructorAnnotatedByAutowired_WhenStudentIsRetrievedFromContext_ThenInstanceWillBeCreatedFromTheConstructor() { + Student student = context.getBean(Student.class); + assertNotNull(student); + assertEquals("Default", student.getFirstName()); + assertEquals("Default", student.getLastName()); + } + + @Test + public void givenAddressAutowiredToSpringUserBySetterInjection_WhenSpringUserRetrievedFromContext_ThenAddressInitializedByTheSetter() { + SpringUser springUser = context.getBean(SpringUser.class); + assertNotNull(springUser.getAddress()); + assertEquals("Default", springUser.getAddress().getCity()); + } + +} From acf8034d9352feded9a4e442e654ae517c182e10 Mon Sep 17 00:00:00 2001 From: codehunter34 Date: Wed, 26 Dec 2018 23:58:04 -0500 Subject: [PATCH 007/143] BAEL-2399: Guice vs Spring - Dependency Injection --- guice/pom.xml | 62 ++++++++++++------- .../{GuiceTests.java => GuiceUnitTest.java} | 2 +- .../{SpringTests.java => SpringUnitTest.java} | 2 +- 3 files changed, 41 insertions(+), 25 deletions(-) rename guice/src/test/java/com/baeldung/examples/{GuiceTests.java => GuiceUnitTest.java} (96%) rename guice/src/test/java/com/baeldung/examples/{SpringTests.java => SpringUnitTest.java} (96%) diff --git a/guice/pom.xml b/guice/pom.xml index f3e7873245..54532bc992 100644 --- a/guice/pom.xml +++ b/guice/pom.xml @@ -1,29 +1,45 @@ - - 4.0.0 - com.baeldung.examples.guice - guice - 1.0-SNAPSHOT - jar - guice + + 4.0.0 + com.baeldung.examples.guice + guice + 1.0-SNAPSHOT + jar + guice - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + - - - com.google.inject - guice - ${guice.version} - - + + + com.google.inject + guice + ${guice.version} + - - 4.1.0 - + + org.springframework + spring-context + ${spring.version} + + + + org.springframework + spring-test + ${springtest.version} + test + + + + + 4.1.0 + 5.1.3.RELEASE + 5.1.3.RELEASE + diff --git a/guice/src/test/java/com/baeldung/examples/GuiceTests.java b/guice/src/test/java/com/baeldung/examples/GuiceUnitTest.java similarity index 96% rename from guice/src/test/java/com/baeldung/examples/GuiceTests.java rename to guice/src/test/java/com/baeldung/examples/GuiceUnitTest.java index b87289a1a4..ebc35de405 100644 --- a/guice/src/test/java/com/baeldung/examples/GuiceTests.java +++ b/guice/src/test/java/com/baeldung/examples/GuiceUnitTest.java @@ -15,7 +15,7 @@ import com.baeldung.examples.guice.modules.GuiceModule; import com.google.inject.Guice; import com.google.inject.Injector; -public class GuiceTests { +public class GuiceUnitTest { @Test public void givenAccountFieldInjectedInGuiceUser_WhenGetAccountInvoked_ThenReturnValueIsNotNull() { diff --git a/guice/src/test/java/com/baeldung/examples/SpringTests.java b/guice/src/test/java/com/baeldung/examples/SpringUnitTest.java similarity index 96% rename from guice/src/test/java/com/baeldung/examples/SpringTests.java rename to guice/src/test/java/com/baeldung/examples/SpringUnitTest.java index 327e409cc1..0bd6770909 100644 --- a/guice/src/test/java/com/baeldung/examples/SpringTests.java +++ b/guice/src/test/java/com/baeldung/examples/SpringUnitTest.java @@ -18,7 +18,7 @@ import com.baeldung.examples.spring.UserService; @RunWith(SpringRunner.class) @ContextConfiguration(classes = { AppConfig.class }) -public class SpringTests { +public class SpringUnitTest { @Autowired ApplicationContext context; From aeba601c1f5bd14ad061a18c69babe92db97735d Mon Sep 17 00:00:00 2001 From: codehunter34 Date: Wed, 26 Dec 2018 23:58:04 -0500 Subject: [PATCH 008/143] BAEL-2399: Guice vs Spring - Dependency Injection --- guice/pom.xml | 62 ++++++++++++------- .../{GuiceTests.java => GuiceUnitTest.java} | 2 +- .../{SpringTests.java => SpringUnitTest.java} | 2 +- 3 files changed, 41 insertions(+), 25 deletions(-) rename guice/src/test/java/com/baeldung/examples/{GuiceTests.java => GuiceUnitTest.java} (96%) rename guice/src/test/java/com/baeldung/examples/{SpringTests.java => SpringUnitTest.java} (96%) diff --git a/guice/pom.xml b/guice/pom.xml index f3e7873245..54532bc992 100644 --- a/guice/pom.xml +++ b/guice/pom.xml @@ -1,29 +1,45 @@ - - 4.0.0 - com.baeldung.examples.guice - guice - 1.0-SNAPSHOT - jar - guice + + 4.0.0 + com.baeldung.examples.guice + guice + 1.0-SNAPSHOT + jar + guice - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + - - - com.google.inject - guice - ${guice.version} - - + + + com.google.inject + guice + ${guice.version} + - - 4.1.0 - + + org.springframework + spring-context + ${spring.version} + + + + org.springframework + spring-test + ${springtest.version} + test + + + + + 4.1.0 + 5.1.3.RELEASE + 5.1.3.RELEASE + diff --git a/guice/src/test/java/com/baeldung/examples/GuiceTests.java b/guice/src/test/java/com/baeldung/examples/GuiceUnitTest.java similarity index 96% rename from guice/src/test/java/com/baeldung/examples/GuiceTests.java rename to guice/src/test/java/com/baeldung/examples/GuiceUnitTest.java index b87289a1a4..ebc35de405 100644 --- a/guice/src/test/java/com/baeldung/examples/GuiceTests.java +++ b/guice/src/test/java/com/baeldung/examples/GuiceUnitTest.java @@ -15,7 +15,7 @@ import com.baeldung.examples.guice.modules.GuiceModule; import com.google.inject.Guice; import com.google.inject.Injector; -public class GuiceTests { +public class GuiceUnitTest { @Test public void givenAccountFieldInjectedInGuiceUser_WhenGetAccountInvoked_ThenReturnValueIsNotNull() { diff --git a/guice/src/test/java/com/baeldung/examples/SpringTests.java b/guice/src/test/java/com/baeldung/examples/SpringUnitTest.java similarity index 96% rename from guice/src/test/java/com/baeldung/examples/SpringTests.java rename to guice/src/test/java/com/baeldung/examples/SpringUnitTest.java index 327e409cc1..0bd6770909 100644 --- a/guice/src/test/java/com/baeldung/examples/SpringTests.java +++ b/guice/src/test/java/com/baeldung/examples/SpringUnitTest.java @@ -18,7 +18,7 @@ import com.baeldung.examples.spring.UserService; @RunWith(SpringRunner.class) @ContextConfiguration(classes = { AppConfig.class }) -public class SpringTests { +public class SpringUnitTest { @Autowired ApplicationContext context; From bd63df8caf05acee9307f84f94c83a304cbc401b Mon Sep 17 00:00:00 2001 From: codehunter34 Date: Tue, 1 Jan 2019 02:46:06 -0500 Subject: [PATCH 009/143] BAEL-2399: Guice vs Spring - Dependency Injection --- .../main/java/com/baeldung/examples/common/PersonDao.java | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 guice/src/main/java/com/baeldung/examples/common/PersonDao.java diff --git a/guice/src/main/java/com/baeldung/examples/common/PersonDao.java b/guice/src/main/java/com/baeldung/examples/common/PersonDao.java new file mode 100644 index 0000000000..980fee0252 --- /dev/null +++ b/guice/src/main/java/com/baeldung/examples/common/PersonDao.java @@ -0,0 +1,5 @@ +package com.baeldung.examples.common; + +public interface PersonDao { + +} From d740cb2da09e0dfeef3ae166473785aa92f3a443 Mon Sep 17 00:00:00 2001 From: codehunter34 Date: Tue, 1 Jan 2019 02:46:06 -0500 Subject: [PATCH 010/143] BAEL-2399: Guice vs Spring - Dependency Injection --- .../java/com/baeldung/examples/common/PersonDaoImpl.java | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 guice/src/main/java/com/baeldung/examples/common/PersonDaoImpl.java diff --git a/guice/src/main/java/com/baeldung/examples/common/PersonDaoImpl.java b/guice/src/main/java/com/baeldung/examples/common/PersonDaoImpl.java new file mode 100644 index 0000000000..971db5aa87 --- /dev/null +++ b/guice/src/main/java/com/baeldung/examples/common/PersonDaoImpl.java @@ -0,0 +1,8 @@ +package com.baeldung.examples.common; + +import org.springframework.stereotype.Component; + +@Component +public class PersonDaoImpl implements PersonDao { + +} \ No newline at end of file From 3ac96662fc8d9f83936f21fc688a13ffd648af40 Mon Sep 17 00:00:00 2001 From: codehunter34 Date: Tue, 1 Jan 2019 02:46:06 -0500 Subject: [PATCH 011/143] BAEL-2399: Guice vs Spring - Dependency Injection --- .../examples/common/PersonDaoImpl.java | 8 ++++++++ .../examples/guice/GuicePersonService.java | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 guice/src/main/java/com/baeldung/examples/common/PersonDaoImpl.java create mode 100644 guice/src/main/java/com/baeldung/examples/guice/GuicePersonService.java diff --git a/guice/src/main/java/com/baeldung/examples/common/PersonDaoImpl.java b/guice/src/main/java/com/baeldung/examples/common/PersonDaoImpl.java new file mode 100644 index 0000000000..971db5aa87 --- /dev/null +++ b/guice/src/main/java/com/baeldung/examples/common/PersonDaoImpl.java @@ -0,0 +1,8 @@ +package com.baeldung.examples.common; + +import org.springframework.stereotype.Component; + +@Component +public class PersonDaoImpl implements PersonDao { + +} \ No newline at end of file diff --git a/guice/src/main/java/com/baeldung/examples/guice/GuicePersonService.java b/guice/src/main/java/com/baeldung/examples/guice/GuicePersonService.java new file mode 100644 index 0000000000..ce12e3e528 --- /dev/null +++ b/guice/src/main/java/com/baeldung/examples/guice/GuicePersonService.java @@ -0,0 +1,19 @@ +package com.baeldung.examples.guice; + +import com.baeldung.examples.common.PersonDao; +import com.google.inject.Inject; + +public class GuicePersonService { + + @Inject + private PersonDao personDao; + + public PersonDao getPersonDao() { + return personDao; + } + + public void setPersonDao(PersonDao personDao) { + this.personDao = personDao; + } + +} From 91f8c421c9941997165d0e7ac1e8c3e81836432d Mon Sep 17 00:00:00 2001 From: amdegregorio Date: Tue, 8 Jan 2019 10:31:20 -0500 Subject: [PATCH 012/143] example code for Article How to Write to a CSV File in Java --- .../com/baeldung/csv/WriteCsvFileExample.java | 29 ++++++ .../csv/WriteCsvFileExampleUnitTest.java | 90 +++++++++++++++++++ .../src/test/resources/exampleOutput.csv | 2 + 3 files changed, 121 insertions(+) create mode 100644 core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java create mode 100644 core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java create mode 100644 core-java-io/src/test/resources/exampleOutput.csv diff --git a/core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java b/core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java new file mode 100644 index 0000000000..fd3678d2c5 --- /dev/null +++ b/core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java @@ -0,0 +1,29 @@ +package com.baeldung.csv; + +import java.io.BufferedWriter; +import java.io.IOException; + +public class WriteCsvFileExample { + + public void writeLine(BufferedWriter writer, String[] data) throws IOException { + StringBuilder csvLine = new StringBuilder(); + + for (int i = 0; i < data.length; i++) { + if (i > 0) { + csvLine.append(","); + } + csvLine.append(escapeSpecialCharacters(data[i])); + } + + writer.write(csvLine.toString()); + } + + public String escapeSpecialCharacters(String data) { + String escapedData = data.replaceAll("\\R", " "); + if (data.contains(",") || data.contains("\"") || data.contains("'")) { + data = data.replace("\"", "\"\""); + escapedData = "\"" + data + "\""; + } + return escapedData; + } +} diff --git a/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java b/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java new file mode 100644 index 0000000000..4ac84f939d --- /dev/null +++ b/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java @@ -0,0 +1,90 @@ +package com.baeldung.csv; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class WriteCsvFileExampleUnitTest { + private static final Logger LOG = LoggerFactory.getLogger(WriteCsvFileExampleUnitTest.class); + + private static final String CSV_FILE_NAME = "src/test/resources/exampleOutput.csv"; + private WriteCsvFileExample csvExample; + + @Before + public void setupClass() { + csvExample = new WriteCsvFileExample(); + } + + @Test + public void givenCommaContainingData_whenEscapeSpecialCharacters_stringReturnedInQuotes() { + String data = "three,two,one"; + String escapedData = csvExample.escapeSpecialCharacters(data); + + String expectedData = "\"three,two,one\""; + assertEquals(expectedData, escapedData); + } + + @Test + public void givenQuoteContainingData_whenEscapeSpecialCharacters_stringReturnedFormatted() { + String data = "She said \"Hello\""; + String escapedData = csvExample.escapeSpecialCharacters(data); + + String expectedData = "\"She said \"\"Hello\"\"\""; + assertEquals(expectedData, escapedData); + } + + @Test + public void givenNewlineContainingData_whenEscapeSpecialCharacters_stringReturnedInQuotes() { + String dataNewline = "This contains\na newline"; + String dataCarriageReturn = "This contains\r\na newline and carriage return"; + String escapedDataNl = csvExample.escapeSpecialCharacters(dataNewline); + String escapedDataCr = csvExample.escapeSpecialCharacters(dataCarriageReturn); + + String expectedData = "This contains a newline"; + assertEquals(expectedData, escapedDataNl); + String expectedDataCr = "This contains a newline and carriage return"; + assertEquals(expectedDataCr, escapedDataCr); + } + + @Test + public void givenNonSpecialData_whenEscapeSpecialCharacters_stringReturnedUnchanged() { + String data = "This is nothing special"; + String returnedData = csvExample.escapeSpecialCharacters(data); + + assertEquals(data, returnedData); + } + + @Test + public void givenBufferedWriter_whenWriteLine_thenOutputCreated() { + List dataLines = new ArrayList(); + dataLines.add(new String[] { "John", "Doe", "38", "Comment Data\nAnother line of comment data" }); + dataLines.add(new String[] { "Jane", "Doe, Jr.", "19", "She said \"I'm being quoted\"" }); + + File csvOutputFile = new File(CSV_FILE_NAME); + try (BufferedWriter writer = new BufferedWriter(new FileWriter(csvOutputFile))) { + for (Iterator dataIterator = dataLines.iterator(); dataIterator.hasNext();) { + csvExample.writeLine(writer, dataIterator.next()); + if (dataIterator.hasNext()) { + writer.newLine(); + } + } + writer.flush(); + } catch (IOException e) { + LOG.error("IOException " + e.getMessage()); + } + + assertTrue(csvOutputFile.exists()); + } +} diff --git a/core-java-io/src/test/resources/exampleOutput.csv b/core-java-io/src/test/resources/exampleOutput.csv new file mode 100644 index 0000000000..45c37f3a3b --- /dev/null +++ b/core-java-io/src/test/resources/exampleOutput.csv @@ -0,0 +1,2 @@ +John,Doe,38,Comment Data Another line of comment data +Jane,"Doe, Jr.",19,"She said ""I'm being quoted""" \ No newline at end of file From 81e2750ee0011d4badb355b87c112177a0e0d333 Mon Sep 17 00:00:00 2001 From: amdegregorio Date: Thu, 10 Jan 2019 10:50:03 -0500 Subject: [PATCH 013/143] Updated to use a Stream --- .../com/baeldung/csv/WriteCsvFileExample.java | 7 ++----- .../csv/WriteCsvFileExampleUnitTest.java | 20 +++++++------------ 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java b/core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java index fd3678d2c5..e1237481b1 100644 --- a/core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java +++ b/core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java @@ -1,11 +1,8 @@ package com.baeldung.csv; -import java.io.BufferedWriter; -import java.io.IOException; - public class WriteCsvFileExample { - public void writeLine(BufferedWriter writer, String[] data) throws IOException { + public String convertToCSV(String[] data) { StringBuilder csvLine = new StringBuilder(); for (int i = 0; i < data.length; i++) { @@ -15,7 +12,7 @@ public class WriteCsvFileExample { csvLine.append(escapeSpecialCharacters(data[i])); } - writer.write(csvLine.toString()); + return csvLine.toString(); } public String escapeSpecialCharacters(String data) { diff --git a/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java b/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java index 4ac84f939d..e30ec0818c 100644 --- a/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java +++ b/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java @@ -3,12 +3,10 @@ package com.baeldung.csv; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import java.io.BufferedWriter; import java.io.File; -import java.io.FileWriter; -import java.io.IOException; +import java.io.FileNotFoundException; +import java.io.PrintWriter; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import org.junit.Before; @@ -73,15 +71,11 @@ public class WriteCsvFileExampleUnitTest { dataLines.add(new String[] { "Jane", "Doe, Jr.", "19", "She said \"I'm being quoted\"" }); File csvOutputFile = new File(CSV_FILE_NAME); - try (BufferedWriter writer = new BufferedWriter(new FileWriter(csvOutputFile))) { - for (Iterator dataIterator = dataLines.iterator(); dataIterator.hasNext();) { - csvExample.writeLine(writer, dataIterator.next()); - if (dataIterator.hasNext()) { - writer.newLine(); - } - } - writer.flush(); - } catch (IOException e) { + try (PrintWriter pw = new PrintWriter(csvOutputFile)) { + dataLines.stream() + .map(csvExample::convertToCSV) + .forEach(pw::println); + } catch (FileNotFoundException e) { LOG.error("IOException " + e.getMessage()); } From 2db589c5b47ee20cbc7b3e82d857bd261938dd0d Mon Sep 17 00:00:00 2001 From: amdegregorio Date: Mon, 14 Jan 2019 13:35:07 -0500 Subject: [PATCH 014/143] Updated to use Streams in convertToCSV for BAEL-2499 --- .../com/baeldung/csv/WriteCsvFileExample.java | 16 ++++++---------- .../csv/WriteCsvFileExampleUnitTest.java | 2 +- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java b/core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java index e1237481b1..f409d05b06 100644 --- a/core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java +++ b/core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java @@ -1,18 +1,14 @@ package com.baeldung.csv; +import java.util.stream.Collectors; +import java.util.stream.Stream; + public class WriteCsvFileExample { public String convertToCSV(String[] data) { - StringBuilder csvLine = new StringBuilder(); - - for (int i = 0; i < data.length; i++) { - if (i > 0) { - csvLine.append(","); - } - csvLine.append(escapeSpecialCharacters(data[i])); - } - - return csvLine.toString(); + return Stream.of(data) + .map(this::escapeSpecialCharacters) + .collect(Collectors.joining(",")); } public String escapeSpecialCharacters(String data) { diff --git a/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java b/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java index e30ec0818c..0658ec6101 100644 --- a/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java +++ b/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java @@ -65,7 +65,7 @@ public class WriteCsvFileExampleUnitTest { } @Test - public void givenBufferedWriter_whenWriteLine_thenOutputCreated() { + public void givenDataArray_whenConvertToCSV_thenOutputCreated() { List dataLines = new ArrayList(); dataLines.add(new String[] { "John", "Doe", "38", "Comment Data\nAnother line of comment data" }); dataLines.add(new String[] { "Jane", "Doe, Jr.", "19", "She said \"I'm being quoted\"" }); From 2e2f3bc4a95f83b91188b5ea7ee75e7913d3fe03 Mon Sep 17 00:00:00 2001 From: Chirag Dewan Date: Tue, 15 Jan 2019 17:14:03 +0530 Subject: [PATCH 015/143] BAEL-2408 Java Project Loom --- .../java/com/baeldung/loom/AsyncThreads.java | 22 +++++++++++++ .../com/baeldung/loom/BlockingThreads.java | 33 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 libraries/src/main/java/com/baeldung/loom/AsyncThreads.java create mode 100644 libraries/src/main/java/com/baeldung/loom/BlockingThreads.java diff --git a/libraries/src/main/java/com/baeldung/loom/AsyncThreads.java b/libraries/src/main/java/com/baeldung/loom/AsyncThreads.java new file mode 100644 index 0000000000..1ec448be69 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/loom/AsyncThreads.java @@ -0,0 +1,22 @@ +package com.baeldung.loom; + +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; + +public class AsyncThreads { + + public static void main(String[] args) throws ExecutionException, InterruptedException { + + CompletableFuture cf = CompletableFuture.runAsync(() -> { + + System.out.println("Hello " + Thread.currentThread().getName()); + }); + + cf.thenRun(() -> { + + System.out.println("World " + Thread.currentThread().getName()); + }); + + cf.get(); + } +} diff --git a/libraries/src/main/java/com/baeldung/loom/BlockingThreads.java b/libraries/src/main/java/com/baeldung/loom/BlockingThreads.java new file mode 100644 index 0000000000..de11529753 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/loom/BlockingThreads.java @@ -0,0 +1,33 @@ +package com.baeldung.loom; + +public class BlockingThreads { + + private static final Object LOCK = new Object(); + + public static void main(String[] args) throws InterruptedException { + + Thread thread1 = new Thread(() -> { + synchronized (LOCK) { + System.out.println("Hello " + Thread.currentThread().getName()); + LOCK.notify(); + } + }); + + + Thread thread2 = new Thread(() -> { + synchronized (LOCK) { + try { + System.out.println("Will wait for thread1 now..."); + LOCK.wait(); + System.out.println("World " + Thread.currentThread().getName()); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + }); + + thread2.start(); + thread1.start(); + + } +} From d83101854c35218ea54bbaa5f6ce6747d16d44bf Mon Sep 17 00:00:00 2001 From: mherbaghinyan Date: Fri, 18 Jan 2019 11:05:26 +0400 Subject: [PATCH 016/143] primitive collections libraries added --- core-java-arrays/pom.xml | 16 ++++ .../baeldung/array/PrimitiveCollections.java | 34 ++++++++ .../array/PrimitivesListPerformance.java | 77 +++++++++++++++++++ 3 files changed, 127 insertions(+) create mode 100644 core-java-arrays/src/main/java/com/baeldung/array/PrimitiveCollections.java create mode 100644 core-java-arrays/src/main/java/com/baeldung/array/PrimitivesListPerformance.java diff --git a/core-java-arrays/pom.xml b/core-java-arrays/pom.xml index d2d0453e87..6d4109804e 100644 --- a/core-java-arrays/pom.xml +++ b/core-java-arrays/pom.xml @@ -52,6 +52,22 @@ spring-web ${springframework.spring-web.version} + + + net.sf.trove4j + trove4j + 3.0.2 + + + it.unimi.dsi + fastutil + 8.1.0 + + + colt + colt + 1.2.0 + diff --git a/core-java-arrays/src/main/java/com/baeldung/array/PrimitiveCollections.java b/core-java-arrays/src/main/java/com/baeldung/array/PrimitiveCollections.java new file mode 100644 index 0000000000..115c5fe5c3 --- /dev/null +++ b/core-java-arrays/src/main/java/com/baeldung/array/PrimitiveCollections.java @@ -0,0 +1,34 @@ +package com.baeldung.array; + +import com.google.common.primitives.ImmutableIntArray; +import com.google.common.primitives.Ints; +import gnu.trove.list.array.TIntArrayList; + +import java.util.Arrays; +import java.util.List; + +public class PrimitiveCollections { + + public static void main(String[] args) { + + int[] primitives = new int[] {5, 10, 0, 2}; + + guavaPrimitives(primitives); + + trovePrimitives(primitives); + } + + private static void trovePrimitives(int[] primitives) { + TIntArrayList list = new TIntArrayList(primitives); + } + + private static void guavaPrimitives(int[] primitives) { + + ImmutableIntArray list = ImmutableIntArray.builder().addAll(primitives).build(); + + List integers = Ints.asList(primitives); + + int[] primitive = Ints.toArray(Arrays.asList(1, 2, 3, 4, 5)); + System.out.println(Arrays.toString(primitive)); + } +} diff --git a/core-java-arrays/src/main/java/com/baeldung/array/PrimitivesListPerformance.java b/core-java-arrays/src/main/java/com/baeldung/array/PrimitivesListPerformance.java new file mode 100644 index 0000000000..9db3a75574 --- /dev/null +++ b/core-java-arrays/src/main/java/com/baeldung/array/PrimitivesListPerformance.java @@ -0,0 +1,77 @@ +package com.baeldung.array; + +import it.unimi.dsi.fastutil.ints.IntArrayList; +import gnu.trove.list.array.TIntArrayList; +import org.openjdk.jmh.annotations.*; +import org.openjdk.jmh.runner.Runner; +import org.openjdk.jmh.runner.options.Options; +import org.openjdk.jmh.runner.options.OptionsBuilder; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import java.util.concurrent.TimeUnit; + +@BenchmarkMode(Mode.AverageTime) +@OutputTimeUnit(TimeUnit.NANOSECONDS) +@Warmup(iterations = 10) +public class PrimitivesListPerformance { + + @State(Scope.Thread) + public static class Initialize { + + List arrayList = new ArrayList<>(); + TIntArrayList tList = new TIntArrayList(); + cern.colt.list.IntArrayList coltList = new cern.colt.list.IntArrayList(); + IntArrayList fastUtilList = new IntArrayList(); + + int getValue = 10; + + final int iterations = 100000; + + @Setup(Level.Trial) + public void setUp() { + + for (int i = 0; i < iterations; i++) { + arrayList.add(i); + tList.add(i); + coltList.add(i); + fastUtilList.add(i); + } + + arrayList.add(getValue); + tList.add(getValue); + coltList.add(getValue); + fastUtilList.add(getValue); + } + } + + @Benchmark + public boolean containsArrayList(PrimitivesListPerformance.Initialize state) { + return state.arrayList.contains(state.getValue); + } + + @Benchmark + public boolean containsTIntList(PrimitivesListPerformance.Initialize state) { + return state.tList.contains(state.getValue); + } + + @Benchmark + public boolean containsColtIntList(PrimitivesListPerformance.Initialize state) { + return state.coltList.contains(state.getValue); + } + + @Benchmark + public boolean containsFastUtilIntList(PrimitivesListPerformance.Initialize state) { + return state.fastUtilList.contains(state.getValue); + } + + public static void main(String[] args) throws Exception { + Options options = new OptionsBuilder() + .include(PrimitivesListPerformance.class.getSimpleName()).threads(1) + .forks(1).shouldFailOnError(true) + .shouldDoGC(true) + .jvmArgs("-server").build(); + new Runner(options).run(); + } +} From c713ddee6da9f3b3efc13a0b1935582c2581fee0 Mon Sep 17 00:00:00 2001 From: mherbaghinyan Date: Mon, 21 Jan 2019 09:26:47 +0400 Subject: [PATCH 017/143] trove list --- .../java/com/baeldung/array/PrimitiveCollections.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core-java-arrays/src/main/java/com/baeldung/array/PrimitiveCollections.java b/core-java-arrays/src/main/java/com/baeldung/array/PrimitiveCollections.java index 115c5fe5c3..b991dcb598 100644 --- a/core-java-arrays/src/main/java/com/baeldung/array/PrimitiveCollections.java +++ b/core-java-arrays/src/main/java/com/baeldung/array/PrimitiveCollections.java @@ -2,6 +2,7 @@ package com.baeldung.array; import com.google.common.primitives.ImmutableIntArray; import com.google.common.primitives.Ints; +import gnu.trove.list.TIntList; import gnu.trove.list.array.TIntArrayList; import java.util.Arrays; @@ -13,13 +14,16 @@ public class PrimitiveCollections { int[] primitives = new int[] {5, 10, 0, 2}; - guavaPrimitives(primitives); + //guavaPrimitives(primitives); trovePrimitives(primitives); } private static void trovePrimitives(int[] primitives) { - TIntArrayList list = new TIntArrayList(primitives); + TIntList tList = new TIntArrayList(primitives); + tList.reverse(); + System.out.println(tList); + System.out.println(tList.size()); } private static void guavaPrimitives(int[] primitives) { From 81f23992cb19ef7860cc4faa57df167a5d6d8ecd Mon Sep 17 00:00:00 2001 From: mherbaghinyan Date: Mon, 21 Jan 2019 13:08:09 +0400 Subject: [PATCH 018/143] primitive collections --- .../baeldung/array/PrimitiveCollections.java | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/core-java-arrays/src/main/java/com/baeldung/array/PrimitiveCollections.java b/core-java-arrays/src/main/java/com/baeldung/array/PrimitiveCollections.java index b991dcb598..85f4dd2498 100644 --- a/core-java-arrays/src/main/java/com/baeldung/array/PrimitiveCollections.java +++ b/core-java-arrays/src/main/java/com/baeldung/array/PrimitiveCollections.java @@ -2,8 +2,6 @@ package com.baeldung.array; import com.google.common.primitives.ImmutableIntArray; import com.google.common.primitives.Ints; -import gnu.trove.list.TIntList; -import gnu.trove.list.array.TIntArrayList; import java.util.Arrays; import java.util.List; @@ -14,25 +12,21 @@ public class PrimitiveCollections { int[] primitives = new int[] {5, 10, 0, 2}; - //guavaPrimitives(primitives); - - trovePrimitives(primitives); + guavaPrimitives(primitives); } - private static void trovePrimitives(int[] primitives) { - TIntList tList = new TIntArrayList(primitives); - tList.reverse(); - System.out.println(tList); - System.out.println(tList.size()); - } private static void guavaPrimitives(int[] primitives) { - ImmutableIntArray list = ImmutableIntArray.builder().addAll(primitives).build(); + ImmutableIntArray immutableIntArray = ImmutableIntArray.builder().addAll(primitives).build(); + System.out.println(immutableIntArray); - List integers = Ints.asList(primitives); + List list = Ints.asList(primitives); - int[] primitive = Ints.toArray(Arrays.asList(1, 2, 3, 4, 5)); - System.out.println(Arrays.toString(primitive)); + int[] primitiveArray = Ints.toArray(list); + + int[] concatenated = Ints.concat(primitiveArray, primitives); + + System.out.println(Arrays.toString(concatenated)); } } From ae344b37ec7d7c0ed2cb0141e96c9811ad4eea71 Mon Sep 17 00:00:00 2001 From: mherbaghinyan Date: Fri, 25 Jan 2019 09:51:15 +0400 Subject: [PATCH 019/143] move the code into core-java-collections-lists module --- core-java-arrays/pom.xml | 16 ---------- core-java-collections-list/pom.xml | 29 +++++++++++++++++++ .../list/primitive}/PrimitiveCollections.java | 2 +- .../primitive}/PrimitivesListPerformance.java | 3 +- 4 files changed, 31 insertions(+), 19 deletions(-) rename {core-java-arrays/src/main/java/com/baeldung/array => core-java-collections-list/src/main/java/com/baeldung/list/primitive}/PrimitiveCollections.java (95%) rename {core-java-arrays/src/main/java/com/baeldung/array => core-java-collections-list/src/main/java/com/baeldung/list/primitive}/PrimitivesListPerformance.java (97%) diff --git a/core-java-arrays/pom.xml b/core-java-arrays/pom.xml index 6d4109804e..d2d0453e87 100644 --- a/core-java-arrays/pom.xml +++ b/core-java-arrays/pom.xml @@ -52,22 +52,6 @@ spring-web ${springframework.spring-web.version} - - - net.sf.trove4j - trove4j - 3.0.2 - - - it.unimi.dsi - fastutil - 8.1.0 - - - colt - colt - 1.2.0 - diff --git a/core-java-collections-list/pom.xml b/core-java-collections-list/pom.xml index ee99e470d0..bc71882683 100644 --- a/core-java-collections-list/pom.xml +++ b/core-java-collections-list/pom.xml @@ -36,6 +36,33 @@ ${lombok.version} provided + + + org.openjdk.jmh + jmh-core + ${jmh-core.version} + + + org.openjdk.jmh + jmh-generator-annprocess + ${jmh-generator-annprocess.version} + + + + net.sf.trove4j + trove4j + 3.0.2 + + + it.unimi.dsi + fastutil + 8.1.0 + + + colt + colt + 1.2.0 + @@ -44,5 +71,7 @@ 1.7.0 3.11.1 1.16.12 + 1.19 + 1.19 diff --git a/core-java-arrays/src/main/java/com/baeldung/array/PrimitiveCollections.java b/core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitiveCollections.java similarity index 95% rename from core-java-arrays/src/main/java/com/baeldung/array/PrimitiveCollections.java rename to core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitiveCollections.java index 85f4dd2498..d6da32d899 100644 --- a/core-java-arrays/src/main/java/com/baeldung/array/PrimitiveCollections.java +++ b/core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitiveCollections.java @@ -1,4 +1,4 @@ -package com.baeldung.array; +package com.baeldung.list.primitive; import com.google.common.primitives.ImmutableIntArray; import com.google.common.primitives.Ints; diff --git a/core-java-arrays/src/main/java/com/baeldung/array/PrimitivesListPerformance.java b/core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitivesListPerformance.java similarity index 97% rename from core-java-arrays/src/main/java/com/baeldung/array/PrimitivesListPerformance.java rename to core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitivesListPerformance.java index 9db3a75574..f57c8d65a6 100644 --- a/core-java-arrays/src/main/java/com/baeldung/array/PrimitivesListPerformance.java +++ b/core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitivesListPerformance.java @@ -1,4 +1,4 @@ -package com.baeldung.array; +package com.baeldung.list.primitive; import it.unimi.dsi.fastutil.ints.IntArrayList; import gnu.trove.list.array.TIntArrayList; @@ -9,7 +9,6 @@ import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.ArrayList; import java.util.List; -import java.util.Random; import java.util.concurrent.TimeUnit; @BenchmarkMode(Mode.AverageTime) From 2f5ef3480b97cea30ec57dafb9370a114f9f8b18 Mon Sep 17 00:00:00 2001 From: mherbaghinyan Date: Fri, 25 Jan 2019 10:54:59 +0400 Subject: [PATCH 020/143] remove Ints examples --- .../com/baeldung/list/primitive/PrimitiveCollections.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitiveCollections.java b/core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitiveCollections.java index d6da32d899..5a8ddc0acd 100644 --- a/core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitiveCollections.java +++ b/core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitiveCollections.java @@ -20,13 +20,5 @@ public class PrimitiveCollections { ImmutableIntArray immutableIntArray = ImmutableIntArray.builder().addAll(primitives).build(); System.out.println(immutableIntArray); - - List list = Ints.asList(primitives); - - int[] primitiveArray = Ints.toArray(list); - - int[] concatenated = Ints.concat(primitiveArray, primitives); - - System.out.println(Arrays.toString(concatenated)); } } From 931dc2ae18577e9189ba83e44f2344b087c1563f Mon Sep 17 00:00:00 2001 From: alv21 Date: Fri, 25 Jan 2019 21:15:59 -0800 Subject: [PATCH 021/143] BAEL-2466 spring soap --- spring-soap/.gitignore | 1 + spring-soap/pom.xml | 68 +++++++++ .../com/baeldung/springsoap/Application.java | 12 ++ .../baeldung/springsoap/CountryEndpoint.java | 30 ++++ .../springsoap/CountryRepository.java | 47 ++++++ .../baeldung/springsoap/WebServiceConfig.java | 41 +++++ .../com/baeldung/springsoap/gen/Country.java | 144 ++++++++++++++++++ .../com/baeldung/springsoap/gen/Currency.java | 47 ++++++ .../springsoap/gen/GetCountryRequest.java | 71 +++++++++ .../springsoap/gen/GetCountryResponse.java | 71 +++++++++ .../springsoap/gen/ObjectFactory.java | 63 ++++++++ .../baeldung/springsoap/gen/package-info.java | 9 ++ spring-soap/src/main/resources/countries.xsd | 37 +++++ spring-soap/src/main/resources/request.xml | 23 +++ .../ApplicationIntegrationTest.java | 39 +++++ 15 files changed, 703 insertions(+) create mode 100644 spring-soap/.gitignore create mode 100644 spring-soap/pom.xml create mode 100644 spring-soap/src/main/java/com/baeldung/springsoap/Application.java create mode 100644 spring-soap/src/main/java/com/baeldung/springsoap/CountryEndpoint.java create mode 100644 spring-soap/src/main/java/com/baeldung/springsoap/CountryRepository.java create mode 100644 spring-soap/src/main/java/com/baeldung/springsoap/WebServiceConfig.java create mode 100644 spring-soap/src/main/java/com/baeldung/springsoap/gen/Country.java create mode 100644 spring-soap/src/main/java/com/baeldung/springsoap/gen/Currency.java create mode 100644 spring-soap/src/main/java/com/baeldung/springsoap/gen/GetCountryRequest.java create mode 100644 spring-soap/src/main/java/com/baeldung/springsoap/gen/GetCountryResponse.java create mode 100644 spring-soap/src/main/java/com/baeldung/springsoap/gen/ObjectFactory.java create mode 100644 spring-soap/src/main/java/com/baeldung/springsoap/gen/package-info.java create mode 100644 spring-soap/src/main/resources/countries.xsd create mode 100644 spring-soap/src/main/resources/request.xml create mode 100644 spring-soap/src/test/java/com/baeldung/springsoap/ApplicationIntegrationTest.java diff --git a/spring-soap/.gitignore b/spring-soap/.gitignore new file mode 100644 index 0000000000..b83d22266a --- /dev/null +++ b/spring-soap/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/spring-soap/pom.xml b/spring-soap/pom.xml new file mode 100644 index 0000000000..54a1d86038 --- /dev/null +++ b/spring-soap/pom.xml @@ -0,0 +1,68 @@ + + + 4.0.0 + + org.springframework + spring-soap + 1.0.0 + + + org.springframework.boot + spring-boot-starter-parent + 2.0.5.RELEASE + + + + 1.8 + + + + + + org.springframework.boot + spring-boot-starter-web-services + + + wsdl4j + wsdl4j + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + org.codehaus.mojo + jaxb2-maven-plugin + 1.6 + + + xjc + + xjc + + + + + ${project.basedir}/src/main/resources/ + ${project.basedir}/src/main/java + false + + + + + + + diff --git a/spring-soap/src/main/java/com/baeldung/springsoap/Application.java b/spring-soap/src/main/java/com/baeldung/springsoap/Application.java new file mode 100644 index 0000000000..ad9258447c --- /dev/null +++ b/spring-soap/src/main/java/com/baeldung/springsoap/Application.java @@ -0,0 +1,12 @@ +package com.baeldung.springsoap; + +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); + } +} diff --git a/spring-soap/src/main/java/com/baeldung/springsoap/CountryEndpoint.java b/spring-soap/src/main/java/com/baeldung/springsoap/CountryEndpoint.java new file mode 100644 index 0000000000..745131767a --- /dev/null +++ b/spring-soap/src/main/java/com/baeldung/springsoap/CountryEndpoint.java @@ -0,0 +1,30 @@ +package com.baeldung.springsoap; + +import com.baeldung.springsoap.gen.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.ws.server.endpoint.annotation.Endpoint; +import org.springframework.ws.server.endpoint.annotation.PayloadRoot; +import org.springframework.ws.server.endpoint.annotation.RequestPayload; +import org.springframework.ws.server.endpoint.annotation.ResponsePayload; + +@Endpoint +public class CountryEndpoint { + + private static final String NAMESPACE_URI = "http://www.baeldung.com/springsoap/gen"; + + private CountryRepository countryRepository; + + @Autowired + public CountryEndpoint(CountryRepository countryRepository) { + this.countryRepository = countryRepository; + } + + @PayloadRoot(namespace = NAMESPACE_URI, localPart = "getCountryRequest") + @ResponsePayload + public GetCountryResponse getCountry(@RequestPayload GetCountryRequest request) { + GetCountryResponse response = new GetCountryResponse(); + response.setCountry(countryRepository.findCountry(request.getName())); + + return response; + } +} diff --git a/spring-soap/src/main/java/com/baeldung/springsoap/CountryRepository.java b/spring-soap/src/main/java/com/baeldung/springsoap/CountryRepository.java new file mode 100644 index 0000000000..8a0f58a64e --- /dev/null +++ b/spring-soap/src/main/java/com/baeldung/springsoap/CountryRepository.java @@ -0,0 +1,47 @@ +package com.baeldung.springsoap; + +import com.baeldung.springsoap.gen.*; +import org.springframework.stereotype.Component; +import org.springframework.util.Assert; + +import javax.annotation.PostConstruct; +import java.util.HashMap; +import java.util.Map; + +@Component +public class CountryRepository { + + private static final Map countries = new HashMap<>(); + + @PostConstruct + public void initData() { + Country spain = new Country(); + spain.setName("Spain"); + spain.setCapital("Madrid"); + spain.setCurrency(Currency.EUR); + spain.setPopulation(46704314); + + countries.put(spain.getName(), spain); + + Country poland = new Country(); + poland.setName("Poland"); + poland.setCapital("Warsaw"); + poland.setCurrency(Currency.PLN); + poland.setPopulation(38186860); + + countries.put(poland.getName(), poland); + + Country uk = new Country(); + uk.setName("United Kingdom"); + uk.setCapital("London"); + uk.setCurrency(Currency.GBP); + uk.setPopulation(63705000); + + countries.put(uk.getName(), uk); + } + + public Country findCountry(String name) { + Assert.notNull(name, "The country's name must not be null"); + return countries.get(name); + } +} diff --git a/spring-soap/src/main/java/com/baeldung/springsoap/WebServiceConfig.java b/spring-soap/src/main/java/com/baeldung/springsoap/WebServiceConfig.java new file mode 100644 index 0000000000..930a961208 --- /dev/null +++ b/spring-soap/src/main/java/com/baeldung/springsoap/WebServiceConfig.java @@ -0,0 +1,41 @@ +package com.baeldung.springsoap; + +import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.ClassPathResource; +import org.springframework.ws.config.annotation.EnableWs; +import org.springframework.ws.config.annotation.WsConfigurerAdapter; +import org.springframework.ws.transport.http.MessageDispatcherServlet; +import org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition; +import org.springframework.xml.xsd.SimpleXsdSchema; +import org.springframework.xml.xsd.XsdSchema; + +@EnableWs +@Configuration +public class WebServiceConfig extends WsConfigurerAdapter { + + @Bean + public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) { + MessageDispatcherServlet servlet = new MessageDispatcherServlet(); + servlet.setApplicationContext(applicationContext); + servlet.setTransformWsdlLocations(true); + return new ServletRegistrationBean(servlet, "/ws/*"); + } + + @Bean(name = "countries") + public DefaultWsdl11Definition defaultWsdl11Definition(XsdSchema countriesSchema) { + DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition(); + wsdl11Definition.setPortTypeName("CountriesPort"); + wsdl11Definition.setLocationUri("/ws"); + wsdl11Definition.setTargetNamespace("http://www.baeldung.com/springsoap/gen"); + wsdl11Definition.setSchema(countriesSchema); + return wsdl11Definition; + } + + @Bean + public XsdSchema countriesSchema() { + return new SimpleXsdSchema(new ClassPathResource("countries.xsd")); + } +} diff --git a/spring-soap/src/main/java/com/baeldung/springsoap/gen/Country.java b/spring-soap/src/main/java/com/baeldung/springsoap/gen/Country.java new file mode 100644 index 0000000000..e3eb686d6b --- /dev/null +++ b/spring-soap/src/main/java/com/baeldung/springsoap/gen/Country.java @@ -0,0 +1,144 @@ +// +// Questo file è stato generato dall'architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.7 +// Vedere http://java.sun.com/xml/jaxb +// Qualsiasi modifica a questo file andrà persa durante la ricompilazione dello schema di origine. +// Generato il: 2019.01.25 alle 06:06:58 PM PST +// + + +package com.baeldung.springsoap.gen; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Classe Java per country complex type. + * + *

Il seguente frammento di schema specifica il contenuto previsto contenuto in questa classe. + * + *

+ * <complexType name="country">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="population" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <element name="capital" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="currency" type="{http://www.baeldung.com/springsoap/gen}currency"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "country", propOrder = { + "name", + "population", + "capital", + "currency" +}) +public class Country { + + @XmlElement(required = true) + protected String name; + protected int population; + @XmlElement(required = true) + protected String capital; + @XmlElement(required = true) + protected Currency currency; + + /** + * Recupera il valore della proprietà name. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Imposta il valore della proprietà name. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Recupera il valore della proprietà population. + * + */ + public int getPopulation() { + return population; + } + + /** + * Imposta il valore della proprietà population. + * + */ + public void setPopulation(int value) { + this.population = value; + } + + /** + * Recupera il valore della proprietà capital. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCapital() { + return capital; + } + + /** + * Imposta il valore della proprietà capital. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCapital(String value) { + this.capital = value; + } + + /** + * Recupera il valore della proprietà currency. + * + * @return + * possible object is + * {@link Currency } + * + */ + public Currency getCurrency() { + return currency; + } + + /** + * Imposta il valore della proprietà currency. + * + * @param value + * allowed object is + * {@link Currency } + * + */ + public void setCurrency(Currency value) { + this.currency = value; + } + +} diff --git a/spring-soap/src/main/java/com/baeldung/springsoap/gen/Currency.java b/spring-soap/src/main/java/com/baeldung/springsoap/gen/Currency.java new file mode 100644 index 0000000000..9b0660466f --- /dev/null +++ b/spring-soap/src/main/java/com/baeldung/springsoap/gen/Currency.java @@ -0,0 +1,47 @@ +// +// Questo file è stato generato dall'architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.7 +// Vedere http://java.sun.com/xml/jaxb +// Qualsiasi modifica a questo file andrà persa durante la ricompilazione dello schema di origine. +// Generato il: 2019.01.25 alle 06:06:58 PM PST +// + + +package com.baeldung.springsoap.gen; + +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Classe Java per currency. + * + *

Il seguente frammento di schema specifica il contenuto previsto contenuto in questa classe. + *

+ *

+ * <simpleType name="currency">
+ *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *     <enumeration value="GBP"/>
+ *     <enumeration value="EUR"/>
+ *     <enumeration value="PLN"/>
+ *   </restriction>
+ * </simpleType>
+ * 
+ * + */ +@XmlType(name = "currency") +@XmlEnum +public enum Currency { + + GBP, + EUR, + PLN; + + public String value() { + return name(); + } + + public static Currency fromValue(String v) { + return valueOf(v); + } + +} diff --git a/spring-soap/src/main/java/com/baeldung/springsoap/gen/GetCountryRequest.java b/spring-soap/src/main/java/com/baeldung/springsoap/gen/GetCountryRequest.java new file mode 100644 index 0000000000..7e1f151929 --- /dev/null +++ b/spring-soap/src/main/java/com/baeldung/springsoap/gen/GetCountryRequest.java @@ -0,0 +1,71 @@ +// +// Questo file è stato generato dall'architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.7 +// Vedere http://java.sun.com/xml/jaxb +// Qualsiasi modifica a questo file andrà persa durante la ricompilazione dello schema di origine. +// Generato il: 2019.01.25 alle 06:06:58 PM PST +// + + +package com.baeldung.springsoap.gen; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Classe Java per anonymous complex type. + * + *

Il seguente frammento di schema specifica il contenuto previsto contenuto in questa classe. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "name" +}) +@XmlRootElement(name = "getCountryRequest") +public class GetCountryRequest { + + @XmlElement(required = true) + protected String name; + + /** + * Recupera il valore della proprietà name. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Imposta il valore della proprietà name. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + +} diff --git a/spring-soap/src/main/java/com/baeldung/springsoap/gen/GetCountryResponse.java b/spring-soap/src/main/java/com/baeldung/springsoap/gen/GetCountryResponse.java new file mode 100644 index 0000000000..38c49193b4 --- /dev/null +++ b/spring-soap/src/main/java/com/baeldung/springsoap/gen/GetCountryResponse.java @@ -0,0 +1,71 @@ +// +// Questo file è stato generato dall'architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.7 +// Vedere http://java.sun.com/xml/jaxb +// Qualsiasi modifica a questo file andrà persa durante la ricompilazione dello schema di origine. +// Generato il: 2019.01.25 alle 06:06:58 PM PST +// + + +package com.baeldung.springsoap.gen; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Classe Java per anonymous complex type. + * + *

Il seguente frammento di schema specifica il contenuto previsto contenuto in questa classe. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="country" type="{http://www.baeldung.com/springsoap/gen}country"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "country" +}) +@XmlRootElement(name = "getCountryResponse") +public class GetCountryResponse { + + @XmlElement(required = true) + protected Country country; + + /** + * Recupera il valore della proprietà country. + * + * @return + * possible object is + * {@link Country } + * + */ + public Country getCountry() { + return country; + } + + /** + * Imposta il valore della proprietà country. + * + * @param value + * allowed object is + * {@link Country } + * + */ + public void setCountry(Country value) { + this.country = value; + } + +} diff --git a/spring-soap/src/main/java/com/baeldung/springsoap/gen/ObjectFactory.java b/spring-soap/src/main/java/com/baeldung/springsoap/gen/ObjectFactory.java new file mode 100644 index 0000000000..6b9691efc0 --- /dev/null +++ b/spring-soap/src/main/java/com/baeldung/springsoap/gen/ObjectFactory.java @@ -0,0 +1,63 @@ +// +// Questo file è stato generato dall'architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.7 +// Vedere http://java.sun.com/xml/jaxb +// Qualsiasi modifica a questo file andrà persa durante la ricompilazione dello schema di origine. +// Generato il: 2019.01.25 alle 06:06:58 PM PST +// + + +package com.baeldung.springsoap.gen; + +import javax.xml.bind.annotation.XmlRegistry; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.baeldung.springsoap.gen package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.baeldung.springsoap.gen + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link GetCountryRequest } + * + */ + public GetCountryRequest createGetCountryRequest() { + return new GetCountryRequest(); + } + + /** + * Create an instance of {@link GetCountryResponse } + * + */ + public GetCountryResponse createGetCountryResponse() { + return new GetCountryResponse(); + } + + /** + * Create an instance of {@link Country } + * + */ + public Country createCountry() { + return new Country(); + } + +} diff --git a/spring-soap/src/main/java/com/baeldung/springsoap/gen/package-info.java b/spring-soap/src/main/java/com/baeldung/springsoap/gen/package-info.java new file mode 100644 index 0000000000..9638be3d94 --- /dev/null +++ b/spring-soap/src/main/java/com/baeldung/springsoap/gen/package-info.java @@ -0,0 +1,9 @@ +// +// Questo file è stato generato dall'architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.7 +// Vedere http://java.sun.com/xml/jaxb +// Qualsiasi modifica a questo file andrà persa durante la ricompilazione dello schema di origine. +// Generato il: 2019.01.25 alle 06:06:58 PM PST +// + +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.baeldung.com/springsoap/gen", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package com.baeldung.springsoap.gen; diff --git a/spring-soap/src/main/resources/countries.xsd b/spring-soap/src/main/resources/countries.xsd new file mode 100644 index 0000000000..524e5ac2d5 --- /dev/null +++ b/spring-soap/src/main/resources/countries.xsd @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-soap/src/main/resources/request.xml b/spring-soap/src/main/resources/request.xml new file mode 100644 index 0000000000..7a94aeeee6 --- /dev/null +++ b/spring-soap/src/main/resources/request.xml @@ -0,0 +1,23 @@ + + + + + Spain + + + + + + + + + + Spain + 46704314 + Madrid + EUR + + + + \ No newline at end of file diff --git a/spring-soap/src/test/java/com/baeldung/springsoap/ApplicationIntegrationTest.java b/spring-soap/src/test/java/com/baeldung/springsoap/ApplicationIntegrationTest.java new file mode 100644 index 0000000000..18c8a96576 --- /dev/null +++ b/spring-soap/src/test/java/com/baeldung/springsoap/ApplicationIntegrationTest.java @@ -0,0 +1,39 @@ +package com.baeldung.springsoap; + +import com.baeldung.springsoap.gen.GetCountryRequest; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.oxm.jaxb.Jaxb2Marshaller; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.util.ClassUtils; +import org.springframework.ws.client.core.WebServiceTemplate; + +import static org.assertj.core.api.Assertions.assertThat; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) +public class ApplicationIntegrationTest { + + private Jaxb2Marshaller marshaller = new Jaxb2Marshaller(); + + @LocalServerPort private int port = 0; + + @Before + public void init() throws Exception { + marshaller.setPackagesToScan(ClassUtils.getPackageName(GetCountryRequest.class)); + marshaller.afterPropertiesSet(); + } + + @Test + public void whenSendRequest_thenResponseIsNotNull() { + WebServiceTemplate ws = new WebServiceTemplate(marshaller); + GetCountryRequest request = new GetCountryRequest(); + request.setName("Spain"); + + assertThat(ws.marshalSendAndReceive("http://localhost:" + port + "/ws", request)).isNotNull(); + } +} \ No newline at end of file From 720c32ab78b18e3fc092700e674c4e84724ef33b Mon Sep 17 00:00:00 2001 From: amdegregorio Date: Sat, 26 Jan 2019 09:00:26 -0500 Subject: [PATCH 022/143] BAEL-2542 Creating a Jar - example code --- .../java/com/baeldung/jar/Dimensioner.java | 27 ++++++++++++ .../java/com/baeldung/jar/JarExample.java | 31 +++++++++++++ .../main/java/com/baeldung/jar/Rectangle.java | 44 +++++++++++++++++++ .../resources/META-INF/example_manifest.txt | 1 + .../src/main/resources/files/dimensions.txt | 3 ++ 5 files changed, 106 insertions(+) create mode 100644 core-java/src/main/java/com/baeldung/jar/Dimensioner.java create mode 100644 core-java/src/main/java/com/baeldung/jar/JarExample.java create mode 100644 core-java/src/main/java/com/baeldung/jar/Rectangle.java create mode 100644 core-java/src/main/resources/META-INF/example_manifest.txt create mode 100644 core-java/src/main/resources/files/dimensions.txt diff --git a/core-java/src/main/java/com/baeldung/jar/Dimensioner.java b/core-java/src/main/java/com/baeldung/jar/Dimensioner.java new file mode 100644 index 0000000000..bc5cea4010 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/jar/Dimensioner.java @@ -0,0 +1,27 @@ +package com.baeldung.jar; + +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.List; + +public class Dimensioner { + + public List loadFromFile(String dimensionFile) throws FileNotFoundException, IOException { + List rectangles = new ArrayList(); + try (BufferedReader br = new BufferedReader(new InputStreamReader(Dimensioner.class.getResourceAsStream(dimensionFile)))) { + String line; + while ((line = br.readLine()) != null) { + String[] dimensions = line.split(","); + if (dimensions.length == 2) { + Rectangle rectangle = new Rectangle(Integer.valueOf(dimensions[0]), Integer.valueOf(dimensions[1])); + rectangles.add(rectangle); + } + } + } + return rectangles; + } + +} diff --git a/core-java/src/main/java/com/baeldung/jar/JarExample.java b/core-java/src/main/java/com/baeldung/jar/JarExample.java new file mode 100644 index 0000000000..262df3a5ec --- /dev/null +++ b/core-java/src/main/java/com/baeldung/jar/JarExample.java @@ -0,0 +1,31 @@ +package com.baeldung.jar; + +import java.io.IOException; +import java.util.List; + +public class JarExample { + private static final String DIMENSION_FILE = "/dimensions.txt"; + + public static void main(String[] args) { + String environment = System.getProperty("environment"); + if (environment != null && environment.equalsIgnoreCase("prod")) { + Dimensioner dimensioner = new Dimensioner(); + try { + List rectangles = dimensioner.loadFromFile(DIMENSION_FILE); + rectangles.forEach(rectangle -> { + rectangle.printArea(); + rectangle.printPerimeter(); + }); + } catch (IOException e) { + System.err.println("Exception loading dimensions"); + } + } else if (args.length > 0) { + int length = Integer.valueOf(args[0]); + int width = (args.length > 1) ? Integer.valueOf(args[1]) : Integer.valueOf(args[0]); + Rectangle rectangle = new Rectangle(length, width); + rectangle.printArea(); + rectangle.printPerimeter(); + } + } + +} diff --git a/core-java/src/main/java/com/baeldung/jar/Rectangle.java b/core-java/src/main/java/com/baeldung/jar/Rectangle.java new file mode 100644 index 0000000000..f2a174c819 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/jar/Rectangle.java @@ -0,0 +1,44 @@ +package com.baeldung.jar; + +public class Rectangle { + private int length; + private int width; + + public Rectangle(int length, int width) { + this.length = length; + this.width = width; + } + + public int area() { + return length * width; + } + + public int perimeter() { + return (length * 2) + (width * 2); + } + + public void printArea() { + System.out.println("Area: " + area()); + } + + public void printPerimeter() { + System.out.println("Perimeter: " + perimeter()); + } + + public int getLength() { + return length; + } + + public void setLength(int length) { + this.length = length; + } + + public int getWidth() { + return width; + } + + public void setWidth(int width) { + this.width = width; + } + +} diff --git a/core-java/src/main/resources/META-INF/example_manifest.txt b/core-java/src/main/resources/META-INF/example_manifest.txt new file mode 100644 index 0000000000..90e83e9b42 --- /dev/null +++ b/core-java/src/main/resources/META-INF/example_manifest.txt @@ -0,0 +1 @@ +Main-Class: com.baeldung.jar.JarExample diff --git a/core-java/src/main/resources/files/dimensions.txt b/core-java/src/main/resources/files/dimensions.txt new file mode 100644 index 0000000000..0397c2a610 --- /dev/null +++ b/core-java/src/main/resources/files/dimensions.txt @@ -0,0 +1,3 @@ +12,16 +24,6 +7,19 \ No newline at end of file From 4c1c93e1f698c06137de54737fb11fc828b27857 Mon Sep 17 00:00:00 2001 From: alv21 Date: Sat, 26 Jan 2019 09:14:27 -0800 Subject: [PATCH 023/143] BAEL-2466 spring-soap module added --- pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pom.xml b/pom.xml index d084d0f7af..fe55a9bf44 100644 --- a/pom.xml +++ b/pom.xml @@ -749,6 +749,7 @@ spring-security-x509 spring-session spring-sleuth + spring-soap spring-social-login spring-spel spring-state-machine @@ -1458,6 +1459,7 @@ spring-security-x509 spring-session spring-sleuth + spring-soap spring-social-login spring-spel spring-state-machine From aed3e8f829d418a90afea6d659123afed0dd9e4c Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 27 Jan 2019 15:09:00 +0200 Subject: [PATCH 024/143] Update README.md --- core-java/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java/README.md b/core-java/README.md index 5aee69d9a9..d6cb619ed3 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -46,3 +46,4 @@ - [Graphs in Java](https://www.baeldung.com/java-graphs) - [Console I/O in Java](http://www.baeldung.com/java-console-input-output) - [Formatting with printf() in Java](https://www.baeldung.com/java-printstream-printf) +- [Retrieve Fields from a Java Class Using Reflection](https://www.baeldung.com/java-reflection-class-fields) From 79f1babc26b4d96686e1815d4437d0c5f3f0c65f Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 27 Jan 2019 15:09:46 +0200 Subject: [PATCH 025/143] Update README.md --- persistence-modules/java-jpa/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/java-jpa/README.md b/persistence-modules/java-jpa/README.md index 2eea5e60b4..5fe119cca4 100644 --- a/persistence-modules/java-jpa/README.md +++ b/persistence-modules/java-jpa/README.md @@ -4,3 +4,4 @@ - [A Guide to Stored Procedures with JPA](http://www.baeldung.com/jpa-stored-procedures) - [Fixing the JPA error “java.lang.String cannot be cast to Ljava.lang.String;”](https://www.baeldung.com/jpa-error-java-lang-string-cannot-be-cast) - [JPA Entity Graph](https://www.baeldung.com/jpa-entity-graph) +- [JPA 2.2 Support for Java 8 Date/Time Types](https://www.baeldung.com/jpa-java-time) From 639e0046d7ef36502edffff27be8a88b7d2d1ad4 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 27 Jan 2019 15:10:33 +0200 Subject: [PATCH 026/143] Update README.md --- core-java-io/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core-java-io/README.md b/core-java-io/README.md index 2ad980ca6a..fcb3302a48 100644 --- a/core-java-io/README.md +++ b/core-java-io/README.md @@ -36,4 +36,5 @@ - [Reading a CSV File into an Array](https://www.baeldung.com/java-csv-file-array) - [Guide to BufferedReader](https://www.baeldung.com/java-buffered-reader) - [How to Get the File Extension of a File in Java](http://www.baeldung.com/java-file-extension) -- [Getting a File’s Mime Type in Java](http://www.baeldung.com/java-file-mime-type) \ No newline at end of file +- [Getting a File’s Mime Type in Java](http://www.baeldung.com/java-file-mime-type) +- [Create a Directory in Java](https://www.baeldung.com/java-create-directory) From 242dc1dbcee7394319af5eafb91b209fe39421fc Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 27 Jan 2019 15:11:21 +0200 Subject: [PATCH 027/143] Update README.md --- persistence-modules/hibernate5/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/hibernate5/README.md b/persistence-modules/hibernate5/README.md index 03bdd9b759..a4e95a9062 100644 --- a/persistence-modules/hibernate5/README.md +++ b/persistence-modules/hibernate5/README.md @@ -29,3 +29,4 @@ - [Hibernate Named Query](https://www.baeldung.com/hibernate-named-query) - [Using c3p0 with Hibernate](https://www.baeldung.com/hibernate-c3p0) - [Persist a JSON Object Using Hibernate](https://www.baeldung.com/hibernate-persist-json-object) +- [Common Hibernate Exceptions](https://www.baeldung.com/hibernate-exceptions) From 8a3d3f934402b3409b3392edfccff8b4f1ad8a5e Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 27 Jan 2019 15:12:01 +0200 Subject: [PATCH 028/143] Update README.md --- java-streams/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/java-streams/README.md b/java-streams/README.md index 33ca2619a8..f2afd570f6 100644 --- a/java-streams/README.md +++ b/java-streams/README.md @@ -15,3 +15,4 @@ - [Stream Ordering in Java](https://www.baeldung.com/java-stream-ordering) - [Introduction to Protonpack](https://www.baeldung.com/java-protonpack) - [Java Stream Filter with Lambda Expression](https://www.baeldung.com/java-stream-filter-lambda) +- [Counting Matches on a Stream Filter](https://www.baeldung.com/java-stream-filter-count) From ac53498b767eaa5052933373a823a58365263583 Mon Sep 17 00:00:00 2001 From: Anshul Bansal Date: Sun, 27 Jan 2019 15:40:36 +0200 Subject: [PATCH 029/143] BAEL-2659 - Reading a file in Groovy --- .../groovy/com/baeldung/file/ReadFile.groovy | 61 +++++++++++++++++++ .../src/main/resources/fileContent.txt | 3 + .../com/baeldung/file/ReadFileUnitTest.groovy | 58 ++++++++++++++++++ 3 files changed, 122 insertions(+) create mode 100644 core-groovy/src/main/groovy/com/baeldung/file/ReadFile.groovy create mode 100644 core-groovy/src/main/resources/fileContent.txt create mode 100644 core-groovy/src/test/groovy/com/baeldung/file/ReadFileUnitTest.groovy diff --git a/core-groovy/src/main/groovy/com/baeldung/file/ReadFile.groovy b/core-groovy/src/main/groovy/com/baeldung/file/ReadFile.groovy new file mode 100644 index 0000000000..fca5bde06f --- /dev/null +++ b/core-groovy/src/main/groovy/com/baeldung/file/ReadFile.groovy @@ -0,0 +1,61 @@ +package com.baeldung.file + +class ReadFile { + + /** + * reads file content in string using File.text + * @param filePath + * @return + */ + String readFileString(String filePath) { + File file = new File(filePath) + String fileContent = file.text + return fileContent + } + + /** + * reads file content in string with encoding using File.getText + * @param filePath + * @return + */ + String readFileStringWithCharset(String filePath) { + File file = new File(filePath) + String utf8Content = file.getText("UTF-8") + return utf8Content + } + + /** + * reads file content line by line using withReader and reader.readLine + * @param filePath + * @return + */ + int readFileLineByLine(String filePath) { + File file = new File(filePath) + def line, noOfLines = 0; + file.withReader { reader -> + while ((line = reader.readLine())!=null) + { + println "${line}" + noOfLines++ + } + } + return noOfLines + } + + /** + * reads file content in list of lines + * @param filePath + * @return + */ + List readFileInList(String filePath) { + File file = new File(filePath) + def lines = file.readLines() + return lines + } + + public static void main(String[] args) { + def file = new File("../../src") + println file.directorySize + } + +} \ No newline at end of file diff --git a/core-groovy/src/main/resources/fileContent.txt b/core-groovy/src/main/resources/fileContent.txt new file mode 100644 index 0000000000..643e4af3de --- /dev/null +++ b/core-groovy/src/main/resources/fileContent.txt @@ -0,0 +1,3 @@ +Line 1 : Hello World!!! +Line 2 : This is a file content. +Line 3 : String content diff --git a/core-groovy/src/test/groovy/com/baeldung/file/ReadFileUnitTest.groovy b/core-groovy/src/test/groovy/com/baeldung/file/ReadFileUnitTest.groovy new file mode 100644 index 0000000000..c90cc8b960 --- /dev/null +++ b/core-groovy/src/test/groovy/com/baeldung/file/ReadFileUnitTest.groovy @@ -0,0 +1,58 @@ +package com.baeldung.file + +import spock.lang.Specification + +class ReadFileUnitTest extends Specification { + + ReadFile readFile + + void setup () { + readFile = new ReadFile() + } + + def 'Should return file content in string using ReadFile.readFileString given filePath' () { + given: + def filePath = "src/main/resources/fileContent.txt" + when: + def fileContent = readFile.readFileString(filePath) + then: + fileContent + fileContent instanceof String + fileContent.contains("""Line 1 : Hello World!!! +Line 2 : This is a file content. +Line 3 : String content""") + + } + + def 'Should return UTF-8 encoded file content in string using ReadFile.readFileStringWithCharset given filePath' () { + given: + def filePath = "src/main/resources/fileContent.txt" + when: + def noOfLines = readFile.readFileStringWithCharset(filePath) + then: + noOfLines + noOfLines instanceof String + } + + def 'Should return number of lines in File using ReadFile.readFileLineByLine given filePath' () { + given: + def filePath = "src/main/resources/fileContent.txt" + when: + def noOfLines = readFile.readFileLineByLine(filePath) + then: + noOfLines + noOfLines instanceof Integer + assert noOfLines, 3 + } + + def 'Should return File Content in list of lines using ReadFile.readFileInList given filePath' () { + given: + def filePath = "src/main/resources/fileContent.txt" + when: + def lines = readFile.readFileInList(filePath) + then: + lines + lines instanceof List + assert lines.size(), 3 + } +} \ No newline at end of file From fd70f654b54e3ac59a9477809aed14c833ec15fa Mon Sep 17 00:00:00 2001 From: mherbaghinyan Date: Sun, 27 Jan 2019 17:45:34 +0400 Subject: [PATCH 030/143] primitive list collections --- .../list/primitive/PrimitiveCollections.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitiveCollections.java b/core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitiveCollections.java index 5a8ddc0acd..50f372e9c9 100644 --- a/core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitiveCollections.java +++ b/core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitiveCollections.java @@ -2,6 +2,8 @@ package com.baeldung.list.primitive; import com.google.common.primitives.ImmutableIntArray; import com.google.common.primitives.Ints; +import gnu.trove.list.array.TIntArrayList; +import it.unimi.dsi.fastutil.ints.IntArrayList; import java.util.Arrays; import java.util.List; @@ -13,6 +15,18 @@ public class PrimitiveCollections { int[] primitives = new int[] {5, 10, 0, 2}; guavaPrimitives(primitives); + + TIntArrayList tList = new TIntArrayList(primitives); + + cern.colt.list.IntArrayList coltList = new cern.colt.list.IntArrayList(primitives); + + IntArrayList fastUtilList = new IntArrayList(primitives); + + System.out.println(tList); + + System.out.println(coltList); + + System.out.println(fastUtilList); } From f22d1073d19416ba5d327149b316babebb8b4b47 Mon Sep 17 00:00:00 2001 From: Anshul Bansal Date: Sun, 27 Jan 2019 22:47:27 +0200 Subject: [PATCH 031/143] BAEL-2659 - Reading a file in Groovy - changed order of functions --- .../groovy/com/baeldung/file/ReadFile.groovy | 48 +++++++++---------- .../com/baeldung/file/ReadFileUnitTest.groovy | 44 ++++++++--------- 2 files changed, 44 insertions(+), 48 deletions(-) diff --git a/core-groovy/src/main/groovy/com/baeldung/file/ReadFile.groovy b/core-groovy/src/main/groovy/com/baeldung/file/ReadFile.groovy index fca5bde06f..73208a52c8 100644 --- a/core-groovy/src/main/groovy/com/baeldung/file/ReadFile.groovy +++ b/core-groovy/src/main/groovy/com/baeldung/file/ReadFile.groovy @@ -2,28 +2,6 @@ package com.baeldung.file class ReadFile { - /** - * reads file content in string using File.text - * @param filePath - * @return - */ - String readFileString(String filePath) { - File file = new File(filePath) - String fileContent = file.text - return fileContent - } - - /** - * reads file content in string with encoding using File.getText - * @param filePath - * @return - */ - String readFileStringWithCharset(String filePath) { - File file = new File(filePath) - String utf8Content = file.getText("UTF-8") - return utf8Content - } - /** * reads file content line by line using withReader and reader.readLine * @param filePath @@ -52,10 +30,28 @@ class ReadFile { def lines = file.readLines() return lines } - - public static void main(String[] args) { - def file = new File("../../src") - println file.directorySize + + /** + * reads file content in string using File.text + * @param filePath + * @return + */ + String readFileString(String filePath) { + File file = new File(filePath) + String fileContent = file.text + return fileContent } + /** + * reads file content in string with encoding using File.getText + * @param filePath + * @return + */ + String readFileStringWithCharset(String filePath) { + File file = new File(filePath) + String utf8Content = file.getText("UTF-8") + return utf8Content + } + + } \ No newline at end of file diff --git a/core-groovy/src/test/groovy/com/baeldung/file/ReadFileUnitTest.groovy b/core-groovy/src/test/groovy/com/baeldung/file/ReadFileUnitTest.groovy index c90cc8b960..105a8e157f 100644 --- a/core-groovy/src/test/groovy/com/baeldung/file/ReadFileUnitTest.groovy +++ b/core-groovy/src/test/groovy/com/baeldung/file/ReadFileUnitTest.groovy @@ -10,6 +10,28 @@ class ReadFileUnitTest extends Specification { readFile = new ReadFile() } + def 'Should return number of lines in File using ReadFile.readFileLineByLine given filePath' () { + given: + def filePath = "src/main/resources/fileContent.txt" + when: + def noOfLines = readFile.readFileLineByLine(filePath) + then: + noOfLines + noOfLines instanceof Integer + assert noOfLines, 3 + } + + def 'Should return File Content in list of lines using ReadFile.readFileInList given filePath' () { + given: + def filePath = "src/main/resources/fileContent.txt" + when: + def lines = readFile.readFileInList(filePath) + then: + lines + lines instanceof List + assert lines.size(), 3 + } + def 'Should return file content in string using ReadFile.readFileString given filePath' () { given: def filePath = "src/main/resources/fileContent.txt" @@ -33,26 +55,4 @@ Line 3 : String content""") noOfLines noOfLines instanceof String } - - def 'Should return number of lines in File using ReadFile.readFileLineByLine given filePath' () { - given: - def filePath = "src/main/resources/fileContent.txt" - when: - def noOfLines = readFile.readFileLineByLine(filePath) - then: - noOfLines - noOfLines instanceof Integer - assert noOfLines, 3 - } - - def 'Should return File Content in list of lines using ReadFile.readFileInList given filePath' () { - given: - def filePath = "src/main/resources/fileContent.txt" - when: - def lines = readFile.readFileInList(filePath) - then: - lines - lines instanceof List - assert lines.size(), 3 - } } \ No newline at end of file From 44d5be301ce9e69b69f4ef632250f6b8f07cd8c0 Mon Sep 17 00:00:00 2001 From: mherbaghinyan Date: Mon, 28 Jan 2019 15:15:05 +0400 Subject: [PATCH 032/143] remove performance test --- .../primitive/PrimitivesListPerformance.java | 76 ------------------- 1 file changed, 76 deletions(-) delete mode 100644 core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitivesListPerformance.java diff --git a/core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitivesListPerformance.java b/core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitivesListPerformance.java deleted file mode 100644 index f57c8d65a6..0000000000 --- a/core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitivesListPerformance.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.baeldung.list.primitive; - -import it.unimi.dsi.fastutil.ints.IntArrayList; -import gnu.trove.list.array.TIntArrayList; -import org.openjdk.jmh.annotations.*; -import org.openjdk.jmh.runner.Runner; -import org.openjdk.jmh.runner.options.Options; -import org.openjdk.jmh.runner.options.OptionsBuilder; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.TimeUnit; - -@BenchmarkMode(Mode.AverageTime) -@OutputTimeUnit(TimeUnit.NANOSECONDS) -@Warmup(iterations = 10) -public class PrimitivesListPerformance { - - @State(Scope.Thread) - public static class Initialize { - - List arrayList = new ArrayList<>(); - TIntArrayList tList = new TIntArrayList(); - cern.colt.list.IntArrayList coltList = new cern.colt.list.IntArrayList(); - IntArrayList fastUtilList = new IntArrayList(); - - int getValue = 10; - - final int iterations = 100000; - - @Setup(Level.Trial) - public void setUp() { - - for (int i = 0; i < iterations; i++) { - arrayList.add(i); - tList.add(i); - coltList.add(i); - fastUtilList.add(i); - } - - arrayList.add(getValue); - tList.add(getValue); - coltList.add(getValue); - fastUtilList.add(getValue); - } - } - - @Benchmark - public boolean containsArrayList(PrimitivesListPerformance.Initialize state) { - return state.arrayList.contains(state.getValue); - } - - @Benchmark - public boolean containsTIntList(PrimitivesListPerformance.Initialize state) { - return state.tList.contains(state.getValue); - } - - @Benchmark - public boolean containsColtIntList(PrimitivesListPerformance.Initialize state) { - return state.coltList.contains(state.getValue); - } - - @Benchmark - public boolean containsFastUtilIntList(PrimitivesListPerformance.Initialize state) { - return state.fastUtilList.contains(state.getValue); - } - - public static void main(String[] args) throws Exception { - Options options = new OptionsBuilder() - .include(PrimitivesListPerformance.class.getSimpleName()).threads(1) - .forks(1).shouldFailOnError(true) - .shouldDoGC(true) - .jvmArgs("-server").build(); - new Runner(options).run(); - } -} From d944b67c29a56d83ea31603238aa599de7cb212e Mon Sep 17 00:00:00 2001 From: mherbaghinyan Date: Mon, 28 Jan 2019 15:23:01 +0400 Subject: [PATCH 033/143] remove JMH dependency --- core-java-collections-list/pom.xml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/core-java-collections-list/pom.xml b/core-java-collections-list/pom.xml index bc71882683..a7e711088a 100644 --- a/core-java-collections-list/pom.xml +++ b/core-java-collections-list/pom.xml @@ -37,17 +37,6 @@ provided - - org.openjdk.jmh - jmh-core - ${jmh-core.version} - - - org.openjdk.jmh - jmh-generator-annprocess - ${jmh-generator-annprocess.version} - - net.sf.trove4j trove4j @@ -71,7 +60,5 @@ 1.7.0 3.11.1 1.16.12 - 1.19 - 1.19 From 66c92495fb27780f76c0409408fc38cdcf3f83f4 Mon Sep 17 00:00:00 2001 From: amdegregorio Date: Mon, 28 Jan 2019 06:53:52 -0500 Subject: [PATCH 034/143] BAEL-2542 Update system property name --- core-java/src/main/java/com/baeldung/jar/JarExample.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core-java/src/main/java/com/baeldung/jar/JarExample.java b/core-java/src/main/java/com/baeldung/jar/JarExample.java index 262df3a5ec..daa44025d5 100644 --- a/core-java/src/main/java/com/baeldung/jar/JarExample.java +++ b/core-java/src/main/java/com/baeldung/jar/JarExample.java @@ -7,8 +7,8 @@ public class JarExample { private static final String DIMENSION_FILE = "/dimensions.txt"; public static void main(String[] args) { - String environment = System.getProperty("environment"); - if (environment != null && environment.equalsIgnoreCase("prod")) { + String inputType = System.getProperty("input"); + if (inputType != null && inputType.equalsIgnoreCase("file")) { Dimensioner dimensioner = new Dimensioner(); try { List rectangles = dimensioner.loadFromFile(DIMENSION_FILE); From 1f4d1839f44232312c289e30b6869420dd558520 Mon Sep 17 00:00:00 2001 From: Anshul Bansal Date: Tue, 29 Jan 2019 17:27:52 +0200 Subject: [PATCH 035/143] BAEL-2659 - Reading a file in Groovy - added more examples and unit tests --- .../groovy/com/baeldung/file/ReadFile.groovy | 36 ++++++++++++++++++ core-groovy/src/main/resources/sample.png | Bin 0 -> 329 bytes .../src/main/resources/utf8Content.html | 5 +++ .../com/baeldung/file/ReadFileUnitTest.groovy | 12 +++++- 4 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 core-groovy/src/main/resources/sample.png create mode 100644 core-groovy/src/main/resources/utf8Content.html diff --git a/core-groovy/src/main/groovy/com/baeldung/file/ReadFile.groovy b/core-groovy/src/main/groovy/com/baeldung/file/ReadFile.groovy index 73208a52c8..38bf189e63 100644 --- a/core-groovy/src/main/groovy/com/baeldung/file/ReadFile.groovy +++ b/core-groovy/src/main/groovy/com/baeldung/file/ReadFile.groovy @@ -53,5 +53,41 @@ class ReadFile { return utf8Content } + /** + * reads content of binary file and returns byte array + * @param filePath + * @return + */ + byte[] readBinaryFile(String filePath) { + File file = new File(filePath) + byte[] binaryContent = file.bytes + return binaryContent + } + + /** + * More Examples of reading a file + * @return + */ + def moreExamples() { + def list = new File("src/main/resources/fileContent.txt").collect {it} + + def array = new File("src/main/resources/fileContent.txt") as String[] + + new File("src/main/resources/fileContent.txt").eachLine { line -> + println line + } + + def is = new File("src/main/resources/fileContent.txt").newInputStream() + is.eachLine { + println it + } + is.close() + + new File("src/main/resources/fileContent.txt").withInputStream { stream -> + stream.eachLine { line -> + println line + } + } + } } \ No newline at end of file diff --git a/core-groovy/src/main/resources/sample.png b/core-groovy/src/main/resources/sample.png new file mode 100644 index 0000000000000000000000000000000000000000..7d473430b7bec514f7de12f5769fe7c5859e8c5d GIT binary patch literal 329 zcmeAS@N?(olHy`uVBq!ia0vp^JRr;gBp8b2n5}^nQC}X^4DKU-G|w_t}fLBA)Suv#nrW z!^h2QnY_`l!BOq-UXEX{m2up>JTQkX)2m zTvF+fTUlI^nXH#utd~++ke^qgmzgTe~DWM4ffP81J literal 0 HcmV?d00001 diff --git a/core-groovy/src/main/resources/utf8Content.html b/core-groovy/src/main/resources/utf8Content.html new file mode 100644 index 0000000000..9d941200b1 --- /dev/null +++ b/core-groovy/src/main/resources/utf8Content.html @@ -0,0 +1,5 @@ +ᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗ +ᛋᚳᛖᚪᛚ᛫ᚦᛖᚪᚻ᛫ᛗᚪᚾᚾᚪ᛫ᚷᛖᚻᚹᛦᛚᚳ᛫ᛗᛁᚳᛚᚢᚾ᛫ᚻᛦᛏ᛫ᛞᚫᛚᚪᚾ +ᚷᛁᚠ᛫ᚻᛖ᛫ᚹᛁᛚᛖ᛫ᚠᚩᚱ᛫ᛞᚱᛁᚻᛏᚾᛖ᛫ᛞᚩᛗᛖᛋ᛫ᚻᛚᛇᛏᚪᚾ + +¥ · £ · € · $ · ¢ · ₡ · ₢ · ₣ · ₤ · ₥ · ₦ · ₧ · ₨ · ₩ · ₪ · ₫ · ₭ · ₮ · ₯ · ₹ \ No newline at end of file diff --git a/core-groovy/src/test/groovy/com/baeldung/file/ReadFileUnitTest.groovy b/core-groovy/src/test/groovy/com/baeldung/file/ReadFileUnitTest.groovy index 105a8e157f..5fc1409276 100644 --- a/core-groovy/src/test/groovy/com/baeldung/file/ReadFileUnitTest.groovy +++ b/core-groovy/src/test/groovy/com/baeldung/file/ReadFileUnitTest.groovy @@ -48,11 +48,21 @@ Line 3 : String content""") def 'Should return UTF-8 encoded file content in string using ReadFile.readFileStringWithCharset given filePath' () { given: - def filePath = "src/main/resources/fileContent.txt" + def filePath = "src/main/resources/utf8Content.html" when: def noOfLines = readFile.readFileStringWithCharset(filePath) then: noOfLines noOfLines instanceof String } + + def 'Should return binary file content in byte arry using ReadFile.readBinaryFile given filePath' () { + given: + def filePath = "src/main/resources/sample.png" + when: + def noOfLines = readFile.readBinaryFile(filePath) + then: + noOfLines + noOfLines instanceof byte[] + } } \ No newline at end of file From 822b09baab5b1a4080bf8311c2e562f46397b2a0 Mon Sep 17 00:00:00 2001 From: ciro Date: Tue, 29 Jan 2019 11:31:15 -0800 Subject: [PATCH 036/143] BAEL-2466 moving request.xml --- spring-soap/src/{main => test}/resources/request.xml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename spring-soap/src/{main => test}/resources/request.xml (100%) diff --git a/spring-soap/src/main/resources/request.xml b/spring-soap/src/test/resources/request.xml similarity index 100% rename from spring-soap/src/main/resources/request.xml rename to spring-soap/src/test/resources/request.xml From 50a8870d4f95175e409b51972fc31ae014bb1a2f Mon Sep 17 00:00:00 2001 From: Anshul Bansal Date: Wed, 30 Jan 2019 13:46:56 +0200 Subject: [PATCH 037/143] BAEL-2659 - Reading a file in Groovy - added more example --- .../src/main/groovy/com/baeldung/file/ReadFile.groovy | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core-groovy/src/main/groovy/com/baeldung/file/ReadFile.groovy b/core-groovy/src/main/groovy/com/baeldung/file/ReadFile.groovy index 38bf189e63..828f702e82 100644 --- a/core-groovy/src/main/groovy/com/baeldung/file/ReadFile.groovy +++ b/core-groovy/src/main/groovy/com/baeldung/file/ReadFile.groovy @@ -69,6 +69,14 @@ class ReadFile { * @return */ def moreExamples() { + + new File("src/main/resources/utf8Content.html").withReader('UTF-8') { reader -> + def line + while ((line = reader.readLine())!=null) { + println "${line}" + } + } + def list = new File("src/main/resources/fileContent.txt").collect {it} def array = new File("src/main/resources/fileContent.txt") as String[] From 499aec3490118b3e9d92264edcc4f8816c5f3abb Mon Sep 17 00:00:00 2001 From: amdegregorio Date: Wed, 30 Jan 2019 13:55:37 -0500 Subject: [PATCH 038/143] updates to simplify example --- .../java/com/baeldung/jar/Dimensioner.java | 27 ------------ .../java/com/baeldung/jar/JarExample.java | 24 +--------- .../main/java/com/baeldung/jar/Rectangle.java | 44 ------------------- 3 files changed, 1 insertion(+), 94 deletions(-) delete mode 100644 core-java/src/main/java/com/baeldung/jar/Dimensioner.java delete mode 100644 core-java/src/main/java/com/baeldung/jar/Rectangle.java diff --git a/core-java/src/main/java/com/baeldung/jar/Dimensioner.java b/core-java/src/main/java/com/baeldung/jar/Dimensioner.java deleted file mode 100644 index bc5cea4010..0000000000 --- a/core-java/src/main/java/com/baeldung/jar/Dimensioner.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baeldung.jar; - -import java.io.BufferedReader; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.List; - -public class Dimensioner { - - public List loadFromFile(String dimensionFile) throws FileNotFoundException, IOException { - List rectangles = new ArrayList(); - try (BufferedReader br = new BufferedReader(new InputStreamReader(Dimensioner.class.getResourceAsStream(dimensionFile)))) { - String line; - while ((line = br.readLine()) != null) { - String[] dimensions = line.split(","); - if (dimensions.length == 2) { - Rectangle rectangle = new Rectangle(Integer.valueOf(dimensions[0]), Integer.valueOf(dimensions[1])); - rectangles.add(rectangle); - } - } - } - return rectangles; - } - -} diff --git a/core-java/src/main/java/com/baeldung/jar/JarExample.java b/core-java/src/main/java/com/baeldung/jar/JarExample.java index daa44025d5..5f33188adf 100644 --- a/core-java/src/main/java/com/baeldung/jar/JarExample.java +++ b/core-java/src/main/java/com/baeldung/jar/JarExample.java @@ -1,31 +1,9 @@ package com.baeldung.jar; -import java.io.IOException; -import java.util.List; - public class JarExample { - private static final String DIMENSION_FILE = "/dimensions.txt"; public static void main(String[] args) { - String inputType = System.getProperty("input"); - if (inputType != null && inputType.equalsIgnoreCase("file")) { - Dimensioner dimensioner = new Dimensioner(); - try { - List rectangles = dimensioner.loadFromFile(DIMENSION_FILE); - rectangles.forEach(rectangle -> { - rectangle.printArea(); - rectangle.printPerimeter(); - }); - } catch (IOException e) { - System.err.println("Exception loading dimensions"); - } - } else if (args.length > 0) { - int length = Integer.valueOf(args[0]); - int width = (args.length > 1) ? Integer.valueOf(args[1]) : Integer.valueOf(args[0]); - Rectangle rectangle = new Rectangle(length, width); - rectangle.printArea(); - rectangle.printPerimeter(); - } + System.out.println("Hello Baeldung Reader!"); } } diff --git a/core-java/src/main/java/com/baeldung/jar/Rectangle.java b/core-java/src/main/java/com/baeldung/jar/Rectangle.java deleted file mode 100644 index f2a174c819..0000000000 --- a/core-java/src/main/java/com/baeldung/jar/Rectangle.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.baeldung.jar; - -public class Rectangle { - private int length; - private int width; - - public Rectangle(int length, int width) { - this.length = length; - this.width = width; - } - - public int area() { - return length * width; - } - - public int perimeter() { - return (length * 2) + (width * 2); - } - - public void printArea() { - System.out.println("Area: " + area()); - } - - public void printPerimeter() { - System.out.println("Perimeter: " + perimeter()); - } - - public int getLength() { - return length; - } - - public void setLength(int length) { - this.length = length; - } - - public int getWidth() { - return width; - } - - public void setWidth(int width) { - this.width = width; - } - -} From b48f77cf6e61afb2990f52a9fe515813aa0f8f3a Mon Sep 17 00:00:00 2001 From: Anshul Bansal Date: Thu, 31 Jan 2019 12:46:25 +0200 Subject: [PATCH 039/143] BAEL-2659 - Reading a file in Groovy - corrected variable names --- .../main/groovy/com/baeldung/file/ReadFile.groovy | 8 +++++++- core-groovy/src/main/resources/utf8Content.html | 4 +--- .../com/baeldung/file/ReadFileUnitTest.groovy | 14 ++++++++------ 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/core-groovy/src/main/groovy/com/baeldung/file/ReadFile.groovy b/core-groovy/src/main/groovy/com/baeldung/file/ReadFile.groovy index 828f702e82..4239fa534c 100644 --- a/core-groovy/src/main/groovy/com/baeldung/file/ReadFile.groovy +++ b/core-groovy/src/main/groovy/com/baeldung/file/ReadFile.groovy @@ -70,6 +70,7 @@ class ReadFile { */ def moreExamples() { + //with reader with utf-8 new File("src/main/resources/utf8Content.html").withReader('UTF-8') { reader -> def line while ((line = reader.readLine())!=null) { @@ -77,20 +78,25 @@ class ReadFile { } } + //collect api def list = new File("src/main/resources/fileContent.txt").collect {it} + //as operator def array = new File("src/main/resources/fileContent.txt") as String[] - + + //eachline new File("src/main/resources/fileContent.txt").eachLine { line -> println line } + //newInputStream with eachLine def is = new File("src/main/resources/fileContent.txt").newInputStream() is.eachLine { println it } is.close() + //withInputStream new File("src/main/resources/fileContent.txt").withInputStream { stream -> stream.eachLine { line -> println line diff --git a/core-groovy/src/main/resources/utf8Content.html b/core-groovy/src/main/resources/utf8Content.html index 9d941200b1..873a75b8d0 100644 --- a/core-groovy/src/main/resources/utf8Content.html +++ b/core-groovy/src/main/resources/utf8Content.html @@ -1,5 +1,3 @@ ᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗ ᛋᚳᛖᚪᛚ᛫ᚦᛖᚪᚻ᛫ᛗᚪᚾᚾᚪ᛫ᚷᛖᚻᚹᛦᛚᚳ᛫ᛗᛁᚳᛚᚢᚾ᛫ᚻᛦᛏ᛫ᛞᚫᛚᚪᚾ -ᚷᛁᚠ᛫ᚻᛖ᛫ᚹᛁᛚᛖ᛫ᚠᚩᚱ᛫ᛞᚱᛁᚻᛏᚾᛖ᛫ᛞᚩᛗᛖᛋ᛫ᚻᛚᛇᛏᚪᚾ - -¥ · £ · € · $ · ¢ · ₡ · ₢ · ₣ · ₤ · ₥ · ₦ · ₧ · ₨ · ₩ · ₪ · ₫ · ₭ · ₮ · ₯ · ₹ \ No newline at end of file +ᚷᛁᚠ᛫ᚻᛖ᛫ᚹᛁᛚᛖ᛫ᚠᚩᚱ᛫ᛞᚱᛁᚻᛏᚾᛖ᛫ᛞᚩᛗᛖᛋ᛫ᚻᛚᛇᛏᚪᚾ \ No newline at end of file diff --git a/core-groovy/src/test/groovy/com/baeldung/file/ReadFileUnitTest.groovy b/core-groovy/src/test/groovy/com/baeldung/file/ReadFileUnitTest.groovy index 5fc1409276..0d0e2aed1a 100644 --- a/core-groovy/src/test/groovy/com/baeldung/file/ReadFileUnitTest.groovy +++ b/core-groovy/src/test/groovy/com/baeldung/file/ReadFileUnitTest.groovy @@ -50,19 +50,21 @@ Line 3 : String content""") given: def filePath = "src/main/resources/utf8Content.html" when: - def noOfLines = readFile.readFileStringWithCharset(filePath) + def encodedContent = readFile.readFileStringWithCharset(filePath) then: - noOfLines - noOfLines instanceof String + encodedContent + encodedContent instanceof String } def 'Should return binary file content in byte arry using ReadFile.readBinaryFile given filePath' () { given: def filePath = "src/main/resources/sample.png" when: - def noOfLines = readFile.readBinaryFile(filePath) + def binaryContent = readFile.readBinaryFile(filePath) then: - noOfLines - noOfLines instanceof byte[] + binaryContent + binaryContent instanceof byte[] + binaryContent.length == 329 } + } \ No newline at end of file From ca98fbb7062c13129ee3193b679a64ad9da63f84 Mon Sep 17 00:00:00 2001 From: mherbaghinyan Date: Thu, 31 Jan 2019 16:18:59 +0400 Subject: [PATCH 040/143] Added Stream Api --- .../list/primitive/PrimitiveCollections.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitiveCollections.java b/core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitiveCollections.java index 50f372e9c9..01372763e9 100644 --- a/core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitiveCollections.java +++ b/core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitiveCollections.java @@ -7,15 +7,20 @@ import it.unimi.dsi.fastutil.ints.IntArrayList; import java.util.Arrays; import java.util.List; +import java.util.OptionalDouble; +import java.util.function.IntPredicate; +import java.util.stream.IntStream; public class PrimitiveCollections { public static void main(String[] args) { - int[] primitives = new int[] {5, 10, 0, 2}; + int[] primitives = new int[] {5, 10, 0, 2, -8}; guavaPrimitives(primitives); + intStream(primitives); + TIntArrayList tList = new TIntArrayList(primitives); cern.colt.list.IntArrayList coltList = new cern.colt.list.IntArrayList(primitives); @@ -29,6 +34,15 @@ public class PrimitiveCollections { System.out.println(fastUtilList); } + private static void intStream(int[] primitives) { + + IntStream stream = IntStream.of(5, 10, 0, 2, -8); + + IntStream newStream = IntStream.of(primitives); + + OptionalDouble average = stream.filter(i -> i > 0).average(); + } + private static void guavaPrimitives(int[] primitives) { From bd166ed82f02a49b7c1eadec210b0c1459745c33 Mon Sep 17 00:00:00 2001 From: Andrey Shcherbakov Date: Thu, 31 Jan 2019 22:18:07 +0100 Subject: [PATCH 041/143] Fix the integration test in module spring-4 --- .../org/baeldung/SpringContextIntegrationTest.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/spring-4/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-4/src/test/java/org/baeldung/SpringContextIntegrationTest.java index 9dfac2bd9e..d646e22511 100644 --- a/spring-4/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/spring-4/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -2,13 +2,16 @@ package org.baeldung; 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.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; import com.baeldung.flips.ApplicationConfig; -@RunWith(SpringRunner.class) -@SpringBootTest(classes = ApplicationConfig.class) + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = ApplicationConfig.class) +@WebAppConfiguration public class SpringContextIntegrationTest { @Test From 1c556fe4fc9192eef90e0c60e084b202fd004a9e Mon Sep 17 00:00:00 2001 From: Andrey Shcherbakov Date: Thu, 31 Jan 2019 22:28:46 +0100 Subject: [PATCH 042/143] Fix the integration test in module springboot-autoconfiguration This test requires that MySQL engine is up. --- .../SpringContextIntegrationTest.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 spring-boot-autoconfiguration/src/test/java/com/baeldung/SpringContextIntegrationTest.java diff --git a/spring-boot-autoconfiguration/src/test/java/com/baeldung/SpringContextIntegrationTest.java b/spring-boot-autoconfiguration/src/test/java/com/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..a0138bec8d --- /dev/null +++ b/spring-boot-autoconfiguration/src/test/java/com/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,19 @@ +package com.baeldung; + +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.web.WebAppConfiguration; + +import com.baeldung.autoconfiguration.MySQLAutoconfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = MySQLAutoconfiguration.class) +@WebAppConfiguration +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} \ No newline at end of file From 8d9d76cc09207401ade39329e6ae4c65fbfc19da Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Fri, 1 Feb 2019 12:00:43 +0330 Subject: [PATCH 043/143] Refactored the test names and used backtick identifiers. --- .../kotlin/com/baeldung/kotlin/junit5/CalculatorTest5.kt | 8 ++++---- .../test/kotlin/com/baeldung/kotlin/junit5/SimpleTest5.kt | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/junit5/CalculatorTest5.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/junit5/CalculatorTest5.kt index 40cd9adc99..1337ff7503 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/junit5/CalculatorTest5.kt +++ b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/junit5/CalculatorTest5.kt @@ -7,12 +7,12 @@ class CalculatorTest5 { private val calculator = Calculator() @Test - fun whenAdding1and3_thenAnswerIs4() { + fun `Adding 1 and 3 should be eqaul to 4`() { Assertions.assertEquals(4, calculator.add(1, 3)) } @Test - fun whenDividingBy0_thenErrorOccurs() { + fun `Dividing by zero should throw the DivideByZeroException`() { val exception = Assertions.assertThrows(DivideByZeroException::class.java) { calculator.divide(5, 0) } @@ -21,7 +21,7 @@ class CalculatorTest5 { } @Test - fun whenSquaringNumbers_thenCorrectAnswerGiven() { + fun `The square of a number should be eqaul to that number multiplied in itself`() { Assertions.assertAll( Executable { Assertions.assertEquals(1, calculator.square(1)) }, Executable { Assertions.assertEquals(4, calculator.square(2)) }, @@ -76,7 +76,7 @@ class CalculatorTest5 { Tag("logarithms") ) @Test - fun whenIcalculateLog2Of8_thenIget3() { + fun `Log to base 2 of 8 should be equal to 3`() { Assertions.assertEquals(3.0, calculator.log(2, 8)) } } diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/junit5/SimpleTest5.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/junit5/SimpleTest5.kt index 70d3fb90bf..49541985e1 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/junit5/SimpleTest5.kt +++ b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/junit5/SimpleTest5.kt @@ -5,15 +5,16 @@ import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test class SimpleTest5 { + @Test - fun whenEmptyList_thenListIsEmpty() { + fun `isEmpty should return true for empty lists`() { val list = listOf() Assertions.assertTrue(list::isEmpty) } @Test @Disabled - fun when3equals4_thenTestFails() { + fun `JUnit should complain and report failed assertions`() { Assertions.assertEquals(3, 4) { "Three does not equal four" } From f80f7b79a97714b430ae2b610c5709dc38fa39da Mon Sep 17 00:00:00 2001 From: Chirag Dewan Date: Fri, 1 Feb 2019 22:51:28 +0530 Subject: [PATCH 044/143] =?UTF-8?q?BAEL2567-New=20section=20on=20Lombok?= =?UTF-8?q?=E2=80=99s=20@Getter(lazy=3Dtrue)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/baeldung/singleton/GetterLazy.java | 10 ++++++ .../baeldung/lombok/getter/GetterLazy.java | 36 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 lombok-custom/src/main/java/com/baeldung/singleton/GetterLazy.java create mode 100644 lombok/src/main/java/com/baeldung/lombok/getter/GetterLazy.java diff --git a/lombok-custom/src/main/java/com/baeldung/singleton/GetterLazy.java b/lombok-custom/src/main/java/com/baeldung/singleton/GetterLazy.java new file mode 100644 index 0000000000..8d690ebde7 --- /dev/null +++ b/lombok-custom/src/main/java/com/baeldung/singleton/GetterLazy.java @@ -0,0 +1,10 @@ +package com.baeldung.singleton; + +import lombok.Getter; + + +public class GetterLazy { + + @Getter(lazy = true) + private final String name = "name"; +} diff --git a/lombok/src/main/java/com/baeldung/lombok/getter/GetterLazy.java b/lombok/src/main/java/com/baeldung/lombok/getter/GetterLazy.java new file mode 100644 index 0000000000..5ac82a74d8 --- /dev/null +++ b/lombok/src/main/java/com/baeldung/lombok/getter/GetterLazy.java @@ -0,0 +1,36 @@ +package com.baeldung.lombok.getter; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import lombok.Getter; + +public class GetterLazy { + + private static final String DELIMETER = ","; + + @Getter(lazy = true) + private final Map transactions = readTxnsFromFile(); + + private Map readTxnsFromFile() { + + final Map cache = new HashMap<>(); + List txnRows = readTxnListFromFile(); + + txnRows.forEach(s -> { + String[] txnIdValueTuple = s.split(DELIMETER); + cache.put(txnIdValueTuple[0], Long.parseLong(txnIdValueTuple[1])); + }); + + return cache; + } + + private List readTxnListFromFile() { + + // read large file + return Stream.of("file content here").collect(Collectors.toList()); + } +} From 328d58d3d070f15f7aa65de4ed529f3b618501f7 Mon Sep 17 00:00:00 2001 From: Chirag Dewan Date: Fri, 1 Feb 2019 22:52:52 +0530 Subject: [PATCH 045/143] =?UTF-8?q?BAEL2567-New=20section=20on=20Lombok?= =?UTF-8?q?=E2=80=99s=20@Getter(lazy=3Dtrue)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/baeldung/singleton/GetterLazy.java | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 lombok-custom/src/main/java/com/baeldung/singleton/GetterLazy.java diff --git a/lombok-custom/src/main/java/com/baeldung/singleton/GetterLazy.java b/lombok-custom/src/main/java/com/baeldung/singleton/GetterLazy.java deleted file mode 100644 index 8d690ebde7..0000000000 --- a/lombok-custom/src/main/java/com/baeldung/singleton/GetterLazy.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.baeldung.singleton; - -import lombok.Getter; - - -public class GetterLazy { - - @Getter(lazy = true) - private final String name = "name"; -} From 79308e633615577d2469c3592a8cad8990a7d1e5 Mon Sep 17 00:00:00 2001 From: Chirag Dewan Date: Fri, 1 Feb 2019 22:54:57 +0530 Subject: [PATCH 046/143] =?UTF-8?q?BAEL2567-New=20section=20on=20Lombok?= =?UTF-8?q?=E2=80=99s=20@Getter(lazy=3Dtrue)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/baeldung/loom/AsyncThreads.java | 22 ------------- .../com/baeldung/loom/BlockingThreads.java | 33 ------------------- 2 files changed, 55 deletions(-) delete mode 100644 libraries/src/main/java/com/baeldung/loom/AsyncThreads.java delete mode 100644 libraries/src/main/java/com/baeldung/loom/BlockingThreads.java diff --git a/libraries/src/main/java/com/baeldung/loom/AsyncThreads.java b/libraries/src/main/java/com/baeldung/loom/AsyncThreads.java deleted file mode 100644 index 1ec448be69..0000000000 --- a/libraries/src/main/java/com/baeldung/loom/AsyncThreads.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baeldung.loom; - -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; - -public class AsyncThreads { - - public static void main(String[] args) throws ExecutionException, InterruptedException { - - CompletableFuture cf = CompletableFuture.runAsync(() -> { - - System.out.println("Hello " + Thread.currentThread().getName()); - }); - - cf.thenRun(() -> { - - System.out.println("World " + Thread.currentThread().getName()); - }); - - cf.get(); - } -} diff --git a/libraries/src/main/java/com/baeldung/loom/BlockingThreads.java b/libraries/src/main/java/com/baeldung/loom/BlockingThreads.java deleted file mode 100644 index de11529753..0000000000 --- a/libraries/src/main/java/com/baeldung/loom/BlockingThreads.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.baeldung.loom; - -public class BlockingThreads { - - private static final Object LOCK = new Object(); - - public static void main(String[] args) throws InterruptedException { - - Thread thread1 = new Thread(() -> { - synchronized (LOCK) { - System.out.println("Hello " + Thread.currentThread().getName()); - LOCK.notify(); - } - }); - - - Thread thread2 = new Thread(() -> { - synchronized (LOCK) { - try { - System.out.println("Will wait for thread1 now..."); - LOCK.wait(); - System.out.println("World " + Thread.currentThread().getName()); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - }); - - thread2.start(); - thread1.start(); - - } -} From f324ce902f68bf00edcfabc3784975785e393bf7 Mon Sep 17 00:00:00 2001 From: amdegregorio Date: Fri, 1 Feb 2019 14:34:28 -0500 Subject: [PATCH 047/143] move the manifest into to simplify the example --- .../META-INF => java/com/baeldung/jar}/example_manifest.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename core-java/src/main/{resources/META-INF => java/com/baeldung/jar}/example_manifest.txt (100%) diff --git a/core-java/src/main/resources/META-INF/example_manifest.txt b/core-java/src/main/java/com/baeldung/jar/example_manifest.txt similarity index 100% rename from core-java/src/main/resources/META-INF/example_manifest.txt rename to core-java/src/main/java/com/baeldung/jar/example_manifest.txt From ec0ec38b0630cf1f1b8879b16ea988fb42b7c356 Mon Sep 17 00:00:00 2001 From: soufiane-cheouati <46105138+soufiane-cheouati@users.noreply.github.com> Date: Fri, 1 Feb 2019 20:16:40 +0000 Subject: [PATCH 048/143] Adding marker interfaces files --- .../baeldung/markerinterface/Deletable.java | 5 +++++ .../markerinterface/DeletableShape.java | 7 ++++++ .../baeldung/markerinterface/Rectangle.java | 22 +++++++++++++++++++ .../baeldung/markerinterface/ShapeDao.java | 14 ++++++++++++ 4 files changed, 48 insertions(+) create mode 100644 core-java-lang-oop/src/main/java/com/baeldung/markerinterface/Deletable.java create mode 100644 core-java-lang-oop/src/main/java/com/baeldung/markerinterface/DeletableShape.java create mode 100644 core-java-lang-oop/src/main/java/com/baeldung/markerinterface/Rectangle.java create mode 100644 core-java-lang-oop/src/main/java/com/baeldung/markerinterface/ShapeDao.java diff --git a/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/Deletable.java b/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/Deletable.java new file mode 100644 index 0000000000..d40d81b1d4 --- /dev/null +++ b/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/Deletable.java @@ -0,0 +1,5 @@ +package com.baeldung.markerinterface; + +public interface Deletable extends DeletableShape { + +} diff --git a/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/DeletableShape.java b/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/DeletableShape.java new file mode 100644 index 0000000000..d5ae52c9f2 --- /dev/null +++ b/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/DeletableShape.java @@ -0,0 +1,7 @@ +package com.baeldung.markerinterface; + +public interface DeletableShape { + double getArea(); + + double getCircumference(); +} \ No newline at end of file diff --git a/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/Rectangle.java b/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/Rectangle.java new file mode 100644 index 0000000000..f8ea987c6f --- /dev/null +++ b/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/Rectangle.java @@ -0,0 +1,22 @@ +package com.baeldung.markerinterface; + +public class Rectangle implements Deletable { + + private double width; + private double height; + + public Rectangle(double width, double height) { + this.width = width; + this.height = height; + } + + @Override + public double getArea() { + return width * height; + } + + @Override + public double getCircumference() { + return 2 * (width + height); + } +} diff --git a/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/ShapeDao.java b/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/ShapeDao.java new file mode 100644 index 0000000000..49a389bd46 --- /dev/null +++ b/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/ShapeDao.java @@ -0,0 +1,14 @@ +package com.baeldung.markerinterface; + +public class ShapeDao { + + public boolean delete(Object object) { + if (!(object instanceof Deletable)) { + return false; + } + // Calling the code that deletes the entity from the database + + return true; + } + +} From f76d6bd66849a0ea148ea3cacb8835b9e64fcd9b Mon Sep 17 00:00:00 2001 From: soufiane-cheouati <46105138+soufiane-cheouati@users.noreply.github.com> Date: Fri, 1 Feb 2019 20:18:24 +0000 Subject: [PATCH 049/143] Adding marker interfaces UT --- .../MarkerInterfaceUnitTest.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 core-java-lang-oop/src/test/java/com/baeldung/markerinterface/MarkerInterfaceUnitTest.java diff --git a/core-java-lang-oop/src/test/java/com/baeldung/markerinterface/MarkerInterfaceUnitTest.java b/core-java-lang-oop/src/test/java/com/baeldung/markerinterface/MarkerInterfaceUnitTest.java new file mode 100644 index 0000000000..70d32ba253 --- /dev/null +++ b/core-java-lang-oop/src/test/java/com/baeldung/markerinterface/MarkerInterfaceUnitTest.java @@ -0,0 +1,26 @@ +package com.baeldung.markerinterface; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; + +public class MarkerInterfaceUnitTest { + + @Test + public void givenDeletableObjectThenTrueReturned() { + ShapeDao shapeDao = new ShapeDao(); + Object rectangle = new Rectangle(2, 3); + + boolean result = shapeDao.delete(rectangle); + assertEquals(true, result); + } + + @Test + public void givenNonDeletableObjectThenFalseReturned() { + ShapeDao shapeDao = new ShapeDao(); + Object object = new Object(); + + boolean result = shapeDao.delete(object); + assertEquals(false, result); + } +} From ee34c027c06cc363d3cc78dfc3a57416d5402337 Mon Sep 17 00:00:00 2001 From: Andrey Shcherbakov Date: Sat, 2 Feb 2019 11:01:02 +0100 Subject: [PATCH 050/143] Rename the test in boot-autoconfiguration --- ...ngContextIntegrationTest.java => SpringContextLiveTest.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spring-boot-autoconfiguration/src/test/java/com/baeldung/{SpringContextIntegrationTest.java => SpringContextLiveTest.java} (92%) diff --git a/spring-boot-autoconfiguration/src/test/java/com/baeldung/SpringContextIntegrationTest.java b/spring-boot-autoconfiguration/src/test/java/com/baeldung/SpringContextLiveTest.java similarity index 92% rename from spring-boot-autoconfiguration/src/test/java/com/baeldung/SpringContextIntegrationTest.java rename to spring-boot-autoconfiguration/src/test/java/com/baeldung/SpringContextLiveTest.java index a0138bec8d..494013d1d9 100644 --- a/spring-boot-autoconfiguration/src/test/java/com/baeldung/SpringContextIntegrationTest.java +++ b/spring-boot-autoconfiguration/src/test/java/com/baeldung/SpringContextLiveTest.java @@ -11,7 +11,7 @@ import com.baeldung.autoconfiguration.MySQLAutoconfiguration; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = MySQLAutoconfiguration.class) @WebAppConfiguration -public class SpringContextIntegrationTest { +public class SpringContextLiveTest { @Test public void whenSpringContextIsBootstrapped_thenNoExceptions() { From 4b4e5ab87015dfd20f6b7a7e93263e2e161290b5 Mon Sep 17 00:00:00 2001 From: Andrey Shcherbakov Date: Sat, 2 Feb 2019 11:08:19 +0100 Subject: [PATCH 051/143] Add a test to spring-boot-h2 module --- .../SpringContextIntegrationTest.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 persistence-modules/spring-boot-h2/spring-boot-h2-database/src/test/java/com/baeldung/SpringContextIntegrationTest.java diff --git a/persistence-modules/spring-boot-h2/spring-boot-h2-database/src/test/java/com/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-boot-h2/spring-boot-h2-database/src/test/java/com/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..cf964b5011 --- /dev/null +++ b/persistence-modules/spring-boot-h2/spring-boot-h2-database/src/test/java/com/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,19 @@ +package com.baeldung; + +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; +import org.springframework.test.context.web.WebAppConfiguration; + + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(loader = AnnotationConfigContextLoader.class) +@WebAppConfiguration +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} From 2f8beaf1691194ce6d1c4f848a8fc900d8764852 Mon Sep 17 00:00:00 2001 From: Andrey Shcherbakov Date: Sat, 2 Feb 2019 11:16:50 +0100 Subject: [PATCH 052/143] Add a test to spring-mvc-simple module --- .../SpringContextIntegrationTest.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 spring-mvc-simple/src/test/java/com/baeldung/SpringContextIntegrationTest.java diff --git a/spring-mvc-simple/src/test/java/com/baeldung/SpringContextIntegrationTest.java b/spring-mvc-simple/src/test/java/com/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..994c4865f7 --- /dev/null +++ b/spring-mvc-simple/src/test/java/com/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,21 @@ +package com.baeldung; + +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.web.WebAppConfiguration; + +import com.baeldung.spring.configuration.ApplicationConfiguration; + + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes={ApplicationConfiguration.class}) +@WebAppConfiguration +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} + From 724139c9df0eab8be24586412953135c83b7effc Mon Sep 17 00:00:00 2001 From: amdegregorio Date: Sat, 2 Feb 2019 06:50:52 -0500 Subject: [PATCH 053/143] clean up unused file --- core-java/src/main/resources/files/dimensions.txt | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 core-java/src/main/resources/files/dimensions.txt diff --git a/core-java/src/main/resources/files/dimensions.txt b/core-java/src/main/resources/files/dimensions.txt deleted file mode 100644 index 0397c2a610..0000000000 --- a/core-java/src/main/resources/files/dimensions.txt +++ /dev/null @@ -1,3 +0,0 @@ -12,16 -24,6 -7,19 \ No newline at end of file From f9cf8b1a5ec09f2a286ffd2cab0cbfcc669fa14a Mon Sep 17 00:00:00 2001 From: Mikhail Chugunov Date: Sat, 2 Feb 2019 19:54:06 +0300 Subject: [PATCH 054/143] BAEL-2443: Implement JsonView filtering based on Spring security (#6254) * BAEL-2443: Implement filtering with @JsonView based on spring security role * Cleanup test * Rename tests * Fix renaming roles after refactoring --- pom.xml | 1 + spring-security-mvc-jsonview/.gitignore | 13 + spring-security-mvc-jsonview/pom.xml | 222 ++++++++++++++++++ .../java/com/baeldung/AppInitializer.java | 33 +++ .../baeldung/controller/ItemsController.java | 21 ++ .../java/com/baeldung/controller/View.java | 24 ++ .../main/java/com/baeldung/model/Item.java | 32 +++ .../java/com/baeldung/spring/AppConfig.java | 51 ++++ .../SecurityJsonViewControllerAdvice.java | 38 +++ .../src/main/resources/logback.xml | 19 ++ .../SpringContextIntegrationTest.java | 17 ++ ...SpringSecurityJsonViewIntegrationTest.java | 85 +++++++ 12 files changed, 556 insertions(+) create mode 100644 spring-security-mvc-jsonview/.gitignore create mode 100644 spring-security-mvc-jsonview/pom.xml create mode 100644 spring-security-mvc-jsonview/src/main/java/com/baeldung/AppInitializer.java create mode 100644 spring-security-mvc-jsonview/src/main/java/com/baeldung/controller/ItemsController.java create mode 100644 spring-security-mvc-jsonview/src/main/java/com/baeldung/controller/View.java create mode 100644 spring-security-mvc-jsonview/src/main/java/com/baeldung/model/Item.java create mode 100644 spring-security-mvc-jsonview/src/main/java/com/baeldung/spring/AppConfig.java create mode 100644 spring-security-mvc-jsonview/src/main/java/com/baeldung/spring/SecurityJsonViewControllerAdvice.java create mode 100644 spring-security-mvc-jsonview/src/main/resources/logback.xml create mode 100644 spring-security-mvc-jsonview/src/test/java/com/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-security-mvc-jsonview/src/test/java/com/baeldung/security/SpringSecurityJsonViewIntegrationTest.java diff --git a/pom.xml b/pom.xml index 787a03c2fb..58d57ade05 100644 --- a/pom.xml +++ b/pom.xml @@ -733,6 +733,7 @@ spring-security-mvc-boot spring-security-mvc-custom spring-security-mvc-digest-auth + spring-security-mvc-jsonview spring-security-mvc-ldap spring-security-mvc-login spring-security-mvc-persisted-remember-me diff --git a/spring-security-mvc-jsonview/.gitignore b/spring-security-mvc-jsonview/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/spring-security-mvc-jsonview/.gitignore @@ -0,0 +1,13 @@ +*.class + +#folders# +/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-security-mvc-jsonview/pom.xml b/spring-security-mvc-jsonview/pom.xml new file mode 100644 index 0000000000..7f1129128f --- /dev/null +++ b/spring-security-mvc-jsonview/pom.xml @@ -0,0 +1,222 @@ + + 4.0.0 + + com.baeldung + spring-security-mvc-jsonview + 0.1-SNAPSHOT + spring-security-mvc-jsonview + war + + + com.baeldung + parent-spring-5 + 0.0.1-SNAPSHOT + ../parent-spring-5 + + + + + + com.fasterxml.jackson.core + jackson-core + 2.9.7 + + + com.fasterxml.jackson.core + jackson-annotations + 2.9.7 + + + com.fasterxml.jackson.core + jackson-databind + 2.9.7 + + + + + + org.springframework.security + spring-security-web + ${org.springframework.security.version} + + + org.springframework.security + spring-security-config + ${org.springframework.security.version} + + + org.springframework.security + spring-security-taglibs + ${org.springframework.security.version} + + + + + + org.springframework + spring-core + ${spring.version} + + + commons-logging + commons-logging + + + + + org.springframework + spring-context + ${spring.version} + + + org.springframework + spring-jdbc + ${spring.version} + + + org.springframework + spring-beans + ${spring.version} + + + org.springframework + spring-aop + ${spring.version} + + + org.springframework + spring-tx + ${spring.version} + + + org.springframework + spring-expression + ${spring.version} + + + + org.springframework + spring-web + ${spring.version} + + + org.springframework + spring-webmvc + ${spring.version} + + + + + + javax.servlet + javax.servlet-api + ${javax.servlet.version} + provided + + + + javax.servlet + jstl + ${jstl.version} + runtime + + + + + + org.springframework + spring-test + ${spring.version} + test + + + org.springframework.security + spring-security-test + ${org.springframework.security.version} + test + + + com.jayway.jsonpath + json-path + 2.4.0 + test + + + + + + spring-security-mvc-jsonview + + + src/main/resources + true + + + + + + + org.apache.maven.plugins + maven-war-plugin + ${maven-war-plugin.version} + + + default-war + prepare-package + + false + + + + + + + org.codehaus.cargo + cargo-maven2-plugin + ${cargo-maven2-plugin.version} + + + + ${project.build.directory}/${project.name}.war + war + + / + + + + + 2400000 + tomcat8x + embedded + + + + + + + 8084 + + + + + + + + + + + + 5.0.5.RELEASE + + + 3.1.0 + 1.2 + + + 2.6 + 1.6.1 + + + + \ No newline at end of file diff --git a/spring-security-mvc-jsonview/src/main/java/com/baeldung/AppInitializer.java b/spring-security-mvc-jsonview/src/main/java/com/baeldung/AppInitializer.java new file mode 100644 index 0000000000..4f38d190eb --- /dev/null +++ b/spring-security-mvc-jsonview/src/main/java/com/baeldung/AppInitializer.java @@ -0,0 +1,33 @@ +package com.baeldung; + +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.ServletRegistration; + +import org.springframework.web.WebApplicationInitializer; +import org.springframework.web.context.ContextLoaderListener; +import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; +import org.springframework.web.context.support.GenericWebApplicationContext; +import org.springframework.web.filter.DelegatingFilterProxy; +import org.springframework.web.servlet.DispatcherServlet; + +public class AppInitializer implements WebApplicationInitializer { + + @Override + public void onStartup(final ServletContext sc) throws ServletException { + + AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext(); + + root.scan("com.baeldung"); + sc.addListener(new ContextLoaderListener(root)); + + ServletRegistration.Dynamic appServlet = sc.addServlet("mvc", new DispatcherServlet(new GenericWebApplicationContext())); + appServlet.setLoadOnStartup(1); + appServlet.addMapping("/"); + + sc.addFilter("securityFilter", new DelegatingFilterProxy("springSecurityFilterChain")) + .addMappingForUrlPatterns(null, false, "/*"); + + } + +} diff --git a/spring-security-mvc-jsonview/src/main/java/com/baeldung/controller/ItemsController.java b/spring-security-mvc-jsonview/src/main/java/com/baeldung/controller/ItemsController.java new file mode 100644 index 0000000000..16268a239b --- /dev/null +++ b/spring-security-mvc-jsonview/src/main/java/com/baeldung/controller/ItemsController.java @@ -0,0 +1,21 @@ +package com.baeldung.controller; + +import com.baeldung.model.Item; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; + +@RestController +public class ItemsController { + + @RequestMapping("/items") + public Collection getItems() { + return Arrays.asList(new Item(1, "Item 1", "Frank"), new Item(2, "Item 2", "Bob")); + } + +} diff --git a/spring-security-mvc-jsonview/src/main/java/com/baeldung/controller/View.java b/spring-security-mvc-jsonview/src/main/java/com/baeldung/controller/View.java new file mode 100644 index 0000000000..10ae50adef --- /dev/null +++ b/spring-security-mvc-jsonview/src/main/java/com/baeldung/controller/View.java @@ -0,0 +1,24 @@ +package com.baeldung.controller; + +import com.baeldung.spring.AppConfig.Role; + +import java.util.HashMap; +import java.util.Map; + +public class View { + + public static final Map MAPPING = new HashMap<>(); + + static { + MAPPING.put(Role.ROLE_ADMIN, Admin.class); + MAPPING.put(Role.ROLE_USER, User.class); + } + + public static class User { + + } + + public static class Admin extends User { + + } +} diff --git a/spring-security-mvc-jsonview/src/main/java/com/baeldung/model/Item.java b/spring-security-mvc-jsonview/src/main/java/com/baeldung/model/Item.java new file mode 100644 index 0000000000..002ee73e4f --- /dev/null +++ b/spring-security-mvc-jsonview/src/main/java/com/baeldung/model/Item.java @@ -0,0 +1,32 @@ +package com.baeldung.model; + +import com.baeldung.controller.View; +import com.fasterxml.jackson.annotation.JsonView; + +public class Item { + + @JsonView(View.User.class) + private int id; + @JsonView(View.User.class) + private String name; + @JsonView(View.Admin.class) + private String ownerName; + + public Item(int id, String name, String ownerName) { + this.id = id; + this.name = name; + this.ownerName = ownerName; + } + + public int getId() { + return id; + } + + public String getName() { + return name; + } + + public String getOwnerName() { + return ownerName; + } +} diff --git a/spring-security-mvc-jsonview/src/main/java/com/baeldung/spring/AppConfig.java b/spring-security-mvc-jsonview/src/main/java/com/baeldung/spring/AppConfig.java new file mode 100644 index 0000000000..10b2d2447e --- /dev/null +++ b/spring-security-mvc-jsonview/src/main/java/com/baeldung/spring/AppConfig.java @@ -0,0 +1,51 @@ +package com.baeldung.spring; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +import java.util.Arrays; + +@Configuration +@EnableWebMvc +@EnableWebSecurity +@ComponentScan("com.baeldung") +public class AppConfig extends WebSecurityConfigurerAdapter implements WebMvcConfigurer { + + @Override + protected void configure(final AuthenticationManagerBuilder auth) throws Exception { + auth.inMemoryAuthentication() + .withUser("user").password(passwordEncoder().encode("userPass")).roles("USER") + .and() + .withUser("admin").password(passwordEncoder().encode("adminPass")).roles("ADMIN"); + } + + @Override + protected void configure(final HttpSecurity http) throws Exception { + http + .csrf().disable() + .authorizeRequests() + .anyRequest().authenticated() + .and().httpBasic(); + } + + @Bean + public PasswordEncoder passwordEncoder() { + return new BCryptPasswordEncoder(); + } + + + + public enum Role { + ROLE_USER, + ROLE_ADMIN + } +} diff --git a/spring-security-mvc-jsonview/src/main/java/com/baeldung/spring/SecurityJsonViewControllerAdvice.java b/spring-security-mvc-jsonview/src/main/java/com/baeldung/spring/SecurityJsonViewControllerAdvice.java new file mode 100644 index 0000000000..66c7207e91 --- /dev/null +++ b/spring-security-mvc-jsonview/src/main/java/com/baeldung/spring/SecurityJsonViewControllerAdvice.java @@ -0,0 +1,38 @@ +package com.baeldung.spring; + +import com.baeldung.controller.View; +import org.springframework.core.MethodParameter; +import org.springframework.http.MediaType; +import org.springframework.http.converter.json.MappingJacksonValue; +import org.springframework.http.server.ServerHttpRequest; +import org.springframework.http.server.ServerHttpResponse; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.web.bind.annotation.RestControllerAdvice; +import org.springframework.web.servlet.mvc.method.annotation.AbstractMappingJacksonResponseBodyAdvice; + +import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; + +@RestControllerAdvice +public class SecurityJsonViewControllerAdvice extends AbstractMappingJacksonResponseBodyAdvice { + + @Override + protected void beforeBodyWriteInternal(MappingJacksonValue bodyContainer, MediaType contentType, + MethodParameter returnType, ServerHttpRequest request, ServerHttpResponse response) { + if (SecurityContextHolder.getContext().getAuthentication() != null + && SecurityContextHolder.getContext().getAuthentication().getAuthorities() != null) { + Collection authorities = SecurityContextHolder.getContext().getAuthentication().getAuthorities(); + List jsonViews = authorities.stream() + .map(GrantedAuthority::getAuthority) + .map(AppConfig.Role::valueOf) + .map(View.MAPPING::get) + .collect(Collectors.toList()); + if (jsonViews.size() == 1) { + bodyContainer.setSerializationView(jsonViews.get(0)); + } + throw new IllegalArgumentException("Ambiguous @JsonView declaration for roles "+ authorities.stream().map(GrantedAuthority::getAuthority).collect(Collectors.joining(","))); + } + } +} diff --git a/spring-security-mvc-jsonview/src/main/resources/logback.xml b/spring-security-mvc-jsonview/src/main/resources/logback.xml new file mode 100644 index 0000000000..56af2d397e --- /dev/null +++ b/spring-security-mvc-jsonview/src/main/resources/logback.xml @@ -0,0 +1,19 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-security-mvc-jsonview/src/test/java/com/baeldung/SpringContextIntegrationTest.java b/spring-security-mvc-jsonview/src/test/java/com/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..e22cd3d71a --- /dev/null +++ b/spring-security-mvc-jsonview/src/test/java/com/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package com.baeldung; + +import com.baeldung.spring.AppConfig; +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.web.WebAppConfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = AppConfig.class) +@WebAppConfiguration +public class SpringContextIntegrationTest { + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-security-mvc-jsonview/src/test/java/com/baeldung/security/SpringSecurityJsonViewIntegrationTest.java b/spring-security-mvc-jsonview/src/test/java/com/baeldung/security/SpringSecurityJsonViewIntegrationTest.java new file mode 100644 index 0000000000..626c8cb497 --- /dev/null +++ b/spring-security-mvc-jsonview/src/test/java/com/baeldung/security/SpringSecurityJsonViewIntegrationTest.java @@ -0,0 +1,85 @@ +package com.baeldung.security; + +import com.baeldung.spring.AppConfig; +import org.hamcrest.BaseMatcher; +import org.hamcrest.Description; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.util.NestedServletException; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = AppConfig.class) +@WebAppConfiguration +public class SpringSecurityJsonViewIntegrationTest { + + @Autowired + private WebApplicationContext context; + + private MockMvc mvc; + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @Before + public void setup() { + mvc = MockMvcBuilders + .webAppContextSetup(context) + .build(); + } + + @Test + @WithMockUser(username = "admin", password = "adminPass", roles = "ADMIN") + public void whenAdminRequests_thenOwnerNameIsPresent() throws Exception { + mvc.perform(get("/items")) + .andExpect(status().isOk()) + .andExpect(jsonPath("$[0].id").value(1)) + .andExpect(jsonPath("$[0].name").value("Item 1")) + .andExpect(jsonPath("$[0].ownerName").exists()); + } + + @Test + @WithMockUser(username = "user", password = "userPass", roles = "USER") + public void whenUserRequests_thenOwnerNameIsAbsent() throws Exception { + mvc.perform(get("/items")) + .andExpect(status().isOk()) + .andExpect(jsonPath("$[0].id").value(1)) + .andExpect(jsonPath("$[0].name").value("Item 1")) + .andExpect(jsonPath("$[0].ownerName").doesNotExist()); + } + + @Test + @WithMockUser(username = "user", password = "userPass", roles = {"ADMIN", "USER"}) + public void whenMultipleRoles_thenExceptionIsThrown() throws Exception { + expectedException.expect(new BaseMatcher() { + @Override + public boolean matches(Object o) { + NestedServletException exception = (NestedServletException) o; + return exception.getCause() instanceof IllegalArgumentException && exception.getCause().getMessage().equals("Ambiguous @JsonView declaration for roles ROLE_ADMIN,ROLE_USER"); + } + + @Override + public void describeTo(Description description) { + + } + }); + + mvc.perform(get("/items")) + .andExpect(status().isOk()); + + } +} From 6a020446e98ba87cdca00fb6eb5eb6869da1421c Mon Sep 17 00:00:00 2001 From: Andrey Shcherbakov Date: Sat, 2 Feb 2019 17:56:34 +0100 Subject: [PATCH 055/143] Add the integration test to spring-mvc-java module --- .../SpringContextIntegrationTest.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 spring-mvc-java/src/test/java/com/baeldung/SpringContextIntegrationTest.java diff --git a/spring-mvc-java/src/test/java/com/baeldung/SpringContextIntegrationTest.java b/spring-mvc-java/src/test/java/com/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..4c06917325 --- /dev/null +++ b/spring-mvc-java/src/test/java/com/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,21 @@ +package com.baeldung; + +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; +import org.springframework.test.context.web.WebAppConfiguration; + +import com.baeldung.config.AppInitializer; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { AppInitializer.class }, loader = AnnotationConfigContextLoader.class) +@WebAppConfiguration +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + + } +} From 693d9d994706a3223d096c0bb60d4a80e3634919 Mon Sep 17 00:00:00 2001 From: Andrey Shcherbakov Date: Sat, 2 Feb 2019 19:43:39 +0100 Subject: [PATCH 056/143] Add the integration test tospring-jpa module --- .../SpringContextIntegrationTest.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 persistence-modules/spring-jpa/src/test/java/com/baeldung/SpringContextIntegrationTest.java diff --git a/persistence-modules/spring-jpa/src/test/java/com/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-jpa/src/test/java/com/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..aa85128628 --- /dev/null +++ b/persistence-modules/spring-jpa/src/test/java/com/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,19 @@ +package com.baeldung; + +import org.baeldung.config.PersistenceJPAConfigL2Cache; +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; +import org.springframework.test.context.web.WebAppConfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { PersistenceJPAConfigL2Cache.class }, loader = AnnotationConfigContextLoader.class) +@WebAppConfiguration +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} From 2983e1c26ae5a49dd41459d050b3b92cb30676ab Mon Sep 17 00:00:00 2001 From: Andrey Shcherbakov Date: Sat, 2 Feb 2019 20:54:09 +0100 Subject: [PATCH 057/143] Add the live test to spring-exceptions module --- ...textIntegrationTest.java => SpringContextLiveTest.java} | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) rename spring-exceptions/src/test/java/org/baeldung/{SpringContextIntegrationTest.java => SpringContextLiveTest.java} (63%) diff --git a/spring-exceptions/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/SpringContextLiveTest.java similarity index 63% rename from spring-exceptions/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to spring-exceptions/src/test/java/org/baeldung/SpringContextLiveTest.java index 492673b168..ece7e0e730 100644 --- a/spring-exceptions/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/spring-exceptions/src/test/java/org/baeldung/SpringContextLiveTest.java @@ -1,16 +1,15 @@ package org.baeldung; -import org.baeldung.spring.config.CoreConfig; -import org.baeldung.spring.config.MvcConfig; import org.baeldung.spring.config.PersistenceConfig; 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(classes = { CoreConfig.class, MvcConfig.class, PersistenceConfig.class}) -public class SpringContextIntegrationTest { +@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) +public class SpringContextLiveTest { @Test public void whenSpringContextIsBootstrapped_thenNoExceptions() { From c00bfd2d29035c9695e04199b0019e145e5f9a44 Mon Sep 17 00:00:00 2001 From: Andrey Shcherbakov Date: Sat, 2 Feb 2019 21:08:52 +0100 Subject: [PATCH 058/143] Add the integration test to spring-static-resources module --- spring-static-resources/pom.xml | 8 ++++++++ .../SpringContextIntegrationTest.java | 20 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 spring-static-resources/src/test/java/com/baeldung/SpringContextIntegrationTest.java diff --git a/spring-static-resources/pom.xml b/spring-static-resources/pom.xml index 3ca7783682..92f6616839 100644 --- a/spring-static-resources/pom.xml +++ b/spring-static-resources/pom.xml @@ -140,6 +140,14 @@ handlebars ${handlebars.version} + + + org.springframework + spring-test + ${spring.version} + test + + diff --git a/spring-static-resources/src/test/java/com/baeldung/SpringContextIntegrationTest.java b/spring-static-resources/src/test/java/com/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..67dc50030c --- /dev/null +++ b/spring-static-resources/src/test/java/com/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,20 @@ +package com.baeldung; + +import org.baeldung.spring.SecSecurityConfig; +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; +import org.springframework.test.context.web.WebAppConfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { SecSecurityConfig.class }, loader = AnnotationConfigContextLoader.class) +@WebAppConfiguration +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + + } +} From 1f7bbd3c2266cc815437247649a0caffb07f4802 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 3 Feb 2019 11:55:43 +0530 Subject: [PATCH 059/143] [BAEL-12114] - Upgraded MapStruct article --- mapstruct/pom.xml | 13 +++++++- .../main/java/com/baeldung/dto/CarDTO.java | 11 +++++++ .../main/java/com/baeldung/dto/PersonDTO.java | 33 +++++++++++++++++++ .../main/java/com/baeldung/entity/Car.java | 11 +++++++ .../main/java/com/baeldung/entity/Person.java | 33 +++++++++++++++++++ .../java/com/baeldung/mapper/CarMapper.java | 15 +++++++++ .../com/baeldung/mapper/PersonMapper.java | 17 ++++++++++ .../baeldung/mapper/CarMapperUnitTest.java | 24 ++++++++++++++ .../baeldung/mapper/PersonMapperUnitTest.java | 26 +++++++++++++++ 9 files changed, 182 insertions(+), 1 deletion(-) create mode 100644 mapstruct/src/main/java/com/baeldung/dto/CarDTO.java create mode 100644 mapstruct/src/main/java/com/baeldung/dto/PersonDTO.java create mode 100644 mapstruct/src/main/java/com/baeldung/entity/Car.java create mode 100644 mapstruct/src/main/java/com/baeldung/entity/Person.java create mode 100644 mapstruct/src/main/java/com/baeldung/mapper/CarMapper.java create mode 100644 mapstruct/src/main/java/com/baeldung/mapper/PersonMapper.java create mode 100644 mapstruct/src/test/java/com/baeldung/mapper/CarMapperUnitTest.java create mode 100644 mapstruct/src/test/java/com/baeldung/mapper/PersonMapperUnitTest.java diff --git a/mapstruct/pom.xml b/mapstruct/pom.xml index 6c274dfcf2..0493775f85 100644 --- a/mapstruct/pom.xml +++ b/mapstruct/pom.xml @@ -30,6 +30,11 @@ ${springframework.version} test + + org.projectlombok + lombok + ${org.projectlombok.version} + @@ -48,6 +53,11 @@ mapstruct-processor ${org.mapstruct.version} + + org.projectlombok + lombok + ${org.projectlombok.version} + @@ -55,10 +65,11 @@ - 1.1.0.Final + 1.3.0.Beta2 4.3.4.RELEASE 1.8 1.8 + 1.18.4 diff --git a/mapstruct/src/main/java/com/baeldung/dto/CarDTO.java b/mapstruct/src/main/java/com/baeldung/dto/CarDTO.java new file mode 100644 index 0000000000..51aa8ccac2 --- /dev/null +++ b/mapstruct/src/main/java/com/baeldung/dto/CarDTO.java @@ -0,0 +1,11 @@ +package com.baeldung.dto; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class CarDTO { + private int id; + private String name; +} diff --git a/mapstruct/src/main/java/com/baeldung/dto/PersonDTO.java b/mapstruct/src/main/java/com/baeldung/dto/PersonDTO.java new file mode 100644 index 0000000000..ace7a2bc7d --- /dev/null +++ b/mapstruct/src/main/java/com/baeldung/dto/PersonDTO.java @@ -0,0 +1,33 @@ +package com.baeldung.dto; + +public class PersonDTO { + + private String id; + private String name; + + public PersonDTO() { + + } + + public PersonDTO(String id, String name) { + super(); + this.id = id; + this.name = name; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} \ No newline at end of file diff --git a/mapstruct/src/main/java/com/baeldung/entity/Car.java b/mapstruct/src/main/java/com/baeldung/entity/Car.java new file mode 100644 index 0000000000..8559b4a77d --- /dev/null +++ b/mapstruct/src/main/java/com/baeldung/entity/Car.java @@ -0,0 +1,11 @@ +package com.baeldung.entity; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class Car { + private int id; + private String name; +} diff --git a/mapstruct/src/main/java/com/baeldung/entity/Person.java b/mapstruct/src/main/java/com/baeldung/entity/Person.java new file mode 100644 index 0000000000..5f73ee1130 --- /dev/null +++ b/mapstruct/src/main/java/com/baeldung/entity/Person.java @@ -0,0 +1,33 @@ +package com.baeldung.entity; + +public class Person { + + private String id; + private String name; + + public Person() { + + } + + public Person(String id, String name) { + super(); + this.id = id; + this.name = name; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} \ No newline at end of file diff --git a/mapstruct/src/main/java/com/baeldung/mapper/CarMapper.java b/mapstruct/src/main/java/com/baeldung/mapper/CarMapper.java new file mode 100644 index 0000000000..c18fa44f8d --- /dev/null +++ b/mapstruct/src/main/java/com/baeldung/mapper/CarMapper.java @@ -0,0 +1,15 @@ +package com.baeldung.mapper; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import com.baeldung.dto.CarDTO; +import com.baeldung.entity.Car; + +@Mapper +public interface CarMapper { + + CarMapper INSTANCE = Mappers.getMapper(CarMapper.class); + + CarDTO carToCarDTO(Car car); +} diff --git a/mapstruct/src/main/java/com/baeldung/mapper/PersonMapper.java b/mapstruct/src/main/java/com/baeldung/mapper/PersonMapper.java new file mode 100644 index 0000000000..9b9e132b5d --- /dev/null +++ b/mapstruct/src/main/java/com/baeldung/mapper/PersonMapper.java @@ -0,0 +1,17 @@ +package com.baeldung.mapper; + +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +import com.baeldung.dto.PersonDTO; +import com.baeldung.entity.Person; + +@Mapper +public interface PersonMapper { + + PersonMapper INSTANCE = Mappers.getMapper(PersonMapper.class); + + @Mapping(target = "id", source = "person.id", defaultExpression = "java(java.util.UUID.randomUUID().toString())") + PersonDTO personToPersonDTO(Person person); +} diff --git a/mapstruct/src/test/java/com/baeldung/mapper/CarMapperUnitTest.java b/mapstruct/src/test/java/com/baeldung/mapper/CarMapperUnitTest.java new file mode 100644 index 0000000000..32cae56c2e --- /dev/null +++ b/mapstruct/src/test/java/com/baeldung/mapper/CarMapperUnitTest.java @@ -0,0 +1,24 @@ +package com.baeldung.mapper; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +import com.baeldung.dto.CarDTO; +import com.baeldung.entity.Car; + +public class CarMapperUnitTest { + + @Test + public void givenCarEntitytoCar_whenMaps_thenCorrect() { + + Car entity = new Car(); + entity.setId(1); + entity.setName("Toyota"); + + CarDTO carDto = CarMapper.INSTANCE.carToCarDTO(entity); + + assertEquals(carDto.getId(), entity.getId()); + assertEquals(carDto.getName(), entity.getName()); + } +} diff --git a/mapstruct/src/test/java/com/baeldung/mapper/PersonMapperUnitTest.java b/mapstruct/src/test/java/com/baeldung/mapper/PersonMapperUnitTest.java new file mode 100644 index 0000000000..fe4c52ac89 --- /dev/null +++ b/mapstruct/src/test/java/com/baeldung/mapper/PersonMapperUnitTest.java @@ -0,0 +1,26 @@ +package com.baeldung.mapper; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import org.junit.Test; + +import com.baeldung.dto.PersonDTO; +import com.baeldung.entity.Person; + +public class PersonMapperUnitTest { + + @Test + public void givenPersonEntitytoPersonWithExpression_whenMaps_thenCorrect() { + + Person entity = new Person(); + entity.setName("Micheal"); + + PersonDTO personDto = PersonMapper.INSTANCE.personToPersonDTO(entity); + + assertNull(entity.getId()); + assertNotNull(personDto.getId()); + assertEquals(personDto.getName(), entity.getName()); + } +} \ No newline at end of file From 22379add8edf84b76bf4e584d2c91005f6b372ef Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 3 Feb 2019 15:03:02 +0530 Subject: [PATCH 060/143] [BAEL-10924] - Fixed spring-data-rest integration tests --- ...pringDataRestValidatorIntegrationTest.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/spring-data-rest/src/test/java/com/baeldung/validator/SpringDataRestValidatorIntegrationTest.java b/spring-data-rest/src/test/java/com/baeldung/validator/SpringDataRestValidatorIntegrationTest.java index d41736e434..6da76d6a33 100644 --- a/spring-data-rest/src/test/java/com/baeldung/validator/SpringDataRestValidatorIntegrationTest.java +++ b/spring-data-rest/src/test/java/com/baeldung/validator/SpringDataRestValidatorIntegrationTest.java @@ -1,8 +1,12 @@ package com.baeldung.validator; -import com.baeldung.SpringDataRestApplication; -import com.baeldung.models.WebsiteUser; -import com.fasterxml.jackson.databind.ObjectMapper; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.redirectedUrl; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -10,14 +14,14 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; +import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.web.context.WebApplicationContext; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.redirectedUrl; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup; +import com.baeldung.SpringDataRestApplication; +import com.baeldung.models.WebsiteUser; +import com.fasterxml.jackson.databind.ObjectMapper; @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = SpringDataRestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.MOCK) @@ -42,6 +46,7 @@ public class SpringDataRestValidatorIntegrationTest { }; @Test + @DirtiesContext(methodMode = DirtiesContext.MethodMode.BEFORE_METHOD) public void whenAddingNewCorrectUser_thenCorrectStatusCodeAndResponse() throws Exception { WebsiteUser user = new WebsiteUser(); user.setEmail("john.doe@john.com"); @@ -83,6 +88,7 @@ public class SpringDataRestValidatorIntegrationTest { } @Test + @DirtiesContext(methodMode = DirtiesContext.MethodMode.BEFORE_METHOD) public void whenDeletingCorrectUser_thenCorrectStatusCodeAndResponse() throws Exception { WebsiteUser user = new WebsiteUser(); user.setEmail("john.doe@john.com"); @@ -92,6 +98,7 @@ public class SpringDataRestValidatorIntegrationTest { } @Test + @DirtiesContext(methodMode = DirtiesContext.MethodMode.BEFORE_METHOD) public void whenSearchingByEmail_thenCorrectStatusCodeAndResponse() throws Exception { WebsiteUser user = new WebsiteUser(); user.setEmail("john.doe@john.com"); From 3afae4a68980a2a5b5176bacb8aa4d94e9d4d40e Mon Sep 17 00:00:00 2001 From: Yatendra Goel Date: Sun, 3 Feb 2019 15:36:37 +0530 Subject: [PATCH 061/143] BAEL-1656: Deleted the client private key from the truststore.jks --- spring-security-x509/keystore/Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/spring-security-x509/keystore/Makefile b/spring-security-x509/keystore/Makefile index 2b5b5e8abe..2cd7c55c5b 100644 --- a/spring-security-x509/keystore/Makefile +++ b/spring-security-x509/keystore/Makefile @@ -2,6 +2,7 @@ PASSWORD=changeit KEYSTORE=keystore.jks HOSTNAME=localhost CLIENTNAME=cid +CLIENT_PRIVATE_KEY="${CLIENTNAME}_pk" # CN = Common Name # OU = Organization Unit @@ -59,12 +60,12 @@ create-truststore: export-authority add-client: # Generate client certificate - keytool -genkey -alias $(CLIENTNAME) -ext san=dns:localhost,ip:127.0.0.1 \ + keytool -genkey -alias $(CLIENT_PRIVATE_KEY) -ext san=dns:localhost,ip:127.0.0.1 \ -keyalg RSA -keysize 4096 -sigalg SHA512withRSA -keypass $(PASSWORD) \ -validity 3650 -dname $(DNAME_CLIENT) \ -keystore $(TRUSTSTORE) -storepass $(PASSWORD) # Generate a host certificate signing request - keytool -certreq -alias $(CLIENTNAME) -ext san=dns:localhost,ip:127.0.0.1 -ext BC=ca:true \ + keytool -certreq -alias $(CLIENT_PRIVATE_KEY) -ext san=dns:localhost,ip:127.0.0.1 -ext BC=ca:true \ -keyalg RSA -keysize 4096 -sigalg SHA512withRSA \ -validity 3650 -file "$(CLIENTNAME).csr" \ -keystore $(TRUSTSTORE) -storepass $(PASSWORD) @@ -78,10 +79,13 @@ add-client: -file "$(CLIENTNAME).crt" \ -keystore $(TRUSTSTORE) -storepass $(PASSWORD) # Export private certificate for importing into a browser - keytool -importkeystore -srcalias $(CLIENTNAME) -ext san=dns:localhost,ip:127.0.0.1 \ + keytool -importkeystore -srcalias $(CLIENT_PRIVATE_KEY) -ext san=dns:localhost,ip:127.0.0.1 \ -srckeystore $(TRUSTSTORE) -srcstorepass $(PASSWORD) \ -destkeystore "$(CLIENTNAME).p12" -deststorepass $(PASSWORD) \ -deststoretype PKCS12 + # Delete client private key as truststore should not contain any private keys + keytool -delete -alias $(CLIENT_PRIVATE_KEY) \ + -keystore $(TRUSTSTORE) -storepass $(PASSWORD) clean: # Remove generated artifacts From 4260b353c5e992d8556eefaa3287e05d278b2b43 Mon Sep 17 00:00:00 2001 From: Anshul Bansal Date: Sun, 3 Feb 2019 13:53:53 +0200 Subject: [PATCH 062/143] BAEL-2659 - Reading a file in Groovy - html content --- core-groovy/src/main/resources/utf8Content.html | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core-groovy/src/main/resources/utf8Content.html b/core-groovy/src/main/resources/utf8Content.html index 873a75b8d0..61ff338f6c 100644 --- a/core-groovy/src/main/resources/utf8Content.html +++ b/core-groovy/src/main/resources/utf8Content.html @@ -1,3 +1,12 @@ + + + + +

 ᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗ
 ᛋᚳᛖᚪᛚ᛫ᚦᛖᚪᚻ᛫ᛗᚪᚾᚾᚪ᛫ᚷᛖᚻᚹᛦᛚᚳ᛫ᛗᛁᚳᛚᚢᚾ᛫ᚻᛦᛏ᛫ᛞᚫᛚᚪᚾ
-ᚷᛁᚠ᛫ᚻᛖ᛫ᚹᛁᛚᛖ᛫ᚠᚩᚱ᛫ᛞᚱᛁᚻᛏᚾᛖ᛫ᛞᚩᛗᛖᛋ᛫ᚻᛚᛇᛏᚪᚾ
\ No newline at end of file
+ᚷᛁᚠ᛫ᚻᛖ᛫ᚹᛁᛚᛖ᛫ᚠᚩᚱ᛫ᛞᚱᛁᚻᛏᚾᛖ᛫ᛞᚩᛗᛖᛋ᛫ᚻᛚᛇᛏᚪᚾ
+
+ + \ No newline at end of file From 425b8905ecbc01f29b400766acfa2e361fff8296 Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Sun, 3 Feb 2019 18:45:18 +0330 Subject: [PATCH 063/143] Simplifying the test method name. --- .../src/test/kotlin/com/baeldung/kotlin/junit5/SimpleTest5.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/junit5/SimpleTest5.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/junit5/SimpleTest5.kt index 49541985e1..15ff201430 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/junit5/SimpleTest5.kt +++ b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/junit5/SimpleTest5.kt @@ -14,7 +14,7 @@ class SimpleTest5 { @Test @Disabled - fun `JUnit should complain and report failed assertions`() { + fun `3 is equal to 4`() { Assertions.assertEquals(3, 4) { "Three does not equal four" } From 52db7dd65b938debca075bbe9978f726a58cf772 Mon Sep 17 00:00:00 2001 From: Shubhra Srivastava Date: Sun, 3 Feb 2019 21:38:22 +0530 Subject: [PATCH 064/143] Bael 2532 hibernate aggregate functions (#6266) * BAEL-2532 Hibernate Aggregate Functions * BAEL-2532 Deleting created Student POJO --- .../com/baeldung/hibernate/pojo/Student.java | 34 +++++++- .../AggregateFunctionsIntegrationTest.java | 87 +++++++++++++++++++ 2 files changed, 118 insertions(+), 3 deletions(-) create mode 100644 persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/aggregatefunctions/AggregateFunctionsIntegrationTest.java diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Student.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Student.java index a6dec4a30d..9b26c117eb 100644 --- a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Student.java +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Student.java @@ -9,15 +9,43 @@ import javax.persistence.Id; public class Student { @Id - @GeneratedValue (strategy = GenerationType.SEQUENCE) + @GeneratedValue(strategy = GenerationType.SEQUENCE) private long studentId; + private String name; + + private int age; + + public Student() { + } + + public Student(String name, int age) { + this.name = name; + this.age = age; + } + public long getStudentId() { return studentId; } - public void setStudent_id(long studentId) { + public void setStudentId(long studentId) { this.studentId = studentId; } - + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + } diff --git a/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/aggregatefunctions/AggregateFunctionsIntegrationTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/aggregatefunctions/AggregateFunctionsIntegrationTest.java new file mode 100644 index 0000000000..0b2bdf7ead --- /dev/null +++ b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/aggregatefunctions/AggregateFunctionsIntegrationTest.java @@ -0,0 +1,87 @@ +package com.baeldung.hibernate.aggregatefunctions; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.IOException; + +import org.hibernate.HibernateException; +import org.hibernate.Session; +import org.hibernate.Transaction; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.baeldung.hibernate.HibernateUtil; +import com.baeldung.hibernate.pojo.Student; + +public class AggregateFunctionsIntegrationTest { + + private static Session session; + private static Transaction transaction; + + @BeforeClass + public static final void setup() throws HibernateException, IOException { + session = HibernateUtil.getSessionFactory() + .openSession(); + transaction = session.beginTransaction(); + + Student jonas = new Student("Jonas", 22); + session.save(jonas); + + Student sally = new Student("Sally", 20); + session.save(sally); + + Student simon = new Student("Simon", 25); + session.save(simon); + + Student raven = new Student("Raven", 21); + session.save(raven); + + Student sam = new Student("Sam", 23); + session.save(sam); + + } + + @AfterClass + public static final void teardown() { + if (session != null) { + transaction.rollback(); + session.close(); + } + } + + @Test + public void whenMaxAge_ThenReturnValue() { + int maxAge = (int) session.createQuery("SELECT MAX(age) from Student") + .getSingleResult(); + assertThat(maxAge).isEqualTo(25); + } + + @Test + public void whenMinAge_ThenReturnValue() { + int minAge = (int) session.createQuery("SELECT MIN(age) from Student") + .getSingleResult(); + assertThat(minAge).isEqualTo(20); + } + + @Test + public void whenAverageAge_ThenReturnValue() { + Double avgAge = (Double) session.createQuery("SELECT AVG(age) from Student") + .getSingleResult(); + assertThat(avgAge).isEqualTo(22.2); + } + + @Test + public void whenCountAll_ThenReturnValue() { + Long totalStudents = (Long) session.createQuery("SELECT COUNT(*) from Student") + .getSingleResult(); + assertThat(totalStudents).isEqualTo(5); + } + + @Test + public void whenSumOfAllAges_ThenReturnValue() { + Long sumOfAllAges = (Long) session.createQuery("SELECT SUM(age) from Student") + .getSingleResult(); + assertThat(sumOfAllAges).isEqualTo(111); + } +} From 47c1eed6bd10ea2d3a9e1b16c5ef3c2e6936f891 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Sun, 3 Feb 2019 22:43:03 +0530 Subject: [PATCH 065/143] BAEL-2129 Added new core-kotlin-2 extension --- core-kotlin-2/.gitignore | 14 ++ core-kotlin-2/README.md | 1 + core-kotlin-2/build.gradle | 48 +++++ .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 54329 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 + core-kotlin-2/gradlew | 172 ++++++++++++++++++ core-kotlin-2/gradlew.bat | 84 +++++++++ core-kotlin-2/pom.xml | 16 ++ core-kotlin-2/resources/logback.xml | 11 ++ core-kotlin-2/settings.gradle | 2 + core-kotlin-2/src/main/resources/logback.xml | 13 ++ core-kotlin-2/src/test/resources/Kotlin.in | 5 + core-kotlin-2/src/test/resources/Kotlin.out | 2 + pom.xml | 2 + 14 files changed, 375 insertions(+) create mode 100644 core-kotlin-2/.gitignore create mode 100644 core-kotlin-2/README.md create mode 100644 core-kotlin-2/build.gradle create mode 100644 core-kotlin-2/gradle/wrapper/gradle-wrapper.jar create mode 100644 core-kotlin-2/gradle/wrapper/gradle-wrapper.properties create mode 100644 core-kotlin-2/gradlew create mode 100644 core-kotlin-2/gradlew.bat create mode 100644 core-kotlin-2/pom.xml create mode 100644 core-kotlin-2/resources/logback.xml create mode 100644 core-kotlin-2/settings.gradle create mode 100644 core-kotlin-2/src/main/resources/logback.xml create mode 100644 core-kotlin-2/src/test/resources/Kotlin.in create mode 100644 core-kotlin-2/src/test/resources/Kotlin.out diff --git a/core-kotlin-2/.gitignore b/core-kotlin-2/.gitignore new file mode 100644 index 0000000000..0c017e8f8c --- /dev/null +++ b/core-kotlin-2/.gitignore @@ -0,0 +1,14 @@ +/bin/ + +#ignore gradle +.gradle/ + + +#ignore build and generated files +build/ +node/ +out/ + +#ignore installed node modules and package lock file +node_modules/ +package-lock.json diff --git a/core-kotlin-2/README.md b/core-kotlin-2/README.md new file mode 100644 index 0000000000..ff12555376 --- /dev/null +++ b/core-kotlin-2/README.md @@ -0,0 +1 @@ +## Relevant articles: diff --git a/core-kotlin-2/build.gradle b/core-kotlin-2/build.gradle new file mode 100644 index 0000000000..b058e0ecad --- /dev/null +++ b/core-kotlin-2/build.gradle @@ -0,0 +1,48 @@ + + +group 'com.baeldung.ktor' +version '1.0-SNAPSHOT' + + +buildscript { + ext.kotlin_version = '1.2.41' + + repositories { + mavenCentral() + } + dependencies { + + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +apply plugin: 'java' +apply plugin: 'kotlin' +apply plugin: 'application' + +mainClassName = 'APIServer.kt' + +sourceCompatibility = 1.8 +compileKotlin { kotlinOptions.jvmTarget = "1.8" } +compileTestKotlin { kotlinOptions.jvmTarget = "1.8" } + +kotlin { experimental { coroutines "enable" } } + +repositories { + mavenCentral() + jcenter() + maven { url "https://dl.bintray.com/kotlin/ktor" } +} +sourceSets { + main{ + kotlin{ + srcDirs 'com/baeldung/ktor' + } + } + +} + +dependencies { + compile "ch.qos.logback:logback-classic:1.2.1" + testCompile group: 'junit', name: 'junit', version: '4.12' +} \ No newline at end of file diff --git a/core-kotlin-2/gradle/wrapper/gradle-wrapper.jar b/core-kotlin-2/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..01b8bf6b1f99cad9213fc495b33ad5bbab8efd20 GIT binary patch literal 54329 zcmagFV|ZrKvM!pAZQHhO+qP}9lTNj?q^^Y^VFp)SH8qbSJ)2BQ2giqeFT zAwqu@)c?v~^Z#E_K}1nTQbJ9gQ9<%vVRAxVj)8FwL5_iTdUB>&m3fhE=kRWl;g`&m z!W5kh{WsV%fO*%je&j+Lv4xxK~zsEYQls$Q-p&dwID|A)!7uWtJF-=Tm1{V@#x*+kUI$=%KUuf2ka zjiZ{oiL1MXE2EjciJM!jrjFNwCh`~hL>iemrqwqnX?T*MX;U>>8yRcZb{Oy+VKZos zLiFKYPw=LcaaQt8tj=eoo3-@bG_342HQ%?jpgAE?KCLEHC+DmjxAfJ%Og^$dpC8Xw zAcp-)tfJm}BPNq_+6m4gBgBm3+CvmL>4|$2N$^Bz7W(}fz1?U-u;nE`+9`KCLuqg} zwNstNM!J4Uw|78&Y9~9>MLf56to!@qGkJw5Thx%zkzj%Ek9Nn1QA@8NBXbwyWC>9H z#EPwjMNYPigE>*Ofz)HfTF&%PFj$U6mCe-AFw$U%-L?~-+nSXHHKkdgC5KJRTF}`G zE_HNdrE}S0zf4j{r_f-V2imSqW?}3w-4=f@o@-q+cZgaAbZ((hn))@|eWWhcT2pLpTpL!;_5*vM=sRL8 zqU##{U#lJKuyqW^X$ETU5ETeEVzhU|1m1750#f}38_5N9)B_2|v@1hUu=Kt7-@dhA zq_`OMgW01n`%1dB*}C)qxC8q;?zPeF_r;>}%JYmlER_1CUbKa07+=TV45~symC*g8 zW-8(gag#cAOuM0B1xG8eTp5HGVLE}+gYTmK=`XVVV*U!>H`~j4+ROIQ+NkN$LY>h4 zqpwdeE_@AX@PL};e5vTn`Ro(EjHVf$;^oiA%@IBQq>R7_D>m2D4OwwEepkg}R_k*M zM-o;+P27087eb+%*+6vWFCo9UEGw>t&WI17Pe7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tHoYMG(A({rT+%i|7@$5p)Jq& zu9?4q|IdLgFWc>9B)~ISBVax9V!-~>SoO!R`1K^~<^J \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +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 + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/core-kotlin-2/gradlew.bat b/core-kotlin-2/gradlew.bat new file mode 100644 index 0000000000..f9553162f1 --- /dev/null +++ b/core-kotlin-2/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/core-kotlin-2/pom.xml b/core-kotlin-2/pom.xml new file mode 100644 index 0000000000..81df3cee81 --- /dev/null +++ b/core-kotlin-2/pom.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + core-kotlin-2 + core-kotlin-2 + jar + + + com.baeldung + parent-kotlin + 1.0.0-SNAPSHOT + ../parent-kotlin + + + diff --git a/core-kotlin-2/resources/logback.xml b/core-kotlin-2/resources/logback.xml new file mode 100644 index 0000000000..9452207268 --- /dev/null +++ b/core-kotlin-2/resources/logback.xml @@ -0,0 +1,11 @@ + + + + %d{YYYY-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + \ No newline at end of file diff --git a/core-kotlin-2/settings.gradle b/core-kotlin-2/settings.gradle new file mode 100644 index 0000000000..c91c993971 --- /dev/null +++ b/core-kotlin-2/settings.gradle @@ -0,0 +1,2 @@ +rootProject.name = 'KtorWithKotlin' + diff --git a/core-kotlin-2/src/main/resources/logback.xml b/core-kotlin-2/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/core-kotlin-2/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/core-kotlin-2/src/test/resources/Kotlin.in b/core-kotlin-2/src/test/resources/Kotlin.in new file mode 100644 index 0000000000..d140d4429e --- /dev/null +++ b/core-kotlin-2/src/test/resources/Kotlin.in @@ -0,0 +1,5 @@ +Hello to Kotlin. Its: +1. Concise +2. Safe +3. Interoperable +4. Tool-friendly \ No newline at end of file diff --git a/core-kotlin-2/src/test/resources/Kotlin.out b/core-kotlin-2/src/test/resources/Kotlin.out new file mode 100644 index 0000000000..63d15d2528 --- /dev/null +++ b/core-kotlin-2/src/test/resources/Kotlin.out @@ -0,0 +1,2 @@ +Kotlin +Concise, Safe, Interoperable, Tool-friendly \ No newline at end of file diff --git a/pom.xml b/pom.xml index 58d57ade05..648f94c76d 100644 --- a/pom.xml +++ b/pom.xml @@ -1003,6 +1003,7 @@ core-java-concurrency-advanced core-kotlin + core-kotlin-2 jenkins/hello-world jhipster @@ -1554,6 +1555,7 @@ core-java core-java-concurrency-advanced core-kotlin + core-kotlin-2 jenkins/hello-world jhipster From b17a130cf1b4f35056fcffdd2416d962ed4f425d Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Sun, 3 Feb 2019 23:07:10 +0530 Subject: [PATCH 066/143] BAEL-2129 Void Type in Kotlin -Moved the code from core-kotlin to the new extension core-kotlin-2 --- .../src/test/kotlin}/voidtypes/VoidTypesUnitTest.kt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {core-kotlin/src/test/kotlin/com/baeldung => core-kotlin-2/src/test/kotlin}/voidtypes/VoidTypesUnitTest.kt (100%) diff --git a/core-kotlin/src/test/kotlin/com/baeldung/voidtypes/VoidTypesUnitTest.kt b/core-kotlin-2/src/test/kotlin/voidtypes/VoidTypesUnitTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/voidtypes/VoidTypesUnitTest.kt rename to core-kotlin-2/src/test/kotlin/voidtypes/VoidTypesUnitTest.kt From a5b5b0fcba337be13a16ae79515f39f535c02fe5 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Mon, 4 Feb 2019 00:06:11 +0530 Subject: [PATCH 067/143] [BAEL-12090] - Extract versions into properties --- akka-http/pom.xml | 2 +- algorithms-miscellaneous-2/pom.xml | 3 +- .../src/test/resources/graph.png | Bin 9365 -> 9637 bytes apache-geode/pom.xml | 36 ++++++----- apache-meecrowave/pom.xml | 29 +++++---- apache-pulsar/pom.xml | 4 +- apache-spark/pom.xml | 9 ++- axon/pom.xml | 2 +- blade/pom.xml | 58 +++++++++++------- cdi/pom.xml | 1 + core-java-collections-list/pom.xml | 9 ++- core-java-collections/pom.xml | 3 +- core-kotlin/pom.xml | 6 +- flyway-cdi-extension/pom.xml | 27 ++++---- google-web-toolkit/pom.xml | 6 +- java-collections-maps/pom.xml | 3 +- java-streams/pom.xml | 9 ++- java-strings/pom.xml | 24 +++++--- javax-servlets/pom.xml | 1 + javaxval/pom.xml | 1 + jee-7-security/pom.xml | 3 +- jee-7/pom.xml | 30 ++++++--- jib/pom.xml | 12 ++-- json/pom.xml | 15 +++-- jta/pom.xml | 16 ++--- libraries-security/pom.xml | 12 ++-- libraries-server/pom.xml | 3 +- lombok-custom/pom.xml | 24 +++++--- metrics/pom.xml | 6 +- .../spring-data-mongodb/pom.xml | 1 - restx/pom.xml | 19 +++--- rsocket/pom.xml | 32 +++++++--- spring-5-reactive-client/pom.xml | 1 - spring-5-reactive-oauth/pom.xml | 14 ++--- spring-5-reactive-security/pom.xml | 1 - spring-5-security/pom.xml | 1 - spring-all/pom.xml | 6 +- spring-boot-angular-ecommerce/pom.xml | 2 - spring-boot-libraries/pom.xml | 5 +- spring-boot-logging-log4j2/pom.xml | 6 +- 40 files changed, 267 insertions(+), 175 deletions(-) diff --git a/akka-http/pom.xml b/akka-http/pom.xml index 51e70fb583..05e50d2229 100644 --- a/akka-http/pom.xml +++ b/akka-http/pom.xml @@ -23,7 +23,7 @@ com.typesafe.akka akka-stream_2.12 - 2.5.11 + ${akka.stream.version} com.typesafe.akka diff --git a/algorithms-miscellaneous-2/pom.xml b/algorithms-miscellaneous-2/pom.xml index 5461f4ebe1..d5f3172eaa 100644 --- a/algorithms-miscellaneous-2/pom.xml +++ b/algorithms-miscellaneous-2/pom.xml @@ -68,7 +68,7 @@ org.codehaus.mojo cobertura-maven-plugin - 2.7 + ${cobertura-maven-plugin.version} @@ -91,6 +91,7 @@ 1.0.1 3.9.0 1.11 + 2.7 \ No newline at end of file diff --git a/algorithms-miscellaneous-2/src/test/resources/graph.png b/algorithms-miscellaneous-2/src/test/resources/graph.png index 56995b8dd9be23e173c365a616ac64123004d81c..7165a517824fec3ed31dea351d9b37dc4176b875 100644 GIT binary patch literal 9637 zcmZ{KS6EX~)2@mlhzJ3dCIkpgY0{+ysR0oXM0!z*bdV-35T%A1L8W(4RC)(#BE1uk zjvyVRh8hA%{vE&X;ymX+=OPz-ueE2*nwj;^JF^n`L>oqZjrrPz3m2$0)K&B@T(}qp z{0u2B0dIcRcF111!0oJ|qNwjXy`2&8Sl_sLmp|n(&-?cWU0l2wJvJU59tk}IJ@}>7 zRp90Ov@^qk8P|p(FVt^&Yn`khRq2uGn%`B$m&l4a7s*uMId7t{N-8S)?FkW$E8N0Y zZqkAj=brbN9tOEjHS}Hj_WIV*WWe?=uk7z%-(0qv*p9wdAG?)SYsI?YH~a>gr&FiN zGwGG8-V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h3i~lnpjrs3~|KG{93t41u4u!y16;7l6`HlvXU-3_` o`2kf$9aCeMtj6fOpa|k6k6vV*^qxsH2>8+0xuadIY5(f~0EG)fM*si- diff --git a/apache-geode/pom.xml b/apache-geode/pom.xml index 738accdcb8..a39e4a811e 100644 --- a/apache-geode/pom.xml +++ b/apache-geode/pom.xml @@ -12,22 +12,6 @@ parent-modules 1.0.0-SNAPSHOT - - - 1.6.0 - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.8 - 1.8 - - - - @@ -38,8 +22,26 @@ junit junit - RELEASE + ${junit.version} + + + + org.apache.maven.plugins + maven-compiler-plugin + + ${maven.compiler.source} + ${maven.compiler.target} + + + + + + + 1.6.0 + 1.8 + 1.8 + \ No newline at end of file diff --git a/apache-meecrowave/pom.xml b/apache-meecrowave/pom.xml index cf13aa1c1b..fb5af69f9b 100644 --- a/apache-meecrowave/pom.xml +++ b/apache-meecrowave/pom.xml @@ -7,51 +7,58 @@ apache-meecrowave A sample REST API application with Meecrowave - - 1.8 - 1.8 - org.apache.meecrowave meecrowave-core - 1.2.1 + ${meecrowave-core.version} org.apache.meecrowave meecrowave-jpa - 1.2.1 + ${meecrowave-jpa.version} com.squareup.okhttp3 okhttp - 3.10.0 + ${okhttp.version} org.apache.meecrowave meecrowave-junit - 1.2.0 + ${meecrowave-junit.version} test junit junit - 4.10 + ${junit.version} test - + org.apache.meecrowave meecrowave-maven-plugin - 1.2.1 + ${meecrowave-maven-plugin.version} + + + 1.8 + 1.8 + 4.10 + 1.2.0 + 3.10.0 + 1.2.1 + 1.2.1 + 1.2.1 + \ No newline at end of file diff --git a/apache-pulsar/pom.xml b/apache-pulsar/pom.xml index a4c09586eb..11df6d0b87 100644 --- a/apache-pulsar/pom.xml +++ b/apache-pulsar/pom.xml @@ -11,12 +11,14 @@ org.apache.pulsar pulsar-client - 2.1.1-incubating + ${pulsar-client.version} compile + 1.8 1.8 + 2.1.1-incubating diff --git a/apache-spark/pom.xml b/apache-spark/pom.xml index b05b97198d..d5ea105b91 100644 --- a/apache-spark/pom.xml +++ b/apache-spark/pom.xml @@ -54,10 +54,10 @@ org.apache.maven.plugins maven-compiler-plugin - 3.2 + ${maven-compiler-plugin.version} - 1.8 - 1.8 + ${maven.compiler.source} + ${maven.compiler.target} @@ -85,6 +85,9 @@ 2.3.0 2.3.0 1.5.2 + 1.8 + 1.8 + 3.2 diff --git a/axon/pom.xml b/axon/pom.xml index 598dc820e5..2b9ac1fcdd 100644 --- a/axon/pom.xml +++ b/axon/pom.xml @@ -36,7 +36,7 @@ org.springframework.boot spring-boot-autoconfigure - 2.1.1.RELEASE + ${spring-boot.version} compile diff --git a/blade/pom.xml b/blade/pom.xml index 6bad505f4a..37615bed01 100644 --- a/blade/pom.xml +++ b/blade/pom.xml @@ -3,12 +3,12 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 - blade - blade - com.baeldung + blade 1.0.0-SNAPSHOT + blade + @@ -17,35 +17,30 @@ - - 1.8 - 1.8 - - com.bladejava blade-mvc - 2.0.14.RELEASE + ${blade-mvc.version} org.webjars bootstrap - 4.2.1 + ${bootstrap.version} org.apache.commons commons-lang3 - 3.8.1 + ${commons-lang3.version} org.projectlombok lombok - 1.18.4 + ${lombok.version} provided @@ -53,31 +48,31 @@ junit junit - 4.12 + ${junit.version} test org.assertj assertj-core - 3.11.1 + ${assertj-core.version} test org.apache.httpcomponents httpclient - 4.5.6 + ${httpclient.version} test org.apache.httpcomponents httpmime - 4.5.6 + ${httpmime.version} test org.apache.httpcomponents httpcore - 4.4.10 + ${httpcore.version} test @@ -88,6 +83,7 @@ org.apache.maven.plugins maven-surefire-plugin + ${maven-surefire-plugin.version} 3 true @@ -100,7 +96,7 @@ org.apache.maven.plugins maven-failsafe-plugin - 3.0.0-M3 + ${maven-failsafe-plugin.version} **/*LiveTest.java @@ -119,7 +115,7 @@ com.bazaarvoice.maven.plugins process-exec-maven-plugin - 0.7 + ${process-exec-maven-plugin.version} @@ -177,13 +173,33 @@ + org.apache.maven.plugins maven-compiler-plugin + ${maven-compiler-plugin.version} - 1.8 - 1.8 + ${maven.compiler.source} + ${maven.compiler.target} UTF-8 + + + 1.8 + 1.8 + 2.0.14.RELEASE + 4.2.1 + 3.8.1 + 1.18.4 + 4.12 + 4.5.6 + 4.5.6 + 4.4.10 + 3.11.1 + 3.0.0-M3 + 0.7 + 2.21.0 + 3.7.0 + diff --git a/cdi/pom.xml b/cdi/pom.xml index 0cf5062ccc..ba649127a0 100644 --- a/cdi/pom.xml +++ b/cdi/pom.xml @@ -59,6 +59,7 @@ test + 2.0.SP1 3.0.5.Final diff --git a/core-java-collections-list/pom.xml b/core-java-collections-list/pom.xml index a7e711088a..2b1aee6e47 100644 --- a/core-java-collections-list/pom.xml +++ b/core-java-collections-list/pom.xml @@ -40,17 +40,17 @@ net.sf.trove4j trove4j - 3.0.2 + ${trove4j.version} it.unimi.dsi fastutil - 8.1.0 + ${fastutil.version} colt colt - 1.2.0 + ${colt.version} @@ -60,5 +60,8 @@ 1.7.0 3.11.1 1.16.12 + 3.0.2 + 8.1.0 + 1.2.0 diff --git a/core-java-collections/pom.xml b/core-java-collections/pom.xml index 2201ee8b15..38d2f9aee3 100644 --- a/core-java-collections/pom.xml +++ b/core-java-collections/pom.xml @@ -54,7 +54,7 @@ org.apache.commons commons-exec - 1.3 + ${commons-exec.version} org.projectlombok @@ -74,5 +74,6 @@ 3.11.1 7.1.0 1.16.12 + 1.3 diff --git a/core-kotlin/pom.xml b/core-kotlin/pom.xml index ed79ebc01b..5de986b49e 100644 --- a/core-kotlin/pom.xml +++ b/core-kotlin/pom.xml @@ -64,13 +64,13 @@ nl.komponents.kovenant kovenant - 3.3.0 + ${kovenant.version} pom uy.kohesive.injekt injekt-core - 1.16.1 + ${injekt-core.version} @@ -82,6 +82,8 @@ 3.10.0 1.4.197 1.15.0 + 3.3.0 + 1.16.1 diff --git a/flyway-cdi-extension/pom.xml b/flyway-cdi-extension/pom.xml index dbb32f1e5a..f49a51ea4b 100644 --- a/flyway-cdi-extension/pom.xml +++ b/flyway-cdi-extension/pom.xml @@ -8,44 +8,49 @@ 1.0-SNAPSHOT flyway-cdi-extension - - 1.8 - 1.8 - - javax.enterprise cdi-api - 2.0.SP1 + ${cdi-api.version} org.jboss.weld.se weld-se-core - 3.0.5.Final + ${weld-se-core.version} runtime org.flywaydb flyway-core - 5.1.4 + ${flyway-core.version} org.apache.tomcat tomcat-jdbc - 8.5.33 + ${tomcat-jdbc.version} javax.annotation javax.annotation-api - 1.3.2 + ${javax.annotation-api.version} com.h2database h2 - 1.4.197 + ${h2.version} runtime + + 1.8 + 1.8 + 2.0.SP1 + 3.0.5.Final + 5.1.4 + 8.5.33 + 1.3.2 + 1.4.197 + diff --git a/google-web-toolkit/pom.xml b/google-web-toolkit/pom.xml index db9ce2eac0..214f2d1fd8 100644 --- a/google-web-toolkit/pom.xml +++ b/google-web-toolkit/pom.xml @@ -23,7 +23,7 @@ com.google.gwt gwt - 2.8.2 + ${gwt.version} pom import @@ -49,7 +49,7 @@ junit junit - 4.11 + ${junit.version} test @@ -120,6 +120,8 @@ UTF-8 UTF-8 + 4.11 + 2.8.2 diff --git a/java-collections-maps/pom.xml b/java-collections-maps/pom.xml index 0803866c51..71bfa4f8be 100644 --- a/java-collections-maps/pom.xml +++ b/java-collections-maps/pom.xml @@ -39,7 +39,7 @@ one.util streamex - 0.6.5 + ${streamex.version} @@ -50,5 +50,6 @@ 1.7.0 3.6.1 7.1.0 + 0.6.5 diff --git a/java-streams/pom.xml b/java-streams/pom.xml index 2b52ebb4b3..793fc46676 100644 --- a/java-streams/pom.xml +++ b/java-streams/pom.xml @@ -94,10 +94,10 @@ org.apache.maven.plugins maven-compiler-plugin - 3.1 + ${maven-compiler-plugin.version} - 1.8 - 1.8 + ${maven.compiler.source} + ${maven.compiler.target} -parameters @@ -117,5 +117,8 @@ 3.11.1 1.8.9 + 3.1 + 1.8 + 1.8 diff --git a/java-strings/pom.xml b/java-strings/pom.xml index 9f89ed6d76..4555b8ad4a 100755 --- a/java-strings/pom.xml +++ b/java-strings/pom.xml @@ -66,20 +66,20 @@ com.vdurmont emoji-java - 4.0.0 + ${emoji-java.version} org.junit.jupiter junit-jupiter-api - 5.3.1 + ${junit-jupiter-api.version} test org.hamcrest hamcrest-library - 1.3 + ${hamcrest-library.version} test @@ -87,18 +87,18 @@ org.passay passay - 1.3.1 + ${passay.version} org.apache.commons commons-text - 1.4 + ${commons-text.version} org.ahocorasick ahocorasick - 0.4.0 + ${ahocorasick.version} @@ -116,10 +116,10 @@ org.apache.maven.plugins maven-compiler-plugin - 3.1 + ${maven-compiler-plugin.version} - 1.8 - 1.8 + ${java.version} + ${java.version} -parameters @@ -135,6 +135,12 @@ 1.19 61.1 27.0.1-jre + 4.0.0 + 5.3.1 + 1.3 + 1.3.1 + 1.4 + 0.4.0 diff --git a/javax-servlets/pom.xml b/javax-servlets/pom.xml index f00dd0ebe8..bf85feb7ce 100644 --- a/javax-servlets/pom.xml +++ b/javax-servlets/pom.xml @@ -80,6 +80,7 @@ test + 4.5.3 5.0.5.RELEASE diff --git a/javaxval/pom.xml b/javaxval/pom.xml index 5f2690b5b4..f31aa0dc77 100644 --- a/javaxval/pom.xml +++ b/javaxval/pom.xml @@ -50,6 +50,7 @@ test + 2.0.1.Final 6.0.13.Final diff --git a/jee-7-security/pom.xml b/jee-7-security/pom.xml index 622ca19903..f7d96f1165 100644 --- a/jee-7-security/pom.xml +++ b/jee-7-security/pom.xml @@ -56,7 +56,7 @@ javax.mvc javax.mvc-api - 1.0-pr + ${javax.mvc-api.version} @@ -97,6 +97,7 @@ 2.2 1.1.2 4.2.3.RELEASE + 1.0-pr diff --git a/jee-7/pom.xml b/jee-7/pom.xml index 97ed2cc51d..70ca50e200 100644 --- a/jee-7/pom.xml +++ b/jee-7/pom.xml @@ -128,52 +128,52 @@ org.jboss.spec.javax.batch jboss-batch-api_1.0_spec - 1.0.0.Final + ${jboss-batch-api.version} org.jberet jberet-core - 1.0.2.Final + ${jberet-core.version} org.jberet jberet-support - 1.0.2.Final + ${jberet-support.version} org.jboss.spec.javax.transaction jboss-transaction-api_1.2_spec - 1.0.0.Final + ${jboss-transaction-api.version} org.jboss.marshalling jboss-marshalling - 1.4.2.Final + ${jboss-marshalling.version} org.jboss.weld weld-core - 2.1.1.Final + ${weld-core.version} org.jboss.weld.se weld-se - 2.1.1.Final + ${weld-se.version} org.jberet jberet-se - 1.0.2.Final + ${jberet-se.version} com.h2database h2 - 1.4.178 + ${h2.version} org.glassfish.jersey.containers jersey-container-jetty-servlet - 2.22.1 + ${jersey-container-jetty-servlet.version} @@ -533,6 +533,16 @@ 1.2 2.2 20160715 + 1.0.0.Final + 1.0.2.Final + 1.0.2.Final + 1.0.0.Final + 1.4.2.Final + 2.1.1.Final + 2.1.1.Final + 1.0.2.Final + 1.4.178 + 2.22.1 \ No newline at end of file diff --git a/jib/pom.xml b/jib/pom.xml index ad4011c3c4..5c9f242a20 100644 --- a/jib/pom.xml +++ b/jib/pom.xml @@ -18,11 +18,7 @@ spring-boot-starter-web - - - 1.8 - - + @@ -32,7 +28,7 @@ com.google.cloud.tools jib-maven-plugin - 0.9.10 + ${jib-maven-plugin.version} registry.hub.docker.com/baeldungjib/jib-spring-boot-app @@ -42,4 +38,8 @@ + + 1.8 + 0.9.10 + diff --git a/json/pom.xml b/json/pom.xml index fce2d26db5..23955e5a75 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -32,17 +32,17 @@ org.json json - 20171018 + ${json.version} com.google.code.gson gson - 2.8.5 + ${gson.version} com.fasterxml.jackson.core jackson-databind - 2.9.7 + ${jackson-databind.version} javax.json.bind @@ -52,14 +52,14 @@ junit junit - 4.12 + ${junit.version} test org.glassfish javax.json - 1.1.2 + ${javax.version} org.eclipse @@ -81,6 +81,11 @@ 1.0 4.1 1.0.1 + 20171018 + 2.8.5 + 2.9.7 + 4.12 + 1.1.2 diff --git a/jta/pom.xml b/jta/pom.xml index 4754c1872b..038f1dc8d1 100644 --- a/jta/pom.xml +++ b/jta/pom.xml @@ -7,7 +7,6 @@ 1.0-SNAPSHOT jta jar - JEE JTA demo @@ -17,12 +16,6 @@ - - UTF-8 - UTF-8 - 1.8 - - org.springframework.boot @@ -46,7 +39,7 @@ org.hsqldb hsqldb - 2.4.1 + ${hsqldb.version} @@ -86,4 +79,11 @@ + + + UTF-8 + UTF-8 + 1.8 + 2.4.1 + diff --git a/libraries-security/pom.xml b/libraries-security/pom.xml index 3077abc29c..ba51227ce0 100644 --- a/libraries-security/pom.xml +++ b/libraries-security/pom.xml @@ -23,7 +23,7 @@ org.springframework.security.oauth spring-security-oauth2 - 2.3.3.RELEASE + ${spring-security-oauth2.version} @@ -41,21 +41,21 @@ org.passay passay - 1.3.1 + ${passay.version} org.cryptacular cryptacular - 1.2.2 + ${cryptacular.version} - 4.12 2.0.4.RELEASE 5.6.0 + 2.3.3.RELEASE + 1.3.1 + 1.2.2 - - diff --git a/libraries-server/pom.xml b/libraries-server/pom.xml index f60e664fa7..ea556baece 100644 --- a/libraries-server/pom.xml +++ b/libraries-server/pom.xml @@ -14,7 +14,7 @@ org.eclipse.paho org.eclipse.paho.client.mqttv3 - 1.2.0 + ${eclipse.paho.client.mqttv3.version} @@ -107,6 +107,7 @@ 4.12 8.5.24 4.3.1 + 1.2.0 \ No newline at end of file diff --git a/lombok-custom/pom.xml b/lombok-custom/pom.xml index 41bd042a5e..629d1b7c48 100644 --- a/lombok-custom/pom.xml +++ b/lombok-custom/pom.xml @@ -2,34 +2,35 @@ - - parent-modules - com.baeldung - 1.0.0-SNAPSHOT - 4.0.0 lombok-custom 0.1-SNAPSHOT + + parent-modules + com.baeldung + 1.0.0-SNAPSHOT + + org.projectlombok lombok - 1.14.8 + ${lombok.version} provided org.kohsuke.metainf-services metainf-services - 1.8 + ${metainf-services.version} org.eclipse.jdt core - 3.3.0-v_771 + ${eclipse.jdt.core.version} @@ -54,5 +55,12 @@ + + + 1.18.4 + 1.8 + 3.3.0-v_771 + + \ No newline at end of file diff --git a/metrics/pom.xml b/metrics/pom.xml index d7d7a8a911..014931a957 100644 --- a/metrics/pom.xml +++ b/metrics/pom.xml @@ -66,7 +66,7 @@ org.springframework.boot spring-boot-starter-web - 2.0.7.RELEASE + ${spring-boot-starter-web.version} @@ -89,7 +89,7 @@ org.assertj assertj-core - 3.11.1 + ${assertj-core.version} test @@ -102,6 +102,8 @@ 0.12.0.RELEASE 2.9.1 0.57.1 + 2.0.7.RELEASE + 3.11.1 diff --git a/persistence-modules/spring-data-mongodb/pom.xml b/persistence-modules/spring-data-mongodb/pom.xml index c1faf72103..7156cdf071 100644 --- a/persistence-modules/spring-data-mongodb/pom.xml +++ b/persistence-modules/spring-data-mongodb/pom.xml @@ -23,7 +23,6 @@ spring-data-releasetrain Lovelace-SR3 pom - import diff --git a/restx/pom.xml b/restx/pom.xml index c6233b968c..f33d490096 100644 --- a/restx/pom.xml +++ b/restx/pom.xml @@ -3,17 +3,10 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - restx 0.1-SNAPSHOT war restx-demo - - - 1.8 - 1.8 - 0.35-rc4 - com.baeldung @@ -106,7 +99,7 @@ ch.qos.logback logback-classic - 1.0.13 + ${logback-classic.version} io.restx @@ -117,10 +110,11 @@ junit junit - 4.11 + ${junit.version} test + @@ -152,4 +146,11 @@ + + + 1.8 + 1.8 + 0.35-rc4 + 1.0.13 + diff --git a/rsocket/pom.xml b/rsocket/pom.xml index 8b04a31583..c00791bfd8 100644 --- a/rsocket/pom.xml +++ b/rsocket/pom.xml @@ -4,51 +4,63 @@ rsocket 0.0.1-SNAPSHOT rsocket + jar - + com.baeldung parent-modules 1.0.0-SNAPSHOT - jar - + io.rsocket rsocket-core - 0.11.13 + ${rsocket-core.version} io.rsocket rsocket-transport-netty - 0.11.13 + ${rsocket-transport-netty} junit junit - 4.12 + ${junit.version} test org.hamcrest hamcrest-core - 1.3 + ${hamcrest-core.version} test ch.qos.logback logback-classic - 1.2.3 + ${logback-classic.version} ch.qos.logback logback-core - 1.2.3 + ${logback-core.version} org.slf4j slf4j-api - 1.7.25 + ${slf4j-api.version} + + + 1.8 + 1.8 + 3.0.1 + 0.11.13 + 0.11.13 + 1.3 + 1.2.3 + 1.2.3 + 1.7.25 + \ No newline at end of file diff --git a/spring-5-reactive-client/pom.xml b/spring-5-reactive-client/pom.xml index 6e39743ed0..bcf04046a7 100644 --- a/spring-5-reactive-client/pom.xml +++ b/spring-5-reactive-client/pom.xml @@ -2,7 +2,6 @@ 4.0.0 - spring-5-reactive-client jar spring-5-reactive-client diff --git a/spring-5-reactive-oauth/pom.xml b/spring-5-reactive-oauth/pom.xml index 73809681f2..7062372ea1 100644 --- a/spring-5-reactive-oauth/pom.xml +++ b/spring-5-reactive-oauth/pom.xml @@ -2,12 +2,10 @@ 4.0.0 - com.baeldung.reactive.oauth spring-5-reactive-oauth 1.0.0-SNAPSHOT jar - spring-5-reactive-oauth WebFluc and Spring Security OAuth @@ -18,12 +16,6 @@ - - UTF-8 - UTF-8 - 1.8 - - org.springframework.boot @@ -74,4 +66,10 @@ + + UTF-8 + UTF-8 + 1.8 + + diff --git a/spring-5-reactive-security/pom.xml b/spring-5-reactive-security/pom.xml index 3b64b9b3ac..0ff1dc0076 100644 --- a/spring-5-reactive-security/pom.xml +++ b/spring-5-reactive-security/pom.xml @@ -2,7 +2,6 @@ 4.0.0 - com.baeldung spring-5-reactive-security 0.0.1-SNAPSHOT diff --git a/spring-5-security/pom.xml b/spring-5-security/pom.xml index c26e370381..ae9e1fb0c5 100644 --- a/spring-5-security/pom.xml +++ b/spring-5-security/pom.xml @@ -16,7 +16,6 @@ - org.springframework.boot spring-boot-starter-security diff --git a/spring-all/pom.xml b/spring-all/pom.xml index 77c7e74e08..5872fbdac5 100644 --- a/spring-all/pom.xml +++ b/spring-all/pom.xml @@ -160,12 +160,12 @@ net.javacrumbs.shedlock shedlock-spring - 2.1.0 + ${shedlock.version} net.javacrumbs.shedlock shedlock-provider-jdbc-template - 2.1.0 + ${shedlock.version} @@ -243,7 +243,7 @@ 3.6 3.6.1 6.6.0 - + 2.1.0 3.22.0-GA diff --git a/spring-boot-angular-ecommerce/pom.xml b/spring-boot-angular-ecommerce/pom.xml index dc92a91d02..8e476b9d5b 100644 --- a/spring-boot-angular-ecommerce/pom.xml +++ b/spring-boot-angular-ecommerce/pom.xml @@ -2,11 +2,9 @@ 4.0.0 - spring-boot-angular-ecommerce 0.0.1-SNAPSHOT jar - spring-boot-angular-ecommerce Spring Boot Angular E-commerce Appliciation diff --git a/spring-boot-libraries/pom.xml b/spring-boot-libraries/pom.xml index 66aa66bdfd..f21a71de24 100644 --- a/spring-boot-libraries/pom.xml +++ b/spring-boot-libraries/pom.xml @@ -44,12 +44,12 @@ net.javacrumbs.shedlock shedlock-spring - 2.1.0 + ${shedlock.version} net.javacrumbs.shedlock shedlock-provider-jdbc-template - 2.1.0 + ${shedlock.version} @@ -151,6 +151,7 @@ 2.2.4 2.3.2 0.23.0 + 2.1.0 diff --git a/spring-boot-logging-log4j2/pom.xml b/spring-boot-logging-log4j2/pom.xml index ad678a14cf..d3a84de342 100644 --- a/spring-boot-logging-log4j2/pom.xml +++ b/spring-boot-logging-log4j2/pom.xml @@ -40,12 +40,12 @@ org.springframework.boot spring-boot-starter-log4j - 1.3.8.RELEASE + ${spring-boot-starter-log4j.version} org.graylog2 gelfj - 1.1.16 + ${gelfj.version} compile @@ -71,5 +71,7 @@ com.baeldung.springbootlogging.SpringBootLoggingApplication + 1.3.8.RELEASE + 1.1.16 From 565f69ecf30a83ca13c7c1fa2c1e47f6c12a7b16 Mon Sep 17 00:00:00 2001 From: soufiane-cheouati <46105138+soufiane-cheouati@users.noreply.github.com> Date: Sun, 3 Feb 2019 20:44:04 +0000 Subject: [PATCH 068/143] Add files via upload --- .../java/com/baeldung/markerinterface/DeletableShape.java | 6 ++---- .../main/java/com/baeldung/markerinterface/Rectangle.java | 2 +- .../src/main/java/com/baeldung/markerinterface/Shape.java | 6 ++++++ .../main/java/com/baeldung/markerinterface/ShapeDao.java | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 core-java-lang-oop/src/main/java/com/baeldung/markerinterface/Shape.java diff --git a/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/DeletableShape.java b/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/DeletableShape.java index d5ae52c9f2..7674407da8 100644 --- a/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/DeletableShape.java +++ b/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/DeletableShape.java @@ -1,7 +1,5 @@ package com.baeldung.markerinterface; -public interface DeletableShape { - double getArea(); +public interface DeletableShape extends Shape { - double getCircumference(); -} \ No newline at end of file +} diff --git a/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/Rectangle.java b/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/Rectangle.java index f8ea987c6f..d64ffad0a2 100644 --- a/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/Rectangle.java +++ b/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/Rectangle.java @@ -1,6 +1,6 @@ package com.baeldung.markerinterface; -public class Rectangle implements Deletable { +public class Rectangle implements DeletableShape { private double width; private double height; diff --git a/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/Shape.java b/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/Shape.java new file mode 100644 index 0000000000..2e53aefc03 --- /dev/null +++ b/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/Shape.java @@ -0,0 +1,6 @@ +package com.baeldung.markerinterface; + +public interface Shape { + double getArea(); + double getCircumference(); +} \ No newline at end of file diff --git a/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/ShapeDao.java b/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/ShapeDao.java index 49a389bd46..bc988a793d 100644 --- a/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/ShapeDao.java +++ b/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/ShapeDao.java @@ -3,7 +3,7 @@ package com.baeldung.markerinterface; public class ShapeDao { public boolean delete(Object object) { - if (!(object instanceof Deletable)) { + if (!(object instanceof DeletableShape)) { return false; } // Calling the code that deletes the entity from the database From afb46cd8cf3483b76280db355bef38507425dbdb Mon Sep 17 00:00:00 2001 From: soufiane-cheouati <46105138+soufiane-cheouati@users.noreply.github.com> Date: Sun, 3 Feb 2019 20:56:53 +0000 Subject: [PATCH 069/143] Delete Deletable.java --- .../main/java/com/baeldung/markerinterface/Deletable.java | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 core-java-lang-oop/src/main/java/com/baeldung/markerinterface/Deletable.java diff --git a/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/Deletable.java b/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/Deletable.java deleted file mode 100644 index d40d81b1d4..0000000000 --- a/core-java-lang-oop/src/main/java/com/baeldung/markerinterface/Deletable.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.baeldung.markerinterface; - -public interface Deletable extends DeletableShape { - -} From 034869f9c42dcd7c6b8df5abcd437ab2b88c3b99 Mon Sep 17 00:00:00 2001 From: aietcn Date: Mon, 4 Feb 2019 05:53:06 +0800 Subject: [PATCH 070/143] BAEL-2501 add a new section in SHA-256 article (#6271) --- core-java-security/pom.xml | 4 +- .../baeldung/hashing/DigestAlgorithms.java | 9 ++++ .../baeldung/hashing/Keccak256Hashing.java | 30 +++++++++++++ .../com/baeldung/hashing/SHA256Hashing.java | 19 +++----- .../com/baeldung/hashing/SHA3Hashing.java | 45 +++++++++++++++++++ .../com/baeldung/hashing/SHACommonUtils.java | 16 +++++++ .../hashing/Keccak256HashingUnitTest.java | 22 +++++++++ .../hashing/SHA256HashingUnitTest.java | 12 ++--- .../baeldung/hashing/SHA3HashingUnitTest.java | 38 ++++++++++++++++ 9 files changed, 174 insertions(+), 21 deletions(-) create mode 100644 core-java-security/src/main/java/com/baeldung/hashing/DigestAlgorithms.java create mode 100644 core-java-security/src/main/java/com/baeldung/hashing/Keccak256Hashing.java create mode 100644 core-java-security/src/main/java/com/baeldung/hashing/SHA3Hashing.java create mode 100644 core-java-security/src/main/java/com/baeldung/hashing/SHACommonUtils.java create mode 100644 core-java-security/src/test/java/com/baeldung/hashing/Keccak256HashingUnitTest.java create mode 100644 core-java-security/src/test/java/com/baeldung/hashing/SHA3HashingUnitTest.java diff --git a/core-java-security/pom.xml b/core-java-security/pom.xml index cf91121465..7c4ab9763f 100644 --- a/core-java-security/pom.xml +++ b/core-java-security/pom.xml @@ -44,8 +44,8 @@ 3.8.1 - 1.55 - 1.10 + 1.60 + 1.11 3.10.0 diff --git a/core-java-security/src/main/java/com/baeldung/hashing/DigestAlgorithms.java b/core-java-security/src/main/java/com/baeldung/hashing/DigestAlgorithms.java new file mode 100644 index 0000000000..94dd22ff4b --- /dev/null +++ b/core-java-security/src/main/java/com/baeldung/hashing/DigestAlgorithms.java @@ -0,0 +1,9 @@ +package com.baeldung.hashing; + +public class DigestAlgorithms { + + public static final String SHA3_256 = "SHA3-256"; + public static final String SHA_256 = "SHA-256"; + public static final String KECCAK_256 = "Keccak-256"; + +} diff --git a/core-java-security/src/main/java/com/baeldung/hashing/Keccak256Hashing.java b/core-java-security/src/main/java/com/baeldung/hashing/Keccak256Hashing.java new file mode 100644 index 0000000000..19fc4cf059 --- /dev/null +++ b/core-java-security/src/main/java/com/baeldung/hashing/Keccak256Hashing.java @@ -0,0 +1,30 @@ +package com.baeldung.hashing; + +import org.bouncycastle.jcajce.provider.digest.Keccak; +import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.bouncycastle.util.encoders.Hex; + +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.Security; + +import static com.baeldung.hashing.DigestAlgorithms.KECCAK_256; +import static com.baeldung.hashing.SHACommonUtils.bytesToHex; + +public class Keccak256Hashing { + + public static String hashWithJavaMessageDigest(final String originalString) throws NoSuchAlgorithmException { + Security.addProvider(new BouncyCastleProvider()); + final MessageDigest digest = MessageDigest.getInstance(KECCAK_256); + final byte[] encodedhash = digest.digest(originalString.getBytes(StandardCharsets.UTF_8)); + return bytesToHex(encodedhash); + } + + public static String hashWithBouncyCastle(final String originalString) { + Keccak.Digest256 digest256 = new Keccak.Digest256(); + byte[] hashbytes = digest256.digest(originalString.getBytes(StandardCharsets.UTF_8)); + return new String(Hex.encode(hashbytes)); + } + +} diff --git a/core-java-security/src/main/java/com/baeldung/hashing/SHA256Hashing.java b/core-java-security/src/main/java/com/baeldung/hashing/SHA256Hashing.java index 4fa164cadc..ec008cebab 100644 --- a/core-java-security/src/main/java/com/baeldung/hashing/SHA256Hashing.java +++ b/core-java-security/src/main/java/com/baeldung/hashing/SHA256Hashing.java @@ -8,15 +8,18 @@ import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; +import static com.baeldung.hashing.DigestAlgorithms.SHA_256; +import static com.baeldung.hashing.SHACommonUtils.bytesToHex; + public class SHA256Hashing { public static String HashWithJavaMessageDigest(final String originalString) throws NoSuchAlgorithmException { - final MessageDigest digest = MessageDigest.getInstance("SHA-256"); + final MessageDigest digest = MessageDigest.getInstance(SHA_256); final byte[] encodedhash = digest.digest(originalString.getBytes(StandardCharsets.UTF_8)); return bytesToHex(encodedhash); } - public static String HashWithGuava(final String originalString) { + public static String hashWithGuava(final String originalString) { final String sha256hex = Hashing.sha256().hashString(originalString, StandardCharsets.UTF_8).toString(); return sha256hex; } @@ -27,20 +30,10 @@ public class SHA256Hashing { } public static String HashWithBouncyCastle(final String originalString) throws NoSuchAlgorithmException { - final MessageDigest digest = MessageDigest.getInstance("SHA-256"); + final MessageDigest digest = MessageDigest.getInstance(SHA_256); final byte[] hash = digest.digest(originalString.getBytes(StandardCharsets.UTF_8)); final String sha256hex = new String(Hex.encode(hash)); return sha256hex; } - private static String bytesToHex(byte[] hash) { - StringBuffer hexString = new StringBuffer(); - for (int i = 0; i < hash.length; i++) { - String hex = Integer.toHexString(0xff & hash[i]); - if (hex.length() == 1) - hexString.append('0'); - hexString.append(hex); - } - return hexString.toString(); - } } diff --git a/core-java-security/src/main/java/com/baeldung/hashing/SHA3Hashing.java b/core-java-security/src/main/java/com/baeldung/hashing/SHA3Hashing.java new file mode 100644 index 0000000000..eb363205b1 --- /dev/null +++ b/core-java-security/src/main/java/com/baeldung/hashing/SHA3Hashing.java @@ -0,0 +1,45 @@ +package com.baeldung.hashing; + +import com.google.common.hash.Hashing; +import org.apache.commons.codec.digest.DigestUtils; +import org.bouncycastle.crypto.digests.SHA3Digest; +import org.bouncycastle.jcajce.provider.digest.SHA3; +import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.bouncycastle.util.encoders.Hex; + +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.Security; + +import static com.baeldung.hashing.DigestAlgorithms.SHA3_256; +import static com.baeldung.hashing.SHACommonUtils.bytesToHex; + +public class SHA3Hashing { + + /* works with JDK9+ only */ + public static String hashWithJavaMessageDigestJDK9(final String originalString) throws NoSuchAlgorithmException { + final MessageDigest digest = MessageDigest.getInstance(SHA3_256); + final byte[] hashbytes = digest.digest(originalString.getBytes(StandardCharsets.UTF_8)); + return bytesToHex(hashbytes); + } + + public static String hashWithJavaMessageDigest(final String originalString) throws NoSuchAlgorithmException { + Security.addProvider(new BouncyCastleProvider()); + final MessageDigest digest = MessageDigest.getInstance(SHA3_256); + final byte[] hashbytes = digest.digest(originalString.getBytes(StandardCharsets.UTF_8)); + return bytesToHex(hashbytes); + } + + /* works with JDK9+ only */ + public static String hashWithApacheCommonsJDK9(final String originalString) { + return new DigestUtils(SHA3_256).digestAsHex(originalString); + } + + public static String hashWithBouncyCastle(final String originalString) { + SHA3.Digest256 digest256 = new SHA3.Digest256(); + byte[] hashbytes = digest256.digest(originalString.getBytes(StandardCharsets.UTF_8)); + return new String(Hex.encode(hashbytes)); + } + +} diff --git a/core-java-security/src/main/java/com/baeldung/hashing/SHACommonUtils.java b/core-java-security/src/main/java/com/baeldung/hashing/SHACommonUtils.java new file mode 100644 index 0000000000..0f28408083 --- /dev/null +++ b/core-java-security/src/main/java/com/baeldung/hashing/SHACommonUtils.java @@ -0,0 +1,16 @@ +package com.baeldung.hashing; + +class SHACommonUtils { + + public static String bytesToHex(byte[] hash) { + StringBuffer hexString = new StringBuffer(); + for (byte h : hash) { + String hex = Integer.toHexString(0xff & h); + if (hex.length() == 1) + hexString.append('0'); + hexString.append(hex); + } + return hexString.toString(); + } + +} diff --git a/core-java-security/src/test/java/com/baeldung/hashing/Keccak256HashingUnitTest.java b/core-java-security/src/test/java/com/baeldung/hashing/Keccak256HashingUnitTest.java new file mode 100644 index 0000000000..9ed35c8834 --- /dev/null +++ b/core-java-security/src/test/java/com/baeldung/hashing/Keccak256HashingUnitTest.java @@ -0,0 +1,22 @@ +package com.baeldung.hashing; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class Keccak256HashingUnitTest { + + private static String originalValue = "abc123"; + private static String hashedValue = "719accc61a9cc126830e5906f9d672d06eab6f8597287095a2c55a8b775e7016"; + + @Test public void testHashWithJavaMessageDigest() throws Exception { + final String currentHashedValue = Keccak256Hashing.hashWithJavaMessageDigest(originalValue); + assertEquals(hashedValue, currentHashedValue); + } + + @Test public void testHashWithBouncyCastle() { + final String currentHashedValue = Keccak256Hashing.hashWithBouncyCastle(originalValue); + assertEquals(hashedValue, currentHashedValue); + } + +} diff --git a/core-java-security/src/test/java/com/baeldung/hashing/SHA256HashingUnitTest.java b/core-java-security/src/test/java/com/baeldung/hashing/SHA256HashingUnitTest.java index 3c34bf2c6e..6bc9ad2cc6 100644 --- a/core-java-security/src/test/java/com/baeldung/hashing/SHA256HashingUnitTest.java +++ b/core-java-security/src/test/java/com/baeldung/hashing/SHA256HashingUnitTest.java @@ -12,24 +12,24 @@ public class SHA256HashingUnitTest { @Test public void testHashWithJavaMessageDigest() throws Exception { final String currentHashedValue = SHA256Hashing.HashWithJavaMessageDigest(originalValue); - assertEquals(currentHashedValue, hashedValue); + assertEquals(hashedValue, currentHashedValue); } @Test public void testHashWithGuava() throws Exception { - final String currentHashedValue = SHA256Hashing.HashWithApacheCommons(originalValue); - assertEquals(currentHashedValue, hashedValue); + final String currentHashedValue = SHA256Hashing.hashWithGuava(originalValue); + assertEquals(hashedValue, currentHashedValue); } @Test public void testHashWithApacheCommans() throws Exception { - final String currentHashedValue = SHA256Hashing.HashWithGuava(originalValue); - assertEquals(currentHashedValue, hashedValue); + final String currentHashedValue = SHA256Hashing.HashWithApacheCommons(originalValue); + assertEquals(hashedValue, currentHashedValue); } @Test public void testHashWithBouncyCastle() throws Exception { final String currentHashedValue = SHA256Hashing.HashWithBouncyCastle(originalValue); - assertEquals(currentHashedValue, hashedValue); + assertEquals(hashedValue, currentHashedValue); } } \ No newline at end of file diff --git a/core-java-security/src/test/java/com/baeldung/hashing/SHA3HashingUnitTest.java b/core-java-security/src/test/java/com/baeldung/hashing/SHA3HashingUnitTest.java new file mode 100644 index 0000000000..fffab96405 --- /dev/null +++ b/core-java-security/src/test/java/com/baeldung/hashing/SHA3HashingUnitTest.java @@ -0,0 +1,38 @@ +package com.baeldung.hashing; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class SHA3HashingUnitTest { + + private static String originalValue = "abc123"; + private static String hashedValue = "f58fa3df820114f56e1544354379820cff464c9c41cb3ca0ad0b0843c9bb67ee"; + + /* works with JDK9+ only */ + //@Test + public void testHashWithJavaMessageDigestJDK9() throws Exception { + final String currentHashedValue = SHA3Hashing.hashWithJavaMessageDigestJDK9(originalValue); + assertEquals(hashedValue, currentHashedValue); + } + + @Test + public void testHashWithJavaMessageDigest() throws Exception { + final String currentHashedValue = SHA3Hashing.hashWithJavaMessageDigest(originalValue); + assertEquals(hashedValue, currentHashedValue); + } + + /* works with JDK9+ only */ + //@Test + public void testHashWithApacheCommonsJDK9() { + final String currentHashedValue = SHA3Hashing.hashWithApacheCommonsJDK9(originalValue); + assertEquals(hashedValue, currentHashedValue); + } + + @Test + public void testHashWithBouncyCastle() { + final String currentHashedValue = SHA3Hashing.hashWithBouncyCastle(originalValue); + assertEquals(hashedValue, currentHashedValue); + } + +} From 6b83fcde01cc45188fc13dfb94f921e4bb8d2203 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Mon, 4 Feb 2019 20:27:33 +0530 Subject: [PATCH 071/143] Task/bael 10882 fixes2 (#6278) * BAEL-10882 Fixed failing unit tests * BAEL-10882 Fixed failing unit tests --- .../java/com/baeldung/jooby/AppLiveTest.java | 21 +++++++++++++++++++ .../java/com/baeldung/jooby/AppUnitTest.java | 13 ------------ spring-5-reactive-oauth/pom.xml | 2 +- 3 files changed, 22 insertions(+), 14 deletions(-) create mode 100644 jooby/src/test/java/com/baeldung/jooby/AppLiveTest.java diff --git a/jooby/src/test/java/com/baeldung/jooby/AppLiveTest.java b/jooby/src/test/java/com/baeldung/jooby/AppLiveTest.java new file mode 100644 index 0000000000..1bd12f8bb3 --- /dev/null +++ b/jooby/src/test/java/com/baeldung/jooby/AppLiveTest.java @@ -0,0 +1,21 @@ +package com.baeldung.jooby; + +import static io.restassured.RestAssured.get; +import static org.hamcrest.Matchers.equalTo; + +import org.jooby.test.JoobyRule; +import org.junit.ClassRule; +import org.junit.Test; + +public class AppLiveTest { + + @ClassRule + public static JoobyRule app = new JoobyRule(new App()); + + @Test + public void given_defaultUrl_expect_fixedString() { + get("/").then().assertThat().body(equalTo("Hello World!")).statusCode(200) + .contentType("text/html;charset=UTF-8"); + } + +} diff --git a/jooby/src/test/java/com/baeldung/jooby/AppUnitTest.java b/jooby/src/test/java/com/baeldung/jooby/AppUnitTest.java index ab7388f5f4..9bca30e2c1 100644 --- a/jooby/src/test/java/com/baeldung/jooby/AppUnitTest.java +++ b/jooby/src/test/java/com/baeldung/jooby/AppUnitTest.java @@ -1,25 +1,12 @@ package com.baeldung.jooby; -import static io.restassured.RestAssured.get; -import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertEquals; -import org.jooby.test.JoobyRule; import org.jooby.test.MockRouter; -import org.junit.ClassRule; import org.junit.Test; public class AppUnitTest { - @ClassRule - public static JoobyRule app = new JoobyRule(new App()); - - @Test - public void given_defaultUrl_expect_fixedString() { - get("/").then().assertThat().body(equalTo("Hello World!")).statusCode(200) - .contentType("text/html;charset=UTF-8"); - } - @Test public void given_defaultUrl_with_mockrouter_expect_fixedString() throws Throwable { String result = new MockRouter(new App()).get("/"); diff --git a/spring-5-reactive-oauth/pom.xml b/spring-5-reactive-oauth/pom.xml index 73809681f2..4e05227c6c 100644 --- a/spring-5-reactive-oauth/pom.xml +++ b/spring-5-reactive-oauth/pom.xml @@ -62,11 +62,11 @@ org.apache.maven.plugins maven-surefire-plugin - 2.20.1 true **/*IntegrationTest.java + **/*LiveTest.java From 93a448258cf7f727872bf8b12daf0fcd5e54f946 Mon Sep 17 00:00:00 2001 From: Rajesh Bhojwani Date: Mon, 4 Feb 2019 22:14:52 +0530 Subject: [PATCH 072/143] code related to concatenate strings in Groovy (#6277) --- .../com/baeldung/strings/Concatenate.groovy | 43 ++++++++ .../baeldung/strings/ConcatenateTest.groovy | 101 ++++++++++++++++++ 2 files changed, 144 insertions(+) create mode 100644 core-groovy/src/main/groovy/com/baeldung/strings/Concatenate.groovy create mode 100644 core-groovy/src/test/groovy/com/baeldung/strings/ConcatenateTest.groovy diff --git a/core-groovy/src/main/groovy/com/baeldung/strings/Concatenate.groovy b/core-groovy/src/main/groovy/com/baeldung/strings/Concatenate.groovy new file mode 100644 index 0000000000..b3a0852a0b --- /dev/null +++ b/core-groovy/src/main/groovy/com/baeldung/strings/Concatenate.groovy @@ -0,0 +1,43 @@ +package com.baeldung.strings; + +class Concatenate { + String first = 'Hello' + String last = 'Groovy' + + String doSimpleConcat() { + return 'My name is ' + first + ' ' + last + } + + String doConcatUsingGString() { + return "My name is $first $last" + } + + String doConcatUsingGStringClosures() { + return "My name is ${-> first} ${-> last}" + } + + String doConcatUsingStringConcatMethod() { + return 'My name is '.concat(first).concat(' ').concat(last) + } + + String doConcatUsingLeftShiftOperator() { + return 'My name is ' << first << ' ' << last + } + + String doConcatUsingArrayJoinMethod() { + return ['My name is', first, last].join(' ') + } + + String doConcatUsingArrayInjectMethod() { + return [first,' ', last] + .inject(new StringBuffer('My name is '), { initial, name -> initial.append(name); return initial }).toString() + } + + String doConcatUsingStringBuilder() { + return new StringBuilder().append('My name is ').append(first).append(' ').append(last) + } + + String doConcatUsingStringBuffer() { + return new StringBuffer().append('My name is ').append(first).append(' ').append(last) + } +} \ No newline at end of file diff --git a/core-groovy/src/test/groovy/com/baeldung/strings/ConcatenateTest.groovy b/core-groovy/src/test/groovy/com/baeldung/strings/ConcatenateTest.groovy new file mode 100644 index 0000000000..3ef4a5d460 --- /dev/null +++ b/core-groovy/src/test/groovy/com/baeldung/strings/ConcatenateTest.groovy @@ -0,0 +1,101 @@ +import com.baeldung.strings.Concatenate; + +class ConcatenateTest extends GroovyTestCase { + + void testSimpleConcat() { + def name = new Concatenate() + name.first = 'Joe'; + name.last = 'Smith'; + def expected = 'My name is Joe Smith' + assertToString(name.doSimpleConcat(), expected) + } + + void testConcatUsingGString() { + def name = new Concatenate() + name.first = "Joe"; + name.last = "Smith"; + def expected = "My name is Joe Smith" + assertToString(name.doConcatUsingGString(), expected) + } + + void testConcatUsingGStringClosures() { + def name = new Concatenate() + name.first = "Joe"; + name.last = "Smith"; + def expected = "My name is Joe Smith" + assertToString(name.doConcatUsingGStringClosures(), expected) + } + + void testConcatUsingStringConcatMethod() { + def name = new Concatenate() + name.first = "Joe"; + name.last = "Smith"; + def expected = "My name is Joe Smith" + assertToString(name.doConcatUsingStringConcatMethod(), expected) + } + + void testConcatUsingLeftShiftOperator() { + def name = new Concatenate() + name.first = "Joe"; + name.last = "Smith"; + def expected = "My name is Joe Smith" + assertToString(name.doConcatUsingLeftShiftOperator(), expected) + } + + void testConcatUsingArrayJoinMethod() { + def name = new Concatenate() + name.first = "Joe"; + name.last = "Smith"; + def expected = "My name is Joe Smith" + assertToString(name.doConcatUsingArrayJoinMethod(), expected) + } + + void testConcatUsingArrayInjectMethod() { + def name = new Concatenate() + name.first = "Joe"; + name.last = "Smith"; + def expected = "My name is Joe Smith" + assertToString(name.doConcatUsingArrayInjectMethod(), expected) + } + + void testConcatUsingStringBuilder() { + def name = new Concatenate() + name.first = "Joe"; + name.last = "Smith"; + def expected = "My name is Joe Smith" + assertToString(name.doConcatUsingStringBuilder(), expected) + } + + void testConcatUsingStringBuffer() { + def name = new Concatenate() + name.first = "Joe"; + name.last = "Smith"; + def expected = "My name is Joe Smith" + assertToString(name.doConcatUsingStringBuffer(), expected) + } + + void testConcatMultilineUsingStringConcatMethod() { + def name = new Concatenate() + name.first = '''Joe + Smith + '''; + name.last = 'Junior'; + def expected = '''My name is Joe + Smith + Junior'''; + assertToString(name.doConcatUsingStringConcatMethod(), expected) + } + + void testGStringvsClosure(){ + def first = "Joe"; + def last = "Smith"; + def eagerGString = "My name is $first $last" + def lazyGString = "My name is ${-> first} ${-> last}" + + assert eagerGString == "My name is Joe Smith" + assert lazyGString == "My name is Joe Smith" + first = "David"; + assert eagerGString == "My name is Joe Smith" + assert lazyGString == "My name is David Smith" + } +} From 398428056fbb2dd0df1834314609074ef8638d2b Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 15:03:08 +0530 Subject: [PATCH 073/143] Back-link added --- core-java-11/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-11/README.md b/core-java-11/README.md index c8039f4bc5..3c8b94fa28 100644 --- a/core-java-11/README.md +++ b/core-java-11/README.md @@ -3,3 +3,4 @@ - [Java 11 Single File Source Code](https://www.baeldung.com/java-single-file-source-code) - [Java 11 Local Variable Syntax for Lambda Parameters](https://www.baeldung.com/java-var-lambda-params) - [Java 11 String API Additions](https://www.baeldung.com/java-11-string-api) +- [Java 11 Nest Based Access Control](https://www.baeldung.com/java-nest-based-access-control) From 31254b1b2b48fd909737481f4d1b134336c73b20 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 15:05:35 +0530 Subject: [PATCH 074/143] Back-link added --- core-java/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java/README.md b/core-java/README.md index d6cb619ed3..0c25da1543 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -47,3 +47,4 @@ - [Console I/O in Java](http://www.baeldung.com/java-console-input-output) - [Formatting with printf() in Java](https://www.baeldung.com/java-printstream-printf) - [Retrieve Fields from a Java Class Using Reflection](https://www.baeldung.com/java-reflection-class-fields) +- [Introduction to Basic Syntax in Java](https://www.baeldung.com/java-syntax) From 8c3c8394b6274aa7f6c32a427fb036421b42700a Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 15:08:03 +0530 Subject: [PATCH 075/143] Back- link added --- core-java-lang/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core-java-lang/README.md b/core-java-lang/README.md index 7af962558d..34211bc55e 100644 --- a/core-java-lang/README.md +++ b/core-java-lang/README.md @@ -34,4 +34,5 @@ - [“Sneaky Throws” in Java](http://www.baeldung.com/java-sneaky-throws) - [Retrieving a Class Name in Java](https://www.baeldung.com/java-class-name) - [Java Compound Operators](https://www.baeldung.com/java-compound-operators) -- [Guide to Java Packages](https://www.baeldung.com/java-packages) \ No newline at end of file +- [Guide to Java Packages](https://www.baeldung.com/java-packages) +- [The Java Native Keyword and Methods](https://www.baeldung.com/java-native) From 72b8bd5f2eb815783b6942c7138cf156b02756ec Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 15:10:38 +0530 Subject: [PATCH 076/143] Back-link added --- core-java-lang/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-lang/README.md b/core-java-lang/README.md index 34211bc55e..55e6ba5e54 100644 --- a/core-java-lang/README.md +++ b/core-java-lang/README.md @@ -36,3 +36,4 @@ - [Java Compound Operators](https://www.baeldung.com/java-compound-operators) - [Guide to Java Packages](https://www.baeldung.com/java-packages) - [The Java Native Keyword and Methods](https://www.baeldung.com/java-native) +- [If-Else Statement in Java](https://www.baeldung.com/java-if-else) From 1e72400a7c73c4251b69388cc85bfc765e661c34 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 15:14:51 +0530 Subject: [PATCH 077/143] Back-link added --- core-java-9/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-9/README.md b/core-java-9/README.md index c96267dc95..d9586ba684 100644 --- a/core-java-9/README.md +++ b/core-java-9/README.md @@ -26,3 +26,4 @@ - [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap) - [Java 9 Platform Logging API](https://www.baeldung.com/java-9-logging-api) - [Guide to java.lang.Process API](https://www.baeldung.com/java-process-api) +- [Immutable Set in Java](https://www.baeldung.com/java-immutable-set) From a41f59ae91257aa6551ba3634df94bea6df88842 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 15:19:01 +0530 Subject: [PATCH 078/143] Back-link added --- core-java-lang/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-lang/README.md b/core-java-lang/README.md index 55e6ba5e54..1441ac44a0 100644 --- a/core-java-lang/README.md +++ b/core-java-lang/README.md @@ -37,3 +37,4 @@ - [Guide to Java Packages](https://www.baeldung.com/java-packages) - [The Java Native Keyword and Methods](https://www.baeldung.com/java-native) - [If-Else Statement in Java](https://www.baeldung.com/java-if-else) +- [Control Structures in Java](https://www.baeldung.com/java-control-structures) From 31348eee3a36ad24aadced7c3048daf5b0e3bc75 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 15:26:57 +0530 Subject: [PATCH 079/143] Back-link added --- spring-boot-bootstrap/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-boot-bootstrap/README.md b/spring-boot-bootstrap/README.md index 76b977c129..2186aa8fec 100644 --- a/spring-boot-bootstrap/README.md +++ b/spring-boot-bootstrap/README.md @@ -5,3 +5,4 @@ - [Deploying a Spring Boot Application to Cloud Foundry](https://www.baeldung.com/spring-boot-app-deploy-to-cloud-foundry) - [Deploy a Spring Boot Application to Google App Engine](https://www.baeldung.com/spring-boot-google-app-engine) - [Deploy a Spring Boot Application to OpenShift](https://www.baeldung.com/spring-boot-deploy-openshift) +- [Deploy a Spring Boot Application to AWS Beanstalk](https://www.baeldung.com/spring-boot-deploy-aws-beanstalk) From e763aaf8f49efaebbd5f1ecf475d0385582b74b4 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 15:32:51 +0530 Subject: [PATCH 080/143] Back-link added --- java-strings/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/java-strings/README.md b/java-strings/README.md index b72a378d06..287159c25a 100644 --- a/java-strings/README.md +++ b/java-strings/README.md @@ -50,3 +50,4 @@ - [Remove Leading and Trailing Characters from a String](https://www.baeldung.com/java-remove-trailing-characters) - [Concatenating Strings In Java](https://www.baeldung.com/java-strings-concatenation) - [Java toString() Method](https://www.baeldung.com/java-tostring) +- [Java String Interview Questions and Answers](https://www.baeldung.com/java-string-interview-questions) From a7025ea52ea440d289ef65d3c4ddfccec6151fc6 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 15:37:10 +0530 Subject: [PATCH 081/143] Back-link added --- core-java-collections/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-collections/README.md b/core-java-collections/README.md index be83621429..710be31a08 100644 --- a/core-java-collections/README.md +++ b/core-java-collections/README.md @@ -31,3 +31,4 @@ - [A Guide to EnumMap](https://www.baeldung.com/java-enum-map) - [A Guide to Iterator in Java](http://www.baeldung.com/java-iterator) - [Differences Between HashMap and Hashtable](https://www.baeldung.com/hashmap-hashtable-differences) +- [Java ArrayList vs Vector](https://www.baeldung.com/java-arraylist-vs-vector) From 5a213cdd5c3dd9aca4300472198e424786756860 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 15:40:21 +0530 Subject: [PATCH 082/143] Back-link added --- java-strings/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/java-strings/README.md b/java-strings/README.md index 287159c25a..d4ec2325a5 100644 --- a/java-strings/README.md +++ b/java-strings/README.md @@ -51,3 +51,4 @@ - [Concatenating Strings In Java](https://www.baeldung.com/java-strings-concatenation) - [Java toString() Method](https://www.baeldung.com/java-tostring) - [Java String Interview Questions and Answers](https://www.baeldung.com/java-string-interview-questions) +- [Check if a String is a Pangram in Java](https://www.baeldung.com/java-string-pangram) From dd391f5370af211f621b51602c453c4b10d9b5b6 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 15:43:39 +0530 Subject: [PATCH 083/143] Back-link added --- core-java-perf/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core-java-perf/README.md b/core-java-perf/README.md index 252ee4cc45..1b3b590bf8 100644 --- a/core-java-perf/README.md +++ b/core-java-perf/README.md @@ -5,4 +5,5 @@ - [Different Ways to Capture Java Heap Dumps](https://www.baeldung.com/java-heap-dump-capture) - [Understanding Memory Leaks in Java](https://www.baeldung.com/java-memory-leaks) - [OutOfMemoryError: GC Overhead Limit Exceeded](http://www.baeldung.com/java-gc-overhead-limit-exceeded) -- [Basic Introduction to JMX](http://www.baeldung.com/java-management-extensions) \ No newline at end of file +- [Basic Introduction to JMX](http://www.baeldung.com/java-management-extensions) +- [Monitoring Java Applications with Flight Recorder](https://www.baeldung.com/java-flight-recorder-monitoring) From 1def225ba8c5cf9e49ddcc60aa89b22dfad9343f Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 15:46:25 +0530 Subject: [PATCH 084/143] Back-link added --- kotlin-libraries/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/kotlin-libraries/README.md b/kotlin-libraries/README.md index 4110bfe12e..5e2526e64e 100644 --- a/kotlin-libraries/README.md +++ b/kotlin-libraries/README.md @@ -9,3 +9,4 @@ - [Working with Dates in Kotlin](https://www.baeldung.com/kotlin-dates) - [Introduction to Arrow in Kotlin](https://www.baeldung.com/kotlin-arrow) - [Kotlin with Ktor](https://www.baeldung.com/kotlin-ktor) +- [REST API With Kotlin and Kovert](https://www.baeldung.com/kotlin-kovert) From cae8ab31188178d1d850f05a24f36fa3e25f7566 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 15:48:35 +0530 Subject: [PATCH 085/143] Back-link added --- algorithms-miscellaneous-1/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/algorithms-miscellaneous-1/README.md b/algorithms-miscellaneous-1/README.md index 6f18396005..377e5d582b 100644 --- a/algorithms-miscellaneous-1/README.md +++ b/algorithms-miscellaneous-1/README.md @@ -15,3 +15,4 @@ - [Find Substrings That Are Palindromes in Java](https://www.baeldung.com/java-palindrome-substrings) - [Find the Longest Substring without Repeating Characters](https://www.baeldung.com/java-longest-substring-without-repeated-characters) - [Java Two Pointer Technique](https://www.baeldung.com/java-two-pointer-technique) +- [Permutations of an Array in Java](https://www.baeldung.com/java-array-permutations) From f7a3924861833dff4128b4b2b574bf9033d047a1 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 15:50:24 +0530 Subject: [PATCH 086/143] Back-link added --- core-java-lang/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-lang/README.md b/core-java-lang/README.md index 1441ac44a0..02a29d45f1 100644 --- a/core-java-lang/README.md +++ b/core-java-lang/README.md @@ -38,3 +38,4 @@ - [The Java Native Keyword and Methods](https://www.baeldung.com/java-native) - [If-Else Statement in Java](https://www.baeldung.com/java-if-else) - [Control Structures in Java](https://www.baeldung.com/java-control-structures) +- [Java Interfaces](https://www.baeldung.com/java-interfaces) From 3ad3fc7619e0fec79f9bd5ad06a3a59cdc5c36cc Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 15:57:26 +0530 Subject: [PATCH 087/143] Back-link added --- java-dates/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java-dates/README.md b/java-dates/README.md index ac3166d938..8171e5def9 100644 --- a/java-dates/README.md +++ b/java-dates/README.md @@ -27,4 +27,5 @@ - [Convert Between java.time.Instant and java.sql.Timestamp](https://www.baeldung.com/java-time-instant-to-java-sql-timestamp) - [Convert between String and Timestamp](https://www.baeldung.com/java-string-to-timestamp) - [A Guide to SimpleDateFormat](https://www.baeldung.com/java-simple-date-format) -- [ZoneOffset in Java](https://www.baeldung.com/java-zone-offset) \ No newline at end of file +- [ZoneOffset in Java](https://www.baeldung.com/java-zone-offset) +- [Differences Between ZonedDateTime and OffsetDateTime](https://www.baeldung.com/java-zoneddatetime-offsetdatetime) From 979a59759797a0494da7e286fcca0210b9ac8b08 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 15:59:57 +0530 Subject: [PATCH 088/143] Back-link added --- core-java-lang/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-lang/README.md b/core-java-lang/README.md index 02a29d45f1..d0eb7dc663 100644 --- a/core-java-lang/README.md +++ b/core-java-lang/README.md @@ -39,3 +39,4 @@ - [If-Else Statement in Java](https://www.baeldung.com/java-if-else) - [Control Structures in Java](https://www.baeldung.com/java-control-structures) - [Java Interfaces](https://www.baeldung.com/java-interfaces) +- [Attaching Values to Java Enum](https://www.baeldung.com/java-enum-values) From 943d439ca63ced5f2bbbe6e74db264a9c4a3a200 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 16:04:28 +0530 Subject: [PATCH 089/143] Back-link added --- libraries/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/README.md b/libraries/README.md index b247caedda..378317778e 100644 --- a/libraries/README.md +++ b/libraries/README.md @@ -64,7 +64,8 @@ - [Exactly Once Processing in Kafka](https://www.baeldung.com/kafka-exactly-once) - [An Introduction to SuanShu](https://www.baeldung.com/suanshu) - [Implementing a FTP-Client in Java](http://www.baeldung.com/java-ftp-client) -- [Introduction to Functional Java](https://www.baeldung.com/java-functional-library +- [Introduction to Functional Java](https://www.baeldung.com/java-functional-library) +- [Intro to Derive4J](https://www.baeldung.com/derive4j) The libraries module contains examples related to small libraries that are relatively easy to use and does not require any separate module of its own. From e36e9723ac6d137f645f1867d79ae5211ccbe45d Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 16:07:13 +0530 Subject: [PATCH 090/143] Back-link added --- core-java-lang-syntax/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core-java-lang-syntax/README.md b/core-java-lang-syntax/README.md index a7c1b7cc4a..99c8613929 100644 --- a/core-java-lang-syntax/README.md +++ b/core-java-lang-syntax/README.md @@ -16,4 +16,5 @@ - [Quick Guide to java.lang.System](http://www.baeldung.com/java-lang-system) - [Java Switch Statement](https://www.baeldung.com/java-switch) - [The Modulo Operator in Java](https://www.baeldung.com/modulo-java) -- [Ternary Operator In Java](https://www.baeldung.com/java-ternary-operator) \ No newline at end of file +- [Ternary Operator In Java](https://www.baeldung.com/java-ternary-operator) +- [Java instanceof Operator](https://www.baeldung.com/java-instanceof) From 108389bf1c6e2ca8c9cdcb86d8cde5ec3ad0800e Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 16:09:28 +0530 Subject: [PATCH 091/143] Back-link added --- spring-5-reactive-oauth/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-5-reactive-oauth/README.md b/spring-5-reactive-oauth/README.md index 0f27cf5d20..ec5176670b 100644 --- a/spring-5-reactive-oauth/README.md +++ b/spring-5-reactive-oauth/README.md @@ -1,3 +1,4 @@ ### Relevant Articles: - [Spring Security OAuth Login with WebFlux](https://www.baeldung.com/spring-oauth-login-webflux) +- [Spring WebClient and OAuth2 Support](https://www.baeldung.com/spring-webclient-oauth2) From b534fa9589de959c33c39cf8c21b4e254f54133b Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 16:11:56 +0530 Subject: [PATCH 092/143] Back-link added --- core-java/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java/README.md b/core-java/README.md index 0c25da1543..d5ade40812 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -48,3 +48,4 @@ - [Formatting with printf() in Java](https://www.baeldung.com/java-printstream-printf) - [Retrieve Fields from a Java Class Using Reflection](https://www.baeldung.com/java-reflection-class-fields) - [Introduction to Basic Syntax in Java](https://www.baeldung.com/java-syntax) +- [Using Curl in Java](https://www.baeldung.com/java-curl) From 1c01e5592e5be55b6deea5aadc944a438b60e914 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 16:14:13 +0530 Subject: [PATCH 093/143] Back-link added --- core-java-security/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core-java-security/README.md b/core-java-security/README.md index 415171094b..d3343f79ca 100644 --- a/core-java-security/README.md +++ b/core-java-security/README.md @@ -8,4 +8,5 @@ - [Encrypting and Decrypting Files in Java](http://www.baeldung.com/java-cipher-input-output-stream) - [Hashing a Password in Java](https://www.baeldung.com/java-password-hashing) - [SSL Handshake Failures](https://www.baeldung.com/java-ssl-handshake-failures) -- [SHA-256 Hashing in Java](https://www.baeldung.com/sha-256-hashing-java) \ No newline at end of file +- [SHA-256 Hashing in Java](https://www.baeldung.com/sha-256-hashing-java) +- [Enabling TLS v1.2 in Java 7](https://www.baeldung.com/java-7-tls-v12) From eea1576cd726ee5f517504284afc267e411a982a Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 16:15:58 +0530 Subject: [PATCH 094/143] Back-link added --- jackson/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/jackson/README.md b/jackson/README.md index 04e88d0ea1..e201a06727 100644 --- a/jackson/README.md +++ b/jackson/README.md @@ -37,3 +37,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Serialize Only Fields that meet a Custom Criteria with Jackson](http://www.baeldung.com/jackson-serialize-field-custom-criteria) - [Mapping Nested Values with Jackson](http://www.baeldung.com/jackson-nested-values) - [Convert XML to JSON Using Jackson](https://www.baeldung.com/jackson-convert-xml-json) +- [Deserialize Immutable Objects with Jackson](https://www.baeldung.com/jackson-deserialize-immutable-objects) From 8a8ed15217e766c09aefc0d993aacd4aa3555b81 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 16:19:19 +0530 Subject: [PATCH 095/143] Back-link added --- persistence-modules/java-jpa/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/java-jpa/README.md b/persistence-modules/java-jpa/README.md index 5fe119cca4..2c26581bab 100644 --- a/persistence-modules/java-jpa/README.md +++ b/persistence-modules/java-jpa/README.md @@ -5,3 +5,4 @@ - [Fixing the JPA error “java.lang.String cannot be cast to Ljava.lang.String;”](https://www.baeldung.com/jpa-error-java-lang-string-cannot-be-cast) - [JPA Entity Graph](https://www.baeldung.com/jpa-entity-graph) - [JPA 2.2 Support for Java 8 Date/Time Types](https://www.baeldung.com/jpa-java-time) +- [Converting Between LocalDate and SQL Date](https://www.baeldung.com/java-convert-localdate-sql-date) From 62a721d98dd46d27ef882ea08b51f9da204d5afb Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 16:21:14 +0530 Subject: [PATCH 096/143] Back-link added --- java-collections-maps/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/java-collections-maps/README.md b/java-collections-maps/README.md index b4ab270448..5d65e961de 100644 --- a/java-collections-maps/README.md +++ b/java-collections-maps/README.md @@ -19,3 +19,4 @@ - [How to Check If a Key Exists in a Map](https://www.baeldung.com/java-map-key-exists) - [Comparing Two HashMaps in Java](https://www.baeldung.com/java-compare-hashmaps) - [Immutable Map Implementations in Java](https://www.baeldung.com/java-immutable-maps) +- [Map to String Conversion in Java](https://www.baeldung.com/java-map-to-string-conversion) From f528f7ff8368a2194e8a95eb011b618aa748f9d6 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 16:35:20 +0530 Subject: [PATCH 097/143] Back-link added --- java-streams/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/java-streams/README.md b/java-streams/README.md index f2afd570f6..15ea1c742a 100644 --- a/java-streams/README.md +++ b/java-streams/README.md @@ -16,3 +16,4 @@ - [Introduction to Protonpack](https://www.baeldung.com/java-protonpack) - [Java Stream Filter with Lambda Expression](https://www.baeldung.com/java-stream-filter-lambda) - [Counting Matches on a Stream Filter](https://www.baeldung.com/java-stream-filter-count) +- [Java 8 Streams peek() API](https://www.baeldung.com/java-streams-peek-api) From dde992c3b9fe88ec48663e7e43f320756bbd34b4 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 16:37:27 +0530 Subject: [PATCH 098/143] Back-link added --- spring-core/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-core/README.md b/spring-core/README.md index e5c359c11b..dcc15a4cb9 100644 --- a/spring-core/README.md +++ b/spring-core/README.md @@ -22,3 +22,4 @@ - [Spring Application Context Events](https://www.baeldung.com/spring-context-events) - [Unsatisfied Dependency in Spring](https://www.baeldung.com/spring-unsatisfied-dependency) - [What is a Spring Bean?](https://www.baeldung.com/spring-bean) +- [Spring PostConstruct and PreDestroy Annotations](https://www.baeldung.com/spring-postconstruct-predestroy) From 56900e26e0c6d639d88fdb3e1d1a59a810e0e03a Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 16:40:37 +0530 Subject: [PATCH 099/143] Back-link added --- core-java-io/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-io/README.md b/core-java-io/README.md index fcb3302a48..2efe265100 100644 --- a/core-java-io/README.md +++ b/core-java-io/README.md @@ -38,3 +38,4 @@ - [How to Get the File Extension of a File in Java](http://www.baeldung.com/java-file-extension) - [Getting a File’s Mime Type in Java](http://www.baeldung.com/java-file-mime-type) - [Create a Directory in Java](https://www.baeldung.com/java-create-directory) +- [How to Write to a CSV File in Java](https://www.baeldung.com/java-csv) From d69d417b1bcb0500826a0bdcf8e90e0cd34a53a8 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 16:43:06 +0530 Subject: [PATCH 100/143] back-link added --- apache-spark/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/apache-spark/README.md b/apache-spark/README.md index fb8059eb27..a4dce212b4 100644 --- a/apache-spark/README.md +++ b/apache-spark/README.md @@ -1,3 +1,4 @@ ### Relevant articles - [Introduction to Apache Spark](http://www.baeldung.com/apache-spark) +- [Building a Data Pipeline with Kafka, Spark Streaming and Cassandra](https://www.baeldung.com/kafka-spark-data-pipeline) From 77f2f11f88e7feaf60f0b605c78c20158018879e Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 16:48:15 +0530 Subject: [PATCH 101/143] Back-link added --- algorithms-miscellaneous-1/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/algorithms-miscellaneous-1/README.md b/algorithms-miscellaneous-1/README.md index 377e5d582b..7ed805f7c4 100644 --- a/algorithms-miscellaneous-1/README.md +++ b/algorithms-miscellaneous-1/README.md @@ -16,3 +16,4 @@ - [Find the Longest Substring without Repeating Characters](https://www.baeldung.com/java-longest-substring-without-repeated-characters) - [Java Two Pointer Technique](https://www.baeldung.com/java-two-pointer-technique) - [Permutations of an Array in Java](https://www.baeldung.com/java-array-permutations) +- [Implementing Simple State Machines with Java Enums](https://www.baeldung.com/java-enum-simple-state-machine) From 6582a398c16ccd2d9200d136208a18963572600d Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 16:51:16 +0530 Subject: [PATCH 102/143] Back-link added --- core-java-lang/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-lang/README.md b/core-java-lang/README.md index d0eb7dc663..c1c22caf6c 100644 --- a/core-java-lang/README.md +++ b/core-java-lang/README.md @@ -40,3 +40,4 @@ - [Control Structures in Java](https://www.baeldung.com/java-control-structures) - [Java Interfaces](https://www.baeldung.com/java-interfaces) - [Attaching Values to Java Enum](https://www.baeldung.com/java-enum-values) +- [Variable Scope in Java](https://www.baeldung.com/java-variable-scope) From b5d178c15eca915ebf1d0196ae1e15045fd6a56e Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 16:55:15 +0530 Subject: [PATCH 103/143] Back-link added --- core-kotlin/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-kotlin/README.md b/core-kotlin/README.md index 225ad87e87..6ee79b2a2e 100644 --- a/core-kotlin/README.md +++ b/core-kotlin/README.md @@ -51,3 +51,4 @@ - [Operator Overloading in Kotlin](https://www.baeldung.com/kotlin-operator-overloading) - [Inline Classes in Kotlin](https://www.baeldung.com/kotlin-inline-classes) - [Creating Java static final Equivalents in Kotlin](https://www.baeldung.com/kotlin-java-static-final) +- [Nested forEach in Kotlin](https://www.baeldung.com/kotlin-nested-foreach) From 30cbbd394453a0262b6a5f63bec53f51fe626477 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 16:58:24 +0530 Subject: [PATCH 104/143] Back-link added --- testing-modules/junit-5/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/testing-modules/junit-5/README.md b/testing-modules/junit-5/README.md index 1fbd7a4a5e..4ed01e7fa9 100644 --- a/testing-modules/junit-5/README.md +++ b/testing-modules/junit-5/README.md @@ -16,3 +16,4 @@ - [Running JUnit Tests Programmatically, from a Java Application](https://www.baeldung.com/junit-tests-run-programmatically-from-java) - [Testing an Abstract Class With JUnit](https://www.baeldung.com/junit-test-abstract-class) - [A Quick JUnit vs TestNG Comparison](http://www.baeldung.com/junit-vs-testng) +- [Guide to JUnit 5 Parameterized Tests](https://www.baeldung.com/parameterized-tests-junit-5) From 347061485d961882af6eafa917fd414e613d9b8e Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 17:01:27 +0530 Subject: [PATCH 105/143] Back-link added --- core-java/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java/README.md b/core-java/README.md index d5ade40812..914692d425 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -49,3 +49,4 @@ - [Retrieve Fields from a Java Class Using Reflection](https://www.baeldung.com/java-reflection-class-fields) - [Introduction to Basic Syntax in Java](https://www.baeldung.com/java-syntax) - [Using Curl in Java](https://www.baeldung.com/java-curl) +- [Finding Leap Years in Java](https://www.baeldung.com/java-leap-year) From 3814744d59e29f8a739757073afdbaf37de9afd8 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 17:05:30 +0530 Subject: [PATCH 106/143] Back-link added --- core-java-arrays/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-arrays/README.md b/core-java-arrays/README.md index 400dd7793c..ed8221ebe4 100644 --- a/core-java-arrays/README.md +++ b/core-java-arrays/README.md @@ -14,3 +14,4 @@ - [Array Operations in Java](http://www.baeldung.com/java-common-array-operations) - [Intersection Between two Integer Arrays](https://www.baeldung.com/java-array-intersection) - [Sorting Arrays in Java](https://www.baeldung.com/java-sorting-arrays) +- [Convert a Float to a Byte Array in Java](https://www.baeldung.com/java-convert-float-to-byte-array) From e7868372a894484326b4b6380f410bf502c1c698 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 17:07:14 +0530 Subject: [PATCH 107/143] Back-link added --- libraries-server/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries-server/README.md b/libraries-server/README.md index 28f963ade8..75c12fd61a 100644 --- a/libraries-server/README.md +++ b/libraries-server/README.md @@ -7,3 +7,4 @@ - [Creating and Configuring Jetty 9 Server in Java](http://www.baeldung.com/jetty-java-programmatic) - [Testing Netty with EmbeddedChannel](http://www.baeldung.com/testing-netty-embedded-channel) - [MQTT Client in Java](https://www.baeldung.com/java-mqtt-client) +- [Guide to XMPP Smack Client](https://www.baeldung.com/xmpp-smack-chat-client) From ab0d05758cbba447deab373a727a4dff02f02eea Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 17:09:01 +0530 Subject: [PATCH 108/143] Back-link added --- persistence-modules/spring-boot-persistence/README.MD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/persistence-modules/spring-boot-persistence/README.MD b/persistence-modules/spring-boot-persistence/README.MD index cab6be1ec8..6fe5e6f05f 100644 --- a/persistence-modules/spring-boot-persistence/README.MD +++ b/persistence-modules/spring-boot-persistence/README.MD @@ -6,4 +6,4 @@ - [Configuring a Tomcat Connection Pool in Spring Boot](https://www.baeldung.com/spring-boot-tomcat-connection-pool) - [Hibernate Field Naming with Spring Boot](https://www.baeldung.com/hibernate-field-naming-spring-boot) - [Integrating Spring Boot with HSQLDB](https://www.baeldung.com/spring-boot-hsqldb) - +- [Configuring a DataSource Programmatically in Spring Boot](https://www.baeldung.com/spring-boot-configure-data-source-programmatic) From 434ec77c6fdc833ac181989893961de49ecad97f Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 17:15:30 +0530 Subject: [PATCH 109/143] Back-link added --- java-strings/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/java-strings/README.md b/java-strings/README.md index d4ec2325a5..1ab5e098f6 100644 --- a/java-strings/README.md +++ b/java-strings/README.md @@ -52,3 +52,4 @@ - [Java toString() Method](https://www.baeldung.com/java-tostring) - [Java String Interview Questions and Answers](https://www.baeldung.com/java-string-interview-questions) - [Check if a String is a Pangram in Java](https://www.baeldung.com/java-string-pangram) +- [Check If a String Contains Multiple Keywords](https://www.baeldung.com/string-contains-multiple-words) From 0a1b2fd680447376926fc1419449341231dd5bac Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 17:17:34 +0530 Subject: [PATCH 110/143] Back-link added --- spring-boot-mvc/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-boot-mvc/README.md b/spring-boot-mvc/README.md index bf32e4fc7c..0e1ac5a8ce 100644 --- a/spring-boot-mvc/README.md +++ b/spring-boot-mvc/README.md @@ -9,4 +9,5 @@ - [Display RSS Feed with Spring MVC](http://www.baeldung.com/spring-mvc-rss-feed) - [A Controller, Service and DAO Example with Spring Boot and JSF](https://www.baeldung.com/jsf-spring-boot-controller-service-dao) - [Cache Eviction in Spring Boot](https://www.baeldung.com/spring-boot-evict-cache) -- [Setting Up Swagger 2 with a Spring REST API](http://www.baeldung.com/swagger-2-documentation-for-spring-rest-api) \ No newline at end of file +- [Setting Up Swagger 2 with a Spring REST API](http://www.baeldung.com/swagger-2-documentation-for-spring-rest-api) +- [Conditionally Enable Scheduled Jobs in Spring](https://www.baeldung.com/spring-scheduled-enabled-conditionally) From ad763b4ac5b6d2beb12cbde5bf3813c6a62bfa35 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 17:19:39 +0530 Subject: [PATCH 111/143] Back-link added --- persistence-modules/spring-data-jpa/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/spring-data-jpa/README.md b/persistence-modules/spring-data-jpa/README.md index 976a692699..739031ff5e 100644 --- a/persistence-modules/spring-data-jpa/README.md +++ b/persistence-modules/spring-data-jpa/README.md @@ -19,6 +19,7 @@ - [Sorting Query Results with Spring Data](https://www.baeldung.com/spring-data-sorting) - [INSERT Statement in JPA](https://www.baeldung.com/jpa-insert) - [Pagination and Sorting using Spring Data JPA](https://www.baeldung.com/spring-data-jpa-pagination-sorting) +- [Spring Data JPA Query by Example](https://www.baeldung.com/spring-data-query-by-example) ### Eclipse Config After importing the project into Eclipse, you may see the following error: From 93ca117fa856292b7abad9b4ab8b41fb5d8af264 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 17:23:34 +0530 Subject: [PATCH 112/143] Back-link added --- core-java-io/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-io/README.md b/core-java-io/README.md index 2efe265100..9a25009849 100644 --- a/core-java-io/README.md +++ b/core-java-io/README.md @@ -39,3 +39,4 @@ - [Getting a File’s Mime Type in Java](http://www.baeldung.com/java-file-mime-type) - [Create a Directory in Java](https://www.baeldung.com/java-create-directory) - [How to Write to a CSV File in Java](https://www.baeldung.com/java-csv) +- [List Files in a Directory in Java](https://www.baeldung.com/java-list-directory-files) From a64b8054e76c0a4020998752023ca0b368eea3b1 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 5 Feb 2019 17:25:18 +0530 Subject: [PATCH 113/143] Back-link added --- core-java/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java/README.md b/core-java/README.md index 914692d425..d2fd903c10 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -50,3 +50,4 @@ - [Introduction to Basic Syntax in Java](https://www.baeldung.com/java-syntax) - [Using Curl in Java](https://www.baeldung.com/java-curl) - [Finding Leap Years in Java](https://www.baeldung.com/java-leap-year) +- [Java Bitwise Operators](https://www.baeldung.com/java-bitwise-operators) From 46bad01ab982516fe73eb01819d05c46288bd736 Mon Sep 17 00:00:00 2001 From: Seun Matt Date: Tue, 5 Feb 2019 17:15:14 +0100 Subject: [PATCH 114/143] added example code for BAEL-2549 (#6282) * added example code for BAEL-2366 * moved example code for BAEL-2366 * example code for BAEL-1961 * moved example code into integration test * updated the test assertions * refactor the spring boot persistence mongodb module * remove redundant example code * declared the spring boot persistence module in the root pom * fixed issue with non-imported file * added example code for BAEL-2418 * added example code for BAEL-2549 --- .../HibernateCriteriaIntegrationTest.java | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/hibernate/criteria/HibernateCriteriaIntegrationTest.java b/persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/hibernate/criteria/HibernateCriteriaIntegrationTest.java index 723b097305..c3805bac57 100644 --- a/persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/hibernate/criteria/HibernateCriteriaIntegrationTest.java +++ b/persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/hibernate/criteria/HibernateCriteriaIntegrationTest.java @@ -1,17 +1,24 @@ package com.baeldung.hibernate.criteria; import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.util.List; import org.hibernate.Session; +import org.hibernate.Transaction; import org.junit.Test; import com.baeldung.hibernate.criteria.model.Item; import com.baeldung.hibernate.criteria.util.HibernateUtil; import com.baeldung.hibernate.criteria.view.ApplicationView; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaDelete; +import javax.persistence.criteria.CriteriaUpdate; +import javax.persistence.criteria.Root; + public class HibernateCriteriaIntegrationTest { final private ApplicationView av = new ApplicationView(); @@ -179,4 +186,51 @@ public class HibernateCriteriaIntegrationTest { session.close(); assertArrayEquals(expectedPriceBetweenItems, av.betweenCriteria()); } + + @Test + public void givenNewItemPrice_whenCriteriaUpdate_thenReturnAffectedResult() { + + int oldPrice = 10, newPrice = 20; + + Session session = HibernateUtil.getHibernateSession(); + + Item item = new Item(12, "Test Item 12", "This is a description"); + item.setItemPrice(oldPrice); + session.save(item); + + CriteriaBuilder cb = session.getCriteriaBuilder(); + CriteriaUpdate criteriaUpdate = cb.createCriteriaUpdate(Item.class); + Root root = criteriaUpdate.from(Item.class); + criteriaUpdate.set("itemPrice", newPrice); + criteriaUpdate.where(cb.equal(root.get("itemPrice"), oldPrice)); + + Transaction transaction = session.beginTransaction(); + session.createQuery(criteriaUpdate).executeUpdate(); + transaction.commit(); + + Item updatedItem = session.createQuery("FROM Item WHERE itemPrice = " + newPrice, Item.class).getSingleResult(); + session.refresh(updatedItem); + assertEquals(newPrice, updatedItem.getItemPrice().intValue()); + } + + @Test + public void givenTargetItemPrice_whenCriteriaDelete_thenDeleteMatched() { + + int targetPrice = 1000; + + Session session = HibernateUtil.getHibernateSession(); + CriteriaBuilder cb = session.getCriteriaBuilder(); + CriteriaDelete criteriaDelete = cb.createCriteriaDelete(Item.class); + Root root = criteriaDelete.from(Item.class); + criteriaDelete.where(cb.greaterThan(root.get("itemPrice"), targetPrice)); + + Transaction transaction = session.beginTransaction(); + session.createQuery(criteriaDelete).executeUpdate(); + transaction.commit(); + + List deletedItem = session.createQuery("FROM Item WHERE itemPrice > " + targetPrice, Item.class).list(); + assertTrue(deletedItem.isEmpty()); + + } + } From 01fa4cfaf8b33e958c2f18c3afc5b3ad2c5be09c Mon Sep 17 00:00:00 2001 From: eric-martin Date: Tue, 5 Feb 2019 22:14:51 -0600 Subject: [PATCH 115/143] BAEL-2399: Migrate Spring DI example to spring-core module --- .../PriorityQueueUnitTest.java | 0 guice/pom.xml | 64 +++++++------------ .../com/baeldung/examples/common/Account.java | 3 - .../examples/common/AccountServiceImpl.java | 3 - .../examples/common/BookServiceImpl.java | 3 - .../examples/common/PersonDaoImpl.java | 3 - .../baeldung/examples/guice/FooProcessor.java | 3 - .../examples/guice/modules/GuiceModule.java | 2 +- .../java/com/baeldung/di/spring/Account.java | 27 ++++++++ .../baeldung/di/spring/AccountService.java | 5 ++ .../di/spring/AccountServiceImpl.java | 8 +++ .../baeldung/di/spring/AudioBookService.java | 5 ++ .../di/spring/AudioBookServiceImpl.java | 5 ++ .../com/baeldung/di/spring/AuthorService.java | 5 ++ .../baeldung/di/spring/AuthorServiceImpl.java | 5 ++ .../com/baeldung/di/spring/BookService.java | 5 ++ .../baeldung/di/spring/BookServiceImpl.java | 10 +++ .../main/java/com/baeldung/di/spring/Foo.java | 4 ++ .../com/baeldung/di/spring/FooProcessor.java | 6 ++ .../com/baeldung/di/spring/PersonDao.java | 5 ++ .../com/baeldung/di/spring/PersonDaoImpl.java | 8 +++ .../di}/spring/SpringBeansConfig.java | 5 +- .../baeldung/di}/spring/SpringMainConfig.java | 7 +- .../di}/spring/SpringPersonService.java | 4 +- .../com/baeldung/di}/spring/UserService.java | 4 +- .../baeldung/di/spring}/SpringUnitTest.java | 8 +-- 26 files changed, 129 insertions(+), 78 deletions(-) rename core-java-collections/src/test/java/com/baeldung/{queueInterface => queueinterface}/PriorityQueueUnitTest.java (100%) create mode 100644 spring-core/src/main/java/com/baeldung/di/spring/Account.java create mode 100644 spring-core/src/main/java/com/baeldung/di/spring/AccountService.java create mode 100644 spring-core/src/main/java/com/baeldung/di/spring/AccountServiceImpl.java create mode 100644 spring-core/src/main/java/com/baeldung/di/spring/AudioBookService.java create mode 100644 spring-core/src/main/java/com/baeldung/di/spring/AudioBookServiceImpl.java create mode 100644 spring-core/src/main/java/com/baeldung/di/spring/AuthorService.java create mode 100644 spring-core/src/main/java/com/baeldung/di/spring/AuthorServiceImpl.java create mode 100644 spring-core/src/main/java/com/baeldung/di/spring/BookService.java create mode 100644 spring-core/src/main/java/com/baeldung/di/spring/BookServiceImpl.java create mode 100644 spring-core/src/main/java/com/baeldung/di/spring/Foo.java create mode 100644 spring-core/src/main/java/com/baeldung/di/spring/FooProcessor.java create mode 100644 spring-core/src/main/java/com/baeldung/di/spring/PersonDao.java create mode 100644 spring-core/src/main/java/com/baeldung/di/spring/PersonDaoImpl.java rename {guice/src/main/java/com/baeldung/examples => spring-core/src/main/java/com/baeldung/di}/spring/SpringBeansConfig.java (64%) rename {guice/src/main/java/com/baeldung/examples => spring-core/src/main/java/com/baeldung/di}/spring/SpringMainConfig.java (66%) rename {guice/src/main/java/com/baeldung/examples => spring-core/src/main/java/com/baeldung/di}/spring/SpringPersonService.java (81%) rename {guice/src/main/java/com/baeldung/examples => spring-core/src/main/java/com/baeldung/di}/spring/UserService.java (77%) rename {guice/src/test/java/com/baeldung/examples => spring-core/src/test/java/com/baeldung/di/spring}/SpringUnitTest.java (88%) diff --git a/core-java-collections/src/test/java/com/baeldung/queueInterface/PriorityQueueUnitTest.java b/core-java-collections/src/test/java/com/baeldung/queueinterface/PriorityQueueUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/queueInterface/PriorityQueueUnitTest.java rename to core-java-collections/src/test/java/com/baeldung/queueinterface/PriorityQueueUnitTest.java diff --git a/guice/pom.xml b/guice/pom.xml index 0aea662d64..5c4518da7a 100644 --- a/guice/pom.xml +++ b/guice/pom.xml @@ -1,45 +1,29 @@ - - 4.0.0 - com.baeldung.examples.guice - guice - 1.0-SNAPSHOT - jar - guice + + 4.0.0 + com.baeldung.examples.guice + guice + 1.0-SNAPSHOT + jar + guice - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + - - - com.google.inject - guice - ${guice.version} - + + + com.google.inject + guice + ${guice.version} + + - - org.springframework - spring-context - ${spring.version} - + + 4.1.0 + - - org.springframework - spring-test - ${springtest.version} - test - - - - - 4.2.2 - 5.1.3.RELEASE - 5.1.3.RELEASE - - - + \ No newline at end of file diff --git a/guice/src/main/java/com/baeldung/examples/common/Account.java b/guice/src/main/java/com/baeldung/examples/common/Account.java index 8f8b5059c5..fd2df005ac 100644 --- a/guice/src/main/java/com/baeldung/examples/common/Account.java +++ b/guice/src/main/java/com/baeldung/examples/common/Account.java @@ -1,8 +1,5 @@ package com.baeldung.examples.common; -import org.springframework.stereotype.Component; - -@Component public class Account { private String accountNumber; diff --git a/guice/src/main/java/com/baeldung/examples/common/AccountServiceImpl.java b/guice/src/main/java/com/baeldung/examples/common/AccountServiceImpl.java index 969c106d5b..18d6777c4a 100644 --- a/guice/src/main/java/com/baeldung/examples/common/AccountServiceImpl.java +++ b/guice/src/main/java/com/baeldung/examples/common/AccountServiceImpl.java @@ -1,8 +1,5 @@ package com.baeldung.examples.common; -import org.springframework.stereotype.Component; - -@Component public class AccountServiceImpl implements AccountService { } diff --git a/guice/src/main/java/com/baeldung/examples/common/BookServiceImpl.java b/guice/src/main/java/com/baeldung/examples/common/BookServiceImpl.java index 01f968bbe9..aee0d22e51 100644 --- a/guice/src/main/java/com/baeldung/examples/common/BookServiceImpl.java +++ b/guice/src/main/java/com/baeldung/examples/common/BookServiceImpl.java @@ -1,10 +1,7 @@ package com.baeldung.examples.common; -import org.springframework.beans.factory.annotation.Autowired; - public class BookServiceImpl implements BookService { - @Autowired(required = false) private AuthorService authorService; } diff --git a/guice/src/main/java/com/baeldung/examples/common/PersonDaoImpl.java b/guice/src/main/java/com/baeldung/examples/common/PersonDaoImpl.java index 971db5aa87..ecbf198cc0 100644 --- a/guice/src/main/java/com/baeldung/examples/common/PersonDaoImpl.java +++ b/guice/src/main/java/com/baeldung/examples/common/PersonDaoImpl.java @@ -1,8 +1,5 @@ package com.baeldung.examples.common; -import org.springframework.stereotype.Component; - -@Component public class PersonDaoImpl implements PersonDao { } \ No newline at end of file diff --git a/guice/src/main/java/com/baeldung/examples/guice/FooProcessor.java b/guice/src/main/java/com/baeldung/examples/guice/FooProcessor.java index f0cba31d9a..929013cd2b 100644 --- a/guice/src/main/java/com/baeldung/examples/guice/FooProcessor.java +++ b/guice/src/main/java/com/baeldung/examples/guice/FooProcessor.java @@ -1,12 +1,9 @@ package com.baeldung.examples.guice; -import org.springframework.lang.Nullable; - import com.google.inject.Inject; public class FooProcessor { @Inject - @Nullable private Foo foo; } \ No newline at end of file diff --git a/guice/src/main/java/com/baeldung/examples/guice/modules/GuiceModule.java b/guice/src/main/java/com/baeldung/examples/guice/modules/GuiceModule.java index 6a380e922b..fbcd36b56a 100644 --- a/guice/src/main/java/com/baeldung/examples/guice/modules/GuiceModule.java +++ b/guice/src/main/java/com/baeldung/examples/guice/modules/GuiceModule.java @@ -27,7 +27,7 @@ public class GuiceModule extends AbstractModule { // }); bind(Foo.class).toProvider(new Provider() { public Foo get() { - return null; + return new Foo(); } }); bind(PersonDao.class).to(PersonDaoImpl.class); diff --git a/spring-core/src/main/java/com/baeldung/di/spring/Account.java b/spring-core/src/main/java/com/baeldung/di/spring/Account.java new file mode 100644 index 0000000000..6d9883bda5 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/di/spring/Account.java @@ -0,0 +1,27 @@ +package com.baeldung.di.spring; + +import org.springframework.stereotype.Component; + +@Component +public class Account { + + private String accountNumber; + private String type; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + +} diff --git a/spring-core/src/main/java/com/baeldung/di/spring/AccountService.java b/spring-core/src/main/java/com/baeldung/di/spring/AccountService.java new file mode 100644 index 0000000000..75ba6bb3eb --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/di/spring/AccountService.java @@ -0,0 +1,5 @@ +package com.baeldung.di.spring; + +public interface AccountService { + +} diff --git a/spring-core/src/main/java/com/baeldung/di/spring/AccountServiceImpl.java b/spring-core/src/main/java/com/baeldung/di/spring/AccountServiceImpl.java new file mode 100644 index 0000000000..4a4baf7d92 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/di/spring/AccountServiceImpl.java @@ -0,0 +1,8 @@ +package com.baeldung.di.spring; + +import org.springframework.stereotype.Component; + +@Component +public class AccountServiceImpl implements AccountService { + +} diff --git a/spring-core/src/main/java/com/baeldung/di/spring/AudioBookService.java b/spring-core/src/main/java/com/baeldung/di/spring/AudioBookService.java new file mode 100644 index 0000000000..c82e5ed282 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/di/spring/AudioBookService.java @@ -0,0 +1,5 @@ +package com.baeldung.di.spring; + +public interface AudioBookService { + +} diff --git a/spring-core/src/main/java/com/baeldung/di/spring/AudioBookServiceImpl.java b/spring-core/src/main/java/com/baeldung/di/spring/AudioBookServiceImpl.java new file mode 100644 index 0000000000..53a544b65a --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/di/spring/AudioBookServiceImpl.java @@ -0,0 +1,5 @@ +package com.baeldung.di.spring; + +public class AudioBookServiceImpl implements AudioBookService { + +} diff --git a/spring-core/src/main/java/com/baeldung/di/spring/AuthorService.java b/spring-core/src/main/java/com/baeldung/di/spring/AuthorService.java new file mode 100644 index 0000000000..cfb525ddf9 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/di/spring/AuthorService.java @@ -0,0 +1,5 @@ +package com.baeldung.di.spring; + +public interface AuthorService { + +} diff --git a/spring-core/src/main/java/com/baeldung/di/spring/AuthorServiceImpl.java b/spring-core/src/main/java/com/baeldung/di/spring/AuthorServiceImpl.java new file mode 100644 index 0000000000..007eb29930 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/di/spring/AuthorServiceImpl.java @@ -0,0 +1,5 @@ +package com.baeldung.di.spring; + +public class AuthorServiceImpl implements AuthorService { + +} diff --git a/spring-core/src/main/java/com/baeldung/di/spring/BookService.java b/spring-core/src/main/java/com/baeldung/di/spring/BookService.java new file mode 100644 index 0000000000..8e693e687d --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/di/spring/BookService.java @@ -0,0 +1,5 @@ +package com.baeldung.di.spring; + +public interface BookService { + +} diff --git a/spring-core/src/main/java/com/baeldung/di/spring/BookServiceImpl.java b/spring-core/src/main/java/com/baeldung/di/spring/BookServiceImpl.java new file mode 100644 index 0000000000..b4ea602234 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/di/spring/BookServiceImpl.java @@ -0,0 +1,10 @@ +package com.baeldung.di.spring; + +import org.springframework.beans.factory.annotation.Autowired; + +public class BookServiceImpl implements BookService { + + @Autowired(required = false) + private AuthorService authorService; + +} diff --git a/spring-core/src/main/java/com/baeldung/di/spring/Foo.java b/spring-core/src/main/java/com/baeldung/di/spring/Foo.java new file mode 100644 index 0000000000..9d9b5d0888 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/di/spring/Foo.java @@ -0,0 +1,4 @@ +package com.baeldung.di.spring; + +public class Foo { +} diff --git a/spring-core/src/main/java/com/baeldung/di/spring/FooProcessor.java b/spring-core/src/main/java/com/baeldung/di/spring/FooProcessor.java new file mode 100644 index 0000000000..9baaaef7a3 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/di/spring/FooProcessor.java @@ -0,0 +1,6 @@ +package com.baeldung.di.spring; + +public class FooProcessor { + + private Foo foo; +} \ No newline at end of file diff --git a/spring-core/src/main/java/com/baeldung/di/spring/PersonDao.java b/spring-core/src/main/java/com/baeldung/di/spring/PersonDao.java new file mode 100644 index 0000000000..8dde7ed1e0 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/di/spring/PersonDao.java @@ -0,0 +1,5 @@ +package com.baeldung.di.spring; + +public interface PersonDao { + +} diff --git a/spring-core/src/main/java/com/baeldung/di/spring/PersonDaoImpl.java b/spring-core/src/main/java/com/baeldung/di/spring/PersonDaoImpl.java new file mode 100644 index 0000000000..efcc2e0f21 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/di/spring/PersonDaoImpl.java @@ -0,0 +1,8 @@ +package com.baeldung.di.spring; + +import org.springframework.stereotype.Component; + +@Component +public class PersonDaoImpl implements PersonDao { + +} \ No newline at end of file diff --git a/guice/src/main/java/com/baeldung/examples/spring/SpringBeansConfig.java b/spring-core/src/main/java/com/baeldung/di/spring/SpringBeansConfig.java similarity index 64% rename from guice/src/main/java/com/baeldung/examples/spring/SpringBeansConfig.java rename to spring-core/src/main/java/com/baeldung/di/spring/SpringBeansConfig.java index ef0c23142c..4cb6943fc9 100644 --- a/guice/src/main/java/com/baeldung/examples/spring/SpringBeansConfig.java +++ b/spring-core/src/main/java/com/baeldung/di/spring/SpringBeansConfig.java @@ -1,11 +1,8 @@ -package com.baeldung.examples.spring; +package com.baeldung.di.spring; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import com.baeldung.examples.common.AudioBookService; -import com.baeldung.examples.common.AudioBookServiceImpl; - @Configuration public class SpringBeansConfig { diff --git a/guice/src/main/java/com/baeldung/examples/spring/SpringMainConfig.java b/spring-core/src/main/java/com/baeldung/di/spring/SpringMainConfig.java similarity index 66% rename from guice/src/main/java/com/baeldung/examples/spring/SpringMainConfig.java rename to spring-core/src/main/java/com/baeldung/di/spring/SpringMainConfig.java index 1ced22288f..75066fd539 100644 --- a/guice/src/main/java/com/baeldung/examples/spring/SpringMainConfig.java +++ b/spring-core/src/main/java/com/baeldung/di/spring/SpringMainConfig.java @@ -1,16 +1,13 @@ -package com.baeldung.examples.spring; +package com.baeldung.di.spring; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; -import com.baeldung.examples.common.BookService; -import com.baeldung.examples.common.BookServiceImpl; - @Configuration @Import({ SpringBeansConfig.class }) -@ComponentScan("com.baeldung.examples") +@ComponentScan("com.baeldung.di.spring") public class SpringMainConfig { @Bean diff --git a/guice/src/main/java/com/baeldung/examples/spring/SpringPersonService.java b/spring-core/src/main/java/com/baeldung/di/spring/SpringPersonService.java similarity index 81% rename from guice/src/main/java/com/baeldung/examples/spring/SpringPersonService.java rename to spring-core/src/main/java/com/baeldung/di/spring/SpringPersonService.java index 1ab5642f31..b85c749982 100644 --- a/guice/src/main/java/com/baeldung/examples/spring/SpringPersonService.java +++ b/spring-core/src/main/java/com/baeldung/di/spring/SpringPersonService.java @@ -1,10 +1,8 @@ -package com.baeldung.examples.spring; +package com.baeldung.di.spring; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import com.baeldung.examples.common.PersonDao; - @Component public class SpringPersonService { diff --git a/guice/src/main/java/com/baeldung/examples/spring/UserService.java b/spring-core/src/main/java/com/baeldung/di/spring/UserService.java similarity index 77% rename from guice/src/main/java/com/baeldung/examples/spring/UserService.java rename to spring-core/src/main/java/com/baeldung/di/spring/UserService.java index 4173ef8208..330d7f7448 100644 --- a/guice/src/main/java/com/baeldung/examples/spring/UserService.java +++ b/spring-core/src/main/java/com/baeldung/di/spring/UserService.java @@ -1,10 +1,8 @@ -package com.baeldung.examples.spring; +package com.baeldung.di.spring; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import com.baeldung.examples.common.AccountService; - @Component public class UserService { diff --git a/guice/src/test/java/com/baeldung/examples/SpringUnitTest.java b/spring-core/src/test/java/com/baeldung/di/spring/SpringUnitTest.java similarity index 88% rename from guice/src/test/java/com/baeldung/examples/SpringUnitTest.java rename to spring-core/src/test/java/com/baeldung/di/spring/SpringUnitTest.java index 64e1eedcac..7df8dfac89 100644 --- a/guice/src/test/java/com/baeldung/examples/SpringUnitTest.java +++ b/spring-core/src/test/java/com/baeldung/di/spring/SpringUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.examples; +package com.baeldung.di.spring; import static org.junit.Assert.assertNotNull; @@ -9,12 +9,6 @@ import org.springframework.context.ApplicationContext; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; -import com.baeldung.examples.common.AudioBookService; -import com.baeldung.examples.common.BookService; -import com.baeldung.examples.spring.SpringMainConfig; -import com.baeldung.examples.spring.SpringPersonService; -import com.baeldung.examples.spring.UserService; - @RunWith(SpringRunner.class) @ContextConfiguration(classes = { SpringMainConfig.class }) public class SpringUnitTest { From 1f244261d003ffe2bf71e33a40e5ee0d835fca9d Mon Sep 17 00:00:00 2001 From: Mikhail Chugunov Date: Wed, 6 Feb 2019 20:37:22 +0300 Subject: [PATCH 116/143] BAEL-2443: jsonview spring security (#6291) * BAEL-2443: Implement filtering with @JsonView based on spring security role * Cleanup test * Rename tests * Fix renaming roles after refactoring * BAEL-2443: Restore return statement in controller advice --- .../com/baeldung/spring/SecurityJsonViewControllerAdvice.java | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-security-mvc-jsonview/src/main/java/com/baeldung/spring/SecurityJsonViewControllerAdvice.java b/spring-security-mvc-jsonview/src/main/java/com/baeldung/spring/SecurityJsonViewControllerAdvice.java index 66c7207e91..d6d022a110 100644 --- a/spring-security-mvc-jsonview/src/main/java/com/baeldung/spring/SecurityJsonViewControllerAdvice.java +++ b/spring-security-mvc-jsonview/src/main/java/com/baeldung/spring/SecurityJsonViewControllerAdvice.java @@ -31,6 +31,7 @@ public class SecurityJsonViewControllerAdvice extends AbstractMappingJacksonResp .collect(Collectors.toList()); if (jsonViews.size() == 1) { bodyContainer.setSerializationView(jsonViews.get(0)); + return; } throw new IllegalArgumentException("Ambiguous @JsonView declaration for roles "+ authorities.stream().map(GrantedAuthority::getAuthority).collect(Collectors.joining(","))); } From 5ef2a9040a2539a9a5736d036891aeb0ded863cf Mon Sep 17 00:00:00 2001 From: pcoates Date: Wed, 6 Feb 2019 20:04:30 +0000 Subject: [PATCH 117/143] BAEL-2527 Added ArrayList example to EnumIterationExamples --- .../enumiteration/EnumIterationExamples.java | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/core-java-lang/src/test/java/com/baeldung/java/enumiteration/EnumIterationExamples.java b/core-java-lang/src/test/java/com/baeldung/java/enumiteration/EnumIterationExamples.java index 2d874fa650..110943e39f 100644 --- a/core-java-lang/src/test/java/com/baeldung/java/enumiteration/EnumIterationExamples.java +++ b/core-java-lang/src/test/java/com/baeldung/java/enumiteration/EnumIterationExamples.java @@ -1,18 +1,43 @@ package com.baeldung.java.enumiteration; +import java.util.ArrayList; +import java.util.Arrays; import java.util.EnumSet; +import java.util.List; + public class EnumIterationExamples { public static void main(String[] args) { - System.out.println("Enum iteration using forEach:"); + System.out.println("Enum iteration using EnumSet:"); EnumSet.allOf(DaysOfWeekEnum.class).forEach(day -> System.out.println(day)); System.out.println("Enum iteration using Stream:"); DaysOfWeekEnum.stream().filter(d -> d.getTypeOfDay().equals("off")).forEach(System.out::println); - System.out.println("Enum iteration using for loop:"); + System.out.println("Enum iteration using a for loop:"); for (DaysOfWeekEnum day : DaysOfWeekEnum.values()) { System.out.println(day); } + + System.out.println("Enum iteration using Arrays.asList():"); + Arrays.asList(DaysOfWeekEnum.values()).forEach(day -> System.out.println(day)); + + System.out.println("Add Enum values to ArrayList:"); + List days = new ArrayList<>(); + days.add(DaysOfWeekEnum.FRIDAY); + days.add(DaysOfWeekEnum.SATURDAY); + days.add(DaysOfWeekEnum.SUNDAY); + for (DaysOfWeekEnum day : days) { + System.out.println(day); + } + System.out.println("Remove SATURDAY from the list:"); + days.remove(DaysOfWeekEnum.SATURDAY); + if (!days.contains(DaysOfWeekEnum.SATURDAY)) { + System.out.println("Saturday is no longer in the list"); + } + for (DaysOfWeekEnum day : days) { + System.out.println(day); + } + } } From 0066ecfdbd314f8e1e7d2efd0895e8eab24e5ad6 Mon Sep 17 00:00:00 2001 From: pcoates Date: Wed, 6 Feb 2019 20:05:06 +0000 Subject: [PATCH 118/143] Corrected package for classes in com.baeldung.scope --- .../src/main/java/com/baeldung/scope/BracketScopeExample.java | 2 +- .../src/main/java/com/baeldung/scope/ClassScopeExample.java | 2 +- .../src/main/java/com/baeldung/scope/LoopScopeExample.java | 2 +- .../src/main/java/com/baeldung/scope/MethodScopeExample.java | 2 +- .../src/main/java/com/baeldung/scope/NestedScopesExample.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core-java-lang/src/main/java/com/baeldung/scope/BracketScopeExample.java b/core-java-lang/src/main/java/com/baeldung/scope/BracketScopeExample.java index 37ae211dcb..8deec35c16 100644 --- a/core-java-lang/src/main/java/com/baeldung/scope/BracketScopeExample.java +++ b/core-java-lang/src/main/java/com/baeldung/scope/BracketScopeExample.java @@ -1,4 +1,4 @@ -package org.baeldung.variable.scope.examples; +package com.baeldung.scope; public class BracketScopeExample { diff --git a/core-java-lang/src/main/java/com/baeldung/scope/ClassScopeExample.java b/core-java-lang/src/main/java/com/baeldung/scope/ClassScopeExample.java index 241c6b466e..c81fcc9550 100644 --- a/core-java-lang/src/main/java/com/baeldung/scope/ClassScopeExample.java +++ b/core-java-lang/src/main/java/com/baeldung/scope/ClassScopeExample.java @@ -1,4 +1,4 @@ -package org.baeldung.variable.scope.examples; +package com.baeldung.scope; public class ClassScopeExample { diff --git a/core-java-lang/src/main/java/com/baeldung/scope/LoopScopeExample.java b/core-java-lang/src/main/java/com/baeldung/scope/LoopScopeExample.java index 7bf92a6d26..be41252623 100644 --- a/core-java-lang/src/main/java/com/baeldung/scope/LoopScopeExample.java +++ b/core-java-lang/src/main/java/com/baeldung/scope/LoopScopeExample.java @@ -1,4 +1,4 @@ -package org.baeldung.variable.scope.examples; +package com.baeldung.scope; import java.util.Arrays; import java.util.List; diff --git a/core-java-lang/src/main/java/com/baeldung/scope/MethodScopeExample.java b/core-java-lang/src/main/java/com/baeldung/scope/MethodScopeExample.java index e62c6a2a1c..63a6a25271 100644 --- a/core-java-lang/src/main/java/com/baeldung/scope/MethodScopeExample.java +++ b/core-java-lang/src/main/java/com/baeldung/scope/MethodScopeExample.java @@ -1,4 +1,4 @@ -package org.baeldung.variable.scope.examples; +package com.baeldung.scope; public class MethodScopeExample { diff --git a/core-java-lang/src/main/java/com/baeldung/scope/NestedScopesExample.java b/core-java-lang/src/main/java/com/baeldung/scope/NestedScopesExample.java index fcd23e5ae0..c3c5bec221 100644 --- a/core-java-lang/src/main/java/com/baeldung/scope/NestedScopesExample.java +++ b/core-java-lang/src/main/java/com/baeldung/scope/NestedScopesExample.java @@ -1,4 +1,4 @@ -package org.baeldung.variable.scope.examples; +package com.baeldung.scope; public class NestedScopesExample { From 2aa4e807c0a5bc42997681537009cb02be178f36 Mon Sep 17 00:00:00 2001 From: cror <37755757+cror@users.noreply.github.com> Date: Thu, 7 Feb 2019 01:57:56 +0100 Subject: [PATCH 119/143] toSet, toMap: adding examples with duplicates (#6264) * BAEL-2548 fix typo * BAEL-2548 toSet, toMap: added tests with duplicate elements --- .../collectors/Java8CollectorsUnitTest.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsUnitTest.java b/core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsUnitTest.java index bad1c32e4a..9ace27e38f 100644 --- a/core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsUnitTest.java +++ b/core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsUnitTest.java @@ -39,6 +39,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; public class Java8CollectorsUnitTest { private final List givenList = Arrays.asList("a", "bb", "ccc", "dd"); + private final List listWithDuplicates = Arrays.asList("a", "bb", "c", "d", "bb"); @Test public void whenCollectingToList_shouldCollectToList() throws Exception { @@ -48,12 +49,19 @@ public class Java8CollectorsUnitTest { } @Test - public void whenCollectingToList_shouldCollectToSet() throws Exception { + public void whenCollectingToSet_shouldCollectToSet() throws Exception { final Set result = givenList.stream().collect(toSet()); assertThat(result).containsAll(givenList); } + @Test + public void givenContainsDuplicateElements_whenCollectingToSet_shouldAddDuplicateElementsOnlyOnce() throws Exception { + final Set result = listWithDuplicates.stream().collect(toSet()); + + assertThat(result).hasSize(4); + } + @Test public void whenCollectingToCollection_shouldCollectToCollection() throws Exception { final List result = givenList.stream().collect(toCollection(LinkedList::new)); @@ -83,6 +91,13 @@ public class Java8CollectorsUnitTest { assertThat(result).containsEntry("a", 1).containsEntry("bb", 2).containsEntry("ccc", 3).containsEntry("dd", 2); } + @Test + public void givenContainsDuplicateElements_whenCollectingToMap_shouldThrowException() throws Exception { + assertThatThrownBy(() -> { + listWithDuplicates.stream().collect(toMap(Function.identity(), String::length)); + }).isInstanceOf(IllegalStateException.class); + } + @Test public void whenCollectingAndThen_shouldCollect() throws Exception { final List result = givenList.stream().collect(collectingAndThen(toList(), ImmutableList::copyOf)); From 231b8ada5beaa1eede3876b8eb9f563c314c141d Mon Sep 17 00:00:00 2001 From: KevinGilmore Date: Wed, 6 Feb 2019 20:22:19 -0600 Subject: [PATCH 120/143] BAEL-2577: update README (#6295) * BAEL-2246: add link back to article * BAEL-2174: rename core-java-net module to core-java-networking * BAEL-2174: add link back to article * BAEL-2363 BAEL-2337 BAEL-1996 BAEL-2277 add links back to articles * BAEL-2367: add link back to article * BAEL-2335: add link back to article * BAEL-2413: add link back to article * Update README.MD * BAEL-2577: add link back to article --- spring-boot/README.MD | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-boot/README.MD b/spring-boot/README.MD index 2a6a935cc1..28123687fd 100644 --- a/spring-boot/README.MD +++ b/spring-boot/README.MD @@ -35,3 +35,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Load Spring Boot Properties From a JSON File](https://www.baeldung.com/spring-boot-json-properties) - [Display Auto-Configuration Report in Spring Boot](https://www.baeldung.com/spring-boot-auto-configuration-report) - [Injecting Git Information Into Spring](https://www.baeldung.com/spring-git-information) +- [Validation in Spring Boot](https://www.baeldung.com/spring-boot-bean-validation) From 56002a3cc7c151fc0862417e12efee957511c110 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Fri, 8 Feb 2019 00:27:29 +0200 Subject: [PATCH 121/143] Update pom.xml --- lombok-custom/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lombok-custom/pom.xml b/lombok-custom/pom.xml index 629d1b7c48..f016405fd6 100644 --- a/lombok-custom/pom.xml +++ b/lombok-custom/pom.xml @@ -57,10 +57,10 @@ - 1.18.4 + 1.14.8 1.8 3.3.0-v_771 - \ No newline at end of file + From 6a8e295febf1e6ecb98b59f650ac13226eaabf9f Mon Sep 17 00:00:00 2001 From: Anshul Bansal Date: Fri, 8 Feb 2019 08:53:29 +0200 Subject: [PATCH 122/143] BAEL-2659 - Reading a file in Groovy - typo corrected --- .../src/test/groovy/com/baeldung/file/ReadFileUnitTest.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-groovy/src/test/groovy/com/baeldung/file/ReadFileUnitTest.groovy b/core-groovy/src/test/groovy/com/baeldung/file/ReadFileUnitTest.groovy index 0d0e2aed1a..a479c265c4 100644 --- a/core-groovy/src/test/groovy/com/baeldung/file/ReadFileUnitTest.groovy +++ b/core-groovy/src/test/groovy/com/baeldung/file/ReadFileUnitTest.groovy @@ -56,7 +56,7 @@ Line 3 : String content""") encodedContent instanceof String } - def 'Should return binary file content in byte arry using ReadFile.readBinaryFile given filePath' () { + def 'Should return binary file content in byte array using ReadFile.readBinaryFile given filePath' () { given: def filePath = "src/main/resources/sample.png" when: From ba16cee3348f9cdc9610bee7f7d2e097fa7918f2 Mon Sep 17 00:00:00 2001 From: Maiklins Date: Fri, 8 Feb 2019 16:22:10 +0100 Subject: [PATCH 123/143] BAEL-2572 Ahead of Time Compilation (AoT) (#6275) --- core-java-9/compile-aot.sh | 5 +++++ core-java-9/run-aot.sh | 3 +++ .../java/com/baeldung/java9/aot/JaotCompilation.java | 12 ++++++++++++ 3 files changed, 20 insertions(+) create mode 100755 core-java-9/compile-aot.sh create mode 100755 core-java-9/run-aot.sh create mode 100644 core-java-9/src/main/java/com/baeldung/java9/aot/JaotCompilation.java diff --git a/core-java-9/compile-aot.sh b/core-java-9/compile-aot.sh new file mode 100755 index 0000000000..c3a39b0196 --- /dev/null +++ b/core-java-9/compile-aot.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +cd src/main/java +javac com/baeldung/java9/aot/JaotCompilation.java +jaotc --output jaotCompilation.so com/baeldung/java9/aot/JaotCompilation.class + diff --git a/core-java-9/run-aot.sh b/core-java-9/run-aot.sh new file mode 100755 index 0000000000..89fc616469 --- /dev/null +++ b/core-java-9/run-aot.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +cd src/main/java +java -XX:AOTLibrary=./jaotCompilation.so com/baeldung/java9/aot/JaotCompilation \ No newline at end of file diff --git a/core-java-9/src/main/java/com/baeldung/java9/aot/JaotCompilation.java b/core-java-9/src/main/java/com/baeldung/java9/aot/JaotCompilation.java new file mode 100644 index 0000000000..4d8a018d6b --- /dev/null +++ b/core-java-9/src/main/java/com/baeldung/java9/aot/JaotCompilation.java @@ -0,0 +1,12 @@ +package com.baeldung.java9.aot; + +public class JaotCompilation { + + public static void main(String[] argv) { + System.out.println(message()); + } + + public static String message() { + return "The JAOT compiler says 'Hello'"; + } +} \ No newline at end of file From d7b5eaf0f4388ca4ee02fe3cd48a4503cade074c Mon Sep 17 00:00:00 2001 From: eric-martin Date: Fri, 8 Feb 2019 23:41:48 -0600 Subject: [PATCH 124/143] BAEL-2658: Fixed eqaul/equal --- .../test/kotlin/com/baeldung/kotlin/junit5/CalculatorTest5.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/junit5/CalculatorTest5.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/junit5/CalculatorTest5.kt index 1337ff7503..daaedca5a3 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/junit5/CalculatorTest5.kt +++ b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/junit5/CalculatorTest5.kt @@ -7,7 +7,7 @@ class CalculatorTest5 { private val calculator = Calculator() @Test - fun `Adding 1 and 3 should be eqaul to 4`() { + fun `Adding 1 and 3 should be equal to 4`() { Assertions.assertEquals(4, calculator.add(1, 3)) } @@ -21,7 +21,7 @@ class CalculatorTest5 { } @Test - fun `The square of a number should be eqaul to that number multiplied in itself`() { + fun `The square of a number should be equal to that number multiplied in itself`() { Assertions.assertAll( Executable { Assertions.assertEquals(1, calculator.square(1)) }, Executable { Assertions.assertEquals(4, calculator.square(2)) }, From fddca1955d230fa3a9f99d3e9765bc914a31a046 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 9 Feb 2019 13:03:12 +0200 Subject: [PATCH 125/143] Update pom.xml --- jee-7/pom.xml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/jee-7/pom.xml b/jee-7/pom.xml index 70ca50e200..62ccb9d313 100644 --- a/jee-7/pom.xml +++ b/jee-7/pom.xml @@ -133,12 +133,12 @@ org.jberet jberet-core - ${jberet-core.version} + ${jberet.version} org.jberet jberet-support - ${jberet-support.version} + ${jberet.version} org.jboss.spec.javax.transaction @@ -153,17 +153,17 @@ org.jboss.weld weld-core - ${weld-core.version} + ${weld.version} org.jboss.weld.se weld-se - ${weld-se.version} + ${weld.version} org.jberet jberet-se - ${jberet-se.version} + ${jberet.version} com.h2database @@ -534,15 +534,12 @@ 2.2 20160715 1.0.0.Final - 1.0.2.Final - 1.0.2.Final + 1.0.2.Final 1.0.0.Final 1.4.2.Final - 2.1.1.Final - 2.1.1.Final - 1.0.2.Final + 2.1.1.Final 1.4.178 2.22.1 - \ No newline at end of file + From 0fff3a4f88f8d22fb93ab76674e825e2ff89e5f5 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 9 Feb 2019 13:10:58 +0200 Subject: [PATCH 126/143] Update pom.xml --- rsocket/pom.xml | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/rsocket/pom.xml b/rsocket/pom.xml index c00791bfd8..d2182719c2 100644 --- a/rsocket/pom.xml +++ b/rsocket/pom.xml @@ -16,12 +16,12 @@ io.rsocket rsocket-core - ${rsocket-core.version} + ${rsocket.version} io.rsocket rsocket-transport-netty - ${rsocket-transport-netty} + ${rsocket.version} junit @@ -32,18 +32,18 @@ org.hamcrest hamcrest-core - ${hamcrest-core.version} + ${hamcrest.version} test ch.qos.logback logback-classic - ${logback-classic.version} + ${logback.version} ch.qos.logback logback-core - ${logback-core.version} + ${logback.version} org.slf4j @@ -56,11 +56,9 @@ 1.8 1.8 3.0.1 - 0.11.13 - 0.11.13 - 1.3 - 1.2.3 - 1.2.3 + 0.11.13 + 1.3 + 1.2.3 1.7.25 - \ No newline at end of file + From 7c5da0c07c4b8ac053899abf1b00c0c2c557e686 Mon Sep 17 00:00:00 2001 From: KevinGilmore Date: Sat, 9 Feb 2019 11:18:47 -0800 Subject: [PATCH 127/143] Update spring-soap/pom.xml Co-Authored-By: alv21 --- spring-soap/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-soap/pom.xml b/spring-soap/pom.xml index 54a1d86038..68ea7711fc 100644 --- a/spring-soap/pom.xml +++ b/spring-soap/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.springframework + com.baeldung spring-soap 1.0.0 From 97f8a0c46cc472a579228bb3fdb0bfe5fe116388 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 10 Feb 2019 01:47:19 +0530 Subject: [PATCH 128/143] [BAEL-12091] - Fix formatting of POMs --- JGit/pom.xml | 2 +- Twitter4J/pom.xml | 2 +- animal-sniffer-mvn-plugin/pom.xml | 2 +- annotations/pom.xml | 2 +- apache-avro/pom.xml | 17 +- apache-curator/pom.xml | 2 +- apache-solrj/pom.xml | 2 +- apache-spark/pom.xml | 2 +- apache-velocity/pom.xml | 2 +- aws-lambda/pom.xml | 2 +- aws/pom.xml | 2 +- azure/pom.xml | 2 +- bootique/pom.xml | 2 +- cas/cas-secured-app/pom.xml | 2 +- checker-plugin/pom.xml | 2 +- core-java-10/pom.xml | 2 +- core-java-11/pom.xml | 2 +- core-java-8/pom.xml | 2 +- core-java-arrays/pom.xml | 2 +- core-java-collections-list/pom.xml | 2 +- core-java-collections/pom.xml | 2 +- core-java-concurrency-advanced/pom.xml | 2 +- core-java-concurrency-basic/pom.xml | 2 +- core-java-concurrency-collections/pom.xml | 2 +- core-java-io/pom.xml | 2 +- core-java-lang-oop/pom.xml | 2 +- core-java-lang-syntax/pom.xml | 2 +- core-java-lang/pom.xml | 2 +- core-java-networking/pom.xml | 2 +- core-java-perf/pom.xml | 2 +- core-java-security/pom.xml | 2 +- core-java-sun/pom.xml | 2 +- couchbase/pom.xml | 2 +- custom-pmd/pom.xml | 2 +- ddd/pom.xml | 24 +-- deeplearning4j/pom.xml | 2 +- disruptor/pom.xml | 2 +- geotools/pom.xml | 2 +- google-cloud/pom.xml | 2 +- google-web-toolkit/pom.xml | 2 +- grpc/pom.xml | 2 +- guice/pom.xml | 2 +- java-collections-conversions/pom.xml | 2 +- java-collections-maps/pom.xml | 2 +- java-dates/pom.xml | 2 +- java-numbers/pom.xml | 3 +- java-streams/pom.xml | 2 +- jee-7-security/pom.xml | 2 +- jgroups/pom.xml | 2 +- .../jhipster-microservice/car-app/pom.xml | 168 ++++++++--------- .../jhipster-microservice/dealer-app/pom.xml | 165 +++++++++-------- .../jhipster-microservice/gateway-app/pom.xml | 173 +++++++++--------- jhipster/jhipster-uaa/gateway/pom.xml | 165 +++++++++-------- jhipster/jhipster-uaa/pom.xml | 2 +- jhipster/jhipster-uaa/quotes/pom.xml | 161 ++++++++-------- jhipster/jhipster-uaa/uaa/pom.xml | 162 ++++++++-------- jhipster/pom.xml | 2 +- jjwt/pom.xml | 2 +- jmeter/pom.xml | 2 +- jmh/pom.xml | 2 +- libraries-server/pom.xml | 5 +- logging-modules/logback/pom.xml | 2 +- .../resources/archetype-resources/pom.xml | 1 - .../maven-polyglot-json-extension/pom.xml | 10 +- maven/versions-maven-plugin/original/pom.xml | 8 +- micronaut/pom.xml | 12 +- mustache/pom.xml | 2 +- osgi/osgi-intro-sample-activator/pom.xml | 2 +- parent-java/pom.xml | 2 +- parent-kotlin/pom.xml | 2 +- parent-spring-4/pom.xml | 2 +- parent-spring-5/pom.xml | 2 +- patterns/principles/solid/pom.xml | 3 - persistence-modules/activejdbc/pom.xml | 2 +- persistence-modules/apache-cayenne/pom.xml | 3 +- .../core-java-persistence/pom.xml | 9 +- persistence-modules/deltaspike/pom.xml | 2 +- persistence-modules/flyway/pom.xml | 2 +- persistence-modules/influxdb/pom.xml | 2 +- .../jnosql/jnosql-artemis/pom.xml | 59 +++--- .../jnosql/jnosql-diana/pom.xml | 78 ++++---- persistence-modules/jnosql/pom.xml | 11 +- persistence-modules/querydsl/pom.xml | 2 +- persistence-modules/solr/pom.xml | 2 +- .../spring-boot-h2-database/pom.xml | 19 +- .../spring-boot-persistence-mongodb/pom.xml | 9 +- .../spring-data-cassandra-reactive/pom.xml | 17 +- .../spring-data-cassandra/pom.xml | 2 +- .../spring-data-elasticsearch/pom.xml | 2 +- persistence-modules/spring-data-solr/pom.xml | 2 +- persistence-modules/spring-jpa/pom.xml | 2 +- ratpack/pom.xml | 2 +- resteasy/bin/pom.xml | 13 +- resteasy/pom.xml | 2 +- restx/pom.xml | 2 +- rxjava-2/pom.xml | 1 - saas/pom.xml | 2 +- .../sql-injection-samples/pom.xml | 21 +-- spring-4/pom.xml | 2 +- spring-5-mvc/pom.xml | 2 +- spring-5-reactive-client/pom.xml | 2 +- spring-5-reactive-oauth/pom.xml | 2 +- spring-5-reactive-security/pom.xml | 2 +- spring-5-reactive/pom.xml | 3 +- spring-5-security-oauth/pom.xml | 2 +- spring-5-security/pom.xml | 2 +- spring-5/pom.xml | 2 +- spring-activiti/pom.xml | 2 +- spring-amqp/pom.xml | 2 +- spring-aop/pom.xml | 2 +- spring-apache-camel/pom.xml | 2 +- spring-batch/pom.xml | 2 +- .../spring-boot-admin-client/pom.xml | 2 +- .../spring-boot-admin-server/pom.xml | 2 +- spring-boot-angular-ecommerce/pom.xml | 2 +- spring-boot-autoconfiguration/pom.xml | 2 +- spring-boot-bootstrap/pom.xml | 14 +- spring-boot-client/pom.xml | 2 +- spring-boot-jasypt/pom.xml | 3 +- spring-boot-keycloak/pom.xml | 2 +- spring-boot-libraries/pom.xml | 2 +- spring-boot-logging-log4j2/pom.xml | 2 +- spring-boot-mvc/pom.xml | 2 +- spring-boot-ops/pom.xml | 3 +- spring-boot-security/pom.xml | 2 +- spring-boot-testing/pom.xml | 2 +- spring-boot-vue/pom.xml | 15 +- spring-boot/pom.xml | 2 +- spring-cloud-bus/pom.xml | 2 +- .../spring-cloud-config-client/pom.xml | 3 +- .../spring-cloud-config-server/pom.xml | 3 +- spring-cloud-data-flow/batch-job/pom.xml | 2 +- .../data-flow-server/pom.xml | 3 +- .../data-flow-shell/pom.xml | 3 +- .../etl/customer-mongodb-sink/pom.xml | 4 +- .../etl/customer-transform/pom.xml | 4 +- spring-cloud-data-flow/etl/pom.xml | 2 +- spring-cloud-data-flow/log-sink/pom.xml | 3 +- spring-cloud-data-flow/pom.xml | 2 +- spring-cloud-data-flow/time-processor/pom.xml | 3 +- spring-cloud-data-flow/time-source/pom.xml | 1 - spring-cloud/pom.xml | 2 +- .../additional-sources-simple/pom.xml | 2 +- .../basic-config/pom.xml | 2 +- .../extra-configs/pom.xml | 2 +- spring-cloud/spring-cloud-aws/pom.xml | 2 +- spring-cloud/spring-cloud-consul/pom.xml | 2 +- spring-cloud/spring-cloud-contract/pom.xml | 2 +- .../spring-cloud-contract-consumer/pom.xml | 16 +- .../spring-cloud-contract-producer/pom.xml | 17 +- spring-cloud/spring-cloud-eureka/pom.xml | 2 +- .../spring-cloud-eureka-client/pom.xml | 2 +- .../spring-cloud-eureka-feign-client/pom.xml | 2 +- .../spring-cloud-eureka-server/pom.xml | 2 +- spring-cloud/spring-cloud-functions/pom.xml | 2 +- .../feign-rest-consumer/pom.xml | 2 +- spring-cloud/spring-cloud-hystrix/pom.xml | 2 +- .../rest-consumer/pom.xml | 3 +- .../rest-producer/pom.xml | 4 +- .../liveness-example/pom.xml | 20 +- spring-cloud/spring-cloud-kubernetes/pom.xml | 16 +- .../readiness-example/pom.xml | 20 +- spring-cloud/spring-cloud-rest/pom.xml | 2 +- .../spring-cloud-rest-books-api/pom.xml | 2 +- .../spring-cloud-rest-config-server/pom.xml | 2 +- .../pom.xml | 2 +- .../spring-cloud-rest-reviews-api/pom.xml | 2 +- .../spring-cloud-ribbon-client/pom.xml | 2 +- .../spring-cloud-security/auth-client/pom.xml | 2 +- .../auth-resource/pom.xml | 4 +- spring-cloud/spring-cloud-security/pom.xml | 2 +- .../twitterhdfs/pom.xml | 2 +- spring-cloud/spring-cloud-stream/pom.xml | 2 +- .../spring-cloud-stream-rabbit/pom.xml | 2 +- spring-cloud/spring-cloud-task/pom.xml | 2 +- .../springcloudtasksink/pom.xml | 2 +- spring-cloud/spring-cloud-vault/pom.xml | 4 +- .../spring-cloud-zookeeper/Greeting/pom.xml | 2 +- spring-cloud/spring-cloud-zookeeper/pom.xml | 2 +- .../bin/eureka-client/pom.xml | 3 +- .../bin/eureka-server/pom.xml | 5 +- .../bin/pom.xml | 17 +- .../bin/zuul-server/pom.xml | 5 +- .../eureka-client/pom.xml | 2 +- .../eureka-server/pom.xml | 2 +- .../pom.xml | 2 +- spring-cloud/spring-cloud-zuul/pom.xml | 19 +- spring-core/pom.xml | 2 +- spring-cucumber/pom.xml | 2 +- spring-data-rest/pom.xml | 2 +- spring-dispatcher-servlet/pom.xml | 2 +- spring-ejb/pom.xml | 2 +- spring-ejb/spring-ejb-client/pom.xml | 4 +- spring-ejb/spring-ejb-remote/pom.xml | 2 +- spring-ejb/wildfly/pom.xml | 2 +- spring-ejb/wildfly/widlfly-web/pom.xml | 2 +- spring-ejb/wildfly/wildfly-ear/pom.xml | 2 +- spring-ejb/wildfly/wildfly-ejb/pom.xml | 2 +- spring-freemarker/pom.xml | 2 +- spring-groovy/pom.xml | 3 +- spring-integration/pom.xml | 2 +- spring-jenkins-pipeline/pom.xml | 2 +- spring-jersey/pom.xml | 2 +- spring-jms/pom.xml | 2 +- spring-katharsis/pom.xml | 2 +- spring-mobile/pom.xml | 1 - spring-mockito/pom.xml | 3 +- spring-mvc-forms-thymeleaf/pom.xml | 3 +- spring-mvc-java/pom.xml | 2 +- spring-mvc-kotlin/pom.xml | 1 - spring-mvc-simple/pom.xml | 10 +- spring-mvc-velocity/pom.xml | 3 +- spring-mvc-xml/pom.xml | 1 - spring-quartz/pom.xml | 3 +- spring-reactive-kotlin/pom.xml | 2 +- spring-reactor/pom.xml | 2 +- spring-remoting/pom.xml | 2 +- spring-remoting/remoting-amqp/pom.xml | 1 - .../remoting-amqp-client/pom.xml | 3 +- .../remoting-amqp-server/pom.xml | 3 +- .../remoting-hessian-burlap/pom.xml | 2 +- spring-remoting/remoting-http/pom.xml | 3 +- .../remoting-jms/remoting-jms-client/pom.xml | 8 +- .../remoting-jms/remoting-jms-server/pom.xml | 8 +- spring-remoting/remoting-rmi/pom.xml | 2 +- .../remoting-rmi/remoting-rmi-server/pom.xml | 8 +- spring-rest-hal-browser/pom.xml | 27 ++- spring-rest-shell/pom.xml | 2 +- spring-security-acl/pom.xml | 3 +- spring-security-angular/server/pom.xml | 2 +- .../pom.xml | 2 +- .../spring-security-jsp-authorize/pom.xml | 3 +- .../spring-security-jsp-config/pom.xml | 2 +- .../spring-security-mvc/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../spring-security-thymeleaf-config/pom.xml | 3 +- spring-security-mvc-boot/pom.xml | 3 +- spring-security-mvc-login/pom.xml | 1 - .../pom.xml | 1 - spring-security-mvc-session/pom.xml | 1 - spring-security-openid/pom.xml | 3 +- spring-security-react/pom.xml | 1 - spring-security-rest-custom/pom.xml | 1 - spring-security-sso/pom.xml | 1 - .../spring-security-sso-auth-server/pom.xml | 3 - .../spring-security-sso-ui-2/pom.xml | 1 - .../spring-security-sso-ui/pom.xml | 1 - spring-security-stormpath/pom.xml | 3 +- spring-security-thymeleaf/pom.xml | 3 +- spring-security-x509/pom.xml | 2 +- .../spring-security-x509-basic-auth/pom.xml | 2 +- .../spring-security-x509-client-auth/pom.xml | 2 +- spring-session/pom.xml | 1 - spring-session/spring-session-jdbc/pom.xml | 2 +- spring-sleuth/pom.xml | 2 +- spring-social-login/pom.xml | 1 - spring-static-resources/pom.xml | 2 +- .../spring-swagger-codegen-api-client/pom.xml | 5 +- spring-thymeleaf/pom.xml | 2 +- spring-vault/pom.xml | 3 +- spring-vertx/pom.xml | 2 +- spring-webflux-amqp/pom.xml | 3 +- spring-zuul/pom.xml | 1 - spring-zuul/spring-zuul-foos-resource/pom.xml | 1 - spring-zuul/spring-zuul-ui/pom.xml | 1 - stripe/pom.xml | 3 +- struts-2/pom.xml | 2 +- testing-modules/groovy-spock/pom.xml | 2 +- testing-modules/junit5-migration/pom.xml | 2 - .../load-testing-comparison/pom.xml | 27 +-- testing-modules/mockito-2/pom.xml | 2 +- testing-modules/mocks/pom.xml | 7 +- .../math-test-functions/pom.xml | 16 +- testing-modules/parallel-tests-junit/pom.xml | 23 +-- .../string-test-functions/pom.xml | 15 +- testing-modules/rest-testing/pom.xml | 1 - testing-modules/testng/pom.xml | 2 +- undertow/pom.xml | 3 +- vaadin/pom.xml | 3 +- vertx/pom.xml | 1 - video-tutorials/pom.xml | 3 +- vraptor/pom.xml | 2 +- wicket/pom.xml | 3 +- xstream/pom.xml | 1 - 285 files changed, 1024 insertions(+), 1110 deletions(-) diff --git a/JGit/pom.xml b/JGit/pom.xml index 176d55d321..deae1e45e3 100644 --- a/JGit/pom.xml +++ b/JGit/pom.xml @@ -5,9 +5,9 @@ com.baeldung JGit 1.0-SNAPSHOT + JGit jar http://maven.apache.org - JGit com.baeldung diff --git a/Twitter4J/pom.xml b/Twitter4J/pom.xml index 982c1adc23..b82b9f6778 100644 --- a/Twitter4J/pom.xml +++ b/Twitter4J/pom.xml @@ -2,8 +2,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 Twitter4J - jar Twitter4J + jar com.baeldung diff --git a/animal-sniffer-mvn-plugin/pom.xml b/animal-sniffer-mvn-plugin/pom.xml index cdfb1fb2a3..55e37e2ec4 100644 --- a/animal-sniffer-mvn-plugin/pom.xml +++ b/animal-sniffer-mvn-plugin/pom.xml @@ -3,9 +3,9 @@ 4.0.0 com.baeldung animal-sniffer-mvn-plugin - jar 1.0-SNAPSHOT animal-sniffer-mvn-plugin + jar http://maven.apache.org diff --git a/annotations/pom.xml b/annotations/pom.xml index 6d83f5b057..5fe89adf0a 100644 --- a/annotations/pom.xml +++ b/annotations/pom.xml @@ -3,8 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 annotations - pom annotations + pom parent-modules diff --git a/apache-avro/pom.xml b/apache-avro/pom.xml index 18f9c34d64..b98e52be75 100644 --- a/apache-avro/pom.xml +++ b/apache-avro/pom.xml @@ -7,14 +7,6 @@ 0.0.1-SNAPSHOT apache-avro - - UTF-8 - 3.5 - 1.8.2 - 1.8 - 1.7.25 - - com.baeldung parent-modules @@ -85,4 +77,13 @@ + + + UTF-8 + 3.5 + 1.8.2 + 1.8 + 1.7.25 + + diff --git a/apache-curator/pom.xml b/apache-curator/pom.xml index e6be32277d..3306c0613f 100644 --- a/apache-curator/pom.xml +++ b/apache-curator/pom.xml @@ -3,8 +3,8 @@ 4.0.0 apache-curator 0.0.1-SNAPSHOT - jar apache-curator + jar com.baeldung diff --git a/apache-solrj/pom.xml b/apache-solrj/pom.xml index 9a807c2f26..1227fdca46 100644 --- a/apache-solrj/pom.xml +++ b/apache-solrj/pom.xml @@ -4,8 +4,8 @@ com.baeldung apache-solrj 0.0.1-SNAPSHOT - jar apache-solrj + jar com.baeldung diff --git a/apache-spark/pom.xml b/apache-spark/pom.xml index d5ea105b91..1aed5b1db9 100644 --- a/apache-spark/pom.xml +++ b/apache-spark/pom.xml @@ -4,8 +4,8 @@ com.baeldung apache-spark 1.0-SNAPSHOT - jar apache-spark + jar http://maven.apache.org diff --git a/apache-velocity/pom.xml b/apache-velocity/pom.xml index 19cf77d945..a0a8389f7d 100644 --- a/apache-velocity/pom.xml +++ b/apache-velocity/pom.xml @@ -4,8 +4,8 @@ com.baeldung 0.1-SNAPSHOT apache-velocity - war apache-velocity + war com.baeldung diff --git a/aws-lambda/pom.xml b/aws-lambda/pom.xml index c47c3cd86f..c799718e61 100644 --- a/aws-lambda/pom.xml +++ b/aws-lambda/pom.xml @@ -5,8 +5,8 @@ com.baeldung aws-lambda 0.1.0-SNAPSHOT - jar aws-lambda + jar parent-modules diff --git a/aws/pom.xml b/aws/pom.xml index ab63f6afa1..560f9145f9 100644 --- a/aws/pom.xml +++ b/aws/pom.xml @@ -4,8 +4,8 @@ com.baeldung aws 0.1.0-SNAPSHOT - jar aws + jar com.baeldung diff --git a/azure/pom.xml b/azure/pom.xml index 555efeef70..e2a05796d6 100644 --- a/azure/pom.xml +++ b/azure/pom.xml @@ -5,9 +5,9 @@ com.baeldung azure 0.1 - war azure Demo project for Spring Boot on Azure + war parent-boot-2 diff --git a/bootique/pom.xml b/bootique/pom.xml index 880b9a516f..4ae8703074 100644 --- a/bootique/pom.xml +++ b/bootique/pom.xml @@ -3,9 +3,9 @@ 4.0.0 com.baeldung.bootique bootique - jar 1.0-SNAPSHOT bootique + jar http://maven.apache.org diff --git a/cas/cas-secured-app/pom.xml b/cas/cas-secured-app/pom.xml index 2291da9084..338a9e5653 100644 --- a/cas/cas-secured-app/pom.xml +++ b/cas/cas-secured-app/pom.xml @@ -3,9 +3,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 cas-secured-app - jar cas-secured-app Demo project for CAS + jar parent-boot-1 diff --git a/checker-plugin/pom.xml b/checker-plugin/pom.xml index 45f0939e77..08408366a4 100644 --- a/checker-plugin/pom.xml +++ b/checker-plugin/pom.xml @@ -3,9 +3,9 @@ 4.0.0 com.baeldung checker-plugin - jar 1.0-SNAPSHOT checker-plugin + jar http://maven.apache.org diff --git a/core-java-10/pom.xml b/core-java-10/pom.xml index 9fcdd9a162..b15f8b5d63 100644 --- a/core-java-10/pom.xml +++ b/core-java-10/pom.xml @@ -3,9 +3,9 @@ 4.0.0 com.baeldung core-java-10 - jar 0.1.0-SNAPSHOT core-java-10 + jar http://maven.apache.org diff --git a/core-java-11/pom.xml b/core-java-11/pom.xml index 4dcab49867..a9776d8f3b 100644 --- a/core-java-11/pom.xml +++ b/core-java-11/pom.xml @@ -3,9 +3,9 @@ 4.0.0 com.baeldung core-java-11 - jar 0.1.0-SNAPSHOT core-java-11 + jar http://maven.apache.org diff --git a/core-java-8/pom.xml b/core-java-8/pom.xml index 112e8b764d..b4519a8161 100644 --- a/core-java-8/pom.xml +++ b/core-java-8/pom.xml @@ -4,8 +4,8 @@ com.baeldung core-java-8 0.1.0-SNAPSHOT - jar core-java-8 + jar com.baeldung diff --git a/core-java-arrays/pom.xml b/core-java-arrays/pom.xml index d2d0453e87..39ac764b27 100644 --- a/core-java-arrays/pom.xml +++ b/core-java-arrays/pom.xml @@ -4,8 +4,8 @@ com.baeldung core-java-arrays 0.1.0-SNAPSHOT - jar core-java-arrays + jar com.baeldung diff --git a/core-java-collections-list/pom.xml b/core-java-collections-list/pom.xml index 2b1aee6e47..737be8ee34 100644 --- a/core-java-collections-list/pom.xml +++ b/core-java-collections-list/pom.xml @@ -3,8 +3,8 @@ 4.0.0 core-java-collections-list 0.1.0-SNAPSHOT - jar core-java-collections-list + jar com.baeldung diff --git a/core-java-collections/pom.xml b/core-java-collections/pom.xml index 38d2f9aee3..261558836d 100644 --- a/core-java-collections/pom.xml +++ b/core-java-collections/pom.xml @@ -3,8 +3,8 @@ 4.0.0 core-java-collections 0.1.0-SNAPSHOT - jar core-java-collections + jar com.baeldung diff --git a/core-java-concurrency-advanced/pom.xml b/core-java-concurrency-advanced/pom.xml index 1209cba619..23032fb2e1 100644 --- a/core-java-concurrency-advanced/pom.xml +++ b/core-java-concurrency-advanced/pom.xml @@ -4,8 +4,8 @@ com.baeldung core-java-concurrency-advanced 0.1.0-SNAPSHOT - jar core-java-concurrency-advanced + jar com.baeldung diff --git a/core-java-concurrency-basic/pom.xml b/core-java-concurrency-basic/pom.xml index 3544403aca..35c360769b 100644 --- a/core-java-concurrency-basic/pom.xml +++ b/core-java-concurrency-basic/pom.xml @@ -4,8 +4,8 @@ com.baeldung core-java-concurrency-basic 0.1.0-SNAPSHOT - jar core-java-concurrency-basic + jar com.baeldung diff --git a/core-java-concurrency-collections/pom.xml b/core-java-concurrency-collections/pom.xml index 9473de8c51..e192bbe46f 100644 --- a/core-java-concurrency-collections/pom.xml +++ b/core-java-concurrency-collections/pom.xml @@ -4,8 +4,8 @@ com.baeldung core-java-concurrency-collections 0.1.0-SNAPSHOT - jar core-java-concurrency-collections + jar com.baeldung diff --git a/core-java-io/pom.xml b/core-java-io/pom.xml index 1f2d52de81..350e1a8b96 100644 --- a/core-java-io/pom.xml +++ b/core-java-io/pom.xml @@ -3,8 +3,8 @@ 4.0.0 core-java-io 0.1.0-SNAPSHOT - jar core-java-io + jar com.baeldung diff --git a/core-java-lang-oop/pom.xml b/core-java-lang-oop/pom.xml index 262408c024..8cfaf2b544 100644 --- a/core-java-lang-oop/pom.xml +++ b/core-java-lang-oop/pom.xml @@ -4,8 +4,8 @@ com.baeldung core-java-lang-oop 0.1.0-SNAPSHOT - jar core-java-lang-oop + jar com.baeldung diff --git a/core-java-lang-syntax/pom.xml b/core-java-lang-syntax/pom.xml index 9481f29459..9a9df01057 100644 --- a/core-java-lang-syntax/pom.xml +++ b/core-java-lang-syntax/pom.xml @@ -4,8 +4,8 @@ com.baeldung core-java-lang-syntax 0.1.0-SNAPSHOT - jar core-java-lang-syntax + jar com.baeldung diff --git a/core-java-lang/pom.xml b/core-java-lang/pom.xml index 283acab775..6881fd56db 100644 --- a/core-java-lang/pom.xml +++ b/core-java-lang/pom.xml @@ -4,8 +4,8 @@ com.baeldung core-java-lang 0.1.0-SNAPSHOT - jar core-java-lang + jar com.baeldung diff --git a/core-java-networking/pom.xml b/core-java-networking/pom.xml index d9c7c691e9..12bb257fcb 100644 --- a/core-java-networking/pom.xml +++ b/core-java-networking/pom.xml @@ -3,8 +3,8 @@ 4.0.0 core-java-networking 0.1.0-SNAPSHOT - jar core-java-networking + jar com.baeldung diff --git a/core-java-perf/pom.xml b/core-java-perf/pom.xml index 062f76db77..0e0ec79691 100644 --- a/core-java-perf/pom.xml +++ b/core-java-perf/pom.xml @@ -4,8 +4,8 @@ com.baeldung core-java-perf 0.1.0-SNAPSHOT - jar core-java-perf + jar com.baeldung diff --git a/core-java-security/pom.xml b/core-java-security/pom.xml index 7c4ab9763f..63bc46b114 100644 --- a/core-java-security/pom.xml +++ b/core-java-security/pom.xml @@ -4,8 +4,8 @@ com.baeldung core-java-security 0.1.0-SNAPSHOT - jar core-java-security + jar com.baeldung diff --git a/core-java-sun/pom.xml b/core-java-sun/pom.xml index ef68c947ce..6099e7a5ac 100644 --- a/core-java-sun/pom.xml +++ b/core-java-sun/pom.xml @@ -4,8 +4,8 @@ com.baeldung core-java-sun 0.1.0-SNAPSHOT - jar core-java-sun + jar com.baeldung diff --git a/couchbase/pom.xml b/couchbase/pom.xml index 7da027597e..994b80e7cd 100644 --- a/couchbase/pom.xml +++ b/couchbase/pom.xml @@ -5,9 +5,9 @@ com.baeldung couchbase 0.1-SNAPSHOT - jar couchbase Couchbase Tutorials + jar com.baeldung diff --git a/custom-pmd/pom.xml b/custom-pmd/pom.xml index 0f73282ae3..74e6d9593b 100644 --- a/custom-pmd/pom.xml +++ b/custom-pmd/pom.xml @@ -4,8 +4,8 @@ org.baeldung.pmd custom-pmd 0.0.1 - jar custom-pmd + jar http://maven.apache.org diff --git a/ddd/pom.xml b/ddd/pom.xml index a61ae24e92..749e444e52 100644 --- a/ddd/pom.xml +++ b/ddd/pom.xml @@ -1,6 +1,12 @@ 4.0.0 + com.baeldung.ddd + ddd + 0.0.1-SNAPSHOT + ddd + jar + DDD series examples org.springframework.boot @@ -9,18 +15,6 @@ - com.baeldung.ddd - ddd - 0.0.1-SNAPSHOT - jar - ddd - DDD series examples - - - 1.0.1 - 2.22.0 - - org.springframework.boot @@ -88,4 +82,10 @@ test + + + 1.0.1 + 2.22.0 + + \ No newline at end of file diff --git a/deeplearning4j/pom.xml b/deeplearning4j/pom.xml index 38be189bd0..181dbc871c 100644 --- a/deeplearning4j/pom.xml +++ b/deeplearning4j/pom.xml @@ -3,9 +3,9 @@ 4.0.0 com.baeldung.deeplearning4j deeplearning4j - jar 1.0-SNAPSHOT deeplearning4j + jar com.baeldung diff --git a/disruptor/pom.xml b/disruptor/pom.xml index c26dcc0cd4..296704f546 100644 --- a/disruptor/pom.xml +++ b/disruptor/pom.xml @@ -4,8 +4,8 @@ com.baeldung disruptor 0.1.0-SNAPSHOT - jar disruptor + jar com.baeldung diff --git a/geotools/pom.xml b/geotools/pom.xml index 3ac8a63564..f2a9a77d2a 100644 --- a/geotools/pom.xml +++ b/geotools/pom.xml @@ -4,8 +4,8 @@ 4.0.0 geotools 0.0.1-SNAPSHOT - jar geotools + jar http://maven.apache.org diff --git a/google-cloud/pom.xml b/google-cloud/pom.xml index 85f47cc2f5..e39e186f05 100644 --- a/google-cloud/pom.xml +++ b/google-cloud/pom.xml @@ -4,9 +4,9 @@ 4.0.0 google-cloud 0.1-SNAPSHOT - jar google-cloud Google Cloud Tutorials + jar com.baeldung diff --git a/google-web-toolkit/pom.xml b/google-web-toolkit/pom.xml index 214f2d1fd8..f4c6a0ab39 100644 --- a/google-web-toolkit/pom.xml +++ b/google-web-toolkit/pom.xml @@ -7,9 +7,9 @@ 4.0.0 com.baeldung google-web-toolkit - war 1.0-SNAPSHOT google-web-toolkit + war com.baeldung diff --git a/grpc/pom.xml b/grpc/pom.xml index 725bec3e70..ab550c31d7 100644 --- a/grpc/pom.xml +++ b/grpc/pom.xml @@ -3,8 +3,8 @@ 4.0.0 grpc 0.0.1-SNAPSHOT - jar grpc + jar com.baeldung diff --git a/guice/pom.xml b/guice/pom.xml index 5c4518da7a..8ed2b557dc 100644 --- a/guice/pom.xml +++ b/guice/pom.xml @@ -5,8 +5,8 @@ com.baeldung.examples.guice guice 1.0-SNAPSHOT - jar guice + jar com.baeldung diff --git a/java-collections-conversions/pom.xml b/java-collections-conversions/pom.xml index 9b54652001..ee7221b25e 100644 --- a/java-collections-conversions/pom.xml +++ b/java-collections-conversions/pom.xml @@ -3,8 +3,8 @@ 4.0.0 java-collections-conversions 0.1.0-SNAPSHOT - jar java-collections-conversions + jar com.baeldung diff --git a/java-collections-maps/pom.xml b/java-collections-maps/pom.xml index 71bfa4f8be..b5eba31437 100644 --- a/java-collections-maps/pom.xml +++ b/java-collections-maps/pom.xml @@ -3,8 +3,8 @@ 4.0.0 java-collections-maps 0.1.0-SNAPSHOT - jar java-collections-maps + jar com.baeldung diff --git a/java-dates/pom.xml b/java-dates/pom.xml index 2618fad1d4..8dd5ad675e 100644 --- a/java-dates/pom.xml +++ b/java-dates/pom.xml @@ -4,8 +4,8 @@ com.baeldung java-dates 0.1.0-SNAPSHOT - jar java-dates + jar com.baeldung diff --git a/java-numbers/pom.xml b/java-numbers/pom.xml index 0f5140ea5e..eb75f85bf0 100644 --- a/java-numbers/pom.xml +++ b/java-numbers/pom.xml @@ -4,8 +4,8 @@ 4.0.0 java-numbers 0.1.0-SNAPSHOT - jar java-numbers + jar com.baeldung @@ -13,6 +13,7 @@ 0.0.1-SNAPSHOT ../parent-java + log4j diff --git a/java-streams/pom.xml b/java-streams/pom.xml index 793fc46676..0de1a424d6 100644 --- a/java-streams/pom.xml +++ b/java-streams/pom.xml @@ -3,8 +3,8 @@ 4.0.0 java-streams 0.1.0-SNAPSHOT - jar java-streams + jar com.baeldung diff --git a/jee-7-security/pom.xml b/jee-7-security/pom.xml index f7d96f1165..5b7bb07239 100644 --- a/jee-7-security/pom.xml +++ b/jee-7-security/pom.xml @@ -4,8 +4,8 @@ 4.0.0 jee-7-security 1.0-SNAPSHOT - war jee-7-security + war JavaEE 7 Spring Security Application diff --git a/jgroups/pom.xml b/jgroups/pom.xml index 34bdd59919..e95fe2be3c 100644 --- a/jgroups/pom.xml +++ b/jgroups/pom.xml @@ -4,9 +4,9 @@ 4.0.0 jgroups 0.1-SNAPSHOT - jar jgroups Reliable Messaging with JGroups Tutorial + jar com.baeldung diff --git a/jhipster/jhipster-microservice/car-app/pom.xml b/jhipster/jhipster-microservice/car-app/pom.xml index b05979b9c5..529877d448 100644 --- a/jhipster/jhipster-microservice/car-app/pom.xml +++ b/jhipster/jhipster-microservice/car-app/pom.xml @@ -1,6 +1,10 @@ 4.0.0 + com.car.app + car-app + car-app + war jhipster-microservice @@ -8,94 +12,10 @@ 1.0.0-SNAPSHOT - com.car.app - car-app - war - car-app - ${maven.version} - - -Djava.security.egd=file:/dev/./urandom -Xmx256m - 3.6.2 - 2.0.0 - 2.5 - 3.5 - 0.4.13 - 1.2 - 5.2.8.Final - 2.6.0 - 0.7.9 - 1.8 - 3.21.0-GA - 1.0.0 - 1.1.0 - 0.7.0 - 3.6 - 2.0.0 - 3.6.2 - 4.8 - jdt_apt - 1.1.0.Final - 2.10 - 1.4.1 - 3.0.1 - yyyyMMddHHmmss - 3.0.0 - 3.1.3 - v6.10.0 - - - - - ${project.build.directory}/test-results - 0.0.20 - false - 3.2.2 - 2.12.1 - 3.2 - - src/main/webapp/content/**/*.*, src/main/webapp/bower_components/**/*.*, src/main/webapp/i18n/*.js, target/www/**/*.* - - S3437,UndocumentedApi,BoldAndItalicTagsCheck - - - src/main/webapp/app/**/*.* - Web:BoldAndItalicTagsCheck - - src/main/java/**/* - squid:S3437 - - src/main/java/**/* - squid:UndocumentedApi - - ${project.testresult.directory}/coverage/jacoco/jacoco-it.exec - ${project.testresult.directory}/coverage/jacoco/jacoco.exec - jacoco - - ${project.testresult.directory}/karma - - ${project.testresult.directory}/coverage/report-lcov/lcov.info - - ${project.testresult.directory}/coverage/report-lcov/lcov.info - - ${project.basedir}/src/main/ - ${project.testresult.directory}/surefire-reports - ${project.basedir}/src/test/ - - 2.5.0 - - Camden.SR5 - 2.6.1 - 1.4.10.Final - 1.1.0.Final - v0.21.3 - - @@ -898,4 +818,84 @@ + + + -Djava.security.egd=file:/dev/./urandom -Xmx256m + 3.6.2 + 2.0.0 + 2.5 + 3.5 + 0.4.13 + 1.2 + 5.2.8.Final + 2.6.0 + 0.7.9 + 1.8 + 3.21.0-GA + 1.0.0 + 1.1.0 + 0.7.0 + 3.6 + 2.0.0 + 3.6.2 + 4.8 + jdt_apt + 1.1.0.Final + 2.10 + 1.4.1 + 3.0.1 + yyyyMMddHHmmss + 3.0.0 + 3.1.3 + v6.10.0 + + + + + ${project.build.directory}/test-results + 0.0.20 + false + 3.2.2 + 2.12.1 + 3.2 + + src/main/webapp/content/**/*.*, src/main/webapp/bower_components/**/*.*, src/main/webapp/i18n/*.js, target/www/**/*.* + + S3437,UndocumentedApi,BoldAndItalicTagsCheck + + + src/main/webapp/app/**/*.* + Web:BoldAndItalicTagsCheck + + src/main/java/**/* + squid:S3437 + + src/main/java/**/* + squid:UndocumentedApi + + ${project.testresult.directory}/coverage/jacoco/jacoco-it.exec + ${project.testresult.directory}/coverage/jacoco/jacoco.exec + jacoco + + ${project.testresult.directory}/karma + + ${project.testresult.directory}/coverage/report-lcov/lcov.info + + ${project.testresult.directory}/coverage/report-lcov/lcov.info + + ${project.basedir}/src/main/ + ${project.testresult.directory}/surefire-reports + ${project.basedir}/src/test/ + + 2.5.0 + + Camden.SR5 + 2.6.1 + 1.4.10.Final + 1.1.0.Final + v0.21.3 + + diff --git a/jhipster/jhipster-microservice/dealer-app/pom.xml b/jhipster/jhipster-microservice/dealer-app/pom.xml index 803a0f62e6..1eac8a930e 100644 --- a/jhipster/jhipster-microservice/dealer-app/pom.xml +++ b/jhipster/jhipster-microservice/dealer-app/pom.xml @@ -1,6 +1,10 @@ 4.0.0 + com.dealer.app + dealer-app + dealer-app + war jhipster-microservice @@ -8,93 +12,10 @@ 1.0.0-SNAPSHOT - com.dealer.app - dealer-app - war - dealer-app - ${maven.version} - - -Djava.security.egd=file:/dev/./urandom -Xmx256m - 3.6.2 - 2.0.0 - 2.5 - 3.5 - 0.4.13 - 1.2 - 5.2.8.Final - 2.6.0 - 0.7.9 - 3.21.0-GA - 1.0.0 - 1.1.0 - 0.7.0 - 3.6 - 2.0.0 - 3.6.2 - 4.8 - jdt_apt - 1.1.0.Final - 2.10 - 1.4.1 - 3.0.1 - yyyyMMddHHmmss - 3.0.0 - 3.1.3 - v6.10.0 - - - - - ${project.build.directory}/test-results - 0.0.20 - false - 3.2.2 - 2.12.1 - 3.2 - - src/main/webapp/content/**/*.*, src/main/webapp/bower_components/**/*.*, src/main/webapp/i18n/*.js, target/www/**/*.* - - S3437,UndocumentedApi,BoldAndItalicTagsCheck - - - src/main/webapp/app/**/*.* - Web:BoldAndItalicTagsCheck - - src/main/java/**/* - squid:S3437 - - src/main/java/**/* - squid:UndocumentedApi - - ${project.testresult.directory}/coverage/jacoco/jacoco-it.exec - ${project.testresult.directory}/coverage/jacoco/jacoco.exec - jacoco - - ${project.testresult.directory}/karma - - ${project.testresult.directory}/coverage/report-lcov/lcov.info - - ${project.testresult.directory}/coverage/report-lcov/lcov.info - - ${project.basedir}/src/main/ - ${project.testresult.directory}/surefire-reports - ${project.basedir}/src/test/ - - 2.5.0 - - Camden.SR5 - 2.6.1 - 1.4.10.Final - 1.1.0.Final - v0.21.3 - - @@ -892,5 +813,83 @@ + + + -Djava.security.egd=file:/dev/./urandom -Xmx256m + 3.6.2 + 2.0.0 + 2.5 + 3.5 + 0.4.13 + 1.2 + 5.2.8.Final + 2.6.0 + 0.7.9 + 3.21.0-GA + 1.0.0 + 1.1.0 + 0.7.0 + 3.6 + 2.0.0 + 3.6.2 + 4.8 + jdt_apt + 1.1.0.Final + 2.10 + 1.4.1 + 3.0.1 + yyyyMMddHHmmss + 3.0.0 + 3.1.3 + v6.10.0 + + + + + ${project.build.directory}/test-results + 0.0.20 + false + 3.2.2 + 2.12.1 + 3.2 + src/main/webapp/content/**/*.*, src/main/webapp/bower_components/**/*.*, src/main/webapp/i18n/*.js, target/www/**/*.* + + S3437,UndocumentedApi,BoldAndItalicTagsCheck + + + src/main/webapp/app/**/*.* + Web:BoldAndItalicTagsCheck + + src/main/java/**/* + squid:S3437 + + src/main/java/**/* + squid:UndocumentedApi + + ${project.testresult.directory}/coverage/jacoco/jacoco-it.exec + ${project.testresult.directory}/coverage/jacoco/jacoco.exec + jacoco + + ${project.testresult.directory}/karma + + ${project.testresult.directory}/coverage/report-lcov/lcov.info + + ${project.testresult.directory}/coverage/report-lcov/lcov.info + + ${project.basedir}/src/main/ + ${project.testresult.directory}/surefire-reports + ${project.basedir}/src/test/ + + 2.5.0 + + Camden.SR5 + 2.6.1 + 1.4.10.Final + 1.1.0.Final + v0.21.3 + + diff --git a/jhipster/jhipster-microservice/gateway-app/pom.xml b/jhipster/jhipster-microservice/gateway-app/pom.xml index ed0c929027..babc9e4f24 100644 --- a/jhipster/jhipster-microservice/gateway-app/pom.xml +++ b/jhipster/jhipster-microservice/gateway-app/pom.xml @@ -1,6 +1,10 @@ 4.0.0 + com.gateway + gateway-app + gateway-app + war jhipster-microservice @@ -8,97 +12,10 @@ 1.0.0-SNAPSHOT - com.gateway - gateway-app - war - gateway-app - ${maven.version} - - -Djava.security.egd=file:/dev/./urandom -Xmx256m - 3.6.2 - 2.0.0 - 3.6.0 - 1.10 - 2.5 - 3.5 - 0.4.13 - 1.3 - 1.2 - 5.2.8.Final - 2.6.0 - 0.7.9 - 3.21.0-GA - 1.0.0 - 1.1.0 - 0.7.0 - 3.6 - 2.0.0 - 3.6.2 - 4.8 - 1.3.0 - jdt_apt - 1.1.0.Final - 2.10 - 1.4.1 - 3.0.1 - yyyyMMddHHmmss - 3.0.0 - 3.1.3 - v6.10.0 - - - - - ${project.build.directory}/test-results - 0.0.20 - false - 3.2.2 - 2.12.1 - 3.2 - - src/main/webapp/content/**/*.*, src/main/webapp/bower_components/**/*.*, src/main/webapp/i18n/*.js, target/www/**/*.* - - S3437,UndocumentedApi,BoldAndItalicTagsCheck - - - src/main/webapp/app/**/*.* - Web:BoldAndItalicTagsCheck - - src/main/java/**/* - squid:S3437 - - src/main/java/**/* - squid:UndocumentedApi - - ${project.testresult.directory}/coverage/jacoco/jacoco-it.exec - ${project.testresult.directory}/coverage/jacoco/jacoco.exec - jacoco - - ${project.testresult.directory}/karma - - ${project.testresult.directory}/coverage/report-lcov/lcov.info - - ${project.testresult.directory}/coverage/report-lcov/lcov.info - - ${project.basedir}/src/main/ - ${project.testresult.directory}/surefire-reports - ${project.basedir}/src/test/ - - 2.5.0 - - Camden.SR5 - 2.6.1 - 1.4.10.Final - 1.1.0.Final - v0.21.3 - - @@ -1008,5 +925,87 @@ + + + -Djava.security.egd=file:/dev/./urandom -Xmx256m + 3.6.2 + 2.0.0 + 3.6.0 + 1.10 + 2.5 + 3.5 + 0.4.13 + 1.3 + 1.2 + 5.2.8.Final + 2.6.0 + 0.7.9 + 3.21.0-GA + 1.0.0 + 1.1.0 + 0.7.0 + 3.6 + 2.0.0 + 3.6.2 + 4.8 + 1.3.0 + jdt_apt + 1.1.0.Final + 2.10 + 1.4.1 + 3.0.1 + yyyyMMddHHmmss + 3.0.0 + 3.1.3 + v6.10.0 + + + + + ${project.build.directory}/test-results + 0.0.20 + false + 3.2.2 + 2.12.1 + 3.2 + + src/main/webapp/content/**/*.*, src/main/webapp/bower_components/**/*.*, src/main/webapp/i18n/*.js, target/www/**/*.* + + S3437,UndocumentedApi,BoldAndItalicTagsCheck + + + src/main/webapp/app/**/*.* + Web:BoldAndItalicTagsCheck + + src/main/java/**/* + squid:S3437 + + src/main/java/**/* + squid:UndocumentedApi + + ${project.testresult.directory}/coverage/jacoco/jacoco-it.exec + ${project.testresult.directory}/coverage/jacoco/jacoco.exec + jacoco + + ${project.testresult.directory}/karma + + ${project.testresult.directory}/coverage/report-lcov/lcov.info + + ${project.testresult.directory}/coverage/report-lcov/lcov.info + + ${project.basedir}/src/main/ + ${project.testresult.directory}/surefire-reports + ${project.basedir}/src/test/ + + 2.5.0 + + Camden.SR5 + 2.6.1 + 1.4.10.Final + 1.1.0.Final + v0.21.3 + diff --git a/jhipster/jhipster-uaa/gateway/pom.xml b/jhipster/jhipster-uaa/gateway/pom.xml index 52f84e4006..0f815bedad 100644 --- a/jhipster/jhipster-uaa/gateway/pom.xml +++ b/jhipster/jhipster-uaa/gateway/pom.xml @@ -1,12 +1,11 @@ 4.0.0 - com.baeldung.jhipster.gateway gateway 0.0.1-SNAPSHOT - war Gateway + war @@ -14,87 +13,6 @@ - - - 3.0.0 - 1.8 - 2.12.6 - v8.12.0 - 6.4.1 - UTF-8 - UTF-8 - ${project.build.directory}/test-results - yyyyMMddHHmmss - ${java.version} - ${java.version} - -Djava.security.egd=file:/dev/./urandom -Xmx256m - jdt_apt - false - - - - - - - 2.0.25 - - 2.0.5.RELEASE - - 5.2.17.Final - - 3.22.0-GA - - 3.5.5 - 3.6 - 2.0.1.Final - 1.2.0.Final - - - 3.1.0 - 3.8.0 - 2.10 - 3.0.0-M2 - 3.1.0 - 2.22.0 - 3.2.2 - 0.9.11 - 1.6 - 0.8.2 - 3.4.2 - 3.5.0.1254 - 2.2.5 - - - http://localhost:9001 - src/main/webapp/content/**/*.*, src/main/webapp/i18n/*.js, target/www/**/*.* - S3437,S4684,UndocumentedApi,BoldAndItalicTagsCheck - - src/main/webapp/app/**/*.* - Web:BoldAndItalicTagsCheck - - src/main/java/**/* - squid:S3437 - - src/main/java/**/* - squid:UndocumentedApi - - src/main/java/**/* - squid:S4684 - ${project.testresult.directory}/coverage/jacoco/jacoco.exec - jacoco - ${project.testresult.directory}/jest/TESTS-results-sonar.xml - ${project.testresult.directory}/lcov.info - ${project.basedir}/src/main/ - ${project.testresult.directory}/surefire-reports - ${project.basedir}/src/test/ - - - - @@ -1092,4 +1010,85 @@ + + + + 3.0.0 + 1.8 + 2.12.6 + v8.12.0 + 6.4.1 + UTF-8 + UTF-8 + ${project.build.directory}/test-results + yyyyMMddHHmmss + ${java.version} + ${java.version} + -Djava.security.egd=file:/dev/./urandom -Xmx256m + jdt_apt + false + + + + + + + 2.0.25 + + 2.0.5.RELEASE + + 5.2.17.Final + + 3.22.0-GA + + 3.5.5 + 3.6 + 2.0.1.Final + 1.2.0.Final + + + 3.1.0 + 3.8.0 + 2.10 + 3.0.0-M2 + 3.1.0 + 2.22.0 + 3.2.2 + 0.9.11 + 1.6 + 0.8.2 + 3.4.2 + 3.5.0.1254 + 2.2.5 + + + http://localhost:9001 + src/main/webapp/content/**/*.*, src/main/webapp/i18n/*.js, target/www/**/*.* + S3437,S4684,UndocumentedApi,BoldAndItalicTagsCheck + + src/main/webapp/app/**/*.* + Web:BoldAndItalicTagsCheck + + src/main/java/**/* + squid:S3437 + + src/main/java/**/* + squid:UndocumentedApi + + src/main/java/**/* + squid:S4684 + ${project.testresult.directory}/coverage/jacoco/jacoco.exec + jacoco + ${project.testresult.directory}/jest/TESTS-results-sonar.xml + ${project.testresult.directory}/lcov.info + ${project.basedir}/src/main/ + ${project.testresult.directory}/surefire-reports + ${project.basedir}/src/test/ + + + diff --git a/jhipster/jhipster-uaa/pom.xml b/jhipster/jhipster-uaa/pom.xml index e8ccaabfb0..88df59b735 100644 --- a/jhipster/jhipster-uaa/pom.xml +++ b/jhipster/jhipster-uaa/pom.xml @@ -4,8 +4,8 @@ 4.0.0 com.baeldung.jhipster jhipster-microservice-uaa - pom JHipster Microservice with UAA + pom jhipster diff --git a/jhipster/jhipster-uaa/quotes/pom.xml b/jhipster/jhipster-uaa/quotes/pom.xml index 9984f009ff..81ab23471f 100644 --- a/jhipster/jhipster-uaa/quotes/pom.xml +++ b/jhipster/jhipster-uaa/quotes/pom.xml @@ -1,12 +1,11 @@ 4.0.0 - com.baeldung.jhipster.quotes quotes 0.0.1-SNAPSHOT - war Quotes + war @@ -14,85 +13,6 @@ - - - 3.0.0 - 1.8 - 2.12.6 - v8.12.0 - 6.4.1 - UTF-8 - UTF-8 - ${project.build.directory}/test-results - yyyyMMddHHmmss - ${java.version} - ${java.version} - -Djava.security.egd=file:/dev/./urandom -Xmx256m - jdt_apt - false - - - - - - - 2.0.25 - - 2.0.5.RELEASE - - 5.2.17.Final - - 3.22.0-GA - - 3.5.5 - 3.6 - 2.0.1.Final - 1.2.0.Final - - - 3.1.0 - 3.8.0 - 2.10 - 3.0.0-M2 - 3.1.0 - 2.22.0 - 3.2.2 - 0.9.11 - 0.8.2 - 3.4.2 - 3.5.0.1254 - 2.2.5 - - - http://localhost:9001 - src/main/webapp/content/**/*.*, src/main/webapp/i18n/*.js, target/www/**/*.* - S3437,S4684,UndocumentedApi,BoldAndItalicTagsCheck - - src/main/webapp/app/**/*.* - Web:BoldAndItalicTagsCheck - - src/main/java/**/* - squid:S3437 - - src/main/java/**/* - squid:UndocumentedApi - - src/main/java/**/* - squid:S4684 - ${project.testresult.directory}/coverage/jacoco/jacoco.exec - jacoco - ${project.testresult.directory}/lcov.info - ${project.basedir}/src/main/ - ${project.testresult.directory}/surefire-reports - ${project.basedir}/src/test/ - - - - @@ -912,4 +832,83 @@ + + + + 3.0.0 + 1.8 + 2.12.6 + v8.12.0 + 6.4.1 + UTF-8 + UTF-8 + ${project.build.directory}/test-results + yyyyMMddHHmmss + ${java.version} + ${java.version} + -Djava.security.egd=file:/dev/./urandom -Xmx256m + jdt_apt + false + + + + + + + 2.0.25 + + 2.0.5.RELEASE + + 5.2.17.Final + + 3.22.0-GA + + 3.5.5 + 3.6 + 2.0.1.Final + 1.2.0.Final + + + 3.1.0 + 3.8.0 + 2.10 + 3.0.0-M2 + 3.1.0 + 2.22.0 + 3.2.2 + 0.9.11 + 0.8.2 + 3.4.2 + 3.5.0.1254 + 2.2.5 + + + http://localhost:9001 + src/main/webapp/content/**/*.*, src/main/webapp/i18n/*.js, target/www/**/*.* + S3437,S4684,UndocumentedApi,BoldAndItalicTagsCheck + + src/main/webapp/app/**/*.* + Web:BoldAndItalicTagsCheck + + src/main/java/**/* + squid:S3437 + + src/main/java/**/* + squid:UndocumentedApi + + src/main/java/**/* + squid:S4684 + ${project.testresult.directory}/coverage/jacoco/jacoco.exec + jacoco + ${project.testresult.directory}/lcov.info + ${project.basedir}/src/main/ + ${project.testresult.directory}/surefire-reports + ${project.basedir}/src/test/ + + + diff --git a/jhipster/jhipster-uaa/uaa/pom.xml b/jhipster/jhipster-uaa/uaa/pom.xml index 9c4783747a..2c4dd9d0f0 100644 --- a/jhipster/jhipster-uaa/uaa/pom.xml +++ b/jhipster/jhipster-uaa/uaa/pom.xml @@ -1,12 +1,11 @@ 4.0.0 - com.baeldung.jhipster.uaa uaa 0.0.1-SNAPSHOT - war Uaa + war @@ -14,85 +13,6 @@ - - - 3.0.0 - 1.8 - 2.12.6 - v8.12.0 - 6.4.1 - UTF-8 - UTF-8 - ${project.build.directory}/test-results - yyyyMMddHHmmss - ${java.version} - ${java.version} - -Djava.security.egd=file:/dev/./urandom -Xmx256m - jdt_apt - false - - - - - - - 2.0.25 - - 2.0.5.RELEASE - - 5.2.17.Final - - 3.22.0-GA - - 3.5.5 - 3.6 - 2.0.1.Final - 1.2.0.Final - - - 3.1.0 - 3.8.0 - 2.10 - 3.0.0-M2 - 3.1.0 - 2.22.0 - 3.2.2 - 0.9.11 - 0.8.2 - 3.4.2 - 3.5.0.1254 - 2.2.5 - - - http://localhost:9001 - src/main/webapp/content/**/*.*, src/main/webapp/i18n/*.js, target/www/**/*.* - S3437,S4684,UndocumentedApi,BoldAndItalicTagsCheck - - src/main/webapp/app/**/*.* - Web:BoldAndItalicTagsCheck - - src/main/java/**/* - squid:S3437 - - src/main/java/**/* - squid:UndocumentedApi - - src/main/java/**/* - squid:S4684 - ${project.testresult.directory}/coverage/jacoco/jacoco.exec - jacoco - ${project.testresult.directory}/lcov.info - ${project.basedir}/src/main/ - ${project.testresult.directory}/surefire-reports - ${project.basedir}/src/test/ - - - - @@ -912,4 +832,84 @@ + + + + 3.0.0 + 1.8 + 2.12.6 + v8.12.0 + 6.4.1 + UTF-8 + UTF-8 + ${project.build.directory}/test-results + yyyyMMddHHmmss + ${java.version} + ${java.version} + -Djava.security.egd=file:/dev/./urandom -Xmx256m + jdt_apt + false + + + + + + + 2.0.25 + + 2.0.5.RELEASE + + 5.2.17.Final + + 3.22.0-GA + + 3.5.5 + 3.6 + 2.0.1.Final + 1.2.0.Final + + + 3.1.0 + 3.8.0 + 2.10 + 3.0.0-M2 + 3.1.0 + 2.22.0 + 3.2.2 + 0.9.11 + 0.8.2 + 3.4.2 + 3.5.0.1254 + 2.2.5 + + + http://localhost:9001 + src/main/webapp/content/**/*.*, src/main/webapp/i18n/*.js, target/www/**/*.* + S3437,S4684,UndocumentedApi,BoldAndItalicTagsCheck + + src/main/webapp/app/**/*.* + Web:BoldAndItalicTagsCheck + + src/main/java/**/* + squid:S3437 + + src/main/java/**/* + squid:UndocumentedApi + + src/main/java/**/* + squid:S4684 + ${project.testresult.directory}/coverage/jacoco/jacoco.exec + jacoco + ${project.testresult.directory}/lcov.info + ${project.basedir}/src/main/ + ${project.testresult.directory}/surefire-reports + ${project.basedir}/src/test/ + + + + diff --git a/jhipster/pom.xml b/jhipster/pom.xml index 5132c6dc95..3fcc53b354 100644 --- a/jhipster/pom.xml +++ b/jhipster/pom.xml @@ -5,8 +5,8 @@ com.baeldung.jhipster jhipster 1.0.0-SNAPSHOT - pom JHipster + pom parent-boot-1 diff --git a/jjwt/pom.xml b/jjwt/pom.xml index 6bf9f4426a..2d03543293 100644 --- a/jjwt/pom.xml +++ b/jjwt/pom.xml @@ -5,8 +5,8 @@ io.jsonwebtoken jjwt 0.0.1-SNAPSHOT - jar jjwt + jar Exercising the JJWT diff --git a/jmeter/pom.xml b/jmeter/pom.xml index 943b75e03b..514546987d 100644 --- a/jmeter/pom.xml +++ b/jmeter/pom.xml @@ -4,9 +4,9 @@ 4.0.0 jmeter 0.0.1-SNAPSHOT - jar jmeter Intro to Performance testing using JMeter + jar parent-boot-1 diff --git a/jmh/pom.xml b/jmh/pom.xml index 1e01809fe6..70a0a398d4 100644 --- a/jmh/pom.xml +++ b/jmh/pom.xml @@ -3,9 +3,9 @@ 4.0.0 com.baeldung jmh - jar 1.0-SNAPSHOT jmh + jar http://maven.apache.org diff --git a/libraries-server/pom.xml b/libraries-server/pom.xml index ea556baece..b30b6137a1 100644 --- a/libraries-server/pom.xml +++ b/libraries-server/pom.xml @@ -5,12 +5,13 @@ 0.0.1-SNAPSHOT libraries-server - + com.baeldung parent-modules 1.0.0-SNAPSHOT - + + org.eclipse.paho org.eclipse.paho.client.mqttv3 diff --git a/logging-modules/logback/pom.xml b/logging-modules/logback/pom.xml index ef7adbc3ea..845424af0c 100644 --- a/logging-modules/logback/pom.xml +++ b/logging-modules/logback/pom.xml @@ -4,9 +4,9 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - logback logback 0.1-SNAPSHOT + logback com.baeldung diff --git a/maven-archetype/src/main/resources/archetype-resources/pom.xml b/maven-archetype/src/main/resources/archetype-resources/pom.xml index eb69f64626..a5c813652d 100644 --- a/maven-archetype/src/main/resources/archetype-resources/pom.xml +++ b/maven-archetype/src/main/resources/archetype-resources/pom.xml @@ -1,7 +1,6 @@ 4.0.0 - ${groupId} ${artifactId} ${version} diff --git a/maven-polyglot/maven-polyglot-json-extension/pom.xml b/maven-polyglot/maven-polyglot-json-extension/pom.xml index fe1e025d1f..5b18529ec5 100644 --- a/maven-polyglot/maven-polyglot-json-extension/pom.xml +++ b/maven-polyglot/maven-polyglot-json-extension/pom.xml @@ -7,11 +7,6 @@ maven-polyglot-json-extension 1.0-SNAPSHOT maven-polyglot-json-extension - - - 1.8 - 1.8 - @@ -43,5 +38,10 @@ + + + 1.8 + 1.8 + \ No newline at end of file diff --git a/maven/versions-maven-plugin/original/pom.xml b/maven/versions-maven-plugin/original/pom.xml index 295c77b860..7608e4d168 100644 --- a/maven/versions-maven-plugin/original/pom.xml +++ b/maven/versions-maven-plugin/original/pom.xml @@ -6,10 +6,6 @@ versions-maven-plugin-example 0.0.1-SNAPSHOT - - 1.15 - - @@ -73,4 +69,8 @@ + + 1.15 + + \ No newline at end of file diff --git a/micronaut/pom.xml b/micronaut/pom.xml index aa69c77f73..2a8d135483 100644 --- a/micronaut/pom.xml +++ b/micronaut/pom.xml @@ -4,12 +4,6 @@ micronaut 0.1 micronaut - - - com.baeldung.micronaut.helloworld.server.ServerApplication - 1.0.0.RC2 - 1.8 - @@ -133,4 +127,10 @@ + + + com.baeldung.micronaut.helloworld.server.ServerApplication + 1.0.0.RC2 + 1.8 + diff --git a/mustache/pom.xml b/mustache/pom.xml index 1b89997996..027d62ebc4 100644 --- a/mustache/pom.xml +++ b/mustache/pom.xml @@ -3,8 +3,8 @@ 4.0.0 mustache - jar mustache + jar parent-boot-2 diff --git a/osgi/osgi-intro-sample-activator/pom.xml b/osgi/osgi-intro-sample-activator/pom.xml index 77d7198698..95ac1fc0fb 100644 --- a/osgi/osgi-intro-sample-activator/pom.xml +++ b/osgi/osgi-intro-sample-activator/pom.xml @@ -2,9 +2,9 @@ 4.0.0 + osgi-intro-sample-activator bundle - osgi-intro-sample-activator diff --git a/parent-java/pom.xml b/parent-java/pom.xml index 8f603b2d09..cb3e205871 100644 --- a/parent-java/pom.xml +++ b/parent-java/pom.xml @@ -4,9 +4,9 @@ com.baeldung parent-java 0.0.1-SNAPSHOT - pom parent-java Parent for all java modules + pom com.baeldung diff --git a/parent-kotlin/pom.xml b/parent-kotlin/pom.xml index 73c98e1a80..7a3a8b10ca 100644 --- a/parent-kotlin/pom.xml +++ b/parent-kotlin/pom.xml @@ -3,8 +3,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 parent-kotlin - pom parent-kotlin + pom Parent for all kotlin modules diff --git a/parent-spring-4/pom.xml b/parent-spring-4/pom.xml index 9b3c42599b..6cbcf3000e 100644 --- a/parent-spring-4/pom.xml +++ b/parent-spring-4/pom.xml @@ -4,8 +4,8 @@ com.baeldung parent-spring-4 0.0.1-SNAPSHOT - pom parent-spring-4 + pom Parent for all spring 4 core modules diff --git a/parent-spring-5/pom.xml b/parent-spring-5/pom.xml index 51a2c1fd1f..650305b7e2 100644 --- a/parent-spring-5/pom.xml +++ b/parent-spring-5/pom.xml @@ -4,9 +4,9 @@ com.baeldung parent-spring-5 0.0.1-SNAPSHOT - pom parent-spring-5 Parent for all spring 5 core modules + pom com.baeldung diff --git a/patterns/principles/solid/pom.xml b/patterns/principles/solid/pom.xml index 825c7730a5..5d308f5120 100644 --- a/patterns/principles/solid/pom.xml +++ b/patterns/principles/solid/pom.xml @@ -3,12 +3,10 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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 solid/artifactId> 1.0-SNAPSHOT - @@ -17,7 +15,6 @@ 4.12 test - diff --git a/persistence-modules/activejdbc/pom.xml b/persistence-modules/activejdbc/pom.xml index 6a29f14ced..45a618b840 100644 --- a/persistence-modules/activejdbc/pom.xml +++ b/persistence-modules/activejdbc/pom.xml @@ -3,8 +3,8 @@ 4.0.0 activejdbc 1.0-SNAPSHOT - jar activejdbc + jar http://maven.apache.org diff --git a/persistence-modules/apache-cayenne/pom.xml b/persistence-modules/apache-cayenne/pom.xml index d0c6d1f2b2..776b2b5233 100644 --- a/persistence-modules/apache-cayenne/pom.xml +++ b/persistence-modules/apache-cayenne/pom.xml @@ -2,11 +2,10 @@ 4.0.0 - apache-cayenne 0.0.1-SNAPSHOT - jar apache-cayenne + jar Introduction to Apache Cayenne diff --git a/persistence-modules/core-java-persistence/pom.xml b/persistence-modules/core-java-persistence/pom.xml index f012d60ee6..a777eeb73f 100644 --- a/persistence-modules/core-java-persistence/pom.xml +++ b/persistence-modules/core-java-persistence/pom.xml @@ -4,14 +4,16 @@ com.baeldung.core-java-persistence core-java-persistence 0.1.0-SNAPSHOT - jar core-java-persistence + jar + com.baeldung parent-java 0.0.1-SNAPSHOT ../../parent-java + org.assertj @@ -50,6 +52,7 @@ ${springframework.boot.spring-boot-starter.version} + core-java-persistence @@ -58,7 +61,8 @@ true - + + 3.10.0 1.4.197 @@ -68,4 +72,5 @@ 1.5.8.RELEASE 4.3.4.RELEASE + \ No newline at end of file diff --git a/persistence-modules/deltaspike/pom.xml b/persistence-modules/deltaspike/pom.xml index b798d2f39e..9a4669102a 100644 --- a/persistence-modules/deltaspike/pom.xml +++ b/persistence-modules/deltaspike/pom.xml @@ -5,8 +5,8 @@ com.baeldung deltaspike 1.0 - war deltaspike + war A starter Java EE 7 webapp which uses DeltaSpike http://wildfly.org diff --git a/persistence-modules/flyway/pom.xml b/persistence-modules/flyway/pom.xml index 237b426521..eb827f5675 100644 --- a/persistence-modules/flyway/pom.xml +++ b/persistence-modules/flyway/pom.xml @@ -3,8 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 flyway - jar flyway + jar Flyway Callbacks Demo diff --git a/persistence-modules/influxdb/pom.xml b/persistence-modules/influxdb/pom.xml index 5043d61897..8e1aeebe6d 100644 --- a/persistence-modules/influxdb/pom.xml +++ b/persistence-modules/influxdb/pom.xml @@ -4,8 +4,8 @@ 4.0.0 influxdb 0.1-SNAPSHOT - jar influxdb + jar InfluxDB SDK Tutorial diff --git a/persistence-modules/jnosql/jnosql-artemis/pom.xml b/persistence-modules/jnosql/jnosql-artemis/pom.xml index 8a978fb179..a07f26c6ee 100644 --- a/persistence-modules/jnosql/jnosql-artemis/pom.xml +++ b/persistence-modules/jnosql/jnosql-artemis/pom.xml @@ -12,11 +12,30 @@ jnosql 1.0-SNAPSHOT - - - 2.4.2 - false - + + + + javax + javaee-web-api + 8.0 + provided + + + org.jnosql.artemis + artemis-configuration + ${jnosql.version} + + + org.jnosql.artemis + artemis-document + ${jnosql.version} + + + org.jnosql.diana + mongodb-driver + ${jnosql.version} + + ${project.artifactId} @@ -58,31 +77,9 @@ - - - - javax - javaee-web-api - 8.0 - provided - - - - org.jnosql.artemis - artemis-configuration - ${jnosql.version} - - - org.jnosql.artemis - artemis-document - ${jnosql.version} - - - org.jnosql.diana - mongodb-driver - ${jnosql.version} - - - + + 2.4.2 + false + diff --git a/persistence-modules/jnosql/jnosql-diana/pom.xml b/persistence-modules/jnosql/jnosql-diana/pom.xml index 126f0314d9..b52c808cf5 100644 --- a/persistence-modules/jnosql/jnosql-diana/pom.xml +++ b/persistence-modules/jnosql/jnosql-diana/pom.xml @@ -12,45 +12,6 @@ 1.0-SNAPSHOT - - - - org.codehaus.mojo - exec-maven-plugin - 1.6.0 - - - document - - java - - - com.baeldung.jnosql.diana.document.DocumentApp - - - - column - - java - - - com.baeldung.jnosql.diana.column.ColumnFamilyApp - - - - key - - java - - - com.baeldung.jnosql.diana.key.KeyValueApp - - - - - - - @@ -90,4 +51,43 @@ + + + + org.codehaus.mojo + exec-maven-plugin + 1.6.0 + + + document + + java + + + com.baeldung.jnosql.diana.document.DocumentApp + + + + column + + java + + + com.baeldung.jnosql.diana.column.ColumnFamilyApp + + + + key + + java + + + com.baeldung.jnosql.diana.key.KeyValueApp + + + + + + + \ No newline at end of file diff --git a/persistence-modules/jnosql/pom.xml b/persistence-modules/jnosql/pom.xml index 5fb29a3b9c..513a447b91 100644 --- a/persistence-modules/jnosql/pom.xml +++ b/persistence-modules/jnosql/pom.xml @@ -9,15 +9,14 @@ jnosql pom - - 1.8 - 1.8 - 0.0.5 - - jnosql-diana jnosql-artemis + + 1.8 + 1.8 + 0.0.5 + diff --git a/persistence-modules/querydsl/pom.xml b/persistence-modules/querydsl/pom.xml index d3bf1b1fb7..4d4347e909 100644 --- a/persistence-modules/querydsl/pom.xml +++ b/persistence-modules/querydsl/pom.xml @@ -5,8 +5,8 @@ com.baeldung querydsl 0.1-SNAPSHOT - jar querydsl + jar http://maven.apache.org diff --git a/persistence-modules/solr/pom.xml b/persistence-modules/solr/pom.xml index 49f2f85856..1c14c06315 100644 --- a/persistence-modules/solr/pom.xml +++ b/persistence-modules/solr/pom.xml @@ -4,8 +4,8 @@ com.baeldung solr 0.0.1-SNAPSHOT - jar solr + jar com.baeldung diff --git a/persistence-modules/spring-boot-h2/spring-boot-h2-database/pom.xml b/persistence-modules/spring-boot-h2/spring-boot-h2-database/pom.xml index 6ebc75de8d..a181360e2b 100644 --- a/persistence-modules/spring-boot-h2/spring-boot-h2-database/pom.xml +++ b/persistence-modules/spring-boot-h2/spring-boot-h2-database/pom.xml @@ -8,7 +8,6 @@ 0.0.1-SNAPSHOT spring-boot-h2-database jar - Demo Spring Boot applications that starts H2 in memory database @@ -18,20 +17,11 @@ - - UTF-8 - UTF-8 - 1.8 - - com.baeldung.h2db.demo.server.SpringBootApp - - org.springframework.boot spring-boot-starter-data-jpa - com.h2database h2 @@ -51,4 +41,13 @@ + + + UTF-8 + UTF-8 + 1.8 + + com.baeldung.h2db.demo.server.SpringBootApp + + diff --git a/persistence-modules/spring-boot-persistence-mongodb/pom.xml b/persistence-modules/spring-boot-persistence-mongodb/pom.xml index fc267eedf6..86b93c7826 100644 --- a/persistence-modules/spring-boot-persistence-mongodb/pom.xml +++ b/persistence-modules/spring-boot-persistence-mongodb/pom.xml @@ -3,6 +3,10 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + spring-boot-persistence-mongodb + spring-boot-persistence-mongodb + war + This is simple boot application for Spring boot persistence mongodb test parent-boot-2 @@ -11,11 +15,6 @@ ../../parent-boot-2 - spring-boot-persistence-mongodb - war - spring-boot-persistence-mongodb - This is simple boot application for Spring boot persistence mongodb test - org.springframework.boot diff --git a/persistence-modules/spring-data-cassandra-reactive/pom.xml b/persistence-modules/spring-data-cassandra-reactive/pom.xml index 5303f9a53a..d2bc574ee9 100644 --- a/persistence-modules/spring-data-cassandra-reactive/pom.xml +++ b/persistence-modules/spring-data-cassandra-reactive/pom.xml @@ -3,13 +3,11 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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-data-cassandra-reactive 0.0.1-SNAPSHOT - jar - spring-data-cassandra-reactive + jar Spring Data Cassandra reactive @@ -19,13 +17,6 @@ ../../parent-boot-2 - - UTF-8 - UTF-8 - - 1.8 - - org.springframework.data @@ -57,5 +48,11 @@ + + UTF-8 + UTF-8 + + 1.8 + diff --git a/persistence-modules/spring-data-cassandra/pom.xml b/persistence-modules/spring-data-cassandra/pom.xml index 11953a734b..4f323a72d8 100644 --- a/persistence-modules/spring-data-cassandra/pom.xml +++ b/persistence-modules/spring-data-cassandra/pom.xml @@ -4,8 +4,8 @@ com.baeldung spring-data-cassandra 0.0.1-SNAPSHOT - jar spring-data-cassandra + jar com.baeldung diff --git a/persistence-modules/spring-data-elasticsearch/pom.xml b/persistence-modules/spring-data-elasticsearch/pom.xml index ee9e71a1cb..9495d56798 100644 --- a/persistence-modules/spring-data-elasticsearch/pom.xml +++ b/persistence-modules/spring-data-elasticsearch/pom.xml @@ -4,8 +4,8 @@ com.baeldung spring-data-elasticsearch 0.0.1-SNAPSHOT - jar spring-data-elasticsearch + jar com.baeldung diff --git a/persistence-modules/spring-data-solr/pom.xml b/persistence-modules/spring-data-solr/pom.xml index dcba80b49a..82539b0ca8 100644 --- a/persistence-modules/spring-data-solr/pom.xml +++ b/persistence-modules/spring-data-solr/pom.xml @@ -4,8 +4,8 @@ com.baeldung spring-data-solr 0.0.1-SNAPSHOT - jar spring-data-solr + jar com.baeldung diff --git a/persistence-modules/spring-jpa/pom.xml b/persistence-modules/spring-jpa/pom.xml index 400811b582..29a6996791 100644 --- a/persistence-modules/spring-jpa/pom.xml +++ b/persistence-modules/spring-jpa/pom.xml @@ -3,8 +3,8 @@ 4.0.0 spring-jpa 0.1-SNAPSHOT - war spring-jpa + war com.baeldung diff --git a/ratpack/pom.xml b/ratpack/pom.xml index 7de11e6955..a4389275b6 100644 --- a/ratpack/pom.xml +++ b/ratpack/pom.xml @@ -3,9 +3,9 @@ 4.0.0 com.baeldung ratpack - jar 1.0-SNAPSHOT ratpack + jar http://maven.apache.org diff --git a/resteasy/bin/pom.xml b/resteasy/bin/pom.xml index f8cdc20360..15d8b5bd18 100644 --- a/resteasy/bin/pom.xml +++ b/resteasy/bin/pom.xml @@ -2,18 +2,11 @@ 4.0.0 - com.baeldung resteasy-tutorial 1.0 war - - 3.0.19.Final - 2.5 - 1.6.1 - - com.baeldung resteasy-tutorial @@ -80,4 +73,10 @@ ${commons-io.version} + + + 3.0.19.Final + 2.5 + 1.6.1 + \ No newline at end of file diff --git a/resteasy/pom.xml b/resteasy/pom.xml index 31a6ed485a..ca4124abca 100644 --- a/resteasy/pom.xml +++ b/resteasy/pom.xml @@ -5,8 +5,8 @@ com.baeldung resteasy 1.0 - war resteasy + war com.baeldung diff --git a/restx/pom.xml b/restx/pom.xml index f33d490096..cc503f89b6 100644 --- a/restx/pom.xml +++ b/restx/pom.xml @@ -5,8 +5,8 @@ 4.0.0 restx 0.1-SNAPSHOT - war restx-demo + war com.baeldung diff --git a/rxjava-2/pom.xml b/rxjava-2/pom.xml index 3038c20037..2519516f45 100644 --- a/rxjava-2/pom.xml +++ b/rxjava-2/pom.xml @@ -3,7 +3,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - rxjava-2 1.0-SNAPSHOT diff --git a/saas/pom.xml b/saas/pom.xml index 2abc932497..35de34ea72 100644 --- a/saas/pom.xml +++ b/saas/pom.xml @@ -4,8 +4,8 @@ com.baeldung saas 0.1.0-SNAPSHOT - jar saas + jar com.baeldung diff --git a/software-security/sql-injection-samples/pom.xml b/software-security/sql-injection-samples/pom.xml index d5e64db6b3..e1590662b7 100644 --- a/software-security/sql-injection-samples/pom.xml +++ b/software-security/sql-injection-samples/pom.xml @@ -2,23 +2,18 @@ 4.0.0 - - - parent-boot-2 - com.baeldung - 0.0.1-SNAPSHOT - ../../parent-boot-2 - - com.baeldung sql-injection-samples 0.0.1-SNAPSHOT sql-injection-samples Sample SQL Injection tests - - 1.8 - + + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../../parent-boot-2 + @@ -58,4 +53,8 @@ + + 1.8 + + diff --git a/spring-4/pom.xml b/spring-4/pom.xml index 60f1555d8f..eb64c1839f 100644 --- a/spring-4/pom.xml +++ b/spring-4/pom.xml @@ -3,8 +3,8 @@ 4.0.0 spring-4 spring-4 - jar spring-4 + jar parent-boot-1 diff --git a/spring-5-mvc/pom.xml b/spring-5-mvc/pom.xml index f5346a0fa0..5fb8f66f71 100644 --- a/spring-5-mvc/pom.xml +++ b/spring-5-mvc/pom.xml @@ -5,9 +5,9 @@ com.baeldung spring-5-mvc 0.0.1-SNAPSHOT - jar spring-5-mvc spring 5 MVC sample project about new features + jar com.baeldung diff --git a/spring-5-reactive-client/pom.xml b/spring-5-reactive-client/pom.xml index bcf04046a7..1b71815eb4 100644 --- a/spring-5-reactive-client/pom.xml +++ b/spring-5-reactive-client/pom.xml @@ -3,8 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-5-reactive-client - jar spring-5-reactive-client + jar spring 5 sample project about new features diff --git a/spring-5-reactive-oauth/pom.xml b/spring-5-reactive-oauth/pom.xml index 48db8a65d6..86a5233ad4 100644 --- a/spring-5-reactive-oauth/pom.xml +++ b/spring-5-reactive-oauth/pom.xml @@ -5,8 +5,8 @@ com.baeldung.reactive.oauth spring-5-reactive-oauth 1.0.0-SNAPSHOT - jar spring-5-reactive-oauth + jar WebFluc and Spring Security OAuth diff --git a/spring-5-reactive-security/pom.xml b/spring-5-reactive-security/pom.xml index 0ff1dc0076..72a73a86ce 100644 --- a/spring-5-reactive-security/pom.xml +++ b/spring-5-reactive-security/pom.xml @@ -5,8 +5,8 @@ com.baeldung spring-5-reactive-security 0.0.1-SNAPSHOT - jar spring-5-reactive-security + jar spring 5 security sample project about new features diff --git a/spring-5-reactive/pom.xml b/spring-5-reactive/pom.xml index 63cc185afe..a1eb6f4c8a 100644 --- a/spring-5-reactive/pom.xml +++ b/spring-5-reactive/pom.xml @@ -2,12 +2,11 @@ 4.0.0 - com.baeldung spring-5-reactive 0.0.1-SNAPSHOT - jar spring-5-reactive + jar spring 5 sample project about new features diff --git a/spring-5-security-oauth/pom.xml b/spring-5-security-oauth/pom.xml index 59150a153f..d9a1e3094e 100644 --- a/spring-5-security-oauth/pom.xml +++ b/spring-5-security-oauth/pom.xml @@ -4,8 +4,8 @@ com.baeldung spring-5-security-oauth 0.0.1-SNAPSHOT - jar spring-5-security-oauth + jar spring 5 security oauth sample project diff --git a/spring-5-security/pom.xml b/spring-5-security/pom.xml index ae9e1fb0c5..413337633f 100644 --- a/spring-5-security/pom.xml +++ b/spring-5-security/pom.xml @@ -4,8 +4,8 @@ com.baeldung spring-5-security 0.0.1-SNAPSHOT - jar spring-5-security + jar spring 5 security sample project diff --git a/spring-5/pom.xml b/spring-5/pom.xml index 58c14475e0..dcb50a4617 100644 --- a/spring-5/pom.xml +++ b/spring-5/pom.xml @@ -6,8 +6,8 @@ com.baeldung spring-5 0.0.1-SNAPSHOT - jar spring-5 + jar spring 5 sample project about new features diff --git a/spring-activiti/pom.xml b/spring-activiti/pom.xml index 4e21c5b032..3d67a2ab7b 100644 --- a/spring-activiti/pom.xml +++ b/spring-activiti/pom.xml @@ -3,8 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-activiti - jar spring-activiti + jar Demo project for Spring Boot diff --git a/spring-amqp/pom.xml b/spring-amqp/pom.xml index e08a4243b3..c021bd49ff 100755 --- a/spring-amqp/pom.xml +++ b/spring-amqp/pom.xml @@ -4,8 +4,8 @@ com.baeldung spring-amqp 0.1-SNAPSHOT - jar spring-amqp + jar Introduction to Spring-AMQP diff --git a/spring-aop/pom.xml b/spring-aop/pom.xml index 9e2f97916a..a1e2ffd534 100644 --- a/spring-aop/pom.xml +++ b/spring-aop/pom.xml @@ -2,8 +2,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-aop - war spring-aop + war parent-boot-2 diff --git a/spring-apache-camel/pom.xml b/spring-apache-camel/pom.xml index 662b3f899c..3e76c0c7f1 100644 --- a/spring-apache-camel/pom.xml +++ b/spring-apache-camel/pom.xml @@ -3,9 +3,9 @@ 4.0.0 org.apache.camel spring-apache-camel - jar 1.0-SNAPSHOT spring-apache-camel + jar http://maven.apache.org diff --git a/spring-batch/pom.xml b/spring-batch/pom.xml index cfd725b2bd..e81078568b 100644 --- a/spring-batch/pom.xml +++ b/spring-batch/pom.xml @@ -4,8 +4,8 @@ com.baeldung spring-batch 0.1-SNAPSHOT - jar spring-batch + jar http://maven.apache.org diff --git a/spring-boot-admin/spring-boot-admin-client/pom.xml b/spring-boot-admin/spring-boot-admin-client/pom.xml index ea03d6ef6d..7563a01172 100644 --- a/spring-boot-admin/spring-boot-admin-client/pom.xml +++ b/spring-boot-admin/spring-boot-admin-client/pom.xml @@ -4,9 +4,9 @@ 4.0.0 spring-boot-admin-client 0.0.1-SNAPSHOT - jar spring-boot-admin-client Spring Boot Admin Client + jar spring-boot-admin diff --git a/spring-boot-admin/spring-boot-admin-server/pom.xml b/spring-boot-admin/spring-boot-admin-server/pom.xml index d8e7bb5574..d429d9289f 100644 --- a/spring-boot-admin/spring-boot-admin-server/pom.xml +++ b/spring-boot-admin/spring-boot-admin-server/pom.xml @@ -4,9 +4,9 @@ 4.0.0 spring-boot-admin-server 0.0.1-SNAPSHOT - jar spring-boot-admin-server Spring Boot Admin Server + jar spring-boot-admin diff --git a/spring-boot-angular-ecommerce/pom.xml b/spring-boot-angular-ecommerce/pom.xml index 8e476b9d5b..a5296eade8 100644 --- a/spring-boot-angular-ecommerce/pom.xml +++ b/spring-boot-angular-ecommerce/pom.xml @@ -4,8 +4,8 @@ 4.0.0 spring-boot-angular-ecommerce 0.0.1-SNAPSHOT - jar spring-boot-angular-ecommerce + jar Spring Boot Angular E-commerce Appliciation diff --git a/spring-boot-autoconfiguration/pom.xml b/spring-boot-autoconfiguration/pom.xml index 1c3d8796ed..91692ebfff 100644 --- a/spring-boot-autoconfiguration/pom.xml +++ b/spring-boot-autoconfiguration/pom.xml @@ -4,8 +4,8 @@ com.baeldung spring-boot-autoconfiguration 0.0.1-SNAPSHOT - war spring-boot-autoconfiguration + war This is simple boot application demonstrating a custom auto-configuration diff --git a/spring-boot-bootstrap/pom.xml b/spring-boot-bootstrap/pom.xml index 0ffc1820b8..f13801f532 100644 --- a/spring-boot-bootstrap/pom.xml +++ b/spring-boot-bootstrap/pom.xml @@ -4,16 +4,18 @@ 4.0.0 com.baeldung spring-boot-bootstrap - jar spring-boot-bootstrap Demo project for Spring Boot - + jar + + parent-boot-2 com.baeldung 0.0.1-SNAPSHOT ../parent-boot-2 - + + org.springframework.boot spring-boot-starter-web @@ -312,7 +314,8 @@ - + + org.apache.maven.plugins @@ -325,7 +328,8 @@ - + + 4.0.0 diff --git a/spring-boot-client/pom.xml b/spring-boot-client/pom.xml index fc89931f79..4850849039 100644 --- a/spring-boot-client/pom.xml +++ b/spring-boot-client/pom.xml @@ -4,8 +4,8 @@ com.baeldung spring-boot-client 0.0.1-SNAPSHOT - war spring-boot-client + war This is simple boot client application for Spring boot actuator test diff --git a/spring-boot-jasypt/pom.xml b/spring-boot-jasypt/pom.xml index de0df92678..ae0483f107 100644 --- a/spring-boot-jasypt/pom.xml +++ b/spring-boot-jasypt/pom.xml @@ -2,11 +2,10 @@ 4.0.0 - com.example.jasypt spring-boot-jasypt - jar spring-boot-jasypt + jar Demo project for Spring Boot diff --git a/spring-boot-keycloak/pom.xml b/spring-boot-keycloak/pom.xml index 3a39d4aa94..b13805b4bf 100644 --- a/spring-boot-keycloak/pom.xml +++ b/spring-boot-keycloak/pom.xml @@ -5,9 +5,9 @@ com.baeldung.keycloak spring-boot-keycloak 0.0.1 - jar spring-boot-keycloak This is a simple application demonstrating integration between Keycloak and Spring Boot. + jar com.baeldung diff --git a/spring-boot-libraries/pom.xml b/spring-boot-libraries/pom.xml index f21a71de24..b448d6fd66 100644 --- a/spring-boot-libraries/pom.xml +++ b/spring-boot-libraries/pom.xml @@ -3,8 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-boot-libraries - war spring-boot-libraries + war This is simple boot application for Spring boot actuator test diff --git a/spring-boot-logging-log4j2/pom.xml b/spring-boot-logging-log4j2/pom.xml index d3a84de342..6cc60da52c 100644 --- a/spring-boot-logging-log4j2/pom.xml +++ b/spring-boot-logging-log4j2/pom.xml @@ -3,8 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-boot-logging-log4j2 - jar spring-boot-logging-log4j2 + jar Demo project for Spring Boot Logging with Log4J2 diff --git a/spring-boot-mvc/pom.xml b/spring-boot-mvc/pom.xml index bb3e6312ab..89fa6bb04d 100644 --- a/spring-boot-mvc/pom.xml +++ b/spring-boot-mvc/pom.xml @@ -3,8 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-boot-mvc - jar spring-boot-mvc + jar Module For Spring Boot MVC diff --git a/spring-boot-ops/pom.xml b/spring-boot-ops/pom.xml index 9717a352d3..625b2ad188 100644 --- a/spring-boot-ops/pom.xml +++ b/spring-boot-ops/pom.xml @@ -2,10 +2,9 @@ 4.0.0 - spring-boot-ops - war spring-boot-ops + war Demo project for Spring Boot diff --git a/spring-boot-security/pom.xml b/spring-boot-security/pom.xml index b87189757a..aaa0fbf4c7 100644 --- a/spring-boot-security/pom.xml +++ b/spring-boot-security/pom.xml @@ -3,9 +3,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-boot-security - jar spring-boot-security Spring Boot Security Auto-Configuration + jar parent-boot-1 diff --git a/spring-boot-testing/pom.xml b/spring-boot-testing/pom.xml index c2c886a4fe..caf48276b6 100644 --- a/spring-boot-testing/pom.xml +++ b/spring-boot-testing/pom.xml @@ -3,9 +3,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-boot-testing - war spring-boot-testing This is simple boot application for demonstrating testing features. + war parent-boot-2 diff --git a/spring-boot-vue/pom.xml b/spring-boot-vue/pom.xml index d581b11d68..4e47a98d6f 100644 --- a/spring-boot-vue/pom.xml +++ b/spring-boot-vue/pom.xml @@ -2,13 +2,11 @@ 4.0.0 - com.baeldung spring-boot-vue 0.0.1-SNAPSHOT - jar - spring-boot-vue + jar Demo project for Spring Boot Vue project @@ -18,12 +16,6 @@ ../parent-boot-2 - - UTF-8 - UTF-8 - 1.8 - - org.springframework.boot @@ -52,5 +44,10 @@ + + UTF-8 + UTF-8 + 1.8 + diff --git a/spring-boot/pom.xml b/spring-boot/pom.xml index e6866b5a8f..2e463e0189 100644 --- a/spring-boot/pom.xml +++ b/spring-boot/pom.xml @@ -3,8 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-boot - war spring-boot + war This is simple boot application for Spring boot actuator test diff --git a/spring-cloud-bus/pom.xml b/spring-cloud-bus/pom.xml index 784e4cbae6..fdaf8c024f 100644 --- a/spring-cloud-bus/pom.xml +++ b/spring-cloud-bus/pom.xml @@ -6,8 +6,8 @@ com.baeldung.spring.cloud spring-cloud-bus 1.0.0-SNAPSHOT - pom spring-cloud-bus + pom parent-boot-1 diff --git a/spring-cloud-bus/spring-cloud-config-client/pom.xml b/spring-cloud-bus/spring-cloud-config-client/pom.xml index b2b69303bf..4994626ba5 100644 --- a/spring-cloud-bus/spring-cloud-config-client/pom.xml +++ b/spring-cloud-bus/spring-cloud-config-client/pom.xml @@ -3,9 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-cloud-config-client - jar - spring-cloud-config-client + jar Demo Spring Cloud Config Client diff --git a/spring-cloud-bus/spring-cloud-config-server/pom.xml b/spring-cloud-bus/spring-cloud-config-server/pom.xml index f50b78ff18..51b447161e 100644 --- a/spring-cloud-bus/spring-cloud-config-server/pom.xml +++ b/spring-cloud-bus/spring-cloud-config-server/pom.xml @@ -3,9 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-cloud-config-server - jar - spring-cloud-config-server + jar Demo Spring Cloud Config Server diff --git a/spring-cloud-data-flow/batch-job/pom.xml b/spring-cloud-data-flow/batch-job/pom.xml index 7bc2909f4c..04187badb4 100644 --- a/spring-cloud-data-flow/batch-job/pom.xml +++ b/spring-cloud-data-flow/batch-job/pom.xml @@ -5,9 +5,9 @@ org.baeldung.spring.cloud batch-job 0.0.1-SNAPSHOT - jar batch-job Demo project for Spring Boot + jar parent-boot-1 diff --git a/spring-cloud-data-flow/data-flow-server/pom.xml b/spring-cloud-data-flow/data-flow-server/pom.xml index a02d2984c1..cf583c216a 100644 --- a/spring-cloud-data-flow/data-flow-server/pom.xml +++ b/spring-cloud-data-flow/data-flow-server/pom.xml @@ -2,11 +2,10 @@ 4.0.0 - data-flow-server 0.0.1-SNAPSHOT - jar data-flow-server + jar Demo project for Spring Boot diff --git a/spring-cloud-data-flow/data-flow-shell/pom.xml b/spring-cloud-data-flow/data-flow-shell/pom.xml index 3b155736c3..52cb204201 100644 --- a/spring-cloud-data-flow/data-flow-shell/pom.xml +++ b/spring-cloud-data-flow/data-flow-shell/pom.xml @@ -2,11 +2,10 @@ 4.0.0 - data-flow-shell 0.0.1-SNAPSHOT - jar data-flow-shell + jar Demo project for Spring Boot diff --git a/spring-cloud-data-flow/etl/customer-mongodb-sink/pom.xml b/spring-cloud-data-flow/etl/customer-mongodb-sink/pom.xml index 1f16a02a98..c8b609fd70 100644 --- a/spring-cloud-data-flow/etl/customer-mongodb-sink/pom.xml +++ b/spring-cloud-data-flow/etl/customer-mongodb-sink/pom.xml @@ -2,11 +2,9 @@ 4.0.0 - customer-mongodb-sink - jar - customer-mongodb-sink + jar Example ETL Load Project diff --git a/spring-cloud-data-flow/etl/customer-transform/pom.xml b/spring-cloud-data-flow/etl/customer-transform/pom.xml index ed281b420a..5b2eb05fc8 100644 --- a/spring-cloud-data-flow/etl/customer-transform/pom.xml +++ b/spring-cloud-data-flow/etl/customer-transform/pom.xml @@ -2,11 +2,9 @@ 4.0.0 - customer-transform - jar - customer-transform + jar Example transform ETL step diff --git a/spring-cloud-data-flow/etl/pom.xml b/spring-cloud-data-flow/etl/pom.xml index 7d5040e8ad..55b2f34289 100644 --- a/spring-cloud-data-flow/etl/pom.xml +++ b/spring-cloud-data-flow/etl/pom.xml @@ -1,9 +1,9 @@ 4.0.0 - etl etl 0.0.1-SNAPSHOT + etl pom diff --git a/spring-cloud-data-flow/log-sink/pom.xml b/spring-cloud-data-flow/log-sink/pom.xml index 69de679c2a..ecabb91a98 100644 --- a/spring-cloud-data-flow/log-sink/pom.xml +++ b/spring-cloud-data-flow/log-sink/pom.xml @@ -2,11 +2,10 @@ 4.0.0 - log-sink 0.0.1-SNAPSHOT - jar log-sink + jar Demo project for Spring Boot diff --git a/spring-cloud-data-flow/pom.xml b/spring-cloud-data-flow/pom.xml index b5ef5d2c2a..daf8ebd2c8 100644 --- a/spring-cloud-data-flow/pom.xml +++ b/spring-cloud-data-flow/pom.xml @@ -3,8 +3,8 @@ 4.0.0 spring-cloud-data-flow 0.0.1-SNAPSHOT - pom spring-cloud-data-flow + pom com.baeldung diff --git a/spring-cloud-data-flow/time-processor/pom.xml b/spring-cloud-data-flow/time-processor/pom.xml index e630df1865..de354ca698 100644 --- a/spring-cloud-data-flow/time-processor/pom.xml +++ b/spring-cloud-data-flow/time-processor/pom.xml @@ -2,11 +2,10 @@ 4.0.0 - time-processor 0.0.1-SNAPSHOT - jar time-processor + jar Demo project for Spring Boot diff --git a/spring-cloud-data-flow/time-source/pom.xml b/spring-cloud-data-flow/time-source/pom.xml index 649af32cf0..a4d06e13d2 100644 --- a/spring-cloud-data-flow/time-source/pom.xml +++ b/spring-cloud-data-flow/time-source/pom.xml @@ -2,7 +2,6 @@ 4.0.0 - time-source 0.0.1-SNAPSHOT jar diff --git a/spring-cloud/pom.xml b/spring-cloud/pom.xml index 39cda888c5..baf86a4386 100644 --- a/spring-cloud/pom.xml +++ b/spring-cloud/pom.xml @@ -5,8 +5,8 @@ com.baeldung.spring.cloud spring-cloud 1.0.0-SNAPSHOT - pom spring-cloud + pom com.baeldung diff --git a/spring-cloud/spring-cloud-archaius/additional-sources-simple/pom.xml b/spring-cloud/spring-cloud-archaius/additional-sources-simple/pom.xml index 1ae6d543fb..cc100833cd 100644 --- a/spring-cloud/spring-cloud-archaius/additional-sources-simple/pom.xml +++ b/spring-cloud/spring-cloud-archaius/additional-sources-simple/pom.xml @@ -5,8 +5,8 @@ 4.0.0 additional-sources-simple 1.0.0-SNAPSHOT - jar additional-sources-simple + jar com.baeldung.spring.cloud diff --git a/spring-cloud/spring-cloud-archaius/basic-config/pom.xml b/spring-cloud/spring-cloud-archaius/basic-config/pom.xml index b5b091712d..be77eeb71c 100644 --- a/spring-cloud/spring-cloud-archaius/basic-config/pom.xml +++ b/spring-cloud/spring-cloud-archaius/basic-config/pom.xml @@ -5,8 +5,8 @@ 4.0.0 basic-config 1.0.0-SNAPSHOT - jar basic-config + jar com.baeldung.spring.cloud diff --git a/spring-cloud/spring-cloud-archaius/extra-configs/pom.xml b/spring-cloud/spring-cloud-archaius/extra-configs/pom.xml index 2f3f2b084a..c3c830f197 100644 --- a/spring-cloud/spring-cloud-archaius/extra-configs/pom.xml +++ b/spring-cloud/spring-cloud-archaius/extra-configs/pom.xml @@ -5,8 +5,8 @@ 4.0.0 extra-configs 1.0.0-SNAPSHOT - jar extra-configs + jar com.baeldung.spring.cloud diff --git a/spring-cloud/spring-cloud-aws/pom.xml b/spring-cloud/spring-cloud-aws/pom.xml index 7edabd03f5..26c407a77e 100644 --- a/spring-cloud/spring-cloud-aws/pom.xml +++ b/spring-cloud/spring-cloud-aws/pom.xml @@ -4,9 +4,9 @@ 4.0.0 com.baeldung.spring.cloud spring-cloud-aws - jar spring-cloud-aws Spring Cloud AWS Examples + jar parent-boot-1 diff --git a/spring-cloud/spring-cloud-consul/pom.xml b/spring-cloud/spring-cloud-consul/pom.xml index 2a2714d597..1ca3d703b5 100644 --- a/spring-cloud/spring-cloud-consul/pom.xml +++ b/spring-cloud/spring-cloud-consul/pom.xml @@ -4,8 +4,8 @@ 4.0.0 org.baeldung spring-cloud-consul - jar spring-cloud-consul + jar com.baeldung.spring.cloud diff --git a/spring-cloud/spring-cloud-contract/pom.xml b/spring-cloud/spring-cloud-contract/pom.xml index 3563d0ee58..4d4e8ad2c3 100644 --- a/spring-cloud/spring-cloud-contract/pom.xml +++ b/spring-cloud/spring-cloud-contract/pom.xml @@ -2,11 +2,11 @@ 4.0.0 - pom com.baeldung.spring.cloud spring-cloud-contract 1.0.0-SNAPSHOT spring-cloud-contract + pom com.baeldung.spring.cloud diff --git a/spring-cloud/spring-cloud-contract/spring-cloud-contract-consumer/pom.xml b/spring-cloud/spring-cloud-contract/spring-cloud-contract-consumer/pom.xml index fa9bf51bc3..7d00a9f463 100644 --- a/spring-cloud/spring-cloud-contract/spring-cloud-contract-consumer/pom.xml +++ b/spring-cloud/spring-cloud-contract/spring-cloud-contract-consumer/pom.xml @@ -2,14 +2,12 @@ 4.0.0 - com.baeldung.spring.cloud spring-cloud-contract-consumer 1.0.0-SNAPSHOT - jar - spring-cloud-contract-consumer Spring Cloud Consumer Sample + jar com.baeldung.spring.cloud @@ -18,12 +16,6 @@ .. - - UTF-8 - UTF-8 - 1.8 - - org.springframework.cloud @@ -54,4 +46,10 @@ test + + + UTF-8 + UTF-8 + 1.8 + diff --git a/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/pom.xml b/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/pom.xml index ac27dbb645..a6bd4e1be4 100644 --- a/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/pom.xml +++ b/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/pom.xml @@ -2,14 +2,12 @@ 4.0.0 - com.baeldung.spring.cloud spring-cloud-contract-producer 1.0.0-SNAPSHOT - jar - spring-cloud-contract-producer Spring Cloud Producer Sample + jar com.baeldung.spring.cloud @@ -18,13 +16,6 @@ .. - - UTF-8 - UTF-8 - 1.8 - Edgware.SR1 - - org.springframework.cloud @@ -70,5 +61,11 @@ + + UTF-8 + UTF-8 + 1.8 + Edgware.SR1 + diff --git a/spring-cloud/spring-cloud-eureka/pom.xml b/spring-cloud/spring-cloud-eureka/pom.xml index 99d8c0ed40..b59b415ee2 100644 --- a/spring-cloud/spring-cloud-eureka/pom.xml +++ b/spring-cloud/spring-cloud-eureka/pom.xml @@ -5,9 +5,9 @@ com.baeldung.spring.cloud spring-cloud-eureka 1.0.0-SNAPSHOT - pom spring-cloud-eureka Spring Cloud Eureka Server and Sample Clients + pom spring-cloud-eureka-server diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml index 5378095af0..c2d64ce237 100644 --- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml +++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml @@ -4,9 +4,9 @@ 4.0.0 spring-cloud-eureka-client 1.0.0-SNAPSHOT - jar spring-cloud-eureka-client Spring Cloud Eureka Sample Client + jar com.baeldung.spring.cloud diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/pom.xml b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/pom.xml index f2057c8a76..84ba1e28fe 100644 --- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/pom.xml +++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/pom.xml @@ -4,9 +4,9 @@ 4.0.0 spring-cloud-eureka-feign-client 1.0.0-SNAPSHOT - jar spring-cloud-eureka-feign-client Spring Cloud Eureka - Sample Feign Client + jar com.baeldung.spring.cloud diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/pom.xml b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/pom.xml index 587aed6c49..f51f6d229d 100644 --- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/pom.xml +++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/pom.xml @@ -4,9 +4,9 @@ 4.0.0 spring-cloud-eureka-server 1.0.0-SNAPSHOT - jar spring-cloud-eureka-server Spring Cloud Eureka Server Demo + jar com.baeldung.spring.cloud diff --git a/spring-cloud/spring-cloud-functions/pom.xml b/spring-cloud/spring-cloud-functions/pom.xml index 5686fc8c64..9396ad0a55 100644 --- a/spring-cloud/spring-cloud-functions/pom.xml +++ b/spring-cloud/spring-cloud-functions/pom.xml @@ -6,9 +6,9 @@ com.baeldung.spring spring-cloud-functions 0.0.1-SNAPSHOT - jar spring-cloud-functions Demo project for Spring Cloud Function + jar org.springframework.boot diff --git a/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml b/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml index 11b9275b46..a345d6856b 100644 --- a/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml +++ b/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml @@ -5,8 +5,8 @@ 4.0.0 feign-rest-consumer 1.0.0-SNAPSHOT - jar feign-rest-consumer + jar com.baeldung.spring.cloud diff --git a/spring-cloud/spring-cloud-hystrix/pom.xml b/spring-cloud/spring-cloud-hystrix/pom.xml index 266644b4c3..51f6a4e82b 100644 --- a/spring-cloud/spring-cloud-hystrix/pom.xml +++ b/spring-cloud/spring-cloud-hystrix/pom.xml @@ -6,8 +6,8 @@ com.baeldung.spring.cloud spring-cloud-hystrix 1.0.0-SNAPSHOT - pom spring-cloud-hystrix + pom com.baeldung.spring.cloud diff --git a/spring-cloud/spring-cloud-hystrix/rest-consumer/pom.xml b/spring-cloud/spring-cloud-hystrix/rest-consumer/pom.xml index 651f80fc92..ec2f6d1e55 100644 --- a/spring-cloud/spring-cloud-hystrix/rest-consumer/pom.xml +++ b/spring-cloud/spring-cloud-hystrix/rest-consumer/pom.xml @@ -2,11 +2,10 @@ 4.0.0 - rest-consumer 1.0.0-SNAPSHOT - jar rest-consumer + jar com.baeldung.spring.cloud diff --git a/spring-cloud/spring-cloud-hystrix/rest-producer/pom.xml b/spring-cloud/spring-cloud-hystrix/rest-producer/pom.xml index 8437ac6833..0f84fb7e23 100644 --- a/spring-cloud/spring-cloud-hystrix/rest-producer/pom.xml +++ b/spring-cloud/spring-cloud-hystrix/rest-producer/pom.xml @@ -2,12 +2,10 @@ 4.0.0 - rest-producer 1.0.0-SNAPSHOT - jar - rest-producer + jar com.baeldung.spring.cloud diff --git a/spring-cloud/spring-cloud-kubernetes/liveness-example/pom.xml b/spring-cloud/spring-cloud-kubernetes/liveness-example/pom.xml index e963dafe67..9254718c81 100644 --- a/spring-cloud/spring-cloud-kubernetes/liveness-example/pom.xml +++ b/spring-cloud/spring-cloud-kubernetes/liveness-example/pom.xml @@ -2,6 +2,9 @@ + 4.0.0 + liveness-example + 1.0-SNAPSHOT org.springframework.boot @@ -10,17 +13,6 @@ - 4.0.0 - - liveness-example - 1.0-SNAPSHOT - - - UTF-8 - UTF-8 - 1.8 - - org.springframework.boot @@ -48,4 +40,10 @@ + + UTF-8 + UTF-8 + 1.8 + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-kubernetes/pom.xml b/spring-cloud/spring-cloud-kubernetes/pom.xml index de0718633e..51e1456358 100644 --- a/spring-cloud/spring-cloud-kubernetes/pom.xml +++ b/spring-cloud/spring-cloud-kubernetes/pom.xml @@ -5,15 +5,8 @@ com.baeldung.spring.cloud spring-cloud-kubernetes 1.0-SNAPSHOT - pom spring-cloud-kubernetes - - - demo-frontend - demo-backend - liveness-example - readiness-example - + pom parent-boot-1 @@ -21,5 +14,12 @@ 0.0.1-SNAPSHOT ../../parent-boot-1 + + + demo-frontend + demo-backend + liveness-example + readiness-example + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-kubernetes/readiness-example/pom.xml b/spring-cloud/spring-cloud-kubernetes/readiness-example/pom.xml index fa85120d21..e22bb0a9fe 100644 --- a/spring-cloud/spring-cloud-kubernetes/readiness-example/pom.xml +++ b/spring-cloud/spring-cloud-kubernetes/readiness-example/pom.xml @@ -2,22 +2,16 @@ + 4.0.0 + readiness-example + 1.0-SNAPSHOT + org.springframework.boot spring-boot-starter-parent 1.5.17.RELEASE - 4.0.0 - - readiness-example - 1.0-SNAPSHOT - - - UTF-8 - UTF-8 - 1.8 - @@ -46,4 +40,10 @@ + + UTF-8 + UTF-8 + 1.8 + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-rest/pom.xml b/spring-cloud/spring-cloud-rest/pom.xml index f78f58caa0..7f316f47fc 100644 --- a/spring-cloud/spring-cloud-rest/pom.xml +++ b/spring-cloud/spring-cloud-rest/pom.xml @@ -5,8 +5,8 @@ org.baeldung spring-cloud-rest 1.0.0-SNAPSHOT - pom spring-cloud-rest + pom com.baeldung.spring.cloud diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/pom.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/pom.xml index d1139b1fa4..a196ed8531 100644 --- a/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/pom.xml +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/pom.xml @@ -5,9 +5,9 @@ org.baeldung spring-cloud-rest-books-api 0.0.1-SNAPSHOT - jar spring-cloud-rest-books-api Simple books API + jar parent-boot-1 diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/pom.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/pom.xml index a43829666c..7a71cdb13b 100644 --- a/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/pom.xml +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/pom.xml @@ -5,9 +5,9 @@ org.baeldung spring-cloud-rest-config-server 0.0.1-SNAPSHOT - jar spring-cloud-rest-config-server Spring Cloud REST configuration server + jar parent-boot-1 diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/pom.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/pom.xml index 5b656d4342..7ce04f2815 100644 --- a/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/pom.xml +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/pom.xml @@ -5,9 +5,9 @@ org.baeldung spring-cloud-rest-discovery-server 0.0.1-SNAPSHOT - jar spring-cloud-rest-discovery-server Spring Cloud REST server + jar parent-boot-1 diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/pom.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/pom.xml index ef969e04e5..cd7749460e 100644 --- a/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/pom.xml +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/pom.xml @@ -5,9 +5,9 @@ org.baeldung spring-cloud-rest-reviews-api 0.0.1-SNAPSHOT - jar spring-cloud-rest-reviews-api Simple reviews API + jar parent-boot-1 diff --git a/spring-cloud/spring-cloud-ribbon-client/pom.xml b/spring-cloud/spring-cloud-ribbon-client/pom.xml index 12125f4cf3..f677009a41 100644 --- a/spring-cloud/spring-cloud-ribbon-client/pom.xml +++ b/spring-cloud/spring-cloud-ribbon-client/pom.xml @@ -4,8 +4,8 @@ com.baeldung spring-cloud-ribbon-client 0.0.1-SNAPSHOT - jar spring-cloud-ribbon-client + jar Introduction to Spring Cloud Rest Client with Netflix Ribbon diff --git a/spring-cloud/spring-cloud-security/auth-client/pom.xml b/spring-cloud/spring-cloud-security/auth-client/pom.xml index 5d15c6c726..4f64f470f0 100644 --- a/spring-cloud/spring-cloud-security/auth-client/pom.xml +++ b/spring-cloud/spring-cloud-security/auth-client/pom.xml @@ -3,8 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 auth-client - jar auth-client + jar Spring Cloud Security APP Client Module diff --git a/spring-cloud/spring-cloud-security/auth-resource/pom.xml b/spring-cloud/spring-cloud-security/auth-resource/pom.xml index 0367baa990..22ee0528c3 100644 --- a/spring-cloud/spring-cloud-security/auth-resource/pom.xml +++ b/spring-cloud/spring-cloud-security/auth-resource/pom.xml @@ -2,11 +2,9 @@ 4.0.0 - auth-resource - jar - auth-resource + jar Spring Cloud Security APP Resource Module diff --git a/spring-cloud/spring-cloud-security/pom.xml b/spring-cloud/spring-cloud-security/pom.xml index 1cf8751548..2eecf579a5 100644 --- a/spring-cloud/spring-cloud-security/pom.xml +++ b/spring-cloud/spring-cloud-security/pom.xml @@ -3,9 +3,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-cloud-security - pom 1.0.0-SNAPSHOT spring-cloud-security + pom parent-boot-1 diff --git a/spring-cloud/spring-cloud-stream-starters/twitterhdfs/pom.xml b/spring-cloud/spring-cloud-stream-starters/twitterhdfs/pom.xml index 6f582576d8..8846773338 100644 --- a/spring-cloud/spring-cloud-stream-starters/twitterhdfs/pom.xml +++ b/spring-cloud/spring-cloud-stream-starters/twitterhdfs/pom.xml @@ -4,9 +4,9 @@ 4.0.0 com.baeldung.twitterhdfs twitterhdfs - jar 1.0.0-SNAPSHOT twitterhdfs + jar parent-boot-1 diff --git a/spring-cloud/spring-cloud-stream/pom.xml b/spring-cloud/spring-cloud-stream/pom.xml index d62b959131..76a51cc3ca 100644 --- a/spring-cloud/spring-cloud-stream/pom.xml +++ b/spring-cloud/spring-cloud-stream/pom.xml @@ -4,8 +4,8 @@ 4.0.0 org.baeldung spring-cloud-stream - pom spring-cloud-stream + pom com.baeldung.spring.cloud diff --git a/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/pom.xml b/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/pom.xml index fa14d04087..1649cfc0b5 100644 --- a/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/pom.xml +++ b/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/pom.xml @@ -3,9 +3,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-cloud-stream-rabbit - jar spring-cloud-stream-rabbit Simple Spring Cloud Stream + jar org.baeldung diff --git a/spring-cloud/spring-cloud-task/pom.xml b/spring-cloud/spring-cloud-task/pom.xml index 748cc378f1..7c2c0d17f2 100644 --- a/spring-cloud/spring-cloud-task/pom.xml +++ b/spring-cloud/spring-cloud-task/pom.xml @@ -5,8 +5,8 @@ com.baeldung.spring.cloud spring-cloud-task 1.0.0-SNAPSHOT - pom spring-cloud-task + pom parent-boot-1 diff --git a/spring-cloud/spring-cloud-task/springcloudtasksink/pom.xml b/spring-cloud/spring-cloud-task/springcloudtasksink/pom.xml index ca0de342a9..03bfe7b1cb 100644 --- a/spring-cloud/spring-cloud-task/springcloudtasksink/pom.xml +++ b/spring-cloud/spring-cloud-task/springcloudtasksink/pom.xml @@ -3,8 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 SpringCloudTaskSink - jar SpringCloudTaskSink + jar Demo project for Spring Boot diff --git a/spring-cloud/spring-cloud-vault/pom.xml b/spring-cloud/spring-cloud-vault/pom.xml index 363de6e107..abfb0d06f3 100644 --- a/spring-cloud/spring-cloud-vault/pom.xml +++ b/spring-cloud/spring-cloud-vault/pom.xml @@ -2,12 +2,10 @@ 4.0.0 - org.baeldung.spring.cloud spring-cloud-vault - jar - spring-cloud-vault + jar Demo project for Spring Boot diff --git a/spring-cloud/spring-cloud-zookeeper/Greeting/pom.xml b/spring-cloud/spring-cloud-zookeeper/Greeting/pom.xml index 9243766b77..2da47cf40d 100644 --- a/spring-cloud/spring-cloud-zookeeper/Greeting/pom.xml +++ b/spring-cloud/spring-cloud-zookeeper/Greeting/pom.xml @@ -3,8 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 Greeting - jar Greeting + jar com.baeldung.spring.cloud diff --git a/spring-cloud/spring-cloud-zookeeper/pom.xml b/spring-cloud/spring-cloud-zookeeper/pom.xml index 9661f2b71a..4ea9b22e9d 100644 --- a/spring-cloud/spring-cloud-zookeeper/pom.xml +++ b/spring-cloud/spring-cloud-zookeeper/pom.xml @@ -3,8 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-cloud-zookeeper - pom spring-cloud-zookeeper + pom com.baeldung.spring.cloud diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/bin/eureka-client/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/bin/eureka-client/pom.xml index 6a00b279c8..9c075ebfe3 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/bin/eureka-client/pom.xml +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/bin/eureka-client/pom.xml @@ -4,9 +4,8 @@ 4.0.0 eureka-client 1.0.0-SNAPSHOT - jar - Spring Cloud Eureka Client + jar Spring Cloud Eureka Sample Client diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/bin/eureka-server/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/bin/eureka-server/pom.xml index 9db3204f64..97933210de 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/bin/eureka-server/pom.xml +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/bin/eureka-server/pom.xml @@ -2,12 +2,10 @@ 4.0.0 - eureka-server 1.0.0-SNAPSHOT - jar - Spring Cloud Eureka Server + jar Spring Cloud Eureka Server Demo @@ -27,7 +25,6 @@ commons-configuration ${commons-config.version} - diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/bin/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/bin/pom.xml index 7e864499d4..fbae051277 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/bin/pom.xml +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/bin/pom.xml @@ -1,14 +1,13 @@ - 4.0.0 - + 4.0.0 com.baeldung.spring.cloud spring-cloud-zuul-eureka-integration 1.0.0-SNAPSHOT - pom Spring Cloud Zuul and Eureka Integration Spring Cloud Zuul and Eureka Integration + pom com.baeldung.spring.cloud @@ -17,16 +16,16 @@ .. + + zuul-server + eureka-server + eureka-client + + UTF-8 3.7.0 1.4.2.RELEASE 1.10 - - - zuul-server - eureka-server - eureka-client - diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/bin/zuul-server/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/bin/zuul-server/pom.xml index 40462c57f4..1c2cb85da5 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/bin/zuul-server/pom.xml +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/bin/zuul-server/pom.xml @@ -1,12 +1,14 @@ 4.0.0 + zuul-server + com.baeldung.spring.cloud spring-cloud-zuul-eureka-integration 1.0.0-SNAPSHOT - zuul-server + org.springframework.boot @@ -30,6 +32,7 @@ spring-boot-starter-security + diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml index c4f7ae704a..0b479ec226 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml @@ -4,8 +4,8 @@ 4.0.0 eureka-client 1.0.0-SNAPSHOT - jar eureka-client + jar Spring Cloud Eureka Sample Client diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml index 0256ee7000..eea22779a6 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml @@ -4,8 +4,8 @@ 4.0.0 eureka-server 1.0.0-SNAPSHOT - jar eureka-server + jar Spring Cloud Eureka Server Demo diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/pom.xml index edd7b9d99e..7fe0cf6ac3 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/pom.xml +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/pom.xml @@ -6,8 +6,8 @@ com.baeldung.spring.cloud spring-cloud-zuul-eureka-integration 1.0.0-SNAPSHOT - pom spring-cloud-zuul-eureka-integration + pom Spring Cloud Zuul and Eureka Integration diff --git a/spring-cloud/spring-cloud-zuul/pom.xml b/spring-cloud/spring-cloud-zuul/pom.xml index e387bacb4e..97e67f16d8 100644 --- a/spring-cloud/spring-cloud-zuul/pom.xml +++ b/spring-cloud/spring-cloud-zuul/pom.xml @@ -2,13 +2,11 @@ 4.0.0 - com.baeldung.spring.cloud spring-cloud-zuul 0.0.1-SNAPSHOT - jar - spring-cloud-zuul + jar Demo project for Spring Boot @@ -18,13 +16,6 @@ - - UTF-8 - UTF-8 - 1.8 - Finchley.SR1 - - org.springframework.boot @@ -76,5 +67,11 @@ - + + UTF-8 + UTF-8 + 1.8 + Finchley.SR1 + + diff --git a/spring-core/pom.xml b/spring-core/pom.xml index f1e2e2a748..46f777c020 100644 --- a/spring-core/pom.xml +++ b/spring-core/pom.xml @@ -5,8 +5,8 @@ com.baeldung spring-core 0.0.1-SNAPSHOT - war spring-core + war com.baeldung diff --git a/spring-cucumber/pom.xml b/spring-cucumber/pom.xml index 2bc3201775..85980fbc60 100644 --- a/spring-cucumber/pom.xml +++ b/spring-cucumber/pom.xml @@ -5,9 +5,9 @@ com.baeldung spring-cucumber 0.0.1-SNAPSHOT - jar spring-cucumber Demo project for Spring Boot + jar parent-boot-2 diff --git a/spring-data-rest/pom.xml b/spring-data-rest/pom.xml index 2fe4715bac..772d6f2553 100644 --- a/spring-data-rest/pom.xml +++ b/spring-data-rest/pom.xml @@ -5,8 +5,8 @@ com.baeldung spring-data-rest 1.0 - jar spring-data-rest + jar Intro to Spring Data REST diff --git a/spring-dispatcher-servlet/pom.xml b/spring-dispatcher-servlet/pom.xml index 7ac291740e..2eeb37eef0 100644 --- a/spring-dispatcher-servlet/pom.xml +++ b/spring-dispatcher-servlet/pom.xml @@ -4,9 +4,9 @@ 4.0.0 com.baeldung spring-dispatcher-servlet - war 1.0.0 spring-dispatcher-servlet + war com.baeldung diff --git a/spring-ejb/pom.xml b/spring-ejb/pom.xml index 688f692757..712bfc66ab 100755 --- a/spring-ejb/pom.xml +++ b/spring-ejb/pom.xml @@ -4,8 +4,8 @@ 4.0.0 com.baeldung.spring.ejb spring-ejb - pom spring-ejb + pom Spring EJB Tutorial diff --git a/spring-ejb/spring-ejb-client/pom.xml b/spring-ejb/spring-ejb-client/pom.xml index 3d8003cbba..e0348d5ae3 100644 --- a/spring-ejb/spring-ejb-client/pom.xml +++ b/spring-ejb/spring-ejb-client/pom.xml @@ -2,11 +2,9 @@ 4.0.0 - spring-ejb-client - jar - spring-ejb-client + jar Spring EJB Client diff --git a/spring-ejb/spring-ejb-remote/pom.xml b/spring-ejb/spring-ejb-remote/pom.xml index 797cc3ac68..4f4ddb0b54 100644 --- a/spring-ejb/spring-ejb-remote/pom.xml +++ b/spring-ejb/spring-ejb-remote/pom.xml @@ -3,8 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-ejb-remote - ejb spring-ejb-remote + ejb com.baeldung.spring.ejb diff --git a/spring-ejb/wildfly/pom.xml b/spring-ejb/wildfly/pom.xml index f50dad82f1..e2c3ffb50c 100644 --- a/spring-ejb/wildfly/pom.xml +++ b/spring-ejb/wildfly/pom.xml @@ -4,8 +4,8 @@ com.baeldung.wildfly wildfly 0.0.1-SNAPSHOT - pom wildfly + pom com.baeldung.spring.ejb diff --git a/spring-ejb/wildfly/widlfly-web/pom.xml b/spring-ejb/wildfly/widlfly-web/pom.xml index f0baac10dd..5eefada2fc 100644 --- a/spring-ejb/wildfly/widlfly-web/pom.xml +++ b/spring-ejb/wildfly/widlfly-web/pom.xml @@ -2,8 +2,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 widlfly-web - war widlfly-web + war com.baeldung.wildfly diff --git a/spring-ejb/wildfly/wildfly-ear/pom.xml b/spring-ejb/wildfly/wildfly-ear/pom.xml index 93d6df96e5..62d15a53dc 100644 --- a/spring-ejb/wildfly/wildfly-ear/pom.xml +++ b/spring-ejb/wildfly/wildfly-ear/pom.xml @@ -2,8 +2,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 wildfly-ear - ear wildfly-ear + ear com.baeldung.wildfly diff --git a/spring-ejb/wildfly/wildfly-ejb/pom.xml b/spring-ejb/wildfly/wildfly-ejb/pom.xml index 12bfc9c1bf..f03bfb341c 100644 --- a/spring-ejb/wildfly/wildfly-ejb/pom.xml +++ b/spring-ejb/wildfly/wildfly-ejb/pom.xml @@ -2,8 +2,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 wildfly-ejb - ejb wildfly-ejb + ejb com.baeldung.wildfly diff --git a/spring-freemarker/pom.xml b/spring-freemarker/pom.xml index 02f2a3fd06..c71643dc39 100644 --- a/spring-freemarker/pom.xml +++ b/spring-freemarker/pom.xml @@ -3,9 +3,9 @@ 4.0.0 com.baeldung.freemarker spring-freemarker - war 1.0-SNAPSHOT spring-freemarker + war com.baeldung diff --git a/spring-groovy/pom.xml b/spring-groovy/pom.xml index 42cdb93fd2..c26de0b6dd 100644 --- a/spring-groovy/pom.xml +++ b/spring-groovy/pom.xml @@ -1,12 +1,11 @@ 4.0.0 - com.baeldug spring-groovy 0.0.1-SNAPSHOT - jar spring-groovy + jar http://maven.apache.org diff --git a/spring-integration/pom.xml b/spring-integration/pom.xml index 8a5399ae0b..11a1e617aa 100644 --- a/spring-integration/pom.xml +++ b/spring-integration/pom.xml @@ -4,8 +4,8 @@ com.baeldung.samples.spring.integration spring-integration 1.0.0.BUILD-SNAPSHOT - jar spring-integration + jar http://www.springsource.org/spring-integration diff --git a/spring-jenkins-pipeline/pom.xml b/spring-jenkins-pipeline/pom.xml index 85336f9689..54b4cc478c 100644 --- a/spring-jenkins-pipeline/pom.xml +++ b/spring-jenkins-pipeline/pom.xml @@ -4,9 +4,9 @@ 4.0.0 spring-jenkins-pipeline 0.0.1-SNAPSHOT - jar spring-jenkins-pipeline Intro to Jenkins 2 and the power of pipelines + jar parent-boot-1 diff --git a/spring-jersey/pom.xml b/spring-jersey/pom.xml index b548de3701..c12f6a1241 100644 --- a/spring-jersey/pom.xml +++ b/spring-jersey/pom.xml @@ -5,8 +5,8 @@ com.baeldung spring-jersey 0.1-SNAPSHOT - war spring-jersey + war com.baeldung diff --git a/spring-jms/pom.xml b/spring-jms/pom.xml index 814875f77b..2ed58c0c95 100644 --- a/spring-jms/pom.xml +++ b/spring-jms/pom.xml @@ -4,8 +4,8 @@ com.baeldung spring-jms 0.0.1-SNAPSHOT - war spring-jms + war Introduction to Spring JMS diff --git a/spring-katharsis/pom.xml b/spring-katharsis/pom.xml index 756aae93d3..74786e7926 100644 --- a/spring-katharsis/pom.xml +++ b/spring-katharsis/pom.xml @@ -4,8 +4,8 @@ org.springframework.samples spring-katharsis 0.0.1-SNAPSHOT - war spring-katharsis + war parent-boot-1 diff --git a/spring-mobile/pom.xml b/spring-mobile/pom.xml index 4b04c3b8d5..71d0d05933 100644 --- a/spring-mobile/pom.xml +++ b/spring-mobile/pom.xml @@ -2,7 +2,6 @@ 4.0.0 - com.baeldung spring-mobile 1.0-SNAPSHOT diff --git a/spring-mockito/pom.xml b/spring-mockito/pom.xml index 481c818f39..766234c41b 100644 --- a/spring-mockito/pom.xml +++ b/spring-mockito/pom.xml @@ -2,13 +2,12 @@ 4.0.0 - com.baeldung spring-mockito 0.0.1-SNAPSHOT - jar spring-mockito Injecting Mockito Mocks into Spring Beans + jar parent-boot-2 diff --git a/spring-mvc-forms-thymeleaf/pom.xml b/spring-mvc-forms-thymeleaf/pom.xml index 504ad1dcb2..99bf465b44 100644 --- a/spring-mvc-forms-thymeleaf/pom.xml +++ b/spring-mvc-forms-thymeleaf/pom.xml @@ -2,10 +2,9 @@ 4.0.0 - spring-mvc-forms-thymeleaf - jar spring-mvc-forms-thymeleaf + jar spring forms examples using thymeleaf diff --git a/spring-mvc-java/pom.xml b/spring-mvc-java/pom.xml index 562df30318..552f62d9f7 100644 --- a/spring-mvc-java/pom.xml +++ b/spring-mvc-java/pom.xml @@ -5,7 +5,7 @@ spring-mvc-java 0.1-SNAPSHOT spring-mvc-java - war + war parent-spring-5 diff --git a/spring-mvc-kotlin/pom.xml b/spring-mvc-kotlin/pom.xml index 59b60ebd3c..fc76f58727 100644 --- a/spring-mvc-kotlin/pom.xml +++ b/spring-mvc-kotlin/pom.xml @@ -26,7 +26,6 @@ org.thymeleaf thymeleaf - org.thymeleaf thymeleaf-spring4 diff --git a/spring-mvc-simple/pom.xml b/spring-mvc-simple/pom.xml index 087ffea46d..8c2661cc27 100644 --- a/spring-mvc-simple/pom.xml +++ b/spring-mvc-simple/pom.xml @@ -19,11 +19,11 @@ spring-oxm ${spring-oxm.version} - - com.sun.mail - javax.mail - 1.6.1 - + + com.sun.mail + javax.mail + 1.6.1 + javax.servlet javax.servlet-api diff --git a/spring-mvc-velocity/pom.xml b/spring-mvc-velocity/pom.xml index dc5adcf3cf..60ac8b9c2f 100644 --- a/spring-mvc-velocity/pom.xml +++ b/spring-mvc-velocity/pom.xml @@ -1,9 +1,8 @@ 4.0.0 - 0.1-SNAPSHOT spring-mvc-velocity - + 0.1-SNAPSHOT spring-mvc-velocity war diff --git a/spring-mvc-xml/pom.xml b/spring-mvc-xml/pom.xml index 8e4a56c148..c6a6da406c 100644 --- a/spring-mvc-xml/pom.xml +++ b/spring-mvc-xml/pom.xml @@ -3,7 +3,6 @@ 4.0.0 0.1-SNAPSHOT spring-mvc-xml - spring-mvc-xml war diff --git a/spring-quartz/pom.xml b/spring-quartz/pom.xml index 77424c219e..58e72c1d51 100644 --- a/spring-quartz/pom.xml +++ b/spring-quartz/pom.xml @@ -2,13 +2,12 @@ 4.0.0 - com.baeldung spring-quartz spring-quartz 0.0.1-SNAPSHOT - jar Demo project for Scheduling in Spring with Quartz + jar parent-boot-2 diff --git a/spring-reactive-kotlin/pom.xml b/spring-reactive-kotlin/pom.xml index 7bd31396f7..90764111cb 100644 --- a/spring-reactive-kotlin/pom.xml +++ b/spring-reactive-kotlin/pom.xml @@ -3,8 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-reactive-kotlin - jar spring-reactive-kotlin + jar Demo project for Spring Boot diff --git a/spring-reactor/pom.xml b/spring-reactor/pom.xml index c6ad99aea7..051244c9db 100644 --- a/spring-reactor/pom.xml +++ b/spring-reactor/pom.xml @@ -3,9 +3,9 @@ 4.0.0 com.baeldung spring-reactor - jar 1.0-SNAPSHOT spring-reactor + jar http://maven.apache.org diff --git a/spring-remoting/pom.xml b/spring-remoting/pom.xml index 060f33837c..e11c5b06f9 100644 --- a/spring-remoting/pom.xml +++ b/spring-remoting/pom.xml @@ -4,10 +4,10 @@ 4.0.0 com.baeldung spring-remoting - pom 1.0-SNAPSHOT spring-remoting Parent for all projects related to Spring Remoting, except remoting-hessian-burlap + pom diff --git a/spring-remoting/remoting-amqp/pom.xml b/spring-remoting/remoting-amqp/pom.xml index f52959046a..901ce69d6b 100644 --- a/spring-remoting/remoting-amqp/pom.xml +++ b/spring-remoting/remoting-amqp/pom.xml @@ -1,7 +1,6 @@ 4.0.0 - remoting-amqp pom remoting-amqp diff --git a/spring-remoting/remoting-amqp/remoting-amqp-client/pom.xml b/spring-remoting/remoting-amqp/remoting-amqp-client/pom.xml index 98e0bc5df5..40b2fa7965 100644 --- a/spring-remoting/remoting-amqp/remoting-amqp-client/pom.xml +++ b/spring-remoting/remoting-amqp/remoting-amqp-client/pom.xml @@ -1,10 +1,9 @@ 4.0.0 - remoting-amqp-client - jar remoting-amqp-client + jar http://maven.apache.org diff --git a/spring-remoting/remoting-amqp/remoting-amqp-server/pom.xml b/spring-remoting/remoting-amqp/remoting-amqp-server/pom.xml index 7fe276f824..e8eb665815 100644 --- a/spring-remoting/remoting-amqp/remoting-amqp-server/pom.xml +++ b/spring-remoting/remoting-amqp/remoting-amqp-server/pom.xml @@ -1,10 +1,9 @@ 4.0.0 - remoting-amqp-server - jar remoting-amqp-server + jar http://maven.apache.org diff --git a/spring-remoting/remoting-hessian-burlap/pom.xml b/spring-remoting/remoting-hessian-burlap/pom.xml index 8c30e76296..e94d1bee82 100644 --- a/spring-remoting/remoting-hessian-burlap/pom.xml +++ b/spring-remoting/remoting-hessian-burlap/pom.xml @@ -4,9 +4,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 remoting-hessian-burlap - pom remoting-hessian-burlap 1.0-SNAPSHOT + pom parent-boot-1 diff --git a/spring-remoting/remoting-http/pom.xml b/spring-remoting/remoting-http/pom.xml index 886a28b886..c4ed511bb5 100644 --- a/spring-remoting/remoting-http/pom.xml +++ b/spring-remoting/remoting-http/pom.xml @@ -4,9 +4,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 remoting-http - pom - remoting-http + pom Parent for all modules related to HTTP Spring Remoting. diff --git a/spring-remoting/remoting-jms/remoting-jms-client/pom.xml b/spring-remoting/remoting-jms/remoting-jms-client/pom.xml index b7b1af5a1a..043ced8527 100644 --- a/spring-remoting/remoting-jms/remoting-jms-client/pom.xml +++ b/spring-remoting/remoting-jms/remoting-jms-client/pom.xml @@ -12,10 +12,6 @@ 1.0-SNAPSHOT - - UTF-8 - - org.springframework.boot @@ -34,4 +30,8 @@ + + UTF-8 + + \ No newline at end of file diff --git a/spring-remoting/remoting-jms/remoting-jms-server/pom.xml b/spring-remoting/remoting-jms/remoting-jms-server/pom.xml index 8a17cdb0a9..13de66977a 100644 --- a/spring-remoting/remoting-jms/remoting-jms-server/pom.xml +++ b/spring-remoting/remoting-jms/remoting-jms-server/pom.xml @@ -12,10 +12,6 @@ 1.0-SNAPSHOT - - UTF-8 - - org.springframework.boot @@ -34,4 +30,8 @@ + + UTF-8 + + \ No newline at end of file diff --git a/spring-remoting/remoting-rmi/pom.xml b/spring-remoting/remoting-rmi/pom.xml index b3b84786b8..7b6e807550 100644 --- a/spring-remoting/remoting-rmi/pom.xml +++ b/spring-remoting/remoting-rmi/pom.xml @@ -4,8 +4,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 remoting-rmi - pom remoting-rmi + pom spring-remoting diff --git a/spring-remoting/remoting-rmi/remoting-rmi-server/pom.xml b/spring-remoting/remoting-rmi/remoting-rmi-server/pom.xml index 7fb4d2c1bc..2a19ebbbf6 100644 --- a/spring-remoting/remoting-rmi/remoting-rmi-server/pom.xml +++ b/spring-remoting/remoting-rmi/remoting-rmi-server/pom.xml @@ -12,10 +12,6 @@ 1.0-SNAPSHOT - - UTF-8 - - org.springframework.boot @@ -34,4 +30,8 @@ + + UTF-8 + + \ No newline at end of file diff --git a/spring-rest-hal-browser/pom.xml b/spring-rest-hal-browser/pom.xml index ee0a2c043d..413aad9e8c 100644 --- a/spring-rest-hal-browser/pom.xml +++ b/spring-rest-hal-browser/pom.xml @@ -7,19 +7,6 @@ spring-rest-hal-browser 1.0-SNAPSHOT spring-rest-hal-browser - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.8 - 1.8 - - - - @@ -46,9 +33,19 @@ h2 1.4.197 - - + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + \ No newline at end of file diff --git a/spring-rest-shell/pom.xml b/spring-rest-shell/pom.xml index 540b3d08eb..acf33cf98f 100644 --- a/spring-rest-shell/pom.xml +++ b/spring-rest-shell/pom.xml @@ -3,8 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-rest-shell - jar spring-rest-shell + jar A simple project to demonstrate Spring REST Shell features. diff --git a/spring-security-acl/pom.xml b/spring-security-acl/pom.xml index c87c237233..8acc39b785 100644 --- a/spring-security-acl/pom.xml +++ b/spring-security-acl/pom.xml @@ -2,12 +2,11 @@ 4.0.0 - spring-security-acl 0.0.1-SNAPSHOT - war spring-security-acl Spring Security ACL + war parent-boot-1 diff --git a/spring-security-angular/server/pom.xml b/spring-security-angular/server/pom.xml index 55269bb35f..6474bb5ed6 100644 --- a/spring-security-angular/server/pom.xml +++ b/spring-security-angular/server/pom.xml @@ -5,8 +5,8 @@ com.baeldung server 0.0.1-SNAPSHOT - jar server + jar Spring Security Angular diff --git a/spring-security-client/spring-security-jsp-authentication/pom.xml b/spring-security-client/spring-security-jsp-authentication/pom.xml index 9bb58863d9..9cb2a45331 100644 --- a/spring-security-client/spring-security-jsp-authentication/pom.xml +++ b/spring-security-client/spring-security-jsp-authentication/pom.xml @@ -5,8 +5,8 @@ com.baeldung spring-security-jsp-authentication 0.0.1-SNAPSHOT - war spring-security-jsp-authentication + war Spring Security JSP Authentication tag sample diff --git a/spring-security-client/spring-security-jsp-authorize/pom.xml b/spring-security-client/spring-security-jsp-authorize/pom.xml index 427ba7754a..ad4c9d105b 100644 --- a/spring-security-client/spring-security-jsp-authorize/pom.xml +++ b/spring-security-client/spring-security-jsp-authorize/pom.xml @@ -2,13 +2,12 @@ 4.0.0 - com.baeldung spring-security-jsp-authorize 0.0.1-SNAPSHOT - war spring-security-jsp-authorize Spring Security JSP Authorize tag sample + war parent-boot-1 diff --git a/spring-security-client/spring-security-jsp-config/pom.xml b/spring-security-client/spring-security-jsp-config/pom.xml index c0318a2c5c..02ea206738 100644 --- a/spring-security-client/spring-security-jsp-config/pom.xml +++ b/spring-security-client/spring-security-jsp-config/pom.xml @@ -5,9 +5,9 @@ com.baeldung spring-security-jsp-config 0.0.1-SNAPSHOT - war spring-security-jsp-config Spring Security JSP configuration + war parent-boot-1 diff --git a/spring-security-client/spring-security-mvc/pom.xml b/spring-security-client/spring-security-mvc/pom.xml index 6ddc6fbe65..75298026a8 100644 --- a/spring-security-client/spring-security-mvc/pom.xml +++ b/spring-security-client/spring-security-mvc/pom.xml @@ -5,9 +5,9 @@ com.baeldung spring-security-mvc 0.0.1-SNAPSHOT - war spring-security-mvc Spring Security MVC + war parent-boot-1 diff --git a/spring-security-client/spring-security-thymeleaf-authentication/pom.xml b/spring-security-client/spring-security-thymeleaf-authentication/pom.xml index 8e6a352af1..01d2c6bdbe 100644 --- a/spring-security-client/spring-security-thymeleaf-authentication/pom.xml +++ b/spring-security-client/spring-security-thymeleaf-authentication/pom.xml @@ -6,9 +6,9 @@ com.baeldung spring-security-thymeleaf-authentication 0.0.1-SNAPSHOT - war spring-security-thymeleaf-authentication Spring Security thymeleaf authentication tag sample + war parent-boot-1 diff --git a/spring-security-client/spring-security-thymeleaf-authorize/pom.xml b/spring-security-client/spring-security-thymeleaf-authorize/pom.xml index 52972c0241..8c600c1f81 100644 --- a/spring-security-client/spring-security-thymeleaf-authorize/pom.xml +++ b/spring-security-client/spring-security-thymeleaf-authorize/pom.xml @@ -6,9 +6,9 @@ com.baeldung spring-security-thymeleaf-authorize 0.0.1-SNAPSHOT - war spring-security-thymeleaf-authorize Spring Security thymeleaf authorize tag sample + war parent-boot-1 diff --git a/spring-security-client/spring-security-thymeleaf-config/pom.xml b/spring-security-client/spring-security-thymeleaf-config/pom.xml index 668f20c001..aeda999405 100644 --- a/spring-security-client/spring-security-thymeleaf-config/pom.xml +++ b/spring-security-client/spring-security-thymeleaf-config/pom.xml @@ -2,13 +2,12 @@ 4.0.0 - com.baeldung spring-security-thymeleaf-config 0.0.1-SNAPSHOT - war spring-security-thymeleaf-config Spring Security thymeleaf configuration sample project + war parent-boot-1 diff --git a/spring-security-mvc-boot/pom.xml b/spring-security-mvc-boot/pom.xml index 0a40b0b324..00d8f032c2 100644 --- a/spring-security-mvc-boot/pom.xml +++ b/spring-security-mvc-boot/pom.xml @@ -2,12 +2,11 @@ 4.0.0 - com.baeldung spring-security-mvc-boot 0.0.1-SNAPSHOT - war spring-security-mvc-boot + war Spring Security MVC Boot diff --git a/spring-security-mvc-login/pom.xml b/spring-security-mvc-login/pom.xml index 5ee216548a..bbdff6fc2f 100644 --- a/spring-security-mvc-login/pom.xml +++ b/spring-security-mvc-login/pom.xml @@ -1,7 +1,6 @@ 4.0.0 - com.baeldung spring-security-mvc-login 0.1-SNAPSHOT diff --git a/spring-security-mvc-persisted-remember-me/pom.xml b/spring-security-mvc-persisted-remember-me/pom.xml index 8b15e658e8..c65b7a30cb 100644 --- a/spring-security-mvc-persisted-remember-me/pom.xml +++ b/spring-security-mvc-persisted-remember-me/pom.xml @@ -1,7 +1,6 @@ 4.0.0 - com.baeldung spring-security-mvc-persisted-remember-me 0.1-SNAPSHOT diff --git a/spring-security-mvc-session/pom.xml b/spring-security-mvc-session/pom.xml index 85c8475657..03c75b99e2 100644 --- a/spring-security-mvc-session/pom.xml +++ b/spring-security-mvc-session/pom.xml @@ -1,7 +1,6 @@ 4.0.0 - com.baeldung spring-security-mvc-session 0.1-SNAPSHOT diff --git a/spring-security-openid/pom.xml b/spring-security-openid/pom.xml index 4343996e02..0b5eaf6270 100644 --- a/spring-security-openid/pom.xml +++ b/spring-security-openid/pom.xml @@ -2,10 +2,9 @@ 4.0.0 - spring-security-openid - war spring-security-openid + war Spring OpenID sample project diff --git a/spring-security-react/pom.xml b/spring-security-react/pom.xml index 32817945be..eaf10791bc 100644 --- a/spring-security-react/pom.xml +++ b/spring-security-react/pom.xml @@ -3,7 +3,6 @@ 4.0.0 spring-security-react 0.1-SNAPSHOT - spring-security-react war diff --git a/spring-security-rest-custom/pom.xml b/spring-security-rest-custom/pom.xml index 66ad087bf6..8fdcb509ee 100644 --- a/spring-security-rest-custom/pom.xml +++ b/spring-security-rest-custom/pom.xml @@ -1,7 +1,6 @@ 4.0.0 - com.baeldung spring-security-rest-custom 0.1-SNAPSHOT diff --git a/spring-security-sso/pom.xml b/spring-security-sso/pom.xml index 4b297a91b5..707f516da2 100644 --- a/spring-security-sso/pom.xml +++ b/spring-security-sso/pom.xml @@ -4,7 +4,6 @@ org.baeldung spring-security-sso 1.0.0-SNAPSHOT - spring-security-sso pom diff --git a/spring-security-sso/spring-security-sso-auth-server/pom.xml b/spring-security-sso/spring-security-sso-auth-server/pom.xml index ff76f377c6..3c8f04a056 100644 --- a/spring-security-sso/spring-security-sso-auth-server/pom.xml +++ b/spring-security-sso/spring-security-sso-auth-server/pom.xml @@ -1,7 +1,6 @@ 4.0.0 - spring-security-sso-auth-server spring-security-sso-auth-server war @@ -13,12 +12,10 @@ - org.springframework.boot spring-boot-starter-web - org.springframework.security.oauth spring-security-oauth2 diff --git a/spring-security-sso/spring-security-sso-ui-2/pom.xml b/spring-security-sso/spring-security-sso-ui-2/pom.xml index e4ccb82fea..a6cf5e5386 100644 --- a/spring-security-sso/spring-security-sso-ui-2/pom.xml +++ b/spring-security-sso/spring-security-sso-ui-2/pom.xml @@ -1,7 +1,6 @@ 4.0.0 - spring-security-sso-ui-2 spring-security-sso-ui-2 war diff --git a/spring-security-sso/spring-security-sso-ui/pom.xml b/spring-security-sso/spring-security-sso-ui/pom.xml index a946db4c3b..7edcee82c8 100644 --- a/spring-security-sso/spring-security-sso-ui/pom.xml +++ b/spring-security-sso/spring-security-sso-ui/pom.xml @@ -1,7 +1,6 @@ 4.0.0 - spring-security-sso-ui spring-security-sso-ui war diff --git a/spring-security-stormpath/pom.xml b/spring-security-stormpath/pom.xml index 4f19921fbd..dd6037a22c 100644 --- a/spring-security-stormpath/pom.xml +++ b/spring-security-stormpath/pom.xml @@ -3,10 +3,11 @@ 4.0.0 com.baeldung spring-security-stormpath - war 1.0-SNAPSHOT spring-security-stormpath + war http://maven.apache.org + abhinabkanrar@gmail.com diff --git a/spring-security-thymeleaf/pom.xml b/spring-security-thymeleaf/pom.xml index d8b476683a..732eb1dc1d 100644 --- a/spring-security-thymeleaf/pom.xml +++ b/spring-security-thymeleaf/pom.xml @@ -2,12 +2,11 @@ 4.0.0 - com.baeldung spring-security-thymeleaf 0.0.1-SNAPSHOT - jar spring-security-thymeleaf + jar Spring Security with Thymeleaf tutorial diff --git a/spring-security-x509/pom.xml b/spring-security-x509/pom.xml index 658840e866..db7def0c02 100644 --- a/spring-security-x509/pom.xml +++ b/spring-security-x509/pom.xml @@ -5,8 +5,8 @@ com.baeldung spring-security-x509 0.0.1-SNAPSHOT - pom spring-security-x509 + pom parent-boot-1 diff --git a/spring-security-x509/spring-security-x509-basic-auth/pom.xml b/spring-security-x509/spring-security-x509-basic-auth/pom.xml index 5b68a8e63b..0bbd5d3d3d 100644 --- a/spring-security-x509/spring-security-x509-basic-auth/pom.xml +++ b/spring-security-x509/spring-security-x509-basic-auth/pom.xml @@ -4,8 +4,8 @@ 4.0.0 spring-security-x509-basic-auth 0.0.1-SNAPSHOT - jar spring-security-x509-basic-auth + jar Spring x.509 Authentication Demo diff --git a/spring-security-x509/spring-security-x509-client-auth/pom.xml b/spring-security-x509/spring-security-x509-client-auth/pom.xml index 47ec7f971d..3e2e18223a 100644 --- a/spring-security-x509/spring-security-x509-client-auth/pom.xml +++ b/spring-security-x509/spring-security-x509-client-auth/pom.xml @@ -4,8 +4,8 @@ 4.0.0 spring-security-x509-client-auth 0.0.1-SNAPSHOT - jar spring-security-x509-client-auth + jar Spring x.509 Client Authentication Demo diff --git a/spring-session/pom.xml b/spring-session/pom.xml index 28dde40272..bcdbaf2406 100644 --- a/spring-session/pom.xml +++ b/spring-session/pom.xml @@ -4,7 +4,6 @@ org.baeldung spring-session 1.0.0-SNAPSHOT - spring-session pom diff --git a/spring-session/spring-session-jdbc/pom.xml b/spring-session/spring-session-jdbc/pom.xml index ce6b5f5908..a98c4b3429 100644 --- a/spring-session/spring-session-jdbc/pom.xml +++ b/spring-session/spring-session-jdbc/pom.xml @@ -6,8 +6,8 @@ com.baeldung spring-session-jdbc 0.0.1-SNAPSHOT - jar spring-session-jdbc + jar Spring Session with JDBC tutorial diff --git a/spring-sleuth/pom.xml b/spring-sleuth/pom.xml index c693466ab0..2387915c79 100644 --- a/spring-sleuth/pom.xml +++ b/spring-sleuth/pom.xml @@ -5,8 +5,8 @@ com.baeldung spring-sleuth 1.0.0-SNAPSHOT - jar spring-sleuth + jar parent-boot-2 diff --git a/spring-social-login/pom.xml b/spring-social-login/pom.xml index 6b7b90443a..e948c908d4 100644 --- a/spring-social-login/pom.xml +++ b/spring-social-login/pom.xml @@ -1,7 +1,6 @@ 4.0.0 - spring-social-login spring-social-login war diff --git a/spring-static-resources/pom.xml b/spring-static-resources/pom.xml index 92f6616839..aedf88e384 100644 --- a/spring-static-resources/pom.xml +++ b/spring-static-resources/pom.xml @@ -5,8 +5,8 @@ com.baeldung spring-static-resources 0.1.0-SNAPSHOT - war spring-static-resources + war com.baeldung diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/pom.xml b/spring-swagger-codegen/spring-swagger-codegen-api-client/pom.xml index c175ea48b3..320745b6e5 100644 --- a/spring-swagger-codegen/spring-swagger-codegen-api-client/pom.xml +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/pom.xml @@ -1,12 +1,12 @@ 4.0.0 - spring-swagger-codegen-api-client - jar spring-swagger-codegen-api-client https://github.com/swagger-api/swagger-codegen Swagger Java + jar + scm:git:git@github.com:swagger-api/swagger-codegen.git scm:git:git@github.com:swagger-api/swagger-codegen.git @@ -20,6 +20,7 @@ repo + Swagger diff --git a/spring-thymeleaf/pom.xml b/spring-thymeleaf/pom.xml index 78f95fe1df..cdc2ed25ae 100644 --- a/spring-thymeleaf/pom.xml +++ b/spring-thymeleaf/pom.xml @@ -4,8 +4,8 @@ com.baeldung spring-thymeleaf 0.1-SNAPSHOT - war spring-thymeleaf + war com.baeldung diff --git a/spring-vault/pom.xml b/spring-vault/pom.xml index aad6da1cc3..ccad71c024 100644 --- a/spring-vault/pom.xml +++ b/spring-vault/pom.xml @@ -4,12 +4,11 @@ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - com.baeldung spring-vault 0.0.1-SNAPSHOT - jar spring-vault + jar Spring Vault sample project diff --git a/spring-vertx/pom.xml b/spring-vertx/pom.xml index 7a0bdc81d0..1a0e1c0223 100644 --- a/spring-vertx/pom.xml +++ b/spring-vertx/pom.xml @@ -3,9 +3,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-vertx - jar spring-vertx A demo project with vertx spring integration + jar parent-boot-2 diff --git a/spring-webflux-amqp/pom.xml b/spring-webflux-amqp/pom.xml index 0868e14717..a8346458a0 100755 --- a/spring-webflux-amqp/pom.xml +++ b/spring-webflux-amqp/pom.xml @@ -2,12 +2,11 @@ 4.0.0 - org.baeldung.spring spring-webflux-amqp 1.0.0-SNAPSHOT - jar spring-webflux-amqp + jar Spring WebFlux AMQP Sample diff --git a/spring-zuul/pom.xml b/spring-zuul/pom.xml index a8c891cd89..d00a932168 100644 --- a/spring-zuul/pom.xml +++ b/spring-zuul/pom.xml @@ -2,7 +2,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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-zuul 1.0.0-SNAPSHOT diff --git a/spring-zuul/spring-zuul-foos-resource/pom.xml b/spring-zuul/spring-zuul-foos-resource/pom.xml index 70e39db4aa..4fe4e1dbbc 100644 --- a/spring-zuul/spring-zuul-foos-resource/pom.xml +++ b/spring-zuul/spring-zuul-foos-resource/pom.xml @@ -1,7 +1,6 @@ 4.0.0 - spring-zuul-foos-resource spring-zuul-foos-resource war diff --git a/spring-zuul/spring-zuul-ui/pom.xml b/spring-zuul/spring-zuul-ui/pom.xml index 159decd331..619e6c6b78 100644 --- a/spring-zuul/spring-zuul-ui/pom.xml +++ b/spring-zuul/spring-zuul-ui/pom.xml @@ -1,7 +1,6 @@ 4.0.0 - spring-zuul-ui spring-zuul-ui war diff --git a/stripe/pom.xml b/stripe/pom.xml index 1e13612fb5..b0cb194bfe 100644 --- a/stripe/pom.xml +++ b/stripe/pom.xml @@ -2,13 +2,12 @@ 4.0.0 - com.baeldung.stripe stripe 0.0.1-SNAPSHOT - jar Stripe Demo project for Stripe API + jar parent-boot-1 diff --git a/struts-2/pom.xml b/struts-2/pom.xml index ac8579d9e0..7f0fba727d 100644 --- a/struts-2/pom.xml +++ b/struts-2/pom.xml @@ -4,8 +4,8 @@ com.baeldung struts-2 0.0.1-SNAPSHOT - pom struts-2 + pom com.baeldung diff --git a/testing-modules/groovy-spock/pom.xml b/testing-modules/groovy-spock/pom.xml index 3dd01c29ab..2a058e5358 100644 --- a/testing-modules/groovy-spock/pom.xml +++ b/testing-modules/groovy-spock/pom.xml @@ -5,8 +5,8 @@ org.spockframework groovy-spock 1.0-SNAPSHOT - jar groovy-spock + jar com.baeldung diff --git a/testing-modules/junit5-migration/pom.xml b/testing-modules/junit5-migration/pom.xml index 9d9d418774..536953afc8 100644 --- a/testing-modules/junit5-migration/pom.xml +++ b/testing-modules/junit5-migration/pom.xml @@ -1,9 +1,7 @@ - 4.0.0 - junit5-migration 1.0-SNAPSHOT junit5-migration diff --git a/testing-modules/load-testing-comparison/pom.xml b/testing-modules/load-testing-comparison/pom.xml index 42614d310b..63472d0467 100644 --- a/testing-modules/load-testing-comparison/pom.xml +++ b/testing-modules/load-testing-comparison/pom.xml @@ -13,19 +13,6 @@ ../../pom.xml - - 1.8 - 1.8 - UTF-8 - 2.11.12 - 2.2.5 - 3.2.2 - 2.2.1 - 5.0 - 3.11 - 2.0.5.RELEASE - - io.gatling @@ -146,4 +133,18 @@ + + + 1.8 + 1.8 + UTF-8 + 2.11.12 + 2.2.5 + 3.2.2 + 2.2.1 + 5.0 + 3.11 + 2.0.5.RELEASE + + \ No newline at end of file diff --git a/testing-modules/mockito-2/pom.xml b/testing-modules/mockito-2/pom.xml index 5f60566566..e319dd9edd 100644 --- a/testing-modules/mockito-2/pom.xml +++ b/testing-modules/mockito-2/pom.xml @@ -4,8 +4,8 @@ com.baeldung mockito-2 0.0.1-SNAPSHOT - jar mockito-2 + jar com.baeldung diff --git a/testing-modules/mocks/pom.xml b/testing-modules/mocks/pom.xml index 6473f07c13..ecc8b61a6d 100644 --- a/testing-modules/mocks/pom.xml +++ b/testing-modules/mocks/pom.xml @@ -1,6 +1,9 @@ 4.0.0 + mocks + mocks + pom com.baeldung @@ -9,10 +12,6 @@ ../../ - mocks - mocks - pom - mock-comparisons jmockit diff --git a/testing-modules/parallel-tests-junit/math-test-functions/pom.xml b/testing-modules/parallel-tests-junit/math-test-functions/pom.xml index 18d2b562f3..a3569714ef 100644 --- a/testing-modules/parallel-tests-junit/math-test-functions/pom.xml +++ b/testing-modules/parallel-tests-junit/math-test-functions/pom.xml @@ -4,17 +4,16 @@ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 + math-test-functions + math-test-functions + http://maven.apache.org + com.baeldung parallel-tests-junit 0.0.1-SNAPSHOT - math-test-functions - math-test-functions - http://maven.apache.org - - UTF-8 - + junit @@ -23,6 +22,7 @@ test + @@ -45,4 +45,8 @@ + + + UTF-8 + diff --git a/testing-modules/parallel-tests-junit/pom.xml b/testing-modules/parallel-tests-junit/pom.xml index ecca8b3930..f400a5ae07 100644 --- a/testing-modules/parallel-tests-junit/pom.xml +++ b/testing-modules/parallel-tests-junit/pom.xml @@ -1,14 +1,15 @@ - 4.0.0 - com.baeldung - parallel-tests-junit - 0.0.1-SNAPSHOT - pom - parallel-tests-junit - - - math-test-functions - string-test-functions - + 4.0.0 + com.baeldung + parallel-tests-junit + 0.0.1-SNAPSHOT + parallel-tests-junit + pom + + + math-test-functions + string-test-functions + + diff --git a/testing-modules/parallel-tests-junit/string-test-functions/pom.xml b/testing-modules/parallel-tests-junit/string-test-functions/pom.xml index af61cfce8e..7fa09ff493 100644 --- a/testing-modules/parallel-tests-junit/string-test-functions/pom.xml +++ b/testing-modules/parallel-tests-junit/string-test-functions/pom.xml @@ -4,17 +4,15 @@ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 + string-test-functions + string-test-functions + http://maven.apache.org + com.baeldung parallel-tests-junit 0.0.1-SNAPSHOT - string-test-functions - string-test-functions - http://maven.apache.org - - UTF-8 - @@ -24,6 +22,7 @@ test + @@ -38,4 +37,8 @@ + + + UTF-8 + diff --git a/testing-modules/rest-testing/pom.xml b/testing-modules/rest-testing/pom.xml index 2fa303a98e..2b1f146f0f 100644 --- a/testing-modules/rest-testing/pom.xml +++ b/testing-modules/rest-testing/pom.xml @@ -1,7 +1,6 @@ 4.0.0 - com.baeldung rest-testing 0.1-SNAPSHOT diff --git a/testing-modules/testng/pom.xml b/testing-modules/testng/pom.xml index a9f680aafb..8389604717 100644 --- a/testing-modules/testng/pom.xml +++ b/testing-modules/testng/pom.xml @@ -4,8 +4,8 @@ 4.0.0 testng 0.1.0-SNAPSHOT - jar testng + jar com.baeldung diff --git a/undertow/pom.xml b/undertow/pom.xml index d000956aee..1c2cc3aa36 100644 --- a/undertow/pom.xml +++ b/undertow/pom.xml @@ -1,12 +1,11 @@ 4.0.0 - com.baeldung.undertow undertow - jar 1.0-SNAPSHOT undertow + jar http://maven.apache.org diff --git a/vaadin/pom.xml b/vaadin/pom.xml index c34ffa3636..d24b3dff1b 100644 --- a/vaadin/pom.xml +++ b/vaadin/pom.xml @@ -2,12 +2,11 @@ 4.0.0 - org.test vaadin - war 1.0-SNAPSHOT Vaadin + war parent-boot-2 diff --git a/vertx/pom.xml b/vertx/pom.xml index 7e494c5914..befd4c45bb 100644 --- a/vertx/pom.xml +++ b/vertx/pom.xml @@ -2,7 +2,6 @@ 4.0.0 - com.baeldung vertx 1.0-SNAPSHOT diff --git a/video-tutorials/pom.xml b/video-tutorials/pom.xml index ca3b39904f..a798f77863 100644 --- a/video-tutorials/pom.xml +++ b/video-tutorials/pom.xml @@ -1,12 +1,11 @@ 4.0.0 - com.baeldung video-tutorials 1.0.0-SNAPSHOT - pom video-tutorials + pom com.baeldung diff --git a/vraptor/pom.xml b/vraptor/pom.xml index 97005bd158..214a44cede 100644 --- a/vraptor/pom.xml +++ b/vraptor/pom.xml @@ -4,8 +4,8 @@ com.baeldung vraptor 1.0.0 - war vraptor + war A demo project to start using VRaptor 4 diff --git a/wicket/pom.xml b/wicket/pom.xml index 99be467167..80c728e3a5 100644 --- a/wicket/pom.xml +++ b/wicket/pom.xml @@ -2,12 +2,11 @@ 4.0.0 - com.baeldung.wicket.examples wicket - war 1.0-SNAPSHOT Wicket + war com.baeldung diff --git a/xstream/pom.xml b/xstream/pom.xml index 64c8198082..f75e10fc7d 100644 --- a/xstream/pom.xml +++ b/xstream/pom.xml @@ -1,7 +1,6 @@ 4.0.0 - org.baeldung xstream 0.0.1-SNAPSHOT From 312f633d15216647e042e6717210e0cc9a621e90 Mon Sep 17 00:00:00 2001 From: Juan Moreno Date: Sun, 10 Feb 2019 01:54:51 -0300 Subject: [PATCH 129/143] BAEL-2490 Code samples (#6211) * Added initial samples * Added initial samples * Awaitility updated --- spring-5/pom.xml | 8 ++++++- .../com/baeldung/config/ScheduledConfig.java | 11 +++++++++ .../java/com/baeldung/scheduled/Counter.java | 20 ++++++++++++++++ .../ScheduledAwaitilityIntegrationTest.java | 24 +++++++++++++++++++ .../scheduled/ScheduledIntegrationTest.java | 22 +++++++++++++++++ 5 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 spring-5/src/main/java/com/baeldung/config/ScheduledConfig.java create mode 100644 spring-5/src/main/java/com/baeldung/scheduled/Counter.java create mode 100644 spring-5/src/test/java/com/baeldung/scheduled/ScheduledAwaitilityIntegrationTest.java create mode 100644 spring-5/src/test/java/com/baeldung/scheduled/ScheduledIntegrationTest.java diff --git a/spring-5/pom.xml b/spring-5/pom.xml index 58c14475e0..b4b12e5c79 100644 --- a/spring-5/pom.xml +++ b/spring-5/pom.xml @@ -89,6 +89,12 @@ org.junit.jupiter junit-jupiter-api + + org.awaitility + awaitility + ${awaitility.version} + test + org.springframework.restdocs @@ -156,7 +162,7 @@ 4.1 ${project.build.directory}/generated-snippets 2.21.0 - + 3.1.6 diff --git a/spring-5/src/main/java/com/baeldung/config/ScheduledConfig.java b/spring-5/src/main/java/com/baeldung/config/ScheduledConfig.java new file mode 100644 index 0000000000..b54a2b5339 --- /dev/null +++ b/spring-5/src/main/java/com/baeldung/config/ScheduledConfig.java @@ -0,0 +1,11 @@ +package com.baeldung.config; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.EnableScheduling; + +@Configuration +@EnableScheduling +@ComponentScan("com.baeldung.scheduled") +public class ScheduledConfig { +} diff --git a/spring-5/src/main/java/com/baeldung/scheduled/Counter.java b/spring-5/src/main/java/com/baeldung/scheduled/Counter.java new file mode 100644 index 0000000000..17aa15b6f3 --- /dev/null +++ b/spring-5/src/main/java/com/baeldung/scheduled/Counter.java @@ -0,0 +1,20 @@ +package com.baeldung.scheduled; + +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.util.concurrent.atomic.AtomicInteger; + +@Component +public class Counter { + private final AtomicInteger count = new AtomicInteger(0); + + @Scheduled(fixedDelay = 5) + public void scheduled() { + this.count.incrementAndGet(); + } + + public int getInvocationCount() { + return this.count.get(); + } +} diff --git a/spring-5/src/test/java/com/baeldung/scheduled/ScheduledAwaitilityIntegrationTest.java b/spring-5/src/test/java/com/baeldung/scheduled/ScheduledAwaitilityIntegrationTest.java new file mode 100644 index 0000000000..4883aa16c2 --- /dev/null +++ b/spring-5/src/test/java/com/baeldung/scheduled/ScheduledAwaitilityIntegrationTest.java @@ -0,0 +1,24 @@ +package com.baeldung.scheduled; + +import com.baeldung.config.ScheduledConfig; +import org.awaitility.Duration; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.mock.mockito.SpyBean; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; + +import static org.awaitility.Awaitility.await; +import static org.mockito.Mockito.atLeast; +import static org.mockito.Mockito.verify; + +@SpringJUnitConfig(ScheduledConfig.class) +public class ScheduledAwaitilityIntegrationTest { + + @SpyBean private Counter counter; + + @Test + public void whenWaitOneSecond_thenScheduledIsCalledAtLeastTenTimes() { + await() + .atMost(Duration.ONE_SECOND) + .untilAsserted(() -> verify(counter, atLeast(10)).scheduled()); + } +} diff --git a/spring-5/src/test/java/com/baeldung/scheduled/ScheduledIntegrationTest.java b/spring-5/src/test/java/com/baeldung/scheduled/ScheduledIntegrationTest.java new file mode 100644 index 0000000000..058cd50caa --- /dev/null +++ b/spring-5/src/test/java/com/baeldung/scheduled/ScheduledIntegrationTest.java @@ -0,0 +1,22 @@ +package com.baeldung.scheduled; + +import com.baeldung.config.ScheduledConfig; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; + +import static org.assertj.core.api.Assertions.assertThat; + +@SpringJUnitConfig(ScheduledConfig.class) +public class ScheduledIntegrationTest { + + @Autowired Counter counter; + + @Test + public void givenSleepBy100ms_whenGetInvocationCount_thenIsGreaterThanZero() throws InterruptedException { + Thread.sleep(100L); + + assertThat(counter.getInvocationCount()).isGreaterThan(0); + } + +} From 68ea49996b04a633fcefa2ce3d35d59dd2a19d43 Mon Sep 17 00:00:00 2001 From: Loredana Date: Sun, 10 Feb 2019 18:24:45 +0200 Subject: [PATCH 130/143] update solid ex --- patterns/pom.xml | 1 + .../src/main/java/com/baeldung/d/Keyboard.java | 4 ---- patterns/{principles => }/solid/pom.xml | 17 +++++++---------- .../src/main/java/com/baeldung/d/Keyboard.java | 4 ++++ .../src/main/java/com/baeldung/d/Monitor.java | 0 .../java/com/baeldung/d/StandardKeyboard.java | 5 +++++ .../java/com/baeldung/d/Windows98Machine.java | 4 ++-- .../java/com/baeldung/d/Windows98MachineDI.java | 0 .../src/main/java/com/baeldung/i/BearCarer.java | 0 .../main/java/com/baeldung/i/BearCleaner.java | 0 .../main/java/com/baeldung/i/BearFeeder.java | 0 .../main/java/com/baeldung/i/BearKeeper.java | 0 .../main/java/com/baeldung/i/BearPetter.java | 0 .../main/java/com/baeldung/i/CrazyPerson.java | 0 .../solid/src/main/java/com/baeldung/l/Car.java | 0 .../main/java/com/baeldung/l/ElectricCar.java | 0 .../src/main/java/com/baeldung/l/Engine.java | 0 .../src/main/java/com/baeldung/l/MotorCar.java | 0 .../src/main/java/com/baeldung/o/Guitar.java | 0 .../baeldung/o/SuperCoolGuitarWithFlames.java | 0 .../src/main/java/com/baeldung/s/BadBook.java | 0 .../main/java/com/baeldung/s/BookPrinter.java | 0 .../src/main/java/com/baeldung/s/GoodBook.java | 0 23 files changed, 19 insertions(+), 16 deletions(-) delete mode 100644 patterns/principles/solid/src/main/java/com/baeldung/d/Keyboard.java rename patterns/{principles => }/solid/pom.xml (54%) create mode 100644 patterns/solid/src/main/java/com/baeldung/d/Keyboard.java rename patterns/{principles => }/solid/src/main/java/com/baeldung/d/Monitor.java (100%) create mode 100644 patterns/solid/src/main/java/com/baeldung/d/StandardKeyboard.java rename patterns/{principles => }/solid/src/main/java/com/baeldung/d/Windows98Machine.java (66%) rename patterns/{principles => }/solid/src/main/java/com/baeldung/d/Windows98MachineDI.java (100%) rename patterns/{principles => }/solid/src/main/java/com/baeldung/i/BearCarer.java (100%) rename patterns/{principles => }/solid/src/main/java/com/baeldung/i/BearCleaner.java (100%) rename patterns/{principles => }/solid/src/main/java/com/baeldung/i/BearFeeder.java (100%) rename patterns/{principles => }/solid/src/main/java/com/baeldung/i/BearKeeper.java (100%) rename patterns/{principles => }/solid/src/main/java/com/baeldung/i/BearPetter.java (100%) rename patterns/{principles => }/solid/src/main/java/com/baeldung/i/CrazyPerson.java (100%) rename patterns/{principles => }/solid/src/main/java/com/baeldung/l/Car.java (100%) rename patterns/{principles => }/solid/src/main/java/com/baeldung/l/ElectricCar.java (100%) rename patterns/{principles => }/solid/src/main/java/com/baeldung/l/Engine.java (100%) rename patterns/{principles => }/solid/src/main/java/com/baeldung/l/MotorCar.java (100%) rename patterns/{principles => }/solid/src/main/java/com/baeldung/o/Guitar.java (100%) rename patterns/{principles => }/solid/src/main/java/com/baeldung/o/SuperCoolGuitarWithFlames.java (100%) rename patterns/{principles => }/solid/src/main/java/com/baeldung/s/BadBook.java (100%) rename patterns/{principles => }/solid/src/main/java/com/baeldung/s/BookPrinter.java (100%) rename patterns/{principles => }/solid/src/main/java/com/baeldung/s/GoodBook.java (100%) diff --git a/patterns/pom.xml b/patterns/pom.xml index bc1f5173e2..3c3bb6d5ea 100644 --- a/patterns/pom.xml +++ b/patterns/pom.xml @@ -17,6 +17,7 @@ front-controller intercepting-filter design-patterns + solid diff --git a/patterns/principles/solid/src/main/java/com/baeldung/d/Keyboard.java b/patterns/principles/solid/src/main/java/com/baeldung/d/Keyboard.java deleted file mode 100644 index acb50cedb4..0000000000 --- a/patterns/principles/solid/src/main/java/com/baeldung/d/Keyboard.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.baeldung.d; - -public class Keyboard { -} diff --git a/patterns/principles/solid/pom.xml b/patterns/solid/pom.xml similarity index 54% rename from patterns/principles/solid/pom.xml rename to patterns/solid/pom.xml index 5d308f5120..2837504197 100644 --- a/patterns/principles/solid/pom.xml +++ b/patterns/solid/pom.xml @@ -4,17 +4,14 @@ 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 - solid/artifactId> + solid 1.0-SNAPSHOT - - - - junit - junit - 4.12 - test - - + + com.baeldung + patterns + 1.0.0-SNAPSHOT + .. + diff --git a/patterns/solid/src/main/java/com/baeldung/d/Keyboard.java b/patterns/solid/src/main/java/com/baeldung/d/Keyboard.java new file mode 100644 index 0000000000..cc6fc47d65 --- /dev/null +++ b/patterns/solid/src/main/java/com/baeldung/d/Keyboard.java @@ -0,0 +1,4 @@ +package com.baeldung.d; + +public interface Keyboard { +} diff --git a/patterns/principles/solid/src/main/java/com/baeldung/d/Monitor.java b/patterns/solid/src/main/java/com/baeldung/d/Monitor.java similarity index 100% rename from patterns/principles/solid/src/main/java/com/baeldung/d/Monitor.java rename to patterns/solid/src/main/java/com/baeldung/d/Monitor.java diff --git a/patterns/solid/src/main/java/com/baeldung/d/StandardKeyboard.java b/patterns/solid/src/main/java/com/baeldung/d/StandardKeyboard.java new file mode 100644 index 0000000000..cb0e229943 --- /dev/null +++ b/patterns/solid/src/main/java/com/baeldung/d/StandardKeyboard.java @@ -0,0 +1,5 @@ +package com.baeldung.d; + +public class StandardKeyboard implements Keyboard { + +} diff --git a/patterns/principles/solid/src/main/java/com/baeldung/d/Windows98Machine.java b/patterns/solid/src/main/java/com/baeldung/d/Windows98Machine.java similarity index 66% rename from patterns/principles/solid/src/main/java/com/baeldung/d/Windows98Machine.java rename to patterns/solid/src/main/java/com/baeldung/d/Windows98Machine.java index a9f130aedb..4d6ead9aa2 100644 --- a/patterns/principles/solid/src/main/java/com/baeldung/d/Windows98Machine.java +++ b/patterns/solid/src/main/java/com/baeldung/d/Windows98Machine.java @@ -2,13 +2,13 @@ package com.baeldung.d; public class Windows98Machine { - private final Keyboard keyboard; + private final StandardKeyboard keyboard; private final Monitor monitor; public Windows98Machine() { monitor = new Monitor(); - keyboard = new Keyboard(); + keyboard = new StandardKeyboard(); } diff --git a/patterns/principles/solid/src/main/java/com/baeldung/d/Windows98MachineDI.java b/patterns/solid/src/main/java/com/baeldung/d/Windows98MachineDI.java similarity index 100% rename from patterns/principles/solid/src/main/java/com/baeldung/d/Windows98MachineDI.java rename to patterns/solid/src/main/java/com/baeldung/d/Windows98MachineDI.java diff --git a/patterns/principles/solid/src/main/java/com/baeldung/i/BearCarer.java b/patterns/solid/src/main/java/com/baeldung/i/BearCarer.java similarity index 100% rename from patterns/principles/solid/src/main/java/com/baeldung/i/BearCarer.java rename to patterns/solid/src/main/java/com/baeldung/i/BearCarer.java diff --git a/patterns/principles/solid/src/main/java/com/baeldung/i/BearCleaner.java b/patterns/solid/src/main/java/com/baeldung/i/BearCleaner.java similarity index 100% rename from patterns/principles/solid/src/main/java/com/baeldung/i/BearCleaner.java rename to patterns/solid/src/main/java/com/baeldung/i/BearCleaner.java diff --git a/patterns/principles/solid/src/main/java/com/baeldung/i/BearFeeder.java b/patterns/solid/src/main/java/com/baeldung/i/BearFeeder.java similarity index 100% rename from patterns/principles/solid/src/main/java/com/baeldung/i/BearFeeder.java rename to patterns/solid/src/main/java/com/baeldung/i/BearFeeder.java diff --git a/patterns/principles/solid/src/main/java/com/baeldung/i/BearKeeper.java b/patterns/solid/src/main/java/com/baeldung/i/BearKeeper.java similarity index 100% rename from patterns/principles/solid/src/main/java/com/baeldung/i/BearKeeper.java rename to patterns/solid/src/main/java/com/baeldung/i/BearKeeper.java diff --git a/patterns/principles/solid/src/main/java/com/baeldung/i/BearPetter.java b/patterns/solid/src/main/java/com/baeldung/i/BearPetter.java similarity index 100% rename from patterns/principles/solid/src/main/java/com/baeldung/i/BearPetter.java rename to patterns/solid/src/main/java/com/baeldung/i/BearPetter.java diff --git a/patterns/principles/solid/src/main/java/com/baeldung/i/CrazyPerson.java b/patterns/solid/src/main/java/com/baeldung/i/CrazyPerson.java similarity index 100% rename from patterns/principles/solid/src/main/java/com/baeldung/i/CrazyPerson.java rename to patterns/solid/src/main/java/com/baeldung/i/CrazyPerson.java diff --git a/patterns/principles/solid/src/main/java/com/baeldung/l/Car.java b/patterns/solid/src/main/java/com/baeldung/l/Car.java similarity index 100% rename from patterns/principles/solid/src/main/java/com/baeldung/l/Car.java rename to patterns/solid/src/main/java/com/baeldung/l/Car.java diff --git a/patterns/principles/solid/src/main/java/com/baeldung/l/ElectricCar.java b/patterns/solid/src/main/java/com/baeldung/l/ElectricCar.java similarity index 100% rename from patterns/principles/solid/src/main/java/com/baeldung/l/ElectricCar.java rename to patterns/solid/src/main/java/com/baeldung/l/ElectricCar.java diff --git a/patterns/principles/solid/src/main/java/com/baeldung/l/Engine.java b/patterns/solid/src/main/java/com/baeldung/l/Engine.java similarity index 100% rename from patterns/principles/solid/src/main/java/com/baeldung/l/Engine.java rename to patterns/solid/src/main/java/com/baeldung/l/Engine.java diff --git a/patterns/principles/solid/src/main/java/com/baeldung/l/MotorCar.java b/patterns/solid/src/main/java/com/baeldung/l/MotorCar.java similarity index 100% rename from patterns/principles/solid/src/main/java/com/baeldung/l/MotorCar.java rename to patterns/solid/src/main/java/com/baeldung/l/MotorCar.java diff --git a/patterns/principles/solid/src/main/java/com/baeldung/o/Guitar.java b/patterns/solid/src/main/java/com/baeldung/o/Guitar.java similarity index 100% rename from patterns/principles/solid/src/main/java/com/baeldung/o/Guitar.java rename to patterns/solid/src/main/java/com/baeldung/o/Guitar.java diff --git a/patterns/principles/solid/src/main/java/com/baeldung/o/SuperCoolGuitarWithFlames.java b/patterns/solid/src/main/java/com/baeldung/o/SuperCoolGuitarWithFlames.java similarity index 100% rename from patterns/principles/solid/src/main/java/com/baeldung/o/SuperCoolGuitarWithFlames.java rename to patterns/solid/src/main/java/com/baeldung/o/SuperCoolGuitarWithFlames.java diff --git a/patterns/principles/solid/src/main/java/com/baeldung/s/BadBook.java b/patterns/solid/src/main/java/com/baeldung/s/BadBook.java similarity index 100% rename from patterns/principles/solid/src/main/java/com/baeldung/s/BadBook.java rename to patterns/solid/src/main/java/com/baeldung/s/BadBook.java diff --git a/patterns/principles/solid/src/main/java/com/baeldung/s/BookPrinter.java b/patterns/solid/src/main/java/com/baeldung/s/BookPrinter.java similarity index 100% rename from patterns/principles/solid/src/main/java/com/baeldung/s/BookPrinter.java rename to patterns/solid/src/main/java/com/baeldung/s/BookPrinter.java diff --git a/patterns/principles/solid/src/main/java/com/baeldung/s/GoodBook.java b/patterns/solid/src/main/java/com/baeldung/s/GoodBook.java similarity index 100% rename from patterns/principles/solid/src/main/java/com/baeldung/s/GoodBook.java rename to patterns/solid/src/main/java/com/baeldung/s/GoodBook.java From ac06100e1b1a5d2be89fffaf24c1b239d64b5524 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 10 Feb 2019 18:32:25 +0200 Subject: [PATCH 131/143] Create README.md --- patterns/principles/solid/README.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 patterns/principles/solid/README.md diff --git a/patterns/principles/solid/README.md b/patterns/principles/solid/README.md new file mode 100644 index 0000000000..e2d72ecd28 --- /dev/null +++ b/patterns/principles/solid/README.md @@ -0,0 +1,5 @@ +### Relevant Articles: + +- [A Guide to Solid Principles](https://www.baeldung.com/solid-principles) + + From c0f72ffa88871edd7cd1ad7cb0420f7623b1249b Mon Sep 17 00:00:00 2001 From: Loredana Date: Sun, 10 Feb 2019 19:00:55 +0200 Subject: [PATCH 132/143] update meth ref ex --- ...ceExamples.java => MethodReferenceUnitTest.java} | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) rename core-java-8/src/test/java/com/baeldung/java8/lambda/methodreference/{MethodReferenceExamples.java => MethodReferenceUnitTest.java} (89%) diff --git a/core-java-8/src/test/java/com/baeldung/java8/lambda/methodreference/MethodReferenceExamples.java b/core-java-8/src/test/java/com/baeldung/java8/lambda/methodreference/MethodReferenceUnitTest.java similarity index 89% rename from core-java-8/src/test/java/com/baeldung/java8/lambda/methodreference/MethodReferenceExamples.java rename to core-java-8/src/test/java/com/baeldung/java8/lambda/methodreference/MethodReferenceUnitTest.java index ede0ef9f70..835815aecd 100644 --- a/core-java-8/src/test/java/com/baeldung/java8/lambda/methodreference/MethodReferenceExamples.java +++ b/core-java-8/src/test/java/com/baeldung/java8/lambda/methodreference/MethodReferenceUnitTest.java @@ -5,22 +5,21 @@ import java.util.Arrays; import java.util.List; import java.util.function.BiFunction; +import org.apache.commons.lang3.StringUtils; import org.junit.Test; -public class MethodReferenceExamples { +public class MethodReferenceUnitTest { private static void doNothingAtAll(Object... o) { } ; - + @Test public void referenceToStaticMethod() { List messages = Arrays.asList("Hello", "Baeldung", "readers!"); - messages.forEach((word) -> { - System.out.println(word); - }); - messages.forEach(System.out::println); + messages.forEach(word -> StringUtils.capitalize(word)); + messages.forEach(StringUtils::capitalize); } @Test @@ -63,7 +62,7 @@ public class MethodReferenceExamples { @Test public void limitationsAndAdditionalExamples() { createBicyclesList().forEach(b -> System.out.printf("Bike brand is '%s' and frame size is '%d'%n", b.getBrand(), b.getFrameSize())); - createBicyclesList().forEach((o) -> MethodReferenceExamples.doNothingAtAll(o)); + createBicyclesList().forEach((o) -> MethodReferenceUnitTest.doNothingAtAll(o)); } private List createBicyclesList() { From 31f858f3baaa46d1e6d459b42a18166d60ecfa1d Mon Sep 17 00:00:00 2001 From: ciro Date: Sun, 10 Feb 2019 17:12:04 -0800 Subject: [PATCH 133/143] review changes --- spring-soap/pom.xml | 2 +- .../com/baeldung/springsoap/gen/Country.java | 144 ------------------ .../com/baeldung/springsoap/gen/Currency.java | 47 ------ .../springsoap/gen/GetCountryRequest.java | 71 --------- .../springsoap/gen/GetCountryResponse.java | 71 --------- .../springsoap/gen/ObjectFactory.java | 63 -------- .../baeldung/springsoap/gen/package-info.java | 9 -- .../ApplicationIntegrationTest.java | 1 - 8 files changed, 1 insertion(+), 407 deletions(-) delete mode 100644 spring-soap/src/main/java/com/baeldung/springsoap/gen/Country.java delete mode 100644 spring-soap/src/main/java/com/baeldung/springsoap/gen/Currency.java delete mode 100644 spring-soap/src/main/java/com/baeldung/springsoap/gen/GetCountryRequest.java delete mode 100644 spring-soap/src/main/java/com/baeldung/springsoap/gen/GetCountryResponse.java delete mode 100644 spring-soap/src/main/java/com/baeldung/springsoap/gen/ObjectFactory.java delete mode 100644 spring-soap/src/main/java/com/baeldung/springsoap/gen/package-info.java diff --git a/spring-soap/pom.xml b/spring-soap/pom.xml index 68ea7711fc..2865a4c3bc 100644 --- a/spring-soap/pom.xml +++ b/spring-soap/pom.xml @@ -10,7 +10,7 @@ org.springframework.boot spring-boot-starter-parent - 2.0.5.RELEASE + 2.1.2.RELEASE diff --git a/spring-soap/src/main/java/com/baeldung/springsoap/gen/Country.java b/spring-soap/src/main/java/com/baeldung/springsoap/gen/Country.java deleted file mode 100644 index e3eb686d6b..0000000000 --- a/spring-soap/src/main/java/com/baeldung/springsoap/gen/Country.java +++ /dev/null @@ -1,144 +0,0 @@ -// -// Questo file è stato generato dall'architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.7 -// Vedere http://java.sun.com/xml/jaxb -// Qualsiasi modifica a questo file andrà persa durante la ricompilazione dello schema di origine. -// Generato il: 2019.01.25 alle 06:06:58 PM PST -// - - -package com.baeldung.springsoap.gen; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

    Classe Java per country complex type. - * - *

    Il seguente frammento di schema specifica il contenuto previsto contenuto in questa classe. - * - *

    - * <complexType name="country">
    - *   <complexContent>
    - *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    - *       <sequence>
    - *         <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
    - *         <element name="population" type="{http://www.w3.org/2001/XMLSchema}int"/>
    - *         <element name="capital" type="{http://www.w3.org/2001/XMLSchema}string"/>
    - *         <element name="currency" type="{http://www.baeldung.com/springsoap/gen}currency"/>
    - *       </sequence>
    - *     </restriction>
    - *   </complexContent>
    - * </complexType>
    - * 
    - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "country", propOrder = { - "name", - "population", - "capital", - "currency" -}) -public class Country { - - @XmlElement(required = true) - protected String name; - protected int population; - @XmlElement(required = true) - protected String capital; - @XmlElement(required = true) - protected Currency currency; - - /** - * Recupera il valore della proprietà name. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - return name; - } - - /** - * Imposta il valore della proprietà name. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - - /** - * Recupera il valore della proprietà population. - * - */ - public int getPopulation() { - return population; - } - - /** - * Imposta il valore della proprietà population. - * - */ - public void setPopulation(int value) { - this.population = value; - } - - /** - * Recupera il valore della proprietà capital. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCapital() { - return capital; - } - - /** - * Imposta il valore della proprietà capital. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCapital(String value) { - this.capital = value; - } - - /** - * Recupera il valore della proprietà currency. - * - * @return - * possible object is - * {@link Currency } - * - */ - public Currency getCurrency() { - return currency; - } - - /** - * Imposta il valore della proprietà currency. - * - * @param value - * allowed object is - * {@link Currency } - * - */ - public void setCurrency(Currency value) { - this.currency = value; - } - -} diff --git a/spring-soap/src/main/java/com/baeldung/springsoap/gen/Currency.java b/spring-soap/src/main/java/com/baeldung/springsoap/gen/Currency.java deleted file mode 100644 index 9b0660466f..0000000000 --- a/spring-soap/src/main/java/com/baeldung/springsoap/gen/Currency.java +++ /dev/null @@ -1,47 +0,0 @@ -// -// Questo file è stato generato dall'architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.7 -// Vedere http://java.sun.com/xml/jaxb -// Qualsiasi modifica a questo file andrà persa durante la ricompilazione dello schema di origine. -// Generato il: 2019.01.25 alle 06:06:58 PM PST -// - - -package com.baeldung.springsoap.gen; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

    Classe Java per currency. - * - *

    Il seguente frammento di schema specifica il contenuto previsto contenuto in questa classe. - *

    - *

    - * <simpleType name="currency">
    - *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
    - *     <enumeration value="GBP"/>
    - *     <enumeration value="EUR"/>
    - *     <enumeration value="PLN"/>
    - *   </restriction>
    - * </simpleType>
    - * 
    - * - */ -@XmlType(name = "currency") -@XmlEnum -public enum Currency { - - GBP, - EUR, - PLN; - - public String value() { - return name(); - } - - public static Currency fromValue(String v) { - return valueOf(v); - } - -} diff --git a/spring-soap/src/main/java/com/baeldung/springsoap/gen/GetCountryRequest.java b/spring-soap/src/main/java/com/baeldung/springsoap/gen/GetCountryRequest.java deleted file mode 100644 index 7e1f151929..0000000000 --- a/spring-soap/src/main/java/com/baeldung/springsoap/gen/GetCountryRequest.java +++ /dev/null @@ -1,71 +0,0 @@ -// -// Questo file è stato generato dall'architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.7 -// Vedere http://java.sun.com/xml/jaxb -// Qualsiasi modifica a questo file andrà persa durante la ricompilazione dello schema di origine. -// Generato il: 2019.01.25 alle 06:06:58 PM PST -// - - -package com.baeldung.springsoap.gen; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

    Classe Java per anonymous complex type. - * - *

    Il seguente frammento di schema specifica il contenuto previsto contenuto in questa classe. - * - *

    - * <complexType>
    - *   <complexContent>
    - *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    - *       <sequence>
    - *         <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
    - *       </sequence>
    - *     </restriction>
    - *   </complexContent>
    - * </complexType>
    - * 
    - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "name" -}) -@XmlRootElement(name = "getCountryRequest") -public class GetCountryRequest { - - @XmlElement(required = true) - protected String name; - - /** - * Recupera il valore della proprietà name. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - return name; - } - - /** - * Imposta il valore della proprietà name. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - -} diff --git a/spring-soap/src/main/java/com/baeldung/springsoap/gen/GetCountryResponse.java b/spring-soap/src/main/java/com/baeldung/springsoap/gen/GetCountryResponse.java deleted file mode 100644 index 38c49193b4..0000000000 --- a/spring-soap/src/main/java/com/baeldung/springsoap/gen/GetCountryResponse.java +++ /dev/null @@ -1,71 +0,0 @@ -// -// Questo file è stato generato dall'architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.7 -// Vedere http://java.sun.com/xml/jaxb -// Qualsiasi modifica a questo file andrà persa durante la ricompilazione dello schema di origine. -// Generato il: 2019.01.25 alle 06:06:58 PM PST -// - - -package com.baeldung.springsoap.gen; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

    Classe Java per anonymous complex type. - * - *

    Il seguente frammento di schema specifica il contenuto previsto contenuto in questa classe. - * - *

    - * <complexType>
    - *   <complexContent>
    - *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    - *       <sequence>
    - *         <element name="country" type="{http://www.baeldung.com/springsoap/gen}country"/>
    - *       </sequence>
    - *     </restriction>
    - *   </complexContent>
    - * </complexType>
    - * 
    - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "country" -}) -@XmlRootElement(name = "getCountryResponse") -public class GetCountryResponse { - - @XmlElement(required = true) - protected Country country; - - /** - * Recupera il valore della proprietà country. - * - * @return - * possible object is - * {@link Country } - * - */ - public Country getCountry() { - return country; - } - - /** - * Imposta il valore della proprietà country. - * - * @param value - * allowed object is - * {@link Country } - * - */ - public void setCountry(Country value) { - this.country = value; - } - -} diff --git a/spring-soap/src/main/java/com/baeldung/springsoap/gen/ObjectFactory.java b/spring-soap/src/main/java/com/baeldung/springsoap/gen/ObjectFactory.java deleted file mode 100644 index 6b9691efc0..0000000000 --- a/spring-soap/src/main/java/com/baeldung/springsoap/gen/ObjectFactory.java +++ /dev/null @@ -1,63 +0,0 @@ -// -// Questo file è stato generato dall'architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.7 -// Vedere http://java.sun.com/xml/jaxb -// Qualsiasi modifica a questo file andrà persa durante la ricompilazione dello schema di origine. -// Generato il: 2019.01.25 alle 06:06:58 PM PST -// - - -package com.baeldung.springsoap.gen; - -import javax.xml.bind.annotation.XmlRegistry; - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the com.baeldung.springsoap.gen package. - *

    An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are - * provided in this class. - * - */ -@XmlRegistry -public class ObjectFactory { - - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.baeldung.springsoap.gen - * - */ - public ObjectFactory() { - } - - /** - * Create an instance of {@link GetCountryRequest } - * - */ - public GetCountryRequest createGetCountryRequest() { - return new GetCountryRequest(); - } - - /** - * Create an instance of {@link GetCountryResponse } - * - */ - public GetCountryResponse createGetCountryResponse() { - return new GetCountryResponse(); - } - - /** - * Create an instance of {@link Country } - * - */ - public Country createCountry() { - return new Country(); - } - -} diff --git a/spring-soap/src/main/java/com/baeldung/springsoap/gen/package-info.java b/spring-soap/src/main/java/com/baeldung/springsoap/gen/package-info.java deleted file mode 100644 index 9638be3d94..0000000000 --- a/spring-soap/src/main/java/com/baeldung/springsoap/gen/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// -// Questo file è stato generato dall'architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.7 -// Vedere http://java.sun.com/xml/jaxb -// Qualsiasi modifica a questo file andrà persa durante la ricompilazione dello schema di origine. -// Generato il: 2019.01.25 alle 06:06:58 PM PST -// - -@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.baeldung.com/springsoap/gen", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) -package com.baeldung.springsoap.gen; diff --git a/spring-soap/src/test/java/com/baeldung/springsoap/ApplicationIntegrationTest.java b/spring-soap/src/test/java/com/baeldung/springsoap/ApplicationIntegrationTest.java index 18c8a96576..0bde6f94aa 100644 --- a/spring-soap/src/test/java/com/baeldung/springsoap/ApplicationIntegrationTest.java +++ b/spring-soap/src/test/java/com/baeldung/springsoap/ApplicationIntegrationTest.java @@ -1,6 +1,5 @@ package com.baeldung.springsoap; -import com.baeldung.springsoap.gen.GetCountryRequest; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; From 29e492342e9d0479a2a7b81803a7a1d25e079514 Mon Sep 17 00:00:00 2001 From: Ciro Alvino Date: Sun, 10 Feb 2019 17:13:27 -0800 Subject: [PATCH 134/143] Update ApplicationIntegrationTest.java --- .../com/baeldung/springsoap/ApplicationIntegrationTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-soap/src/test/java/com/baeldung/springsoap/ApplicationIntegrationTest.java b/spring-soap/src/test/java/com/baeldung/springsoap/ApplicationIntegrationTest.java index 0bde6f94aa..3b071c286f 100644 --- a/spring-soap/src/test/java/com/baeldung/springsoap/ApplicationIntegrationTest.java +++ b/spring-soap/src/test/java/com/baeldung/springsoap/ApplicationIntegrationTest.java @@ -1,5 +1,6 @@ package com.baeldung.springsoap; +import com.baeldung.springsoap.gen.GetCountryRequest; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -35,4 +36,4 @@ public class ApplicationIntegrationTest { assertThat(ws.marshalSendAndReceive("http://localhost:" + port + "/ws", request)).isNotNull(); } -} \ No newline at end of file +} From e6fc0bd94dbb2ffd196f82888b847a0174891655 Mon Sep 17 00:00:00 2001 From: Marko Previsic Date: Mon, 11 Feb 2019 04:22:34 +0100 Subject: [PATCH 135/143] [BAEL-2533] Formatting JSON Dates in Spring Boot (#6313) * [BAEL-2533] formatting json date output in spring boot * [BAEL-2533] removed unused import --- .../com/baeldung/jsondateformat/Contact.java | 70 ++++++++++++++ .../baeldung/jsondateformat/ContactApp.java | 13 +++ .../jsondateformat/ContactAppConfig.java | 33 +++++++ .../jsondateformat/ContactController.java | 77 +++++++++++++++ .../ContactWithJavaUtilDate.java | 69 +++++++++++++ .../baeldung/jsondateformat/PlainContact.java | 66 +++++++++++++ .../PlainContactWithJavaUtilDate.java | 69 +++++++++++++ .../org/baeldung/demo/boottest/Employee.java | 3 + .../src/main/resources/application.properties | 2 + .../ContactAppIntegrationTest.java | 96 +++++++++++++++++++ ...ObjectMapperCustomizerIntegrationTest.java | 63 ++++++++++++ 11 files changed, 561 insertions(+) create mode 100644 spring-boot/src/main/java/com/baeldung/jsondateformat/Contact.java create mode 100644 spring-boot/src/main/java/com/baeldung/jsondateformat/ContactApp.java create mode 100644 spring-boot/src/main/java/com/baeldung/jsondateformat/ContactAppConfig.java create mode 100644 spring-boot/src/main/java/com/baeldung/jsondateformat/ContactController.java create mode 100644 spring-boot/src/main/java/com/baeldung/jsondateformat/ContactWithJavaUtilDate.java create mode 100644 spring-boot/src/main/java/com/baeldung/jsondateformat/PlainContact.java create mode 100644 spring-boot/src/main/java/com/baeldung/jsondateformat/PlainContactWithJavaUtilDate.java create mode 100644 spring-boot/src/test/java/com/baeldung/jsondateformat/ContactAppIntegrationTest.java create mode 100644 spring-boot/src/test/java/com/baeldung/jsondateformat/ContactAppWithObjectMapperCustomizerIntegrationTest.java diff --git a/spring-boot/src/main/java/com/baeldung/jsondateformat/Contact.java b/spring-boot/src/main/java/com/baeldung/jsondateformat/Contact.java new file mode 100644 index 0000000000..f131d17196 --- /dev/null +++ b/spring-boot/src/main/java/com/baeldung/jsondateformat/Contact.java @@ -0,0 +1,70 @@ +package com.baeldung.jsondateformat; + +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.time.LocalDate; +import java.time.LocalDateTime; + +public class Contact { + + private String name; + private String address; + private String phone; + + @JsonFormat(pattern="yyyy-MM-dd") + private LocalDate birthday; + + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss") + private LocalDateTime lastUpdate; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public LocalDate getBirthday() { + return birthday; + } + + public void setBirthday(LocalDate birthday) { + this.birthday = birthday; + } + + public LocalDateTime getLastUpdate() { + return lastUpdate; + } + + public void setLastUpdate(LocalDateTime lastUpdate) { + this.lastUpdate = lastUpdate; + } + + public Contact() { + } + + public Contact(String name, String address, String phone, LocalDate birthday, LocalDateTime lastUpdate) { + this.name = name; + this.address = address; + this.phone = phone; + this.birthday = birthday; + this.lastUpdate = lastUpdate; + } +} diff --git a/spring-boot/src/main/java/com/baeldung/jsondateformat/ContactApp.java b/spring-boot/src/main/java/com/baeldung/jsondateformat/ContactApp.java new file mode 100644 index 0000000000..79037e1038 --- /dev/null +++ b/spring-boot/src/main/java/com/baeldung/jsondateformat/ContactApp.java @@ -0,0 +1,13 @@ +package com.baeldung.jsondateformat; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class ContactApp { + + public static void main(String[] args) { + SpringApplication.run(ContactApp.class, args); + } + +} diff --git a/spring-boot/src/main/java/com/baeldung/jsondateformat/ContactAppConfig.java b/spring-boot/src/main/java/com/baeldung/jsondateformat/ContactAppConfig.java new file mode 100644 index 0000000000..7a20ebfa51 --- /dev/null +++ b/spring-boot/src/main/java/com/baeldung/jsondateformat/ContactAppConfig.java @@ -0,0 +1,33 @@ +package com.baeldung.jsondateformat; + +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; + +import java.time.format.DateTimeFormatter; + +@Configuration +public class ContactAppConfig { + + private static final String dateFormat = "yyyy-MM-dd"; + + private static final String dateTimeFormat = "yyyy-MM-dd HH:mm:ss"; + + @Bean + @ConditionalOnProperty(value = "spring.jackson.date-format", matchIfMissing = true, havingValue = "none") + public Jackson2ObjectMapperBuilderCustomizer jsonCustomizer() { + return new Jackson2ObjectMapperBuilderCustomizer() { + @Override + public void customize(Jackson2ObjectMapperBuilder builder) { + builder.simpleDateFormat(dateTimeFormat); + builder.serializers(new LocalDateSerializer(DateTimeFormatter.ofPattern(dateFormat))); + builder.serializers(new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(dateTimeFormat))); + } + }; + } + +} diff --git a/spring-boot/src/main/java/com/baeldung/jsondateformat/ContactController.java b/spring-boot/src/main/java/com/baeldung/jsondateformat/ContactController.java new file mode 100644 index 0000000000..8894d82fc7 --- /dev/null +++ b/spring-boot/src/main/java/com/baeldung/jsondateformat/ContactController.java @@ -0,0 +1,77 @@ +package com.baeldung.jsondateformat; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +@RestController +@RequestMapping(value = "/contacts") +public class ContactController { + + @GetMapping + public List getContacts() { + List contacts = new ArrayList<>(); + + Contact contact1 = new Contact("John Doe", "123 Sesame Street", "123-456-789", LocalDate.now(), LocalDateTime.now()); + Contact contact2 = new Contact("John Doe 2", "124 Sesame Street", "123-456-789", LocalDate.now(), LocalDateTime.now()); + Contact contact3 = new Contact("John Doe 3", "125 Sesame Street", "123-456-789", LocalDate.now(), LocalDateTime.now()); + + contacts.add(contact1); + contacts.add(contact2); + contacts.add(contact3); + + return contacts; + } + + @GetMapping("/javaUtilDate") + public List getContactsWithJavaUtilDate() { + List contacts = new ArrayList<>(); + + ContactWithJavaUtilDate contact1 = new ContactWithJavaUtilDate("John Doe", "123 Sesame Street", "123-456-789", new Date(), new Date()); + ContactWithJavaUtilDate contact2 = new ContactWithJavaUtilDate("John Doe 2", "124 Sesame Street", "123-456-789", new Date(), new Date()); + ContactWithJavaUtilDate contact3 = new ContactWithJavaUtilDate("John Doe 3", "125 Sesame Street", "123-456-789", new Date(), new Date()); + + contacts.add(contact1); + contacts.add(contact2); + contacts.add(contact3); + + return contacts; + } + + @GetMapping("/plain") + public List getPlainContacts() { + List contacts = new ArrayList<>(); + + PlainContact contact1 = new PlainContact("John Doe", "123 Sesame Street", "123-456-789", LocalDate.now(), LocalDateTime.now()); + PlainContact contact2 = new PlainContact("John Doe 2", "124 Sesame Street", "123-456-789", LocalDate.now(), LocalDateTime.now()); + PlainContact contact3 = new PlainContact("John Doe 3", "125 Sesame Street", "123-456-789", LocalDate.now(), LocalDateTime.now()); + + contacts.add(contact1); + contacts.add(contact2); + contacts.add(contact3); + + return contacts; + } + + @GetMapping("/plainWithJavaUtilDate") + public List getPlainContactsWithJavaUtilDate() { + List contacts = new ArrayList<>(); + + PlainContactWithJavaUtilDate contact1 = new PlainContactWithJavaUtilDate("John Doe", "123 Sesame Street", "123-456-789", new Date(), new Date()); + PlainContactWithJavaUtilDate contact2 = new PlainContactWithJavaUtilDate("John Doe 2", "124 Sesame Street", "123-456-789", new Date(), new Date()); + PlainContactWithJavaUtilDate contact3 = new PlainContactWithJavaUtilDate("John Doe 3", "125 Sesame Street", "123-456-789", new Date(), new Date()); + + contacts.add(contact1); + contacts.add(contact2); + contacts.add(contact3); + + return contacts; + } + +} diff --git a/spring-boot/src/main/java/com/baeldung/jsondateformat/ContactWithJavaUtilDate.java b/spring-boot/src/main/java/com/baeldung/jsondateformat/ContactWithJavaUtilDate.java new file mode 100644 index 0000000000..5a1c508098 --- /dev/null +++ b/spring-boot/src/main/java/com/baeldung/jsondateformat/ContactWithJavaUtilDate.java @@ -0,0 +1,69 @@ +package com.baeldung.jsondateformat; + +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.util.Date; + +public class ContactWithJavaUtilDate { + + private String name; + private String address; + private String phone; + + @JsonFormat(pattern="yyyy-MM-dd") + private Date birthday; + + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss") + private Date lastUpdate; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public Date getBirthday() { + return birthday; + } + + public void setBirthday(Date birthday) { + this.birthday = birthday; + } + + public Date getLastUpdate() { + return lastUpdate; + } + + public void setLastUpdate(Date lastUpdate) { + this.lastUpdate = lastUpdate; + } + + public ContactWithJavaUtilDate() { + } + + public ContactWithJavaUtilDate(String name, String address, String phone, Date birthday, Date lastUpdate) { + this.name = name; + this.address = address; + this.phone = phone; + this.birthday = birthday; + this.lastUpdate = lastUpdate; + } +} diff --git a/spring-boot/src/main/java/com/baeldung/jsondateformat/PlainContact.java b/spring-boot/src/main/java/com/baeldung/jsondateformat/PlainContact.java new file mode 100644 index 0000000000..7e9e53d205 --- /dev/null +++ b/spring-boot/src/main/java/com/baeldung/jsondateformat/PlainContact.java @@ -0,0 +1,66 @@ +package com.baeldung.jsondateformat; + +import java.time.LocalDate; +import java.time.LocalDateTime; + +public class PlainContact { + + private String name; + private String address; + private String phone; + + private LocalDate birthday; + + private LocalDateTime lastUpdate; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public LocalDate getBirthday() { + return birthday; + } + + public void setBirthday(LocalDate birthday) { + this.birthday = birthday; + } + + public LocalDateTime getLastUpdate() { + return lastUpdate; + } + + public void setLastUpdate(LocalDateTime lastUpdate) { + this.lastUpdate = lastUpdate; + } + + public PlainContact() { + } + + public PlainContact(String name, String address, String phone, LocalDate birthday, LocalDateTime lastUpdate) { + this.name = name; + this.address = address; + this.phone = phone; + this.birthday = birthday; + this.lastUpdate = lastUpdate; + } +} diff --git a/spring-boot/src/main/java/com/baeldung/jsondateformat/PlainContactWithJavaUtilDate.java b/spring-boot/src/main/java/com/baeldung/jsondateformat/PlainContactWithJavaUtilDate.java new file mode 100644 index 0000000000..daefb15543 --- /dev/null +++ b/spring-boot/src/main/java/com/baeldung/jsondateformat/PlainContactWithJavaUtilDate.java @@ -0,0 +1,69 @@ +package com.baeldung.jsondateformat; + +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.util.Date; + +public class PlainContactWithJavaUtilDate { + + private String name; + private String address; + private String phone; + + @JsonFormat(pattern="yyyy-MM-dd") + private Date birthday; + + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss") + private Date lastUpdate; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public Date getBirthday() { + return birthday; + } + + public void setBirthday(Date birthday) { + this.birthday = birthday; + } + + public Date getLastUpdate() { + return lastUpdate; + } + + public void setLastUpdate(Date lastUpdate) { + this.lastUpdate = lastUpdate; + } + + public PlainContactWithJavaUtilDate() { + } + + public PlainContactWithJavaUtilDate(String name, String address, String phone, Date birthday, Date lastUpdate) { + this.name = name; + this.address = address; + this.phone = phone; + this.birthday = birthday; + this.lastUpdate = lastUpdate; + } +} diff --git a/spring-boot/src/main/java/org/baeldung/demo/boottest/Employee.java b/spring-boot/src/main/java/org/baeldung/demo/boottest/Employee.java index c1dd109f91..645ce2838a 100644 --- a/spring-boot/src/main/java/org/baeldung/demo/boottest/Employee.java +++ b/spring-boot/src/main/java/org/baeldung/demo/boottest/Employee.java @@ -6,6 +6,7 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import javax.validation.constraints.Size; +import java.util.Date; @Entity @Table(name = "person") @@ -25,6 +26,8 @@ public class Employee { @Size(min = 3, max = 20) private String name; + private Date birthday; + public Long getId() { return id; } diff --git a/spring-boot/src/main/resources/application.properties b/spring-boot/src/main/resources/application.properties index 6a52dd1f70..00c251d823 100644 --- a/spring-boot/src/main/resources/application.properties +++ b/spring-boot/src/main/resources/application.properties @@ -73,3 +73,5 @@ chaos.monkey.watcher.repository=false #Component watcher active chaos.monkey.watcher.component=false +spring.jackson.date-format=yyyy-MM-dd HH:mm:ss +spring.jackson.time-zone=Europe/Zagreb diff --git a/spring-boot/src/test/java/com/baeldung/jsondateformat/ContactAppIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/jsondateformat/ContactAppIntegrationTest.java new file mode 100644 index 0000000000..86af985d8a --- /dev/null +++ b/spring-boot/src/test/java/com/baeldung/jsondateformat/ContactAppIntegrationTest.java @@ -0,0 +1,96 @@ +package com.baeldung.jsondateformat; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.http.ResponseEntity; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.junit4.SpringRunner; + +import java.io.IOException; +import java.text.ParseException; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; +import java.util.List; +import java.util.Map; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.DEFINED_PORT; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = DEFINED_PORT, classes = ContactApp.class) +@TestPropertySource(properties = { + "spring.jackson.date-format=yyyy-MM-dd HH:mm:ss" +}) +public class ContactAppIntegrationTest { + + private final ObjectMapper mapper = new ObjectMapper(); + + @Autowired + TestRestTemplate restTemplate; + + @Test + public void givenJsonFormatAnnotationAndJava8DateType_whenGet_thenReturnExpectedDateFormat() throws IOException, ParseException { + ResponseEntity response = restTemplate.getForEntity("http://localhost:8080/contacts", String.class); + + assertEquals(200, response.getStatusCodeValue()); + + List> respMap = mapper.readValue(response.getBody(), new TypeReference>>(){}); + + LocalDate birthdayDate = LocalDate.parse(respMap.get(0).get("birthday"), DateTimeFormatter.ofPattern("yyyy-MM-dd")); + LocalDateTime lastUpdateTime = LocalDateTime.parse(respMap.get(0).get("lastUpdate"), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + + assertNotNull(birthdayDate); + assertNotNull(lastUpdateTime); + } + + @Test + public void givenJsonFormatAnnotationAndLegacyDateType_whenGet_thenReturnExpectedDateFormat() throws IOException { + ResponseEntity response = restTemplate.getForEntity("http://localhost:8080/contacts/javaUtilDate", String.class); + + assertEquals(200, response.getStatusCodeValue()); + + List> respMap = mapper.readValue(response.getBody(), new TypeReference>>(){}); + + LocalDate birthdayDate = LocalDate.parse(respMap.get(0).get("birthday"), DateTimeFormatter.ofPattern("yyyy-MM-dd")); + LocalDateTime lastUpdateTime = LocalDateTime.parse(respMap.get(0).get("lastUpdate"), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + + assertNotNull(birthdayDate); + assertNotNull(lastUpdateTime); + } + + @Test + public void givenDefaultDateFormatInAppPropertiesAndLegacyDateType_whenGet_thenReturnExpectedDateFormat() throws IOException { + ResponseEntity response = restTemplate.getForEntity("http://localhost:8080/contacts/plainWithJavaUtilDate", String.class); + + assertEquals(200, response.getStatusCodeValue()); + + List> respMap = mapper.readValue(response.getBody(), new TypeReference>>(){}); + + LocalDate birthdayDate = LocalDate.parse(respMap.get(0).get("birthday"), DateTimeFormatter.ofPattern("yyyy-MM-dd")); + LocalDateTime lastUpdateTime = LocalDateTime.parse(respMap.get(0).get("lastUpdate"), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + + assertNotNull(birthdayDate); + assertNotNull(lastUpdateTime); + } + + @Test(expected = DateTimeParseException.class) + public void givenDefaultDateFormatInAppPropertiesAndJava8DateType_whenGet_thenNotApplyFormat() throws IOException { + ResponseEntity response = restTemplate.getForEntity("http://localhost:8080/contacts/plain", String.class); + + assertEquals(200, response.getStatusCodeValue()); + + List> respMap = mapper.readValue(response.getBody(), new TypeReference>>(){}); + + LocalDate birthdayDate = LocalDate.parse(respMap.get(0).get("birthday"), DateTimeFormatter.ofPattern("yyyy-MM-dd")); + LocalDateTime lastUpdateTime = LocalDateTime.parse(respMap.get(0).get("lastUpdate"), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + } + +} diff --git a/spring-boot/src/test/java/com/baeldung/jsondateformat/ContactAppWithObjectMapperCustomizerIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/jsondateformat/ContactAppWithObjectMapperCustomizerIntegrationTest.java new file mode 100644 index 0000000000..554283d758 --- /dev/null +++ b/spring-boot/src/test/java/com/baeldung/jsondateformat/ContactAppWithObjectMapperCustomizerIntegrationTest.java @@ -0,0 +1,63 @@ +package com.baeldung.jsondateformat; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.http.ResponseEntity; +import org.springframework.test.context.junit4.SpringRunner; + +import java.io.IOException; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.DEFINED_PORT; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = DEFINED_PORT, classes = ContactApp.class) +public class ContactAppWithObjectMapperCustomizerIntegrationTest { + + private final ObjectMapper mapper = new ObjectMapper(); + + @Autowired + TestRestTemplate restTemplate; + + @Test + public void givenDefaultDateFormatInAppPropertiesAndLegacyDateType_whenGet_thenReturnExpectedDateFormat() throws IOException { + ResponseEntity response = restTemplate.getForEntity("http://localhost:8080/contacts/plainWithJavaUtilDate", String.class); + + assertEquals(200, response.getStatusCodeValue()); + + List> respMap = mapper.readValue(response.getBody(), new TypeReference>>(){}); + + LocalDate birthdayDate = LocalDate.parse(respMap.get(0).get("birthday"), DateTimeFormatter.ofPattern("yyyy-MM-dd")); + LocalDateTime lastUpdateTime = LocalDateTime.parse(respMap.get(0).get("lastUpdate"), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + + assertNotNull(birthdayDate); + assertNotNull(lastUpdateTime); + } + + @Test + public void givenDefaultDateFormatInAppPropertiesAndJava8DateType_whenGet_thenReturnExpectedDateFormat() throws IOException { + ResponseEntity response = restTemplate.getForEntity("http://localhost:8080/contacts/plain", String.class); + + assertEquals(200, response.getStatusCodeValue()); + + List> respMap = mapper.readValue(response.getBody(), new TypeReference>>(){}); + + LocalDate birthdayDate = LocalDate.parse(respMap.get(0).get("birthday"), DateTimeFormatter.ofPattern("yyyy-MM-dd")); + LocalDateTime lastUpdateTime = LocalDateTime.parse(respMap.get(0).get("lastUpdate"), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + + assertNotNull(birthdayDate); + assertNotNull(lastUpdateTime); + } + +} From f894b40fe668c03065e6a63e405a5675d4bb12c7 Mon Sep 17 00:00:00 2001 From: Dhananjay Singh Date: Mon, 11 Feb 2019 09:00:35 +0530 Subject: [PATCH 136/143] Char stack (#6248) * Corrected Package name * Char stack * Changed file names --- .../com/baeldung/charstack/CharStack.java | 37 +++++++++++ .../charstack/CharStackWithArray.java | 48 ++++++++++++++ .../charstack/EmptyStackException.java | 9 +++ .../queueInterface/CustomBaeldungQueue.java | 2 +- .../baeldung/charstack/CharStackUnitTest.java | 50 ++++++++++++++ .../charstack/CharStackUsingJavaUnitTest.java | 53 +++++++++++++++ .../charstack/CharStackWithArrayUnitTest.java | 65 +++++++++++++++++++ .../CustomBaeldungQueueUnitTest.java | 2 +- .../queueinterface/PriorityQueueUnitTest.java | 2 +- 9 files changed, 265 insertions(+), 3 deletions(-) create mode 100644 core-java-collections/src/main/java/com/baeldung/charstack/CharStack.java create mode 100644 core-java-collections/src/main/java/com/baeldung/charstack/CharStackWithArray.java create mode 100644 core-java-collections/src/main/java/com/baeldung/charstack/EmptyStackException.java create mode 100644 core-java-collections/src/test/java/com/baeldung/charstack/CharStackUnitTest.java create mode 100644 core-java-collections/src/test/java/com/baeldung/charstack/CharStackUsingJavaUnitTest.java create mode 100644 core-java-collections/src/test/java/com/baeldung/charstack/CharStackWithArrayUnitTest.java diff --git a/core-java-collections/src/main/java/com/baeldung/charstack/CharStack.java b/core-java-collections/src/main/java/com/baeldung/charstack/CharStack.java new file mode 100644 index 0000000000..f789a68d90 --- /dev/null +++ b/core-java-collections/src/main/java/com/baeldung/charstack/CharStack.java @@ -0,0 +1,37 @@ +package com.baeldung.charstack; + +import java.util.Iterator; +import java.util.LinkedList; + +public class CharStack { + + private LinkedList items; + + public CharStack() { + this.items = new LinkedList(); + } + + public void push(Character item) { + items.push(item); + } + + public Character peek() { + return items.getFirst(); + } + + public Character pop() { + + Iterator iter = items.iterator(); + Character item = iter.next(); + if (item != null) { + iter.remove(); + return item; + } + return null; + } + + public int size() { + return items.size(); + } + +} diff --git a/core-java-collections/src/main/java/com/baeldung/charstack/CharStackWithArray.java b/core-java-collections/src/main/java/com/baeldung/charstack/CharStackWithArray.java new file mode 100644 index 0000000000..ed7fa3f253 --- /dev/null +++ b/core-java-collections/src/main/java/com/baeldung/charstack/CharStackWithArray.java @@ -0,0 +1,48 @@ +package com.baeldung.charstack; + +public class CharStackWithArray { + + private char[] elements; + private int size; + + public CharStackWithArray() { + size = 0; + elements = new char[4]; + } + + public int size() { + return size; + } + + public char peek() { + if (size == 0) { + throw new EmptyStackException(); + } + return elements[size - 1]; + } + + public char pop() { + if (size == 0) { + throw new EmptyStackException(); + } + + return elements[--size]; + } + + public void push(char item) { + ensureCapacity(size + 1); + elements[size] = item; + size++; + } + + private void ensureCapacity(int newSize) { + char newBiggerArray[]; + + if (elements.length < newSize) { + newBiggerArray = new char[elements.length * 2]; + System.arraycopy(elements, 0, newBiggerArray, 0, size); + elements = newBiggerArray; + } + } + +} diff --git a/core-java-collections/src/main/java/com/baeldung/charstack/EmptyStackException.java b/core-java-collections/src/main/java/com/baeldung/charstack/EmptyStackException.java new file mode 100644 index 0000000000..f005854e7f --- /dev/null +++ b/core-java-collections/src/main/java/com/baeldung/charstack/EmptyStackException.java @@ -0,0 +1,9 @@ +package com.baeldung.charstack; + +public class EmptyStackException extends RuntimeException { + + public EmptyStackException() { + super("Stack is empty"); + } + +} diff --git a/core-java-collections/src/main/java/com/baeldung/queueInterface/CustomBaeldungQueue.java b/core-java-collections/src/main/java/com/baeldung/queueInterface/CustomBaeldungQueue.java index 6b088a5079..4fcc211812 100644 --- a/core-java-collections/src/main/java/com/baeldung/queueInterface/CustomBaeldungQueue.java +++ b/core-java-collections/src/main/java/com/baeldung/queueInterface/CustomBaeldungQueue.java @@ -1,4 +1,4 @@ -package com.baeldung.queueinterface; +package com.baeldung.queueInterface; import java.util.AbstractQueue; import java.util.Iterator; diff --git a/core-java-collections/src/test/java/com/baeldung/charstack/CharStackUnitTest.java b/core-java-collections/src/test/java/com/baeldung/charstack/CharStackUnitTest.java new file mode 100644 index 0000000000..a20526fd9d --- /dev/null +++ b/core-java-collections/src/test/java/com/baeldung/charstack/CharStackUnitTest.java @@ -0,0 +1,50 @@ +package com.baeldung.charstack; + +import static org.junit.Assert.assertEquals; + +import org.junit.jupiter.api.Test; + +public class CharStackUnitTest { + + @Test + public void whenCharStackIsCreated_thenItHasSize0() { + + CharStack charStack = new CharStack(); + + assertEquals(0, charStack.size()); + } + + @Test + public void givenEmptyCharStack_whenElementIsPushed_thenStackSizeisIncreased() { + + CharStack charStack = new CharStack(); + + charStack.push('A'); + + assertEquals(1, charStack.size()); + } + + @Test + public void givenCharStack_whenElementIsPoppedFromStack_thenElementIsRemovedAndSizeChanges() { + + CharStack charStack = new CharStack(); + charStack.push('A'); + + char element = charStack.pop(); + + assertEquals('A', element); + assertEquals(0, charStack.size()); + } + + @Test + public void givenCharStack_whenElementIsPeeked_thenElementIsNotRemovedAndSizeDoesNotChange() { + CharStack charStack = new CharStack(); + charStack.push('A'); + + char element = charStack.peek(); + + assertEquals('A', element); + assertEquals(1, charStack.size()); + } + +} diff --git a/core-java-collections/src/test/java/com/baeldung/charstack/CharStackUsingJavaUnitTest.java b/core-java-collections/src/test/java/com/baeldung/charstack/CharStackUsingJavaUnitTest.java new file mode 100644 index 0000000000..964b901ae0 --- /dev/null +++ b/core-java-collections/src/test/java/com/baeldung/charstack/CharStackUsingJavaUnitTest.java @@ -0,0 +1,53 @@ +package com.baeldung.charstack; + +import static org.junit.Assert.assertEquals; + +import java.util.Stack; + +import org.junit.jupiter.api.Test; + +public class CharStackUsingJavaUnitTest { + + @Test + public void whenCharStackIsCreated_thenItHasSize0() { + + Stack charStack = new Stack<>(); + + assertEquals(0, charStack.size()); + } + + @Test + public void givenEmptyCharStack_whenElementIsPushed_thenStackSizeisIncreased() { + + Stack charStack = new Stack<>(); + + charStack.push('A'); + + assertEquals(1, charStack.size()); + } + + @Test + public void givenCharStack_whenElementIsPoppedFromStack_thenElementIsRemovedAndSizeChanges() { + + Stack charStack = new Stack<>(); + charStack.push('A'); + + char element = charStack.pop(); + + assertEquals('A', element); + assertEquals(0, charStack.size()); + } + + @Test + public void givenCharStack_whenElementIsPeeked_thenElementIsNotRemovedAndSizeDoesNotChange() { + + Stack charStack = new Stack<>(); + charStack.push('A'); + + char element = charStack.peek(); + + assertEquals('A', element); + assertEquals(1, charStack.size()); + } + +} diff --git a/core-java-collections/src/test/java/com/baeldung/charstack/CharStackWithArrayUnitTest.java b/core-java-collections/src/test/java/com/baeldung/charstack/CharStackWithArrayUnitTest.java new file mode 100644 index 0000000000..df90b8f0a4 --- /dev/null +++ b/core-java-collections/src/test/java/com/baeldung/charstack/CharStackWithArrayUnitTest.java @@ -0,0 +1,65 @@ +package com.baeldung.charstack; + +import static org.junit.Assert.assertEquals; + +import org.junit.jupiter.api.Test; + +public class CharStackWithArrayUnitTest { + + @Test + public void whenCharStackIsCreated_thenItHasSize0() { + + CharStackWithArray charStack = new CharStackWithArray(); + + assertEquals(0, charStack.size()); + } + + @Test + public void givenEmptyCharStack_whenElementIsPushed_thenStackSizeisIncreased() { + + CharStackWithArray charStack = new CharStackWithArray(); + + charStack.push('A'); + + assertEquals(1, charStack.size()); + } + + @Test + public void givenEmptyCharStack_when5ElementIsPushed_thenStackSizeis() { + + CharStackWithArray charStack = new CharStackWithArray(); + + charStack.push('A'); + charStack.push('B'); + charStack.push('C'); + charStack.push('D'); + charStack.push('E'); + + assertEquals(5, charStack.size()); + } + + @Test + public void givenCharStack_whenElementIsPoppedFromStack_thenElementIsRemovedAndSizeChanges() { + + CharStackWithArray charStack = new CharStackWithArray(); + charStack.push('A'); + + char element = charStack.pop(); + + assertEquals('A', element); + assertEquals(0, charStack.size()); + } + + @Test + public void givenCharStack_whenElementIsPeeked_thenElementIsNotRemovedAndSizeDoesNotChange() { + + CharStackWithArray charStack = new CharStackWithArray(); + charStack.push('A'); + + char element = charStack.peek(); + + assertEquals('A', element); + assertEquals(1, charStack.size()); + } + +} diff --git a/core-java-collections/src/test/java/com/baeldung/queueinterface/CustomBaeldungQueueUnitTest.java b/core-java-collections/src/test/java/com/baeldung/queueinterface/CustomBaeldungQueueUnitTest.java index 6dec768542..7471d9841d 100644 --- a/core-java-collections/src/test/java/com/baeldung/queueinterface/CustomBaeldungQueueUnitTest.java +++ b/core-java-collections/src/test/java/com/baeldung/queueinterface/CustomBaeldungQueueUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.queueinterface; +package com.baeldung.queueInterface; import org.junit.Before; import org.junit.Test; diff --git a/core-java-collections/src/test/java/com/baeldung/queueinterface/PriorityQueueUnitTest.java b/core-java-collections/src/test/java/com/baeldung/queueinterface/PriorityQueueUnitTest.java index c5b564b55b..748099e8d1 100644 --- a/core-java-collections/src/test/java/com/baeldung/queueinterface/PriorityQueueUnitTest.java +++ b/core-java-collections/src/test/java/com/baeldung/queueinterface/PriorityQueueUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.queueinterface; +package com.baeldung.queueInterface; import org.junit.Before; import org.junit.Test; From e2f3d605f04d0de3dc44d42d152753a1a656ec35 Mon Sep 17 00:00:00 2001 From: Fabian Rivera Date: Mon, 11 Feb 2019 10:37:48 -0600 Subject: [PATCH 137/143] Enable stacktraces and causal chain of causes. Add a couple of tests to validate stacktrace and cause are included in responses (#6315) --- .../boot/problem/advice/ExceptionHandler.java | 7 +++++ .../ProblemDemoConfiguration.java | 4 ++- .../ProblemDemoControllerIntegrationTest.java | 26 +++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/advice/ExceptionHandler.java b/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/advice/ExceptionHandler.java index 7b4cbac7f7..18df103733 100644 --- a/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/advice/ExceptionHandler.java +++ b/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/advice/ExceptionHandler.java @@ -5,5 +5,12 @@ import org.zalando.problem.spring.web.advice.ProblemHandling; @ControllerAdvice public class ExceptionHandler implements ProblemHandling { + + // The causal chain of causes is disabled by default, + // but we can easily enable it by overriding the behavior: + @Override + public boolean isCausalChainsEnabled() { + return true; + } } diff --git a/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/configuration/ProblemDemoConfiguration.java b/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/configuration/ProblemDemoConfiguration.java index 209ff553c7..f5e6a6b99a 100644 --- a/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/configuration/ProblemDemoConfiguration.java +++ b/spring-boot-libraries/src/main/java/com/baeldung/boot/problem/configuration/ProblemDemoConfiguration.java @@ -12,6 +12,8 @@ public class ProblemDemoConfiguration { @Bean public ObjectMapper objectMapper() { - return new ObjectMapper().registerModules(new ProblemModule(), new ConstraintViolationProblemModule()); + // In this example, stack traces support is enabled by default. + // If you want to disable stack traces just use new ProblemModule() instead of new ProblemModule().withStackTraces() + return new ObjectMapper().registerModules(new ProblemModule().withStackTraces(), new ConstraintViolationProblemModule()); } } diff --git a/spring-boot-libraries/src/test/java/com/baeldung/boot/problem/controller/ProblemDemoControllerIntegrationTest.java b/spring-boot-libraries/src/test/java/com/baeldung/boot/problem/controller/ProblemDemoControllerIntegrationTest.java index 3b7e43a565..5ced1034c4 100644 --- a/spring-boot-libraries/src/test/java/com/baeldung/boot/problem/controller/ProblemDemoControllerIntegrationTest.java +++ b/spring-boot-libraries/src/test/java/com/baeldung/boot/problem/controller/ProblemDemoControllerIntegrationTest.java @@ -1,6 +1,8 @@ package com.baeldung.boot.problem.controller; +import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.notNullValue; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; @@ -71,5 +73,29 @@ public class ProblemDemoControllerIntegrationTest { .andExpect(jsonPath("$.detail", equalTo("You can't delete this task"))) .andExpect(status().isForbidden()); } + + @Test + public void whenMakeGetCallWithInvalidIdFormat_thenReturnBadRequestResponseWithStackTrace() throws Exception { + mockMvc.perform(get("/tasks/invalid-id").contentType(MediaType.APPLICATION_PROBLEM_JSON_VALUE)) + .andDo(print()) + .andExpect(jsonPath("$.title", equalTo("Bad Request"))) + .andExpect(jsonPath("$.status", equalTo(400))) + .andExpect(jsonPath("$.stacktrace", notNullValue())) + .andExpect(status().isBadRequest()); + } + + @Test + public void whenMakeGetCallWithInvalidIdFormat_thenReturnBadRequestResponseWithCause() throws Exception { + mockMvc.perform(get("/tasks/invalid-id").contentType(MediaType.APPLICATION_PROBLEM_JSON_VALUE)) + .andDo(print()) + .andExpect(jsonPath("$.title", equalTo("Bad Request"))) + .andExpect(jsonPath("$.status", equalTo(400))) + .andExpect(jsonPath("$.cause", notNullValue())) + .andExpect(jsonPath("$.cause.title", equalTo("Internal Server Error"))) + .andExpect(jsonPath("$.cause.status", equalTo(500))) + .andExpect(jsonPath("$.cause.detail", containsString("For input string:"))) + .andExpect(jsonPath("$.cause.stacktrace", notNullValue())) + .andExpect(status().isBadRequest()); + } } From c957ceaeba90265346c4fafea04e42bb421d6f06 Mon Sep 17 00:00:00 2001 From: Kacper Date: Tue, 12 Feb 2019 06:06:09 +0100 Subject: [PATCH 138/143] Types of string in groovy (#6287) --- .../stringtypes/CharacterInGroovy.groovy | 19 ++++++ .../stringtypes/DollarSlashyString.groovy | 24 +++++++ .../stringtypes/DoubleQuotedString.groovy | 67 +++++++++++++++++++ .../stringtypes/SingleQuotedString.groovy | 15 +++++ .../baeldung/stringtypes/SlashyString.groovy | 31 +++++++++ .../com/baeldung/stringtypes/Strings.groovy | 26 +++++++ .../TripleDoubleQuotedString.groovy | 19 ++++++ .../TripleSingleQuotedString.groovy | 67 +++++++++++++++++++ 8 files changed, 268 insertions(+) create mode 100644 core-groovy/src/test/groovy/com/baeldung/stringtypes/CharacterInGroovy.groovy create mode 100644 core-groovy/src/test/groovy/com/baeldung/stringtypes/DollarSlashyString.groovy create mode 100644 core-groovy/src/test/groovy/com/baeldung/stringtypes/DoubleQuotedString.groovy create mode 100644 core-groovy/src/test/groovy/com/baeldung/stringtypes/SingleQuotedString.groovy create mode 100644 core-groovy/src/test/groovy/com/baeldung/stringtypes/SlashyString.groovy create mode 100644 core-groovy/src/test/groovy/com/baeldung/stringtypes/Strings.groovy create mode 100644 core-groovy/src/test/groovy/com/baeldung/stringtypes/TripleDoubleQuotedString.groovy create mode 100644 core-groovy/src/test/groovy/com/baeldung/stringtypes/TripleSingleQuotedString.groovy diff --git a/core-groovy/src/test/groovy/com/baeldung/stringtypes/CharacterInGroovy.groovy b/core-groovy/src/test/groovy/com/baeldung/stringtypes/CharacterInGroovy.groovy new file mode 100644 index 0000000000..c043723d95 --- /dev/null +++ b/core-groovy/src/test/groovy/com/baeldung/stringtypes/CharacterInGroovy.groovy @@ -0,0 +1,19 @@ +package groovy.com.baeldung.stringtypes + +import org.junit.Assert +import org.junit.Test + +class CharacterInGroovy { + + @Test + void 'character'() { + char a = 'A' as char + char b = 'B' as char + char c = (char) 'C' + + Assert.assertTrue(a instanceof Character) + Assert.assertTrue(b instanceof Character) + Assert.assertTrue(c instanceof Character) + } + +} diff --git a/core-groovy/src/test/groovy/com/baeldung/stringtypes/DollarSlashyString.groovy b/core-groovy/src/test/groovy/com/baeldung/stringtypes/DollarSlashyString.groovy new file mode 100644 index 0000000000..db8ba68c8f --- /dev/null +++ b/core-groovy/src/test/groovy/com/baeldung/stringtypes/DollarSlashyString.groovy @@ -0,0 +1,24 @@ +package groovy.com.baeldung.stringtypes + +import org.junit.Test + +class DollarSlashyString { + + @Test + void 'dollar slashy string'() { + def name = "John" + + def dollarSlashy = $/ + Hello $name!, + + I can show you $ sign or escaped dollar sign: $$ + Both slashes works: \ or /, but we can still escape it: $/ + + We have to escape opening and closing delimiter: + - $$$/ + - $/$$ + /$ + + print(dollarSlashy) + } +} diff --git a/core-groovy/src/test/groovy/com/baeldung/stringtypes/DoubleQuotedString.groovy b/core-groovy/src/test/groovy/com/baeldung/stringtypes/DoubleQuotedString.groovy new file mode 100644 index 0000000000..a730244d0a --- /dev/null +++ b/core-groovy/src/test/groovy/com/baeldung/stringtypes/DoubleQuotedString.groovy @@ -0,0 +1,67 @@ +package groovy.com.baeldung.stringtypes + +import org.junit.Assert +import org.junit.Test + +class DoubleQuotedString { + + @Test + void 'escape double quoted string'() { + def example = "Hello \"world\"!" + + println(example) + } + + @Test + void 'String ang GString'() { + def string = "example" + def stringWithExpression = "example${2}" + + Assert.assertTrue(string instanceof String) + Assert.assertTrue(stringWithExpression instanceof GString) + Assert.assertTrue(stringWithExpression.toString() instanceof String) + } + + @Test + void 'placeholder with variable'() { + def name = "John" + def helloName = "Hello $name!".toString() + + Assert.assertEquals("Hello John!", helloName) + } + + @Test + void 'placeholder with expression'() { + def result = "result is ${2 * 2}".toString() + + Assert.assertEquals("result is 4", result) + } + + @Test + void 'placeholder with dotted access'() { + def person = [name: 'John'] + + def myNameIs = "I'm $person.name, and you?".toString() + + Assert.assertEquals("I'm John, and you?", myNameIs) + } + + @Test + void 'placeholder with method call'() { + def name = 'John' + + def result = "Uppercase name: ${name.toUpperCase()}".toString() + + Assert.assertEquals("Uppercase name: JOHN", result) + } + + + @Test + void 'GString and String hashcode'() { + def string = "2+2 is 4" + def gstring = "2+2 is ${4}" + + Assert.assertTrue(string.hashCode() != gstring.hashCode()) + } + +} diff --git a/core-groovy/src/test/groovy/com/baeldung/stringtypes/SingleQuotedString.groovy b/core-groovy/src/test/groovy/com/baeldung/stringtypes/SingleQuotedString.groovy new file mode 100644 index 0000000000..569991b788 --- /dev/null +++ b/core-groovy/src/test/groovy/com/baeldung/stringtypes/SingleQuotedString.groovy @@ -0,0 +1,15 @@ +package groovy.com.baeldung.stringtypes + +import org.junit.Assert +import org.junit.Test + +class SingleQuotedString { + + @Test + void 'single quoted string'() { + def example = 'Hello world' + + Assert.assertEquals('Hello world!', 'Hello' + ' world!') + } + +} diff --git a/core-groovy/src/test/groovy/com/baeldung/stringtypes/SlashyString.groovy b/core-groovy/src/test/groovy/com/baeldung/stringtypes/SlashyString.groovy new file mode 100644 index 0000000000..09ba35e17e --- /dev/null +++ b/core-groovy/src/test/groovy/com/baeldung/stringtypes/SlashyString.groovy @@ -0,0 +1,31 @@ +package groovy.com.baeldung.stringtypes + +import org.junit.Assert +import org.junit.Test + +class SlashyString { + + @Test + void 'slashy string'() { + def pattern = /.*foobar.*\/hello.*/ + + Assert.assertTrue("I'm matching foobar /hello regexp pattern".matches(pattern)) + } + + void 'wont compile'() { +// if ('' == //) { +// println("I can't compile") +// } + } + + @Test + void 'interpolate and multiline'() { + def name = 'John' + + def example = / + Hello $name + second line + / + } + +} diff --git a/core-groovy/src/test/groovy/com/baeldung/stringtypes/Strings.groovy b/core-groovy/src/test/groovy/com/baeldung/stringtypes/Strings.groovy new file mode 100644 index 0000000000..e45f352285 --- /dev/null +++ b/core-groovy/src/test/groovy/com/baeldung/stringtypes/Strings.groovy @@ -0,0 +1,26 @@ +package groovy.com.baeldung.stringtypes + +import org.junit.Assert +import org.junit.Test + +class Strings { + + @Test + void 'string interpolation '() { + def name = "Kacper" + + def result = "Hello ${name}!" + + Assert.assertEquals("Hello Kacper!", result.toString()) + } + + @Test + void 'string concatenation'() { + def first = "first" + def second = "second" + + def concatenation = first + second + + Assert.assertEquals("firstsecond", concatenation) + } +} diff --git a/core-groovy/src/test/groovy/com/baeldung/stringtypes/TripleDoubleQuotedString.groovy b/core-groovy/src/test/groovy/com/baeldung/stringtypes/TripleDoubleQuotedString.groovy new file mode 100644 index 0000000000..cbbb1a4665 --- /dev/null +++ b/core-groovy/src/test/groovy/com/baeldung/stringtypes/TripleDoubleQuotedString.groovy @@ -0,0 +1,19 @@ +package groovy.com.baeldung.stringtypes + +import org.junit.Test + +class TripleDoubleQuotedString { + + @Test + void 'triple-quoted strings with interpolation'() { + def name = "John" + + def multiLine = """ + I'm $name. + "This is quotation" + """ + + println(multiLine) + } + +} diff --git a/core-groovy/src/test/groovy/com/baeldung/stringtypes/TripleSingleQuotedString.groovy b/core-groovy/src/test/groovy/com/baeldung/stringtypes/TripleSingleQuotedString.groovy new file mode 100644 index 0000000000..24d55b8a2a --- /dev/null +++ b/core-groovy/src/test/groovy/com/baeldung/stringtypes/TripleSingleQuotedString.groovy @@ -0,0 +1,67 @@ +package groovy.com.baeldung.stringtypes + +import org.junit.Assert +import org.junit.Test + +class TripleSingleQuotedString { + + def 'formatted json'() { + def jsonContent = ''' + { + "name": "John", + "age": 20, + "birthDate": null + } + ''' + } + + def 'triple single quoted'() { + def triple = '''im triple single quoted string''' + } + + @Test + void 'triple single quoted with multiline string'() { + def triple = ''' + firstline + secondline + ''' + + Assert.assertTrue(triple.startsWith("\n")) + } + + @Test + void 'triple single quoted with multiline string with stripIndent() and removing newline characters'() { + def triple = '''\ + firstline + secondline'''.stripIndent() + + Assert.assertEquals("firstline\nsecondline", triple) + } + + @Test + void 'triple single quoted with multiline string with last line with only whitespaces'() { + def triple = '''\ + firstline + secondline\ + '''.stripIndent() + + println(triple) + } + + @Test + void 'triple single quoted with multiline string with stripMargin(Character) and removing newline characters'() { + def triple = '''\ + |firstline + |secondline'''.stripMargin() + + println(triple) + } + + @Test + void 'striple single quoted with special characters'() { + def specialCharacters = '''hello \'John\'. This is backslash - \\. \nSecond line starts here''' + + println(specialCharacters) + } + +} From 8a264439b7b30af6a8c8cd214bc30a4bbc3ead0d Mon Sep 17 00:00:00 2001 From: FrancoCorleone Date: Tue, 12 Feb 2019 06:09:37 +0100 Subject: [PATCH 139/143] Bael 2557 (#6307) * [BAEL-2557] Implement tests with Test Containers * [BAEL-2557] Remove author info * [BAEL-2557] Small refactor fixes * [BAEL-2557] Remove duplicated property * [BAEL-2557] Fix pmd rule violation --- persistence-modules/spring-data-jpa/pom.xml | 16 + .../config/PersistenceConfiguration.java | 20 +- .../PersistenceProductConfiguration.java | 2 + .../config/PersistenceUserConfiguration.java | 6 +- .../dao/repositories/user/UserRepository.java | 17 +- .../com/baeldung/domain/user/Possession.java | 8 +- .../java/com/baeldung/domain/user/User.java | 2 +- .../repositories/UserRepositoryCommon.java | 371 ++++++++++++++++++ .../UserRepositoryIntegrationTest.java | 366 +---------------- .../UserRepositoryTCAutoIntegrationTest.java | 40 ++ .../UserRepositoryTCIntegrationTest.java | 55 +++ .../util/BaeldungPostgresqlContainer.java | 35 ++ .../resources/application-tc-auto.properties | 4 + .../test/resources/application-tc.properties | 4 + 14 files changed, 551 insertions(+), 395 deletions(-) create mode 100644 persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryCommon.java create mode 100644 persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryTCAutoIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryTCIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa/src/test/java/com/baeldung/util/BaeldungPostgresqlContainer.java create mode 100644 persistence-modules/spring-data-jpa/src/test/resources/application-tc-auto.properties create mode 100644 persistence-modules/spring-data-jpa/src/test/resources/application-tc.properties diff --git a/persistence-modules/spring-data-jpa/pom.xml b/persistence-modules/spring-data-jpa/pom.xml index 786e587734..401f4877ac 100644 --- a/persistence-modules/spring-data-jpa/pom.xml +++ b/persistence-modules/spring-data-jpa/pom.xml @@ -27,11 +27,27 @@ org.hibernate hibernate-envers + com.h2database h2 + + + org.testcontainers + postgresql + 1.10.6 + test + + + + org.postgresql + postgresql + 42.2.5 + + + org.springframework.security spring-security-test diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceConfiguration.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceConfiguration.java index 2bdd4e5451..891624443b 100644 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceConfiguration.java +++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceConfiguration.java @@ -1,14 +1,11 @@ package com.baeldung.config; -import java.util.Properties; - -import javax.sql.DataSource; - +import com.baeldung.dao.repositories.impl.ExtendedRepositoryImpl; +import com.baeldung.services.IBarService; +import com.baeldung.services.impl.BarSpringDataJpaService; +import com.google.common.base.Preconditions; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; +import org.springframework.context.annotation.*; import org.springframework.core.env.Environment; import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; import org.springframework.data.jpa.repository.config.EnableJpaAuditing; @@ -21,10 +18,8 @@ import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; -import com.baeldung.dao.repositories.impl.ExtendedRepositoryImpl; -import com.baeldung.services.IBarService; -import com.baeldung.services.impl.BarSpringDataJpaService; -import com.google.common.base.Preconditions; +import javax.sql.DataSource; +import java.util.Properties; @Configuration @ComponentScan({ "com.baeldung.dao", "com.baeldung.services" }) @@ -32,6 +27,7 @@ import com.google.common.base.Preconditions; @EnableJpaRepositories(basePackages = { "com.baeldung.dao" }, repositoryBaseClass = ExtendedRepositoryImpl.class) @EnableJpaAuditing @PropertySource("classpath:persistence.properties") +@Profile("!tc") public class PersistenceConfiguration { @Autowired diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceProductConfiguration.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceProductConfiguration.java index 207fba9bc5..ecaee82ae5 100644 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceProductConfiguration.java +++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceProductConfiguration.java @@ -4,6 +4,7 @@ import com.google.common.base.Preconditions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; import org.springframework.context.annotation.PropertySource; import org.springframework.core.env.Environment; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; @@ -19,6 +20,7 @@ import java.util.HashMap; @Configuration @PropertySource({"classpath:persistence-multiple-db.properties"}) @EnableJpaRepositories(basePackages = "com.baeldung.dao.repositories.product", entityManagerFactoryRef = "productEntityManager", transactionManagerRef = "productTransactionManager") +@Profile("!tc") public class PersistenceProductConfiguration { @Autowired private Environment env; diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceUserConfiguration.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceUserConfiguration.java index dd32477755..6893d889e6 100644 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceUserConfiguration.java +++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceUserConfiguration.java @@ -2,10 +2,7 @@ package com.baeldung.config; import com.google.common.base.Preconditions; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Primary; -import org.springframework.context.annotation.PropertySource; +import org.springframework.context.annotation.*; import org.springframework.core.env.Environment; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.jdbc.datasource.DriverManagerDataSource; @@ -20,6 +17,7 @@ import java.util.HashMap; @Configuration @PropertySource({"classpath:persistence-multiple-db.properties"}) @EnableJpaRepositories(basePackages = "com.baeldung.dao.repositories.user", entityManagerFactoryRef = "userEntityManager", transactionManagerRef = "userTransactionManager") +@Profile("!tc") public class PersistenceUserConfiguration { @Autowired private Environment env; diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/UserRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/UserRepository.java index 7f54254832..c291f93e2c 100644 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/UserRepository.java +++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/UserRepository.java @@ -1,7 +1,6 @@ package com.baeldung.dao.repositories.user; import com.baeldung.domain.user.User; - import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; @@ -21,13 +20,13 @@ public interface UserRepository extends JpaRepository , UserRepos @Query("SELECT u FROM User u WHERE u.status = 1") Collection findAllActiveUsers(); - @Query(value = "SELECT * FROM USERS.USERS u WHERE u.status = 1", nativeQuery = true) + @Query(value = "SELECT * FROM Users u WHERE u.status = 1", nativeQuery = true) Collection findAllActiveUsersNative(); @Query("SELECT u FROM User u WHERE u.status = ?1") User findUserByStatus(Integer status); - @Query(value = "SELECT * FROM USERS.Users u WHERE u.status = ?1", nativeQuery = true) + @Query(value = "SELECT * FROM Users u WHERE u.status = ?1", nativeQuery = true) User findUserByStatusNative(Integer status); @Query("SELECT u FROM User u WHERE u.status = ?1 and u.name = ?2") @@ -36,7 +35,7 @@ public interface UserRepository extends JpaRepository , UserRepos @Query("SELECT u FROM User u WHERE u.status = :status and u.name = :name") User findUserByStatusAndNameNamedParams(@Param("status") Integer status, @Param("name") String name); - @Query(value = "SELECT * FROM USERS.Users u WHERE u.status = :status AND u.name = :name", nativeQuery = true) + @Query(value = "SELECT * FROM Users u WHERE u.status = :status AND u.name = :name", nativeQuery = true) User findUserByStatusAndNameNamedParamsNative(@Param("status") Integer status, @Param("name") String name); @Query("SELECT u FROM User u WHERE u.status = :status and u.name = :name") @@ -48,7 +47,7 @@ public interface UserRepository extends JpaRepository , UserRepos @Query("SELECT u FROM User u WHERE u.name like :name%") User findUserByNameLikeNamedParam(@Param("name") String name); - @Query(value = "SELECT * FROM USERS.users u WHERE u.name LIKE ?1%", nativeQuery = true) + @Query(value = "SELECT * FROM users u WHERE u.name LIKE ?1%", nativeQuery = true) User findUserByNameLikeNative(String name); @Query(value = "SELECT u FROM User u") @@ -57,7 +56,7 @@ public interface UserRepository extends JpaRepository , UserRepos @Query(value = "SELECT u FROM User u ORDER BY id") Page findAllUsersWithPagination(Pageable pageable); - @Query(value = "SELECT * FROM USERS.Users ORDER BY id", countQuery = "SELECT count(*) FROM USERS.Users", nativeQuery = true) + @Query(value = "SELECT * FROM Users ORDER BY id", countQuery = "SELECT count(*) FROM Users", nativeQuery = true) Page findAllUsersWithPaginationNative(Pageable pageable); @Modifying @@ -65,6 +64,10 @@ public interface UserRepository extends JpaRepository , UserRepos int updateUserSetStatusForName(@Param("status") Integer status, @Param("name") String name); @Modifying - @Query(value = "UPDATE USERS.Users u SET u.status = ? WHERE u.name = ?", nativeQuery = true) + @Query(value = "UPDATE Users u SET u.status = ? WHERE u.name = ?", nativeQuery = true) int updateUserSetStatusForNameNative(Integer status, String name); + + @Modifying + @Query(value = "UPDATE Users u SET status = ? WHERE u.name = ?", nativeQuery = true) + int updateUserSetStatusForNameNativePostgres(Integer status, String name); } diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/user/Possession.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/user/Possession.java index 614e13df36..b1427c0270 100644 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/user/Possession.java +++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/user/Possession.java @@ -1,13 +1,9 @@ package com.baeldung.domain.user; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; +import javax.persistence.*; @Entity -@Table(schema = "users") +@Table public class Possession { @Id diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/user/User.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/user/User.java index 3a8b617d9a..28c52140c7 100644 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/user/User.java +++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/user/User.java @@ -4,7 +4,7 @@ import javax.persistence.*; import java.util.List; @Entity -@Table(name = "users", schema = "users") +@Table(name = "users") public class User { @Id diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryCommon.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryCommon.java new file mode 100644 index 0000000000..8c4e8073b7 --- /dev/null +++ b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryCommon.java @@ -0,0 +1,371 @@ +package com.baeldung.dao.repositories; + +import com.baeldung.dao.repositories.user.UserRepository; +import com.baeldung.domain.user.User; +import org.junit.After; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Sort; +import org.springframework.data.jpa.domain.JpaSort; +import org.springframework.data.mapping.PropertyReferenceException; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.stream.Stream; + +import static org.assertj.core.api.Assertions.assertThat; + +class UserRepositoryCommon { + + final String USER_EMAIL = "email@example.com"; + final String USER_EMAIL2 = "email2@example.com"; + final String USER_EMAIL3 = "email3@example.com"; + final String USER_EMAIL4 = "email4@example.com"; + final Integer INACTIVE_STATUS = 0; + final Integer ACTIVE_STATUS = 1; + private final String USER_EMAIL5 = "email5@example.com"; + private final String USER_EMAIL6 = "email6@example.com"; + private final String USER_NAME_ADAM = "Adam"; + private final String USER_NAME_PETER = "Peter"; + + @Autowired + protected UserRepository userRepository; + + @Test + @Transactional + public void givenUsersWithSameNameInDB_WhenFindAllByName_ThenReturnStreamOfUsers() { + User user1 = new User(); + user1.setName(USER_NAME_ADAM); + user1.setEmail(USER_EMAIL); + userRepository.save(user1); + + User user2 = new User(); + user2.setName(USER_NAME_ADAM); + user2.setEmail(USER_EMAIL2); + userRepository.save(user2); + + User user3 = new User(); + user3.setName(USER_NAME_ADAM); + user3.setEmail(USER_EMAIL3); + userRepository.save(user3); + + User user4 = new User(); + user4.setName("SAMPLE"); + user4.setEmail(USER_EMAIL4); + userRepository.save(user4); + + try (Stream foundUsersStream = userRepository.findAllByName(USER_NAME_ADAM)) { + assertThat(foundUsersStream.count()).isEqualTo(3l); + } + } + + @Test + public void givenUsersInDB_WhenFindAllWithQueryAnnotation_ThenReturnCollectionWithActiveUsers() { + User user1 = new User(); + user1.setName(USER_NAME_ADAM); + user1.setEmail(USER_EMAIL); + user1.setStatus(ACTIVE_STATUS); + userRepository.save(user1); + + User user2 = new User(); + user2.setName(USER_NAME_ADAM); + user2.setEmail(USER_EMAIL2); + user2.setStatus(ACTIVE_STATUS); + userRepository.save(user2); + + User user3 = new User(); + user3.setName(USER_NAME_ADAM); + user3.setEmail(USER_EMAIL3); + user3.setStatus(INACTIVE_STATUS); + userRepository.save(user3); + + Collection allActiveUsers = userRepository.findAllActiveUsers(); + + assertThat(allActiveUsers.size()).isEqualTo(2); + } + + @Test + public void givenUsersInDB_WhenFindAllWithQueryAnnotationNative_ThenReturnCollectionWithActiveUsers() { + User user1 = new User(); + user1.setName(USER_NAME_ADAM); + user1.setEmail(USER_EMAIL); + user1.setStatus(ACTIVE_STATUS); + userRepository.save(user1); + + User user2 = new User(); + user2.setName(USER_NAME_ADAM); + user2.setEmail(USER_EMAIL2); + user2.setStatus(ACTIVE_STATUS); + userRepository.save(user2); + + User user3 = new User(); + user3.setName(USER_NAME_ADAM); + user3.setEmail(USER_EMAIL3); + user3.setStatus(INACTIVE_STATUS); + userRepository.save(user3); + + Collection allActiveUsers = userRepository.findAllActiveUsersNative(); + + assertThat(allActiveUsers.size()).isEqualTo(2); + } + + @Test + public void givenUserInDB_WhenFindUserByStatusWithQueryAnnotation_ThenReturnActiveUser() { + User user = new User(); + user.setName(USER_NAME_ADAM); + user.setEmail(USER_EMAIL); + user.setStatus(ACTIVE_STATUS); + userRepository.save(user); + + User userByStatus = userRepository.findUserByStatus(ACTIVE_STATUS); + + assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); + } + + @Test + public void givenUserInDB_WhenFindUserByStatusWithQueryAnnotationNative_ThenReturnActiveUser() { + User user = new User(); + user.setName(USER_NAME_ADAM); + user.setEmail(USER_EMAIL); + user.setStatus(ACTIVE_STATUS); + userRepository.save(user); + + User userByStatus = userRepository.findUserByStatusNative(ACTIVE_STATUS); + + assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); + } + + @Test + public void givenUsersInDB_WhenFindUserByStatusAndNameWithQueryAnnotationIndexedParams_ThenReturnOneUser() { + User user = new User(); + user.setName(USER_NAME_ADAM); + user.setEmail(USER_EMAIL); + user.setStatus(ACTIVE_STATUS); + userRepository.save(user); + + User user2 = new User(); + user2.setName(USER_NAME_PETER); + user2.setEmail(USER_EMAIL2); + user2.setStatus(ACTIVE_STATUS); + userRepository.save(user2); + + User userByStatus = userRepository.findUserByStatusAndName(ACTIVE_STATUS, USER_NAME_ADAM); + + assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); + } + + @Test + public void givenUsersInDB_WhenFindUserByStatusAndNameWithQueryAnnotationNamedParams_ThenReturnOneUser() { + User user = new User(); + user.setName(USER_NAME_ADAM); + user.setEmail(USER_EMAIL); + user.setStatus(ACTIVE_STATUS); + userRepository.save(user); + + User user2 = new User(); + user2.setName(USER_NAME_PETER); + user2.setEmail(USER_EMAIL2); + user2.setStatus(ACTIVE_STATUS); + userRepository.save(user2); + + User userByStatus = userRepository.findUserByStatusAndNameNamedParams(ACTIVE_STATUS, USER_NAME_ADAM); + + assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); + } + + @Test + public void givenUsersInDB_WhenFindUserByStatusAndNameWithQueryAnnotationNativeNamedParams_ThenReturnOneUser() { + User user = new User(); + user.setName(USER_NAME_ADAM); + user.setEmail(USER_EMAIL); + user.setStatus(ACTIVE_STATUS); + userRepository.save(user); + + User user2 = new User(); + user2.setName(USER_NAME_PETER); + user2.setEmail(USER_EMAIL2); + user2.setStatus(ACTIVE_STATUS); + userRepository.save(user2); + + User userByStatus = userRepository.findUserByStatusAndNameNamedParamsNative(ACTIVE_STATUS, USER_NAME_ADAM); + + assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); + } + + @Test + public void givenUsersInDB_WhenFindUserByStatusAndNameWithQueryAnnotationNamedParamsCustomNames_ThenReturnOneUser() { + User user = new User(); + user.setName(USER_NAME_ADAM); + user.setEmail(USER_EMAIL); + user.setStatus(ACTIVE_STATUS); + userRepository.save(user); + + User user2 = new User(); + user2.setName(USER_NAME_PETER); + user2.setEmail(USER_EMAIL2); + user2.setStatus(ACTIVE_STATUS); + userRepository.save(user2); + + User userByStatus = userRepository.findUserByUserStatusAndUserName(ACTIVE_STATUS, USER_NAME_ADAM); + + assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); + } + + @Test + public void givenUsersInDB_WhenFindUserByNameLikeWithQueryAnnotationIndexedParams_ThenReturnUser() { + User user = new User(); + user.setName(USER_NAME_ADAM); + user.setEmail(USER_EMAIL); + user.setStatus(ACTIVE_STATUS); + userRepository.save(user); + + User userByStatus = userRepository.findUserByNameLike("Ad"); + + assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); + } + + @Test + public void givenUsersInDB_WhenFindUserByNameLikeWithQueryAnnotationNamedParams_ThenReturnUser() { + User user = new User(); + user.setName(USER_NAME_ADAM); + user.setEmail(USER_EMAIL); + user.setStatus(ACTIVE_STATUS); + userRepository.save(user); + + User userByStatus = userRepository.findUserByNameLikeNamedParam("Ad"); + + assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); + } + + @Test + public void givenUsersInDB_WhenFindUserByNameLikeWithQueryAnnotationNative_ThenReturnUser() { + User user = new User(); + user.setName(USER_NAME_ADAM); + user.setEmail(USER_EMAIL); + user.setStatus(ACTIVE_STATUS); + userRepository.save(user); + + User userByStatus = userRepository.findUserByNameLikeNative("Ad"); + + assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); + } + + @Test + public void givenUsersInDB_WhenFindAllWithSortByName_ThenReturnUsersSorted() { + userRepository.save(new User(USER_NAME_ADAM, USER_EMAIL, ACTIVE_STATUS)); + userRepository.save(new User(USER_NAME_PETER, USER_EMAIL2, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE", USER_EMAIL3, INACTIVE_STATUS)); + + List usersSortByName = userRepository.findAll(new Sort(Sort.Direction.ASC, "name")); + + assertThat(usersSortByName.get(0) + .getName()).isEqualTo(USER_NAME_ADAM); + } + + @Test(expected = PropertyReferenceException.class) + public void givenUsersInDB_WhenFindAllSortWithFunction_ThenThrowException() { + userRepository.save(new User(USER_NAME_ADAM, USER_EMAIL, ACTIVE_STATUS)); + userRepository.save(new User(USER_NAME_PETER, USER_EMAIL2, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE", USER_EMAIL3, INACTIVE_STATUS)); + + userRepository.findAll(new Sort(Sort.Direction.ASC, "name")); + + List usersSortByNameLength = userRepository.findAll(new Sort("LENGTH(name)")); + + assertThat(usersSortByNameLength.get(0) + .getName()).isEqualTo(USER_NAME_ADAM); + } + + @Test + public void givenUsersInDB_WhenFindAllSortWithFunctionQueryAnnotationJPQL_ThenReturnUsersSorted() { + userRepository.save(new User(USER_NAME_ADAM, USER_EMAIL, ACTIVE_STATUS)); + userRepository.save(new User(USER_NAME_PETER, USER_EMAIL2, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE", USER_EMAIL3, INACTIVE_STATUS)); + + userRepository.findAllUsers(new Sort("name")); + + List usersSortByNameLength = userRepository.findAllUsers(JpaSort.unsafe("LENGTH(name)")); + + assertThat(usersSortByNameLength.get(0) + .getName()).isEqualTo(USER_NAME_ADAM); + } + + @Test + public void givenUsersInDB_WhenFindAllWithPageRequestQueryAnnotationJPQL_ThenReturnPageOfUsers() { + userRepository.save(new User(USER_NAME_ADAM, USER_EMAIL, ACTIVE_STATUS)); + userRepository.save(new User(USER_NAME_PETER, USER_EMAIL2, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE", USER_EMAIL3, INACTIVE_STATUS)); + userRepository.save(new User("SAMPLE1", USER_EMAIL4, INACTIVE_STATUS)); + userRepository.save(new User("SAMPLE2", USER_EMAIL5, INACTIVE_STATUS)); + userRepository.save(new User("SAMPLE3", USER_EMAIL6, INACTIVE_STATUS)); + + Page usersPage = userRepository.findAllUsersWithPagination(new PageRequest(1, 3)); + + assertThat(usersPage.getContent() + .get(0) + .getName()).isEqualTo("SAMPLE1"); + } + + @Test + public void givenUsersInDB_WhenFindAllWithPageRequestQueryAnnotationNative_ThenReturnPageOfUsers() { + userRepository.save(new User(USER_NAME_ADAM, USER_EMAIL, ACTIVE_STATUS)); + userRepository.save(new User(USER_NAME_PETER, USER_EMAIL2, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE", USER_EMAIL3, INACTIVE_STATUS)); + userRepository.save(new User("SAMPLE1", USER_EMAIL4, INACTIVE_STATUS)); + userRepository.save(new User("SAMPLE2", USER_EMAIL5, INACTIVE_STATUS)); + userRepository.save(new User("SAMPLE3", USER_EMAIL6, INACTIVE_STATUS)); + + Page usersSortByNameLength = userRepository.findAllUsersWithPaginationNative(new PageRequest(1, 3)); + + assertThat(usersSortByNameLength.getContent() + .get(0) + .getName()).isEqualTo("SAMPLE1"); + } + + @Test + @Transactional + public void givenUsersInDB_WhenUpdateStatusForNameModifyingQueryAnnotationJPQL_ThenModifyMatchingUsers() { + userRepository.save(new User("SAMPLE", USER_EMAIL, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE1", USER_EMAIL2, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE", USER_EMAIL3, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE3", USER_EMAIL4, ACTIVE_STATUS)); + + int updatedUsersSize = userRepository.updateUserSetStatusForName(INACTIVE_STATUS, "SAMPLE"); + + assertThat(updatedUsersSize).isEqualTo(2); + } + + @Test + public void givenUsersInDB_WhenFindByEmailsWithDynamicQuery_ThenReturnCollection() { + + User user1 = new User(); + user1.setEmail(USER_EMAIL); + userRepository.save(user1); + + User user2 = new User(); + user2.setEmail(USER_EMAIL2); + userRepository.save(user2); + + User user3 = new User(); + user3.setEmail(USER_EMAIL3); + userRepository.save(user3); + + Set emails = new HashSet<>(); + emails.add(USER_EMAIL2); + emails.add(USER_EMAIL3); + + Collection usersWithEmails = userRepository.findUserByEmails(emails); + + assertThat(usersWithEmails.size()).isEqualTo(2); + } + + @After + public void cleanUp() { + userRepository.deleteAll(); + } +} diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryIntegrationTest.java index b05086d00e..6bcbb6dcaa 100644 --- a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryIntegrationTest.java +++ b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryIntegrationTest.java @@ -1,28 +1,14 @@ package com.baeldung.dao.repositories; import com.baeldung.config.PersistenceConfiguration; -import com.baeldung.dao.repositories.user.UserRepository; import com.baeldung.domain.user.User; -import org.junit.After; 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.data.domain.Page; -import org.springframework.data.domain.PageRequest; -import org.springframework.data.domain.Sort; -import org.springframework.data.jpa.domain.JpaSort; -import org.springframework.data.mapping.PropertyReferenceException; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.transaction.annotation.Transactional; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.stream.Stream; - import static org.assertj.core.api.Assertions.assertThat; /** @@ -31,327 +17,7 @@ import static org.assertj.core.api.Assertions.assertThat; @RunWith(SpringRunner.class) @SpringBootTest(classes = PersistenceConfiguration.class) @DirtiesContext -public class UserRepositoryIntegrationTest { - - private final String USER_NAME_ADAM = "Adam"; - private final String USER_NAME_PETER = "Peter"; - - private final String USER_EMAIL = "email@example.com"; - private final String USER_EMAIL2 = "email2@example.com"; - private final String USER_EMAIL3 = "email3@example.com"; - private final String USER_EMAIL4 = "email4@example.com"; - private final String USER_EMAIL5 = "email5@example.com"; - private final String USER_EMAIL6 = "email6@example.com"; - - private final Integer INACTIVE_STATUS = 0; - private final Integer ACTIVE_STATUS = 1; - - @Autowired - private UserRepository userRepository; - - @Test - @Transactional - public void givenUsersWithSameNameInDBWhenFindAllByNameThenReturnStreamOfUsers() { - User user1 = new User(); - user1.setName(USER_NAME_ADAM); - user1.setEmail(USER_EMAIL); - userRepository.save(user1); - - User user2 = new User(); - user2.setName(USER_NAME_ADAM); - user2.setEmail(USER_EMAIL2); - userRepository.save(user2); - - User user3 = new User(); - user3.setName(USER_NAME_ADAM); - user3.setEmail(USER_EMAIL3); - userRepository.save(user3); - - User user4 = new User(); - user4.setName("SAMPLE"); - user4.setEmail(USER_EMAIL4); - userRepository.save(user4); - - try (Stream foundUsersStream = userRepository.findAllByName(USER_NAME_ADAM)) { - assertThat(foundUsersStream.count()).isEqualTo(3l); - } - } - - @Test - public void givenUsersInDBWhenFindAllWithQueryAnnotationThenReturnCollectionWithActiveUsers() { - User user1 = new User(); - user1.setName(USER_NAME_ADAM); - user1.setEmail(USER_EMAIL); - user1.setStatus(ACTIVE_STATUS); - userRepository.save(user1); - - User user2 = new User(); - user2.setName(USER_NAME_ADAM); - user2.setEmail(USER_EMAIL2); - user2.setStatus(ACTIVE_STATUS); - userRepository.save(user2); - - User user3 = new User(); - user3.setName(USER_NAME_ADAM); - user3.setEmail(USER_EMAIL3); - user3.setStatus(INACTIVE_STATUS); - userRepository.save(user3); - - Collection allActiveUsers = userRepository.findAllActiveUsers(); - - assertThat(allActiveUsers.size()).isEqualTo(2); - } - - @Test - public void givenUsersInDBWhenFindAllWithQueryAnnotationNativeThenReturnCollectionWithActiveUsers() { - User user1 = new User(); - user1.setName(USER_NAME_ADAM); - user1.setEmail(USER_EMAIL); - user1.setStatus(ACTIVE_STATUS); - userRepository.save(user1); - - User user2 = new User(); - user2.setName(USER_NAME_ADAM); - user2.setEmail(USER_EMAIL2); - user2.setStatus(ACTIVE_STATUS); - userRepository.save(user2); - - User user3 = new User(); - user3.setName(USER_NAME_ADAM); - user3.setEmail(USER_EMAIL3); - user3.setStatus(INACTIVE_STATUS); - userRepository.save(user3); - - Collection allActiveUsers = userRepository.findAllActiveUsersNative(); - - assertThat(allActiveUsers.size()).isEqualTo(2); - } - - @Test - public void givenUserInDBWhenFindUserByStatusWithQueryAnnotationThenReturnActiveUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User userByStatus = userRepository.findUserByStatus(ACTIVE_STATUS); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUserInDBWhenFindUserByStatusWithQueryAnnotationNativeThenReturnActiveUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User userByStatus = userRepository.findUserByStatusNative(ACTIVE_STATUS); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDBWhenFindUserByStatusAndNameWithQueryAnnotationIndexedParamsThenReturnOneUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User user2 = new User(); - user2.setName(USER_NAME_PETER); - user2.setEmail(USER_EMAIL2); - user2.setStatus(ACTIVE_STATUS); - userRepository.save(user2); - - User userByStatus = userRepository.findUserByStatusAndName(ACTIVE_STATUS, USER_NAME_ADAM); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDBWhenFindUserByStatusAndNameWithQueryAnnotationNamedParamsThenReturnOneUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User user2 = new User(); - user2.setName(USER_NAME_PETER); - user2.setEmail(USER_EMAIL2); - user2.setStatus(ACTIVE_STATUS); - userRepository.save(user2); - - User userByStatus = userRepository.findUserByStatusAndNameNamedParams(ACTIVE_STATUS, USER_NAME_ADAM); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDBWhenFindUserByStatusAndNameWithQueryAnnotationNativeNamedParamsThenReturnOneUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User user2 = new User(); - user2.setName(USER_NAME_PETER); - user2.setEmail(USER_EMAIL2); - user2.setStatus(ACTIVE_STATUS); - userRepository.save(user2); - - User userByStatus = userRepository.findUserByStatusAndNameNamedParamsNative(ACTIVE_STATUS, USER_NAME_ADAM); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDBWhenFindUserByStatusAndNameWithQueryAnnotationNamedParamsCustomNamesThenReturnOneUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User user2 = new User(); - user2.setName(USER_NAME_PETER); - user2.setEmail(USER_EMAIL2); - user2.setStatus(ACTIVE_STATUS); - userRepository.save(user2); - - User userByStatus = userRepository.findUserByUserStatusAndUserName(ACTIVE_STATUS, USER_NAME_ADAM); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDBWhenFindUserByNameLikeWithQueryAnnotationIndexedParamsThenReturnUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User userByStatus = userRepository.findUserByNameLike("Ad"); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDBWhenFindUserByNameLikeWithQueryAnnotationNamedParamsThenReturnUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User userByStatus = userRepository.findUserByNameLikeNamedParam("Ad"); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDBWhenFindUserByNameLikeWithQueryAnnotationNativeThenReturnUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User userByStatus = userRepository.findUserByNameLikeNative("Ad"); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDBWhenFindAllWithSortByNameThenReturnUsersSorted() { - userRepository.save(new User(USER_NAME_ADAM, USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User(USER_NAME_PETER, USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", USER_EMAIL3, INACTIVE_STATUS)); - - List usersSortByName = userRepository.findAll(new Sort(Sort.Direction.ASC, "name")); - - assertThat(usersSortByName.get(0) - .getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test(expected = PropertyReferenceException.class) - public void givenUsersInDBWhenFindAllSortWithFunctionThenThrowException() { - userRepository.save(new User(USER_NAME_ADAM, USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User(USER_NAME_PETER, USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", USER_EMAIL3, INACTIVE_STATUS)); - - userRepository.findAll(new Sort(Sort.Direction.ASC, "name")); - - List usersSortByNameLength = userRepository.findAll(new Sort("LENGTH(name)")); - - assertThat(usersSortByNameLength.get(0) - .getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDBWhenFindAllSortWithFunctionQueryAnnotationJPQLThenReturnUsersSorted() { - userRepository.save(new User(USER_NAME_ADAM, USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User(USER_NAME_PETER, USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", USER_EMAIL3, INACTIVE_STATUS)); - - userRepository.findAllUsers(new Sort("name")); - - List usersSortByNameLength = userRepository.findAllUsers(JpaSort.unsafe("LENGTH(name)")); - - assertThat(usersSortByNameLength.get(0) - .getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDBWhenFindAllWithPageRequestQueryAnnotationJPQLThenReturnPageOfUsers() { - userRepository.save(new User(USER_NAME_ADAM, USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User(USER_NAME_PETER, USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", USER_EMAIL3, INACTIVE_STATUS)); - userRepository.save(new User("SAMPLE1", USER_EMAIL4, INACTIVE_STATUS)); - userRepository.save(new User("SAMPLE2", USER_EMAIL5, INACTIVE_STATUS)); - userRepository.save(new User("SAMPLE3", USER_EMAIL6, INACTIVE_STATUS)); - - Page usersPage = userRepository.findAllUsersWithPagination(new PageRequest(1, 3)); - - assertThat(usersPage.getContent() - .get(0) - .getName()).isEqualTo("SAMPLE1"); - } - - @Test - public void givenUsersInDBWhenFindAllWithPageRequestQueryAnnotationNativeThenReturnPageOfUsers() { - userRepository.save(new User(USER_NAME_ADAM, USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User(USER_NAME_PETER, USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", USER_EMAIL3, INACTIVE_STATUS)); - userRepository.save(new User("SAMPLE1", USER_EMAIL4, INACTIVE_STATUS)); - userRepository.save(new User("SAMPLE2", USER_EMAIL5, INACTIVE_STATUS)); - userRepository.save(new User("SAMPLE3", USER_EMAIL6, INACTIVE_STATUS)); - - Page usersSortByNameLength = userRepository.findAllUsersWithPaginationNative(new PageRequest(1, 3)); - - assertThat(usersSortByNameLength.getContent() - .get(0) - .getName()).isEqualTo("SAMPLE1"); - } - - @Test - @Transactional - public void givenUsersInDBWhenUpdateStatusForNameModifyingQueryAnnotationJPQLThenModifyMatchingUsers() { - userRepository.save(new User("SAMPLE", USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE1", USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", USER_EMAIL3, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE3", USER_EMAIL4, ACTIVE_STATUS)); - - int updatedUsersSize = userRepository.updateUserSetStatusForName(INACTIVE_STATUS, "SAMPLE"); - - assertThat(updatedUsersSize).isEqualTo(2); - } +public class UserRepositoryIntegrationTest extends UserRepositoryCommon { @Test @Transactional @@ -366,34 +32,4 @@ public class UserRepositoryIntegrationTest { assertThat(updatedUsersSize).isEqualTo(2); } - - @Test - public void givenUsersInDBWhenFindByEmailsWithDynamicQueryThenReturnCollection() { - - User user1 = new User(); - user1.setEmail(USER_EMAIL); - userRepository.save(user1); - - User user2 = new User(); - user2.setEmail(USER_EMAIL2); - userRepository.save(user2); - - User user3 = new User(); - user3.setEmail(USER_EMAIL3); - userRepository.save(user3); - - Set emails = new HashSet<>(); - emails.add(USER_EMAIL2); - emails.add(USER_EMAIL3); - - Collection usersWithEmails = userRepository.findUserByEmails(emails); - - assertThat(usersWithEmails.size()).isEqualTo(2); - } - - @After - public void cleanUp() { - userRepository.deleteAll(); - } - } diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryTCAutoIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryTCAutoIntegrationTest.java new file mode 100644 index 0000000000..4b58be487c --- /dev/null +++ b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryTCAutoIntegrationTest.java @@ -0,0 +1,40 @@ +package com.baeldung.dao.repositories; + +import com.baeldung.domain.user.User; +import com.baeldung.util.BaeldungPostgresqlContainer; +import org.junit.ClassRule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.transaction.annotation.Transactional; +import org.testcontainers.containers.PostgreSQLContainer; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * Created by adam. + */ +@RunWith(SpringRunner.class) +@SpringBootTest +@ActiveProfiles({"tc", "tc-auto"}) +public class UserRepositoryTCAutoIntegrationTest extends UserRepositoryCommon { + + @ClassRule + public static PostgreSQLContainer postgreSQLContainer = BaeldungPostgresqlContainer.getInstance(); + + @Test + @Transactional + public void givenUsersInDB_WhenUpdateStatusForNameModifyingQueryAnnotationNativePostgres_ThenModifyMatchingUsers() { + userRepository.save(new User("SAMPLE", USER_EMAIL, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE1", USER_EMAIL2, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE", USER_EMAIL3, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE3", USER_EMAIL4, ACTIVE_STATUS)); + userRepository.flush(); + + int updatedUsersSize = userRepository.updateUserSetStatusForNameNativePostgres(INACTIVE_STATUS, "SAMPLE"); + + assertThat(updatedUsersSize).isEqualTo(2); + } +} diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryTCIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryTCIntegrationTest.java new file mode 100644 index 0000000000..ccbc3b3fe2 --- /dev/null +++ b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryTCIntegrationTest.java @@ -0,0 +1,55 @@ +package com.baeldung.dao.repositories; + +import com.baeldung.domain.user.User; +import org.junit.ClassRule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.util.TestPropertyValues; +import org.springframework.context.ApplicationContextInitializer; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.transaction.annotation.Transactional; +import org.testcontainers.containers.PostgreSQLContainer; + +import static org.assertj.core.api.Assertions.assertThat; + +@RunWith(SpringRunner.class) +@SpringBootTest +@ActiveProfiles("tc") +@ContextConfiguration(initializers = {UserRepositoryTCIntegrationTest.Initializer.class}) +public class UserRepositoryTCIntegrationTest extends UserRepositoryCommon { + + @ClassRule + public static PostgreSQLContainer postgreSQLContainer = new PostgreSQLContainer("postgres:11.1") + .withDatabaseName("integration-tests-db") + .withUsername("sa") + .withPassword("sa"); + + @Test + @Transactional + public void givenUsersInDB_WhenUpdateStatusForNameModifyingQueryAnnotationNative_ThenModifyMatchingUsers() { + userRepository.save(new User("SAMPLE", USER_EMAIL, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE1", USER_EMAIL2, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE", USER_EMAIL3, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE3", USER_EMAIL4, ACTIVE_STATUS)); + userRepository.flush(); + + int updatedUsersSize = userRepository.updateUserSetStatusForNameNativePostgres(INACTIVE_STATUS, "SAMPLE"); + + assertThat(updatedUsersSize).isEqualTo(2); + } + + static class Initializer + implements ApplicationContextInitializer { + public void initialize(ConfigurableApplicationContext configurableApplicationContext) { + TestPropertyValues.of( + "spring.datasource.url=" + postgreSQLContainer.getJdbcUrl(), + "spring.datasource.username=" + postgreSQLContainer.getUsername(), + "spring.datasource.password=" + postgreSQLContainer.getPassword() + ).applyTo(configurableApplicationContext.getEnvironment()); + } + } +} diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/util/BaeldungPostgresqlContainer.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/util/BaeldungPostgresqlContainer.java new file mode 100644 index 0000000000..e5ad2dd448 --- /dev/null +++ b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/util/BaeldungPostgresqlContainer.java @@ -0,0 +1,35 @@ +package com.baeldung.util; + +import org.testcontainers.containers.PostgreSQLContainer; + +public class BaeldungPostgresqlContainer extends PostgreSQLContainer { + + private static final String IMAGE_VERSION = "postgres:11.1"; + + private static BaeldungPostgresqlContainer container; + + + private BaeldungPostgresqlContainer() { + super(IMAGE_VERSION); + } + + public static BaeldungPostgresqlContainer getInstance() { + if (container == null) { + container = new BaeldungPostgresqlContainer(); + } + return container; + } + + @Override + public void start() { + super.start(); + System.setProperty("DB_URL", container.getJdbcUrl()); + System.setProperty("DB_USERNAME", container.getUsername()); + System.setProperty("DB_PASSWORD", container.getPassword()); + } + + @Override + public void stop() { + //do nothing, JVM handles shut down + } +} diff --git a/persistence-modules/spring-data-jpa/src/test/resources/application-tc-auto.properties b/persistence-modules/spring-data-jpa/src/test/resources/application-tc-auto.properties new file mode 100644 index 0000000000..c3005d861f --- /dev/null +++ b/persistence-modules/spring-data-jpa/src/test/resources/application-tc-auto.properties @@ -0,0 +1,4 @@ +# configuration for test containers testing +spring.datasource.url=${DB_URL} +spring.datasource.username=${DB_USERNAME} +spring.datasource.password=${DB_PASSWORD} diff --git a/persistence-modules/spring-data-jpa/src/test/resources/application-tc.properties b/persistence-modules/spring-data-jpa/src/test/resources/application-tc.properties new file mode 100644 index 0000000000..3bf8693d53 --- /dev/null +++ b/persistence-modules/spring-data-jpa/src/test/resources/application-tc.properties @@ -0,0 +1,4 @@ +# configuration for Test Containers testing +spring.datasource.driver-class-name=org.postgresql.Driver +spring.jpa.hibernate.ddl-auto=create-drop +spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false From cf72052df53f7f9b542324f8ca1cae722affb7f7 Mon Sep 17 00:00:00 2001 From: Laurentiu Delcea Date: Wed, 13 Feb 2019 01:20:38 +0200 Subject: [PATCH 140/143] BAEL-2651 Implement Java static methods equivalent (#6322) --- .../main/kotlin/com/baeldung/static/ConsoleUtils.kt | 10 ++++++++++ .../main/kotlin/com/baeldung/static/LoggingUtils.kt | 5 +++++ .../kotlin/com/baeldung/static/ConsoleUtilsUnitTest.kt | 10 ++++++++++ .../kotlin/com/baeldung/static/LoggingUtilsUnitTest.kt | 10 ++++++++++ 4 files changed, 35 insertions(+) create mode 100644 core-kotlin/src/main/kotlin/com/baeldung/static/ConsoleUtils.kt create mode 100644 core-kotlin/src/main/kotlin/com/baeldung/static/LoggingUtils.kt create mode 100644 core-kotlin/src/test/kotlin/com/baeldung/static/ConsoleUtilsUnitTest.kt create mode 100644 core-kotlin/src/test/kotlin/com/baeldung/static/LoggingUtilsUnitTest.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/static/ConsoleUtils.kt b/core-kotlin/src/main/kotlin/com/baeldung/static/ConsoleUtils.kt new file mode 100644 index 0000000000..23c7cfb11a --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/static/ConsoleUtils.kt @@ -0,0 +1,10 @@ +package com.baeldung.static + +class ConsoleUtils { + companion object { + @JvmStatic + fun debug(debugMessage : String) { + println("[DEBUG] $debugMessage") + } + } +} \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/static/LoggingUtils.kt b/core-kotlin/src/main/kotlin/com/baeldung/static/LoggingUtils.kt new file mode 100644 index 0000000000..e67addc9ea --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/static/LoggingUtils.kt @@ -0,0 +1,5 @@ +package com.baeldung.static + +fun debug(debugMessage : String) { + println("[DEBUG] $debugMessage") +} \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/static/ConsoleUtilsUnitTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/static/ConsoleUtilsUnitTest.kt new file mode 100644 index 0000000000..8abed144eb --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/static/ConsoleUtilsUnitTest.kt @@ -0,0 +1,10 @@ +package com.baeldung.static + +import org.junit.Test + +class ConsoleUtilsUnitTest { + @Test + fun givenAStaticMethod_whenCalled_thenNoErrorIsThrown() { + ConsoleUtils.debug("test message") + } +} \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/static/LoggingUtilsUnitTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/static/LoggingUtilsUnitTest.kt new file mode 100644 index 0000000000..59587ff009 --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/static/LoggingUtilsUnitTest.kt @@ -0,0 +1,10 @@ +package com.baeldung.static + +import org.junit.Test + +class LoggingUtilsUnitTest { + @Test + fun givenAPackageMethod_whenCalled_thenNoErrorIsThrown() { + debug("test message") + } +} \ No newline at end of file From cc49ae8cdf65a47c497fa082d0e89b7313a56059 Mon Sep 17 00:00:00 2001 From: Urvy Agrawal Date: Wed, 13 Feb 2019 09:21:07 +0530 Subject: [PATCH 141/143] Added files for BAEL-2044 (#6296) --- .../java11/httpclient/HttpClientExample.java | 132 ++++++++++ .../httpclient/test/HttpClientTest.java | 240 ++++++++++++++++++ .../httpclient/test/HttpRequestTest.java | 168 ++++++++++++ .../httpclient/test/HttpResponseTest.java | 54 ++++ 4 files changed, 594 insertions(+) create mode 100644 core-java-11/src/main/java/com/baeldung/java11/httpclient/HttpClientExample.java create mode 100644 core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpClientTest.java create mode 100644 core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpRequestTest.java create mode 100644 core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpResponseTest.java diff --git a/core-java-11/src/main/java/com/baeldung/java11/httpclient/HttpClientExample.java b/core-java-11/src/main/java/com/baeldung/java11/httpclient/HttpClientExample.java new file mode 100644 index 0000000000..fb4abd3bb6 --- /dev/null +++ b/core-java-11/src/main/java/com/baeldung/java11/httpclient/HttpClientExample.java @@ -0,0 +1,132 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.baeldung.java11.httpclient; + +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.http.HttpClient; +import java.net.http.HttpClient.Version; +import java.net.http.HttpRequest; +import java.net.http.HttpRequest.BodyPublishers; +import java.net.http.HttpResponse; +import java.net.http.HttpResponse.BodyHandlers; +import java.net.http.HttpResponse.PushPromiseHandler; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import java.util.stream.Collectors; + +public class HttpClientExample { + + public static void main(String[] args) throws Exception { + httpGetRequest(); + httpPostRequest(); + asynchronousGetRequest(); + asynchronousMultipleRequests(); + pushRequest(); + } + + public static void httpGetRequest() throws URISyntaxException, IOException, InterruptedException { + HttpClient client = HttpClient.newHttpClient(); + HttpRequest request = HttpRequest.newBuilder() + .version(HttpClient.Version.HTTP_2) + .uri(URI.create("http://jsonplaceholder.typicode.com/posts/1")) + .headers("Accept-Enconding", "gzip, deflate") + .build(); + HttpResponse response = client.send(request, BodyHandlers.ofString()); + + String responseBody = response.body(); + int responseStatusCode = response.statusCode(); + + System.out.println("httpGetRequest: " + responseBody); + System.out.println("httpGetRequest status code: " + responseStatusCode); + } + + public static void httpPostRequest() throws URISyntaxException, IOException, InterruptedException { + HttpClient client = HttpClient.newBuilder() + .version(HttpClient.Version.HTTP_2) + .build(); + HttpRequest request = HttpRequest.newBuilder(new URI("http://jsonplaceholder.typicode.com/posts")) + .version(HttpClient.Version.HTTP_2) + .POST(BodyPublishers.ofString("Sample Post Request")) + .build(); + HttpResponse response = client.send(request, BodyHandlers.ofString()); + String responseBody = response.body(); + System.out.println("httpPostRequest : " + responseBody); + } + + public static void asynchronousGetRequest() throws URISyntaxException { + HttpClient client = HttpClient.newHttpClient(); + URI httpURI = new URI("http://jsonplaceholder.typicode.com/posts/1"); + HttpRequest request = HttpRequest.newBuilder(httpURI) + .version(HttpClient.Version.HTTP_2) + .build(); + CompletableFuture futureResponse = client.sendAsync(request, HttpResponse.BodyHandlers.ofString()) + .thenAccept(resp -> { + System.out.println("Got pushed response " + resp.uri()); + System.out.println("Response statuscode: " + resp.statusCode()); + System.out.println("Response body: " + resp.body()); + }); + System.out.println("futureResponse" + futureResponse); + + } + + public static void asynchronousMultipleRequests() throws URISyntaxException { + HttpClient client = HttpClient.newHttpClient(); + List uris = Arrays.asList(new URI("http://jsonplaceholder.typicode.com/posts/1"), new URI("http://jsonplaceholder.typicode.com/posts/2")); + List requests = uris.stream() + .map(HttpRequest::newBuilder) + .map(reqBuilder -> reqBuilder.build()) + .collect(Collectors.toList()); + System.out.println("Got pushed response1 " + requests); + CompletableFuture.allOf(requests.stream() + .map(request -> client.sendAsync(request, BodyHandlers.ofString())) + .toArray(CompletableFuture[]::new)) + .thenAccept(System.out::println) + .join(); + } + + public static void pushRequest() throws URISyntaxException, InterruptedException { + System.out.println("Running HTTP/2 Server Push example..."); + + HttpClient httpClient = HttpClient.newBuilder() + .version(Version.HTTP_2) + .build(); + + HttpRequest pageRequest = HttpRequest.newBuilder() + .uri(URI.create("https://http2.golang.org/serverpush")) + .build(); + + // Interface HttpResponse.PushPromiseHandler + // void applyPushPromise​(HttpRequest initiatingRequest, HttpRequest pushPromiseRequest, Function,​CompletableFuture>> acceptor) + httpClient.sendAsync(pageRequest, BodyHandlers.ofString(), pushPromiseHandler()) + .thenAccept(pageResponse -> { + System.out.println("Page response status code: " + pageResponse.statusCode()); + System.out.println("Page response headers: " + pageResponse.headers()); + String responseBody = pageResponse.body(); + System.out.println(responseBody); + }).join(); + + Thread.sleep(1000); // waiting for full response + } + + private static PushPromiseHandler pushPromiseHandler() { + return (HttpRequest initiatingRequest, + HttpRequest pushPromiseRequest, + Function, + CompletableFuture>> acceptor) -> { + acceptor.apply(BodyHandlers.ofString()) + .thenAccept(resp -> { + System.out.println(" Pushed response: " + resp.uri() + ", headers: " + resp.headers()); + }); + System.out.println("Promise request: " + pushPromiseRequest.uri()); + System.out.println("Promise request: " + pushPromiseRequest.headers()); + }; + } + +} diff --git a/core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpClientTest.java b/core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpClientTest.java new file mode 100644 index 0000000000..bade666636 --- /dev/null +++ b/core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpClientTest.java @@ -0,0 +1,240 @@ +package com.baeldung.java11.httpclient.test; + +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.IOException; +import java.net.Authenticator; +import java.net.CookieManager; +import java.net.CookiePolicy; +import java.net.HttpURLConnection; +import java.net.PasswordAuthentication; +import java.net.ProxySelector; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.net.http.HttpResponse.BodyHandlers; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +import org.junit.jupiter.api.Test; + +public class HttpClientTest { + + @Test + public void shouldReturnSampleDataContentWhenConnectViaSystemProxy() throws IOException, InterruptedException, URISyntaxException { + HttpRequest request = HttpRequest.newBuilder() + .uri(new URI("https://postman-echo.com/post")) + .headers("Content-Type", "text/plain;charset=UTF-8") + .POST(HttpRequest.BodyPublishers.ofString("Sample body")) + .build(); + + + HttpResponse response = HttpClient.newBuilder() + .proxy(ProxySelector.getDefault()) + .build() + .send(request, HttpResponse.BodyHandlers.ofString()); + + assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK)); + assertThat(response.body(), containsString("Sample body")); + } + + @Test + public void shouldNotFollowRedirectWhenSetToDefaultNever() throws IOException, InterruptedException, URISyntaxException { + HttpRequest request = HttpRequest.newBuilder() + .uri(new URI("http://stackoverflow.com")) + .version(HttpClient.Version.HTTP_1_1) + .GET() + .build(); + HttpResponse response = HttpClient.newBuilder() + .build() + .send(request, HttpResponse.BodyHandlers.ofString()); + + assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_MOVED_PERM)); + assertThat(response.body(), containsString("https://stackoverflow.com/")); + } + + @Test + public void shouldFollowRedirectWhenSetToAlways() throws IOException, InterruptedException, URISyntaxException { + HttpRequest request = HttpRequest.newBuilder() + .uri(new URI("http://stackoverflow.com")) + .version(HttpClient.Version.HTTP_1_1) + .GET() + .build(); + HttpResponse response = HttpClient.newBuilder() + .followRedirects(HttpClient.Redirect.ALWAYS) + .build() + .send(request, HttpResponse.BodyHandlers.ofString()); + + assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK)); + assertThat(response.request() + .uri() + .toString(), equalTo("https://stackoverflow.com/")); + } + + @Test + public void shouldReturnOKStatusForAuthenticatedAccess() throws URISyntaxException, IOException, InterruptedException { + HttpRequest request = HttpRequest.newBuilder() + .uri(new URI("https://postman-echo.com/basic-auth")) + .GET() + .build(); + HttpResponse response = HttpClient.newBuilder() + .authenticator(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication("postman", "password".toCharArray()); + } + }) + .build() + .send(request, HttpResponse.BodyHandlers.ofString()); + + assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK)); + } + + @Test + public void shouldSendRequestAsync() throws URISyntaxException, InterruptedException, ExecutionException { + HttpRequest request = HttpRequest.newBuilder() + .uri(new URI("https://postman-echo.com/post")) + .headers("Content-Type", "text/plain;charset=UTF-8") + .POST(HttpRequest.BodyPublishers.ofString("Sample body")) + .build(); + CompletableFuture> response = HttpClient.newBuilder() + .build() + .sendAsync(request, HttpResponse.BodyHandlers.ofString()); + + assertThat(response.get() + .statusCode(), equalTo(HttpURLConnection.HTTP_OK)); + } + + @Test + public void shouldUseJustTwoThreadWhenProcessingSendAsyncRequest() throws URISyntaxException, InterruptedException, ExecutionException { + HttpRequest request = HttpRequest.newBuilder() + .uri(new URI("https://postman-echo.com/get")) + .GET() + .build(); + + ExecutorService executorService = Executors.newFixedThreadPool(2); + + CompletableFuture> response1 = HttpClient.newBuilder() + .executor(executorService) + .build() + .sendAsync(request, HttpResponse.BodyHandlers.ofString()); + + CompletableFuture> response2 = HttpClient.newBuilder() + .executor(executorService) + .build() + .sendAsync(request, HttpResponse.BodyHandlers.ofString()); + + CompletableFuture> response3 = HttpClient.newBuilder() + .executor(executorService) + .build() + .sendAsync(request, HttpResponse.BodyHandlers.ofString()); + + CompletableFuture.allOf(response1, response2, response3) + .join(); + + assertThat(response1.get() + .statusCode(), equalTo(HttpURLConnection.HTTP_OK)); + assertThat(response2.get() + .statusCode(), equalTo(HttpURLConnection.HTTP_OK)); + assertThat(response3.get() + .statusCode(), equalTo(HttpURLConnection.HTTP_OK)); + } + + @Test + public void shouldNotStoreCookieWhenPolicyAcceptNone() throws URISyntaxException, IOException, InterruptedException { + HttpRequest request = HttpRequest.newBuilder() + .uri(new URI("https://postman-echo.com/get")) + .GET() + .build(); + + HttpClient httpClient = HttpClient.newBuilder() + .cookieHandler(new CookieManager(null, CookiePolicy.ACCEPT_NONE)) + .build(); + + httpClient.send(request, HttpResponse.BodyHandlers.ofString()); + + assertTrue(httpClient.cookieHandler() + .isPresent()); + } + + @Test + public void shouldStoreCookieWhenPolicyAcceptAll() throws URISyntaxException, IOException, InterruptedException { + HttpRequest request = HttpRequest.newBuilder() + .uri(new URI("https://postman-echo.com/get")) + .GET() + .build(); + + HttpClient httpClient = HttpClient.newBuilder() + .cookieHandler(new CookieManager(null, CookiePolicy.ACCEPT_ALL)) + .build(); + + httpClient.send(request, HttpResponse.BodyHandlers.ofString()); + + assertTrue(httpClient.cookieHandler() + .isPresent()); + } + + @Test + public void shouldProcessMultipleRequestViaStream() throws URISyntaxException, ExecutionException, InterruptedException { + List targets = Arrays.asList(new URI("https://postman-echo.com/get?foo1=bar1"), new URI("https://postman-echo.com/get?foo2=bar2")); + + HttpClient client = HttpClient.newHttpClient(); + + List> futures = targets.stream() + .map(target -> client.sendAsync(HttpRequest.newBuilder(target) + .GET() + .build(), HttpResponse.BodyHandlers.ofString()) + .thenApply(response -> response.body())) + .collect(Collectors.toList()); + + CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])) + .join(); + + if (futures.get(0) + .get() + .contains("foo1")) { + assertThat(futures.get(0) + .get(), containsString("bar1")); + assertThat(futures.get(1) + .get(), containsString("bar2")); + } else { + assertThat(futures.get(1) + .get(), containsString("bar2")); + assertThat(futures.get(1) + .get(), containsString("bar1")); + } + + } + + @Test + public void completeExceptionallyExample() { + CompletableFuture cf = CompletableFuture.completedFuture("message").thenApplyAsync(String::toUpperCase, + CompletableFuture.delayedExecutor(1, TimeUnit.SECONDS)); + CompletableFuture exceptionHandler = cf.handle((s, th) -> { return (th != null) ? "message upon cancel" : ""; }); + cf.completeExceptionally(new RuntimeException("completed exceptionally")); + assertTrue("Was not completed exceptionally", cf.isCompletedExceptionally()); + try { + cf.join(); + fail("Should have thrown an exception"); + } catch (CompletionException ex) { // just for testing + assertEquals("completed exceptionally", ex.getCause().getMessage()); + } + + assertEquals("message upon cancel", exceptionHandler.join()); + } + +} diff --git a/core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpRequestTest.java b/core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpRequestTest.java new file mode 100644 index 0000000000..7d138bd8d5 --- /dev/null +++ b/core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpRequestTest.java @@ -0,0 +1,168 @@ +package com.baeldung.java11.httpclient.test; + +import static java.time.temporal.ChronoUnit.SECONDS; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.junit.Assert.assertThat; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.nio.file.Paths; +import java.security.NoSuchAlgorithmException; +import java.time.Duration; + +import org.junit.Test; + +public class HttpRequestTest { + + @Test + public void shouldReturnStatusOKWhenSendGetRequest() throws IOException, InterruptedException, URISyntaxException { + HttpRequest request = HttpRequest.newBuilder() + .uri(new URI("https://postman-echo.com/get")) + .GET() + .build(); + + HttpResponse response = HttpClient.newHttpClient() + .send(request, HttpResponse.BodyHandlers.ofString()); + + assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK)); + } + + @Test + public void shouldUseHttp2WhenWebsiteUsesHttp2() throws IOException, InterruptedException, URISyntaxException { + HttpRequest request = HttpRequest.newBuilder() + .uri(new URI("https://stackoverflow.com")) + .version(HttpClient.Version.HTTP_2) + .GET() + .build(); + HttpResponse response = HttpClient.newHttpClient() + .send(request, HttpResponse.BodyHandlers.ofString()); + + assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK)); + assertThat(response.version(), equalTo(HttpClient.Version.HTTP_2)); + } + + @Test + public void shouldFallbackToHttp1_1WhenWebsiteDoesNotUseHttp2() throws IOException, InterruptedException, URISyntaxException, NoSuchAlgorithmException { + HttpRequest request = HttpRequest.newBuilder() + .uri(new URI("https://postman-echo.com/get")) + .version(HttpClient.Version.HTTP_2) + .GET() + .build(); + + HttpResponse response = HttpClient.newHttpClient() + .send(request, HttpResponse.BodyHandlers.ofString()); + + assertThat(response.version(), equalTo(HttpClient.Version.HTTP_1_1)); + } + + @Test + public void shouldReturnStatusOKWhenSendGetRequestWithDummyHeaders() throws IOException, InterruptedException, URISyntaxException { + HttpRequest request = HttpRequest.newBuilder() + .uri(new URI("https://postman-echo.com/get")) + .headers("key1", "value1", "key2", "value2") + .GET() + .build(); + + HttpResponse response = HttpClient.newHttpClient() + .send(request, HttpResponse.BodyHandlers.ofString()); + + assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK)); + } + + @Test + public void shouldReturnStatusOKWhenSendGetRequestTimeoutSet() throws IOException, InterruptedException, URISyntaxException { + HttpRequest request = HttpRequest.newBuilder() + .uri(new URI("https://postman-echo.com/get")) + .timeout(Duration.of(10, SECONDS)) + .GET() + .build(); + + HttpResponse response = HttpClient.newHttpClient() + .send(request, HttpResponse.BodyHandlers.ofString()); + + assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK)); + } + + @Test + public void shouldReturnNoContentWhenPostWithNoBody() throws IOException, InterruptedException, URISyntaxException { + HttpRequest request = HttpRequest.newBuilder() + .uri(new URI("https://postman-echo.com/post")) + .POST(HttpRequest.BodyPublishers.noBody()) + .build(); + + HttpResponse response = HttpClient.newHttpClient() + .send(request, HttpResponse.BodyHandlers.ofString()); + + assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK)); + } + + @Test + public void shouldReturnSampleDataContentWhenPostWithBodyText() throws IOException, InterruptedException, URISyntaxException { + HttpRequest request = HttpRequest.newBuilder() + .uri(new URI("https://postman-echo.com/post")) + .headers("Content-Type", "text/plain;charset=UTF-8") + .POST(HttpRequest.BodyPublishers.ofString("Sample request body")) + .build(); + + HttpResponse response = HttpClient.newHttpClient() + .send(request, HttpResponse.BodyHandlers.ofString()); + + assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK)); + assertThat(response.body(), containsString("Sample request body")); + } + + @Test + public void shouldReturnSampleDataContentWhenPostWithInputStream() throws IOException, InterruptedException, URISyntaxException { + byte[] sampleData = "Sample request body".getBytes(); + HttpRequest request = HttpRequest.newBuilder() + .uri(new URI("https://postman-echo.com/post")) + .headers("Content-Type", "text/plain;charset=UTF-8") + .POST(HttpRequest.BodyPublishers.ofInputStream(() -> new ByteArrayInputStream(sampleData))) + .build(); + + HttpResponse response = HttpClient.newHttpClient() + .send(request, HttpResponse.BodyHandlers.ofString()); + + assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK)); + assertThat(response.body(), containsString("Sample request body")); + } + + @Test + public void shouldReturnSampleDataContentWhenPostWithByteArrayProcessorStream() throws IOException, InterruptedException, URISyntaxException { + byte[] sampleData = "Sample request body".getBytes(); + HttpRequest request = HttpRequest.newBuilder() + .uri(new URI("https://postman-echo.com/post")) + .headers("Content-Type", "text/plain;charset=UTF-8") + .POST(HttpRequest.BodyPublishers.ofByteArray(sampleData)) + .build(); + + HttpResponse response = HttpClient.newHttpClient() + .send(request, HttpResponse.BodyHandlers.ofString()); + + assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK)); + assertThat(response.body(), containsString("Sample request body")); + } + + @Test + public void shouldReturnSampleDataContentWhenPostWithFileProcessorStream() throws IOException, InterruptedException, URISyntaxException { + HttpRequest request = HttpRequest.newBuilder() + .uri(new URI("https://postman-echo.com/post")) + .headers("Content-Type", "text/plain;charset=UTF-8") + .POST(HttpRequest.BodyPublishers.ofFile(Paths.get("src/test/resources/sample.txt"))) + .build(); + + HttpResponse response = HttpClient.newHttpClient() + .send(request, HttpResponse.BodyHandlers.ofString()); + + assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK)); + assertThat(response.body(), containsString("Sample file content")); + } + +} diff --git a/core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpResponseTest.java b/core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpResponseTest.java new file mode 100644 index 0000000000..78d86fbf4e --- /dev/null +++ b/core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpResponseTest.java @@ -0,0 +1,54 @@ +package com.baeldung.java11.httpclient.test; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; + +import org.junit.Test; + +public class HttpResponseTest { + + @Test + public void shouldReturnStatusOKWhenSendGetRequest() throws IOException, InterruptedException, URISyntaxException { + HttpRequest request = HttpRequest.newBuilder() + .uri(new URI("https://postman-echo.com/get")) + .version(HttpClient.Version.HTTP_2) + .GET() + .build(); + + HttpResponse response = HttpClient.newBuilder() + .followRedirects(HttpClient.Redirect.NORMAL) + .build() + .send(request, HttpResponse.BodyHandlers.ofString()); + + assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK)); + assertNotNull(response.body()); + } + + @Test + public void shouldResponseURIDifferentThanRequestUIRWhenRedirect() throws IOException, InterruptedException, URISyntaxException { + HttpRequest request = HttpRequest.newBuilder() + .uri(new URI("http://stackoverflow.com")) + .version(HttpClient.Version.HTTP_2) + .GET() + .build(); + HttpResponse response = HttpClient.newBuilder() + .followRedirects(HttpClient.Redirect.NORMAL) + .build() + .send(request, HttpResponse.BodyHandlers.ofString()); + + assertThat(request.uri() + .toString(), equalTo("http://stackoverflow.com")); + assertThat(response.uri() + .toString(), equalTo("https://stackoverflow.com/")); + } + +} From 96277462b819f4573aa0981a333144d8f1ff955a Mon Sep 17 00:00:00 2001 From: anuraggoyal1 Date: Wed, 13 Feb 2019 20:05:35 +0530 Subject: [PATCH 142/143] [BAEL-2471] Guide to Apache Commons MultiValuedMap (#6308) * [BAEL-2471] Guide to Apache Commons MultiValuedMap * Update MultiValuedMapUnitTest.java * added empty lines * updated as per review comments --- .../java/map/MultiValuedMapUnitTest.java | 160 ++++++++++-------- 1 file changed, 89 insertions(+), 71 deletions(-) diff --git a/java-collections-maps/src/test/java/com/baeldung/java/map/MultiValuedMapUnitTest.java b/java-collections-maps/src/test/java/com/baeldung/java/map/MultiValuedMapUnitTest.java index 67e4a5b0a0..b02b67f685 100644 --- a/java-collections-maps/src/test/java/com/baeldung/java/map/MultiValuedMapUnitTest.java +++ b/java-collections-maps/src/test/java/com/baeldung/java/map/MultiValuedMapUnitTest.java @@ -22,139 +22,157 @@ public class MultiValuedMapUnitTest { public void givenMultiValuesMap_whenPuttingMultipleValuesUsingPutMethod_thenReturningAllValues() { MultiValuedMap map = new ArrayListValuedHashMap<>(); - map.put("key", "value1"); - map.put("key", "value2"); - map.put("key", "value2"); + map.put("fruits", "apple"); + map.put("fruits", "orange"); - assertThat((Collection) map.get("key")).containsExactly("value1", "value2", "value2"); + assertThat((Collection) map.get("fruits")).containsExactly("apple", "orange"); + } @Test public void givenMultiValuesMap_whenPuttingMultipleValuesUsingPutAllMethod_thenReturningAllValues() { MultiValuedMap map = new ArrayListValuedHashMap<>(); + + map.putAll("vehicles", Arrays.asList("car", "bike")); - map.putAll("key", Arrays.asList("value1", "value2", "value2")); - - assertThat((Collection) map.get("key")).containsExactly("value1", "value2", "value2"); + assertThat((Collection) map.get("vehicles")).containsExactly("car", "bike"); + } @Test public void givenMultiValuesMap_whenGettingValueUsingGetMethod_thenReturningValue() { MultiValuedMap map = new ArrayListValuedHashMap<>(); - map.put("key", "value"); + + map.put("fruits", "apple"); - assertThat((Collection) map.get("key")).containsExactly("value"); + assertThat((Collection) map.get("fruits")).containsExactly("apple"); } @Test public void givenMultiValuesMap_whenUsingEntriesMethod_thenReturningMappings() { MultiValuedMap map = new ArrayListValuedHashMap<>(); - map.put("key", "value1"); - map.put("key", "value2"); - + map.put("fruits", "apple"); + map.put("fruits", "orange"); + Collection> entries = (Collection>) map.entries(); for(Map.Entry entry : entries) { - assertThat(entry.getKey()).contains("key"); - assertTrue(entry.getValue().equals("value1") || entry.getValue().equals("value2") ); + assertThat(entry.getKey()).contains("fruits"); + assertTrue(entry.getValue().equals("apple") || entry.getValue().equals("orange") ); } } @Test public void givenMultiValuesMap_whenUsingKeysMethod_thenReturningAllKeys() { MultiValuedMap map = new ArrayListValuedHashMap<>(); - map.put("key", "value"); - map.put("key1", "value1"); - map.put("key2", "value2"); + + map.put("fruits", "apple"); + map.put("fruits", "orange"); + map.put("vehicles", "car"); + map.put("vehicles", "bike"); - assertThat(((Collection) map.keys())).contains("key", "key1", "key2"); + assertThat(((Collection) map.keys())).contains("fruits", "vehicles"); } @Test public void givenMultiValuesMap_whenUsingKeySetMethod_thenReturningAllKeys() { MultiValuedMap map = new ArrayListValuedHashMap<>(); - map.put("key", "value"); - map.put("key1", "value1"); - map.put("key2", "value2"); + + map.put("fruits", "apple"); + map.put("fruits", "orange"); + map.put("vehicles", "car"); + map.put("vehicles", "bike"); - assertThat((Collection) map.keySet()).contains("key", "key1", "key2"); + assertThat((Collection) map.keySet()).contains("fruits", "vehicles"); + } @Test public void givenMultiValuesMap_whenUsingValuesMethod_thenReturningAllValues() { MultiValuedMap map = new ArrayListValuedHashMap<>(); - map.put("key", "value"); - map.put("key1", "value1"); - map.put("key2", "value2"); + + map.put("fruits", "apple"); + map.put("fruits", "orange"); + map.put("vehicles", "car"); + map.put("vehicles", "bike"); - assertThat(((Collection) map.values())).contains("value", "value1", "value2"); + assertThat(((Collection) map.values())).contains("apple", "orange", "car", "bike"); } @Test public void givenMultiValuesMap_whenUsingRemoveMethod_thenReturningUpdatedMap() { MultiValuedMap map = new ArrayListValuedHashMap<>(); - map.put("key", "value"); - map.put("key1", "value1"); - map.put("key2", "value2"); - assertThat(((Collection) map.values())).contains("value", "value1", "value2"); + + map.put("fruits", "apple"); + map.put("fruits", "orange"); + map.put("vehicles", "car"); + map.put("vehicles", "bike"); + assertThat(((Collection) map.values())).contains("apple", "orange", "car", "bike"); - map.remove("key"); + map.remove("fruits"); - assertThat(((Collection) map.values())).contains("value1", "value2"); + assertThat(((Collection) map.values())).contains("car", "bike"); + } @Test public void givenMultiValuesMap_whenUsingRemoveMappingMethod_thenReturningUpdatedMapAfterMappingRemoved() { MultiValuedMap map = new ArrayListValuedHashMap<>(); - map.put("key", "value"); - map.put("key1", "value1"); - map.put("key2", "value2"); - assertThat(((Collection) map.values())).contains("value", "value1", "value2"); + + map.put("fruits", "apple"); + map.put("fruits", "orange"); + map.put("vehicles", "car"); + map.put("vehicles", "bike"); + assertThat(((Collection) map.values())).contains("apple", "orange", "car", "bike"); - map.removeMapping("key", "value"); + map.removeMapping("fruits", "apple"); - assertThat(((Collection) map.values())).contains("value1", "value2"); + assertThat(((Collection) map.values())).contains("orange", "car", "bike"); } @Test public void givenMultiValuesMap_whenUsingClearMethod_thenReturningEmptyMap() { MultiValuedMap map = new ArrayListValuedHashMap<>(); - map.put("key", "value"); - map.put("key1", "value1"); - map.put("key2", "value2"); - assertThat(((Collection) map.values())).contains("value", "value1", "value2"); + map.put("fruits", "apple"); + map.put("fruits", "orange"); + map.put("vehicles", "car"); + map.put("vehicles", "bike"); + assertThat(((Collection) map.values())).contains("apple", "orange", "car", "bike"); map.clear(); - + assertTrue(map.isEmpty()); } @Test public void givenMultiValuesMap_whenUsingContainsKeyMethod_thenReturningTrue() { MultiValuedMap map = new ArrayListValuedHashMap<>(); - map.put("key", "value"); - map.put("key1", "value1"); - map.put("key2", "value2"); + map.put("fruits", "apple"); + map.put("fruits", "orange"); + map.put("vehicles", "car"); + map.put("vehicles", "bike"); - assertTrue(map.containsKey("key")); + assertTrue(map.containsKey("fruits")); } @Test public void givenMultiValuesMap_whenUsingContainsValueMethod_thenReturningTrue() { MultiValuedMap map = new ArrayListValuedHashMap<>(); - map.put("key", "value"); - map.put("key1", "value1"); - map.put("key2", "value2"); + map.put("fruits", "apple"); + map.put("fruits", "orange"); + map.put("vehicles", "car"); + map.put("vehicles", "bike"); - assertTrue(map.containsValue("value")); + assertTrue(map.containsValue("orange")); } @Test public void givenMultiValuesMap_whenUsingIsEmptyMethod_thenReturningFalse() { MultiValuedMap map = new ArrayListValuedHashMap<>(); - map.put("key", "value"); - map.put("key1", "value1"); - map.put("key2", "value2"); + map.put("fruits", "apple"); + map.put("fruits", "orange"); + map.put("vehicles", "car"); + map.put("vehicles", "bike"); assertFalse(map.isEmpty()); } @@ -162,42 +180,42 @@ public class MultiValuedMapUnitTest { @Test public void givenMultiValuesMap_whenUsingSizeMethod_thenReturningElementCount() { MultiValuedMap map = new ArrayListValuedHashMap<>(); - map.put("key", "value"); - map.put("key1", "value1"); - map.put("key2", "value2"); + map.put("fruits", "apple"); + map.put("fruits", "orange"); + map.put("vehicles", "car"); + map.put("vehicles", "bike"); - assertEquals(3, map.size()); + assertEquals(4, map.size()); } @Test public void givenArrayListValuedHashMap_whenPuttingDoubleValues_thenReturningAllValues() { MultiValuedMap map = new ArrayListValuedHashMap<>(); + map.put("fruits", "apple"); + map.put("fruits", "orange"); + map.put("fruits", "orange"); - map.put("key", "value1"); - map.put("key", "value2"); - map.put("key", "value2"); - - assertThat((Collection) map.get("key")).containsExactly("value1", "value2", "value2"); + assertThat((Collection) map.get("fruits")).containsExactly("apple", "orange", "orange"); } @Test public void givenHashSetValuedHashMap_whenPuttingTwiceTheSame_thenReturningOneValue() { MultiValuedMap map = new HashSetValuedHashMap<>(); - - map.put("key1", "value1"); - map.put("key1", "value1"); - - assertThat((Collection) map.get("key1")).containsExactly("value1"); + map.put("fruits", "apple"); + map.put("fruits", "apple"); + + assertThat((Collection) map.get("fruits")).containsExactly("apple"); } @Test(expected = UnsupportedOperationException.class) public void givenUnmodifiableMultiValuedMap_whenInserting_thenThrowingException() { MultiValuedMap map = new ArrayListValuedHashMap<>(); - map.put("key", "value1"); - map.put("key", "value2"); + map.put("fruits", "apple"); + map.put("fruits", "orange"); MultiValuedMap immutableMap = MultiMapUtils.unmodifiableMultiValuedMap(map); - immutableMap.put("key", "value3"); + immutableMap.put("fruits", "banana"); + } From d9cf2c05f52f5321f42751ae0a9ea17b461f6a63 Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Wed, 13 Feb 2019 18:56:34 +0100 Subject: [PATCH 143/143] added link (#6192)