From 334137939be5d9a9757729bf8a953a68662535b3 Mon Sep 17 00:00:00 2001 From: Simon <7910919+smic1909@users.noreply.github.com> Date: Thu, 6 Sep 2018 11:45:25 +0200 Subject: [PATCH 01/87] Fixed assignment of restTemplate Fixed assignment of restTemplate --- .../main/java/org/baeldung/web/service/BarConsumerService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-resttemplate/src/main/java/org/baeldung/web/service/BarConsumerService.java b/spring-resttemplate/src/main/java/org/baeldung/web/service/BarConsumerService.java index 4188677b4f..0bf24bd480 100644 --- a/spring-resttemplate/src/main/java/org/baeldung/web/service/BarConsumerService.java +++ b/spring-resttemplate/src/main/java/org/baeldung/web/service/BarConsumerService.java @@ -14,7 +14,7 @@ public class BarConsumerService { @Autowired public BarConsumerService(RestTemplateBuilder restTemplateBuilder) { - RestTemplate restTemplate = restTemplateBuilder + restTemplate = restTemplateBuilder .errorHandler(new RestTemplateResponseErrorHandler()) .build(); } From 51a583b229141c1618279bed7653fdd61bf06c38 Mon Sep 17 00:00:00 2001 From: cror Date: Thu, 6 Sep 2018 22:25:49 +0200 Subject: [PATCH 02/87] spring-5-reactive-security: fixing EmployeeControllerIntegrationTest --- .../reactive/webflux/EmployeeControllerIntegrationTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-5-reactive-security/src/test/java/com/baeldung/reactive/webflux/EmployeeControllerIntegrationTest.java b/spring-5-reactive-security/src/test/java/com/baeldung/reactive/webflux/EmployeeControllerIntegrationTest.java index 3dc832d781..12a21ed4ef 100644 --- a/spring-5-reactive-security/src/test/java/com/baeldung/reactive/webflux/EmployeeControllerIntegrationTest.java +++ b/spring-5-reactive-security/src/test/java/com/baeldung/reactive/webflux/EmployeeControllerIntegrationTest.java @@ -15,7 +15,7 @@ import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.reactive.server.WebTestClient; -import com.baeldung.reactive.actuator.Spring5ReactiveApplication; +import com.baeldung.webflux.EmployeeSpringApplication; import com.baeldung.webflux.Employee; import com.baeldung.webflux.EmployeeRepository; @@ -23,7 +23,7 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes=Spring5ReactiveApplication.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes=EmployeeSpringApplication.class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class EmployeeControllerIntegrationTest { From 33d5e710845a943b08ebb6b4aada6c6bf7378d82 Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Sun, 23 Sep 2018 15:26:48 +0200 Subject: [PATCH 03/87] added link --- java-strings/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/java-strings/README.md b/java-strings/README.md index 233d986d98..1286f7b6c9 100644 --- a/java-strings/README.md +++ b/java-strings/README.md @@ -27,3 +27,4 @@ - [Compact Strings in Java 9](http://www.baeldung.com/java-9-compact-string) - [Java Check a String for Lowercase/Uppercase Letter, Special Character and Digit](https://www.baeldung.com/java-lowercase-uppercase-special-character-digit-regex) - [Convert java.util.Date to String](https://www.baeldung.com/java-util-date-to-string) +- [String Not Empty Test Assertions in Java](https://www.baeldung.com/java-assert-string-not-empty) From 8ca0e9a84711edfd712bced5b6cf659a53dd783a Mon Sep 17 00:00:00 2001 From: dupirefr Date: Mon, 1 Oct 2018 19:30:04 +0200 Subject: [PATCH 04/87] [BAEL-2183] Arrays manipulations --- .../baeldung/array/ArrayReferenceGuide.java | 159 ++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 core-java/src/main/java/com/baeldung/array/ArrayReferenceGuide.java diff --git a/core-java/src/main/java/com/baeldung/array/ArrayReferenceGuide.java b/core-java/src/main/java/com/baeldung/array/ArrayReferenceGuide.java new file mode 100644 index 0000000000..7d7dec85b0 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/array/ArrayReferenceGuide.java @@ -0,0 +1,159 @@ +package com.baeldung.array; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.List; +import java.util.stream.IntStream; +import java.util.stream.Stream; + +public class ArrayReferenceGuide { + + public static void main(String[] args) { + declaration(); + + initialization(); + + access(); + + iterating(); + + varargs(); + + transformIntoList(); + + transformIntoStream(); + + sort(); + + search(); + + merge(); + } + + private static void declaration() { + int[] anArray; + int anotherArray[]; + } + + private static void initialization() { + int[] anArray = new int[10]; + anArray[0] = 10; + anArray[5] = 4; + + int[] anotherArray = new int[] {1, 2, 3, 4, 5}; + } + + private static void access() { + int[] anArray = new int[10]; + anArray[0] = 10; + anArray[5] = 4; + + System.out.println(anArray[0]); + } + + private static void iterating() { + int[] anArray = new int[] {1, 2, 3, 4, 5}; + for (int i = 0; i < anArray.length; i++) { + System.out.println(anArray[i]); + } + + for (int element : anArray) { + System.out.println(element); + } + } + + private static void varargs() { + String[] groceries = new String[] {"Milk", "Tomato", "Chips"}; + varargMethod(groceries); + varargMethod("Milk", "Tomato", "Chips"); + } + + private static void varargMethod(String... varargs) { + for (String element : varargs) { + System.out.println(element); + } + } + + private static void transformIntoList() { + Integer[] anArray = new Integer[] {1, 2, 3, 4, 5}; + + // Naïve implementation + List aList = new ArrayList<>(); // We create an empty list + for (int element : anArray) { + // We iterate over array's elements and add them to the list + aList.add(element); + } + + // Pretty implementation + aList = Arrays.asList(anArray); + + // Drawbacks + try { + aList.remove(0); + } catch (UnsupportedOperationException e) { + System.out.println(e.getMessage()); + } + + try { + aList.add(6); + } catch (UnsupportedOperationException e) { + System.out.println(e.getMessage()); + } + + int[] anotherArray = new int[] {1, 2, 3, 4, 5}; +// List anotherList = Arrays.asList(anotherArray); + } + + private static void transformIntoStream() { + int[] anArray = new int[] {1, 2, 3, 4, 5}; + IntStream aStream = Arrays.stream(anArray); + + Integer[] anotherArray = new Integer[] {1, 2, 3, 4, 5}; + Stream anotherStream = Arrays.stream(anotherArray, 2, 4); + } + + private static void sort() { + int[] anArray = new int[] {5, 2, 1, 4, 8}; + Arrays.sort(anArray); // anArray is now {1, 2, 4, 5, 8} + + Integer[] anotherArray = new Integer[] {5, 2, 1, 4, 8}; + Arrays.sort(anotherArray); // anArray is now {1, 2, 4, 5, 8} + + String[] yetAnotherArray = new String[] {"A", "E", "Z", "B", "C"}; + Arrays.sort(yetAnotherArray, 1, 3, Comparator.comparing(String::toString).reversed()); // yetAnotherArray is now {"A", "Z", "E", "B", "C"} + } + + private static void search() { + int[] anArray = new int[] {5, 2, 1, 4, 8}; + for (int i = 0; i < anArray.length; i++) { + if (anArray[i] == 4) { + System.out.println("Found at index " + i); + break; + } + } + + Arrays.sort(anArray); + int index = Arrays.binarySearch(anArray, 4); + System.out.println("Found at index " + index); + } + + private static void merge() { + int[] anArray = new int[] {5, 2, 1, 4, 8}; + int[] anotherArray = new int[] {10, 4, 9, 11, 2}; + + int[] resultArray = new int[anArray.length + anotherArray.length]; + for (int i = 0; i < resultArray.length; i++) { + resultArray[i] = (i < anArray.length ? anArray[i] : anotherArray[i - anArray.length]); + } + for (int element : resultArray) { + System.out.println(element); + } + + Arrays.setAll(resultArray, i -> (i < anArray.length ? anArray[i] : anotherArray[i - anArray.length])); + for (int element : resultArray) { + System.out.println(element); + } + } + +} From 6460e73eb67f514376005258d490ed742f93a60d Mon Sep 17 00:00:00 2001 From: Satyam Date: Tue, 2 Oct 2018 12:06:56 +0530 Subject: [PATCH 05/87] BAEL-2197: Initial Commit --- core-java-8/findItemsBasedOnValues/.gitignore | 1 + .../src/findItems/FindItemsBasedOnValues.java | 114 ++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 core-java-8/findItemsBasedOnValues/.gitignore create mode 100644 core-java-8/findItemsBasedOnValues/src/findItems/FindItemsBasedOnValues.java diff --git a/core-java-8/findItemsBasedOnValues/.gitignore b/core-java-8/findItemsBasedOnValues/.gitignore new file mode 100644 index 0000000000..ae3c172604 --- /dev/null +++ b/core-java-8/findItemsBasedOnValues/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/core-java-8/findItemsBasedOnValues/src/findItems/FindItemsBasedOnValues.java b/core-java-8/findItemsBasedOnValues/src/findItems/FindItemsBasedOnValues.java new file mode 100644 index 0000000000..5fa15be86e --- /dev/null +++ b/core-java-8/findItemsBasedOnValues/src/findItems/FindItemsBasedOnValues.java @@ -0,0 +1,114 @@ +package findItems; + +import static org.junit.Assert.*; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; +import org.junit.Test; + +public class FindItemsBasedOnValues { + + static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("dd-MM-yyyy"); + + public static void main(String[] args) throws ParseException { + FindItemsBasedOnValues findItems = new FindItemsBasedOnValues(); + findItems.findItemsImpl(); + } + + @Test + public void findItemsImpl() throws ParseException { + List expectedList = new ArrayList(); + Client expectedClient = new Client(1001, DATE_FORMAT.parse("01-02-2018")); + expectedList.add(expectedClient); + + List listOfCompanies = new ArrayList(); + List listOfClients = new ArrayList(); + populate(listOfCompanies, listOfClients); + + List filteredList = listOfClients.stream() + .filter(client -> listOfCompanies.stream() + .anyMatch(company -> company.getType() + .equals("eMart") && company.getProjectId() + .equals(client.getProjectId()) && company.getStart() + .after(client.getDate()) && company.getEnd() + .before(client.getDate()))) + .collect(Collectors.toList()); + + assertEquals(expectedClient.getProjectId(), filteredList.get(0) + .getProjectId()); + assertEquals(expectedClient.getDate(), filteredList.get(0) + .getDate()); + } + + private void populate(List companyList, List clientList) throws ParseException { + Company company1 = new Company(1001, DATE_FORMAT.parse("01-03-2018"), DATE_FORMAT.parse("01-01-2018"), "eMart"); + Company company2 = new Company(1002, DATE_FORMAT.parse("01-02-2018"), DATE_FORMAT.parse("01-04-2018"), "commerce"); + Company company3 = new Company(1003, DATE_FORMAT.parse("01-06-2018"), DATE_FORMAT.parse("01-02-2018"), "eMart"); + Company company4 = new Company(1004, DATE_FORMAT.parse("01-03-2018"), DATE_FORMAT.parse("01-06-2018"), "blog"); + + Collections.addAll(companyList, company1, company2, company3, company4); + + Client client1 = new Client(1001, DATE_FORMAT.parse("01-02-2018")); + Client client2 = new Client(1003, DATE_FORMAT.parse("01-04-2018")); + Client client3 = new Client(1005, DATE_FORMAT.parse("01-07-2018")); + Client client4 = new Client(1007, DATE_FORMAT.parse("01-08-2018")); + + Collections.addAll(clientList, client1, client2, client3, client4); + } +} + +class Company { + Long projectId; + Date start; + Date end; + String type; + + public Company(long projectId, Date start, Date end, String type) { + super(); + this.projectId = projectId; + this.start = start; + this.end = end; + this.type = type; + } + + public Long getProjectId() { + return projectId; + } + + public Date getStart() { + return start; + } + + public Date getEnd() { + return end; + } + + public String getType() { + return type; + } + +} + +class Client { + Long projectId; + Date date; + + public Client(long projectId, Date date) { + super(); + this.projectId = projectId; + this.date = date; + } + + public Long getProjectId() { + return projectId; + } + + public Date getDate() { + return date; + } + +} \ No newline at end of file From 7070aae38f951a23463abb3e2545bb7682ef387c Mon Sep 17 00:00:00 2001 From: Satyam Date: Wed, 3 Oct 2018 10:39:58 +0530 Subject: [PATCH 06/87] Updated Test method name --- .../src/findItems/FindItemsBasedOnValues.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core-java-8/findItemsBasedOnValues/src/findItems/FindItemsBasedOnValues.java b/core-java-8/findItemsBasedOnValues/src/findItems/FindItemsBasedOnValues.java index 5fa15be86e..d6a320a8ec 100644 --- a/core-java-8/findItemsBasedOnValues/src/findItems/FindItemsBasedOnValues.java +++ b/core-java-8/findItemsBasedOnValues/src/findItems/FindItemsBasedOnValues.java @@ -16,11 +16,11 @@ public class FindItemsBasedOnValues { public static void main(String[] args) throws ParseException { FindItemsBasedOnValues findItems = new FindItemsBasedOnValues(); - findItems.findItemsImpl(); + findItems.givenListOfCompanies_thenListOfClientsIsFilteredCorrectly(); } @Test - public void findItemsImpl() throws ParseException { + public void givenListOfCompanies_thenListOfClientsIsFilteredCorrectly() throws ParseException { List expectedList = new ArrayList(); Client expectedClient = new Client(1001, DATE_FORMAT.parse("01-02-2018")); expectedList.add(expectedClient); From 247d855422fef735fd9142b63b332973cb8a2e82 Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Mon, 8 Oct 2018 20:25:36 +0200 Subject: [PATCH 07/87] added article link --- spring-cloud-data-flow/etl/README.MD | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spring-cloud-data-flow/etl/README.MD b/spring-cloud-data-flow/etl/README.MD index 0cbb460b01..ee9c3a19c3 100644 --- a/spring-cloud-data-flow/etl/README.MD +++ b/spring-cloud-data-flow/etl/README.MD @@ -7,3 +7,7 @@ JDBC Source - Application Starter distributed by default customer-transform - Custom application to transform the data customer-mongodb-sink - Custom application to sink the data + +# Relevant Articles + +* [ETL with Spring Cloud Data Flow](https://www.baeldung.com/spring-cloud-data-flow-etl) From 369d471b8fa5b7b4d88a214bce56bbcd451806c3 Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Mon, 8 Oct 2018 20:35:36 +0200 Subject: [PATCH 08/87] added link --- core-java/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java/README.md b/core-java/README.md index a117d1843d..65263e4d8a 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -150,3 +150,4 @@ - [Throw Exception in Optional in Java 8](https://www.baeldung.com/java-optional-throw-exception) - [Add a Character to a String at a Given Position](https://www.baeldung.com/java-add-character-to-string) - [Synthetic Constructs in Java](https://www.baeldung.com/java-synthetic) +- [Calculating the nth Root in Java](https://www.baeldung.com/java-nth-root) From 8bf1a4cdf8d59328eba36d53d5716175bd97b1d6 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Mon, 8 Oct 2018 22:24:39 +0300 Subject: [PATCH 09/87] Update FinalList.java --- .../mockito/src/test/java/org/baeldung/mockito/FinalList.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing-modules/mockito/src/test/java/org/baeldung/mockito/FinalList.java b/testing-modules/mockito/src/test/java/org/baeldung/mockito/FinalList.java index 3824de619c..c41021f7b6 100644 --- a/testing-modules/mockito/src/test/java/org/baeldung/mockito/FinalList.java +++ b/testing-modules/mockito/src/test/java/org/baeldung/mockito/FinalList.java @@ -1,6 +1,6 @@ package org.baeldung.mockito; -public class FinalList extends MyList { +public final class FinalList extends MyList { @Override public int size() { From ef61b86af31c3d5c5186905fff2ec2046c483348 Mon Sep 17 00:00:00 2001 From: Satyam Date: Thu, 11 Oct 2018 20:55:55 +0530 Subject: [PATCH 10/87] BAEL-2197:Code rework --- .../src/findItems/FindItemsBasedOnValues.java | 111 +++++++----------- 1 file changed, 45 insertions(+), 66 deletions(-) diff --git a/core-java-8/findItemsBasedOnValues/src/findItems/FindItemsBasedOnValues.java b/core-java-8/findItemsBasedOnValues/src/findItems/FindItemsBasedOnValues.java index d6a320a8ec..a0dcdddd85 100644 --- a/core-java-8/findItemsBasedOnValues/src/findItems/FindItemsBasedOnValues.java +++ b/core-java-8/findItemsBasedOnValues/src/findItems/FindItemsBasedOnValues.java @@ -1,114 +1,93 @@ package findItems; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; + import java.text.ParseException; -import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; -import java.util.Date; import java.util.List; import java.util.stream.Collectors; + import org.junit.Test; public class FindItemsBasedOnValues { - static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("dd-MM-yyyy"); + List EmplList = new ArrayList(); + List deptList = new ArrayList(); public static void main(String[] args) throws ParseException { FindItemsBasedOnValues findItems = new FindItemsBasedOnValues(); - findItems.givenListOfCompanies_thenListOfClientsIsFilteredCorrectly(); + findItems.givenDepartmentList_thenEmployeeListIsFilteredCorrectly(); } @Test - public void givenListOfCompanies_thenListOfClientsIsFilteredCorrectly() throws ParseException { - List expectedList = new ArrayList(); - Client expectedClient = new Client(1001, DATE_FORMAT.parse("01-02-2018")); - expectedList.add(expectedClient); + public void givenDepartmentList_thenEmployeeListIsFilteredCorrectly() { + Integer expectedId = 1002; - List listOfCompanies = new ArrayList(); - List listOfClients = new ArrayList(); - populate(listOfCompanies, listOfClients); + populate(EmplList, deptList); - List filteredList = listOfClients.stream() - .filter(client -> listOfCompanies.stream() - .anyMatch(company -> company.getType() - .equals("eMart") && company.getProjectId() - .equals(client.getProjectId()) && company.getStart() - .after(client.getDate()) && company.getEnd() - .before(client.getDate()))) + List filteredList = EmplList.stream() + .filter(empl -> deptList.stream() + .anyMatch(dept -> dept.getDepartment() + .equals("sales") && empl.getEmployeeId() + .equals(dept.getEmployeeId()))) .collect(Collectors.toList()); - assertEquals(expectedClient.getProjectId(), filteredList.get(0) - .getProjectId()); - assertEquals(expectedClient.getDate(), filteredList.get(0) - .getDate()); + assertEquals(expectedId, filteredList.get(0) + .getEmployeeId()); } - private void populate(List companyList, List clientList) throws ParseException { - Company company1 = new Company(1001, DATE_FORMAT.parse("01-03-2018"), DATE_FORMAT.parse("01-01-2018"), "eMart"); - Company company2 = new Company(1002, DATE_FORMAT.parse("01-02-2018"), DATE_FORMAT.parse("01-04-2018"), "commerce"); - Company company3 = new Company(1003, DATE_FORMAT.parse("01-06-2018"), DATE_FORMAT.parse("01-02-2018"), "eMart"); - Company company4 = new Company(1004, DATE_FORMAT.parse("01-03-2018"), DATE_FORMAT.parse("01-06-2018"), "blog"); + private void populate(List EmplList, List deptList) { + Employee employee1 = new Employee(1001, "empl1"); + Employee employee2 = new Employee(1002, "empl2"); + Employee employee3 = new Employee(1003, "empl3"); - Collections.addAll(companyList, company1, company2, company3, company4); + Collections.addAll(EmplList, employee1, employee2, employee3); - Client client1 = new Client(1001, DATE_FORMAT.parse("01-02-2018")); - Client client2 = new Client(1003, DATE_FORMAT.parse("01-04-2018")); - Client client3 = new Client(1005, DATE_FORMAT.parse("01-07-2018")); - Client client4 = new Client(1007, DATE_FORMAT.parse("01-08-2018")); + Department department1 = new Department(1002, "sales"); + Department department2 = new Department(1003, "marketing"); + Department department3 = new Department(1004, "sales"); - Collections.addAll(clientList, client1, client2, client3, client4); + Collections.addAll(deptList, department1, department2, department3); } } -class Company { - Long projectId; - Date start; - Date end; - String type; +class Employee { + Integer employeeId; + String employeeName; - public Company(long projectId, Date start, Date end, String type) { + public Employee(Integer employeeId, String employeeName) { super(); - this.projectId = projectId; - this.start = start; - this.end = end; - this.type = type; + this.employeeId = employeeId; + this.employeeName = employeeName; } - public Long getProjectId() { - return projectId; + public Integer getEmployeeId() { + return employeeId; } - public Date getStart() { - return start; - } - - public Date getEnd() { - return end; - } - - public String getType() { - return type; + public String getEmployeeName() { + return employeeName; } } -class Client { - Long projectId; - Date date; +class Department { + Integer employeeId; + String department; - public Client(long projectId, Date date) { + public Department(Integer employeeId, String department) { super(); - this.projectId = projectId; - this.date = date; + this.employeeId = employeeId; + this.department = department; } - public Long getProjectId() { - return projectId; + public Integer getEmployeeId() { + return employeeId; } - public Date getDate() { - return date; + public String getDepartment() { + return department; } } \ No newline at end of file From e1d07fcc4c0a5940c4d7f851dd35309ef92fd888 Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Thu, 11 Oct 2018 20:59:40 +0200 Subject: [PATCH 11/87] added link --- core-java-8/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-8/README.md b/core-java-8/README.md index 64d423aafe..ffd629a170 100644 --- a/core-java-8/README.md +++ b/core-java-8/README.md @@ -32,3 +32,4 @@ - [Set the Time Zone of a Date in Java](https://www.baeldung.com/java-set-date-time-zone) - [An Overview of Regular Expressions Performance in Java](https://www.baeldung.com/java-regex-performance) - [Java Primitives versus Objects](https://www.baeldung.com/java-primitives-vs-objects) +- [How to Use if/else Logic in Java 8 Streams](https://www.baeldung.com/java-8-streams-if-else-logic) From 01819fe1bac8d3bf7dbd016a77a0f42a87ba16f5 Mon Sep 17 00:00:00 2001 From: Johan Janssen Date: Thu, 11 Oct 2018 21:40:30 +0200 Subject: [PATCH 12/87] BAEL-2263 Using JUnit 5 with Gradle --- gradle/junit5/build.gradle | 25 +++++++++++++ .../com/example/CalculatorJUnit4Test.java | 12 +++++++ .../com/example/CalculatorJUnit5Test.java | 36 +++++++++++++++++++ gradle/settings.gradle | 2 +- 4 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 gradle/junit5/build.gradle create mode 100644 gradle/junit5/src/test/java/com/example/CalculatorJUnit4Test.java create mode 100644 gradle/junit5/src/test/java/com/example/CalculatorJUnit5Test.java diff --git a/gradle/junit5/build.gradle b/gradle/junit5/build.gradle new file mode 100644 index 0000000000..5f056d8c23 --- /dev/null +++ b/gradle/junit5/build.gradle @@ -0,0 +1,25 @@ +plugins { + // Apply the java-library plugin to add support for Java Library + id 'java-library' +} + +dependencies { + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1' + + // Only necessary for JUnit 3 and 4 tests + testCompileOnly 'junit:junit:4.12' + testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.3.1' + +} + +repositories { + jcenter() +} + +test { + useJUnitPlatform { + includeTags 'fast' + excludeTags 'slow' + } +} \ No newline at end of file diff --git a/gradle/junit5/src/test/java/com/example/CalculatorJUnit4Test.java b/gradle/junit5/src/test/java/com/example/CalculatorJUnit4Test.java new file mode 100644 index 0000000000..4cf63642ee --- /dev/null +++ b/gradle/junit5/src/test/java/com/example/CalculatorJUnit4Test.java @@ -0,0 +1,12 @@ +package com.example; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class CalculatorJUnit4Test { + @Test + public void testAdd() { + assertEquals(42, Integer.sum(19, 23)); + } +} diff --git a/gradle/junit5/src/test/java/com/example/CalculatorJUnit5Test.java b/gradle/junit5/src/test/java/com/example/CalculatorJUnit5Test.java new file mode 100644 index 0000000000..59fdb0f8ae --- /dev/null +++ b/gradle/junit5/src/test/java/com/example/CalculatorJUnit5Test.java @@ -0,0 +1,36 @@ +package com.example; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test;; + +public class CalculatorJUnit5Test { + + @Tag("fast") + @Test + public void testAdd() { + assertEquals(42, Integer.sum(19, 23)); + } + + @Tag("slow") + @Test + public void testAddMaxInteger() { + assertEquals(2147483646, Integer.sum(2147183646, 300000)); + } + + @Tag("fast") + @Test + public void testAddZero() { + assertEquals(21, Integer.sum(21, 0)); + } + + @Tag("fast") + @Test + public void testDivide() { + assertThrows(ArithmeticException.class, () -> { + Integer.divideUnsigned(42, 0); + }); + } +} diff --git a/gradle/settings.gradle b/gradle/settings.gradle index 38704681bd..f1d64de58a 100644 --- a/gradle/settings.gradle +++ b/gradle/settings.gradle @@ -5,6 +5,6 @@ include 'greeting-library' include 'greeting-library-java' include 'greeter' include 'gradletaskdemo' - +include 'junit5' println 'This will be executed during the initialization phase.' From 3596d3dc34533748ce1e245270d78819fdc3e4c2 Mon Sep 17 00:00:00 2001 From: Syed Mansoor Date: Fri, 12 Oct 2018 16:55:59 +1100 Subject: [PATCH 13/87] Added project for Apache pulsar examples --- apache-pulsar/.gitignore | 8 + apache-pulsar/build.gradle | 26 +++ .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 54413 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 + apache-pulsar/gradlew | 172 ++++++++++++++++++ apache-pulsar/gradlew.bat | 84 +++++++++ .../main/java/com/baeldung/ConsumerTest.java | 48 +++++ .../main/java/com/baeldung/ProducerTest.java | 58 ++++++ .../ExclusiveSubscriptionTutorial.java | 59 ++++++ .../FailoverSubscriptionTutorial.java | 76 ++++++++ 10 files changed, 536 insertions(+) create mode 100755 apache-pulsar/.gitignore create mode 100755 apache-pulsar/build.gradle create mode 100755 apache-pulsar/gradle/wrapper/gradle-wrapper.jar create mode 100755 apache-pulsar/gradle/wrapper/gradle-wrapper.properties create mode 100755 apache-pulsar/gradlew create mode 100755 apache-pulsar/gradlew.bat create mode 100755 apache-pulsar/src/main/java/com/baeldung/ConsumerTest.java create mode 100755 apache-pulsar/src/main/java/com/baeldung/ProducerTest.java create mode 100755 apache-pulsar/src/main/java/com/baeldung/subscriptions/ExclusiveSubscriptionTutorial.java create mode 100755 apache-pulsar/src/main/java/com/baeldung/subscriptions/FailoverSubscriptionTutorial.java diff --git a/apache-pulsar/.gitignore b/apache-pulsar/.gitignore new file mode 100755 index 0000000000..1c53e03007 --- /dev/null +++ b/apache-pulsar/.gitignore @@ -0,0 +1,8 @@ +.classpath +.project +.settings +target +.idea +*.iml +.gradle/ +build/ diff --git a/apache-pulsar/build.gradle b/apache-pulsar/build.gradle new file mode 100755 index 0000000000..f3545d69b2 --- /dev/null +++ b/apache-pulsar/build.gradle @@ -0,0 +1,26 @@ +apply plugin: 'java' +ext{ + pulsarVersion = '2.1.1-incubating' +} + +repositories { + jcenter() + mavenCentral() + mavenLocal() +} + +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + +group = 'com.baeldung.pulsar' +archivesBaseName = 'pulsar-java-example' +version = '0.0.1' + + + + +dependencies { + compile group: 'org.apache.pulsar', name: 'pulsar-client', version: pulsarVersion + +} + diff --git a/apache-pulsar/gradle/wrapper/gradle-wrapper.jar b/apache-pulsar/gradle/wrapper/gradle-wrapper.jar new file mode 100755 index 0000000000000000000000000000000000000000..91ca28c8b802289c3a438766657a5e98f20eff03 GIT binary patch literal 54413 zcmafaV|Zr4wq`oEZQHiZj%|LijZQlLf{tz5M#r{o+fI6V=G-$g=gzrzeyqLskF}nv zRZs0&c;EUi2L_G~0s;*U0szbK}f6%Pvi zRZ#mYf6f1oqJoH`jHHCB8l!^by~4z}yc`4LEP@;Z?bO6{g9`Hk+s@(L1jC5Tq{1Yf z4E;CQvrx0-gF+peRxFC*gF=&$zNYk(w0q}U=WqXMz`tYs@0o%B{dRD+{C_6(f9t^g zhmNJQv6-#;f2)f2uc{u-#*U8W&i{|ewYN^n_1~cv|1J!}zc&$eaBy{T{cEpa46s*q zHFkD2cV;xTHFj}{*3kBt*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7N~ql@KXNonIOUIHwgYg4Dcn>OOdc=rUl>M zVEQe|u$P=Kb)TL&-2#4t^Pg0pUQ)dj%6O)#3;zwOe~`_1$@Ef`;F+l=>NlAFFbBS0 zN))`LdKnA;OjQ{B+f;z>i|wCv-CmNs46S`8X-oKRl0V+pKZ%XJWO*6G`OMOs^xG_d zj_7-p06{fybw_P;UzX^eX5Pkcrm04%9rPFa56 zyZE \(.*\)$'` + 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/apache-pulsar/gradlew.bat b/apache-pulsar/gradlew.bat new file mode 100755 index 0000000000..e95643d6a2 --- /dev/null +++ b/apache-pulsar/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/apache-pulsar/src/main/java/com/baeldung/ConsumerTest.java b/apache-pulsar/src/main/java/com/baeldung/ConsumerTest.java new file mode 100755 index 0000000000..72dc10b542 --- /dev/null +++ b/apache-pulsar/src/main/java/com/baeldung/ConsumerTest.java @@ -0,0 +1,48 @@ +package com.baeldung; + +import java.io.IOException; + +import org.apache.pulsar.client.api.Consumer; +import org.apache.pulsar.client.api.Message; +import org.apache.pulsar.client.api.PulsarClient; +import org.apache.pulsar.client.api.SubscriptionType; + +public class ConsumerTest { + + private static final String SERVICE_URL = "pulsar://localhost:6650"; + private static final String TOPIC_NAME = "test-topic"; + private static final String SUBSCRIPTION_NAME = "test-subscription"; + + public static void main(String[] args) throws IOException { + // Create a Pulsar client instance. A single instance can be shared across many + // producers and consumer within the same application + PulsarClient client = PulsarClient.builder() + .serviceUrl(SERVICE_URL) + .build(); + + //Configure consumer specific settings. + Consumer consumer = client.newConsumer() + .topic(TOPIC_NAME) + // Allow multiple consumers to attach to the same subscription + // and get messages dispatched as a queue + .subscriptionType(SubscriptionType.Shared) + .subscriptionName(SUBSCRIPTION_NAME) + .subscribe(); + + + // Once the consumer is created, it can be used for the entire application lifecycle + System.out.println("Created consumer for the topic "+ TOPIC_NAME); + + do { + // Wait until a message is available + Message msg = consumer.receive(); + + // Extract the message as a printable string and then log + String content = new String(msg.getData()); + System.out.println("Received message '"+content+"' with ID "+msg.getMessageId()); + + // Acknowledge processing of the message so that it can be deleted + consumer.acknowledge(msg); + } while (true); + } +} diff --git a/apache-pulsar/src/main/java/com/baeldung/ProducerTest.java b/apache-pulsar/src/main/java/com/baeldung/ProducerTest.java new file mode 100755 index 0000000000..08ee0e89b9 --- /dev/null +++ b/apache-pulsar/src/main/java/com/baeldung/ProducerTest.java @@ -0,0 +1,58 @@ +package com.baeldung; + +import org.apache.pulsar.client.api.CompressionType; +import org.apache.pulsar.client.api.Message; +import org.apache.pulsar.client.api.MessageBuilder; +import org.apache.pulsar.client.api.MessageId; +import org.apache.pulsar.client.api.Producer; +import org.apache.pulsar.client.api.PulsarClient; +import org.apache.pulsar.client.api.PulsarClientException; + +import java.io.IOException; +import java.util.stream.IntStream; + +public class ProducerTest { + + private static final String SERVICE_URL = "pulsar://localhost:6650"; + private static final String TOPIC_NAME = "test-topic"; + + public static void main(String[] args) throws IOException { + // Create a Pulsar client instance. A single instance can be shared across many + // producers and consumer within the same application + PulsarClient client = PulsarClient.builder() + .serviceUrl(SERVICE_URL) + .build(); + + // Configure producer specific settings + Producer producer = client.newProducer() + // Set the topic + .topic(TOPIC_NAME) + // Enable compression + .compressionType(CompressionType.LZ4) + .create(); + + // Once the producer is created, it can be used for the entire application life-cycle + System.out.println("Created producer for the topic "+TOPIC_NAME); + + // Send 5 test messages + IntStream.range(1, 5).forEach(i -> { + String content = String.format("hi-pulsar-%d", i); + + // Build a message object + Message msg = MessageBuilder.create() + .setContent(content.getBytes()) + .build(); + + // Send each message and log message content and ID when successfully received + try { + MessageId msgId = producer.send(msg); + + System.out.println("Published message '"+content+"' with the ID "+msgId); + } catch (PulsarClientException e) { + System.out.println(e.getMessage()); + } + }); + + client.close(); + } +} diff --git a/apache-pulsar/src/main/java/com/baeldung/subscriptions/ExclusiveSubscriptionTutorial.java b/apache-pulsar/src/main/java/com/baeldung/subscriptions/ExclusiveSubscriptionTutorial.java new file mode 100755 index 0000000000..da9ff0974d --- /dev/null +++ b/apache-pulsar/src/main/java/com/baeldung/subscriptions/ExclusiveSubscriptionTutorial.java @@ -0,0 +1,59 @@ +package com.baeldung.subscriptions; + +import org.apache.pulsar.client.api.ConsumerBuilder; +import org.apache.pulsar.client.api.Message; +import org.apache.pulsar.client.api.MessageBuilder; +import org.apache.pulsar.client.api.Producer; +import org.apache.pulsar.client.api.PulsarClient; +import org.apache.pulsar.client.api.PulsarClientException; +import org.apache.pulsar.client.api.SubscriptionType; + +import java.util.stream.IntStream; + +public class ExclusiveSubscriptionTutorial { + private static final String SERVICE_URL = "pulsar://localhost:6650"; + private static final String TOPIC_NAME = "test-topic"; + private static final String SUBSCRIPTION_NAME = "test-subscription"; + private static final SubscriptionType SUBSCRIPTION_TYPE = SubscriptionType.Exclusive; + + public static void main(String[] args) throws PulsarClientException { + PulsarClient client = PulsarClient.builder() + .serviceUrl(SERVICE_URL) + .build(); + + Producer producer = client.newProducer() + .topic(TOPIC_NAME) + .create(); + + ConsumerBuilder consumer1 = client.newConsumer() + .topic(TOPIC_NAME) + .subscriptionName(SUBSCRIPTION_NAME) + .subscriptionType(SUBSCRIPTION_TYPE); + + ConsumerBuilder consumer2 = client.newConsumer() + .topic(TOPIC_NAME) + .subscriptionName(SUBSCRIPTION_NAME) + .subscriptionType(SUBSCRIPTION_TYPE); + + IntStream.range(0, 999).forEach(i -> { + Message msg = MessageBuilder.create() + .setContent(String.format("message-%d", i).getBytes()) + .build(); + try { + producer.send(msg); + } catch (PulsarClientException e) { + System.out.println(e.getMessage()); + } + }); + + // Consumer 1 can subscribe to the topic + consumer1.subscribe(); + + // Consumer 2 cannot due to the exclusive subscription held by consumer 1 + consumer2.subscribeAsync() + .handle((consumer, exception) -> { + System.out.println(exception.getMessage()); + return null; + }); + } +} diff --git a/apache-pulsar/src/main/java/com/baeldung/subscriptions/FailoverSubscriptionTutorial.java b/apache-pulsar/src/main/java/com/baeldung/subscriptions/FailoverSubscriptionTutorial.java new file mode 100755 index 0000000000..30351c229d --- /dev/null +++ b/apache-pulsar/src/main/java/com/baeldung/subscriptions/FailoverSubscriptionTutorial.java @@ -0,0 +1,76 @@ +package com.baeldung.subscriptions; + +import org.apache.pulsar.client.api.Consumer; +import org.apache.pulsar.client.api.ConsumerBuilder; +import org.apache.pulsar.client.api.Message; +import org.apache.pulsar.client.api.MessageBuilder; +import org.apache.pulsar.client.api.Producer; +import org.apache.pulsar.client.api.PulsarClient; +import org.apache.pulsar.client.api.PulsarClientException; +import org.apache.pulsar.client.api.SubscriptionType; + +import java.util.stream.IntStream; + +public class FailoverSubscriptionTutorial { + private static final String SERVICE_URL = "pulsar://localhost:6650"; + private static final String TOPIC_NAME = "failover-subscription-test-topic"; + private static final String SUBSCRIPTION_NAME = "test-subscription"; + private static final SubscriptionType SUBSCRIPTION_TYPE = SubscriptionType.Failover; + private static final int NUM_MSGS = 10; + + public static void main(String[] args) throws PulsarClientException { + PulsarClient client = PulsarClient.builder() + .serviceUrl(SERVICE_URL) + .build(); + + Producer producer = client.newProducer() + .topic(TOPIC_NAME) + .create(); + + ConsumerBuilder consumerBuilder = client.newConsumer() + .topic(TOPIC_NAME) + .subscriptionName(SUBSCRIPTION_NAME) + .subscriptionType(SUBSCRIPTION_TYPE); + + Consumer mainConsumer = consumerBuilder + .consumerName("consumer-a") + .messageListener((consumer, msg) -> { + System.out.println("Message received by main consumer"); + + try { + consumer.acknowledge(msg); + } catch (PulsarClientException e) { + System.out.println(e.getMessage()); + } + }) + .subscribe(); + + Consumer failoverConsumer = consumerBuilder + .consumerName("consumer-b") + .messageListener((consumer, msg) -> { + System.out.println("Message received by failover consumer"); + + try { + consumer.acknowledge(msg); + } catch (PulsarClientException e) { + System.out.println(e.getMessage()); + } + }) + .subscribe(); + + IntStream.range(0, NUM_MSGS).forEach(i -> { + Message msg = MessageBuilder.create() + .setContent(String.format("message-%d", i).getBytes()) + .build(); + try { + producer.send(msg); + + Thread.sleep(100); + + if (i > 5) mainConsumer.close(); + } catch (InterruptedException | PulsarClientException e) { + System.out.println(e.getMessage()); + } + }); + } +} From bae7a74acd987defc018c79852b88417f8c3a931 Mon Sep 17 00:00:00 2001 From: Kumar Chandrakant Date: Fri, 12 Oct 2018 10:54:04 +0100 Subject: [PATCH 14/87] Adding files for the article BAEL-2206 --- .../interfaces/ConflictingInterfaces.kt | 23 +++++++++++++ .../interfaces/InterfaceDelegation.kt | 13 ++++++++ .../baeldung/interfaces/MultipleInterfaces.kt | 29 +++++++++++++++++ .../baeldung/interfaces/SimpleInterface.kt | 24 ++++++++++++++ .../interfaces/InterfaceExamplesUnitTest.kt | 32 +++++++++++++++++++ 5 files changed, 121 insertions(+) create mode 100644 core-kotlin/src/main/kotlin/com/baeldung/interfaces/ConflictingInterfaces.kt create mode 100644 core-kotlin/src/main/kotlin/com/baeldung/interfaces/InterfaceDelegation.kt create mode 100644 core-kotlin/src/main/kotlin/com/baeldung/interfaces/MultipleInterfaces.kt create mode 100644 core-kotlin/src/main/kotlin/com/baeldung/interfaces/SimpleInterface.kt create mode 100644 core-kotlin/src/test/kotlin/com/baeldung/interfaces/InterfaceExamplesUnitTest.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/interfaces/ConflictingInterfaces.kt b/core-kotlin/src/main/kotlin/com/baeldung/interfaces/ConflictingInterfaces.kt new file mode 100644 index 0000000000..630afbdae7 --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/interfaces/ConflictingInterfaces.kt @@ -0,0 +1,23 @@ +package com.baeldung.interfaces + +interface BaseInterface { + fun someMethod(): String +} + +interface FirstChildInterface : BaseInterface { + override fun someMethod(): String { + return("Hello, from someMethod in FirstChildInterface") + } +} + +interface SecondChildInterface : BaseInterface { + override fun someMethod(): String { + return("Hello, from someMethod in SecondChildInterface") + } +} + +class ChildClass : FirstChildInterface, SecondChildInterface { + override fun someMethod(): String { + return super.someMethod() + } +} \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/interfaces/InterfaceDelegation.kt b/core-kotlin/src/main/kotlin/com/baeldung/interfaces/InterfaceDelegation.kt new file mode 100644 index 0000000000..591fde0689 --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/interfaces/InterfaceDelegation.kt @@ -0,0 +1,13 @@ +package com.baeldung.interfaces + +interface MyInterface { + fun someMethod(): String +} + +class MyClass() : MyInterface { + override fun someMethod(): String { + return("Hello, World!") + } +} + +class MyDerivedClass(myInterface: MyInterface) : MyInterface by myInterface \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/interfaces/MultipleInterfaces.kt b/core-kotlin/src/main/kotlin/com/baeldung/interfaces/MultipleInterfaces.kt new file mode 100644 index 0000000000..105a85cbb3 --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/interfaces/MultipleInterfaces.kt @@ -0,0 +1,29 @@ +package com.baeldung.interfaces + +interface FirstInterface { + fun someMethod(): String + + fun anotherMethod(): String { + return("Hello, from anotherMethod in FirstInterface") + } +} + +interface SecondInterface { + fun someMethod(): String { + return("Hello, from someMethod in SecondInterface") + } + + fun anotherMethod(): String { + return("Hello, from anotherMethod in SecondInterface") + } +} + +class SomeClass: FirstInterface, SecondInterface { + override fun someMethod(): String { + return("Hello, from someMethod in SomeClass") + } + + override fun anotherMethod(): String { + return("Hello, from anotherMethod in SomeClass") + } +} \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/interfaces/SimpleInterface.kt b/core-kotlin/src/main/kotlin/com/baeldung/interfaces/SimpleInterface.kt new file mode 100644 index 0000000000..0758549dde --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/interfaces/SimpleInterface.kt @@ -0,0 +1,24 @@ +package com.baeldung.interfaces + +interface SimpleInterface { + val firstProp: String + val secondProp: String + get() = "Second Property" + fun firstMethod(): String + fun secondMethod(): String { + println("Hello, from: " + secondProp) + return "" + } +} + +class SimpleClass: SimpleInterface { + override val firstProp: String = "First Property" + override val secondProp: String + get() = "Second Property, Overridden!" + override fun firstMethod(): String { + return("Hello, from: " + firstProp) + } + override fun secondMethod(): String { + return("Hello, from: " + secondProp + firstProp) + } +} \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/interfaces/InterfaceExamplesUnitTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/interfaces/InterfaceExamplesUnitTest.kt new file mode 100644 index 0000000000..96b99948b7 --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/interfaces/InterfaceExamplesUnitTest.kt @@ -0,0 +1,32 @@ +package com.baeldung.interfaces + +import org.junit.Test +import kotlin.test.assertEquals + +class InterfaceExamplesUnitTest { + @Test + fun givenAnInterface_whenImplemented_thenBehavesAsOverridden() { + val simpleClass = SimpleClass() + assertEquals("Hello, from: First Property", simpleClass.firstMethod()) + assertEquals("Hello, from: Second Property, Overridden!First Property", simpleClass.secondMethod()) + } + + @Test + fun givenMultipleInterfaces_whenImplemented_thenBehavesAsOverridden() { + val someClass = SomeClass() + assertEquals("Hello, from someMethod in SomeClass", someClass.someMethod()) + assertEquals("Hello, from anotherMethod in SomeClass", someClass.anotherMethod()) + } + + @Test + fun givenConflictingInterfaces_whenImplemented_thenBehavesAsOverridden() { + val childClass = ChildClass() + assertEquals("Hello, from someMethod in SecondChildInterface", childClass.someMethod()) + } + + @Test + fun givenAnInterface_whenImplemented_thenBehavesAsDelegated() { + val myClass = MyClass() + assertEquals("Hello, World!", MyDerivedClass(myClass).someMethod()) + } +} \ No newline at end of file From fe8488a8d5e773e7e657a85c477bbfa7f3af68a0 Mon Sep 17 00:00:00 2001 From: Akash Pandey Date: Sat, 13 Oct 2018 01:20:33 +0530 Subject: [PATCH 15/87] Bael 2189: Convert Byte Array To/From hex String (#5396) * BAEL-2159: Mini Article on "Separate double into integer and decimal parts" * BAEL-2189: Tutorial to convert Byte Array to/from hex String. * BEAL-2189: Code review comments incorporated. * 1. Added validations for Non-Hex String characters in hex String. 2. Moved classes to algorithms module. 3. Renamed unit test class name ends with *UnitTest. * 1. Added validations for Non-Hex String characters in hex String. 2. Moved classes to algorithms module. 3. Renamed unit test class name ends with *UnitTest. * removed: redundant property added for local testing. --- algorithms/pom.xml | 6 + .../conversion/HexStringConverter.java | 110 +++++++++++++++ .../ByteArrayConverterUnitTest.java | 127 ++++++++++++++++++ 3 files changed, 243 insertions(+) create mode 100644 algorithms/src/main/java/com/baeldung/algorithms/conversion/HexStringConverter.java create mode 100644 algorithms/src/test/java/com/baeldung/algorithms/conversion/ByteArrayConverterUnitTest.java diff --git a/algorithms/pom.xml b/algorithms/pom.xml index eda87d6c75..db4a1c2eff 100644 --- a/algorithms/pom.xml +++ b/algorithms/pom.xml @@ -17,6 +17,11 @@ commons-math3 ${commons-math3.version} + + commons-codec + commons-codec + ${commons-codec.version} + org.projectlombok lombok @@ -85,6 +90,7 @@ 3.7.0 1.0.1 3.9.0 + 1.11 \ No newline at end of file diff --git a/algorithms/src/main/java/com/baeldung/algorithms/conversion/HexStringConverter.java b/algorithms/src/main/java/com/baeldung/algorithms/conversion/HexStringConverter.java new file mode 100644 index 0000000000..d3e251d3fd --- /dev/null +++ b/algorithms/src/main/java/com/baeldung/algorithms/conversion/HexStringConverter.java @@ -0,0 +1,110 @@ +package com.baeldung.algorithms.conversion; + +import java.math.BigInteger; + +import javax.xml.bind.DatatypeConverter; + +import org.apache.commons.codec.DecoderException; +import org.apache.commons.codec.binary.Hex; + +import com.google.common.io.BaseEncoding; + +public class HexStringConverter { + + /** + * Create a byte Array from String of hexadecimal digits using Character conversion + * @param hexString - Hexadecimal digits as String + * @return Desired byte Array + */ + public byte[] decodeHexString(String hexString) { + if (hexString.length() % 2 == 1) { + throw new IllegalArgumentException("Invalid hexadecimal String supplied."); + } + byte[] bytes = new byte[hexString.length() / 2]; + + for (int i = 0; i < hexString.length(); i += 2) { + bytes[i / 2] = hexToByte(hexString.substring(i, i + 2)); + } + return bytes; + } + + /** + * Create a String of hexadecimal digits from a byte Array using Character conversion + * @param byteArray - The byte Array + * @return Desired String of hexadecimal digits in lower case + */ + public String encodeHexString(byte[] byteArray) { + StringBuffer hexStringBuffer = new StringBuffer(); + for (int i = 0; i < byteArray.length; i++) { + hexStringBuffer.append(byteToHex(byteArray[i])); + } + return hexStringBuffer.toString(); + } + + public String byteToHex(byte num) { + char[] hexDigits = new char[2]; + hexDigits[0] = Character.forDigit((num >> 4) & 0xF, 16); + hexDigits[1] = Character.forDigit((num & 0xF), 16); + return new String(hexDigits); + } + + public byte hexToByte(String hexString) { + int firstDigit = toDigit(hexString.charAt(0)); + int secondDigit = toDigit(hexString.charAt(1)); + return (byte) ((firstDigit << 4) + secondDigit); + } + + private int toDigit(char hexChar) { + int digit = Character.digit(hexChar, 16); + if(digit == -1) { + throw new IllegalArgumentException("Invalid Hexadecimal Character: "+ hexChar); + } + return digit; + } + + public String encodeUsingBigIntegerToString(byte[] bytes) { + BigInteger bigInteger = new BigInteger(1, bytes); + return bigInteger.toString(16); + } + + public String encodeUsingBigIntegerStringFormat(byte[] bytes) { + BigInteger bigInteger = new BigInteger(1, bytes); + return String.format("%0" + (bytes.length << 1) + "x", bigInteger); + } + + public byte[] decodeUsingBigInteger(String hexString) { + byte[] byteArray = new BigInteger(hexString, 16).toByteArray(); + if (byteArray[0] == 0) { + byte[] output = new byte[byteArray.length - 1]; + System.arraycopy(byteArray, 1, output, 0, output.length); + return output; + } + return byteArray; + } + + public String encodeUsingDataTypeConverter(byte[] bytes) { + return DatatypeConverter.printHexBinary(bytes); + } + + public byte[] decodeUsingDataTypeConverter(String hexString) { + return DatatypeConverter.parseHexBinary(hexString); + } + + public String encodeUsingApacheCommons(byte[] bytes) throws DecoderException { + return Hex.encodeHexString(bytes); + } + + public byte[] decodeUsingApacheCommons(String hexString) throws DecoderException { + return Hex.decodeHex(hexString); + } + + public String encodeUsingGuava(byte[] bytes) { + return BaseEncoding.base16() + .encode(bytes); + } + + public byte[] decodeUsingGuava(String hexString) { + return BaseEncoding.base16() + .decode(hexString.toUpperCase()); + } +} diff --git a/algorithms/src/test/java/com/baeldung/algorithms/conversion/ByteArrayConverterUnitTest.java b/algorithms/src/test/java/com/baeldung/algorithms/conversion/ByteArrayConverterUnitTest.java new file mode 100644 index 0000000000..be61802705 --- /dev/null +++ b/algorithms/src/test/java/com/baeldung/algorithms/conversion/ByteArrayConverterUnitTest.java @@ -0,0 +1,127 @@ +package com.baeldung.algorithms.conversion; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; + +import org.apache.commons.codec.DecoderException; +import org.hamcrest.text.IsEqualIgnoringCase; +import org.junit.Before; +import org.junit.Test; + +import com.baeldung.algorithms.conversion.HexStringConverter; + +public class ByteArrayConverterUnitTest { + + private HexStringConverter hexStringConverter; + + @Before + public void setup() { + hexStringConverter = new HexStringConverter(); + } + + @Test + public void shouldEncodeByteArrayToHexStringUsingBigIntegerToString() { + byte[] bytes = getSampleBytes(); + String hexString = getSampleHexString(); + if(hexString.charAt(0) == '0') { + hexString = hexString.substring(1); + } + String output = hexStringConverter.encodeUsingBigIntegerToString(bytes); + assertThat(output, IsEqualIgnoringCase.equalToIgnoringCase(hexString)); + } + + @Test + public void shouldEncodeByteArrayToHexStringUsingBigIntegerStringFormat() { + byte[] bytes = getSampleBytes(); + String hexString = getSampleHexString(); + String output = hexStringConverter.encodeUsingBigIntegerStringFormat(bytes); + assertThat(output, IsEqualIgnoringCase.equalToIgnoringCase(hexString)); + } + + @Test + public void shouldDecodeHexStringToByteArrayUsingBigInteger() { + byte[] bytes = getSampleBytes(); + String hexString = getSampleHexString(); + byte[] output = hexStringConverter.decodeUsingBigInteger(hexString); + assertArrayEquals(bytes, output); + } + + @Test + public void shouldEncodeByteArrayToHexStringUsingCharacterConversion() { + byte[] bytes = getSampleBytes(); + String hexString = getSampleHexString(); + String output = hexStringConverter.encodeHexString(bytes); + assertThat(output, IsEqualIgnoringCase.equalToIgnoringCase(hexString)); + } + + @Test + public void shouldDecodeHexStringToByteArrayUsingCharacterConversion() { + byte[] bytes = getSampleBytes(); + String hexString = getSampleHexString(); + byte[] output = hexStringConverter.decodeHexString(hexString); + assertArrayEquals(bytes, output); + } + + @Test(expected=IllegalArgumentException.class) + public void shouldDecodeHexToByteWithInvalidHexCharacter() { + hexStringConverter.hexToByte("fg"); + } + + @Test + public void shouldEncodeByteArrayToHexStringDataTypeConverter() { + byte[] bytes = getSampleBytes(); + String hexString = getSampleHexString(); + String output = hexStringConverter.encodeUsingDataTypeConverter(bytes); + assertThat(output, IsEqualIgnoringCase.equalToIgnoringCase(hexString)); + } + + @Test + public void shouldDecodeHexStringToByteArrayUsingDataTypeConverter() { + byte[] bytes = getSampleBytes(); + String hexString = getSampleHexString(); + byte[] output = hexStringConverter.decodeUsingDataTypeConverter(hexString); + assertArrayEquals(bytes, output); + } + + @Test + public void shouldEncodeByteArrayToHexStringUsingGuava() { + byte[] bytes = getSampleBytes(); + String hexString = getSampleHexString(); + String output = hexStringConverter.encodeUsingGuava(bytes); + assertThat(output, IsEqualIgnoringCase.equalToIgnoringCase(hexString)); + } + + @Test + public void shouldDecodeHexStringToByteArrayUsingGuava() { + byte[] bytes = getSampleBytes(); + String hexString = getSampleHexString(); + byte[] output = hexStringConverter.decodeUsingGuava(hexString); + assertArrayEquals(bytes, output); + } + + @Test + public void shouldEncodeByteArrayToHexStringUsingApacheCommons() throws DecoderException { + byte[] bytes = getSampleBytes(); + String hexString = getSampleHexString(); + String output = hexStringConverter.encodeUsingApacheCommons(bytes); + assertThat(output, IsEqualIgnoringCase.equalToIgnoringCase(hexString)); + } + + @Test + public void shouldDecodeHexStringToByteArrayUsingApacheCommons() throws DecoderException { + byte[] bytes = getSampleBytes(); + String hexString = getSampleHexString(); + byte[] output = hexStringConverter.decodeUsingApacheCommons(hexString); + assertArrayEquals(bytes, output); + } + + private String getSampleHexString() { + return "0af50c0e2d10"; + } + + private byte[] getSampleBytes() { + return new byte[] { 10, -11, 12, 14, 45, 16 }; + } + +} From 3c35e25015dd5e7b7943c8e77fab9b8345c37191 Mon Sep 17 00:00:00 2001 From: Rokon Uddin Ahmed Date: Sat, 13 Oct 2018 02:22:56 +0600 Subject: [PATCH 16/87] BAEL-9344 (#5435) * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.MD * Update README.md * Update README.md * Update README.md * Create README.md * Update README.md * Update README.md --- algorithms/README.md | 3 +++ aws/README.md | 2 +- core-java-9/README.md | 1 + core-java-collections/README.md | 3 +++ core-java-concurrency/README.md | 1 + core-java/README.md | 6 ++++++ core-kotlin/README.md | 2 ++ hibernate5/README.md | 1 + java-streams/README.md | 1 + java-strings/README.md | 2 ++ libraries-security/README.md | 3 +++ libraries/README.md | 2 ++ spring-5-mvc/README.md | 1 + spring-boot-bootstrap/README.md | 1 + spring-cloud/README.md | 2 ++ spring-core/README.md | 2 ++ spring-data-jpa/README.md | 1 + spring-security-mvc-boot/README.MD | 1 + testing-modules/spring-testing/README.md | 3 ++- 19 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 libraries-security/README.md diff --git a/algorithms/README.md b/algorithms/README.md index 9b3bbcdee5..9d347869bd 100644 --- a/algorithms/README.md +++ b/algorithms/README.md @@ -28,3 +28,6 @@ - [Calculate the Distance Between Two Points in Java](https://www.baeldung.com/java-distance-between-two-points) - [Find the Intersection of Two Lines in Java](https://www.baeldung.com/java-intersection-of-two-lines) - [Check If a String Contains All The Letters of The Alphabet](https://www.baeldung.com/java-string-contains-all-letters) +- [Round Up to the Nearest Hundred](https://www.baeldung.com/java-round-up-nearest-hundred) +- [Merge Sort in Java](https://www.baeldung.com/java-merge-sort) +- [Calculate Percentage in Java](https://www.baeldung.com/java-calculate-percentage) diff --git a/aws/README.md b/aws/README.md index d23937a419..2c61928095 100644 --- a/aws/README.md +++ b/aws/README.md @@ -9,4 +9,4 @@ - [Integration Testing with a Local DynamoDB Instance](http://www.baeldung.com/dynamodb-local-integration-tests) - [Using the JetS3t Java Client With Amazon S3](http://www.baeldung.com/jets3t-amazon-s3) - [Managing Amazon SQS Queues in Java](http://www.baeldung.com/aws-queues-java) - +- [Guide to AWS Aurora RDS with Java](https://www.baeldung.com/aws-aurora-rds-java) diff --git a/core-java-9/README.md b/core-java-9/README.md index bf07cfcc86..38816471aa 100644 --- a/core-java-9/README.md +++ b/core-java-9/README.md @@ -26,3 +26,4 @@ - [Iterate Through a Range of Dates in Java](https://www.baeldung.com/java-iterate-date-range) - [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) diff --git a/core-java-collections/README.md b/core-java-collections/README.md index d9d768961c..aef640634e 100644 --- a/core-java-collections/README.md +++ b/core-java-collections/README.md @@ -52,3 +52,6 @@ - [Performance of contains() in a HashSet vs ArrayList](https://www.baeldung.com/java-hashset-arraylist-contains-performance) - [Get the Key for a Value from a Java Map](https://www.baeldung.com/java-map-key-from-value) - [Time Complexity of Java Collections](https://www.baeldung.com/java-collections-complexity) +- [Sort a HashMap in Java](https://www.baeldung.com/java-hashmap-sort) +- [Finding the Highest Value in a Java Map](https://www.baeldung.com/java-find-map-max) +- [Operating on and Removing an Item from Stream](https://www.baeldung.com/java-use-remove-item-stream) diff --git a/core-java-concurrency/README.md b/core-java-concurrency/README.md index d775d24dff..eeb9a83748 100644 --- a/core-java-concurrency/README.md +++ b/core-java-concurrency/README.md @@ -29,3 +29,4 @@ - [A Custom Spring SecurityConfigurer](http://www.baeldung.com/spring-security-custom-configurer) - [Life Cycle of a Thread in Java](http://www.baeldung.com/java-thread-lifecycle) - [Runnable vs. Callable in Java](http://www.baeldung.com/java-runnable-callable) +- [Brief Introduction to Java Thread.yield()](https://www.baeldung.com/java-thread-yield) diff --git a/core-java/README.md b/core-java/README.md index a117d1843d..9e38dfc47d 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -150,3 +150,9 @@ - [Throw Exception in Optional in Java 8](https://www.baeldung.com/java-optional-throw-exception) - [Add a Character to a String at a Given Position](https://www.baeldung.com/java-add-character-to-string) - [Synthetic Constructs in Java](https://www.baeldung.com/java-synthetic) +- [Convert Double to String, Removing Decimal Places](https://www.baeldung.com/java-double-to-string) +- [Different Ways to Capture Java Heap Dumps](https://www.baeldung.com/java-heap-dump-capture) +- [How to Separate Double into Integer and Decimal Parts](https://www.baeldung.com/java-separate-double-into-integer-decimal-parts) +- [ZoneOffset in Java](https://www.baeldung.com/java-zone-offset) +- [Hashing a Password in Java](https://www.baeldung.com/java-password-hashing) +- [Java Switch Statement](https://www.baeldung.com/java-switch) diff --git a/core-kotlin/README.md b/core-kotlin/README.md index 7d8d5213d1..523f5b6e78 100644 --- a/core-kotlin/README.md +++ b/core-kotlin/README.md @@ -37,3 +37,5 @@ - [Kotlin with Ktor](https://www.baeldung.com/kotlin-ktor) - [Fuel HTTP Library with Kotlin](https://www.baeldung.com/kotlin-fuel) - [Introduction to Kovenant Library for Kotlin](https://www.baeldung.com/kotlin-kovenant) +- [Converting Kotlin Data Class from JSON using GSON](https://www.baeldung.com/kotlin-json-convert-data-class) +- [Concatenate Strings in Kotlin](https://www.baeldung.com/kotlin-concatenate-strings) diff --git a/hibernate5/README.md b/hibernate5/README.md index b90f885c78..fbf46eed50 100644 --- a/hibernate5/README.md +++ b/hibernate5/README.md @@ -16,3 +16,4 @@ - [Hibernate Entity Lifecycle](https://www.baeldung.com/hibernate-entity-lifecycle) - [Mapping A Hibernate Query to a Custom Class](https://www.baeldung.com/hibernate-query-to-custom-class) - [@JoinColumn Annotation Explained](https://www.baeldung.com/jpa-join-column) +- [Hibernate 5 Naming Strategy Configuration](https://www.baeldung.com/hibernate-naming-strategy) diff --git a/java-streams/README.md b/java-streams/README.md index 548d4b6a33..2550f08650 100644 --- a/java-streams/README.md +++ b/java-streams/README.md @@ -13,3 +13,4 @@ - [How to Iterate Over a Stream With Indices](http://www.baeldung.com/java-stream-indices) - [Primitive Type Streams in Java 8](http://www.baeldung.com/java-8-primitive-streams) - [Stream Ordering in Java](https://www.baeldung.com/java-stream-ordering) +- [Introduction to Protonpack](https://www.baeldung.com/java-protonpack) diff --git a/java-strings/README.md b/java-strings/README.md index b12fc75f30..ff833a5cda 100644 --- a/java-strings/README.md +++ b/java-strings/README.md @@ -31,3 +31,5 @@ - [Converting a Stack Trace to a String in Java](https://www.baeldung.com/java-stacktrace-to-string) - [Sorting a String Alphabetically in Java](https://www.baeldung.com/java-sort-string-alphabetically) - [Remove Emojis from a Java String](https://www.baeldung.com/java-string-remove-emojis) +- [String Not Empty Test Assertions in Java](https://www.baeldung.com/java-assert-string-not-empty) +- [String Performance Hints](https://www.baeldung.com/java-string-performance) diff --git a/libraries-security/README.md b/libraries-security/README.md new file mode 100644 index 0000000000..c42e91a888 --- /dev/null +++ b/libraries-security/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Guide to ScribeJava](https://www.baeldung.com/scribejava) diff --git a/libraries/README.md b/libraries/README.md index c2c4b2718a..fcf687d806 100644 --- a/libraries/README.md +++ b/libraries/README.md @@ -81,6 +81,8 @@ - [Guide to Resilience4j](http://www.baeldung.com/resilience4j) - [Parsing YAML with SnakeYAML](http://www.baeldung.com/java-snake-yaml) - [Guide to JMapper](http://www.baeldung.com/jmapper) +- [An Introduction to Apache Commons Lang 3](https://www.baeldung.com/java-commons-lang-3) +- [Exactly Once Processing in Kafka](https://www.baeldung.com/kafka-exactly-once) 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. diff --git a/spring-5-mvc/README.md b/spring-5-mvc/README.md index 7e83077f54..fa9d48ab72 100644 --- a/spring-5-mvc/README.md +++ b/spring-5-mvc/README.md @@ -2,3 +2,4 @@ - [Spring Boot and Kotlin](http://www.baeldung.com/spring-boot-kotlin) - [Spring MVC Streaming and SSE Request Processing](https://www.baeldung.com/spring-mvc-sse-streams) - [Overview and Need for DelegatingFilterProxy in Spring](https://www.baeldung.com/spring-delegating-filter-proxy) +- [A Controller, Service and DAO Example with Spring Boot and JSF](https://www.baeldung.com/jsf-spring-boot-controller-service-dao) diff --git a/spring-boot-bootstrap/README.md b/spring-boot-bootstrap/README.md index 4b09f11714..08fdb1bdc9 100644 --- a/spring-boot-bootstrap/README.md +++ b/spring-boot-bootstrap/README.md @@ -3,3 +3,4 @@ - [Spring Boot Dependency Management with a Custom Parent](http://www.baeldung.com/spring-boot-dependency-management-custom-parent) - [Thin JARs with Spring Boot](http://www.baeldung.com/spring-boot-thin-jar) - [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) diff --git a/spring-cloud/README.md b/spring-cloud/README.md index 805052e4db..16bc2d110a 100644 --- a/spring-cloud/README.md +++ b/spring-cloud/README.md @@ -28,3 +28,5 @@ - [An Intro to Spring Cloud Task](http://www.baeldung.com/spring-cloud-task) - [Running Spring Boot Applications With Minikube](http://www.baeldung.com/spring-boot-minikube) - [Introduction to Netflix Archaius with Spring Cloud](https://www.baeldung.com/netflix-archaius-spring-cloud-integration) +- [An Intro to Spring Cloud Vault](https://www.baeldung.com/spring-cloud-vault) +- [Netflix Archaius with Various Database Configurations](https://www.baeldung.com/netflix-archaius-database-configurations) diff --git a/spring-core/README.md b/spring-core/README.md index c0577b4ebc..e5c359c11b 100644 --- a/spring-core/README.md +++ b/spring-core/README.md @@ -20,3 +20,5 @@ - [Controlling Bean Creation Order with @DependsOn Annotation](http://www.baeldung.com/spring-depends-on) - [Spring Autowiring of Generic Types](https://www.baeldung.com/spring-autowire-generics) - [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) diff --git a/spring-data-jpa/README.md b/spring-data-jpa/README.md index 8817020eec..44ce240da3 100644 --- a/spring-data-jpa/README.md +++ b/spring-data-jpa/README.md @@ -14,6 +14,7 @@ - [Auditing with JPA, Hibernate, and Spring Data JPA](https://www.baeldung.com/database-auditing-jpa) - [Query Entities by Dates and Times with Spring Data JPA](https://www.baeldung.com/spring-data-jpa-query-by-date) - [DDD Aggregates and @DomainEvents](https://www.baeldung.com/spring-data-ddd) +- [Spring Data – CrudRepository save() Method](https://www.baeldung.com/spring-data-crud-repository-save) ### Eclipse Config After importing the project into Eclipse, you may see the following error: diff --git a/spring-security-mvc-boot/README.MD b/spring-security-mvc-boot/README.MD index 6bd9b9295c..6f01bfdc65 100644 --- a/spring-security-mvc-boot/README.MD +++ b/spring-security-mvc-boot/README.MD @@ -11,3 +11,4 @@ The "REST With Spring" Classes: http://github.learnspringsecurity.com - [Granted Authority Versus Role in Spring Security](http://www.baeldung.com/spring-security-granted-authority-vs-role) - [Spring Data with Spring Security](https://www.baeldung.com/spring-data-security) - [Spring Security – Whitelist IP Range](https://www.baeldung.com/spring-security-whitelist-ip-range) +- [Find the Registered Spring Security Filters](https://www.baeldung.com/spring-security-registered-filters) diff --git a/testing-modules/spring-testing/README.md b/testing-modules/spring-testing/README.md index aed330d260..e22c3e84e7 100644 --- a/testing-modules/spring-testing/README.md +++ b/testing-modules/spring-testing/README.md @@ -1,3 +1,4 @@ ### Relevant Articles: -* [Mockito.mock() vs @Mock vs @MockBean](http://www.baeldung.com/java-spring-mockito-mock-mockbean) +- [Mockito.mock() vs @Mock vs @MockBean](http://www.baeldung.com/java-spring-mockito-mock-mockbean) +- [A Quick Guide to @TestPropertySource](https://www.baeldung.com/spring-test-property-source) From ac8742cfff0f11b7e2b7f9fcae0f8a3bacaf71a3 Mon Sep 17 00:00:00 2001 From: DOHA Date: Sat, 13 Oct 2018 01:47:27 +0300 Subject: [PATCH 17/87] fix MockitoJUnitRunner deprecated import --- .../calculator/NthRootCalculatorUnitTest.java | 6 +++--- .../app/rest/FlowerControllerUnitTest.java | 13 ++++++------ .../app/rest/MessageControllerUnitTest.java | 21 ++++++++++--------- .../creditcard/CreditCardEditorUnitTest.java | 5 +---- .../mockito/MockitoSpyIntegrationTest.java | 12 +++++------ .../mockito/MockitoVoidMethodsUnitTest.java | 18 +++++++++++----- 6 files changed, 41 insertions(+), 34 deletions(-) diff --git a/core-java/src/test/java/com/baeldung/nth/root/calculator/NthRootCalculatorUnitTest.java b/core-java/src/test/java/com/baeldung/nth/root/calculator/NthRootCalculatorUnitTest.java index 388bceef49..286dffb56a 100644 --- a/core-java/src/test/java/com/baeldung/nth/root/calculator/NthRootCalculatorUnitTest.java +++ b/core-java/src/test/java/com/baeldung/nth/root/calculator/NthRootCalculatorUnitTest.java @@ -1,11 +1,11 @@ package com.baeldung.nth.root.calculator; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; -import org.mockito.runners.MockitoJUnitRunner; - -import static org.junit.Assert.assertEquals; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class NthRootCalculatorUnitTest { diff --git a/spring-mockito/src/test/java/com/baeldung/app/rest/FlowerControllerUnitTest.java b/spring-mockito/src/test/java/com/baeldung/app/rest/FlowerControllerUnitTest.java index f30af140af..aeec57d136 100644 --- a/spring-mockito/src/test/java/com/baeldung/app/rest/FlowerControllerUnitTest.java +++ b/spring-mockito/src/test/java/com/baeldung/app/rest/FlowerControllerUnitTest.java @@ -1,17 +1,18 @@ package com.baeldung.app.rest; -import com.baeldung.app.api.Flower; -import com.baeldung.domain.service.FlowerService; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.when; + import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.when; +import com.baeldung.app.api.Flower; +import com.baeldung.domain.service.FlowerService; @RunWith(MockitoJUnitRunner.class) public class FlowerControllerUnitTest { diff --git a/spring-mockito/src/test/java/com/baeldung/app/rest/MessageControllerUnitTest.java b/spring-mockito/src/test/java/com/baeldung/app/rest/MessageControllerUnitTest.java index e303c85caf..15e91d86b5 100644 --- a/spring-mockito/src/test/java/com/baeldung/app/rest/MessageControllerUnitTest.java +++ b/spring-mockito/src/test/java/com/baeldung/app/rest/MessageControllerUnitTest.java @@ -1,18 +1,19 @@ package com.baeldung.app.rest; +import static org.mockito.Mockito.times; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentMatchers; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; + import com.baeldung.app.api.MessageApi; import com.baeldung.domain.model.Message; import com.baeldung.domain.service.MessageService; import com.baeldung.domain.util.MessageMatcher; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Matchers; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; - -import static org.mockito.Mockito.times; @RunWith(MockitoJUnitRunner.class) public class MessageControllerUnitTest { @@ -37,6 +38,6 @@ public class MessageControllerUnitTest { message.setTo("you"); message.setText("Hello, you!"); - Mockito.verify(messageService, times(1)).deliverMessage(Matchers.argThat(new MessageMatcher(message))); + Mockito.verify(messageService, times(1)).deliverMessage(ArgumentMatchers.argThat(new MessageMatcher(message))); } } diff --git a/spring-rest/src/test/java/com/baeldung/propertyeditor/creditcard/CreditCardEditorUnitTest.java b/spring-rest/src/test/java/com/baeldung/propertyeditor/creditcard/CreditCardEditorUnitTest.java index a84f866dfe..814efc112a 100644 --- a/spring-rest/src/test/java/com/baeldung/propertyeditor/creditcard/CreditCardEditorUnitTest.java +++ b/spring-rest/src/test/java/com/baeldung/propertyeditor/creditcard/CreditCardEditorUnitTest.java @@ -4,10 +4,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; - -import com.baeldung.propertyeditor.creditcard.CreditCard; -import com.baeldung.propertyeditor.creditcard.CreditCardEditor; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class CreditCardEditorUnitTest { diff --git a/testing-modules/mockito/src/test/java/org/baeldung/mockito/MockitoSpyIntegrationTest.java b/testing-modules/mockito/src/test/java/org/baeldung/mockito/MockitoSpyIntegrationTest.java index 206e0f4daf..118d50ea40 100644 --- a/testing-modules/mockito/src/test/java/org/baeldung/mockito/MockitoSpyIntegrationTest.java +++ b/testing-modules/mockito/src/test/java/org/baeldung/mockito/MockitoSpyIntegrationTest.java @@ -1,15 +1,15 @@ package org.baeldung.mockito; +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.List; + import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; import org.mockito.Spy; -import org.mockito.runners.MockitoJUnitRunner; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class MockitoSpyIntegrationTest { diff --git a/testing-modules/mockito/src/test/java/org/baeldung/mockito/MockitoVoidMethodsUnitTest.java b/testing-modules/mockito/src/test/java/org/baeldung/mockito/MockitoVoidMethodsUnitTest.java index 49360f8d6c..b020338fd9 100644 --- a/testing-modules/mockito/src/test/java/org/baeldung/mockito/MockitoVoidMethodsUnitTest.java +++ b/testing-modules/mockito/src/test/java/org/baeldung/mockito/MockitoVoidMethodsUnitTest.java @@ -1,14 +1,22 @@ package org.baeldung.mockito; +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.isA; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doCallRealMethod; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + import org.junit.Test; import org.junit.runner.RunWith; -import static org.junit.Assert.assertEquals; - -import static org.mockito.Mockito.*; import org.mockito.ArgumentCaptor; -import static org.mockito.Matchers.any; +import org.mockito.junit.MockitoJUnitRunner; import org.mockito.stubbing.Answer; -import org.mockito.runners.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class MockitoVoidMethodsUnitTest { From 9a6ce97d4811916f3c6b0387eed50a4d88b0561e Mon Sep 17 00:00:00 2001 From: Chirag Dewan Date: Sat, 13 Oct 2018 11:24:04 +0530 Subject: [PATCH 18/87] BAEL-1708 Custom Types in Hibernate --- hibernate5/pom.xml | 7 +- .../com/baeldung/hibernate/HibernateUtil.java | 11 +- .../hibernate/customtypes/Address.java | 69 +++++++ .../hibernate/customtypes/AddressType.java | 169 ++++++++++++++++++ .../LocalDateStringJavaDescriptor.java | 51 ++++++ .../customtypes/LocalDateStringType.java | 34 ++++ .../hibernate/customtypes/OfficeEmployee.java | 88 +++++++++ .../hibernate/customtypes/PhoneNumber.java | 43 +++++ .../customtypes/PhoneNumberType.java | 98 ++++++++++ .../hibernate/customtypes/Salary.java | 39 ++++ .../customtypes/SalaryCurrencyConvertor.java | 15 ++ .../hibernate/customtypes/SalaryType.java | 161 +++++++++++++++++ .../HibernateCustomTypesUnitTest.java | 90 ++++++++++ .../hibernate-customtypes.properties | 10 ++ 14 files changed, 883 insertions(+), 2 deletions(-) create mode 100644 hibernate5/src/main/java/com/baeldung/hibernate/customtypes/Address.java create mode 100644 hibernate5/src/main/java/com/baeldung/hibernate/customtypes/AddressType.java create mode 100644 hibernate5/src/main/java/com/baeldung/hibernate/customtypes/LocalDateStringJavaDescriptor.java create mode 100644 hibernate5/src/main/java/com/baeldung/hibernate/customtypes/LocalDateStringType.java create mode 100644 hibernate5/src/main/java/com/baeldung/hibernate/customtypes/OfficeEmployee.java create mode 100644 hibernate5/src/main/java/com/baeldung/hibernate/customtypes/PhoneNumber.java create mode 100644 hibernate5/src/main/java/com/baeldung/hibernate/customtypes/PhoneNumberType.java create mode 100644 hibernate5/src/main/java/com/baeldung/hibernate/customtypes/Salary.java create mode 100644 hibernate5/src/main/java/com/baeldung/hibernate/customtypes/SalaryCurrencyConvertor.java create mode 100644 hibernate5/src/main/java/com/baeldung/hibernate/customtypes/SalaryType.java create mode 100644 hibernate5/src/test/java/com/baeldung/hibernate/customtypes/HibernateCustomTypesUnitTest.java create mode 100644 hibernate5/src/test/resources/hibernate-customtypes.properties diff --git a/hibernate5/pom.xml b/hibernate5/pom.xml index 610c893bdc..748a106cca 100644 --- a/hibernate5/pom.xml +++ b/hibernate5/pom.xml @@ -44,6 +44,11 @@ mariaDB4j ${mariaDB4j.version} + + org.hibernate + hibernate-testing + 5.2.2.Final + @@ -57,7 +62,7 @@ - 5.3.2.Final + 5.3.6.Final 6.0.6 2.2.3 1.4.196 diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/HibernateUtil.java b/hibernate5/src/main/java/com/baeldung/hibernate/HibernateUtil.java index 2212e736ab..e0d1de591b 100644 --- a/hibernate5/src/main/java/com/baeldung/hibernate/HibernateUtil.java +++ b/hibernate5/src/main/java/com/baeldung/hibernate/HibernateUtil.java @@ -5,6 +5,8 @@ import java.io.IOException; import java.net.URL; import java.util.Properties; +import com.baeldung.hibernate.customtypes.LocalDateStringType; +import com.baeldung.hibernate.customtypes.OfficeEmployee; import com.baeldung.hibernate.entities.DeptEmployee; import com.baeldung.hibernate.optimisticlocking.OptimisticLockingCourse; import com.baeldung.hibernate.optimisticlocking.OptimisticLockingStudent; @@ -18,8 +20,10 @@ import com.baeldung.hibernate.pojo.inheritance.*; import org.apache.commons.lang3.StringUtils; import org.hibernate.SessionFactory; import org.hibernate.boot.Metadata; +import org.hibernate.boot.MetadataBuilder; import org.hibernate.boot.MetadataSources; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; +import org.hibernate.cfg.Configuration; import org.hibernate.service.ServiceRegistry; import com.baeldung.hibernate.pojo.Course; @@ -66,6 +70,7 @@ public class HibernateUtil { private static SessionFactory makeSessionFactory(ServiceRegistry serviceRegistry) { MetadataSources metadataSources = new MetadataSources(serviceRegistry); + metadataSources.addPackage("com.baeldung.hibernate.pojo"); metadataSources.addAnnotatedClass(Employee.class); metadataSources.addAnnotatedClass(Phone.class); @@ -102,8 +107,12 @@ public class HibernateUtil { metadataSources.addAnnotatedClass(com.baeldung.hibernate.entities.Department.class); metadataSources.addAnnotatedClass(OptimisticLockingCourse.class); metadataSources.addAnnotatedClass(OptimisticLockingStudent.class); + metadataSources.addAnnotatedClass(OfficeEmployee.class); + + Metadata metadata = metadataSources.getMetadataBuilder() + .applyBasicType(LocalDateStringType.INSTANCE) + .build(); - Metadata metadata = metadataSources.buildMetadata(); return metadata.getSessionFactoryBuilder() .build(); diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/Address.java b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/Address.java new file mode 100644 index 0000000000..d559e5a6c2 --- /dev/null +++ b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/Address.java @@ -0,0 +1,69 @@ +package com.baeldung.hibernate.customtypes; + +import java.util.Objects; + +public class Address { + + private String addressLine1; + private String addressLine2; + private String city; + private String country; + private int zipCode; + + public String getAddressLine1() { + return addressLine1; + } + + public String getAddressLine2() { + return addressLine2; + } + + public String getCity() { + return city; + } + + public String getCountry() { + return country; + } + + public int getZipCode() { + return zipCode; + } + + public void setAddressLine1(String addressLine1) { + this.addressLine1 = addressLine1; + } + + public void setAddressLine2(String addressLine2) { + this.addressLine2 = addressLine2; + } + + public void setCity(String city) { + this.city = city; + } + + public void setCountry(String country) { + this.country = country; + } + + public void setZipCode(int zipCode) { + this.zipCode = zipCode; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Address address = (Address) o; + return zipCode == address.zipCode && + Objects.equals(addressLine1, address.addressLine1) && + Objects.equals(addressLine2, address.addressLine2) && + Objects.equals(city, address.city) && + Objects.equals(country, address.country); + } + + @Override + public int hashCode() { + return Objects.hash(addressLine1, addressLine2, city, country, zipCode); + } +} diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/AddressType.java b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/AddressType.java new file mode 100644 index 0000000000..c10c67df9a --- /dev/null +++ b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/AddressType.java @@ -0,0 +1,169 @@ +package com.baeldung.hibernate.customtypes; + +import org.hibernate.HibernateException; +import org.hibernate.engine.spi.SharedSessionContractImplementor; +import org.hibernate.type.IntegerType; +import org.hibernate.type.StringType; +import org.hibernate.type.Type; +import org.hibernate.usertype.CompositeUserType; + +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Types; +import java.util.Objects; + +public class AddressType implements CompositeUserType { + + @Override + public String[] getPropertyNames() { + return new String[]{"addressLine1", "addressLine2", + "city", "country", "zipcode"}; + } + + @Override + public Type[] getPropertyTypes() { + return new Type[]{StringType.INSTANCE, StringType.INSTANCE, + StringType.INSTANCE, StringType.INSTANCE, IntegerType.INSTANCE}; + } + + @Override + public Object getPropertyValue(Object component, int property) throws HibernateException { + + Address empAdd = (Address) component; + + switch (property) { + case 0: + return empAdd.getAddressLine1(); + case 1: + return empAdd.getAddressLine2(); + case 2: + return empAdd.getCity(); + case 3: + return empAdd.getCountry(); + case 4: + return Integer.valueOf(empAdd.getZipCode()); + } + + throw new IllegalArgumentException(property + + " is an invalid property index for class type " + + component.getClass().getName()); + } + + @Override + public void setPropertyValue(Object component, int property, Object value) throws HibernateException { + + Address empAdd = (Address) component; + + switch (property) { + case 0: + empAdd.setAddressLine1((String) value); + case 1: + empAdd.setAddressLine2((String) value); + case 2: + empAdd.setCity((String) value); + case 3: + empAdd.setCountry((String) value); + case 4: + empAdd.setZipCode((Integer) value); + } + + throw new IllegalArgumentException(property + + " is an invalid property index for class type " + + component.getClass().getName()); + + } + + @Override + public Class returnedClass() { + return Address.class; + } + + @Override + public boolean equals(Object x, Object y) throws HibernateException { + if (x == y) + return true; + + if (Objects.isNull(x) || Objects.isNull(y)) + return false; + + return x.equals(y); + } + + @Override + public int hashCode(Object x) throws HibernateException { + return x.hashCode(); + } + + @Override + public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException { + + Address empAdd = new Address(); + empAdd.setAddressLine1(rs.getString(names[0])); + + if (rs.wasNull()) + return null; + + empAdd.setAddressLine2(rs.getString(names[1])); + empAdd.setCity(rs.getString(names[2])); + empAdd.setCountry(rs.getString(names[3])); + empAdd.setZipCode(rs.getInt(names[4])); + + return empAdd; + } + + @Override + public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException { + + if (Objects.isNull(value)) + st.setNull(index, Types.VARCHAR); + else { + + Address empAdd = (Address) value; + st.setString(index, empAdd.getAddressLine1()); + st.setString(index + 1, empAdd.getAddressLine2()); + st.setString(index + 2, empAdd.getCity()); + st.setString(index + 3, empAdd.getCountry()); + st.setInt(index + 4, empAdd.getZipCode()); + } + } + + @Override + public Object deepCopy(Object value) throws HibernateException { + + if (Objects.isNull(value)) + return null; + + Address oldEmpAdd = (Address) value; + Address newEmpAdd = new Address(); + + newEmpAdd.setAddressLine1(oldEmpAdd.getAddressLine1()); + newEmpAdd.setAddressLine2(oldEmpAdd.getAddressLine2()); + newEmpAdd.setCity(oldEmpAdd.getCity()); + newEmpAdd.setCountry(oldEmpAdd.getCountry()); + newEmpAdd.setZipCode(oldEmpAdd.getZipCode()); + + return newEmpAdd; + } + + @Override + public boolean isMutable() { + return true; + } + + @Override + public Serializable disassemble(Object value, SharedSessionContractImplementor session) throws HibernateException { + return (Serializable) deepCopy(value); + } + + @Override + public Object assemble(Serializable cached, SharedSessionContractImplementor session, Object owner) throws HibernateException { + return deepCopy(cached); + } + + @Override + public Object replace(Object original, Object target, SharedSessionContractImplementor session, Object owner) throws HibernateException { + return original; + } +} diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/LocalDateStringJavaDescriptor.java b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/LocalDateStringJavaDescriptor.java new file mode 100644 index 0000000000..56be9e693f --- /dev/null +++ b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/LocalDateStringJavaDescriptor.java @@ -0,0 +1,51 @@ +package com.baeldung.hibernate.customtypes; + +import org.hibernate.type.LocalDateType; +import org.hibernate.type.descriptor.WrapperOptions; +import org.hibernate.type.descriptor.java.AbstractTypeDescriptor; +import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan; +import org.hibernate.type.descriptor.java.MutabilityPlan; + +import java.time.LocalDate; + +public class LocalDateStringJavaDescriptor extends AbstractTypeDescriptor { + + public static final LocalDateStringJavaDescriptor INSTANCE = new LocalDateStringJavaDescriptor(); + + public LocalDateStringJavaDescriptor() { + super(LocalDate.class, ImmutableMutabilityPlan.INSTANCE); + } + + @Override + public String toString(LocalDate value) { + return LocalDateType.FORMATTER.format(value); + } + + @Override + public LocalDate fromString(String string) { + return LocalDate.from(LocalDateType.FORMATTER.parse(string)); + } + + @Override + public X unwrap(LocalDate value, Class type, WrapperOptions options) { + + if (value == null) + return null; + + if (String.class.isAssignableFrom(type)) + return (X) LocalDateType.FORMATTER.format(value); + + throw unknownUnwrap(type); + } + + @Override + public LocalDate wrap(X value, WrapperOptions options) { + if (value == null) + return null; + + if(String.class.isInstance(value)) + return LocalDate.from(LocalDateType.FORMATTER.parse((CharSequence) value)); + + throw unknownWrap(value.getClass()); + } +} diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/LocalDateStringType.java b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/LocalDateStringType.java new file mode 100644 index 0000000000..c8d37073e8 --- /dev/null +++ b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/LocalDateStringType.java @@ -0,0 +1,34 @@ +package com.baeldung.hibernate.customtypes; + +import org.hibernate.dialect.Dialect; +import org.hibernate.type.AbstractSingleColumnStandardBasicType; +import org.hibernate.type.DiscriminatorType; +import org.hibernate.type.descriptor.java.LocalDateJavaDescriptor; +import org.hibernate.type.descriptor.sql.VarcharTypeDescriptor; + +import java.time.LocalDate; + +public class LocalDateStringType extends AbstractSingleColumnStandardBasicType implements DiscriminatorType { + + public static final LocalDateStringType INSTANCE = new LocalDateStringType(); + + public LocalDateStringType() { + super(VarcharTypeDescriptor.INSTANCE, LocalDateStringJavaDescriptor.INSTANCE); + } + + @Override + public String getName() { + return "LocalDateString"; + } + + @Override + public LocalDate stringToObject(String xml) throws Exception { + return fromString(xml); + } + + @Override + public String objectToSQLString(LocalDate value, Dialect dialect) throws Exception { + return '\'' + toString(value) + '\''; + } + +} diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/OfficeEmployee.java b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/OfficeEmployee.java new file mode 100644 index 0000000000..3ca06e4316 --- /dev/null +++ b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/OfficeEmployee.java @@ -0,0 +1,88 @@ +package com.baeldung.hibernate.customtypes; + +import com.baeldung.hibernate.pojo.Phone; +import org.hibernate.annotations.Columns; +import org.hibernate.annotations.Parameter; +import org.hibernate.annotations.Type; +import org.hibernate.annotations.TypeDef; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import java.time.LocalDate; + +@TypeDef(name = "PhoneNumber", + typeClass = PhoneNumberType.class, + defaultForType = PhoneNumber.class) +@Entity +@Table(name = "OfficeEmployee") +public class OfficeEmployee { + + @Id + @GeneratedValue + private long id; + + @Column + @Type(type = "LocalDateString") + private LocalDate dateOfJoining; + + @Columns(columns = {@Column(name = "country_code"), + @Column(name = "city_code"), + @Column(name = "number")}) + private PhoneNumber employeeNumber; + + @Columns(columns = {@Column(name = "address_line_1"), + @Column(name = "address_line_2"), + @Column(name = "city"), @Column(name = "country"), + @Column(name = "zip_code")}) + @Type(type = "com.baeldung.hibernate.customtypes.AddressType") + private Address empAddress; + + @Type(type = "com.baeldung.hibernate.customtypes.SalaryType", + parameters = {@Parameter(name = "currency", value = "USD")}) + @Columns(columns = {@Column(name = "amount"), + @Column(name = "currency")}) + private Salary salary; + + public Salary getSalary() { + return salary; + } + + public void setSalary(Salary salary) { + this.salary = salary; + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public LocalDate getDateOfJoining() { + return dateOfJoining; + } + + public void setDateOfJoining(LocalDate dateOfJoining) { + this.dateOfJoining = dateOfJoining; + } + + public PhoneNumber getEmployeeNumber() { + return employeeNumber; + } + + public void setEmployeeNumber(PhoneNumber employeeNumber) { + this.employeeNumber = employeeNumber; + } + + public Address getEmpAddress() { + return empAddress; + } + + public void setEmpAddress(Address empAddress) { + this.empAddress = empAddress; + } +} diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/PhoneNumber.java b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/PhoneNumber.java new file mode 100644 index 0000000000..0be6cbc910 --- /dev/null +++ b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/PhoneNumber.java @@ -0,0 +1,43 @@ +package com.baeldung.hibernate.customtypes; + +import java.util.Objects; + +public final class PhoneNumber { + + private final int countryCode; + private final int cityCode; + private final int number; + + public PhoneNumber(int countryCode, int cityCode, int number) { + this.countryCode = countryCode; + this.cityCode = cityCode; + this.number = number; + } + + public int getCountryCode() { + return countryCode; + } + + public int getCityCode() { + return cityCode; + } + + public int getNumber() { + return number; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + PhoneNumber that = (PhoneNumber) o; + return countryCode == that.countryCode && + cityCode == that.cityCode && + number == that.number; + } + + @Override + public int hashCode() { + return Objects.hash(countryCode, cityCode, number); + } +} diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/PhoneNumberType.java b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/PhoneNumberType.java new file mode 100644 index 0000000000..9f09352bec --- /dev/null +++ b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/PhoneNumberType.java @@ -0,0 +1,98 @@ +package com.baeldung.hibernate.customtypes; + +import org.hibernate.HibernateException; +import org.hibernate.engine.spi.SharedSessionContractImplementor; +import org.hibernate.usertype.UserType; + +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Types; +import java.util.Objects; + + +public class PhoneNumberType implements UserType { + @Override + public int[] sqlTypes() { + return new int[]{Types.INTEGER, Types.INTEGER, Types.INTEGER}; + } + + @Override + public Class returnedClass() { + return PhoneNumber.class; + } + + @Override + public boolean equals(Object x, Object y) throws HibernateException { + if (x == y) + return true; + if (Objects.isNull(x) || Objects.isNull(y)) + return false; + + return x.equals(y); + } + + @Override + public int hashCode(Object x) throws HibernateException { + return x.hashCode(); + } + + @Override + public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException { + int countryCode = rs.getInt(names[0]); + + if (rs.wasNull()) + return null; + + int cityCode = rs.getInt(names[1]); + int number = rs.getInt(names[2]); + PhoneNumber employeeNumber = new PhoneNumber(countryCode, cityCode, number); + + return employeeNumber; + } + + @Override + public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException { + + if (Objects.isNull(value)) { + st.setNull(index, Types.INTEGER); + } else { + PhoneNumber employeeNumber = (PhoneNumber) value; + st.setInt(index,employeeNumber.getCountryCode()); + st.setInt(index+1,employeeNumber.getCityCode()); + st.setInt(index+2,employeeNumber.getNumber()); + } + } + + @Override + public Object deepCopy(Object value) throws HibernateException { + if (Objects.isNull(value)) + return null; + + PhoneNumber empNumber = (PhoneNumber) value; + PhoneNumber newEmpNumber = new PhoneNumber(empNumber.getCountryCode(),empNumber.getCityCode(),empNumber.getNumber()); + + return newEmpNumber; + } + + @Override + public boolean isMutable() { + return false; + } + + @Override + public Serializable disassemble(Object value) throws HibernateException { + return (Serializable) value; + } + + @Override + public Object assemble(Serializable cached, Object owner) throws HibernateException { + return cached; + } + + @Override + public Object replace(Object original, Object target, Object owner) throws HibernateException { + return original; + } +} diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/Salary.java b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/Salary.java new file mode 100644 index 0000000000..f9a7ac5902 --- /dev/null +++ b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/Salary.java @@ -0,0 +1,39 @@ +package com.baeldung.hibernate.customtypes; + +import java.util.Objects; + +public class Salary { + + private Long amount; + private String currency; + + public Long getAmount() { + return amount; + } + + public void setAmount(Long amount) { + this.amount = amount; + } + + public String getCurrency() { + return currency; + } + + public void setCurrency(String currency) { + this.currency = currency; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Salary salary = (Salary) o; + return Objects.equals(amount, salary.amount) && + Objects.equals(currency, salary.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } +} diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/SalaryCurrencyConvertor.java b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/SalaryCurrencyConvertor.java new file mode 100644 index 0000000000..340c697c11 --- /dev/null +++ b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/SalaryCurrencyConvertor.java @@ -0,0 +1,15 @@ +package com.baeldung.hibernate.customtypes; + +public class SalaryCurrencyConvertor { + + public static Long convert(Long amount, String oldCurr, String newCurr){ + if (newCurr.equalsIgnoreCase(oldCurr)) + return amount; + + return convertTo(); + } + + private static Long convertTo() { + return 10L; + } +} diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/SalaryType.java b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/SalaryType.java new file mode 100644 index 0000000000..266b85140b --- /dev/null +++ b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/SalaryType.java @@ -0,0 +1,161 @@ +package com.baeldung.hibernate.customtypes; + +import org.hibernate.HibernateException; +import org.hibernate.engine.spi.SharedSessionContractImplementor; +import org.hibernate.type.LongType; +import org.hibernate.type.StringType; +import org.hibernate.type.Type; +import org.hibernate.usertype.CompositeUserType; +import org.hibernate.usertype.DynamicParameterizedType; + +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Types; +import java.util.Objects; +import java.util.Properties; + +public class SalaryType implements CompositeUserType, DynamicParameterizedType { + + private String localCurrency; + + @Override + public String[] getPropertyNames() { + return new String[]{"amount", "currency"}; + } + + @Override + public Type[] getPropertyTypes() { + return new Type[]{LongType.INSTANCE, StringType.INSTANCE}; + } + + @Override + public Object getPropertyValue(Object component, int property) throws HibernateException { + + Salary salary = (Salary) component; + + switch (property) { + case 0: + return salary.getAmount(); + case 1: + return salary.getCurrency(); + } + + throw new IllegalArgumentException(property + + " is an invalid property index for class type " + + component.getClass().getName()); + + } + + + @Override + public void setPropertyValue(Object component, int property, Object value) throws HibernateException { + + Salary salary = (Salary) component; + + switch (property) { + case 0: + salary.setAmount((Long) value); + case 1: + salary.setCurrency((String) value); + } + + throw new IllegalArgumentException(property + + " is an invalid property index for class type " + + component.getClass().getName()); + + } + + @Override + public Class returnedClass() { + return Salary.class; + } + + @Override + public boolean equals(Object x, Object y) throws HibernateException { + + if (x == y) + return true; + + if (Objects.isNull(x) || Objects.isNull(y)) + return false; + + return x.equals(y); + + } + + @Override + public int hashCode(Object x) throws HibernateException { + return x.hashCode(); + } + + @Override + public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException { + + Salary salary = new Salary(); + salary.setAmount(rs.getLong(names[0])); + + if (rs.wasNull()) + return null; + + salary.setCurrency(rs.getString(names[1])); + + return salary; + } + + @Override + public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException { + + + if (Objects.isNull(value)) + st.setNull(index, Types.BIGINT); + else { + + Salary salary = (Salary) value; + st.setLong(index, SalaryCurrencyConvertor.convert(salary.getAmount(), + salary.getCurrency(), localCurrency)); + st.setString(index + 1, salary.getCurrency()); + } + } + + @Override + public Object deepCopy(Object value) throws HibernateException { + + if (Objects.isNull(value)) + return null; + + Salary oldSal = (Salary) value; + Salary newSal = new Salary(); + + newSal.setAmount(oldSal.getAmount()); + newSal.setCurrency(oldSal.getCurrency()); + + return newSal; + } + + @Override + public boolean isMutable() { + return true; + } + + @Override + public Serializable disassemble(Object value, SharedSessionContractImplementor session) throws HibernateException { + return (Serializable) deepCopy(value); + } + + @Override + public Object assemble(Serializable cached, SharedSessionContractImplementor session, Object owner) throws HibernateException { + return deepCopy(cached); + } + + @Override + public Object replace(Object original, Object target, SharedSessionContractImplementor session, Object owner) throws HibernateException { + return original; + } + + @Override + public void setParameterValues(Properties parameters) { + this.localCurrency = parameters.getProperty("currency"); + } +} diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/customtypes/HibernateCustomTypesUnitTest.java b/hibernate5/src/test/java/com/baeldung/hibernate/customtypes/HibernateCustomTypesUnitTest.java new file mode 100644 index 0000000000..f0179701df --- /dev/null +++ b/hibernate5/src/test/java/com/baeldung/hibernate/customtypes/HibernateCustomTypesUnitTest.java @@ -0,0 +1,90 @@ +package com.baeldung.hibernate.customtypes; + +import com.baeldung.hibernate.HibernateUtil; +import org.hibernate.SessionFactory; +import org.hibernate.query.Query; +import org.junit.Assert; +import org.junit.Test; + +import java.io.IOException; +import java.time.LocalDate; + +import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate; + +public class HibernateCustomTypesUnitTest { + + @Test + public void givenEmployee_whenSavedWithCustomTypes_thenEntityIsSaved() throws IOException { + + final OfficeEmployee e = new OfficeEmployee(); + e.setDateOfJoining(LocalDate.now()); + + PhoneNumber number = new PhoneNumber(1, 222, 8781902); + e.setEmployeeNumber(number); + + Address empAdd = new Address(); + empAdd.setAddressLine1("Street"); + empAdd.setAddressLine2("Area"); + empAdd.setCity("City"); + empAdd.setCountry("Country"); + empAdd.setZipCode(100); + + e.setEmpAddress(empAdd); + + Salary empSalary = new Salary(); + empSalary.setAmount(1000L); + empSalary.setCurrency("USD"); + e.setSalary(empSalary); + + doInHibernate(this::sessionFactory, session -> { + session.save(e); + boolean contains = session.contains(e); + Assert.assertTrue(contains); + }); + + } + + @Test + public void givenEmployee_whenCustomTypeInQuery_thenReturnEntity() throws IOException { + + final OfficeEmployee e = new OfficeEmployee(); + e.setDateOfJoining(LocalDate.now()); + + PhoneNumber number = new PhoneNumber(1, 222, 8781902); + e.setEmployeeNumber(number); + + Address empAdd = new Address(); + empAdd.setAddressLine1("Street"); + empAdd.setAddressLine2("Area"); + empAdd.setCity("City"); + empAdd.setCountry("Country"); + empAdd.setZipCode(100); + e.setEmpAddress(empAdd); + + Salary empSalary = new Salary(); + empSalary.setAmount(1000L); + empSalary.setCurrency("USD"); + e.setSalary(empSalary); + + doInHibernate(this::sessionFactory, session -> { + session.save(e); + + Query query = session.createQuery("FROM OfficeEmployee OE WHERE OE.empAddress.zipcode = :pinCode"); + query.setParameter("pinCode",100); + int size = query.list().size(); + + Assert.assertEquals(1, size); + }); + + } + + private SessionFactory sessionFactory() { + try { + return HibernateUtil.getSessionFactory("hibernate-customtypes.properties"); + } catch (IOException e) { + e.printStackTrace(); + } + + return null; + } +} diff --git a/hibernate5/src/test/resources/hibernate-customtypes.properties b/hibernate5/src/test/resources/hibernate-customtypes.properties new file mode 100644 index 0000000000..345f3d37b0 --- /dev/null +++ b/hibernate5/src/test/resources/hibernate-customtypes.properties @@ -0,0 +1,10 @@ +hibernate.connection.driver_class=org.postgresql.Driver +hibernate.connection.url=jdbc:postgresql://localhost:5432/test +hibernate.connection.username=postgres +hibernate.connection.password=thule +hibernate.connection.autocommit=true +jdbc.password=thule + +hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect +hibernate.show_sql=true +hibernate.hbm2ddl.auto=create-drop \ No newline at end of file From 435af770b3a7538cb7debee70628aa64520546b9 Mon Sep 17 00:00:00 2001 From: Marcos Lopez Gonzalez Date: Sat, 13 Oct 2018 13:04:22 +0200 Subject: [PATCH 19/87] BAEL-2259 - Guide to EnumSet (#5423) * EnumSet * enumset operations * formatting --- .../java/com/baeldung/enumset/EnumSets.java | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 core-java-collections/src/main/java/com/baeldung/enumset/EnumSets.java diff --git a/core-java-collections/src/main/java/com/baeldung/enumset/EnumSets.java b/core-java-collections/src/main/java/com/baeldung/enumset/EnumSets.java new file mode 100644 index 0000000000..7b93ed8737 --- /dev/null +++ b/core-java-collections/src/main/java/com/baeldung/enumset/EnumSets.java @@ -0,0 +1,45 @@ +package com.baeldung.enumset; + +import java.util.ArrayList; +import java.util.EnumSet; +import java.util.List; + +public class EnumSets { + + public enum Color { + RED, YELLOW, GREEN, BLUE, BLACK, WHITE + } + + public static void main(String[] args) { + EnumSet allColors = EnumSet.allOf(Color.class); + System.out.println(allColors); + + EnumSet noColors = EnumSet.noneOf(Color.class); + System.out.println(noColors); + + EnumSet blackAndWhite = EnumSet.of(Color.BLACK, Color.WHITE); + System.out.println(blackAndWhite); + + EnumSet noBlackOrWhite = EnumSet.complementOf(blackAndWhite); + System.out.println(noBlackOrWhite); + + EnumSet range = EnumSet.range(Color.YELLOW, Color.BLUE); + System.out.println(range); + + EnumSet blackAndWhiteCopy = EnumSet.copyOf(EnumSet.of(Color.BLACK, Color.WHITE)); + System.out.println(blackAndWhiteCopy); + + List colorsList = new ArrayList<>(); + colorsList.add(Color.RED); + EnumSet listCopy = EnumSet.copyOf(colorsList); + System.out.println(listCopy); + + EnumSet set = EnumSet.noneOf(Color.class); + set.add(Color.RED); + set.add(Color.YELLOW); + set.contains(Color.RED); + set.forEach(System.out::println); + set.remove(Color.RED); + } + +} From 03e0627cffc0e8b674f0050951eebddeb5c2664f Mon Sep 17 00:00:00 2001 From: Kuba Date: Sat, 13 Oct 2018 17:02:22 +0200 Subject: [PATCH 20/87] BAEL-2200 Sample application for auto-configuration report. (#5335) * BAEL-2200 Sample application for auto-configuration report. * BAEL-2200 Sample application for auto-configuration report fixes. * Fix formatting. --- .../auto/configuration/AutoConfigurationDemo.java | 14 ++++++++++++++ .../src/main/resources/application.properties | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/auto/configuration/AutoConfigurationDemo.java diff --git a/spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/auto/configuration/AutoConfigurationDemo.java b/spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/auto/configuration/AutoConfigurationDemo.java new file mode 100644 index 0000000000..87a191554b --- /dev/null +++ b/spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/auto/configuration/AutoConfigurationDemo.java @@ -0,0 +1,14 @@ +package com.baeldung.h2db.auto.configuration; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; + +@SpringBootApplication(scanBasePackages = "com.baeldung.h2db.auto-configuration") +public class AutoConfigurationDemo { + + public static void main(String[] args) { + SpringApplication.run(AutoConfigurationDemo.class, args); + } + +} diff --git a/spring-boot-h2/spring-boot-h2-database/src/main/resources/application.properties b/spring-boot-h2/spring-boot-h2-database/src/main/resources/application.properties index 0591cc9e0f..5e425a3550 100644 --- a/spring-boot-h2/spring-boot-h2-database/src/main/resources/application.properties +++ b/spring-boot-h2/spring-boot-h2-database/src/main/resources/application.properties @@ -4,4 +4,5 @@ spring.datasource.username=sa spring.datasource.password= spring.jpa.hibernate.ddl-auto=create spring.h2.console.enabled=true -spring.h2.console.path=/h2-console \ No newline at end of file +spring.h2.console.path=/h2-console +debug=true \ No newline at end of file From b3a6a60100be49fea9925d1c17e8c02b5ff49119 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 13 Oct 2018 19:15:02 +0300 Subject: [PATCH 21/87] add txt files for zip --- core-java-io/src/main/resources/zipTest/test1.txt | 1 + core-java-io/src/main/resources/zipTest/test2.txt | 1 + 2 files changed, 2 insertions(+) create mode 100644 core-java-io/src/main/resources/zipTest/test1.txt create mode 100644 core-java-io/src/main/resources/zipTest/test2.txt diff --git a/core-java-io/src/main/resources/zipTest/test1.txt b/core-java-io/src/main/resources/zipTest/test1.txt new file mode 100644 index 0000000000..e88ded96ab --- /dev/null +++ b/core-java-io/src/main/resources/zipTest/test1.txt @@ -0,0 +1 @@ +Test1 \ No newline at end of file diff --git a/core-java-io/src/main/resources/zipTest/test2.txt b/core-java-io/src/main/resources/zipTest/test2.txt new file mode 100644 index 0000000000..da8f209890 --- /dev/null +++ b/core-java-io/src/main/resources/zipTest/test2.txt @@ -0,0 +1 @@ +Test2 \ No newline at end of file From ca4b6200a74a860fc0c4cc26a47c15215584d70c Mon Sep 17 00:00:00 2001 From: Jonathan Cook Date: Sat, 13 Oct 2018 20:19:14 +0200 Subject: [PATCH 22/87] BAEL-2268 - Guide to JerseyTest (#5443) * BAEL-2268 - Guide to JerseyTest - second attempt without formatting changes * BAEL-2268 - Guide to JerseyTest - Add line break to end of file --- .../baeldung/jersey/server/model/Fruit.java | 5 +++ .../jersey/server/rest/FruitResource.java | 12 +++++++ .../GreetingsResourceIntegrationTest.java | 33 +++++++++++++++++++ .../rest/FruitResourceIntegrationTest.java | 27 +++++++++++++++ 4 files changed, 77 insertions(+) create mode 100644 jersey/src/test/java/com/baeldung/jersey/server/GreetingsResourceIntegrationTest.java diff --git a/jersey/src/main/java/com/baeldung/jersey/server/model/Fruit.java b/jersey/src/main/java/com/baeldung/jersey/server/model/Fruit.java index c55362487b..1a648290a3 100644 --- a/jersey/src/main/java/com/baeldung/jersey/server/model/Fruit.java +++ b/jersey/src/main/java/com/baeldung/jersey/server/model/Fruit.java @@ -54,4 +54,9 @@ public class Fruit { public void setSerial(String serial) { this.serial = serial; } + + @Override + public String toString() { + return "Fruit [name: " + getName() + " colour: " + getColour() + "]"; + } } diff --git a/jersey/src/main/java/com/baeldung/jersey/server/rest/FruitResource.java b/jersey/src/main/java/com/baeldung/jersey/server/rest/FruitResource.java index ee34cdd3ca..88692dcc55 100644 --- a/jersey/src/main/java/com/baeldung/jersey/server/rest/FruitResource.java +++ b/jersey/src/main/java/com/baeldung/jersey/server/rest/FruitResource.java @@ -16,6 +16,8 @@ import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; import org.glassfish.jersey.server.mvc.ErrorTemplate; import org.glassfish.jersey.server.mvc.Template; @@ -86,6 +88,16 @@ public class FruitResource { public void createFruit(@Valid Fruit fruit) { SimpleStorageService.storeFruit(fruit); } + + @POST + @Path("/created") + @Consumes(MediaType.APPLICATION_JSON) + public Response createNewFruit(@Valid Fruit fruit) { + String result = "Fruit saved : " + fruit; + return Response.status(Status.CREATED.getStatusCode()) + .entity(result) + .build(); + } @GET @Valid diff --git a/jersey/src/test/java/com/baeldung/jersey/server/GreetingsResourceIntegrationTest.java b/jersey/src/test/java/com/baeldung/jersey/server/GreetingsResourceIntegrationTest.java new file mode 100644 index 0000000000..8953f4161c --- /dev/null +++ b/jersey/src/test/java/com/baeldung/jersey/server/GreetingsResourceIntegrationTest.java @@ -0,0 +1,33 @@ +package com.baeldung.jersey.server; + +import static org.junit.Assert.assertEquals; + +import javax.ws.rs.core.Application; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; + +import org.glassfish.jersey.server.ResourceConfig; +import org.glassfish.jersey.test.JerseyTest; +import org.junit.Test; + +public class GreetingsResourceIntegrationTest extends JerseyTest { + + @Override + protected Application configure() { + return new ResourceConfig(Greetings.class); + } + + @Test + public void givenGetHiGreeting_whenCorrectRequest_thenResponseIsOkAndContainsHi() { + Response response = target("/greetings/hi").request() + .get(); + + assertEquals("Http Response should be 200: ", Status.OK.getStatusCode(), response.getStatus()); + assertEquals("Http Content-Type should be: ", MediaType.TEXT_HTML, response.getHeaderString(HttpHeaders.CONTENT_TYPE)); + + String content = response.readEntity(String.class); + assertEquals("Content of ressponse is: ", "hi", content); + } +} diff --git a/jersey/src/test/java/com/baeldung/jersey/server/rest/FruitResourceIntegrationTest.java b/jersey/src/test/java/com/baeldung/jersey/server/rest/FruitResourceIntegrationTest.java index 2eeb5710cb..376c8c1e75 100644 --- a/jersey/src/test/java/com/baeldung/jersey/server/rest/FruitResourceIntegrationTest.java +++ b/jersey/src/test/java/com/baeldung/jersey/server/rest/FruitResourceIntegrationTest.java @@ -10,6 +10,7 @@ import javax.ws.rs.core.Application; import javax.ws.rs.core.Form; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; import org.glassfish.jersey.test.JerseyTest; import org.glassfish.jersey.test.TestProperties; @@ -63,6 +64,15 @@ public class FruitResourceIntegrationTest extends JerseyTest { assertEquals("Http Response should be 400 ", 400, response.getStatus()); assertThat(response.readEntity(String.class), containsString("Fruit colour must not be null")); } + + @Test + public void givenCreateFruit_whenJsonIsCorrect_thenResponseCodeIsCreated() { + Response response = target("fruit/created").request() + .post(Entity.json("{\"name\":\"strawberry\",\"weight\":20}")); + + assertEquals("Http Response should be 201 ", Status.CREATED.getStatusCode(), response.getStatus()); + assertThat(response.readEntity(String.class), containsString("Fruit saved : Fruit [name: strawberry colour: null]")); + } @Test public void givenUpdateFruit_whenFormContainsBadSerialParam_thenResponseCodeIsBadRequest() { @@ -102,6 +112,23 @@ public class FruitResourceIntegrationTest extends JerseyTest { .get(String.class); assertThat(json, containsString("{\"name\":\"strawberry\",\"weight\":20}")); } + + @Test + public void givenFruitExists_whenSearching_thenResponseContainsFruitEntity() { + Fruit fruit = new Fruit(); + fruit.setName("strawberry"); + fruit.setWeight(20); + Response response = target("fruit/create").request(MediaType.APPLICATION_JSON_TYPE) + .post(Entity.entity(fruit, MediaType.APPLICATION_JSON_TYPE)); + + assertEquals("Http Response should be 204 ", 204, response.getStatus()); + + final Fruit entity = target("fruit/search/strawberry").request() + .get(Fruit.class); + + assertEquals("Fruit name: ", "strawberry", entity.getName()); + assertEquals("Fruit weight: ", Integer.valueOf(20), entity.getWeight()); + } @Test public void givenFruit_whenFruitIsInvalid_thenReponseContainsCustomExceptions() { From 1820b2c37ff5d2167e34edd3d67754b3189226c2 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sat, 13 Oct 2018 16:29:52 +0530 Subject: [PATCH 23/87] [BAEL-9514] - Added Junit 5 @DisplayName annotation example --- .../customtestname/CustomNameUnitTest.java | 17 +++++++ .../ParameterizedUnitTest.java | 48 +++++++++++++++++++ .../suite/SelectClassesSuiteUnitTest.java | 13 +++++ .../suite/SelectPackagesSuiteUnitTest.java | 11 +++++ .../suite/childpackage1/Class1UnitTest.java | 15 ++++++ .../suite/childpackage2/Class2UnitTest.java | 14 ++++++ 6 files changed, 118 insertions(+) create mode 100644 core-java/src/test/java/org/baeldung/java/customtestname/CustomNameUnitTest.java create mode 100644 core-java/src/test/java/org/baeldung/java/parameterisedsource/ParameterizedUnitTest.java create mode 100644 core-java/src/test/java/org/baeldung/java/suite/SelectClassesSuiteUnitTest.java create mode 100644 core-java/src/test/java/org/baeldung/java/suite/SelectPackagesSuiteUnitTest.java create mode 100644 core-java/src/test/java/org/baeldung/java/suite/childpackage1/Class1UnitTest.java create mode 100644 core-java/src/test/java/org/baeldung/java/suite/childpackage2/Class2UnitTest.java diff --git a/core-java/src/test/java/org/baeldung/java/customtestname/CustomNameUnitTest.java b/core-java/src/test/java/org/baeldung/java/customtestname/CustomNameUnitTest.java new file mode 100644 index 0000000000..f04b825c89 --- /dev/null +++ b/core-java/src/test/java/org/baeldung/java/customtestname/CustomNameUnitTest.java @@ -0,0 +1,17 @@ +package org.baeldung.java.customtestname; + +import static org.junit.Assert.assertNotNull; + +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; + +public class CustomNameUnitTest { + + @ParameterizedTest + @ValueSource(strings = { "Hello", "World" }) + @DisplayName("Test Method to check that the inputs are not nullable") + void givenString_TestNullOrNot(String word) { + assertNotNull(word); + } +} diff --git a/core-java/src/test/java/org/baeldung/java/parameterisedsource/ParameterizedUnitTest.java b/core-java/src/test/java/org/baeldung/java/parameterisedsource/ParameterizedUnitTest.java new file mode 100644 index 0000000000..af9ad870b9 --- /dev/null +++ b/core-java/src/test/java/org/baeldung/java/parameterisedsource/ParameterizedUnitTest.java @@ -0,0 +1,48 @@ +package org.baeldung.java.parameterisedsource; + +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.EnumSet; +import java.util.stream.Stream; + +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; +import org.junit.jupiter.params.provider.EnumSource; +import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; + +import com.baeldung.enums.PizzaDeliveryStrategy; + +public class ParameterizedUnitTest { + + @ParameterizedTest + @ValueSource(strings = { "Hello", "World" }) + void givenString_TestNullOrNot(String word) { + assertNotNull(word); + } + + @ParameterizedTest + @EnumSource(value = PizzaDeliveryStrategy.class, names = {"EXPRESS", "NORMAL"}) + void givenEnum_TestContainsOrNot(PizzaDeliveryStrategy timeUnit) { + assertTrue(EnumSet.of(PizzaDeliveryStrategy.EXPRESS, PizzaDeliveryStrategy.NORMAL).contains(timeUnit)); + } + + @ParameterizedTest + @MethodSource("wordDataProvider") + void givenMethodSource_TestInputStream(String argument) { + assertNotNull(argument); + } + + static Stream wordDataProvider() { + return Stream.of("foo", "bar"); + } + + @ParameterizedTest + @CsvSource({ "1, Car", "2, House", "3, Train" }) + void givenCSVSource_TestContent(int id, String word) { + assertNotNull(id); + assertNotNull(word); + } +} diff --git a/core-java/src/test/java/org/baeldung/java/suite/SelectClassesSuiteUnitTest.java b/core-java/src/test/java/org/baeldung/java/suite/SelectClassesSuiteUnitTest.java new file mode 100644 index 0000000000..220897eae7 --- /dev/null +++ b/core-java/src/test/java/org/baeldung/java/suite/SelectClassesSuiteUnitTest.java @@ -0,0 +1,13 @@ +package org.baeldung.java.suite; + +import org.baeldung.java.suite.childpackage1.Class1UnitTest; +import org.baeldung.java.suite.childpackage2.Class2UnitTest; +import org.junit.platform.runner.JUnitPlatform; +import org.junit.platform.suite.api.SelectClasses; +import org.junit.runner.RunWith; + +@RunWith(JUnitPlatform.class) +@SelectClasses({Class1UnitTest.class, Class2UnitTest.class}) +public class SelectClassesSuiteUnitTest { + +} diff --git a/core-java/src/test/java/org/baeldung/java/suite/SelectPackagesSuiteUnitTest.java b/core-java/src/test/java/org/baeldung/java/suite/SelectPackagesSuiteUnitTest.java new file mode 100644 index 0000000000..ae887ae43b --- /dev/null +++ b/core-java/src/test/java/org/baeldung/java/suite/SelectPackagesSuiteUnitTest.java @@ -0,0 +1,11 @@ +package org.baeldung.java.suite; + +import org.junit.platform.runner.JUnitPlatform; +import org.junit.platform.suite.api.SelectPackages; +import org.junit.runner.RunWith; + +@RunWith(JUnitPlatform.class) +@SelectPackages({ "org.baeldung.java.suite.childpackage1", "org.baeldung.java.suite.childpackage2" }) +public class SelectPackagesSuiteUnitTest { + +} diff --git a/core-java/src/test/java/org/baeldung/java/suite/childpackage1/Class1UnitTest.java b/core-java/src/test/java/org/baeldung/java/suite/childpackage1/Class1UnitTest.java new file mode 100644 index 0000000000..78469cb971 --- /dev/null +++ b/core-java/src/test/java/org/baeldung/java/suite/childpackage1/Class1UnitTest.java @@ -0,0 +1,15 @@ +package org.baeldung.java.suite.childpackage1; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.Test; + + +public class Class1UnitTest { + + @Test + public void testCase_InClass1UnitTest() { + assertTrue(true); + } + +} diff --git a/core-java/src/test/java/org/baeldung/java/suite/childpackage2/Class2UnitTest.java b/core-java/src/test/java/org/baeldung/java/suite/childpackage2/Class2UnitTest.java new file mode 100644 index 0000000000..4463ecfad9 --- /dev/null +++ b/core-java/src/test/java/org/baeldung/java/suite/childpackage2/Class2UnitTest.java @@ -0,0 +1,14 @@ +package org.baeldung.java.suite.childpackage2; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.Test; + +public class Class2UnitTest { + + @Test + public void testCase_InClass2UnitTest() { + assertTrue(true); + } + +} From c9f2162f984a2f36f91406c1d2b9fa431b53fad3 Mon Sep 17 00:00:00 2001 From: Shreyash Date: Sun, 14 Oct 2018 11:34:09 +0530 Subject: [PATCH 24/87] Spring Data Reactive Redis examples Issue: BAEL-1868 --- .../log4j2/${sys:logging.folder.path} | 0 persistence-modules/spring-data-redis/pom.xml | 87 +++++++++++-------- .../redis/SpringRedisReactiveApplication.java | 13 +++ .../reactive/redis/config/RedisConfig.java | 56 ++++++++++++ .../data/reactive/redis/model/Employee.java | 21 +++++ .../spring/data/redis/config/RedisConfig.java | 8 +- .../RedisKeyCommandsIntegrationTest.java | 51 +++++++++++ .../RedisTemplateListOpsIntegrationTest.java | 49 +++++++++++ .../RedisTemplateValueOpsIntegrationTest.java | 71 +++++++++++++++ .../RedisMessageListenerIntegrationTest.java | 2 +- .../StudentRepositoryIntegrationTest.java | 2 +- pom.xml | 1 + 12 files changed, 318 insertions(+), 43 deletions(-) create mode 100755 logging-modules/log4j2/${sys:logging.folder.path} create mode 100644 persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/reactive/redis/SpringRedisReactiveApplication.java create mode 100644 persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/reactive/redis/config/RedisConfig.java create mode 100644 persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/reactive/redis/model/Employee.java create mode 100644 persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/reactive/redis/template/RedisKeyCommandsIntegrationTest.java create mode 100644 persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/reactive/redis/template/RedisTemplateListOpsIntegrationTest.java create mode 100644 persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/reactive/redis/template/RedisTemplateValueOpsIntegrationTest.java diff --git a/logging-modules/log4j2/${sys:logging.folder.path} b/logging-modules/log4j2/${sys:logging.folder.path} new file mode 100755 index 0000000000..e69de29bb2 diff --git a/persistence-modules/spring-data-redis/pom.xml b/persistence-modules/spring-data-redis/pom.xml index 5981bf41e0..bee3d683b8 100644 --- a/persistence-modules/spring-data-redis/pom.xml +++ b/persistence-modules/spring-data-redis/pom.xml @@ -7,17 +7,61 @@ jar + parent-boot-2 com.baeldung - parent-spring-5 0.0.1-SNAPSHOT - ../../parent-spring-5 + ../../parent-boot-2 - org.springframework.data - spring-data-redis - ${spring-data-redis} + org.springframework.boot + spring-boot-starter-data-redis-reactive + + + org.springframework.boot + spring-boot-starter-web + + + org.projectlombok + lombok + + + io.projectreactor + reactor-test + test + + + + org.springframework + spring-test + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.junit.jupiter + junit-jupiter-api + + + org.junit.jupiter + junit-jupiter-engine + test + + + org.junit.platform + junit-platform-surefire-provider + ${junit.platform.version} + test + + + org.junit.platform + junit-platform-runner + ${junit.platform.version} + test @@ -33,42 +77,12 @@ jar - - org.springframework - spring-core - ${spring.version} - - - commons-logging - commons-logging - - - - - - org.springframework - spring-context - ${spring.version} - - - - org.springframework - spring-test - ${spring.version} - test - - com.lordofthejars nosqlunit-redis ${nosqlunit.version} - - org.springframework.data - spring-data-commons - ${spring-data-commons.version} - com.github.kstyrc embedded-redis @@ -77,12 +91,13 @@ - 2.0.3.RELEASE 3.2.4 2.9.0 0.10.0 2.0.3.RELEASE 0.6 + 1.0.0 + 5.0.2 diff --git a/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/reactive/redis/SpringRedisReactiveApplication.java b/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/reactive/redis/SpringRedisReactiveApplication.java new file mode 100644 index 0000000000..8b1f892f67 --- /dev/null +++ b/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/reactive/redis/SpringRedisReactiveApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.spring.data.reactive.redis; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class SpringRedisReactiveApplication { + + public static void main(String[] args) { + SpringApplication.run(SpringRedisReactiveApplication.class, args); + } + +} diff --git a/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/reactive/redis/config/RedisConfig.java b/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/reactive/redis/config/RedisConfig.java new file mode 100644 index 0000000000..d23d0092eb --- /dev/null +++ b/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/reactive/redis/config/RedisConfig.java @@ -0,0 +1,56 @@ +package com.baeldung.spring.data.reactive.redis.config; + + +import com.baeldung.spring.data.reactive.redis.model.Employee; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.ReactiveKeyCommands; +import org.springframework.data.redis.connection.ReactiveRedisConnectionFactory; +import org.springframework.data.redis.connection.ReactiveStringCommands; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.ReactiveRedisTemplate; +import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; +import org.springframework.data.redis.serializer.RedisSerializationContext; +import org.springframework.data.redis.serializer.StringRedisSerializer; + +import javax.annotation.PreDestroy; + +@Configuration +public class RedisConfig { + + @Autowired + RedisConnectionFactory factory; + + @Bean + public ReactiveRedisTemplate reactiveRedisTemplate(ReactiveRedisConnectionFactory factory) { + Jackson2JsonRedisSerializer serializer = new Jackson2JsonRedisSerializer<>(Employee.class); + RedisSerializationContext.RedisSerializationContextBuilder builder = RedisSerializationContext.newSerializationContext(new StringRedisSerializer()); + RedisSerializationContext context = builder.value(serializer) + .build(); + return new ReactiveRedisTemplate<>(factory, context); + } + + @Bean + public ReactiveRedisTemplate reactiveRedisTemplateString(ReactiveRedisConnectionFactory connectionFactory) { + return new ReactiveRedisTemplate<>(connectionFactory, RedisSerializationContext.string()); + } + + @Bean + public ReactiveKeyCommands keyCommands(final ReactiveRedisConnectionFactory reactiveRedisConnectionFactory) { + return reactiveRedisConnectionFactory.getReactiveConnection() + .keyCommands(); + } + + @Bean + public ReactiveStringCommands stringCommands(final ReactiveRedisConnectionFactory reactiveRedisConnectionFactory) { + return reactiveRedisConnectionFactory.getReactiveConnection() + .stringCommands(); + } + + @PreDestroy + public void cleanRedis() { + factory.getConnection() + .flushDb(); + } +} diff --git a/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/reactive/redis/model/Employee.java b/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/reactive/redis/model/Employee.java new file mode 100644 index 0000000000..9178f6e112 --- /dev/null +++ b/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/reactive/redis/model/Employee.java @@ -0,0 +1,21 @@ +package com.baeldung.spring.data.reactive.redis.model; + +import java.io.Serializable; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import lombok.ToString; + +@Data +@ToString +@AllArgsConstructor +@NoArgsConstructor +@EqualsAndHashCode +public class Employee implements Serializable { + private static final long serialVersionUID = 1603714798906422731L; + private String id; + private String name; + private String department; +} diff --git a/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/redis/config/RedisConfig.java b/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/redis/config/RedisConfig.java index 62a7886f46..6fdb3c5bef 100644 --- a/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/redis/config/RedisConfig.java +++ b/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/redis/config/RedisConfig.java @@ -1,6 +1,8 @@ package com.baeldung.spring.data.redis.config; -import org.springframework.beans.factory.annotation.Value; +import com.baeldung.spring.data.redis.queue.MessagePublisher; +import com.baeldung.spring.data.redis.queue.RedisMessagePublisher; +import com.baeldung.spring.data.redis.queue.RedisMessageSubscriber; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -13,10 +15,6 @@ import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; import org.springframework.data.redis.repository.configuration.EnableRedisRepositories; import org.springframework.data.redis.serializer.GenericToStringSerializer; -import com.baeldung.spring.data.redis.queue.MessagePublisher; -import com.baeldung.spring.data.redis.queue.RedisMessagePublisher; -import com.baeldung.spring.data.redis.queue.RedisMessageSubscriber; - @Configuration @ComponentScan("com.baeldung.spring.data.redis") @EnableRedisRepositories(basePackages = "com.baeldung.spring.data.redis.repo") diff --git a/persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/reactive/redis/template/RedisKeyCommandsIntegrationTest.java b/persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/reactive/redis/template/RedisKeyCommandsIntegrationTest.java new file mode 100644 index 0000000000..e48aa1e06a --- /dev/null +++ b/persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/reactive/redis/template/RedisKeyCommandsIntegrationTest.java @@ -0,0 +1,51 @@ +package com.baeldung.spring.data.reactive.redis.template; + + +import com.baeldung.spring.data.reactive.redis.SpringRedisReactiveApplication; +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.redis.connection.ReactiveKeyCommands; +import org.springframework.data.redis.connection.ReactiveStringCommands; +import org.springframework.data.redis.connection.ReactiveStringCommands.SetCommand; +import org.springframework.test.context.junit4.SpringRunner; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.nio.ByteBuffer; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SpringRedisReactiveApplication.class) +public class RedisKeyCommandsIntegrationTest { + + @Autowired + private ReactiveKeyCommands keyCommands; + + @Autowired + private ReactiveStringCommands stringCommands; + + @Test + public void givenFluxOfKeys_whenPerformOperations_thenPerformOperations() { + Flux keys = Flux.just("key1", "key2", "key3", "key4"); + + Flux generator = keys.map(String::getBytes) + .map(ByteBuffer::wrap) + .map(key -> SetCommand.set(key) + .value(key)); + + StepVerifier.create(stringCommands.set(generator)) + .expectNextCount(4L) + .verifyComplete(); + + Mono keyCount = keyCommands.keys(ByteBuffer.wrap("key*".getBytes())) + .flatMapMany(Flux::fromIterable) + .count(); + + StepVerifier.create(keyCount) + .expectNext(4L) + .verifyComplete(); + + } +} diff --git a/persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/reactive/redis/template/RedisTemplateListOpsIntegrationTest.java b/persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/reactive/redis/template/RedisTemplateListOpsIntegrationTest.java new file mode 100644 index 0000000000..3ebeff87b1 --- /dev/null +++ b/persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/reactive/redis/template/RedisTemplateListOpsIntegrationTest.java @@ -0,0 +1,49 @@ +package com.baeldung.spring.data.reactive.redis.template; + + +import com.baeldung.spring.data.reactive.redis.SpringRedisReactiveApplication; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.data.redis.core.ReactiveListOperations; +import org.springframework.data.redis.core.ReactiveRedisTemplate; +import org.springframework.test.context.junit4.SpringRunner; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SpringRedisReactiveApplication.class) +public class RedisTemplateListOpsIntegrationTest { + + private static final String LIST_NAME = "demo_list"; + + @Autowired + private ReactiveRedisTemplate redisTemplate; + + private ReactiveListOperations reactiveListOps; + + @Before + public void setup() { + reactiveListOps = redisTemplate.opsForList(); + } + + @Test + public void givenListAndValues_whenLeftPushAndLeftPop_thenLeftPushAndLeftPop() { + Mono lPush = reactiveListOps.leftPushAll(LIST_NAME, "first", "second") + .log("Pushed"); + + StepVerifier.create(lPush) + .expectNext(2L) + .verifyComplete(); + + Mono lPop = reactiveListOps.leftPop(LIST_NAME) + .log("Popped"); + + StepVerifier.create(lPop) + .expectNext("second") + .verifyComplete(); + } + +} diff --git a/persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/reactive/redis/template/RedisTemplateValueOpsIntegrationTest.java b/persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/reactive/redis/template/RedisTemplateValueOpsIntegrationTest.java new file mode 100644 index 0000000000..9490568089 --- /dev/null +++ b/persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/reactive/redis/template/RedisTemplateValueOpsIntegrationTest.java @@ -0,0 +1,71 @@ +package com.baeldung.spring.data.reactive.redis.template; + + +import com.baeldung.spring.data.reactive.redis.SpringRedisReactiveApplication; +import com.baeldung.spring.data.reactive.redis.model.Employee; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.data.redis.core.ReactiveRedisTemplate; +import org.springframework.data.redis.core.ReactiveValueOperations; +import org.springframework.test.context.junit4.SpringRunner; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.time.Duration; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SpringRedisReactiveApplication.class) +public class RedisTemplateValueOpsIntegrationTest { + + @Autowired + private ReactiveRedisTemplate redisTemplate; + + private ReactiveValueOperations reactiveValueOps; + + @Before + public void setup() { + reactiveValueOps = redisTemplate.opsForValue(); + } + + @Test + public void givenEmployee_whenSet_thenSet() { + + Mono result = reactiveValueOps.set("123", new Employee("123", "Bill", "Accounts")); + + StepVerifier.create(result) + .expectNext(true) + .verifyComplete(); + } + + @Test + public void givenEmployeeId_whenGet_thenReturnsEmployee() { + + Mono fetchedEmployee = reactiveValueOps.get("123"); + + StepVerifier.create(fetchedEmployee) + .expectNext(new Employee("123", "Bill", "Accounts")) + .verifyComplete(); + } + + @Test + public void givenEmployee_whenSetWithExpiry_thenSetsWithExpiryTime() throws InterruptedException { + + Mono result = reactiveValueOps.set("129", new Employee("129", "John", "Programming"), Duration.ofSeconds(1)); + + Mono fetchedEmployee = reactiveValueOps.get("129"); + + StepVerifier.create(result) + .expectNext(true) + .verifyComplete(); + + Thread.sleep(2000L); + + StepVerifier.create(fetchedEmployee) + .expectNextCount(0L) + .verifyComplete(); + } + +} diff --git a/persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/redis/RedisMessageListenerIntegrationTest.java b/persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/redis/RedisMessageListenerIntegrationTest.java index 5bc70069c5..99febb6430 100644 --- a/persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/redis/RedisMessageListenerIntegrationTest.java +++ b/persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/redis/RedisMessageListenerIntegrationTest.java @@ -31,7 +31,7 @@ public class RedisMessageListenerIntegrationTest { @BeforeClass public static void startRedisServer() throws IOException { - redisServer = new redis.embedded.RedisServer(6379); + redisServer = new redis.embedded.RedisServer(6380); redisServer.start(); } diff --git a/persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/redis/repo/StudentRepositoryIntegrationTest.java b/persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/redis/repo/StudentRepositoryIntegrationTest.java index 48832a8de9..43aadefc01 100644 --- a/persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/redis/repo/StudentRepositoryIntegrationTest.java +++ b/persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/redis/repo/StudentRepositoryIntegrationTest.java @@ -32,7 +32,7 @@ public class StudentRepositoryIntegrationTest { @BeforeClass public static void startRedisServer() throws IOException { - redisServer = new redis.embedded.RedisServer(6379); + redisServer = new redis.embedded.RedisServer(6380); redisServer.start(); } diff --git a/pom.xml b/pom.xml index 6c77ede1c2..28a6dd358e 100644 --- a/pom.xml +++ b/pom.xml @@ -451,6 +451,7 @@ spring-5 spring-5-data-reactive spring-5-reactive + spring-data-5-reactive/spring-5-data-reactive-redis spring-5-reactive-security spring-5-reactive-client spring-5-mvc From 79285e3cc60f28359c1429bc4ca15a4faf5a8a8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dar=C3=ADo=20Carrasquel?= Date: Sun, 14 Oct 2018 01:33:39 -0500 Subject: [PATCH 25/87] BAEL-2234 Dates difference with ZonedDateTimes (#5445) --- .../test/java/com/baeldung/date/DateDiffUnitTest.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/java-dates/src/test/java/com/baeldung/date/DateDiffUnitTest.java b/java-dates/src/test/java/com/baeldung/date/DateDiffUnitTest.java index 58d192bfdb..92da22cc95 100644 --- a/java-dates/src/test/java/com/baeldung/date/DateDiffUnitTest.java +++ b/java-dates/src/test/java/com/baeldung/date/DateDiffUnitTest.java @@ -51,6 +51,15 @@ public class DateDiffUnitTest { assertEquals(diff, 6); } + @Test + public void givenTwoZonedDateTimesInJava8_whenDifferentiating_thenWeGetSix() { + LocalDateTime ldt = LocalDateTime.now(); + ZonedDateTime now = ldt.atZone(ZoneId.of("America/Montreal")); + ZonedDateTime sixDaysBehind = now.withZoneSameInstant(ZoneId.of("Asia/Singapore")).minusDays(6); + long diff = ChronoUnit.DAYS.between(sixDaysBehind, now); + assertEquals(diff, 6); + } + @Test public void givenTwoDatesInJodaTime_whenDifferentiating_thenWeGetSix() { org.joda.time.LocalDate now = org.joda.time.LocalDate.now(); From ee5fe8faab1b2bdc4c81d840a5545765e2f7260a Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 14 Oct 2018 15:13:39 +0530 Subject: [PATCH 26/87] [BAEL-9461] - Added code examples for difference between thenApply() and thenCompose() --- .../CompletableFutureLongRunningUnitTest.java | 20 +++++++++++++++++++ .../log4j2/${sys:logging.folder.path} | 0 2 files changed, 20 insertions(+) delete mode 100755 logging-modules/log4j2/${sys:logging.folder.path} diff --git a/core-java-concurrency/src/test/java/com/baeldung/completablefuture/CompletableFutureLongRunningUnitTest.java b/core-java-concurrency/src/test/java/com/baeldung/completablefuture/CompletableFutureLongRunningUnitTest.java index 45d2ec68e4..d9cf8ae019 100644 --- a/core-java-concurrency/src/test/java/com/baeldung/completablefuture/CompletableFutureLongRunningUnitTest.java +++ b/core-java-concurrency/src/test/java/com/baeldung/completablefuture/CompletableFutureLongRunningUnitTest.java @@ -184,5 +184,25 @@ public class CompletableFutureLongRunningUnitTest { assertEquals("Hello World", future.get()); } + + @Test + public void whenPassingTransformation_thenFunctionExecutionWithThenApply() throws InterruptedException, ExecutionException { + CompletableFuture finalResult = compute().thenApply(s -> s + 1); + assertTrue(finalResult.get() == 11); + } + + @Test + public void whenPassingPreviousStage_thenFunctionExecutionWithThenCompose() throws InterruptedException, ExecutionException { + CompletableFuture finalResult = compute().thenCompose(this::computeAnother); + assertTrue(finalResult.get() == 20); + } + + public CompletableFuture compute(){ + return CompletableFuture.supplyAsync(() -> 10); + } + + public CompletableFuture computeAnother(Integer i){ + return CompletableFuture.supplyAsync(() -> 10 + i); + } } \ No newline at end of file diff --git a/logging-modules/log4j2/${sys:logging.folder.path} b/logging-modules/log4j2/${sys:logging.folder.path} deleted file mode 100755 index e69de29bb2..0000000000 From b5dcb13c41cae9374210dfe4c178b11a242a04de Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 14 Oct 2018 18:13:40 +0530 Subject: [PATCH 27/87] [BAEL-9635] - Moved Junit vs TestNg junit code examples to junit-5 module from core-java --- .../customtestname/CustomNameUnitTest.java | 17 ------ .../ParameterizedUnitTest.java | 48 ----------------- .../suite/SelectClassesSuiteUnitTest.java | 13 ----- .../suite/SelectPackagesSuiteUnitTest.java | 11 ---- .../suite/childpackage1/Class1UnitTest.java | 15 ------ .../suite/childpackage2/Class2UnitTest.java | 14 ----- .../log4j2/${sys:logging.folder.path} | 0 pom.xml | 6 +++ .../baeldung/throwsexception/Calculator.java | 0 .../DivideByZeroException.java | 0 .../junit4vstestng/SortedUnitTest.java | 0 .../SummationServiceIntegrationTest.java | 0 .../SummationServiceIntegrationTest.java | 53 +++++++++++++++++++ .../throwsexception/CalculatorUnitTest.java | 0 14 files changed, 59 insertions(+), 118 deletions(-) delete mode 100644 core-java/src/test/java/org/baeldung/java/customtestname/CustomNameUnitTest.java delete mode 100644 core-java/src/test/java/org/baeldung/java/parameterisedsource/ParameterizedUnitTest.java delete mode 100644 core-java/src/test/java/org/baeldung/java/suite/SelectClassesSuiteUnitTest.java delete mode 100644 core-java/src/test/java/org/baeldung/java/suite/SelectPackagesSuiteUnitTest.java delete mode 100644 core-java/src/test/java/org/baeldung/java/suite/childpackage1/Class1UnitTest.java delete mode 100644 core-java/src/test/java/org/baeldung/java/suite/childpackage2/Class2UnitTest.java delete mode 100755 logging-modules/log4j2/${sys:logging.folder.path} rename {core-java => testing-modules/junit-5}/src/main/java/com/baeldung/throwsexception/Calculator.java (100%) rename {core-java => testing-modules/junit-5}/src/main/java/com/baeldung/throwsexception/DivideByZeroException.java (100%) rename {core-java => testing-modules/junit-5}/src/test/java/com/baeldung/junit4vstestng/SortedUnitTest.java (100%) rename {core-java => testing-modules/junit-5}/src/test/java/com/baeldung/junit4vstestng/SummationServiceIntegrationTest.java (100%) create mode 100644 testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SummationServiceIntegrationTest.java rename {core-java => testing-modules/junit-5}/src/test/java/com/baeldung/throwsexception/CalculatorUnitTest.java (100%) diff --git a/core-java/src/test/java/org/baeldung/java/customtestname/CustomNameUnitTest.java b/core-java/src/test/java/org/baeldung/java/customtestname/CustomNameUnitTest.java deleted file mode 100644 index f04b825c89..0000000000 --- a/core-java/src/test/java/org/baeldung/java/customtestname/CustomNameUnitTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung.java.customtestname; - -import static org.junit.Assert.assertNotNull; - -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; - -public class CustomNameUnitTest { - - @ParameterizedTest - @ValueSource(strings = { "Hello", "World" }) - @DisplayName("Test Method to check that the inputs are not nullable") - void givenString_TestNullOrNot(String word) { - assertNotNull(word); - } -} diff --git a/core-java/src/test/java/org/baeldung/java/parameterisedsource/ParameterizedUnitTest.java b/core-java/src/test/java/org/baeldung/java/parameterisedsource/ParameterizedUnitTest.java deleted file mode 100644 index af9ad870b9..0000000000 --- a/core-java/src/test/java/org/baeldung/java/parameterisedsource/ParameterizedUnitTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.baeldung.java.parameterisedsource; - -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.util.EnumSet; -import java.util.stream.Stream; - -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.CsvSource; -import org.junit.jupiter.params.provider.EnumSource; -import org.junit.jupiter.params.provider.MethodSource; -import org.junit.jupiter.params.provider.ValueSource; - -import com.baeldung.enums.PizzaDeliveryStrategy; - -public class ParameterizedUnitTest { - - @ParameterizedTest - @ValueSource(strings = { "Hello", "World" }) - void givenString_TestNullOrNot(String word) { - assertNotNull(word); - } - - @ParameterizedTest - @EnumSource(value = PizzaDeliveryStrategy.class, names = {"EXPRESS", "NORMAL"}) - void givenEnum_TestContainsOrNot(PizzaDeliveryStrategy timeUnit) { - assertTrue(EnumSet.of(PizzaDeliveryStrategy.EXPRESS, PizzaDeliveryStrategy.NORMAL).contains(timeUnit)); - } - - @ParameterizedTest - @MethodSource("wordDataProvider") - void givenMethodSource_TestInputStream(String argument) { - assertNotNull(argument); - } - - static Stream wordDataProvider() { - return Stream.of("foo", "bar"); - } - - @ParameterizedTest - @CsvSource({ "1, Car", "2, House", "3, Train" }) - void givenCSVSource_TestContent(int id, String word) { - assertNotNull(id); - assertNotNull(word); - } -} diff --git a/core-java/src/test/java/org/baeldung/java/suite/SelectClassesSuiteUnitTest.java b/core-java/src/test/java/org/baeldung/java/suite/SelectClassesSuiteUnitTest.java deleted file mode 100644 index 220897eae7..0000000000 --- a/core-java/src/test/java/org/baeldung/java/suite/SelectClassesSuiteUnitTest.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.baeldung.java.suite; - -import org.baeldung.java.suite.childpackage1.Class1UnitTest; -import org.baeldung.java.suite.childpackage2.Class2UnitTest; -import org.junit.platform.runner.JUnitPlatform; -import org.junit.platform.suite.api.SelectClasses; -import org.junit.runner.RunWith; - -@RunWith(JUnitPlatform.class) -@SelectClasses({Class1UnitTest.class, Class2UnitTest.class}) -public class SelectClassesSuiteUnitTest { - -} diff --git a/core-java/src/test/java/org/baeldung/java/suite/SelectPackagesSuiteUnitTest.java b/core-java/src/test/java/org/baeldung/java/suite/SelectPackagesSuiteUnitTest.java deleted file mode 100644 index ae887ae43b..0000000000 --- a/core-java/src/test/java/org/baeldung/java/suite/SelectPackagesSuiteUnitTest.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.baeldung.java.suite; - -import org.junit.platform.runner.JUnitPlatform; -import org.junit.platform.suite.api.SelectPackages; -import org.junit.runner.RunWith; - -@RunWith(JUnitPlatform.class) -@SelectPackages({ "org.baeldung.java.suite.childpackage1", "org.baeldung.java.suite.childpackage2" }) -public class SelectPackagesSuiteUnitTest { - -} diff --git a/core-java/src/test/java/org/baeldung/java/suite/childpackage1/Class1UnitTest.java b/core-java/src/test/java/org/baeldung/java/suite/childpackage1/Class1UnitTest.java deleted file mode 100644 index 78469cb971..0000000000 --- a/core-java/src/test/java/org/baeldung/java/suite/childpackage1/Class1UnitTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.baeldung.java.suite.childpackage1; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -import org.junit.Test; - - -public class Class1UnitTest { - - @Test - public void testCase_InClass1UnitTest() { - assertTrue(true); - } - -} diff --git a/core-java/src/test/java/org/baeldung/java/suite/childpackage2/Class2UnitTest.java b/core-java/src/test/java/org/baeldung/java/suite/childpackage2/Class2UnitTest.java deleted file mode 100644 index 4463ecfad9..0000000000 --- a/core-java/src/test/java/org/baeldung/java/suite/childpackage2/Class2UnitTest.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.baeldung.java.suite.childpackage2; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -import org.junit.Test; - -public class Class2UnitTest { - - @Test - public void testCase_InClass2UnitTest() { - assertTrue(true); - } - -} diff --git a/logging-modules/log4j2/${sys:logging.folder.path} b/logging-modules/log4j2/${sys:logging.folder.path} deleted file mode 100755 index e69de29bb2..0000000000 diff --git a/pom.xml b/pom.xml index 28a6dd358e..da1733d2b2 100644 --- a/pom.xml +++ b/pom.xml @@ -46,6 +46,12 @@ ${junit-jupiter.version} test + + org.junit.jupiter + junit-jupiter-params + ${junit-jupiter.version} + test + org.junit.jupiter junit-jupiter-api diff --git a/core-java/src/main/java/com/baeldung/throwsexception/Calculator.java b/testing-modules/junit-5/src/main/java/com/baeldung/throwsexception/Calculator.java similarity index 100% rename from core-java/src/main/java/com/baeldung/throwsexception/Calculator.java rename to testing-modules/junit-5/src/main/java/com/baeldung/throwsexception/Calculator.java diff --git a/core-java/src/main/java/com/baeldung/throwsexception/DivideByZeroException.java b/testing-modules/junit-5/src/main/java/com/baeldung/throwsexception/DivideByZeroException.java similarity index 100% rename from core-java/src/main/java/com/baeldung/throwsexception/DivideByZeroException.java rename to testing-modules/junit-5/src/main/java/com/baeldung/throwsexception/DivideByZeroException.java diff --git a/core-java/src/test/java/com/baeldung/junit4vstestng/SortedUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit4vstestng/SortedUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/junit4vstestng/SortedUnitTest.java rename to testing-modules/junit-5/src/test/java/com/baeldung/junit4vstestng/SortedUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/junit4vstestng/SummationServiceIntegrationTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit4vstestng/SummationServiceIntegrationTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/junit4vstestng/SummationServiceIntegrationTest.java rename to testing-modules/junit-5/src/test/java/com/baeldung/junit4vstestng/SummationServiceIntegrationTest.java diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SummationServiceIntegrationTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SummationServiceIntegrationTest.java new file mode 100644 index 0000000000..92e7a6f5db --- /dev/null +++ b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SummationServiceIntegrationTest.java @@ -0,0 +1,53 @@ +package com.baeldung.junit5vstestng; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class SummationServiceIntegrationTest { + private static List numbers; + + @BeforeAll + public static void initialize() { + numbers = new ArrayList<>(); + } + + @AfterAll + public static void tearDown() { + numbers = null; + } + + @BeforeEach + public void runBeforeEachTest() { + numbers.add(1); + numbers.add(2); + numbers.add(3); + } + + @AfterEach + public void runAfterEachTest() { + numbers.clear(); + } + + @Test + public void givenNumbers_sumEquals_thenCorrect() { + int sum = numbers.stream() + .reduce(0, Integer::sum); + Assert.assertEquals(6, sum); + } + + @Ignore + @Test + public void givenEmptyList_sumEqualsZero_thenCorrect() { + int sum = numbers.stream() + .reduce(0, Integer::sum); + Assert.assertEquals(6, sum); + } +} diff --git a/core-java/src/test/java/com/baeldung/throwsexception/CalculatorUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/throwsexception/CalculatorUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/throwsexception/CalculatorUnitTest.java rename to testing-modules/junit-5/src/test/java/com/baeldung/throwsexception/CalculatorUnitTest.java From 29cee792a889d72c211251ee31a5052bf118c7ac Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 14 Oct 2018 20:02:51 +0530 Subject: [PATCH 28/87] [BAEL-9601] - Upgraded groovy-all version in libraries module --- libraries/pom.xml | 3 ++- logging-modules/log4j2/{${sys:logging.folder.path} => ${sys} | 0 2 files changed, 2 insertions(+), 1 deletion(-) rename logging-modules/log4j2/{${sys:logging.folder.path} => ${sys} (100%) mode change 100755 => 100644 diff --git a/libraries/pom.xml b/libraries/pom.xml index 91c54b6113..6bbe8e6f1c 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -358,6 +358,7 @@ org.codehaus.groovy groovy-all + pom ${groovy.version} @@ -922,7 +923,7 @@ 2.3.0 0.9.12 1.19 - 2.4.10 + 2.5.2 1.1.0 3.9.0 2.0.4 diff --git a/logging-modules/log4j2/${sys:logging.folder.path} b/logging-modules/log4j2/${sys old mode 100755 new mode 100644 similarity index 100% rename from logging-modules/log4j2/${sys:logging.folder.path} rename to logging-modules/log4j2/${sys From 38ddcc6477ca324e248173a102be6fd63276a7d9 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 14 Oct 2018 19:26:46 +0300 Subject: [PATCH 29/87] rename test to manual --- ...{SystemsUtilsUnitTest.java => SystemsUtilsManualTest.java} | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) rename libraries/src/test/java/com/baeldung/commons/lang3/test/{SystemsUtilsUnitTest.java => SystemsUtilsManualTest.java} (86%) diff --git a/libraries/src/test/java/com/baeldung/commons/lang3/test/SystemsUtilsUnitTest.java b/libraries/src/test/java/com/baeldung/commons/lang3/test/SystemsUtilsManualTest.java similarity index 86% rename from libraries/src/test/java/com/baeldung/commons/lang3/test/SystemsUtilsUnitTest.java rename to libraries/src/test/java/com/baeldung/commons/lang3/test/SystemsUtilsManualTest.java index 0efe97f912..cb45ebc24d 100644 --- a/libraries/src/test/java/com/baeldung/commons/lang3/test/SystemsUtilsUnitTest.java +++ b/libraries/src/test/java/com/baeldung/commons/lang3/test/SystemsUtilsManualTest.java @@ -6,8 +6,10 @@ import org.apache.commons.lang3.SystemUtils; import static org.assertj.core.api.Assertions.assertThat; import org.junit.Test; -public class SystemsUtilsUnitTest { +public class SystemsUtilsManualTest { + // the paths depend on the OS and installed version of Java + @Test public void givenSystemUtilsClass_whenCalledgetJavaHome_thenCorrect() { assertThat(SystemUtils.getJavaHome()).isEqualTo(new File("/usr/lib/jvm/java-8-oracle/jre")); From 6b3803a683a729d356ad88bc0a0b982a587af9c3 Mon Sep 17 00:00:00 2001 From: elrisita Date: Sun, 14 Oct 2018 17:27:34 +0100 Subject: [PATCH 30/87] BAEL-2242 --- .../baeldung/removal/CollectionRemoveIf.java | 19 +++++ .../java/com/baeldung/removal/Iterators.java | 28 +++++++ .../removal/StreamFilterAndCollector.java | 23 ++++++ .../removal/StreamPartitioningBy.java | 28 +++++++ .../com/baeldung/removal/RemovalUnitTest.java | 77 +++++++++++++++++++ 5 files changed, 175 insertions(+) create mode 100644 core-java-collections/src/main/java/com/baeldung/removal/CollectionRemoveIf.java create mode 100644 core-java-collections/src/main/java/com/baeldung/removal/Iterators.java create mode 100644 core-java-collections/src/main/java/com/baeldung/removal/StreamFilterAndCollector.java create mode 100644 core-java-collections/src/main/java/com/baeldung/removal/StreamPartitioningBy.java create mode 100644 core-java-collections/src/test/java/com/baeldung/removal/RemovalUnitTest.java diff --git a/core-java-collections/src/main/java/com/baeldung/removal/CollectionRemoveIf.java b/core-java-collections/src/main/java/com/baeldung/removal/CollectionRemoveIf.java new file mode 100644 index 0000000000..2f5e91596f --- /dev/null +++ b/core-java-collections/src/main/java/com/baeldung/removal/CollectionRemoveIf.java @@ -0,0 +1,19 @@ +package com.baeldung.removal; + +import java.util.ArrayList; +import java.util.Collection; + +public class CollectionRemoveIf { + + public static void main(String args[]) { + Collection names = new ArrayList<>(); + names.add("John"); + names.add("Ana"); + names.add("Mary"); + names.add("Anthony"); + names.add("Mark"); + + names.removeIf(e -> e.startsWith("A")); + System.out.println(String.join(",", names)); + } +} diff --git a/core-java-collections/src/main/java/com/baeldung/removal/Iterators.java b/core-java-collections/src/main/java/com/baeldung/removal/Iterators.java new file mode 100644 index 0000000000..86b91b3fdc --- /dev/null +++ b/core-java-collections/src/main/java/com/baeldung/removal/Iterators.java @@ -0,0 +1,28 @@ +package com.baeldung.removal; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; + +public class Iterators { + + public static void main(String args[]) { + Collection names = new ArrayList<>(); + names.add("John"); + names.add("Ana"); + names.add("Mary"); + names.add("Anthony"); + names.add("Mark"); + + Iterator i = names.iterator(); + + while (i.hasNext()) { + String e = i.next(); + if (e.startsWith("A")) { + i.remove(); + } + } + + System.out.println(String.join(",", names)); + } +} diff --git a/core-java-collections/src/main/java/com/baeldung/removal/StreamFilterAndCollector.java b/core-java-collections/src/main/java/com/baeldung/removal/StreamFilterAndCollector.java new file mode 100644 index 0000000000..bf6db68bae --- /dev/null +++ b/core-java-collections/src/main/java/com/baeldung/removal/StreamFilterAndCollector.java @@ -0,0 +1,23 @@ +package com.baeldung.removal; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.stream.Collectors; + +public class StreamFilterAndCollector { + + public static void main(String args[]) { + Collection names = new ArrayList<>(); + names.add("John"); + names.add("Ana"); + names.add("Mary"); + names.add("Anthony"); + names.add("Mark"); + + Collection filteredCollection = names + .stream() + .filter(e -> !e.startsWith("A")) + .collect(Collectors.toList()); + System.out.println(String.join(",", filteredCollection)); + } +} diff --git a/core-java-collections/src/main/java/com/baeldung/removal/StreamPartitioningBy.java b/core-java-collections/src/main/java/com/baeldung/removal/StreamPartitioningBy.java new file mode 100644 index 0000000000..c77e996616 --- /dev/null +++ b/core-java-collections/src/main/java/com/baeldung/removal/StreamPartitioningBy.java @@ -0,0 +1,28 @@ +package com.baeldung.removal; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public class StreamPartitioningBy { + + public static void main(String args[]) { + Collection names = new ArrayList<>(); + names.add("John"); + names.add("Ana"); + names.add("Mary"); + names.add("Anthony"); + names.add("Mark"); + + Map> classifiedElements = names + .stream() + .collect(Collectors.partitioningBy((String e) -> !e.startsWith("A"))); + + String matching = String.join(",", classifiedElements.get(Boolean.TRUE)); + String nonMatching = String.join(",", classifiedElements.get(Boolean.FALSE)); + System.out.println("Matching elements: " + matching); + System.out.println("Non matching elements: " + nonMatching); + } +} diff --git a/core-java-collections/src/test/java/com/baeldung/removal/RemovalUnitTest.java b/core-java-collections/src/test/java/com/baeldung/removal/RemovalUnitTest.java new file mode 100644 index 0000000000..1b379f32de --- /dev/null +++ b/core-java-collections/src/test/java/com/baeldung/removal/RemovalUnitTest.java @@ -0,0 +1,77 @@ +package com.baeldung.removal; + +import org.junit.Before; +import org.junit.Test; + +import java.util.*; +import java.util.stream.Collectors; + +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThat; + +public class RemovalUnitTest { + + Collection names; + Collection expected; + Collection removed; + + @Before + public void setupTestData() { + names = new ArrayList<>(); + expected = new ArrayList<>(); + removed = new ArrayList<>(); + + names.add("John"); + names.add("Ana"); + names.add("Mary"); + names.add("Anthony"); + names.add("Mark"); + + expected.add("John"); + expected.add("Mary"); + expected.add("Mark"); + + removed.add("Ana"); + removed.add("Anthony"); + } + + @Test + public void givenCollectionOfNames_whenUsingIteratorToRemoveAllNamesStartingWithLetterA_finalListShouldContainNoNamesStartingWithLetterA() { + Iterator i = names.iterator(); + + while (i.hasNext()) { + String e = i.next(); + if (e.startsWith("A")) { + i.remove(); + } + } + + assertThat(names, is(expected)); + } + + @Test + public void givenCollectionOfNames_whenUsingRemoveIfToRemoveAllNamesStartingWithLetterA_finalListShouldContainNoNamesStartingWithLetterA() { + names.removeIf(e -> e.startsWith("A")); + assertThat(names, is(expected)); + } + + @Test + public void givenCollectionOfNames_whenUsingStreamToFilterAllNamesStartingWithLetterA_finalListShouldContainNoNamesStartingWithLetterA() { + Collection filteredCollection = names + .stream() + .filter(e -> !e.startsWith("A")) + .collect(Collectors.toList()); + assertThat(filteredCollection, is(expected)); + } + + @Test + public void givenCollectionOfNames_whenUsingStreamAndPartitioningByToFindNamesThatStartWithLetterA_shouldFind3MatchingAnd2NonMatching() { + Map> classifiedElements = names + .stream() + .collect(Collectors.partitioningBy((String e) -> !e.startsWith("A"))); + + assertThat(classifiedElements.get(Boolean.TRUE), is(expected)); + assertThat(classifiedElements.get(Boolean.FALSE), is(removed)); + } + +} From 23b1323446c2c535ab8fdf3aef19761e0649bc98 Mon Sep 17 00:00:00 2001 From: KevinGilmore Date: Sun, 14 Oct 2018 11:37:16 -0500 Subject: [PATCH 31/87] BAEL-2200: Spring Boot auto-configuration report (#5453) * BAEL-1766: Update README * BAEL-1853: add link to article * BAEL-1801: add link to article * Added links back to articles * Add links back to articles * BAEL-1795: Update README * BAEL-1901 and BAEL-1555 add links back to article * BAEL-2026 add link back to article * BAEL-2029: add link back to article * BAEL-1898: Add link back to article * BAEL-2102 and BAEL-2131 Add links back to articles * BAEL-2132 Add link back to article * BAEL-1980: add link back to article * BAEL-2200: Display auto-configuration report in Spring Boot --- .../baeldung/h2db/auto/configuration/AutoConfigurationDemo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/auto/configuration/AutoConfigurationDemo.java b/spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/auto/configuration/AutoConfigurationDemo.java index 87a191554b..8d92e18754 100644 --- a/spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/auto/configuration/AutoConfigurationDemo.java +++ b/spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/auto/configuration/AutoConfigurationDemo.java @@ -4,7 +4,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; -@SpringBootApplication(scanBasePackages = "com.baeldung.h2db.auto-configuration") +@SpringBootApplication public class AutoConfigurationDemo { public static void main(String[] args) { From 285219c54c3ffe993e9bb9e7819d5b4cb9802de3 Mon Sep 17 00:00:00 2001 From: fanatixan Date: Sun, 14 Oct 2018 19:08:11 +0200 Subject: [PATCH 32/87] Bael-2210 - Heap Sort (#5446) * implementing heap * Heap sort refactor --- .../main/java/com/baeldung/heapsort/Heap.java | 136 ++++++++++++++++++ .../com/baeldung/heapsort/HeapUnitTest.java | 36 +++++ 2 files changed, 172 insertions(+) create mode 100644 core-java/src/main/java/com/baeldung/heapsort/Heap.java create mode 100644 core-java/src/test/java/com/baeldung/heapsort/HeapUnitTest.java diff --git a/core-java/src/main/java/com/baeldung/heapsort/Heap.java b/core-java/src/main/java/com/baeldung/heapsort/Heap.java new file mode 100644 index 0000000000..95e0e1d8cd --- /dev/null +++ b/core-java/src/main/java/com/baeldung/heapsort/Heap.java @@ -0,0 +1,136 @@ +package com.baeldung.heapsort; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class Heap> { + + private List elements = new ArrayList<>(); + + public static > List sort(Iterable elements) { + Heap heap = of(elements); + + List result = new ArrayList<>(); + + while (!heap.isEmpty()) { + result.add(heap.pop()); + } + + return result; + } + + public static > Heap of(E... elements) { + return of(Arrays.asList(elements)); + } + + public static > Heap of(Iterable elements) { + Heap result = new Heap<>(); + for (E element : elements) { + result.add(element); + } + return result; + } + + public void add(E e) { + elements.add(e); + int elementIndex = elements.size() - 1; + while (!isRoot(elementIndex) && !isCorrectChild(elementIndex)) { + int parentIndex = parentIndex(elementIndex); + swap(elementIndex, parentIndex); + elementIndex = parentIndex; + } + } + + public E pop() { + if (isEmpty()) { + throw new IllegalStateException("You cannot pop from an empty heap"); + } + + E result = elementAt(0); + + int lasElementIndex = elements.size() - 1; + swap(0, lasElementIndex); + elements.remove(lasElementIndex); + + int elementIndex = 0; + while (!isLeaf(elementIndex) && !isCorrectParent(elementIndex)) { + int smallerChildIndex = smallerChildIndex(elementIndex); + swap(elementIndex, smallerChildIndex); + elementIndex = smallerChildIndex; + } + + return result; + } + + public boolean isEmpty() { + return elements.isEmpty(); + } + + private boolean isRoot(int index) { + return index == 0; + } + + private int smallerChildIndex(int index) { + int leftChildIndex = leftChildIndex(index); + int rightChildIndex = rightChildIndex(index); + + if (!isValidIndex(rightChildIndex)) { + return leftChildIndex; + } + + if (elementAt(leftChildIndex).compareTo(elementAt(rightChildIndex)) < 0) { + return leftChildIndex; + } + + return rightChildIndex; + } + + private boolean isLeaf(int index) { + return !isValidIndex(leftChildIndex(index)); + } + + private boolean isCorrectParent(int index) { + return isCorrect(index, leftChildIndex(index)) && isCorrect(index, rightChildIndex(index)); + } + + private boolean isCorrectChild(int index) { + return isCorrect(parentIndex(index), index); + } + + private boolean isCorrect(int parentIndex, int childIndex) { + if (!isValidIndex(parentIndex) || !isValidIndex(childIndex)) { + return true; + } + + return elementAt(parentIndex).compareTo(elementAt(childIndex)) < 0; + } + + private boolean isValidIndex(int index) { + return index < elements.size(); + } + + private void swap(int index1, int index2) { + E element1 = elementAt(index1); + E element2 = elementAt(index2); + elements.set(index1, element2); + elements.set(index2, element1); + } + + private E elementAt(int index) { + return elements.get(index); + } + + private int parentIndex(int index) { + return (index - 1) / 2; + } + + private int leftChildIndex(int index) { + return 2 * index + 1; + } + + private int rightChildIndex(int index) { + return 2 * index + 2; + } + +} diff --git a/core-java/src/test/java/com/baeldung/heapsort/HeapUnitTest.java b/core-java/src/test/java/com/baeldung/heapsort/HeapUnitTest.java new file mode 100644 index 0000000000..cc3e49b6c9 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/heapsort/HeapUnitTest.java @@ -0,0 +1,36 @@ +package com.baeldung.heapsort; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.Arrays; +import java.util.List; + +import org.junit.Test; + +public class HeapUnitTest { + + @Test + public void givenNotEmptyHeap_whenPopCalled_thenItShouldReturnSmallestElement() { + // given + Heap heap = Heap.of(3, 5, 1, 4, 2); + + // when + int head = heap.pop(); + + // then + assertThat(head).isEqualTo(1); + } + + @Test + public void givenNotEmptyIterable_whenSortCalled_thenItShouldReturnElementsInSortedList() { + // given + List elements = Arrays.asList(3, 5, 1, 4, 2); + + // when + List sortedElements = Heap.sort(elements); + + // then + assertThat(sortedElements).isEqualTo(Arrays.asList(1, 2, 3, 4, 5)); + } + +} From edff9132ee617922b52a12be0d8b35c4e2ffd7d2 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 14 Oct 2018 23:05:11 +0530 Subject: [PATCH 33/87] [BAEL-9635] - Added missing classes --- .../customtestname/CustomNameUnitTest.java | 17 +++++++ .../ParameterizedUnitTest.java | 45 +++++++++++++++++++ .../PizzaDeliveryStrategy.java | 6 +++ .../suite/SelectClassesSuiteUnitTest.java | 13 ++++++ .../suite/SelectPackagesSuiteUnitTest.java | 11 +++++ .../suite/childpackage1/Class1UnitTest.java | 15 +++++++ .../suite/childpackage2/Class2UnitTest.java | 14 ++++++ 7 files changed, 121 insertions(+) create mode 100644 testing-modules/junit-5/src/test/java/org/baeldung/java/customtestname/CustomNameUnitTest.java create mode 100644 testing-modules/junit-5/src/test/java/org/baeldung/java/parameterisedsource/ParameterizedUnitTest.java create mode 100644 testing-modules/junit-5/src/test/java/org/baeldung/java/parameterisedsource/PizzaDeliveryStrategy.java create mode 100644 testing-modules/junit-5/src/test/java/org/baeldung/java/suite/SelectClassesSuiteUnitTest.java create mode 100644 testing-modules/junit-5/src/test/java/org/baeldung/java/suite/SelectPackagesSuiteUnitTest.java create mode 100644 testing-modules/junit-5/src/test/java/org/baeldung/java/suite/childpackage1/Class1UnitTest.java create mode 100644 testing-modules/junit-5/src/test/java/org/baeldung/java/suite/childpackage2/Class2UnitTest.java diff --git a/testing-modules/junit-5/src/test/java/org/baeldung/java/customtestname/CustomNameUnitTest.java b/testing-modules/junit-5/src/test/java/org/baeldung/java/customtestname/CustomNameUnitTest.java new file mode 100644 index 0000000000..f04b825c89 --- /dev/null +++ b/testing-modules/junit-5/src/test/java/org/baeldung/java/customtestname/CustomNameUnitTest.java @@ -0,0 +1,17 @@ +package org.baeldung.java.customtestname; + +import static org.junit.Assert.assertNotNull; + +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; + +public class CustomNameUnitTest { + + @ParameterizedTest + @ValueSource(strings = { "Hello", "World" }) + @DisplayName("Test Method to check that the inputs are not nullable") + void givenString_TestNullOrNot(String word) { + assertNotNull(word); + } +} diff --git a/testing-modules/junit-5/src/test/java/org/baeldung/java/parameterisedsource/ParameterizedUnitTest.java b/testing-modules/junit-5/src/test/java/org/baeldung/java/parameterisedsource/ParameterizedUnitTest.java new file mode 100644 index 0000000000..8d09161176 --- /dev/null +++ b/testing-modules/junit-5/src/test/java/org/baeldung/java/parameterisedsource/ParameterizedUnitTest.java @@ -0,0 +1,45 @@ +package org.baeldung.java.parameterisedsource; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.EnumSet; +import java.util.stream.Stream; + +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; +import org.junit.jupiter.params.provider.EnumSource; +import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; + +public class ParameterizedUnitTest { + + @ParameterizedTest + @ValueSource(strings = { "Hello", "World" }) + void givenString_TestNullOrNot(String word) { + assertNotNull(word); + } + + @ParameterizedTest + @EnumSource(value = PizzaDeliveryStrategy.class, names = {"EXPRESS", "NORMAL"}) + void givenEnum_TestContainsOrNot(PizzaDeliveryStrategy timeUnit) { + assertTrue(EnumSet.of(PizzaDeliveryStrategy.EXPRESS, PizzaDeliveryStrategy.NORMAL).contains(timeUnit)); + } + + @ParameterizedTest + @MethodSource("wordDataProvider") + void givenMethodSource_TestInputStream(String argument) { + assertNotNull(argument); + } + + static Stream wordDataProvider() { + return Stream.of("foo", "bar"); + } + + @ParameterizedTest + @CsvSource({ "1, Car", "2, House", "3, Train" }) + void givenCSVSource_TestContent(int id, String word) { + assertNotNull(id); + assertNotNull(word); + } +} diff --git a/testing-modules/junit-5/src/test/java/org/baeldung/java/parameterisedsource/PizzaDeliveryStrategy.java b/testing-modules/junit-5/src/test/java/org/baeldung/java/parameterisedsource/PizzaDeliveryStrategy.java new file mode 100644 index 0000000000..ecfc7b4627 --- /dev/null +++ b/testing-modules/junit-5/src/test/java/org/baeldung/java/parameterisedsource/PizzaDeliveryStrategy.java @@ -0,0 +1,6 @@ +package org.baeldung.java.parameterisedsource; + +public enum PizzaDeliveryStrategy { + EXPRESS, + NORMAL; +} diff --git a/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/SelectClassesSuiteUnitTest.java b/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/SelectClassesSuiteUnitTest.java new file mode 100644 index 0000000000..220897eae7 --- /dev/null +++ b/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/SelectClassesSuiteUnitTest.java @@ -0,0 +1,13 @@ +package org.baeldung.java.suite; + +import org.baeldung.java.suite.childpackage1.Class1UnitTest; +import org.baeldung.java.suite.childpackage2.Class2UnitTest; +import org.junit.platform.runner.JUnitPlatform; +import org.junit.platform.suite.api.SelectClasses; +import org.junit.runner.RunWith; + +@RunWith(JUnitPlatform.class) +@SelectClasses({Class1UnitTest.class, Class2UnitTest.class}) +public class SelectClassesSuiteUnitTest { + +} diff --git a/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/SelectPackagesSuiteUnitTest.java b/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/SelectPackagesSuiteUnitTest.java new file mode 100644 index 0000000000..ae887ae43b --- /dev/null +++ b/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/SelectPackagesSuiteUnitTest.java @@ -0,0 +1,11 @@ +package org.baeldung.java.suite; + +import org.junit.platform.runner.JUnitPlatform; +import org.junit.platform.suite.api.SelectPackages; +import org.junit.runner.RunWith; + +@RunWith(JUnitPlatform.class) +@SelectPackages({ "org.baeldung.java.suite.childpackage1", "org.baeldung.java.suite.childpackage2" }) +public class SelectPackagesSuiteUnitTest { + +} diff --git a/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/childpackage1/Class1UnitTest.java b/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/childpackage1/Class1UnitTest.java new file mode 100644 index 0000000000..78469cb971 --- /dev/null +++ b/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/childpackage1/Class1UnitTest.java @@ -0,0 +1,15 @@ +package org.baeldung.java.suite.childpackage1; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.Test; + + +public class Class1UnitTest { + + @Test + public void testCase_InClass1UnitTest() { + assertTrue(true); + } + +} diff --git a/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/childpackage2/Class2UnitTest.java b/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/childpackage2/Class2UnitTest.java new file mode 100644 index 0000000000..4463ecfad9 --- /dev/null +++ b/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/childpackage2/Class2UnitTest.java @@ -0,0 +1,14 @@ +package org.baeldung.java.suite.childpackage2; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.Test; + +public class Class2UnitTest { + + @Test + public void testCase_InClass2UnitTest() { + assertTrue(true); + } + +} From 3a14ed0ff35556766c700a51c1d2004350db6a27 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 14 Oct 2018 23:46:10 +0530 Subject: [PATCH 34/87] [BAEL-9515] - Added latest version of spring 1.5 --- parent-boot-1/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parent-boot-1/pom.xml b/parent-boot-1/pom.xml index 7742841d07..d220b4a6b7 100644 --- a/parent-boot-1/pom.xml +++ b/parent-boot-1/pom.xml @@ -17,7 +17,7 @@ org.springframework.boot spring-boot-dependencies - 1.5.15.RELEASE + 1.5.16.RELEASE pom import From 5c0ea4c47d59c0d17a1f2da5f5c181426f9a6168 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 14 Oct 2018 22:39:34 +0300 Subject: [PATCH 35/87] move tests in junit-5 --- .../{throwsexception => junit5vstestng}/Calculator.java | 2 +- .../DivideByZeroException.java | 2 +- .../CalculatorUnitTest.java | 2 +- .../baeldung/junit5vstestng}/Class1UnitTest.java | 2 +- .../baeldung/junit5vstestng}/Class2UnitTest.java | 2 +- .../baeldung/junit5vstestng}/CustomNameUnitTest.java | 2 +- .../baeldung/junit5vstestng}/ParameterizedUnitTest.java | 2 +- .../baeldung/junit5vstestng}/PizzaDeliveryStrategy.java | 2 +- .../baeldung/junit5vstestng}/SelectClassesSuiteUnitTest.java | 4 +--- .../baeldung/junit5vstestng}/SelectPackagesSuiteUnitTest.java | 2 +- ...viceIntegrationTest.java => SummationServiceUnitTest.java} | 2 +- 11 files changed, 11 insertions(+), 13 deletions(-) rename testing-modules/junit-5/src/main/java/com/baeldung/{throwsexception => junit5vstestng}/Calculator.java (85%) rename testing-modules/junit-5/src/main/java/com/baeldung/{throwsexception => junit5vstestng}/DivideByZeroException.java (79%) rename testing-modules/junit-5/src/test/java/com/baeldung/{throwsexception => junit5vstestng}/CalculatorUnitTest.java (90%) rename testing-modules/junit-5/src/test/java/{org/baeldung/java/suite/childpackage1 => com/baeldung/junit5vstestng}/Class1UnitTest.java (81%) rename testing-modules/junit-5/src/test/java/{org/baeldung/java/suite/childpackage2 => com/baeldung/junit5vstestng}/Class2UnitTest.java (81%) rename testing-modules/junit-5/src/test/java/{org/baeldung/java/customtestname => com/baeldung/junit5vstestng}/CustomNameUnitTest.java (91%) rename testing-modules/junit-5/src/test/java/{org/baeldung/java/parameterisedsource => com/baeldung/junit5vstestng}/ParameterizedUnitTest.java (96%) rename testing-modules/junit-5/src/test/java/{org/baeldung/java/parameterisedsource => com/baeldung/junit5vstestng}/PizzaDeliveryStrategy.java (57%) rename testing-modules/junit-5/src/test/java/{org/baeldung/java/suite => com/baeldung/junit5vstestng}/SelectClassesSuiteUnitTest.java (63%) rename testing-modules/junit-5/src/test/java/{org/baeldung/java/suite => com/baeldung/junit5vstestng}/SelectPackagesSuiteUnitTest.java (89%) rename testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/{SummationServiceIntegrationTest.java => SummationServiceUnitTest.java} (96%) diff --git a/testing-modules/junit-5/src/main/java/com/baeldung/throwsexception/Calculator.java b/testing-modules/junit-5/src/main/java/com/baeldung/junit5vstestng/Calculator.java similarity index 85% rename from testing-modules/junit-5/src/main/java/com/baeldung/throwsexception/Calculator.java rename to testing-modules/junit-5/src/main/java/com/baeldung/junit5vstestng/Calculator.java index 50dbc9c774..4ff303c031 100644 --- a/testing-modules/junit-5/src/main/java/com/baeldung/throwsexception/Calculator.java +++ b/testing-modules/junit-5/src/main/java/com/baeldung/junit5vstestng/Calculator.java @@ -1,4 +1,4 @@ -package com.baeldung.throwsexception; +package com.baeldung.junit5vstestng; public class Calculator { diff --git a/testing-modules/junit-5/src/main/java/com/baeldung/throwsexception/DivideByZeroException.java b/testing-modules/junit-5/src/main/java/com/baeldung/junit5vstestng/DivideByZeroException.java similarity index 79% rename from testing-modules/junit-5/src/main/java/com/baeldung/throwsexception/DivideByZeroException.java rename to testing-modules/junit-5/src/main/java/com/baeldung/junit5vstestng/DivideByZeroException.java index 4413374c99..4523f46590 100644 --- a/testing-modules/junit-5/src/main/java/com/baeldung/throwsexception/DivideByZeroException.java +++ b/testing-modules/junit-5/src/main/java/com/baeldung/junit5vstestng/DivideByZeroException.java @@ -1,4 +1,4 @@ -package com.baeldung.throwsexception; +package com.baeldung.junit5vstestng; public class DivideByZeroException extends RuntimeException { diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/throwsexception/CalculatorUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/CalculatorUnitTest.java similarity index 90% rename from testing-modules/junit-5/src/test/java/com/baeldung/throwsexception/CalculatorUnitTest.java rename to testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/CalculatorUnitTest.java index ef838ed304..c563b01603 100644 --- a/testing-modules/junit-5/src/test/java/com/baeldung/throwsexception/CalculatorUnitTest.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/CalculatorUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.throwsexception; +package com.baeldung.junit5vstestng; import org.junit.Test; diff --git a/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/childpackage1/Class1UnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/Class1UnitTest.java similarity index 81% rename from testing-modules/junit-5/src/test/java/org/baeldung/java/suite/childpackage1/Class1UnitTest.java rename to testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/Class1UnitTest.java index 78469cb971..09c2b9108b 100644 --- a/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/childpackage1/Class1UnitTest.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/Class1UnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.java.suite.childpackage1; +package com.baeldung.junit5vstestng; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/childpackage2/Class2UnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/Class2UnitTest.java similarity index 81% rename from testing-modules/junit-5/src/test/java/org/baeldung/java/suite/childpackage2/Class2UnitTest.java rename to testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/Class2UnitTest.java index 4463ecfad9..184ecafa1b 100644 --- a/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/childpackage2/Class2UnitTest.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/Class2UnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.java.suite.childpackage2; +package com.baeldung.junit5vstestng; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/testing-modules/junit-5/src/test/java/org/baeldung/java/customtestname/CustomNameUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/CustomNameUnitTest.java similarity index 91% rename from testing-modules/junit-5/src/test/java/org/baeldung/java/customtestname/CustomNameUnitTest.java rename to testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/CustomNameUnitTest.java index f04b825c89..9cf03ad3de 100644 --- a/testing-modules/junit-5/src/test/java/org/baeldung/java/customtestname/CustomNameUnitTest.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/CustomNameUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.java.customtestname; +package com.baeldung.junit5vstestng; import static org.junit.Assert.assertNotNull; diff --git a/testing-modules/junit-5/src/test/java/org/baeldung/java/parameterisedsource/ParameterizedUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/ParameterizedUnitTest.java similarity index 96% rename from testing-modules/junit-5/src/test/java/org/baeldung/java/parameterisedsource/ParameterizedUnitTest.java rename to testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/ParameterizedUnitTest.java index 8d09161176..b5560650c4 100644 --- a/testing-modules/junit-5/src/test/java/org/baeldung/java/parameterisedsource/ParameterizedUnitTest.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/ParameterizedUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.java.parameterisedsource; +package com.baeldung.junit5vstestng; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; diff --git a/testing-modules/junit-5/src/test/java/org/baeldung/java/parameterisedsource/PizzaDeliveryStrategy.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/PizzaDeliveryStrategy.java similarity index 57% rename from testing-modules/junit-5/src/test/java/org/baeldung/java/parameterisedsource/PizzaDeliveryStrategy.java rename to testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/PizzaDeliveryStrategy.java index ecfc7b4627..7f0a0ffa20 100644 --- a/testing-modules/junit-5/src/test/java/org/baeldung/java/parameterisedsource/PizzaDeliveryStrategy.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/PizzaDeliveryStrategy.java @@ -1,4 +1,4 @@ -package org.baeldung.java.parameterisedsource; +package com.baeldung.junit5vstestng; public enum PizzaDeliveryStrategy { EXPRESS, diff --git a/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/SelectClassesSuiteUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SelectClassesSuiteUnitTest.java similarity index 63% rename from testing-modules/junit-5/src/test/java/org/baeldung/java/suite/SelectClassesSuiteUnitTest.java rename to testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SelectClassesSuiteUnitTest.java index 220897eae7..7b4bd746bf 100644 --- a/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/SelectClassesSuiteUnitTest.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SelectClassesSuiteUnitTest.java @@ -1,7 +1,5 @@ -package org.baeldung.java.suite; +package com.baeldung.junit5vstestng; -import org.baeldung.java.suite.childpackage1.Class1UnitTest; -import org.baeldung.java.suite.childpackage2.Class2UnitTest; import org.junit.platform.runner.JUnitPlatform; import org.junit.platform.suite.api.SelectClasses; import org.junit.runner.RunWith; diff --git a/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/SelectPackagesSuiteUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SelectPackagesSuiteUnitTest.java similarity index 89% rename from testing-modules/junit-5/src/test/java/org/baeldung/java/suite/SelectPackagesSuiteUnitTest.java rename to testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SelectPackagesSuiteUnitTest.java index ae887ae43b..8f2eb2b5c5 100644 --- a/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/SelectPackagesSuiteUnitTest.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SelectPackagesSuiteUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.java.suite; +package com.baeldung.junit5vstestng; import org.junit.platform.runner.JUnitPlatform; import org.junit.platform.suite.api.SelectPackages; diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SummationServiceIntegrationTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SummationServiceUnitTest.java similarity index 96% rename from testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SummationServiceIntegrationTest.java rename to testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SummationServiceUnitTest.java index 92e7a6f5db..a8c02e9968 100644 --- a/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SummationServiceIntegrationTest.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SummationServiceUnitTest.java @@ -11,7 +11,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class SummationServiceIntegrationTest { +public class SummationServiceUnitTest { private static List numbers; @BeforeAll From 2db4d4091e50024d9ae8e4280387858aa7245da3 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 14 Oct 2018 22:44:56 +0300 Subject: [PATCH 36/87] modify link --- core-java/README.md | 1 - testing-modules/junit-5/README.md | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java/README.md b/core-java/README.md index 9e38dfc47d..c0c3c5c0b9 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -29,7 +29,6 @@ - [AWS Lambda With Java](http://www.baeldung.com/java-aws-lambda) - [Introduction to Nashorn](http://www.baeldung.com/java-nashorn) - [Chained Exceptions in Java](http://www.baeldung.com/java-chained-exceptions) -- [A Quick JUnit vs TestNG Comparison](http://www.baeldung.com/junit-vs-testng) - [Java Primitive Conversions](http://www.baeldung.com/java-primitive-conversions) - [Java Money and the Currency API](http://www.baeldung.com/java-money-and-currency) - [JVM Log Forging](http://www.baeldung.com/jvm-log-forging) diff --git a/testing-modules/junit-5/README.md b/testing-modules/junit-5/README.md index 836848282b..1fbd7a4a5e 100644 --- a/testing-modules/junit-5/README.md +++ b/testing-modules/junit-5/README.md @@ -15,3 +15,4 @@ - [The Order of Tests in JUnit](http://www.baeldung.com/junit-5-test-order) - [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) From 6d79649b5610243216333224222bb88ce9cf6d50 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Mon, 15 Oct 2018 01:32:54 +0530 Subject: [PATCH 37/87] [BAEL-9547] - Splitted guava module and introduced guava-collections module --- guava-collections/.gitignore | 13 ++++ guava-collections/README.md | 20 ++++++ guava-collections/pom.xml | 66 ++++++++++++++++++ .../src/main/resources/logback.xml | 19 +++++ .../baeldung/guava/EvictingQueueUnitTest.java | 0 .../guava/GuavaCollectionTypesUnitTest.java | 0 .../GuavaCollectionsExamplesUnitTest.java | 0 ...avaFilterTransformCollectionsUnitTest.java | 0 .../org/baeldung/guava/GuavaMapFromSet.java | 0 .../guava/GuavaMapFromSetUnitTest.java | 0 .../guava/GuavaMapInitializeUnitTest.java | 0 .../baeldung/guava/GuavaMultiMapUnitTest.java | 0 .../guava/GuavaOrderingExamplesUnitTest.java | 0 .../baeldung/guava/GuavaOrderingUnitTest.java | 0 .../baeldung/guava/GuavaRangeMapUnitTest.java | 0 .../baeldung/guava/GuavaRangeSetUnitTest.java | 0 .../baeldung/guava/GuavaStringUnitTest.java | 0 .../guava/MinMaxPriorityQueueUnitTest.java | 0 .../hamcrest/HamcrestExamplesUnitTest.java | 0 .../CollectionApachePartitionUnitTest.java | 0 .../CollectionGuavaPartitionUnitTest.java | 0 .../java/CollectionJavaPartitionUnitTest.java | 0 .../src/test/resources/.gitignore | 13 ++++ guava-collections/src/test/resources/test.out | 1 + guava-collections/src/test/resources/test1.in | 1 + .../src/test/resources/test1_1.in | 1 + guava-collections/src/test/resources/test2.in | 4 ++ .../src/test/resources/test_copy.in | 1 + .../src/test/resources/test_le.txt | Bin 0 -> 4 bytes guava/README.md | 14 ---- guava/pom.xml | 7 -- pom.xml | 2 + 32 files changed, 141 insertions(+), 21 deletions(-) create mode 100644 guava-collections/.gitignore create mode 100644 guava-collections/README.md create mode 100644 guava-collections/pom.xml create mode 100644 guava-collections/src/main/resources/logback.xml rename {guava => guava-collections}/src/test/java/org/baeldung/guava/EvictingQueueUnitTest.java (100%) rename {guava => guava-collections}/src/test/java/org/baeldung/guava/GuavaCollectionTypesUnitTest.java (100%) rename {guava => guava-collections}/src/test/java/org/baeldung/guava/GuavaCollectionsExamplesUnitTest.java (100%) rename {guava => guava-collections}/src/test/java/org/baeldung/guava/GuavaFilterTransformCollectionsUnitTest.java (100%) rename {guava => guava-collections}/src/test/java/org/baeldung/guava/GuavaMapFromSet.java (100%) rename {guava => guava-collections}/src/test/java/org/baeldung/guava/GuavaMapFromSetUnitTest.java (100%) rename {guava => guava-collections}/src/test/java/org/baeldung/guava/GuavaMapInitializeUnitTest.java (100%) rename {guava => guava-collections}/src/test/java/org/baeldung/guava/GuavaMultiMapUnitTest.java (100%) rename {guava => guava-collections}/src/test/java/org/baeldung/guava/GuavaOrderingExamplesUnitTest.java (100%) rename {guava => guava-collections}/src/test/java/org/baeldung/guava/GuavaOrderingUnitTest.java (100%) rename {guava => guava-collections}/src/test/java/org/baeldung/guava/GuavaRangeMapUnitTest.java (100%) rename {guava => guava-collections}/src/test/java/org/baeldung/guava/GuavaRangeSetUnitTest.java (100%) rename {guava => guava-collections}/src/test/java/org/baeldung/guava/GuavaStringUnitTest.java (100%) rename {guava => guava-collections}/src/test/java/org/baeldung/guava/MinMaxPriorityQueueUnitTest.java (100%) rename {guava => guava-collections}/src/test/java/org/baeldung/hamcrest/HamcrestExamplesUnitTest.java (100%) rename {guava => guava-collections}/src/test/java/org/baeldung/java/CollectionApachePartitionUnitTest.java (100%) rename {guava => guava-collections}/src/test/java/org/baeldung/java/CollectionGuavaPartitionUnitTest.java (100%) rename {guava => guava-collections}/src/test/java/org/baeldung/java/CollectionJavaPartitionUnitTest.java (100%) create mode 100644 guava-collections/src/test/resources/.gitignore create mode 100644 guava-collections/src/test/resources/test.out create mode 100644 guava-collections/src/test/resources/test1.in create mode 100644 guava-collections/src/test/resources/test1_1.in create mode 100644 guava-collections/src/test/resources/test2.in create mode 100644 guava-collections/src/test/resources/test_copy.in create mode 100644 guava-collections/src/test/resources/test_le.txt diff --git a/guava-collections/.gitignore b/guava-collections/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/guava-collections/.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/guava-collections/README.md b/guava-collections/README.md new file mode 100644 index 0000000000..eb1eb1d35c --- /dev/null +++ b/guava-collections/README.md @@ -0,0 +1,20 @@ +========= + +## Guava and Hamcrest Cookbooks and Examples + + +### Relevant Articles: +- [Guava Collections Cookbook](http://www.baeldung.com/guava-collections) +- [Guava Ordering Cookbook](http://www.baeldung.com/guava-order) +- [Hamcrest Collections Cookbook](http://www.baeldung.com/hamcrest-collections-arrays) +- [Partition a List in Java](http://www.baeldung.com/java-list-split) +- [Filtering and Transforming Collections in Guava](http://www.baeldung.com/guava-filter-and-transform-a-collection) +- [Guava – Join and Split Collections](http://www.baeldung.com/guava-joiner-and-splitter-tutorial) +- [Guava – Lists](http://www.baeldung.com/guava-lists) +- [Guava – Sets](http://www.baeldung.com/guava-sets) +- [Guava – Maps](http://www.baeldung.com/guava-maps) +- [Guide to Guava Multimap](http://www.baeldung.com/guava-multimap) +- [Guide to Guava RangeSet](http://www.baeldung.com/guava-rangeset) +- [Guide to Guava RangeMap](http://www.baeldung.com/guava-rangemap) +- [Guide to Guava MinMaxPriorityQueue and EvictingQueue](http://www.baeldung.com/guava-minmax-priority-queue-and-evicting-queue) +- [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap) \ No newline at end of file diff --git a/guava-collections/pom.xml b/guava-collections/pom.xml new file mode 100644 index 0000000000..a717023156 --- /dev/null +++ b/guava-collections/pom.xml @@ -0,0 +1,66 @@ + + 4.0.0 + com.baeldung + guava-collections + 0.1.0-SNAPSHOT + guava-collections + + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../parent-java + + + + + + org.apache.commons + commons-collections4 + ${commons-collections4.version} + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + + + org.assertj + assertj-core + ${assertj.version} + test + + + + + org.hamcrest + java-hamcrest + ${java-hamcrest.version} + test + + + + + guava + + + src/main/resources + true + + + + + + + 24.0-jre + 3.5 + 4.1 + + + 3.6.1 + 2.0.0.0 + + + \ No newline at end of file diff --git a/guava-collections/src/main/resources/logback.xml b/guava-collections/src/main/resources/logback.xml new file mode 100644 index 0000000000..56af2d397e --- /dev/null +++ b/guava-collections/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/guava/src/test/java/org/baeldung/guava/EvictingQueueUnitTest.java b/guava-collections/src/test/java/org/baeldung/guava/EvictingQueueUnitTest.java similarity index 100% rename from guava/src/test/java/org/baeldung/guava/EvictingQueueUnitTest.java rename to guava-collections/src/test/java/org/baeldung/guava/EvictingQueueUnitTest.java diff --git a/guava/src/test/java/org/baeldung/guava/GuavaCollectionTypesUnitTest.java b/guava-collections/src/test/java/org/baeldung/guava/GuavaCollectionTypesUnitTest.java similarity index 100% rename from guava/src/test/java/org/baeldung/guava/GuavaCollectionTypesUnitTest.java rename to guava-collections/src/test/java/org/baeldung/guava/GuavaCollectionTypesUnitTest.java diff --git a/guava/src/test/java/org/baeldung/guava/GuavaCollectionsExamplesUnitTest.java b/guava-collections/src/test/java/org/baeldung/guava/GuavaCollectionsExamplesUnitTest.java similarity index 100% rename from guava/src/test/java/org/baeldung/guava/GuavaCollectionsExamplesUnitTest.java rename to guava-collections/src/test/java/org/baeldung/guava/GuavaCollectionsExamplesUnitTest.java diff --git a/guava/src/test/java/org/baeldung/guava/GuavaFilterTransformCollectionsUnitTest.java b/guava-collections/src/test/java/org/baeldung/guava/GuavaFilterTransformCollectionsUnitTest.java similarity index 100% rename from guava/src/test/java/org/baeldung/guava/GuavaFilterTransformCollectionsUnitTest.java rename to guava-collections/src/test/java/org/baeldung/guava/GuavaFilterTransformCollectionsUnitTest.java diff --git a/guava/src/test/java/org/baeldung/guava/GuavaMapFromSet.java b/guava-collections/src/test/java/org/baeldung/guava/GuavaMapFromSet.java similarity index 100% rename from guava/src/test/java/org/baeldung/guava/GuavaMapFromSet.java rename to guava-collections/src/test/java/org/baeldung/guava/GuavaMapFromSet.java diff --git a/guava/src/test/java/org/baeldung/guava/GuavaMapFromSetUnitTest.java b/guava-collections/src/test/java/org/baeldung/guava/GuavaMapFromSetUnitTest.java similarity index 100% rename from guava/src/test/java/org/baeldung/guava/GuavaMapFromSetUnitTest.java rename to guava-collections/src/test/java/org/baeldung/guava/GuavaMapFromSetUnitTest.java diff --git a/guava/src/test/java/org/baeldung/guava/GuavaMapInitializeUnitTest.java b/guava-collections/src/test/java/org/baeldung/guava/GuavaMapInitializeUnitTest.java similarity index 100% rename from guava/src/test/java/org/baeldung/guava/GuavaMapInitializeUnitTest.java rename to guava-collections/src/test/java/org/baeldung/guava/GuavaMapInitializeUnitTest.java diff --git a/guava/src/test/java/org/baeldung/guava/GuavaMultiMapUnitTest.java b/guava-collections/src/test/java/org/baeldung/guava/GuavaMultiMapUnitTest.java similarity index 100% rename from guava/src/test/java/org/baeldung/guava/GuavaMultiMapUnitTest.java rename to guava-collections/src/test/java/org/baeldung/guava/GuavaMultiMapUnitTest.java diff --git a/guava/src/test/java/org/baeldung/guava/GuavaOrderingExamplesUnitTest.java b/guava-collections/src/test/java/org/baeldung/guava/GuavaOrderingExamplesUnitTest.java similarity index 100% rename from guava/src/test/java/org/baeldung/guava/GuavaOrderingExamplesUnitTest.java rename to guava-collections/src/test/java/org/baeldung/guava/GuavaOrderingExamplesUnitTest.java diff --git a/guava/src/test/java/org/baeldung/guava/GuavaOrderingUnitTest.java b/guava-collections/src/test/java/org/baeldung/guava/GuavaOrderingUnitTest.java similarity index 100% rename from guava/src/test/java/org/baeldung/guava/GuavaOrderingUnitTest.java rename to guava-collections/src/test/java/org/baeldung/guava/GuavaOrderingUnitTest.java diff --git a/guava/src/test/java/org/baeldung/guava/GuavaRangeMapUnitTest.java b/guava-collections/src/test/java/org/baeldung/guava/GuavaRangeMapUnitTest.java similarity index 100% rename from guava/src/test/java/org/baeldung/guava/GuavaRangeMapUnitTest.java rename to guava-collections/src/test/java/org/baeldung/guava/GuavaRangeMapUnitTest.java diff --git a/guava/src/test/java/org/baeldung/guava/GuavaRangeSetUnitTest.java b/guava-collections/src/test/java/org/baeldung/guava/GuavaRangeSetUnitTest.java similarity index 100% rename from guava/src/test/java/org/baeldung/guava/GuavaRangeSetUnitTest.java rename to guava-collections/src/test/java/org/baeldung/guava/GuavaRangeSetUnitTest.java diff --git a/guava/src/test/java/org/baeldung/guava/GuavaStringUnitTest.java b/guava-collections/src/test/java/org/baeldung/guava/GuavaStringUnitTest.java similarity index 100% rename from guava/src/test/java/org/baeldung/guava/GuavaStringUnitTest.java rename to guava-collections/src/test/java/org/baeldung/guava/GuavaStringUnitTest.java diff --git a/guava/src/test/java/org/baeldung/guava/MinMaxPriorityQueueUnitTest.java b/guava-collections/src/test/java/org/baeldung/guava/MinMaxPriorityQueueUnitTest.java similarity index 100% rename from guava/src/test/java/org/baeldung/guava/MinMaxPriorityQueueUnitTest.java rename to guava-collections/src/test/java/org/baeldung/guava/MinMaxPriorityQueueUnitTest.java diff --git a/guava/src/test/java/org/baeldung/hamcrest/HamcrestExamplesUnitTest.java b/guava-collections/src/test/java/org/baeldung/hamcrest/HamcrestExamplesUnitTest.java similarity index 100% rename from guava/src/test/java/org/baeldung/hamcrest/HamcrestExamplesUnitTest.java rename to guava-collections/src/test/java/org/baeldung/hamcrest/HamcrestExamplesUnitTest.java diff --git a/guava/src/test/java/org/baeldung/java/CollectionApachePartitionUnitTest.java b/guava-collections/src/test/java/org/baeldung/java/CollectionApachePartitionUnitTest.java similarity index 100% rename from guava/src/test/java/org/baeldung/java/CollectionApachePartitionUnitTest.java rename to guava-collections/src/test/java/org/baeldung/java/CollectionApachePartitionUnitTest.java diff --git a/guava/src/test/java/org/baeldung/java/CollectionGuavaPartitionUnitTest.java b/guava-collections/src/test/java/org/baeldung/java/CollectionGuavaPartitionUnitTest.java similarity index 100% rename from guava/src/test/java/org/baeldung/java/CollectionGuavaPartitionUnitTest.java rename to guava-collections/src/test/java/org/baeldung/java/CollectionGuavaPartitionUnitTest.java diff --git a/guava/src/test/java/org/baeldung/java/CollectionJavaPartitionUnitTest.java b/guava-collections/src/test/java/org/baeldung/java/CollectionJavaPartitionUnitTest.java similarity index 100% rename from guava/src/test/java/org/baeldung/java/CollectionJavaPartitionUnitTest.java rename to guava-collections/src/test/java/org/baeldung/java/CollectionJavaPartitionUnitTest.java diff --git a/guava-collections/src/test/resources/.gitignore b/guava-collections/src/test/resources/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/guava-collections/src/test/resources/.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/guava-collections/src/test/resources/test.out b/guava-collections/src/test/resources/test.out new file mode 100644 index 0000000000..7a79da3803 --- /dev/null +++ b/guava-collections/src/test/resources/test.out @@ -0,0 +1 @@ +John Jane Adam Tom \ No newline at end of file diff --git a/guava-collections/src/test/resources/test1.in b/guava-collections/src/test/resources/test1.in new file mode 100644 index 0000000000..70c379b63f --- /dev/null +++ b/guava-collections/src/test/resources/test1.in @@ -0,0 +1 @@ +Hello world \ No newline at end of file diff --git a/guava-collections/src/test/resources/test1_1.in b/guava-collections/src/test/resources/test1_1.in new file mode 100644 index 0000000000..8318c86b35 --- /dev/null +++ b/guava-collections/src/test/resources/test1_1.in @@ -0,0 +1 @@ +Test \ No newline at end of file diff --git a/guava-collections/src/test/resources/test2.in b/guava-collections/src/test/resources/test2.in new file mode 100644 index 0000000000..622efea9e6 --- /dev/null +++ b/guava-collections/src/test/resources/test2.in @@ -0,0 +1,4 @@ +John +Jane +Adam +Tom \ No newline at end of file diff --git a/guava-collections/src/test/resources/test_copy.in b/guava-collections/src/test/resources/test_copy.in new file mode 100644 index 0000000000..70c379b63f --- /dev/null +++ b/guava-collections/src/test/resources/test_copy.in @@ -0,0 +1 @@ +Hello world \ No newline at end of file diff --git a/guava-collections/src/test/resources/test_le.txt b/guava-collections/src/test/resources/test_le.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7cc484bf45e18b3fe4dea78290abf122bedbad1 GIT binary patch literal 4 LcmYdcU|;|M0h9n` literal 0 HcmV?d00001 diff --git a/guava/README.md b/guava/README.md index fe1a347d72..7501bf08de 100644 --- a/guava/README.md +++ b/guava/README.md @@ -4,33 +4,19 @@ ### Relevant Articles: -- [Guava Collections Cookbook](http://www.baeldung.com/guava-collections) -- [Guava Ordering Cookbook](http://www.baeldung.com/guava-order) - [Guava Functional Cookbook](http://www.baeldung.com/guava-functions-predicates) -- [Hamcrest Collections Cookbook](http://www.baeldung.com/hamcrest-collections-arrays) -- [Partition a List in Java](http://www.baeldung.com/java-list-split) -- [Filtering and Transforming Collections in Guava](http://www.baeldung.com/guava-filter-and-transform-a-collection) -- [Guava – Join and Split Collections](http://www.baeldung.com/guava-joiner-and-splitter-tutorial) - [Guava – Write to File, Read from File](http://www.baeldung.com/guava-write-to-file-read-from-file) -- [Guava – Lists](http://www.baeldung.com/guava-lists) -- [Guava – Sets](http://www.baeldung.com/guava-sets) -- [Guava – Maps](http://www.baeldung.com/guava-maps) - [Guava Set + Function = Map](http://www.baeldung.com/guava-set-function-map-tutorial) - [Guide to Guava’s Ordering](http://www.baeldung.com/guava-ordering) - [Guide to Guava’s PreConditions](http://www.baeldung.com/guava-preconditions) - [Introduction to Guava CacheLoader](http://www.baeldung.com/guava-cacheloader) - [Introduction to Guava Memoizer](http://www.baeldung.com/guava-memoizer) - [Guide to Guava’s EventBus](http://www.baeldung.com/guava-eventbus) -- [Guide to Guava Multimap](http://www.baeldung.com/guava-multimap) -- [Guide to Guava RangeSet](http://www.baeldung.com/guava-rangeset) -- [Guide to Guava RangeMap](http://www.baeldung.com/guava-rangemap) - [Guide to Guava Table](http://www.baeldung.com/guava-table) - [Guide to Guava’s Reflection Utilities](http://www.baeldung.com/guava-reflection) - [Guide to Guava ClassToInstanceMap](http://www.baeldung.com/guava-class-to-instance-map) -- [Guide to Guava MinMaxPriorityQueue and EvictingQueue](http://www.baeldung.com/guava-minmax-priority-queue-and-evicting-queue) - [Guide to Mathematical Utilities in Guava](http://www.baeldung.com/guava-math) - [Bloom Filter in Java using Guava](http://www.baeldung.com/guava-bloom-filter) - [Using Guava CountingOutputStream](http://www.baeldung.com/guava-counting-outputstream) - [Hamcrest Text Matchers](http://www.baeldung.com/hamcrest-text-matchers) - [Quick Guide to the Guava RateLimiter](http://www.baeldung.com/guava-rate-limiter) -- [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap) diff --git a/guava/pom.xml b/guava/pom.xml index 60678608dd..1d37a79ab6 100644 --- a/guava/pom.xml +++ b/guava/pom.xml @@ -14,12 +14,6 @@ - - - org.apache.commons - commons-collections4 - ${commons-collections4.version} - org.apache.commons commons-lang3 @@ -56,7 +50,6 @@ 24.0-jre 3.5 - 4.1 3.6.1 diff --git a/pom.xml b/pom.xml index 28a6dd358e..d48ec6b7cb 100644 --- a/pom.xml +++ b/pom.xml @@ -372,6 +372,7 @@ google-web-toolkit gson guava + guava-collections guava-modules/guava-18 guava-modules/guava-19 guava-modules/guava-21 @@ -1279,6 +1280,7 @@ google-cloud gson guava + guava-collections guava-modules/guava-18 guava-modules/guava-19 guava-modules/guava-21 From c882fa6e54cc7467caea98c2eeaaf16f1c58ae97 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 14 Oct 2018 23:40:39 +0300 Subject: [PATCH 38/87] fix boot logging modules --- pom.xml | 3 + spring-boot-disable-console-logging/README.md | 2 + .../disabling-console-jul/pom.xml | 8 ++- .../properties/DisablingConsoleJulApp.java | 0 .../DisabledConsoleRestController.java | 0 .../src/main/resources/application.properties | 0 .../src/main/resources/logging.properties | 0 .../disabling-console-log4j2/pom.xml | 8 ++- .../log4j2/xml/DisablingConsoleLog4j2App.java | 0 .../DisabledConsoleRestController.java | 0 .../src/main/resources/log4j2.xml | 0 .../disabling-console-logback/pom.xml | 10 +++- .../xml/DisablingConsoleLogbackApp.java | 0 .../DisabledConsoleRestController.java | 0 .../src/main/resources/application.properties | 0 .../src/main/resources/logback-spring.xml | 0 .../pom.xml | 5 +- spring-boot-logging-log4j2/README.md | 1 - spring-boot-logging-log4j2/pom.xml | 57 ++++++++++++------- .../spring-boot-logging-log4j2-app/pom.xml | 33 ----------- .../springbootlogging/LoggingController.java | 2 +- .../SpringBootLoggingApplication.java | 0 .../src/main/resources/application.properties | 0 .../src/main/resources/log4j2-spring.xml | 0 .../SpringContextIntegrationTest.java | 0 25 files changed, 65 insertions(+), 64 deletions(-) create mode 100644 spring-boot-disable-console-logging/README.md rename {spring-boot-logging-log4j2/disabling-console-logging => spring-boot-disable-console-logging}/disabling-console-jul/pom.xml (85%) rename {spring-boot-logging-log4j2/disabling-console-logging => spring-boot-disable-console-logging}/disabling-console-jul/src/main/java/com/baeldung/springbootlogging/disablingconsole/jul/properties/DisablingConsoleJulApp.java (100%) rename {spring-boot-logging-log4j2/disabling-console-logging => spring-boot-disable-console-logging}/disabling-console-jul/src/main/java/com/baeldung/springbootlogging/disablingconsole/jul/properties/controllers/DisabledConsoleRestController.java (100%) rename {spring-boot-logging-log4j2/disabling-console-logging => spring-boot-disable-console-logging}/disabling-console-jul/src/main/resources/application.properties (100%) rename {spring-boot-logging-log4j2/disabling-console-logging => spring-boot-disable-console-logging}/disabling-console-jul/src/main/resources/logging.properties (100%) rename {spring-boot-logging-log4j2/disabling-console-logging => spring-boot-disable-console-logging}/disabling-console-log4j2/pom.xml (81%) rename {spring-boot-logging-log4j2/disabling-console-logging => spring-boot-disable-console-logging}/disabling-console-log4j2/src/main/java/com/baeldung/springbootlogging/disablingconsole/log4j2/xml/DisablingConsoleLog4j2App.java (100%) rename {spring-boot-logging-log4j2/disabling-console-logging => spring-boot-disable-console-logging}/disabling-console-log4j2/src/main/java/com/baeldung/springbootlogging/disablingconsole/log4j2/xml/controllers/DisabledConsoleRestController.java (100%) rename {spring-boot-logging-log4j2/disabling-console-logging => spring-boot-disable-console-logging}/disabling-console-log4j2/src/main/resources/log4j2.xml (100%) rename {spring-boot-logging-log4j2/disabling-console-logging => spring-boot-disable-console-logging}/disabling-console-logback/pom.xml (61%) rename {spring-boot-logging-log4j2/disabling-console-logging => spring-boot-disable-console-logging}/disabling-console-logback/src/main/java/com/baeldung/springbootlogging/disablingconsole/logback/xml/DisablingConsoleLogbackApp.java (100%) rename {spring-boot-logging-log4j2/disabling-console-logging => spring-boot-disable-console-logging}/disabling-console-logback/src/main/java/com/baeldung/springbootlogging/disablingconsole/logback/xml/controllers/DisabledConsoleRestController.java (100%) rename {spring-boot-logging-log4j2/disabling-console-logging => spring-boot-disable-console-logging}/disabling-console-logback/src/main/resources/application.properties (100%) rename {spring-boot-logging-log4j2/disabling-console-logging => spring-boot-disable-console-logging}/disabling-console-logback/src/main/resources/logback-spring.xml (100%) rename {spring-boot-logging-log4j2/disabling-console-logging => spring-boot-disable-console-logging}/pom.xml (78%) delete mode 100644 spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/pom.xml rename spring-boot-logging-log4j2/{spring-boot-logging-log4j2-app => }/src/main/java/com/baeldung/springbootlogging/LoggingController.java (97%) rename spring-boot-logging-log4j2/{spring-boot-logging-log4j2-app => }/src/main/java/com/baeldung/springbootlogging/SpringBootLoggingApplication.java (100%) rename spring-boot-logging-log4j2/{spring-boot-logging-log4j2-app => }/src/main/resources/application.properties (100%) rename spring-boot-logging-log4j2/{spring-boot-logging-log4j2-app => }/src/main/resources/log4j2-spring.xml (100%) rename spring-boot-logging-log4j2/{spring-boot-logging-log4j2-app => }/src/test/java/org/baeldung/SpringContextIntegrationTest.java (100%) diff --git a/pom.xml b/pom.xml index da1733d2b2..6900f902aa 100644 --- a/pom.xml +++ b/pom.xml @@ -482,6 +482,7 @@ spring-boot-mvc spring-boot-vue spring-boot-logging-log4j2 + spring-boot-disable-console-logging spring-cloud-data-flow spring-cloud spring-cloud-bus @@ -1024,6 +1025,7 @@ spring-boot-security spring-boot-mvc spring-boot-logging-log4j2 + spring-boot-disable-console-logging spring-cloud-data-flow spring-cloud spring-cloud-bus @@ -1379,6 +1381,7 @@ spring-boot-security spring-boot-mvc spring-boot-logging-log4j2 + spring-boot-disable-console-logging spring-cloud-data-flow spring-cloud spring-cloud-bus diff --git a/spring-boot-disable-console-logging/README.md b/spring-boot-disable-console-logging/README.md new file mode 100644 index 0000000000..7676bd1919 --- /dev/null +++ b/spring-boot-disable-console-logging/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Logging in Spring Boot](http://www.baeldung.com/spring-boot-logging) diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-jul/pom.xml b/spring-boot-disable-console-logging/disabling-console-jul/pom.xml similarity index 85% rename from spring-boot-logging-log4j2/disabling-console-logging/disabling-console-jul/pom.xml rename to spring-boot-disable-console-logging/disabling-console-jul/pom.xml index c3bad74352..ceac0616e9 100644 --- a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-jul/pom.xml +++ b/spring-boot-disable-console-logging/disabling-console-jul/pom.xml @@ -3,10 +3,12 @@ 4.0.0 disabling-console-jul + + - com.baeldung - disabling-console-logging - 0.0.1-SNAPSHOT + org.springframework.boot + spring-boot-starter-parent + 2.0.5.RELEASE diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-jul/src/main/java/com/baeldung/springbootlogging/disablingconsole/jul/properties/DisablingConsoleJulApp.java b/spring-boot-disable-console-logging/disabling-console-jul/src/main/java/com/baeldung/springbootlogging/disablingconsole/jul/properties/DisablingConsoleJulApp.java similarity index 100% rename from spring-boot-logging-log4j2/disabling-console-logging/disabling-console-jul/src/main/java/com/baeldung/springbootlogging/disablingconsole/jul/properties/DisablingConsoleJulApp.java rename to spring-boot-disable-console-logging/disabling-console-jul/src/main/java/com/baeldung/springbootlogging/disablingconsole/jul/properties/DisablingConsoleJulApp.java diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-jul/src/main/java/com/baeldung/springbootlogging/disablingconsole/jul/properties/controllers/DisabledConsoleRestController.java b/spring-boot-disable-console-logging/disabling-console-jul/src/main/java/com/baeldung/springbootlogging/disablingconsole/jul/properties/controllers/DisabledConsoleRestController.java similarity index 100% rename from spring-boot-logging-log4j2/disabling-console-logging/disabling-console-jul/src/main/java/com/baeldung/springbootlogging/disablingconsole/jul/properties/controllers/DisabledConsoleRestController.java rename to spring-boot-disable-console-logging/disabling-console-jul/src/main/java/com/baeldung/springbootlogging/disablingconsole/jul/properties/controllers/DisabledConsoleRestController.java diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-jul/src/main/resources/application.properties b/spring-boot-disable-console-logging/disabling-console-jul/src/main/resources/application.properties similarity index 100% rename from spring-boot-logging-log4j2/disabling-console-logging/disabling-console-jul/src/main/resources/application.properties rename to spring-boot-disable-console-logging/disabling-console-jul/src/main/resources/application.properties diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-jul/src/main/resources/logging.properties b/spring-boot-disable-console-logging/disabling-console-jul/src/main/resources/logging.properties similarity index 100% rename from spring-boot-logging-log4j2/disabling-console-logging/disabling-console-jul/src/main/resources/logging.properties rename to spring-boot-disable-console-logging/disabling-console-jul/src/main/resources/logging.properties diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-log4j2/pom.xml b/spring-boot-disable-console-logging/disabling-console-log4j2/pom.xml similarity index 81% rename from spring-boot-logging-log4j2/disabling-console-logging/disabling-console-log4j2/pom.xml rename to spring-boot-disable-console-logging/disabling-console-log4j2/pom.xml index f9b34ec7d9..d6e9a8b5e5 100644 --- a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-log4j2/pom.xml +++ b/spring-boot-disable-console-logging/disabling-console-log4j2/pom.xml @@ -3,10 +3,12 @@ 4.0.0 disabling-console-log4j2 + + - com.baeldung - disabling-console-logging - 0.0.1-SNAPSHOT + org.springframework.boot + spring-boot-starter-parent + 2.0.5.RELEASE diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-log4j2/src/main/java/com/baeldung/springbootlogging/disablingconsole/log4j2/xml/DisablingConsoleLog4j2App.java b/spring-boot-disable-console-logging/disabling-console-log4j2/src/main/java/com/baeldung/springbootlogging/disablingconsole/log4j2/xml/DisablingConsoleLog4j2App.java similarity index 100% rename from spring-boot-logging-log4j2/disabling-console-logging/disabling-console-log4j2/src/main/java/com/baeldung/springbootlogging/disablingconsole/log4j2/xml/DisablingConsoleLog4j2App.java rename to spring-boot-disable-console-logging/disabling-console-log4j2/src/main/java/com/baeldung/springbootlogging/disablingconsole/log4j2/xml/DisablingConsoleLog4j2App.java diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-log4j2/src/main/java/com/baeldung/springbootlogging/disablingconsole/log4j2/xml/controllers/DisabledConsoleRestController.java b/spring-boot-disable-console-logging/disabling-console-log4j2/src/main/java/com/baeldung/springbootlogging/disablingconsole/log4j2/xml/controllers/DisabledConsoleRestController.java similarity index 100% rename from spring-boot-logging-log4j2/disabling-console-logging/disabling-console-log4j2/src/main/java/com/baeldung/springbootlogging/disablingconsole/log4j2/xml/controllers/DisabledConsoleRestController.java rename to spring-boot-disable-console-logging/disabling-console-log4j2/src/main/java/com/baeldung/springbootlogging/disablingconsole/log4j2/xml/controllers/DisabledConsoleRestController.java diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-log4j2/src/main/resources/log4j2.xml b/spring-boot-disable-console-logging/disabling-console-log4j2/src/main/resources/log4j2.xml similarity index 100% rename from spring-boot-logging-log4j2/disabling-console-logging/disabling-console-log4j2/src/main/resources/log4j2.xml rename to spring-boot-disable-console-logging/disabling-console-log4j2/src/main/resources/log4j2.xml diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-logback/pom.xml b/spring-boot-disable-console-logging/disabling-console-logback/pom.xml similarity index 61% rename from spring-boot-logging-log4j2/disabling-console-logging/disabling-console-logback/pom.xml rename to spring-boot-disable-console-logging/disabling-console-logback/pom.xml index 6f2170390b..f18066ea03 100644 --- a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-logback/pom.xml +++ b/spring-boot-disable-console-logging/disabling-console-logback/pom.xml @@ -2,8 +2,16 @@ 4.0.0 com.baeldung - disabling-console-logging + spring-boot-disable-console-logging 0.0.1-SNAPSHOT disabling-console-logback + + + + org.springframework.boot + spring-boot-starter-web + + + \ No newline at end of file diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-logback/src/main/java/com/baeldung/springbootlogging/disablingconsole/logback/xml/DisablingConsoleLogbackApp.java b/spring-boot-disable-console-logging/disabling-console-logback/src/main/java/com/baeldung/springbootlogging/disablingconsole/logback/xml/DisablingConsoleLogbackApp.java similarity index 100% rename from spring-boot-logging-log4j2/disabling-console-logging/disabling-console-logback/src/main/java/com/baeldung/springbootlogging/disablingconsole/logback/xml/DisablingConsoleLogbackApp.java rename to spring-boot-disable-console-logging/disabling-console-logback/src/main/java/com/baeldung/springbootlogging/disablingconsole/logback/xml/DisablingConsoleLogbackApp.java diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-logback/src/main/java/com/baeldung/springbootlogging/disablingconsole/logback/xml/controllers/DisabledConsoleRestController.java b/spring-boot-disable-console-logging/disabling-console-logback/src/main/java/com/baeldung/springbootlogging/disablingconsole/logback/xml/controllers/DisabledConsoleRestController.java similarity index 100% rename from spring-boot-logging-log4j2/disabling-console-logging/disabling-console-logback/src/main/java/com/baeldung/springbootlogging/disablingconsole/logback/xml/controllers/DisabledConsoleRestController.java rename to spring-boot-disable-console-logging/disabling-console-logback/src/main/java/com/baeldung/springbootlogging/disablingconsole/logback/xml/controllers/DisabledConsoleRestController.java diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-logback/src/main/resources/application.properties b/spring-boot-disable-console-logging/disabling-console-logback/src/main/resources/application.properties similarity index 100% rename from spring-boot-logging-log4j2/disabling-console-logging/disabling-console-logback/src/main/resources/application.properties rename to spring-boot-disable-console-logging/disabling-console-logback/src/main/resources/application.properties diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-logback/src/main/resources/logback-spring.xml b/spring-boot-disable-console-logging/disabling-console-logback/src/main/resources/logback-spring.xml similarity index 100% rename from spring-boot-logging-log4j2/disabling-console-logging/disabling-console-logback/src/main/resources/logback-spring.xml rename to spring-boot-disable-console-logging/disabling-console-logback/src/main/resources/logback-spring.xml diff --git a/spring-boot-logging-log4j2/disabling-console-logging/pom.xml b/spring-boot-disable-console-logging/pom.xml similarity index 78% rename from spring-boot-logging-log4j2/disabling-console-logging/pom.xml rename to spring-boot-disable-console-logging/pom.xml index 39a4a40f12..ec84372f99 100644 --- a/spring-boot-logging-log4j2/disabling-console-logging/pom.xml +++ b/spring-boot-disable-console-logging/pom.xml @@ -1,14 +1,15 @@ 4.0.0 - disabling-console-logging + spring-boot-disable-console-logging pom Projects for Disabling Spring Boot Console Logging tutorials + parent-boot-2 com.baeldung - spring-boot-logging-log4j2 0.0.1-SNAPSHOT + ../parent-boot-2 diff --git a/spring-boot-logging-log4j2/README.md b/spring-boot-logging-log4j2/README.md index 305957ed8d..7676bd1919 100644 --- a/spring-boot-logging-log4j2/README.md +++ b/spring-boot-logging-log4j2/README.md @@ -1,3 +1,2 @@ ### Relevant Articles: - [Logging in Spring Boot](http://www.baeldung.com/spring-boot-logging) -- [How to Disable Console Logging in Spring Boot](https://www.baeldung.com/spring-boot-disable-console-logging) diff --git a/spring-boot-logging-log4j2/pom.xml b/spring-boot-logging-log4j2/pom.xml index 7caf1e8690..7220672eaf 100644 --- a/spring-boot-logging-log4j2/pom.xml +++ b/spring-boot-logging-log4j2/pom.xml @@ -4,41 +4,58 @@ 4.0.0 spring-boot-logging-log4j2 - pom - Projects for Spring Boot Logging tutorials + jar + Demo project for Spring Boot Logging with Log4J2 + + - parent-boot-2 - com.baeldung - 0.0.1-SNAPSHOT - ../parent-boot-2 + spring-boot-starter-parent + org.springframework.boot + 2.0.5.RELEASE org.springframework.boot spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-logging + + - org.springframework.boot spring-boot-starter-test - test + + + org.springframework.boot + spring-boot-starter-log4j2 - - spring-boot-logging-log4j2-app - disabling-console-logging - - - - - org.springframework.boot - spring-boot-maven-plugin - - + + + org.apache.maven.plugins + maven-surefire-plugin + + 3 + true + + **/*IntegrationTest.java + **/*IntTest.java + **/*ManualTest.java + **/*LiveTest.java + + + + - + + + + diff --git a/spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/pom.xml b/spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/pom.xml deleted file mode 100644 index 571794167e..0000000000 --- a/spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - 4.0.0 - - spring-boot-logging-log4j2-app - jar - Demo project for Spring Boot Logging with Log4J2 - - - spring-boot-logging-log4j2 - com.baeldung - 0.0.1-SNAPSHOT - .. - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-logging - - - - - org.springframework.boot - spring-boot-starter-log4j2 - - - diff --git a/spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/main/java/com/baeldung/springbootlogging/LoggingController.java b/spring-boot-logging-log4j2/src/main/java/com/baeldung/springbootlogging/LoggingController.java similarity index 97% rename from spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/main/java/com/baeldung/springbootlogging/LoggingController.java rename to spring-boot-logging-log4j2/src/main/java/com/baeldung/springbootlogging/LoggingController.java index 07763c8c3b..d462926616 100644 --- a/spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/main/java/com/baeldung/springbootlogging/LoggingController.java +++ b/spring-boot-logging-log4j2/src/main/java/com/baeldung/springbootlogging/LoggingController.java @@ -32,6 +32,6 @@ public class LoggingController { loggerNative.warn("This WARN message been printed by Log4j2 without passing through SLF4J"); loggerNative.error("This ERROR message been printed by Log4j2 without passing through SLF4J"); loggerNative.fatal("This FATAL message been printed by Log4j2 without passing through SLF4J"); - return "Howdy! Check out the Logs to see the output printed directly throguh Log4j2..."; + return "Howdy! Check out the Logs to see the output printed directly through Log4j2..."; } } diff --git a/spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/main/java/com/baeldung/springbootlogging/SpringBootLoggingApplication.java b/spring-boot-logging-log4j2/src/main/java/com/baeldung/springbootlogging/SpringBootLoggingApplication.java similarity index 100% rename from spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/main/java/com/baeldung/springbootlogging/SpringBootLoggingApplication.java rename to spring-boot-logging-log4j2/src/main/java/com/baeldung/springbootlogging/SpringBootLoggingApplication.java diff --git a/spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/main/resources/application.properties b/spring-boot-logging-log4j2/src/main/resources/application.properties similarity index 100% rename from spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/main/resources/application.properties rename to spring-boot-logging-log4j2/src/main/resources/application.properties diff --git a/spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/main/resources/log4j2-spring.xml b/spring-boot-logging-log4j2/src/main/resources/log4j2-spring.xml similarity index 100% rename from spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/main/resources/log4j2-spring.xml rename to spring-boot-logging-log4j2/src/main/resources/log4j2-spring.xml diff --git a/spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-logging-log4j2/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 100% rename from spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to spring-boot-logging-log4j2/src/test/java/org/baeldung/SpringContextIntegrationTest.java From 500367de1400deb5c7d47a4ea2bafb72899af939 Mon Sep 17 00:00:00 2001 From: Syed Mansoor Date: Mon, 15 Oct 2018 12:58:06 +1100 Subject: [PATCH 39/87] Removed Gradle --- apache-pulsar/build.gradle | 26 --- .../gradle/wrapper/gradle-wrapper.jar | Bin 54413 -> 0 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 - apache-pulsar/gradlew | 172 ------------------ apache-pulsar/gradlew.bat | 84 --------- apache-pulsar/pom.xml | 21 +++ ...al.java => ExclusiveSubscriptionTest.java} | 2 +- ...ial.java => FailoverSubscriptionTest.java} | 2 +- 8 files changed, 23 insertions(+), 289 deletions(-) delete mode 100755 apache-pulsar/build.gradle delete mode 100755 apache-pulsar/gradle/wrapper/gradle-wrapper.jar delete mode 100755 apache-pulsar/gradle/wrapper/gradle-wrapper.properties delete mode 100755 apache-pulsar/gradlew delete mode 100755 apache-pulsar/gradlew.bat create mode 100644 apache-pulsar/pom.xml rename apache-pulsar/src/main/java/com/baeldung/subscriptions/{ExclusiveSubscriptionTutorial.java => ExclusiveSubscriptionTest.java} (98%) mode change 100755 => 100644 rename apache-pulsar/src/main/java/com/baeldung/subscriptions/{FailoverSubscriptionTutorial.java => FailoverSubscriptionTest.java} (98%) mode change 100755 => 100644 diff --git a/apache-pulsar/build.gradle b/apache-pulsar/build.gradle deleted file mode 100755 index f3545d69b2..0000000000 --- a/apache-pulsar/build.gradle +++ /dev/null @@ -1,26 +0,0 @@ -apply plugin: 'java' -ext{ - pulsarVersion = '2.1.1-incubating' -} - -repositories { - jcenter() - mavenCentral() - mavenLocal() -} - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -group = 'com.baeldung.pulsar' -archivesBaseName = 'pulsar-java-example' -version = '0.0.1' - - - - -dependencies { - compile group: 'org.apache.pulsar', name: 'pulsar-client', version: pulsarVersion - -} - diff --git a/apache-pulsar/gradle/wrapper/gradle-wrapper.jar b/apache-pulsar/gradle/wrapper/gradle-wrapper.jar deleted file mode 100755 index 91ca28c8b802289c3a438766657a5e98f20eff03..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 54413 zcmafaV|Zr4wq`oEZQHiZj%|LijZQlLf{tz5M#r{o+fI6V=G-$g=gzrzeyqLskF}nv zRZs0&c;EUi2L_G~0s;*U0szbK}f6%Pvi zRZ#mYf6f1oqJoH`jHHCB8l!^by~4z}yc`4LEP@;Z?bO6{g9`Hk+s@(L1jC5Tq{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vi`kJmbnPYT%X}rzs0K#=H)Q`)_L7%?KLLJP+0XJbL&JgdJE{i*){MOFSK z{7XUfXZR-Te}aE8RelNkQV0AQ7RC0TVE^o8c!~K^RQ4GY+xed`|A+zjZ(qij@~zLP zkS@Q0`rpM|UsnI6B;_+vw)^iA{n0%C7N~ql@KXNonIOUIHwgYg4Dcn>OOdc=rUl>M zVEQe|u$P=Kb)TL&-2#4t^Pg0pUQ)dj%6O)#3;zwOe~`_1$@Ef`;F+l=>NlAFFbBS0 zN))`LdKnA;OjQ{B+f;z>i|wCv-CmNs46S`8X-oKRl0V+pKZ%XJWO*6G`OMOs^xG_d zj_7-p06{fybw_P;UzX^eX5Pkcrm04%9rPFa56 zyZE \(.*\)$'` - 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/apache-pulsar/gradlew.bat b/apache-pulsar/gradlew.bat deleted file mode 100755 index e95643d6a2..0000000000 --- a/apache-pulsar/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@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/apache-pulsar/pom.xml b/apache-pulsar/pom.xml new file mode 100644 index 0000000000..da004a7638 --- /dev/null +++ b/apache-pulsar/pom.xml @@ -0,0 +1,21 @@ + + + 4.0.0 + com.baeldung.pulsar + pulsar-java + 0.0.1 + + + + org.apache.pulsar + pulsar-client + 2.1.1-incubating + compile + + + + 1.8 + 1.8 + + diff --git a/apache-pulsar/src/main/java/com/baeldung/subscriptions/ExclusiveSubscriptionTutorial.java b/apache-pulsar/src/main/java/com/baeldung/subscriptions/ExclusiveSubscriptionTest.java old mode 100755 new mode 100644 similarity index 98% rename from apache-pulsar/src/main/java/com/baeldung/subscriptions/ExclusiveSubscriptionTutorial.java rename to apache-pulsar/src/main/java/com/baeldung/subscriptions/ExclusiveSubscriptionTest.java index da9ff0974d..efb898eaf4 --- a/apache-pulsar/src/main/java/com/baeldung/subscriptions/ExclusiveSubscriptionTutorial.java +++ b/apache-pulsar/src/main/java/com/baeldung/subscriptions/ExclusiveSubscriptionTest.java @@ -10,7 +10,7 @@ import org.apache.pulsar.client.api.SubscriptionType; import java.util.stream.IntStream; -public class ExclusiveSubscriptionTutorial { +public class ExclusiveSubscriptionTest { private static final String SERVICE_URL = "pulsar://localhost:6650"; private static final String TOPIC_NAME = "test-topic"; private static final String SUBSCRIPTION_NAME = "test-subscription"; diff --git a/apache-pulsar/src/main/java/com/baeldung/subscriptions/FailoverSubscriptionTutorial.java b/apache-pulsar/src/main/java/com/baeldung/subscriptions/FailoverSubscriptionTest.java old mode 100755 new mode 100644 similarity index 98% rename from apache-pulsar/src/main/java/com/baeldung/subscriptions/FailoverSubscriptionTutorial.java rename to apache-pulsar/src/main/java/com/baeldung/subscriptions/FailoverSubscriptionTest.java index 30351c229d..545661e0c3 --- a/apache-pulsar/src/main/java/com/baeldung/subscriptions/FailoverSubscriptionTutorial.java +++ b/apache-pulsar/src/main/java/com/baeldung/subscriptions/FailoverSubscriptionTest.java @@ -11,7 +11,7 @@ import org.apache.pulsar.client.api.SubscriptionType; import java.util.stream.IntStream; -public class FailoverSubscriptionTutorial { +public class FailoverSubscriptionTest { private static final String SERVICE_URL = "pulsar://localhost:6650"; private static final String TOPIC_NAME = "failover-subscription-test-topic"; private static final String SUBSCRIPTION_NAME = "test-subscription"; From 3d51a0f86aa42ffd32ba9233af1537be9ba2353a Mon Sep 17 00:00:00 2001 From: KevinGilmore Date: Sun, 14 Oct 2018 22:19:23 -0500 Subject: [PATCH 40/87] BAEL-2253 Update README (#5460) * BAEL-1766: Update README * BAEL-1853: add link to article * BAEL-1801: add link to article * Added links back to articles * Add links back to articles * BAEL-1795: Update README * BAEL-1901 and BAEL-1555 add links back to article * BAEL-2026 add link back to article * BAEL-2029: add link back to article * BAEL-1898: Add link back to article * BAEL-2102 and BAEL-2131 Add links back to articles * BAEL-2132 Add link back to article * BAEL-1980: add link back to article * BAEL-2200: Display auto-configuration report in Spring Boot * BAEL-2253: Add link back to article --- javaxval/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/javaxval/README.md b/javaxval/README.md index 3153546c7d..3a975022ad 100644 --- a/javaxval/README.md +++ b/javaxval/README.md @@ -9,3 +9,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Java Bean Validation Basics](http://www.baeldung.com/javax-validation) - [Validating Container Elements with Bean Validation 2.0](http://www.baeldung.com/bean-validation-container-elements) - [Method Constraints with Bean Validation 2.0](http://www.baeldung.com/javax-validation-method-constraints) +- [Difference Between @NotNull, @NotEmpty, and @NotBlank Constraints in Bean Validation](https://www.baeldung.com/java-bean-validation-not-null-empty-blank) From 23c7fb4adefb98f7c4b5cacf3560f4c8daad39ea Mon Sep 17 00:00:00 2001 From: Puneet Dewan Date: Mon, 15 Oct 2018 22:50:53 +0800 Subject: [PATCH 41/87] [BAEL-2248] Add Controller Method to accept form data Add Test method in RestTemplateBasicLiveTest --- .../web/controller/FooController.java | 17 +++++++++------- .../client/RestTemplateBasicLiveTest.java | 20 ++++++++++++++++++- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/spring-rest-simple/src/main/java/org/baeldung/web/controller/FooController.java b/spring-rest-simple/src/main/java/org/baeldung/web/controller/FooController.java index bf26eb3292..e8cb218258 100644 --- a/spring-rest-simple/src/main/java/org/baeldung/web/controller/FooController.java +++ b/spring-rest-simple/src/main/java/org/baeldung/web/controller/FooController.java @@ -5,13 +5,9 @@ import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; import org.baeldung.web.dto.Foo; import org.baeldung.web.dto.FooProtos; import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.*; @Controller public class FooController { @@ -47,7 +43,7 @@ public class FooController { } @RequestMapping(method = RequestMethod.POST, value = "/foos/new") - @ResponseStatus(HttpStatus.OK) + @ResponseStatus(HttpStatus.CREATED) @ResponseBody public Foo createFoo(@RequestBody final Foo foo) { return foo; @@ -60,4 +56,11 @@ public class FooController { return id; } + @RequestMapping(method = RequestMethod.POST, value = "/foos/form") + @ResponseStatus(HttpStatus.CREATED) + @ResponseBody + public String submitFoo(@RequestParam("id") String id) { + return id; + } + } diff --git a/spring-resttemplate/src/test/java/org/baeldung/client/RestTemplateBasicLiveTest.java b/spring-resttemplate/src/test/java/org/baeldung/client/RestTemplateBasicLiveTest.java index 7bcaab6a07..143aa079d5 100644 --- a/spring-resttemplate/src/test/java/org/baeldung/client/RestTemplateBasicLiveTest.java +++ b/spring-resttemplate/src/test/java/org/baeldung/client/RestTemplateBasicLiveTest.java @@ -26,6 +26,8 @@ import org.springframework.http.ResponseEntity; import org.springframework.http.client.ClientHttpRequestFactory; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.RequestCallback; import org.springframework.web.client.RestTemplate; @@ -213,7 +215,23 @@ public class RestTemplateBasicLiveTest { } } - // + @Test + public void givenFooService_whenFormSubmit_thenResourceIsCreated() { + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); + + MultiValueMap map= new LinkedMultiValueMap<>(); + map.add("id", "1"); + + HttpEntity> request = new HttpEntity<>(map, headers); + + ResponseEntity response = restTemplate.postForEntity( fooResourceUrl+"/form", request , String.class); + + assertThat(response.getStatusCode(), is(HttpStatus.CREATED)); + final String fooResponse = response.getBody(); + assertThat(fooResponse, notNullValue()); + assertThat(fooResponse, is("1")); + } private HttpHeaders prepareBasicAuthHeaders() { final HttpHeaders headers = new HttpHeaders(); From eeb5e0892b759661283d187bb800cdce6d6844a9 Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Mon, 15 Oct 2018 21:40:00 +0200 Subject: [PATCH 42/87] removed unnecessary Mockito and refactored test method name --- .../FindItemsBasedOnOtherStreamUnitTest.java | 180 +++++++++--------- 1 file changed, 88 insertions(+), 92 deletions(-) rename core-java-8/findItemsBasedOnValues/src/findItems/FindItemsBasedOnValues.java => core-java-collections/src/test/java/com/baeldung/findItems/FindItemsBasedOnOtherStreamUnitTest.java (63%) diff --git a/core-java-8/findItemsBasedOnValues/src/findItems/FindItemsBasedOnValues.java b/core-java-collections/src/test/java/com/baeldung/findItems/FindItemsBasedOnOtherStreamUnitTest.java similarity index 63% rename from core-java-8/findItemsBasedOnValues/src/findItems/FindItemsBasedOnValues.java rename to core-java-collections/src/test/java/com/baeldung/findItems/FindItemsBasedOnOtherStreamUnitTest.java index a0dcdddd85..326ea9fbe4 100644 --- a/core-java-8/findItemsBasedOnValues/src/findItems/FindItemsBasedOnValues.java +++ b/core-java-collections/src/test/java/com/baeldung/findItems/FindItemsBasedOnOtherStreamUnitTest.java @@ -1,93 +1,89 @@ -package findItems; - -import static org.junit.Assert.assertEquals; - -import java.text.ParseException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - -import org.junit.Test; - -public class FindItemsBasedOnValues { - - List EmplList = new ArrayList(); - List deptList = new ArrayList(); - - public static void main(String[] args) throws ParseException { - FindItemsBasedOnValues findItems = new FindItemsBasedOnValues(); - findItems.givenDepartmentList_thenEmployeeListIsFilteredCorrectly(); - } - - @Test - public void givenDepartmentList_thenEmployeeListIsFilteredCorrectly() { - Integer expectedId = 1002; - - populate(EmplList, deptList); - - List filteredList = EmplList.stream() - .filter(empl -> deptList.stream() - .anyMatch(dept -> dept.getDepartment() - .equals("sales") && empl.getEmployeeId() - .equals(dept.getEmployeeId()))) - .collect(Collectors.toList()); - - assertEquals(expectedId, filteredList.get(0) - .getEmployeeId()); - } - - private void populate(List EmplList, List deptList) { - Employee employee1 = new Employee(1001, "empl1"); - Employee employee2 = new Employee(1002, "empl2"); - Employee employee3 = new Employee(1003, "empl3"); - - Collections.addAll(EmplList, employee1, employee2, employee3); - - Department department1 = new Department(1002, "sales"); - Department department2 = new Department(1003, "marketing"); - Department department3 = new Department(1004, "sales"); - - Collections.addAll(deptList, department1, department2, department3); - } -} - -class Employee { - Integer employeeId; - String employeeName; - - public Employee(Integer employeeId, String employeeName) { - super(); - this.employeeId = employeeId; - this.employeeName = employeeName; - } - - public Integer getEmployeeId() { - return employeeId; - } - - public String getEmployeeName() { - return employeeName; - } - -} - -class Department { - Integer employeeId; - String department; - - public Department(Integer employeeId, String department) { - super(); - this.employeeId = employeeId; - this.department = department; - } - - public Integer getEmployeeId() { - return employeeId; - } - - public String getDepartment() { - return department; - } - +package com.baeldung.findItems; + +import static org.junit.Assert.assertEquals; + +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +import org.junit.Test; + +public class FindItemsBasedOnOtherStreamUnitTest { + + private List employeeList = new ArrayList(); + + private List departmentList = new ArrayList(); + + @Test + public void givenDepartmentList_thenEmployeeListIsFilteredCorrectly() { + Integer expectedId = 1002; + + populate(employeeList, departmentList); + + List filteredList = employeeList.stream() + .filter(empl -> departmentList.stream() + .anyMatch(dept -> dept.getDepartment() + .equals("sales") && empl.getEmployeeId() + .equals(dept.getEmployeeId()))) + .collect(Collectors.toList()); + + assertEquals(expectedId, filteredList.get(0) + .getEmployeeId()); + } + + private void populate(List EmplList, List deptList) { + Employee employee1 = new Employee(1001, "empl1"); + Employee employee2 = new Employee(1002, "empl2"); + Employee employee3 = new Employee(1003, "empl3"); + + Collections.addAll(EmplList, employee1, employee2, employee3); + + Department department1 = new Department(1002, "sales"); + Department department2 = new Department(1003, "marketing"); + Department department3 = new Department(1004, "sales"); + + Collections.addAll(deptList, department1, department2, department3); + } +} + +class Employee { + private Integer employeeId; + private String employeeName; + + Employee(Integer employeeId, String employeeName) { + super(); + this.employeeId = employeeId; + this.employeeName = employeeName; + } + + Integer getEmployeeId() { + return employeeId; + } + + public String getEmployeeName() { + return employeeName; + } + +} + +class Department { + private Integer employeeId; + private String department; + + Department(Integer employeeId, String department) { + super(); + this.employeeId = employeeId; + this.department = department; + } + + Integer getEmployeeId() { + return employeeId; + } + + String getDepartment() { + return department; + } + } \ No newline at end of file From 8cfa575f5d80ae73bafa9abe4bc4253dbe72db90 Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Mon, 15 Oct 2018 21:40:50 +0200 Subject: [PATCH 43/87] removed unneccessary folder --- core-java-8/findItemsBasedOnValues/.gitignore | 1 - 1 file changed, 1 deletion(-) delete mode 100644 core-java-8/findItemsBasedOnValues/.gitignore diff --git a/core-java-8/findItemsBasedOnValues/.gitignore b/core-java-8/findItemsBasedOnValues/.gitignore deleted file mode 100644 index ae3c172604..0000000000 --- a/core-java-8/findItemsBasedOnValues/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/bin/ From 5e791c56a1a5e8165a332c0f9ac83358a0706441 Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Mon, 15 Oct 2018 23:12:19 +0200 Subject: [PATCH 44/87] removed unneccessary folder --- .../com/baeldung/modulo/ModuloUnitTest.java | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 core-java/src/test/java/com/baeldung/modulo/ModuloUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/modulo/ModuloUnitTest.java b/core-java/src/test/java/com/baeldung/modulo/ModuloUnitTest.java new file mode 100644 index 0000000000..8b3685adf3 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/modulo/ModuloUnitTest.java @@ -0,0 +1,54 @@ +package com.baeldung.modulo; + +import org.junit.Test; +import static org.assertj.core.api.Java6Assertions.*; + +public class ModuloUnitTest { + + @Test + public void whenIntegerDivision_thenLosesRemainder(){ + assertThat(11 / 4).isEqualTo(2); + } + + @Test + public void whenDoubleDivision_thenKeepsRemainder(){ + assertThat(11 / 4.0).isEqualTo(2.75); + } + + @Test + public void whenModulo_thenReturnsRemainder(){ + assertThat(11 % 4).isEqualTo(3); + } + + @Test(expected = ArithmeticException.class) + public void whenDivisionByZero_thenArithmeticException(){ + double result = 1 / 0; + } + + @Test(expected = ArithmeticException.class) + public void whenModuloByZero_thenArithmeticException(){ + double result = 1 % 0; + } + + @Test + public void whenDivisorIsOddAndModulusIs2_thenResultIs1(){ + assertThat(3 % 2).isEqualTo(1); + } + + @Test + public void whenDivisorIsEvenAndModulusIs2_thenResultIs0(){ + assertThat(4 % 2).isEqualTo(0); + } + + @Test + public void whenItemsIsAddedToCircularQueue_thenNoArrayIndexOutOfBounds(){ + int QUEUE_CAPACITY= 10; + int[] circularQueue = new int[QUEUE_CAPACITY]; + int itemsInserted = 0; + for (int value = 0; value < 1000; value++) { + int writeIndex = ++itemsInserted % QUEUE_CAPACITY; + circularQueue[writeIndex] = value; + } + } + +} From 45194b5edc1b18ca785aeaf62e0530cc4ed21293 Mon Sep 17 00:00:00 2001 From: rozagerardo Date: Tue, 16 Oct 2018 02:22:19 -0300 Subject: [PATCH 45/87] [BAEL-1502] spring-5-reactive | Validation for Functional Endpoints (#5437) * Added validation for functional endpoints scenarios: * validating in handler explicitly * created abstract handler with validation steps * using validation handlers with two implementations * * added annotated entity to be used with springvalidator * * added tests and cleaning the code slightly --- .../FunctionalValidationsApplication.java | 12 ++ .../handlers/AbstractValidationHandler.java | 45 +++++++ .../handlers/FunctionalHandler.java | 43 +++++++ ...notatedRequestEntityValidationHandler.java | 30 +++++ .../CustomRequestEntityValidationHandler.java | 37 ++++++ .../impl/OtherEntityValidationHandler.java | 28 +++++ .../model/AnnotatedRequestEntity.java | 23 ++++ .../functional/model/CustomRequestEntity.java | 17 +++ .../functional/model/OtherEntity.java | 17 +++ .../routers/ValidationsRouters.java | 29 +++++ .../CustomRequestEntityValidator.java | 29 +++++ .../validators/OtherEntityValidator.java | 27 +++++ ...FunctionalEndpointValidationsLiveTest.java | 111 ++++++++++++++++++ 13 files changed, 448 insertions(+) create mode 100644 spring-5-reactive/src/main/java/com/baeldung/validations/functional/FunctionalValidationsApplication.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/AbstractValidationHandler.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/FunctionalHandler.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/impl/AnnotatedRequestEntityValidationHandler.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/impl/CustomRequestEntityValidationHandler.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/impl/OtherEntityValidationHandler.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/validations/functional/model/AnnotatedRequestEntity.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/validations/functional/model/CustomRequestEntity.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/validations/functional/model/OtherEntity.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/validations/functional/routers/ValidationsRouters.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/validations/functional/validators/CustomRequestEntityValidator.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/validations/functional/validators/OtherEntityValidator.java create mode 100644 spring-5-reactive/src/test/java/com/baeldung/validations/functional/FunctionalEndpointValidationsLiveTest.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/FunctionalValidationsApplication.java b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/FunctionalValidationsApplication.java new file mode 100644 index 0000000000..e548e33c85 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/FunctionalValidationsApplication.java @@ -0,0 +1,12 @@ +package com.baeldung.validations.functional; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class FunctionalValidationsApplication { + + public static void main(String[] args) { + SpringApplication.run(FunctionalValidationsApplication.class, args); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/AbstractValidationHandler.java b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/AbstractValidationHandler.java new file mode 100644 index 0000000000..f34c1ee8d8 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/AbstractValidationHandler.java @@ -0,0 +1,45 @@ +package com.baeldung.validations.functional.handlers; + +import org.springframework.http.HttpStatus; +import org.springframework.validation.BeanPropertyBindingResult; +import org.springframework.validation.Errors; +import org.springframework.validation.Validator; +import org.springframework.web.reactive.function.server.ServerRequest; +import org.springframework.web.reactive.function.server.ServerResponse; +import org.springframework.web.server.ResponseStatusException; + +import reactor.core.publisher.Mono; + +public abstract class AbstractValidationHandler { + + private final Class validationClass; + + private final U validator; + + protected AbstractValidationHandler(Class clazz, U validator) { + this.validationClass = clazz; + this.validator = validator; + } + + abstract protected Mono processBody(T validBody, final ServerRequest originalRequest); + + public final Mono handleRequest(final ServerRequest request) { + return request.bodyToMono(this.validationClass) + .flatMap(body -> { + Errors errors = new BeanPropertyBindingResult(body, this.validationClass.getName()); + this.validator.validate(body, errors); + + if (errors == null || errors.getAllErrors() + .isEmpty()) { + return processBody(body, request); + } else { + return onValidationErrors(errors, body, request); + } + }); + } + + protected Mono onValidationErrors(Errors errors, T invalidBody, final ServerRequest request) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, errors.getAllErrors() + .toString()); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/FunctionalHandler.java b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/FunctionalHandler.java new file mode 100644 index 0000000000..d7e3bd0bc0 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/FunctionalHandler.java @@ -0,0 +1,43 @@ +package com.baeldung.validations.functional.handlers; + +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Component; +import org.springframework.validation.BeanPropertyBindingResult; +import org.springframework.validation.Errors; +import org.springframework.validation.Validator; +import org.springframework.web.reactive.function.server.ServerRequest; +import org.springframework.web.reactive.function.server.ServerResponse; +import org.springframework.web.server.ResponseStatusException; + +import com.baeldung.validations.functional.model.CustomRequestEntity; +import com.baeldung.validations.functional.validators.CustomRequestEntityValidator; + +import reactor.core.publisher.Mono; + +@Component +public class FunctionalHandler { + + public Mono handleRequest(final ServerRequest request) { + Validator validator = new CustomRequestEntityValidator(); + Mono responseBody = request.bodyToMono(CustomRequestEntity.class) + .map(body -> { + Errors errors = new BeanPropertyBindingResult(body, CustomRequestEntity.class.getName()); + validator.validate(body, errors); + + if (errors == null || errors.getAllErrors() + .isEmpty()) { + return String.format("Hi, %s [%s]!", body.getName(), body.getCode()); + + } else { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, errors.getAllErrors() + .toString()); + } + + }); + return ServerResponse.ok() + .contentType(MediaType.APPLICATION_JSON) + .body(responseBody, String.class); + + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/impl/AnnotatedRequestEntityValidationHandler.java b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/impl/AnnotatedRequestEntityValidationHandler.java new file mode 100644 index 0000000000..2011679741 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/impl/AnnotatedRequestEntityValidationHandler.java @@ -0,0 +1,30 @@ +package com.baeldung.validations.functional.handlers.impl; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Component; +import org.springframework.validation.Validator; +import org.springframework.web.reactive.function.server.ServerRequest; +import org.springframework.web.reactive.function.server.ServerResponse; + +import com.baeldung.validations.functional.handlers.AbstractValidationHandler; +import com.baeldung.validations.functional.model.AnnotatedRequestEntity; + +import reactor.core.publisher.Mono; + +@Component +public class AnnotatedRequestEntityValidationHandler extends AbstractValidationHandler { + + private AnnotatedRequestEntityValidationHandler(@Autowired Validator validator) { + super(AnnotatedRequestEntity.class, validator); + } + + @Override + protected Mono processBody(AnnotatedRequestEntity validBody, ServerRequest originalRequest) { + String responseBody = String.format("Hi, %s. Password: %s!", validBody.getUser(), validBody.getPassword()); + return ServerResponse.ok() + .contentType(MediaType.APPLICATION_JSON) + .body(Mono.just(responseBody), String.class); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/impl/CustomRequestEntityValidationHandler.java b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/impl/CustomRequestEntityValidationHandler.java new file mode 100644 index 0000000000..34630c60b2 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/impl/CustomRequestEntityValidationHandler.java @@ -0,0 +1,37 @@ +package com.baeldung.validations.functional.handlers.impl; + +import org.springframework.http.MediaType; +import org.springframework.stereotype.Component; +import org.springframework.validation.Errors; +import org.springframework.web.reactive.function.server.ServerRequest; +import org.springframework.web.reactive.function.server.ServerResponse; + +import com.baeldung.validations.functional.handlers.AbstractValidationHandler; +import com.baeldung.validations.functional.model.CustomRequestEntity; +import com.baeldung.validations.functional.validators.CustomRequestEntityValidator; + +import reactor.core.publisher.Mono; + +@Component +public class CustomRequestEntityValidationHandler extends AbstractValidationHandler { + + private CustomRequestEntityValidationHandler() { + super(CustomRequestEntity.class, new CustomRequestEntityValidator()); + } + + @Override + protected Mono processBody(CustomRequestEntity validBody, ServerRequest originalRequest) { + String responseBody = String.format("Hi, %s [%s]!", validBody.getName(), validBody.getCode()); + return ServerResponse.ok() + .contentType(MediaType.APPLICATION_JSON) + .body(Mono.just(responseBody), String.class); + } + + @Override + protected Mono onValidationErrors(Errors errors, CustomRequestEntity invalidBody, final ServerRequest request) { + return ServerResponse.badRequest() + .contentType(MediaType.APPLICATION_JSON) + .body(Mono.just(String.format("Custom message showing the errors: %s", errors.getAllErrors() + .toString())), String.class); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/impl/OtherEntityValidationHandler.java b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/impl/OtherEntityValidationHandler.java new file mode 100644 index 0000000000..0196287d13 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/impl/OtherEntityValidationHandler.java @@ -0,0 +1,28 @@ +package com.baeldung.validations.functional.handlers.impl; + +import org.springframework.http.MediaType; +import org.springframework.stereotype.Component; +import org.springframework.web.reactive.function.server.ServerRequest; +import org.springframework.web.reactive.function.server.ServerResponse; + +import com.baeldung.validations.functional.handlers.AbstractValidationHandler; +import com.baeldung.validations.functional.model.OtherEntity; +import com.baeldung.validations.functional.validators.OtherEntityValidator; + +import reactor.core.publisher.Mono; + +@Component +public class OtherEntityValidationHandler extends AbstractValidationHandler { + + private OtherEntityValidationHandler() { + super(OtherEntity.class, new OtherEntityValidator()); + } + + @Override + protected Mono processBody(OtherEntity validBody, ServerRequest originalRequest) { + String responseBody = String.format("Other object with item %s and quantity %s!", validBody.getItem(), validBody.getQuantity()); + return ServerResponse.ok() + .contentType(MediaType.APPLICATION_JSON) + .body(Mono.just(responseBody), String.class); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/model/AnnotatedRequestEntity.java b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/model/AnnotatedRequestEntity.java new file mode 100644 index 0000000000..992f07481c --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/model/AnnotatedRequestEntity.java @@ -0,0 +1,23 @@ +package com.baeldung.validations.functional.model; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@AllArgsConstructor +@NoArgsConstructor +@Getter +@Setter +public class AnnotatedRequestEntity { + @NotNull + private String user; + + @NotNull + @Size(min = 4, max = 7) + private String password; + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/model/CustomRequestEntity.java b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/model/CustomRequestEntity.java new file mode 100644 index 0000000000..ed459f121b --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/model/CustomRequestEntity.java @@ -0,0 +1,17 @@ +package com.baeldung.validations.functional.model; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@AllArgsConstructor +@NoArgsConstructor +@Getter +@Setter +public class CustomRequestEntity { + + private String name; + private String code; + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/model/OtherEntity.java b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/model/OtherEntity.java new file mode 100644 index 0000000000..78667cb13d --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/model/OtherEntity.java @@ -0,0 +1,17 @@ +package com.baeldung.validations.functional.model; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@AllArgsConstructor +@NoArgsConstructor +@Getter +@Setter +public class OtherEntity { + + private String item; + private Integer quantity; + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/routers/ValidationsRouters.java b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/routers/ValidationsRouters.java new file mode 100644 index 0000000000..efbdbe3f99 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/routers/ValidationsRouters.java @@ -0,0 +1,29 @@ +package com.baeldung.validations.functional.routers; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.reactive.function.server.RequestPredicates; +import org.springframework.web.reactive.function.server.RouterFunction; +import org.springframework.web.reactive.function.server.RouterFunctions; +import org.springframework.web.reactive.function.server.ServerResponse; + +import com.baeldung.validations.functional.handlers.FunctionalHandler; +import com.baeldung.validations.functional.handlers.impl.AnnotatedRequestEntityValidationHandler; +import com.baeldung.validations.functional.handlers.impl.CustomRequestEntityValidationHandler; +import com.baeldung.validations.functional.handlers.impl.OtherEntityValidationHandler; + +@Configuration +public class ValidationsRouters { + + @Bean + public RouterFunction responseHeaderRoute(@Autowired CustomRequestEntityValidationHandler dryHandler, + @Autowired FunctionalHandler complexHandler, + @Autowired OtherEntityValidationHandler otherHandler, + @Autowired AnnotatedRequestEntityValidationHandler annotatedEntityHandler) { + return RouterFunctions.route(RequestPredicates.POST("/complex-handler-functional-validation"), complexHandler::handleRequest) + .andRoute(RequestPredicates.POST("/dry-functional-validation"), dryHandler::handleRequest) + .andRoute(RequestPredicates.POST("/other-dry-functional-validation"), otherHandler::handleRequest) + .andRoute(RequestPredicates.POST("/annotated-functional-validation"), annotatedEntityHandler::handleRequest); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/validators/CustomRequestEntityValidator.java b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/validators/CustomRequestEntityValidator.java new file mode 100644 index 0000000000..085d477318 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/validators/CustomRequestEntityValidator.java @@ -0,0 +1,29 @@ +package com.baeldung.validations.functional.validators; + +import org.springframework.validation.Errors; +import org.springframework.validation.ValidationUtils; +import org.springframework.validation.Validator; + +import com.baeldung.validations.functional.model.CustomRequestEntity; + +public class CustomRequestEntityValidator implements Validator { + + private static final int MINIMUM_CODE_LENGTH = 6; + + @Override + public boolean supports(Class clazz) { + return CustomRequestEntity.class.isAssignableFrom(clazz); + } + + @Override + public void validate(Object target, Errors errors) { + ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "field.required"); + ValidationUtils.rejectIfEmptyOrWhitespace(errors, "code", "field.required"); + CustomRequestEntity request = (CustomRequestEntity) target; + if (request.getCode() != null && request.getCode() + .trim() + .length() < MINIMUM_CODE_LENGTH) { + errors.rejectValue("code", "field.min.length", new Object[] { Integer.valueOf(MINIMUM_CODE_LENGTH) }, "The code must be at least [" + MINIMUM_CODE_LENGTH + "] characters in length."); + } + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/validators/OtherEntityValidator.java b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/validators/OtherEntityValidator.java new file mode 100644 index 0000000000..18c2c28cfe --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/validators/OtherEntityValidator.java @@ -0,0 +1,27 @@ +package com.baeldung.validations.functional.validators; + +import org.springframework.validation.Errors; +import org.springframework.validation.ValidationUtils; +import org.springframework.validation.Validator; + +import com.baeldung.validations.functional.model.OtherEntity; + +public class OtherEntityValidator implements Validator { + + private static final int MIN_ITEM_QUANTITY = 1; + + @Override + public boolean supports(Class clazz) { + return OtherEntity.class.isAssignableFrom(clazz); + } + + @Override + public void validate(Object target, Errors errors) { + ValidationUtils.rejectIfEmptyOrWhitespace(errors, "item", "field.required"); + ValidationUtils.rejectIfEmptyOrWhitespace(errors, "quantity", "field.required"); + OtherEntity request = (OtherEntity) target; + if (request.getQuantity() != null && request.getQuantity() < MIN_ITEM_QUANTITY) { + errors.rejectValue("quantity", "field.min.length", new Object[] { Integer.valueOf(MIN_ITEM_QUANTITY) }, "There must be at least one item"); + } + } +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/validations/functional/FunctionalEndpointValidationsLiveTest.java b/spring-5-reactive/src/test/java/com/baeldung/validations/functional/FunctionalEndpointValidationsLiveTest.java new file mode 100644 index 0000000000..5fe764bf8f --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/validations/functional/FunctionalEndpointValidationsLiveTest.java @@ -0,0 +1,111 @@ +package com.baeldung.validations.functional; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.reactive.server.WebTestClient; +import org.springframework.test.web.reactive.server.WebTestClient.ResponseSpec; + +import com.baeldung.validations.functional.model.AnnotatedRequestEntity; +import com.baeldung.validations.functional.model.CustomRequestEntity; + +import reactor.core.publisher.Mono; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +public class FunctionalEndpointValidationsLiveTest { + + private static final String BASE_URL = "http://localhost:8080"; + private static final String COMPLEX_EP_URL = BASE_URL + "/complex-handler-functional-validation"; + private static final String DRY_EP_URL = BASE_URL + "/dry-functional-validation"; + private static final String ANNOTATIONS_EP_URL = BASE_URL + "/annotated-functional-validation"; + + private static WebTestClient client; + + @BeforeAll + public static void setup() { + client = WebTestClient.bindToServer() + .baseUrl(BASE_URL) + .build(); + } + + @Test + public void whenRequestingDryEPWithInvalidBody_thenObtainBadRequest() { + CustomRequestEntity body = new CustomRequestEntity("name", "123"); + + ResponseSpec response = client.post() + .uri(DRY_EP_URL) + .body(Mono.just(body), CustomRequestEntity.class) + .exchange(); + + response.expectStatus() + .isBadRequest(); + } + + @Test + public void whenRequestingComplexEPWithInvalidBody_thenObtainBadRequest() { + CustomRequestEntity body = new CustomRequestEntity("name", "123"); + + ResponseSpec response = client.post() + .uri(COMPLEX_EP_URL) + .body(Mono.just(body), CustomRequestEntity.class) + .exchange(); + + response.expectStatus() + .isBadRequest(); + } + + @Test + public void whenRequestingAnnotatedEPWithInvalidBody_thenObtainBadRequest() { + AnnotatedRequestEntity body = new AnnotatedRequestEntity("user", "passwordlongerthan7digits"); + + ResponseSpec response = client.post() + .uri(ANNOTATIONS_EP_URL) + .body(Mono.just(body), AnnotatedRequestEntity.class) + .exchange(); + + response.expectStatus() + .isBadRequest(); + } + + @Test + public void whenRequestingDryEPWithValidBody_thenObtainBadRequest() { + CustomRequestEntity body = new CustomRequestEntity("name", "1234567"); + + ResponseSpec response = client.post() + .uri(DRY_EP_URL) + .body(Mono.just(body), CustomRequestEntity.class) + .exchange(); + + response.expectStatus() + .isOk(); + } + + @Test + public void whenRequestingComplexEPWithValidBody_thenObtainBadRequest() { + CustomRequestEntity body = new CustomRequestEntity("name", "1234567"); + + ResponseSpec response = client.post() + .uri(COMPLEX_EP_URL) + .body(Mono.just(body), CustomRequestEntity.class) + .exchange(); + + response.expectStatus() + .isOk(); + } + + @Test + public void whenRequestingAnnotatedEPWithValidBody_thenObtainBadRequest() { + AnnotatedRequestEntity body = new AnnotatedRequestEntity("user", "12345"); + + ResponseSpec response = client.post() + .uri(ANNOTATIONS_EP_URL) + .body(Mono.just(body), AnnotatedRequestEntity.class) + .exchange(); + + response.expectStatus() + .isOk(); + } +} From 201c3a75c89827e3b848dcb730657739129a56ee Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Tue, 16 Oct 2018 23:22:04 +0530 Subject: [PATCH 46/87] BAEL-9467 Update Spring Security article - Migrated module to inherit from spring-5 and spring-security-5 - Relevant changes and fixes in code for upgraded spring-security module --- spring-security-rest/pom.xml | 21 ++--- .../org/baeldung/persistence/model/Foo.java | 2 + ...uestAwareAuthenticationSuccessHandler.java | 7 +- .../RestAuthenticationEntryPoint.java | 6 +- .../org/baeldung/spring/ClientWebConfig.java | 11 +-- .../baeldung/spring/SecurityJavaConfig.java | 77 ++++++++++--------- .../org/baeldung/spring/SwaggerConfig.java | 15 +++- .../java/org/baeldung/spring/WebConfig.java | 9 +-- .../web/controller/AsyncController.java | 4 +- .../web/controller/CustomerController.java | 4 +- .../web/controller/FooController.java | 11 --- .../web/service/AsyncServiceImpl.java | 6 +- .../src/main/resources/webSecurityConfig.xml | 6 +- 13 files changed, 84 insertions(+), 95 deletions(-) diff --git a/spring-security-rest/pom.xml b/spring-security-rest/pom.xml index 57ce5ddb92..70967ce214 100644 --- a/spring-security-rest/pom.xml +++ b/spring-security-rest/pom.xml @@ -2,7 +2,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.baeldung spring-security-rest 0.1-SNAPSHOT spring-security-rest @@ -10,9 +9,9 @@ com.baeldung - parent-spring-4 + parent-spring-5 0.0.1-SNAPSHOT - ../parent-spring-4 + ../parent-spring-5 @@ -195,13 +194,6 @@ - - - org.apache.maven.plugins - maven-war-plugin - ${maven-war-plugin.version} - - org.codehaus.cargo cargo-maven2-plugin @@ -282,17 +274,17 @@ - 4.2.6.RELEASE - 0.21.0.RELEASE + 5.1.0.RELEASE + 0.25.0.RELEASE 3.1.0 1.1.0.Final 1.2 - 2.8.5 + 2.9.2 - 19.0 + 26.0-jre 3.5 1.3.2 @@ -303,7 +295,6 @@ 2.9.2 - 2.6 1.6.1 diff --git a/spring-security-rest/src/main/java/org/baeldung/persistence/model/Foo.java b/spring-security-rest/src/main/java/org/baeldung/persistence/model/Foo.java index 1941e2aa51..05a7c7b9a0 100644 --- a/spring-security-rest/src/main/java/org/baeldung/persistence/model/Foo.java +++ b/spring-security-rest/src/main/java/org/baeldung/persistence/model/Foo.java @@ -6,6 +6,8 @@ import javax.validation.constraints.Size; public class Foo implements Serializable { + private static final long serialVersionUID = -5422285893276747592L; + private long id; @Size(min = 5, max = 14) diff --git a/spring-security-rest/src/main/java/org/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java b/spring-security-rest/src/main/java/org/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java index f4b8e7f5ac..6018264632 100644 --- a/spring-security-rest/src/main/java/org/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java +++ b/spring-security-rest/src/main/java/org/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java @@ -11,8 +11,10 @@ import org.springframework.security.web.authentication.SimpleUrlAuthenticationSu import org.springframework.security.web.savedrequest.HttpSessionRequestCache; import org.springframework.security.web.savedrequest.RequestCache; import org.springframework.security.web.savedrequest.SavedRequest; +import org.springframework.stereotype.Component; import org.springframework.util.StringUtils; +@Component public class MySavedRequestAwareAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuccessHandler { private RequestCache requestCache = new HttpSessionRequestCache(); @@ -33,11 +35,6 @@ public class MySavedRequestAwareAuthenticationSuccessHandler extends SimpleUrlAu } clearAuthenticationAttributes(request); - - // Use the DefaultSavedRequest URL - // final String targetUrl = savedRequest.getRedirectUrl(); - // logger.debug("Redirecting to DefaultSavedRequest Url: " + targetUrl); - // getRedirectStrategy().sendRedirect(request, response, targetUrl); } public void setRequestCache(final RequestCache requestCache) { diff --git a/spring-security-rest/src/main/java/org/baeldung/security/RestAuthenticationEntryPoint.java b/spring-security-rest/src/main/java/org/baeldung/security/RestAuthenticationEntryPoint.java index 77aa32ff97..e448e6537f 100644 --- a/spring-security-rest/src/main/java/org/baeldung/security/RestAuthenticationEntryPoint.java +++ b/spring-security-rest/src/main/java/org/baeldung/security/RestAuthenticationEntryPoint.java @@ -16,7 +16,11 @@ import org.springframework.stereotype.Component; public final class RestAuthenticationEntryPoint implements AuthenticationEntryPoint { @Override - public void commence(final HttpServletRequest request, final HttpServletResponse response, final AuthenticationException authException) throws IOException { + public void commence( + final HttpServletRequest request, + final HttpServletResponse response, + final AuthenticationException authException) throws IOException { + response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized"); } diff --git a/spring-security-rest/src/main/java/org/baeldung/spring/ClientWebConfig.java b/spring-security-rest/src/main/java/org/baeldung/spring/ClientWebConfig.java index 601ba66330..8e20358a5a 100644 --- a/spring-security-rest/src/main/java/org/baeldung/spring/ClientWebConfig.java +++ b/spring-security-rest/src/main/java/org/baeldung/spring/ClientWebConfig.java @@ -2,16 +2,9 @@ package org.baeldung.spring; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @EnableWebMvc @Configuration -public class ClientWebConfig extends WebMvcConfigurerAdapter { - - public ClientWebConfig() { - super(); - } - - // API - +public class ClientWebConfig implements WebMvcConfigurer { } \ No newline at end of file diff --git a/spring-security-rest/src/main/java/org/baeldung/spring/SecurityJavaConfig.java b/spring-security-rest/src/main/java/org/baeldung/spring/SecurityJavaConfig.java index c3e738297a..d5111f9b20 100644 --- a/spring-security-rest/src/main/java/org/baeldung/spring/SecurityJavaConfig.java +++ b/spring-security-rest/src/main/java/org/baeldung/spring/SecurityJavaConfig.java @@ -1,6 +1,7 @@ package org.baeldung.spring; import org.baeldung.security.MySavedRequestAwareAuthenticationSuccessHandler; +import org.baeldung.security.RestAuthenticationEntryPoint; import org.baeldung.web.error.CustomAccessDeniedHandler; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -12,6 +13,8 @@ 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.core.context.SecurityContextHolder; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; @Configuration @@ -20,59 +23,61 @@ import org.springframework.security.web.authentication.SimpleUrlAuthenticationFa @ComponentScan("org.baeldung.security") public class SecurityJavaConfig extends WebSecurityConfigurerAdapter { + @Autowired + private PasswordEncoder encoder; + @Autowired private CustomAccessDeniedHandler accessDeniedHandler; - // @Autowired - // private RestAuthenticationEntryPoint restAuthenticationEntryPoint; + @Autowired + private RestAuthenticationEntryPoint restAuthenticationEntryPoint; - // @Autowired - // private MySavedRequestAwareAuthenticationSuccessHandler authenticationSuccessHandler; + @Autowired + private MySavedRequestAwareAuthenticationSuccessHandler mySuccessHandler; + + private SimpleUrlAuthenticationFailureHandler myFailureHandler = new SimpleUrlAuthenticationFailureHandler(); public SecurityJavaConfig() { super(); SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_INHERITABLETHREADLOCAL); } - // - @Override protected void configure(final AuthenticationManagerBuilder auth) throws Exception { - auth.inMemoryAuthentication().withUser("temporary").password("temporary").roles("ADMIN").and().withUser("user").password("userPass").roles("USER"); + auth.inMemoryAuthentication() + .withUser("admin").password(encoder.encode("adminPass")).roles("ADMIN") + .and() + .withUser("user").password(encoder.encode("userPass")).roles("USER"); } @Override - protected void configure(final HttpSecurity http) throws Exception {// @formatter:off - http - .csrf().disable() - .authorizeRequests() - .and() - .exceptionHandling().accessDeniedHandler(accessDeniedHandler) - // .authenticationEntryPoint(restAuthenticationEntryPoint) - .and() - .authorizeRequests() - .antMatchers("/api/csrfAttacker*").permitAll() - .antMatchers("/api/customer/**").permitAll() - .antMatchers("/api/foos/**").authenticated() - .antMatchers("/api/async/**").permitAll() - .antMatchers("/api/admin/**").hasRole("ADMIN") - .and() - .httpBasic() -// .and() -// .successHandler(authenticationSuccessHandler) -// .failureHandler(new SimpleUrlAuthenticationFailureHandler()) - .and() - .logout(); - } // @formatter:on - - @Bean - public MySavedRequestAwareAuthenticationSuccessHandler mySuccessHandler() { - return new MySavedRequestAwareAuthenticationSuccessHandler(); + protected void configure(final HttpSecurity http) throws Exception { + http.csrf().disable() + .authorizeRequests() + .and() + .exceptionHandling() + .accessDeniedHandler(accessDeniedHandler) + .authenticationEntryPoint(restAuthenticationEntryPoint) + .and() + .authorizeRequests() + .antMatchers("/api/csrfAttacker*").permitAll() + .antMatchers("/api/customer/**").permitAll() + .antMatchers("/api/foos/**").authenticated() + .antMatchers("/api/async/**").permitAll() + .antMatchers("/api/admin/**").hasRole("ADMIN") + .and() + .formLogin() + .successHandler(mySuccessHandler) + .failureHandler(myFailureHandler) + .and() + .httpBasic() + .and() + .logout(); } - + @Bean - public SimpleUrlAuthenticationFailureHandler myFailureHandler() { - return new SimpleUrlAuthenticationFailureHandler(); + public PasswordEncoder encoder() { + return new BCryptPasswordEncoder(); } } \ No newline at end of file diff --git a/spring-security-rest/src/main/java/org/baeldung/spring/SwaggerConfig.java b/spring-security-rest/src/main/java/org/baeldung/spring/SwaggerConfig.java index bcf6657eee..aa00e8455e 100644 --- a/spring-security-rest/src/main/java/org/baeldung/spring/SwaggerConfig.java +++ b/spring-security-rest/src/main/java/org/baeldung/spring/SwaggerConfig.java @@ -24,8 +24,19 @@ public class SwaggerConfig { @Bean public Docket api() { - return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.basePackage("org.baeldung.web.controller")).paths(PathSelectors.ant("/foos/*")).build().apiInfo(apiInfo()).useDefaultResponseMessages(false) - .globalResponseMessage(RequestMethod.GET, newArrayList(new ResponseMessageBuilder().code(500).message("500 message").responseModel(new ModelRef("Error")).build(), new ResponseMessageBuilder().code(403).message("Forbidden!!!!!").build())); + return new Docket(DocumentationType.SWAGGER_2).select() + .apis(RequestHandlerSelectors.basePackage("org.baeldung.web.controller")) + .paths(PathSelectors.ant("/foos/*")) + .build() + .apiInfo(apiInfo()) + .useDefaultResponseMessages(false) + .globalResponseMessage(RequestMethod.GET, newArrayList(new ResponseMessageBuilder().code(500) + .message("500 message") + .responseModel(new ModelRef("Error")) + .build(), + new ResponseMessageBuilder().code(403) + .message("Forbidden!!!!!") + .build())); } private ApiInfo apiInfo() { diff --git a/spring-security-rest/src/main/java/org/baeldung/spring/WebConfig.java b/spring-security-rest/src/main/java/org/baeldung/spring/WebConfig.java index 92a3c548a2..dba07dc4e5 100644 --- a/spring-security-rest/src/main/java/org/baeldung/spring/WebConfig.java +++ b/spring-security-rest/src/main/java/org/baeldung/spring/WebConfig.java @@ -8,18 +8,14 @@ import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.view.InternalResourceViewResolver; @Configuration @ComponentScan("org.baeldung.web") @EnableWebMvc @EnableAsync -public class WebConfig extends WebMvcConfigurerAdapter { - - public WebConfig() { - super(); - } +public class WebConfig implements WebMvcConfigurer { @Override public void addResourceHandlers(final ResourceHandlerRegistry registry) { @@ -38,7 +34,6 @@ public class WebConfig extends WebMvcConfigurerAdapter { @Override public void addViewControllers(final ViewControllerRegistry registry) { - super.addViewControllers(registry); registry.addViewController("/csrfAttacker.html"); } diff --git a/spring-security-rest/src/main/java/org/baeldung/web/controller/AsyncController.java b/spring-security-rest/src/main/java/org/baeldung/web/controller/AsyncController.java index 456eeaaeac..f6f1c392cb 100644 --- a/spring-security-rest/src/main/java/org/baeldung/web/controller/AsyncController.java +++ b/spring-security-rest/src/main/java/org/baeldung/web/controller/AsyncController.java @@ -24,9 +24,9 @@ public class AsyncController { @RequestMapping(method = RequestMethod.GET, value = "/async") @ResponseBody public Object standardProcessing() throws Exception { - log.info("Outside the @Async logic - before the async call: " + SecurityContextHolder.getContext().getAuthentication().getPrincipal()); + log.info("Outside the @Async logic - before the async call: {}", SecurityContextHolder.getContext().getAuthentication().getPrincipal()); asyncService.asyncCall(); - log.info("Inside the @Async logic - after the async call: " + SecurityContextHolder.getContext().getAuthentication().getPrincipal()); + log.info("Inside the @Async logic - after the async call: {}", SecurityContextHolder.getContext().getAuthentication().getPrincipal()); return SecurityContextHolder.getContext().getAuthentication().getPrincipal(); } diff --git a/spring-security-rest/src/main/java/org/baeldung/web/controller/CustomerController.java b/spring-security-rest/src/main/java/org/baeldung/web/controller/CustomerController.java index b8f67960f5..e1db105d18 100644 --- a/spring-security-rest/src/main/java/org/baeldung/web/controller/CustomerController.java +++ b/spring-security-rest/src/main/java/org/baeldung/web/controller/CustomerController.java @@ -48,7 +48,7 @@ public class CustomerController { } Link link =linkTo(methodOn(CustomerController.class).getOrdersForCustomer(customerId)).withSelfRel(); - Resources result = new Resources(orders,link); + Resources result = new Resources<>(orders,link); return result; } @@ -67,7 +67,7 @@ public class CustomerController { } Link link =linkTo(CustomerController.class).withSelfRel(); - Resources result = new Resources(allCustomers,link); + Resources result = new Resources<>(allCustomers,link); return result; } diff --git a/spring-security-rest/src/main/java/org/baeldung/web/controller/FooController.java b/spring-security-rest/src/main/java/org/baeldung/web/controller/FooController.java index 3b9e5d25c0..f914f82215 100644 --- a/spring-security-rest/src/main/java/org/baeldung/web/controller/FooController.java +++ b/spring-security-rest/src/main/java/org/baeldung/web/controller/FooController.java @@ -7,8 +7,6 @@ import java.util.List; import javax.servlet.http.HttpServletResponse; import org.baeldung.persistence.model.Foo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationEventPublisher; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; @@ -25,17 +23,9 @@ import com.google.common.collect.Lists; @RequestMapping(value = "/foos") public class FooController { - @Autowired - private ApplicationEventPublisher eventPublisher; - - public FooController() { - super(); - } - // API // read - single - @RequestMapping(value = "/{id}", method = RequestMethod.GET) @ResponseBody public Foo findById(@PathVariable("id") final Long id, final UriComponentsBuilder uriBuilder, final HttpServletResponse response) { @@ -43,7 +33,6 @@ public class FooController { } // read - multiple - @RequestMapping(method = RequestMethod.GET) @ResponseBody public List findAll() { diff --git a/spring-security-rest/src/main/java/org/baeldung/web/service/AsyncServiceImpl.java b/spring-security-rest/src/main/java/org/baeldung/web/service/AsyncServiceImpl.java index caaaa8e0dc..d6d7f53dd7 100644 --- a/spring-security-rest/src/main/java/org/baeldung/web/service/AsyncServiceImpl.java +++ b/spring-security-rest/src/main/java/org/baeldung/web/service/AsyncServiceImpl.java @@ -17,18 +17,18 @@ public class AsyncServiceImpl implements AsyncService { @Async @Override public void asyncCall() { - log.info("Inside the @Async logic: " + SecurityContextHolder.getContext().getAuthentication().getPrincipal()); + log.info("Inside the @Async logic: {}", SecurityContextHolder.getContext().getAuthentication().getPrincipal()); } @Override public Callable checkIfPrincipalPropagated() { Object before = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - log.info("Before new thread: " + before); + log.info("Before new thread: {}", before); return new Callable() { public Boolean call() throws Exception { Object after = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - log.info("New thread: " + after); + log.info("New thread: {}", after); return before == after; } }; diff --git a/spring-security-rest/src/main/resources/webSecurityConfig.xml b/spring-security-rest/src/main/resources/webSecurityConfig.xml index 4bb208a195..54bd0f91b9 100644 --- a/spring-security-rest/src/main/resources/webSecurityConfig.xml +++ b/spring-security-rest/src/main/resources/webSecurityConfig.xml @@ -9,6 +9,8 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd"> + + + @@ -44,5 +46,5 @@ - +--> \ No newline at end of file From 8ef39f81b42964da6914eeaa1259c18f4435cdd0 Mon Sep 17 00:00:00 2001 From: DOHA Date: Tue, 16 Oct 2018 23:04:15 +0300 Subject: [PATCH 47/87] string to byte array --- .../base64/StringToByteArrayUnitTest.java | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 java-strings/src/test/java/com/baeldung/java8/base64/StringToByteArrayUnitTest.java diff --git a/java-strings/src/test/java/com/baeldung/java8/base64/StringToByteArrayUnitTest.java b/java-strings/src/test/java/com/baeldung/java8/base64/StringToByteArrayUnitTest.java new file mode 100644 index 0000000000..5bb97e111a --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/java8/base64/StringToByteArrayUnitTest.java @@ -0,0 +1,60 @@ +package com.baeldung.java8.base64; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.Base64; + +import javax.xml.bind.DatatypeConverter; + +import org.junit.Test; + +public class StringToByteArrayUnitTest { + + @Test + public void whenConvertStringToByteArrayUsingStringClass_thenOk() { + final String originalInput = "test input"; + byte[] result = originalInput.getBytes(); + System.out.println(Arrays.toString(result)); + + assertEquals(originalInput.length(), result.length); + } + + @Test + public void givenCharset_whenConvertStringToByteArrayUsingStringClass_thenOk() throws UnsupportedEncodingException { + final String originalInput = "test input"; + byte[] result = originalInput.getBytes(StandardCharsets.UTF_16); + System.out.println(Arrays.toString(result)); + + assertTrue(originalInput.length() < result.length); + } + + @Test + public void whenConvertStringToByteArrayUsingBase64Decoder_thenOk() { + final String originalInput = "dGVzdCBpbnB1dA=="; + byte[] result = Base64.getDecoder().decode(originalInput); + + assertEquals("test input", new String(result)); + } + + @Test + public void whenConvertStringToByteArrayUsingDatatypeConverter_thenOk() { + final String originalInput = "dGVzdCBpbnB1dA=="; + byte[] result = DatatypeConverter.parseBase64Binary(originalInput); + + assertEquals("test input", new String(result)); + } + + @Test + public void whenConvertStringToByteArray_thenOk(){ + String originalInput = "7465737420696E707574"; + byte[] result = DatatypeConverter.parseHexBinary(originalInput); + System.out.println(Arrays.toString(result)); + + assertEquals("test input", new String(result)); + } + +} From 2f01b4305630a8b3d1d3b124f9b2fd30a77d2f4f Mon Sep 17 00:00:00 2001 From: azrairshad Date: Wed, 17 Oct 2018 10:06:37 -0400 Subject: [PATCH 48/87] BAEL-1547: Request method not supported - 405, examples. (#5464) --- .../controller/RequestMethodController.java | 25 +++++++++++++++++ .../exception/InvalidRequestException.java | 26 ++++++++++++++++++ .../spring/service/EmployeeService.java | 12 +++++++++ .../spring/service/EmployeeServiceImpl.java | 27 +++++++++++++++++++ 4 files changed, 90 insertions(+) create mode 100644 spring-mvc-simple/src/main/java/com/baeldung/spring/controller/RequestMethodController.java create mode 100644 spring-mvc-simple/src/main/java/com/baeldung/spring/exception/InvalidRequestException.java create mode 100644 spring-mvc-simple/src/main/java/com/baeldung/spring/service/EmployeeService.java create mode 100644 spring-mvc-simple/src/main/java/com/baeldung/spring/service/EmployeeServiceImpl.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/RequestMethodController.java b/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/RequestMethodController.java new file mode 100644 index 0000000000..03cf729ddf --- /dev/null +++ b/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/RequestMethodController.java @@ -0,0 +1,25 @@ +package com.baeldung.spring.controller; + +import com.baeldung.spring.domain.Employee; +import com.baeldung.spring.exception.InvalidRequestException; +import com.baeldung.spring.service.EmployeeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping(value="/api") +public class RequestMethodController { + + @Autowired + EmployeeService service; + + @RequestMapping(value = "/employees", produces = "application/json", method={RequestMethod.GET,RequestMethod.POST}) + public List findEmployees() + throws InvalidRequestException { + return service.getEmployeeList(); + } +} diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/exception/InvalidRequestException.java b/spring-mvc-simple/src/main/java/com/baeldung/spring/exception/InvalidRequestException.java new file mode 100644 index 0000000000..4dcbe86735 --- /dev/null +++ b/spring-mvc-simple/src/main/java/com/baeldung/spring/exception/InvalidRequestException.java @@ -0,0 +1,26 @@ +package com.baeldung.spring.exception; + +public class InvalidRequestException extends RuntimeException { + + /** + * + */ + private static final long serialVersionUID = 4088649120307193208L; + + public InvalidRequestException() { + super(); + } + + public InvalidRequestException(final String message, final Throwable cause) { + super(message, cause); + } + + public InvalidRequestException(final String message) { + super(message); + } + + public InvalidRequestException(final Throwable cause) { + super(cause); + } + +} diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/service/EmployeeService.java b/spring-mvc-simple/src/main/java/com/baeldung/spring/service/EmployeeService.java new file mode 100644 index 0000000000..4d87352c42 --- /dev/null +++ b/spring-mvc-simple/src/main/java/com/baeldung/spring/service/EmployeeService.java @@ -0,0 +1,12 @@ +package com.baeldung.spring.service; + +import com.baeldung.spring.domain.Employee; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public interface EmployeeService { + + List getEmployeeList(); +} diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/service/EmployeeServiceImpl.java b/spring-mvc-simple/src/main/java/com/baeldung/spring/service/EmployeeServiceImpl.java new file mode 100644 index 0000000000..18f2d70795 --- /dev/null +++ b/spring-mvc-simple/src/main/java/com/baeldung/spring/service/EmployeeServiceImpl.java @@ -0,0 +1,27 @@ +package com.baeldung.spring.service; + +import com.baeldung.spring.domain.Employee; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +@Service +public class EmployeeServiceImpl implements EmployeeService{ + + @Override + public List getEmployeeList() { + List employeeList = new ArrayList<>(); + employeeList.add(createEmployee(100L, "Steve Martin", "333-777-999")); + employeeList.add(createEmployee(200L, "Adam Schawn", "444-111-777")); + return employeeList; + } + + private Employee createEmployee(long id, String name, String contactNumber) { + Employee employee = new Employee(); + employee.setId(id); + employee.setName(name); + employee.setContactNumber(contactNumber); + return employee; + } +} From 6cabd68be52d97a55a7d0e71b757dd50344c0289 Mon Sep 17 00:00:00 2001 From: shreyasm Date: Wed, 17 Oct 2018 19:39:26 +0530 Subject: [PATCH 49/87] BAEL-2000 - Shreyas Mahajan - Adding a project for demonstrating Spring Boot Jib Maven Plugin (#5375) * BAEL-2000 - Shreyas Mahajan - Adding a project for demonstrating Spring Boot Jib Maven Plugin * BAEL-2000 - Shreyas Mahajan - Incorporating the changes * BAEL-2000 - Shreyas Mahajan - Renaming the module from spring-boot-jib to jib --- jib/pom.xml | 57 +++++++++++++++++++ .../main/java/com/baeldung/Application.java | 12 ++++ jib/src/main/java/com/baeldung/Greeting.java | 20 +++++++ .../java/com/baeldung/GreetingController.java | 20 +++++++ 4 files changed, 109 insertions(+) create mode 100644 jib/pom.xml create mode 100644 jib/src/main/java/com/baeldung/Application.java create mode 100644 jib/src/main/java/com/baeldung/Greeting.java create mode 100644 jib/src/main/java/com/baeldung/GreetingController.java diff --git a/jib/pom.xml b/jib/pom.xml new file mode 100644 index 0000000000..e71250f157 --- /dev/null +++ b/jib/pom.xml @@ -0,0 +1,57 @@ + + 4.0.0 + jib + 0.1-SNAPSHOT + jib + + + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-2 + + + + + org.springframework.boot + spring-boot-starter-web + + + + + 1.8 + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + com.google.cloud.tools + jib-maven-plugin + 0.9.10 + + + registry.hub.docker.com/baeldungjib/jib-spring-boot-app + + + + + + + + + spring-releases + https://repo.spring.io/libs-release + + + + + spring-releases + https://repo.spring.io/libs-release + + + diff --git a/jib/src/main/java/com/baeldung/Application.java b/jib/src/main/java/com/baeldung/Application.java new file mode 100644 index 0000000000..8c087476bf --- /dev/null +++ b/jib/src/main/java/com/baeldung/Application.java @@ -0,0 +1,12 @@ +package com.baeldung; + +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); + } +} \ No newline at end of file diff --git a/jib/src/main/java/com/baeldung/Greeting.java b/jib/src/main/java/com/baeldung/Greeting.java new file mode 100644 index 0000000000..62834d9752 --- /dev/null +++ b/jib/src/main/java/com/baeldung/Greeting.java @@ -0,0 +1,20 @@ +package com.baeldung; + +public class Greeting { + + private final long id; + private final String content; + + public Greeting(long id, String content) { + this.id = id; + this.content = content; + } + + public long getId() { + return id; + } + + public String getContent() { + return content; + } +} \ No newline at end of file diff --git a/jib/src/main/java/com/baeldung/GreetingController.java b/jib/src/main/java/com/baeldung/GreetingController.java new file mode 100644 index 0000000000..0b082b0001 --- /dev/null +++ b/jib/src/main/java/com/baeldung/GreetingController.java @@ -0,0 +1,20 @@ +package com.baeldung; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.concurrent.atomic.AtomicLong; + +@RestController +public class GreetingController { + + private static final String template = "Hello Docker, %s!"; + private final AtomicLong counter = new AtomicLong(); + + @GetMapping("/greeting") + public Greeting greeting(@RequestParam(value="name", defaultValue="World") String name) { + return new Greeting(counter.incrementAndGet(), + String.format(template, name)); + } +} \ No newline at end of file From 99d309b8c23e6810ef47e42a3513ef08633bd6ce Mon Sep 17 00:00:00 2001 From: Felipe Santiago Corro Date: Wed, 17 Oct 2018 14:29:47 -0300 Subject: [PATCH 50/87] BAEL-2237 Using Jackson to parse XML and return JSON (#5478) --- .../jackson/xmlToJson/XmlToJsonUnitTest.java | 43 +++++++------------ 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/jackson/src/test/java/com/baeldung/jackson/xmlToJson/XmlToJsonUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/xmlToJson/XmlToJsonUnitTest.java index 295bb9d6e8..6329a8ed2f 100644 --- a/jackson/src/test/java/com/baeldung/jackson/xmlToJson/XmlToJsonUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/xmlToJson/XmlToJsonUnitTest.java @@ -1,7 +1,5 @@ package com.baeldung.jackson.xmlToJson; - -import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.dataformat.xml.XmlMapper; @@ -14,43 +12,32 @@ import java.io.IOException; public class XmlToJsonUnitTest { @Test - public void givenAnXML_whenUseDataBidingToConvertToJSON_thenReturnDataOK() { + public void givenAnXML_whenUseDataBidingToConvertToJSON_thenReturnDataOK() throws IOException{ String flowerXML = "PoppyRED9"; - try { - XmlMapper xmlMapper = new XmlMapper(); - Flower poppy = xmlMapper.readValue(flowerXML, Flower.class); + XmlMapper xmlMapper = new XmlMapper(); + Flower poppy = xmlMapper.readValue(flowerXML, Flower.class); - assertEquals(poppy.getName(), "Poppy"); - assertEquals(poppy.getColor(), Color.RED); - assertEquals(poppy.getPetals(), new Integer(9)); + assertEquals(poppy.getName(), "Poppy"); + assertEquals(poppy.getColor(), Color.RED); + assertEquals(poppy.getPetals(), new Integer(9)); - ObjectMapper mapper = new ObjectMapper(); - String json = mapper.writeValueAsString(poppy); + ObjectMapper mapper = new ObjectMapper(); + String json = mapper.writeValueAsString(poppy); - assertEquals(json, "{\"name\":\"Poppy\",\"color\":\"RED\",\"petals\":9}"); - System.out.println(json); - } catch(IOException e) { - e.printStackTrace(); - } + assertEquals(json, "{\"name\":\"Poppy\",\"color\":\"RED\",\"petals\":9}"); } @Test - public void givenAnXML_whenUseATreeConvertToJSON_thenReturnDataOK() { + public void givenAnXML_whenUseATreeConvertToJSON_thenReturnDataOK() throws IOException { String flowerXML = "PoppyRED9"; - try { - XmlMapper xmlMapper = new XmlMapper(); - JsonNode node = xmlMapper.readTree(flowerXML.getBytes()); + XmlMapper xmlMapper = new XmlMapper(); + JsonNode node = xmlMapper.readTree(flowerXML.getBytes()); - ObjectMapper jsonMapper = new ObjectMapper(); - String json = jsonMapper.writeValueAsString(node); + ObjectMapper jsonMapper = new ObjectMapper(); + String json = jsonMapper.writeValueAsString(node); - System.out.println(json); - - assertEquals(json, "{\"name\":\"Poppy\",\"color\":\"RED\",\"petals\":\"9\"}"); - } catch(IOException e) { - e.printStackTrace(); - } + assertEquals(json, "{\"name\":\"Poppy\",\"color\":\"RED\",\"petals\":\"9\"}"); } } From ad0eb1ee7d7fe65aeeeba426034d83ad04716797 Mon Sep 17 00:00:00 2001 From: vizsoro Date: Wed, 17 Oct 2018 20:02:53 +0200 Subject: [PATCH 51/87] bael-2195 lombok builder default --- lombok/pom.xml | 1 + .../lombok/builder/defaultvalue/Pojo.java | 17 +++++++++++++ .../BuilderWithDefaultValueUnitTest.java | 25 +++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 lombok/src/main/java/com/baeldung/lombok/builder/defaultvalue/Pojo.java create mode 100644 lombok/src/test/java/com/baeldung/lombok/builder/defaultvalue/BuilderWithDefaultValueUnitTest.java diff --git a/lombok/pom.xml b/lombok/pom.xml index eba140122a..7ad2e3dc83 100644 --- a/lombok/pom.xml +++ b/lombok/pom.xml @@ -59,6 +59,7 @@ ${project.basedir}/src/main/java + ${project.build.directory}/delombok false skip diff --git a/lombok/src/main/java/com/baeldung/lombok/builder/defaultvalue/Pojo.java b/lombok/src/main/java/com/baeldung/lombok/builder/defaultvalue/Pojo.java new file mode 100644 index 0000000000..feaade9cd5 --- /dev/null +++ b/lombok/src/main/java/com/baeldung/lombok/builder/defaultvalue/Pojo.java @@ -0,0 +1,17 @@ +package com.baeldung.lombok.builder.defaultvalue; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@Builder(toBuilder = true) +@NoArgsConstructor +@AllArgsConstructor +public class Pojo { + private String name = "foo"; + private boolean original = true; +} diff --git a/lombok/src/test/java/com/baeldung/lombok/builder/defaultvalue/BuilderWithDefaultValueUnitTest.java b/lombok/src/test/java/com/baeldung/lombok/builder/defaultvalue/BuilderWithDefaultValueUnitTest.java new file mode 100644 index 0000000000..d9184f605c --- /dev/null +++ b/lombok/src/test/java/com/baeldung/lombok/builder/defaultvalue/BuilderWithDefaultValueUnitTest.java @@ -0,0 +1,25 @@ +package com.baeldung.lombok.builder.defaultvalue; + +import org.junit.Assert; +import org.junit.Test; + +public class BuilderWithDefaultValueUnitTest { + + @Test + public void givenBuilderWithDefaultValue_ThanDefaultValueIsPresent() { + Pojo build = new Pojo().toBuilder() + .build(); + Assert.assertEquals("foo", build.getName()); + Assert.assertTrue(build.isOriginal()); + } + + @Test + public void givenBuilderWithDefaultValue_NoArgsWorksAlso() { + Pojo build = new Pojo().toBuilder() + .build(); + Pojo pojo = new Pojo(); + Assert.assertEquals(build.getName(), pojo.getName()); + Assert.assertTrue(build.isOriginal() == pojo.isOriginal()); + } + +} From 03065a43e9f0652a6d64778d651779712ffcda05 Mon Sep 17 00:00:00 2001 From: fanatixan Date: Wed, 17 Oct 2018 21:54:35 +0200 Subject: [PATCH 52/87] moving heap sort from core-java to algorithms (#5475) --- .../src/main/java/com/baeldung/algorithms}/heapsort/Heap.java | 2 +- .../java/com/baeldung/algorithms}/heapsort/HeapUnitTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename {core-java/src/main/java/com/baeldung => algorithms/src/main/java/com/baeldung/algorithms}/heapsort/Heap.java (98%) rename {core-java/src/test/java/com/baeldung => algorithms/src/test/java/com/baeldung/algorithms}/heapsort/HeapUnitTest.java (95%) diff --git a/core-java/src/main/java/com/baeldung/heapsort/Heap.java b/algorithms/src/main/java/com/baeldung/algorithms/heapsort/Heap.java similarity index 98% rename from core-java/src/main/java/com/baeldung/heapsort/Heap.java rename to algorithms/src/main/java/com/baeldung/algorithms/heapsort/Heap.java index 95e0e1d8cd..8c98e4fc5c 100644 --- a/core-java/src/main/java/com/baeldung/heapsort/Heap.java +++ b/algorithms/src/main/java/com/baeldung/algorithms/heapsort/Heap.java @@ -1,4 +1,4 @@ -package com.baeldung.heapsort; +package com.baeldung.algorithms.heapsort; import java.util.ArrayList; import java.util.Arrays; diff --git a/core-java/src/test/java/com/baeldung/heapsort/HeapUnitTest.java b/algorithms/src/test/java/com/baeldung/algorithms/heapsort/HeapUnitTest.java similarity index 95% rename from core-java/src/test/java/com/baeldung/heapsort/HeapUnitTest.java rename to algorithms/src/test/java/com/baeldung/algorithms/heapsort/HeapUnitTest.java index cc3e49b6c9..96e4936eaf 100644 --- a/core-java/src/test/java/com/baeldung/heapsort/HeapUnitTest.java +++ b/algorithms/src/test/java/com/baeldung/algorithms/heapsort/HeapUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.heapsort; +package com.baeldung.algorithms.heapsort; import static org.assertj.core.api.Assertions.assertThat; From 831cdf2bd6a3f256e5fd5080536269c6b9657bbd Mon Sep 17 00:00:00 2001 From: Paul van Gool Date: Wed, 17 Oct 2018 13:00:14 -0700 Subject: [PATCH 53/87] BAEL-1215: Introduction to the Suanshu math library (#5469) * BAEL-1215: Introduction to the Suanshu math library * Updated examples based on feedback. --- libraries/pom.xml | 13 ++ .../com/baeldung/suanshu/SuanShuMath.java | 142 ++++++++++++++++++ 2 files changed, 155 insertions(+) create mode 100644 libraries/src/main/java/com/baeldung/suanshu/SuanShuMath.java diff --git a/libraries/pom.xml b/libraries/pom.xml index 6bbe8e6f1c..8ffd33272d 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -711,6 +711,12 @@ ${snakeyaml.version} + + com.numericalmethod + suanshu + ${suanshu.version} + + @@ -731,6 +737,12 @@ Apache Staging https://repository.apache.org/content/groups/staging + + nm-repo + Numerical Method's Maven Repository + http://repo.numericalmethod.com/maven/ + default + @@ -835,6 +847,7 @@ + 4.0.0 1.21 1.23.0 0.1.0 diff --git a/libraries/src/main/java/com/baeldung/suanshu/SuanShuMath.java b/libraries/src/main/java/com/baeldung/suanshu/SuanShuMath.java new file mode 100644 index 0000000000..46af24692d --- /dev/null +++ b/libraries/src/main/java/com/baeldung/suanshu/SuanShuMath.java @@ -0,0 +1,142 @@ +package com.baeldung.suanshu; + +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.numericalmethod.suanshu.algebra.linear.matrix.doubles.Matrix; +import com.numericalmethod.suanshu.algebra.linear.vector.doubles.Vector; +import com.numericalmethod.suanshu.algebra.linear.vector.doubles.dense.DenseVector; +import com.numericalmethod.suanshu.algebra.linear.matrix.doubles.matrixtype.dense.DenseMatrix; +import com.numericalmethod.suanshu.algebra.linear.matrix.doubles.operation.Inverse; +import com.numericalmethod.suanshu.analysis.function.polynomial.Polynomial; +import com.numericalmethod.suanshu.analysis.function.polynomial.root.PolyRoot; +import com.numericalmethod.suanshu.analysis.function.polynomial.root.PolyRootSolver; +import com.numericalmethod.suanshu.number.complex.Complex; + +class SuanShuMath { + + private static final Logger log = LoggerFactory.getLogger(SuanShuMath.class); + + public static void main(String[] args) throws Exception { + SuanShuMath math = new SuanShuMath(); + + math.addingVectors(); + math.scaleVector(); + math.innerProductVectors(); + math.addingIncorrectVectors(); + + math.addingMatrices(); + math.multiplyMatrices(); + math.multiplyIncorrectMatrices(); + math.inverseMatrix(); + + Polynomial p = math.createPolynomial(); + math.evaluatePolynomial(p); + math.solvePolynomial(); + } + + public void addingVectors() throws Exception { + Vector v1 = new DenseVector(new double[]{1, 2, 3, 4, 5}); + Vector v2 = new DenseVector(new double[]{5, 4, 3, 2, 1}); + Vector v3 = v1.add(v2); + log.info("Adding vectors: {}", v3); + } + + public void scaleVector() throws Exception { + Vector v1 = new DenseVector(new double[]{1, 2, 3, 4, 5}); + Vector v2 = v1.scaled(2.0); + log.info("Scaling a vector: {}", v2); + } + + public void innerProductVectors() throws Exception { + Vector v1 = new DenseVector(new double[]{1, 2, 3, 4, 5}); + Vector v2 = new DenseVector(new double[]{5, 4, 3, 2, 1}); + double inner = v1.innerProduct(v2); + log.info("Vector inner product: {}", inner); + } + + public void addingIncorrectVectors() throws Exception { + Vector v1 = new DenseVector(new double[]{1, 2, 3}); + Vector v2 = new DenseVector(new double[]{5, 4}); + Vector v3 = v1.add(v2); + log.info("Adding vectors: {}", v3); + } + + public void addingMatrices() throws Exception { + Matrix m1 = new DenseMatrix(new double[][]{ + {1, 2, 3}, + {4, 5, 6} + }); + + Matrix m2 = new DenseMatrix(new double[][]{ + {3, 2, 1}, + {6, 5, 4} + }); + + Matrix m3 = m1.add(m2); + log.info("Adding matrices: {}", m3); + } + + public void multiplyMatrices() throws Exception { + Matrix m1 = new DenseMatrix(new double[][]{ + {1, 2, 3}, + {4, 5, 6} + }); + + Matrix m2 = new DenseMatrix(new double[][]{ + {1, 4}, + {2, 5}, + {3, 6} + }); + + Matrix m3 = m1.multiply(m2); + log.info("Multiplying matrices: {}", m3); + } + + public void multiplyIncorrectMatrices() throws Exception { + Matrix m1 = new DenseMatrix(new double[][]{ + {1, 2, 3}, + {4, 5, 6} + }); + + Matrix m2 = new DenseMatrix(new double[][]{ + {3, 2, 1}, + {6, 5, 4} + }); + + Matrix m3 = m1.multiply(m2); + log.info("Multiplying matrices: {}", m3); + } + + public void inverseMatrix() { + Matrix m1 = new DenseMatrix(new double[][]{ + {1, 2}, + {3, 4} + }); + + Inverse m2 = new Inverse(m1); + log.info("Inverting a matrix: {}", m2); + log.info("Verifying a matrix inverse: {}", m1.multiply(m2)); + } + + public Polynomial createPolynomial() { + return new Polynomial(new double[]{3, -5, 1}); + } + + public void evaluatePolynomial(Polynomial p) { + // Evaluate using a real number + log.info("Evaluating a polynomial using a real number: {}", p.evaluate(5)); + // Evaluate using a complex number + log.info("Evaluating a polynomial using a complex number: {}", p.evaluate(new Complex(1, 2))); + } + + public void solvePolynomial() { + Polynomial p = new Polynomial(new double[]{2, 2, -4}); + PolyRootSolver solver = new PolyRoot(); + List roots = solver.solve(p); + log.info("Finding polynomial roots: {}", roots); + } + +} From 8c3598b441a3e5f0ba2e3ab887c3d1633ce23638 Mon Sep 17 00:00:00 2001 From: the-java-guy <39062630+the-java-guy@users.noreply.github.com> Date: Thu, 18 Oct 2018 09:41:25 +0530 Subject: [PATCH 54/87] BAEL - 2166 (#5379) * Bean Object, server side and client side example for event streaming example * BAEL-1628 Access a File from the Classpath in a Spring Application * inputstream retrieval added * Removed files related to evaluation article * + Aligning code to the article. Removed Utility methods and classes * Precommit fix * PMD fixes * Code Review changes Refactored : whenResourceUtils_thenReadSuccessful * BAEL-1934 * +indentation correction in pom.xml * synced with master * Precommit : rebase * BAEL-1782 * BAEL - 2166 : Password Generation * Removed unnecessary javaDoc * Segregated utility method --- java-strings/pom.xml | 12 +- .../password/RandomPasswordGenerator.java | 152 ++++++++++++++++++ .../password/StringPasswordUnitTest.java | 64 ++++++++ 3 files changed, 227 insertions(+), 1 deletion(-) create mode 100644 java-strings/src/main/java/com/baeldung/string/password/RandomPasswordGenerator.java create mode 100644 java-strings/src/test/java/com/baeldung/string/password/StringPasswordUnitTest.java diff --git a/java-strings/pom.xml b/java-strings/pom.xml index b1ba49b33a..a43490ce5c 100644 --- a/java-strings/pom.xml +++ b/java-strings/pom.xml @@ -68,7 +68,17 @@ emoji-java 4.0.0 - + + + org.passay + passay + 1.3.1 + + + org.apache.commons + commons-text + 1.4 + diff --git a/java-strings/src/main/java/com/baeldung/string/password/RandomPasswordGenerator.java b/java-strings/src/main/java/com/baeldung/string/password/RandomPasswordGenerator.java new file mode 100644 index 0000000000..46af4d7c51 --- /dev/null +++ b/java-strings/src/main/java/com/baeldung/string/password/RandomPasswordGenerator.java @@ -0,0 +1,152 @@ +package com.baeldung.string.password; + +import java.security.SecureRandom; +import java.util.Collections; +import java.util.List; +import java.util.Random; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.Stream; + +import org.apache.commons.lang3.RandomStringUtils; +import org.apache.commons.text.RandomStringGenerator; +import org.passay.CharacterData; +import org.passay.CharacterRule; +import org.passay.EnglishCharacterData; +import org.passay.PasswordGenerator; + +public class RandomPasswordGenerator { + + /** + * Special characters allowed in password. + */ + public static final String ALLOWED_SPL_CHARACTERS = "!@#$%^&*()_+"; + + public static final String ERROR_CODE = "ERRONEOUS_SPECIAL_CHARS"; + + Random random = new SecureRandom(); + + public String generatePassayPassword() { + PasswordGenerator gen = new PasswordGenerator(); + CharacterData lowerCaseChars = EnglishCharacterData.LowerCase; + CharacterRule lowerCaseRule = new CharacterRule(lowerCaseChars); + lowerCaseRule.setNumberOfCharacters(2); + CharacterData upperCaseChars = EnglishCharacterData.UpperCase; + CharacterRule upperCaseRule = new CharacterRule(upperCaseChars); + upperCaseRule.setNumberOfCharacters(2); + CharacterData digitChars = EnglishCharacterData.Digit; + CharacterRule digitRule = new CharacterRule(digitChars); + digitRule.setNumberOfCharacters(2); + CharacterData specialChars = new CharacterData() { + public String getErrorCode() { + return ERROR_CODE; + } + + public String getCharacters() { + return ALLOWED_SPL_CHARACTERS; + } + }; + CharacterRule splCharRule = new CharacterRule(specialChars); + splCharRule.setNumberOfCharacters(2); + String password = gen.generatePassword(10, splCharRule, lowerCaseRule, upperCaseRule, digitRule); + return password; + } + + public String generateCommonTextPassword() { + String pwString = generateRandomSpecialCharacters(2).concat(generateRandomNumbers(2)) + .concat(generateRandomAlphabet(2, true)) + .concat(generateRandomAlphabet(2, false)) + .concat(generateRandomCharacters(2)); + List pwChars = pwString.chars() + .mapToObj(data -> (char) data) + .collect(Collectors.toList()); + Collections.shuffle(pwChars); + String password = pwChars.stream() + .collect(StringBuilder::new, StringBuilder::append, StringBuilder::append) + .toString(); + return password; + } + + public String generateCommonsLang3Password() { + String upperCaseLetters = RandomStringUtils.random(2, 65, 90, true, true); + String lowerCaseLetters = RandomStringUtils.random(2, 97, 122, true, true); + String numbers = RandomStringUtils.randomNumeric(2); + String specialChar = RandomStringUtils.random(2, 33, 47, false, false); + String totalChars = RandomStringUtils.randomAlphanumeric(2); + String combinedChars = upperCaseLetters.concat(lowerCaseLetters) + .concat(numbers) + .concat(specialChar) + .concat(totalChars); + List pwdChars = combinedChars.chars() + .mapToObj(c -> (char) c) + .collect(Collectors.toList()); + Collections.shuffle(pwdChars); + String password = pwdChars.stream() + .collect(StringBuilder::new, StringBuilder::append, StringBuilder::append) + .toString(); + return password; + } + + public String generateSecureRandomPassword() { + Stream pwdStream = Stream.concat(getRandomNumbers(2), Stream.concat(getRandomSpecialChars(2), Stream.concat(getRandomAlphabets(2, true), getRandomAlphabets(4, false)))); + List charList = pwdStream.collect(Collectors.toList()); + Collections.shuffle(charList); + String password = charList.stream() + .collect(StringBuilder::new, StringBuilder::append, StringBuilder::append) + .toString(); + return password; + } + + public String generateRandomSpecialCharacters(int length) { + RandomStringGenerator pwdGenerator = new RandomStringGenerator.Builder().withinRange(33, 45) + .build(); + return pwdGenerator.generate(length); + } + + public String generateRandomNumbers(int length) { + RandomStringGenerator pwdGenerator = new RandomStringGenerator.Builder().withinRange(48, 57) + .build(); + return pwdGenerator.generate(length); + } + + public String generateRandomCharacters(int length) { + RandomStringGenerator pwdGenerator = new RandomStringGenerator.Builder().withinRange(48, 57) + .build(); + return pwdGenerator.generate(length); + } + + public String generateRandomAlphabet(int length, boolean lowerCase) { + int low; + int hi; + if (lowerCase) { + low = 97; + hi = 122; + } else { + low = 65; + hi = 90; + } + RandomStringGenerator pwdGenerator = new RandomStringGenerator.Builder().withinRange(low, hi) + .build(); + return pwdGenerator.generate(length); + } + + public Stream getRandomAlphabets(int count, boolean upperCase) { + IntStream characters = null; + if (upperCase) { + characters = random.ints(count, 65, 90); + } else { + characters = random.ints(count, 97, 122); + } + return characters.mapToObj(data -> (char) data); + } + + public Stream getRandomNumbers(int count) { + IntStream numbers = random.ints(count, 48, 57); + return numbers.mapToObj(data -> (char) data); + } + + public Stream getRandomSpecialChars(int count) { + IntStream specialChars = random.ints(count, 33, 45); + return specialChars.mapToObj(data -> (char) data); + } +} diff --git a/java-strings/src/test/java/com/baeldung/string/password/StringPasswordUnitTest.java b/java-strings/src/test/java/com/baeldung/string/password/StringPasswordUnitTest.java new file mode 100644 index 0000000000..bfd4b0fe8e --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/password/StringPasswordUnitTest.java @@ -0,0 +1,64 @@ +package com.baeldung.string.password; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +/** + * Examples of passwords conforming to various specifications, using different libraries. + * + */ +public class StringPasswordUnitTest { + + RandomPasswordGenerator passGen = new RandomPasswordGenerator(); + + @Test + public void whenPasswordGeneratedUsingPassay_thenSuccessful() { + String password = passGen.generatePassayPassword(); + int specialCharCount = 0; + for (char c : password.toCharArray()) { + if (c >= 33 || c <= 47) { + specialCharCount++; + } + } + assertTrue("Password validation failed in Passay", specialCharCount >= 2); + } + + @Test + public void whenPasswordGeneratedUsingCommonsText_thenSuccessful() { + RandomPasswordGenerator passGen = new RandomPasswordGenerator(); + String password = passGen.generateCommonTextPassword(); + int lowerCaseCount = 0; + for (char c : password.toCharArray()) { + if (c >= 97 || c <= 122) { + lowerCaseCount++; + } + } + assertTrue("Password validation failed in commons-text ", lowerCaseCount >= 2); + } + + @Test + public void whenPasswordGeneratedUsingCommonsLang3_thenSuccessful() { + String password = passGen.generateCommonsLang3Password(); + int numCount = 0; + for (char c : password.toCharArray()) { + if (c >= 48 || c <= 57) { + numCount++; + } + } + assertTrue("Password validation failed in commons-lang3", numCount >= 2); + } + + @Test + public void whenPasswordGeneratedUsingSecureRandom_thenSuccessful() { + String password = passGen.generateSecureRandomPassword(); + int specialCharCount = 0; + for (char c : password.toCharArray()) { + if (c >= 33 || c <= 47) { + specialCharCount++; + } + } + assertTrue("Password validation failed in Secure Random", specialCharCount >= 2); + } + +} From a982f70f28391c406e5aadcd96207f4efde98599 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Thu, 18 Oct 2018 19:49:28 +0530 Subject: [PATCH 55/87] Update pom.xml --- spring-security-rest/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/spring-security-rest/pom.xml b/spring-security-rest/pom.xml index 70967ce214..ef16f2201b 100644 --- a/spring-security-rest/pom.xml +++ b/spring-security-rest/pom.xml @@ -297,5 +297,4 @@ 1.6.1 - From ef3614a5a01812d0db40b1561948f06b2d1dfd17 Mon Sep 17 00:00:00 2001 From: mstefanec <42640465+mstefanec@users.noreply.github.com> Date: Thu, 18 Oct 2018 17:47:27 +0200 Subject: [PATCH 56/87] Programatical sequences in project reactor (#5482) * Added programatically creating sequences in project reactor * Added programatically creating sequences in project reactor --- .../baeldung/reactor/ItemProducerCreate.java | 44 ++++++++++++++ .../reactor/NetworTrafficProducerPush.java | 34 +++++++++++ .../reactor/ProgramaticSequences.java | 58 +++++++++++++++++++ .../baeldung/reactor/StatelessGenerate.java | 24 ++++++++ 4 files changed, 160 insertions(+) create mode 100644 reactor-core/src/main/java/com/baeldung/reactor/ItemProducerCreate.java create mode 100644 reactor-core/src/main/java/com/baeldung/reactor/NetworTrafficProducerPush.java create mode 100644 reactor-core/src/main/java/com/baeldung/reactor/ProgramaticSequences.java create mode 100644 reactor-core/src/main/java/com/baeldung/reactor/StatelessGenerate.java diff --git a/reactor-core/src/main/java/com/baeldung/reactor/ItemProducerCreate.java b/reactor-core/src/main/java/com/baeldung/reactor/ItemProducerCreate.java new file mode 100644 index 0000000000..6078f8ef0b --- /dev/null +++ b/reactor-core/src/main/java/com/baeldung/reactor/ItemProducerCreate.java @@ -0,0 +1,44 @@ +package com.baeldung.reactor; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.Consumer; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import reactor.core.publisher.Flux; + +public class ItemProducerCreate { + + Logger logger = LoggerFactory.getLogger(NetworTrafficProducerPush.class); + + Consumer> listener; + + public void create() { + Flux articlesFlux = Flux.create((sink) -> { + ItemProducerCreate.this.listener = (items) -> { + items.stream() + .forEach(article -> sink.next(article)); + }; + }); + articlesFlux.subscribe(ItemProducerCreate.this.logger::info); + } + + public static void main(String[] args) { + ItemProducerCreate producer = new ItemProducerCreate(); + producer.create(); + + new Thread(new Runnable() { + + @Override + public void run() { + List items = new ArrayList<>(); + items.add("Item 1"); + items.add("Item 2"); + items.add("Item 3"); + producer.listener.accept(items); + } + }).start(); + } +} diff --git a/reactor-core/src/main/java/com/baeldung/reactor/NetworTrafficProducerPush.java b/reactor-core/src/main/java/com/baeldung/reactor/NetworTrafficProducerPush.java new file mode 100644 index 0000000000..807ceae84d --- /dev/null +++ b/reactor-core/src/main/java/com/baeldung/reactor/NetworTrafficProducerPush.java @@ -0,0 +1,34 @@ +package com.baeldung.reactor; + +import java.util.function.Consumer; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import reactor.core.publisher.Flux; +import reactor.core.publisher.FluxSink.OverflowStrategy; + +public class NetworTrafficProducerPush { + + Logger logger = LoggerFactory.getLogger(NetworTrafficProducerPush.class); + + Consumer listener; + + public void subscribe(Consumer consumer) { + Flux flux = Flux.push(sink -> { + NetworTrafficProducerPush.this.listener = (t) -> sink.next(t); + }, OverflowStrategy.DROP); + flux.subscribe(consumer); + } + + public void onPacket(String packet) { + listener.accept(packet); + } + + public static void main(String[] args) { + NetworTrafficProducerPush trafficProducer = new NetworTrafficProducerPush(); + trafficProducer.subscribe(trafficProducer.logger::info); + trafficProducer.onPacket("Packet[A18]"); + } + +} diff --git a/reactor-core/src/main/java/com/baeldung/reactor/ProgramaticSequences.java b/reactor-core/src/main/java/com/baeldung/reactor/ProgramaticSequences.java new file mode 100644 index 0000000000..b52def377d --- /dev/null +++ b/reactor-core/src/main/java/com/baeldung/reactor/ProgramaticSequences.java @@ -0,0 +1,58 @@ +package com.baeldung.reactor; + +import java.util.concurrent.atomic.AtomicInteger; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import reactor.core.publisher.Flux; + +public class ProgramaticSequences { + + Logger logger = LoggerFactory.getLogger(ProgramaticSequences.class); + + public void statefullImutableGenerate() { + Flux flux = Flux.generate(() -> 1, (state, sink) -> { + sink.next("2 + " + state + " = " + 2 + state); + if (state == 101) + sink.complete(); + return state + 1; + }); + + flux.subscribe(logger::info); + } + + public void statefullMutableGenerate() { + Flux flux = Flux.generate(AtomicInteger::new, (state, sink) -> { + int i = state.getAndIncrement(); + sink.next("2 + " + state + " = " + 2 + state); + if (i == 101) + sink.complete(); + return state; + }); + + flux.subscribe(logger::info); + } + + public void handle() { + Flux elephants = Flux.just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) + .handle((i, sink) -> { + String animal = "Elephant nr " + i; + if (i % 2 == 0) { + sink.next(animal); + } + }); + + elephants.subscribe(logger::info); + } + + public static void main(String[] args) { + ProgramaticSequences ps = new ProgramaticSequences(); + + ps.statefullImutableGenerate(); + ps.statefullMutableGenerate(); + ps.handle(); + + } + +} diff --git a/reactor-core/src/main/java/com/baeldung/reactor/StatelessGenerate.java b/reactor-core/src/main/java/com/baeldung/reactor/StatelessGenerate.java new file mode 100644 index 0000000000..c82f8e160b --- /dev/null +++ b/reactor-core/src/main/java/com/baeldung/reactor/StatelessGenerate.java @@ -0,0 +1,24 @@ +package com.baeldung.reactor; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import reactor.core.publisher.Flux; + +public class StatelessGenerate { + + Logger logger = LoggerFactory.getLogger(StatelessGenerate.class); + + public void statelessGenerate() { + Flux flux = Flux.generate((sink) -> { + sink.next("hallo"); + }); + flux.subscribe(logger::info); + } + + public static void main(String[] args) { + StatelessGenerate ps = new StatelessGenerate(); + ps.statelessGenerate(); + } + +} From c1e522d38c9db01136c27efde516471c9be4f280 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Thu, 18 Oct 2018 21:26:37 +0530 Subject: [PATCH 57/87] BAEL-9654 Activating multiple profiles for Travis CI (#5483) -Modified travis.yml to execute both default-first and default-second profile --- .travis.yml | 2 +- pom.xml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5e2d690b4e..683422dc97 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ before_install: - echo "MAVEN_OPTS='-Xmx2048M -Xss128M -XX:+CMSClassUnloadingEnabled -XX:+UseG1GC -XX:-UseGCOverheadLimit'" > ~/.mavenrc install: skip -script: travis_wait 60 mvn -q install -Pdefault +script: travis_wait 60 mvn -q install -Pdefault-first,default-second sudo: required diff --git a/pom.xml b/pom.xml index beb10b3287..a0c54f4b8a 100644 --- a/pom.xml +++ b/pom.xml @@ -458,7 +458,6 @@ spring-5 spring-5-data-reactive spring-5-reactive - spring-data-5-reactive/spring-5-data-reactive-redis spring-5-reactive-security spring-5-reactive-client spring-5-mvc From cb9ffa4a4ac026386a398f502421bdb03af589a5 Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Thu, 18 Oct 2018 21:16:33 +0200 Subject: [PATCH 58/87] 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 9e38dfc47d..84c91c5f6e 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -156,3 +156,4 @@ - [ZoneOffset in Java](https://www.baeldung.com/java-zone-offset) - [Hashing a Password in Java](https://www.baeldung.com/java-password-hashing) - [Java Switch Statement](https://www.baeldung.com/java-switch) +- [The Modulo Operator in Java](https://www.baeldung.com/modulo-java) From 6fd52ad66c9c6c29cea89f55084e1ed5f7ac6252 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Thu, 18 Oct 2018 22:59:29 +0300 Subject: [PATCH 59/87] Update StringToByteArrayUnitTest.java --- .../com/baeldung/java8/base64/StringToByteArrayUnitTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/java-strings/src/test/java/com/baeldung/java8/base64/StringToByteArrayUnitTest.java b/java-strings/src/test/java/com/baeldung/java8/base64/StringToByteArrayUnitTest.java index 5bb97e111a..c5f7051c25 100644 --- a/java-strings/src/test/java/com/baeldung/java8/base64/StringToByteArrayUnitTest.java +++ b/java-strings/src/test/java/com/baeldung/java8/base64/StringToByteArrayUnitTest.java @@ -56,5 +56,4 @@ public class StringToByteArrayUnitTest { assertEquals("test input", new String(result)); } - } From 8caaf775568fee31ae5ad0b9e511b79d8bb30cc7 Mon Sep 17 00:00:00 2001 From: KevinGilmore Date: Thu, 18 Oct 2018 21:55:28 -0500 Subject: [PATCH 60/87] BAEL-2200 and BAEL-2287 README updates (#5487) * BAEL-1766: Update README * BAEL-1853: add link to article * BAEL-1801: add link to article * Added links back to articles * Add links back to articles * BAEL-1795: Update README * BAEL-1901 and BAEL-1555 add links back to article * BAEL-2026 add link back to article * BAEL-2029: add link back to article * BAEL-1898: Add link back to article * BAEL-2102 and BAEL-2131 Add links back to articles * BAEL-2132 Add link back to article * BAEL-1980: add link back to article * BAEL-2200: Display auto-configuration report in Spring Boot * BAEL-2253: Add link back to article * BAEL-2200 BAEL-2287 Add links back to articles --- core-java-collections/README.md | 1 + spring-boot/README.MD | 1 + 2 files changed, 2 insertions(+) diff --git a/core-java-collections/README.md b/core-java-collections/README.md index aef640634e..e366232f74 100644 --- a/core-java-collections/README.md +++ b/core-java-collections/README.md @@ -55,3 +55,4 @@ - [Sort a HashMap in Java](https://www.baeldung.com/java-hashmap-sort) - [Finding the Highest Value in a Java Map](https://www.baeldung.com/java-find-map-max) - [Operating on and Removing an Item from Stream](https://www.baeldung.com/java-use-remove-item-stream) +- [An Introduction to Synchronized Java Collections](https://www.baeldung.com/java-synchronized-collections) diff --git a/spring-boot/README.MD b/spring-boot/README.MD index 192c4f9fed..aed2d2c5f8 100644 --- a/spring-boot/README.MD +++ b/spring-boot/README.MD @@ -34,3 +34,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Introduction to Chaos Monkey](https://www.baeldung.com/spring-boot-chaos-monkey) - [Spring Component Scanning](https://www.baeldung.com/spring-component-scanning) - [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) From 361448cc396f2508cca8b66e80f25f549ee8bde9 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Fri, 19 Oct 2018 12:23:39 +0530 Subject: [PATCH 61/87] [BAEL-9547] - Moved 3 articles from guava to guava-collections --- guava-collections/README.md | 5 ++++- .../java/org/baeldung/guava/ClassToInstanceMapUnitTest.java | 0 .../src/test/java/org/baeldung/guava/GuavaTableUnitTest.java | 0 guava/README.md | 3 --- 4 files changed, 4 insertions(+), 4 deletions(-) rename {guava => guava-collections}/src/test/java/org/baeldung/guava/ClassToInstanceMapUnitTest.java (100%) rename {guava => guava-collections}/src/test/java/org/baeldung/guava/GuavaTableUnitTest.java (100%) diff --git a/guava-collections/README.md b/guava-collections/README.md index eb1eb1d35c..fc9cf549c3 100644 --- a/guava-collections/README.md +++ b/guava-collections/README.md @@ -17,4 +17,7 @@ - [Guide to Guava RangeSet](http://www.baeldung.com/guava-rangeset) - [Guide to Guava RangeMap](http://www.baeldung.com/guava-rangemap) - [Guide to Guava MinMaxPriorityQueue and EvictingQueue](http://www.baeldung.com/guava-minmax-priority-queue-and-evicting-queue) -- [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap) \ No newline at end of file +- [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap) +- [Guava Set + Function = Map](http://www.baeldung.com/guava-set-function-map-tutorial) +- [Guide to Guava Table](http://www.baeldung.com/guava-table) +- [Guide to Guava ClassToInstanceMap](http://www.baeldung.com/guava-class-to-instance-map) \ No newline at end of file diff --git a/guava/src/test/java/org/baeldung/guava/ClassToInstanceMapUnitTest.java b/guava-collections/src/test/java/org/baeldung/guava/ClassToInstanceMapUnitTest.java similarity index 100% rename from guava/src/test/java/org/baeldung/guava/ClassToInstanceMapUnitTest.java rename to guava-collections/src/test/java/org/baeldung/guava/ClassToInstanceMapUnitTest.java diff --git a/guava/src/test/java/org/baeldung/guava/GuavaTableUnitTest.java b/guava-collections/src/test/java/org/baeldung/guava/GuavaTableUnitTest.java similarity index 100% rename from guava/src/test/java/org/baeldung/guava/GuavaTableUnitTest.java rename to guava-collections/src/test/java/org/baeldung/guava/GuavaTableUnitTest.java diff --git a/guava/README.md b/guava/README.md index 7501bf08de..56e6aff50c 100644 --- a/guava/README.md +++ b/guava/README.md @@ -6,15 +6,12 @@ ### Relevant Articles: - [Guava Functional Cookbook](http://www.baeldung.com/guava-functions-predicates) - [Guava – Write to File, Read from File](http://www.baeldung.com/guava-write-to-file-read-from-file) -- [Guava Set + Function = Map](http://www.baeldung.com/guava-set-function-map-tutorial) - [Guide to Guava’s Ordering](http://www.baeldung.com/guava-ordering) - [Guide to Guava’s PreConditions](http://www.baeldung.com/guava-preconditions) - [Introduction to Guava CacheLoader](http://www.baeldung.com/guava-cacheloader) - [Introduction to Guava Memoizer](http://www.baeldung.com/guava-memoizer) - [Guide to Guava’s EventBus](http://www.baeldung.com/guava-eventbus) -- [Guide to Guava Table](http://www.baeldung.com/guava-table) - [Guide to Guava’s Reflection Utilities](http://www.baeldung.com/guava-reflection) -- [Guide to Guava ClassToInstanceMap](http://www.baeldung.com/guava-class-to-instance-map) - [Guide to Mathematical Utilities in Guava](http://www.baeldung.com/guava-math) - [Bloom Filter in Java using Guava](http://www.baeldung.com/guava-bloom-filter) - [Using Guava CountingOutputStream](http://www.baeldung.com/guava-counting-outputstream) From e2d1f25dc57c34efaf6929e7d933bfa3b482888e Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Fri, 19 Oct 2018 19:37:21 +0530 Subject: [PATCH 62/87] BAEL-9467 Update Spring Security article - Upgraded xml schema versions to latest --- spring-security-rest/src/main/resources/webSecurityConfig.xml | 4 ++-- spring-security-rest/src/main/webapp/WEB-INF/api-servlet.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-security-rest/src/main/resources/webSecurityConfig.xml b/spring-security-rest/src/main/resources/webSecurityConfig.xml index 54bd0f91b9..edd3cba39c 100644 --- a/spring-security-rest/src/main/resources/webSecurityConfig.xml +++ b/spring-security-rest/src/main/resources/webSecurityConfig.xml @@ -5,9 +5,9 @@ xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation=" http://www.springframework.org/schema/security - http://www.springframework.org/schema/security/spring-security-4.2.xsd + http://www.springframework.org/schema/security/spring-security.xsd http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans-4.2.xsd"> + http://www.springframework.org/schema/beans/spring-beans.xsd"> core-java core-java-collections + java-collections-conversions + java-collections-maps core-java-io core-java-8 java-streams @@ -1270,6 +1272,8 @@ java-strings core-java-collections + java-collections-conversions + java-collections-maps core-java-io core-java-8 java-streams From 0b210ac086ca8d064f7a0a1f3c92c73ae5ad04a2 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sat, 20 Oct 2018 01:23:54 +0530 Subject: [PATCH 68/87] [BAEL-9515] - Added spring boot version property for artifact and plugin dependency --- parent-boot-1/pom.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/parent-boot-1/pom.xml b/parent-boot-1/pom.xml index d220b4a6b7..0f1086fa31 100644 --- a/parent-boot-1/pom.xml +++ b/parent-boot-1/pom.xml @@ -17,7 +17,7 @@ org.springframework.boot spring-boot-dependencies - 1.5.16.RELEASE + ${spring-boot.version} pom import @@ -42,7 +42,7 @@ org.springframework.boot spring-boot-maven-plugin - 1.5.15.RELEASE + ${spring-boot.version} @@ -50,6 +50,7 @@ 3.1.0 + 1.5.16.RELEASE \ No newline at end of file From dc0cf74266999e940a08e3cfb70e2e034e04388c Mon Sep 17 00:00:00 2001 From: amit2103 Date: Mon, 15 Oct 2018 00:05:22 +0530 Subject: [PATCH 69/87] [BAEL-9516] - Added latest version of spring 2 --- parent-boot-2/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parent-boot-2/pom.xml b/parent-boot-2/pom.xml index de6cb5d068..b014181d65 100644 --- a/parent-boot-2/pom.xml +++ b/parent-boot-2/pom.xml @@ -17,7 +17,7 @@ org.springframework.boot spring-boot-dependencies - 2.0.4.RELEASE + 2.0.5.RELEASE pom import From 296e9c03cc84c278f30381817695563a0a51c4e3 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sat, 20 Oct 2018 01:33:02 +0530 Subject: [PATCH 70/87] [BAEL-9516] - Added spring boot version property for artifact and plugin dependency --- parent-boot-2/pom.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/parent-boot-2/pom.xml b/parent-boot-2/pom.xml index b014181d65..ba98898987 100644 --- a/parent-boot-2/pom.xml +++ b/parent-boot-2/pom.xml @@ -17,7 +17,7 @@ org.springframework.boot spring-boot-dependencies - 2.0.5.RELEASE + ${spring-boot.version} pom import @@ -41,7 +41,7 @@ org.springframework.boot spring-boot-maven-plugin - 2.0.4.RELEASE + ${spring-boot.version} @@ -73,6 +73,7 @@ 3.1.0 1.0.11.RELEASE + 2.0.5.RELEASE \ No newline at end of file From 2404312d20387c11599e7b23c428fb23947e24b9 Mon Sep 17 00:00:00 2001 From: Adam InTae Gerard Date: Fri, 19 Oct 2018 21:29:05 -0700 Subject: [PATCH 71/87] BAEL-1909 (#5366) --- spring-5-reactive/README.md | 1 + spring-5-reactive/pom.xml | 22 +++++++ .../com/baeldung/websession/Application.java | 15 +++++ .../websession/configuration/RedisConfig.java | 17 ++++++ .../configuration/SessionConfig.java | 20 +++++++ .../configuration/WebFluxConfig.java | 20 +++++++ .../configuration/WebFluxSecurityConfig.java | 58 +++++++++++++++++++ .../controller/SessionController.java | 42 ++++++++++++++ .../websession/transfer/CustomResponse.java | 31 ++++++++++ 9 files changed, 226 insertions(+) create mode 100644 spring-5-reactive/src/main/java/com/baeldung/websession/Application.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/websession/configuration/RedisConfig.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/websession/configuration/SessionConfig.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/websession/configuration/WebFluxConfig.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/websession/configuration/WebFluxSecurityConfig.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/websession/controller/SessionController.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/websession/transfer/CustomResponse.java diff --git a/spring-5-reactive/README.md b/spring-5-reactive/README.md index 7977fd820f..1431554882 100644 --- a/spring-5-reactive/README.md +++ b/spring-5-reactive/README.md @@ -14,3 +14,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Spring Webflux and CORS](http://www.baeldung.com/spring-webflux-cors) - [Handling Errors in Spring WebFlux](http://www.baeldung.com/spring-webflux-errors) - [Server-Sent Events in Spring](https://www.baeldung.com/spring-server-sent-events) +- [A Guide to Spring Session Reactive Support: WebSession](https://www.baeldung.com/a-guide-to-spring-session-reactive-support-websession/) \ No newline at end of file diff --git a/spring-5-reactive/pom.xml b/spring-5-reactive/pom.xml index 5f455c3906..e903b57c4e 100644 --- a/spring-5-reactive/pom.xml +++ b/spring-5-reactive/pom.xml @@ -76,6 +76,28 @@ test + + + org.springframework.boot + spring-boot-starter-webflux + + + org.springframework.boot + spring-boot-starter-data-redis + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.session + spring-session-core + + + org.springframework.session + spring-session-data-redis + + org.apache.commons commons-collections4 diff --git a/spring-5-reactive/src/main/java/com/baeldung/websession/Application.java b/spring-5-reactive/src/main/java/com/baeldung/websession/Application.java new file mode 100644 index 0000000000..667ef29658 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/websession/Application.java @@ -0,0 +1,15 @@ +package com.baeldung.websession; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; + +@SpringBootApplication +@ComponentScan(basePackages = {"com.baeldung"}) +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} \ No newline at end of file diff --git a/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/RedisConfig.java b/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/RedisConfig.java new file mode 100644 index 0000000000..aa85cf9fd9 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/RedisConfig.java @@ -0,0 +1,17 @@ +package com.baeldung.websession.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; +import org.springframework.session.data.redis.config.annotation.web.server.EnableRedisWebSession; + +@Configuration +//@EnableRedisWebSession +public class RedisConfig { +/** + @Bean + public LettuceConnectionFactory redisConnectionFactory() { + return new LettuceConnectionFactory(); + } +*/ +} \ No newline at end of file diff --git a/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/SessionConfig.java b/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/SessionConfig.java new file mode 100644 index 0000000000..7cb2ff680e --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/SessionConfig.java @@ -0,0 +1,20 @@ +package com.baeldung.websession.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.session.ReactiveMapSessionRepository; +import org.springframework.session.ReactiveSessionRepository; +import org.springframework.session.config.annotation.web.server.EnableSpringWebSession; + +import java.util.concurrent.ConcurrentHashMap; + +@Configuration +@EnableSpringWebSession +public class SessionConfig { + + @Bean + public ReactiveSessionRepository reactiveSessionRepository() { + return new ReactiveMapSessionRepository(new ConcurrentHashMap<>()); + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/WebFluxConfig.java b/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/WebFluxConfig.java new file mode 100644 index 0000000000..964b544916 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/WebFluxConfig.java @@ -0,0 +1,20 @@ +package com.baeldung.websession.configuration; + +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.reactive.config.EnableWebFlux; +import org.springframework.web.reactive.config.ResourceHandlerRegistry; +import org.springframework.web.reactive.config.WebFluxConfigurer; + +@Configuration +@EnableWebFlux +public class WebFluxConfig implements ApplicationContextAware, WebFluxConfigurer { + + private ApplicationContext context; + + @Override + public void setApplicationContext(ApplicationContext context) { + this.context = context; + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/WebFluxSecurityConfig.java b/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/WebFluxSecurityConfig.java new file mode 100644 index 0000000000..452bcac8ab --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/WebFluxSecurityConfig.java @@ -0,0 +1,58 @@ +package com.baeldung.websession.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity; +import org.springframework.security.config.web.server.ServerHttpSecurity; +import org.springframework.security.core.userdetails.MapReactiveUserDetailsService; +import org.springframework.security.core.userdetails.User; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.web.server.SecurityWebFilterChain; +import org.springframework.security.web.server.context.WebSessionServerSecurityContextRepository; + +@Configuration +@EnableWebFluxSecurity +public class WebFluxSecurityConfig { + + @Bean + public MapReactiveUserDetailsService userDetailsService() { + UserDetails admin = User + .withUsername("admin") + .password(encoder().encode("password")) + .roles("ADMIN") + .build(); + + UserDetails user = User + .withUsername("user") + .password(encoder().encode("password")) + .roles("USER") + .build(); + + return new MapReactiveUserDetailsService(admin, user); + } + + @Bean + public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) { + http + .authorizeExchange() + .anyExchange().authenticated() + .and() + .httpBasic() + .securityContextRepository(new WebSessionServerSecurityContextRepository()) + .and() + .formLogin(); + + http + .csrf().disable(); + + return http.build(); + + } + + @Bean + public PasswordEncoder encoder() { + return new BCryptPasswordEncoder(); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/websession/controller/SessionController.java b/spring-5-reactive/src/main/java/com/baeldung/websession/controller/SessionController.java new file mode 100644 index 0000000000..b91a050322 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/websession/controller/SessionController.java @@ -0,0 +1,42 @@ +package com.baeldung.websession.controller; + +import com.baeldung.websession.transfer.CustomResponse; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.server.WebSession; +import reactor.core.publisher.Mono; + +@RestController +public class SessionController { + + @GetMapping("/websession/test") + public Mono testWebSessionByParam( + @RequestParam(value = "id") int id, + @RequestParam(value = "note") String note, + WebSession session) { + + session.getAttributes().put("id", id); + session.getAttributes().put("note", note); + + CustomResponse r = new CustomResponse(); + r.setId((int) session.getAttributes().get("id")); + r.setNote((String) session.getAttributes().get("note")); + + return Mono.just(r); + } + + @GetMapping("/websession") + public Mono getSession(WebSession session) { + + session.getAttributes().putIfAbsent("id", 0); + session.getAttributes().putIfAbsent("note", "Howdy Cosmic Spheroid!"); + + CustomResponse r = new CustomResponse(); + r.setId((int) session.getAttributes().get("id")); + r.setNote((String) session.getAttributes().get("note")); + + return Mono.just(r); + } + +} \ No newline at end of file diff --git a/spring-5-reactive/src/main/java/com/baeldung/websession/transfer/CustomResponse.java b/spring-5-reactive/src/main/java/com/baeldung/websession/transfer/CustomResponse.java new file mode 100644 index 0000000000..2d562de157 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/websession/transfer/CustomResponse.java @@ -0,0 +1,31 @@ +package com.baeldung.websession.transfer; + +public class CustomResponse { + + private int id; + private String note; + + public CustomResponse() {} + + public CustomResponse(int id, String note) { + this.id = id; + this.note = note; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getNote() { + return note; + } + + public void setNote(String note) { + this.note = note; + } + +} From 21a3a43788075ec30d1868cdabc65b8ef0ceb2df Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sat, 20 Oct 2018 11:27:08 +0530 Subject: [PATCH 72/87] [BAEL-9538] - Move persistence-related modules into the persistence folder --- .../core-java-persistence}/README.md | 0 .../core-java-persistence}/pom.xml | 140 ++++----- .../connectionpool/BasicConnectionPool.java | 0 .../connectionpool/C3poDataSource.java | 0 .../connectionpool/ConnectionPool.java | 0 .../connectionpool/DBCPDataSource.java | 0 .../connectionpool/HikariCPDataSource.java | 0 .../com/baeldung/jdbc/BatchProcessing.java | 0 .../main/java/com/baeldung/jdbc/Employee.java | 0 .../jdbcrowset/DatabaseConfiguration.java | 0 .../baeldung/jdbcrowset/ExampleListener.java | 0 .../baeldung/jdbcrowset/FilterExample.java | 0 .../jdbcrowset/JdbcRowsetApplication.java | 0 .../src/main/resources/logback.xml | 0 .../BasicConnectionPoolUnitTest.java | 134 ++++---- .../C3poDataSourceUnitTest.java | 24 +- .../DBCPDataSourceUnitTest.java | 24 +- .../HikariCPDataSourceUnitTest.java | 24 +- .../jdbc/BatchProcessingLiveTest.java | 0 .../java/com/baeldung/jdbc/JdbcLiveTest.java | 0 .../jdbcrowset/JdbcRowSetLiveTest.java | 0 .../deltaspike}/.gitignore | 0 .../deltaspike}/README.md | 0 .../deltaspike}/pom.xml | 1 + .../baeldung/controller/MemberController.java | 0 .../baeldung/data/EntityManagerProducer.java | 0 .../baeldung/data/MemberListProducer.java | 0 .../java/baeldung/data/MemberRepository.java | 0 .../data/QueryDslRepositoryExtension.java | 0 .../java/baeldung/data/QueryDslSupport.java | 0 .../data/SecondaryEntityManagerProducer.java | 0 .../data/SecondaryEntityManagerResolver.java | 0 .../data/SecondaryPersistenceUnit.java | 0 .../baeldung/data/SimpleUserRepository.java | 0 .../java/baeldung/data/UserRepository.java | 0 .../src/main/java/baeldung/model/Address.java | 0 .../src/main/java/baeldung/model/Member.java | 0 .../src/main/java/baeldung/model/User.java | 0 .../java/baeldung/rest/JaxRsActivator.java | 0 .../rest/MemberResourceRESTService.java | 0 .../baeldung/service/MemberRegistration.java | 0 .../main/java/baeldung/util/Resources.java | 0 .../META-INF/apache-deltaspike.properties | 0 .../src/main/resources/META-INF/beans.xml | 0 .../main/resources/META-INF/persistence.xml | 0 .../deltaspike}/src/main/resources/import.sql | 0 .../src/main/resources/logback.xml | 0 .../webapp/WEB-INF/baeldung-jee7-seed-ds.xml | 0 .../baeldung-jee7-seed-secondary-ds.xml | 0 .../src/main/webapp/WEB-INF/beans.xml | 0 .../src/main/webapp/WEB-INF/faces-config.xml | 0 .../webapp/WEB-INF/templates/default.xhtml | 0 .../deltaspike}/src/main/webapp/index.html | 0 .../deltaspike}/src/main/webapp/index.xhtml | 0 .../src/main/webapp/resources/css/screen.css | 0 .../main/webapp/resources/gfx/asidebkg.png | Bin .../webapp/resources/gfx/bkg-blkheader.png | Bin .../webapp/resources/gfx/dualbrand_logo.png | Bin .../main/webapp/resources/gfx/headerbkg.png | Bin .../webapp/resources/gfx/wildfly_400x130.jpg | Bin .../test/java/baeldung/ValidatorProducer.java | 0 .../data/TestEntityManagerProducer.java | 0 .../test/MemberRegistrationLiveTest.java | 0 .../test/SimpleUserRepositoryUnitTest.java | 0 .../baeldung/test/UserRepositoryUnitTest.java | 0 .../META-INF/apache-deltaspike.properties | 0 .../src/test/resources/META-INF/beans.xml | 0 .../test/resources/META-INF/persistence.xml | 0 .../src/test/resources/arquillian.xml | 0 .../deltaspike}/src/test/resources/import.sql | 0 .../src/test/resources/test-ds.xml | 0 .../src/test/resources/test-secondary-ds.xml | 0 .../influxdb}/README.md | 0 .../influxdb}/pom.xml | 1 + .../com/baeldung/influxdb/MemoryPoint.java | 0 .../influxdb}/src/main/resources/logback.xml | 0 .../influxdb/InfluxDBConnectionLiveTest.java | 0 .../influxdb}/src/test/resources/logback.xml | 0 .../orientdb}/.gitignore | 0 .../orientdb}/.mvn/wrapper/maven-wrapper.jar | Bin .../.mvn/wrapper/maven-wrapper.properties | 0 .../orientdb}/README.md | 0 .../orientdb}/mvnw | 0 .../orientdb}/mvnw.cmd | 0 .../orientdb}/pom.xml | 1 + .../java/com/baeldung/orientdb/Author.java | 0 .../orientdb}/src/main/resources/logback.xml | 0 .../orientdb/OrientDBDocumentAPILiveTest.java | 0 .../orientdb/OrientDBGraphAPILiveTest.java | 0 .../orientdb/OrientDBObjectAPILiveTest.java | 0 .../spring-boot-persistence}/.gitignore | 10 +- .../.mvn/wrapper/maven-wrapper.properties | 0 .../spring-boot-persistence}/README.MD | 0 .../spring-boot-persistence}/mvnw | 0 .../spring-boot-persistence}/mvnw.cmd | 290 +++++++++--------- .../spring-boot-persistence}/pom.xml | 150 ++++----- .../main/java/com/baeldung/Application.java | 0 .../com/baeldung/boot/config/H2JpaConfig.java | 0 .../java/com/baeldung/domain/Country.java | 0 .../main/java/com/baeldung/domain/User.java | 0 .../baeldung/repository/UserRepository.java | 0 .../SpringBootConsoleApplication.java | 44 +-- .../application/entities/Customer.java | 106 +++---- .../repositories/CustomerRepository.java | 24 +- .../runners/CommandLineCrudRunner.java | 74 ++--- .../baeldung/boot/domain/GenericEntity.java | 0 .../repository/GenericEntityRepository.java | 0 .../src/main/resources/application.properties | 0 .../src/main/resources/data.sql | 0 .../src/main/resources/logback.xml | 0 .../persistence-generic-entity.properties | 0 .../src/main/resources/schema.sql | 0 .../baeldung/SpringBootH2IntegrationTest.java | 0 .../SpringBootJPAIntegrationTest.java | 0 .../SpringBootProfileIntegrationTest.java | 0 .../UserRepositoryIntegrationTest.java | 0 ...otTomcatConnectionPoolIntegrationTest.java | 44 +-- .../config/H2TestProfileJPAConfig.java | 0 .../src/test/resources/application.properties | 0 .../test/resources/import_active_users.sql | 0 .../test/resources/import_inactive_users.sql | 0 .../src/test/resources/migrated_users.sql | 0 .../spring-data-elasticsearch}/README.md | 0 .../spring-data-elasticsearch}/pom.xml | 2 +- .../com/baeldung/elasticsearch/Person.java | 0 .../spring/data/es/config/Config.java | 0 .../spring/data/es/model/Article.java | 0 .../baeldung/spring/data/es/model/Author.java | 0 .../data/es/repository/ArticleRepository.java | 0 .../data/es/service/ArticleService.java | 0 .../data/es/service/ArticleServiceImpl.java | 0 .../src/main/resources/log4j2.properties | 0 .../ElasticSearchManualTest.java | 0 .../GeoQueriesIntegrationTest.java | 0 .../data/es/ElasticSearchIntegrationTest.java | 0 .../es/ElasticSearchQueryIntegrationTest.java | 0 .../SpringContextIntegrationTest.java | 0 .../spring-data-jpa}/README.md | 0 .../spring-data-jpa}/pom.xml | 9 +- .../main/java/com/baeldung/Application.java | 0 .../config/PersistenceConfiguration.java | 0 .../PersistenceProductConfiguration.java | 0 .../config/PersistenceUserConfiguration.java | 0 .../main/java/com/baeldung/dao/IFooDao.java | 0 .../dao/repositories/ArticleRepository.java | 0 .../repositories/CustomItemRepository.java | 0 .../CustomItemTypeRepository.java | 0 .../dao/repositories/ExtendedRepository.java | 0 .../ExtendedStudentRepository.java | 0 .../dao/repositories/IBarCrudRepository.java | 0 .../dao/repositories/InventoryRepository.java | 0 .../dao/repositories/ItemTypeRepository.java | 0 .../dao/repositories/LocationRepository.java | 0 .../ReadOnlyLocationRepository.java | 0 .../dao/repositories/StoreRepository.java | 0 .../impl/CustomItemRepositoryImpl.java | 0 .../impl/CustomItemTypeRepositoryImpl.java | 0 .../impl/ExtendedRepositoryImpl.java | 0 .../product/ProductRepository.java | 0 .../user/PossessionRepository.java | 0 .../dao/repositories/user/UserRepository.java | 0 .../com/baeldung/ddd/event/Aggregate.java | 0 .../com/baeldung/ddd/event/Aggregate2.java | 0 .../ddd/event/Aggregate2Repository.java | 0 .../com/baeldung/ddd/event/Aggregate3.java | 0 .../ddd/event/Aggregate3Repository.java | 0 .../ddd/event/AggregateRepository.java | 0 .../com/baeldung/ddd/event/DddConfig.java | 0 .../com/baeldung/ddd/event/DomainEvent.java | 0 .../com/baeldung/ddd/event/DomainService.java | 0 .../java/com/baeldung/domain/Article.java | 0 .../main/java/com/baeldung/domain/Bar.java | 0 .../main/java/com/baeldung/domain/Foo.java | 0 .../main/java/com/baeldung/domain/Item.java | 162 +++++----- .../java/com/baeldung/domain/ItemType.java | 92 +++--- .../main/java/com/baeldung/domain/KVTag.java | 0 .../java/com/baeldung/domain/Location.java | 110 +++---- .../baeldung/domain/MerchandiseEntity.java | 0 .../java/com/baeldung/domain/SkillTag.java | 0 .../main/java/com/baeldung/domain/Store.java | 152 ++++----- .../java/com/baeldung/domain/Student.java | 0 .../com/baeldung/domain/product/Product.java | 0 .../com/baeldung/domain/user/Possession.java | 0 .../java/com/baeldung/domain/user/User.java | 0 .../com/baeldung/services/IBarService.java | 0 .../com/baeldung/services/IFooService.java | 0 .../com/baeldung/services/IOperations.java | 0 .../services/impl/AbstractService.java | 0 .../impl/AbstractSpringDataJpaService.java | 0 .../impl/BarSpringDataJpaService.java | 0 .../baeldung/services/impl/FooService.java | 0 .../src/main/resources/application.properties | 0 .../src/main/resources/ddd.properties | 0 .../src/main/resources/logback.xml | 0 .../persistence-multiple-db.properties | 0 .../src/main/resources/persistence.properties | 0 .../ArticleRepositoryIntegrationTest.java | 0 ...endedStudentRepositoryIntegrationTest.java | 0 .../InventoryRepositoryIntegrationTest.java | 0 .../JpaRepositoriesIntegrationTest.java | 0 .../UserRepositoryIntegrationTest.java | 0 .../Aggregate2EventsIntegrationTest.java | 0 .../Aggregate3EventsIntegrationTest.java | 0 .../event/AggregateEventsIntegrationTest.java | 0 .../baeldung/ddd/event/TestEventHandler.java | 0 ...ractServicePersistenceIntegrationTest.java | 0 .../FooServicePersistenceIntegrationTest.java | 0 .../JpaMultipleDBIntegrationTest.java | 0 .../SpringDataJPABarAuditIntegrationTest.java | 0 .../test/java/com/baeldung/util/IDUtil.java | 0 .../SpringContextIntegrationTest.java | 0 .../src/test/resources/import_entities.sql | 0 .../spring-data-keyvalue}/README.md | 0 .../spring-data-keyvalue}/pom.xml | 2 +- .../spring/data/keyvalue/Configurations.java | 0 .../SpringDataKeyValueApplication.java | 0 .../repositories/EmployeeRepository.java | 0 .../keyvalue/services/EmployeeService.java | 0 .../EmployeeServicesWithKeyValueTemplate.java | 0 .../impl/EmployeeServicesWithRepository.java | 0 .../spring/data/keyvalue/vo/Employee.java | 0 .../src/main/resources/logback.xml | 0 ...WithKeyValueRepositoryIntegrationTest.java | 0 ...ServicesWithRepositoryIntegrationTest.java | 0 .../SpringContextIntegrationTest.java | 0 .../spring-data-mongodb}/README.md | 0 .../spring-data-mongodb}/pom.xml | 2 +- .../com/baeldung/annotation/CascadeSave.java | 0 .../java/com/baeldung/config/MongoConfig.java | 0 .../baeldung/config/MongoReactiveConfig.java | 0 .../baeldung/config/SimpleMongoConfig.java | 0 .../converter/UserWriterConverter.java | 0 .../com/baeldung/event/CascadeCallback.java | 0 .../event/CascadeSaveMongoEventListener.java | 0 .../com/baeldung/event/FieldCallback.java | 0 .../UserCascadeSaveMongoEventListener.java | 0 .../java/com/baeldung/model/EmailAddress.java | 0 .../main/java/com/baeldung/model/User.java | 0 .../reactive/repository/UserRepository.java | 0 .../baeldung/repository/UserRepository.java | 0 .../src/main/resources/logback.xml | 0 .../src/main/resources/mongoConfig.xml | 0 .../src/main/resources/test.png | Bin .../aggregation/ZipsAggregationLiveTest.java | 0 .../aggregation/model/StatePopulation.java | 0 .../com/baeldung/gridfs/GridFSLiveTest.java | 0 .../mongotemplate/DocumentQueryLiveTest.java | 0 .../MongoTemplateProjectionLiveTest.java | 0 .../MongoTemplateQueryLiveTest.java | 0 .../repository/BaseQueryLiveTest.java | 0 .../baeldung/repository/DSLQueryLiveTest.java | 0 .../repository/JSONQueryLiveTest.java | 0 .../repository/QueryMethodsLiveTest.java | 0 .../repository/UserRepositoryLiveTest.java | 0 .../UserRepositoryProjectionLiveTest.java | 0 ...ngoTransactionReactiveIntegrationTest.java | 0 ...ngoTransactionTemplateIntegrationTest.java | 0 .../MongoTransactionalIntegrationTest.java | 0 .../SpringContextIntegrationTest.java | 0 .../src/test/resources/zips.json | 0 .../spring-hibernate3}/README.md | 0 .../spring/PersistenceConfigHibernate3.java | 162 +++++----- .../src/main/resources/logback.xml | 0 ...nateExceptionScen1MainIntegrationTest.java | 86 +++--- ...nateExceptionScen2MainIntegrationTest.java | 90 +++--- .../spring-hibernate4}/.gitignore | 0 .../spring-hibernate4}/README.md | 0 .../spring-hibernate4}/pom.xml | 1 + .../hibernate/criteria/model/Item.java | 0 .../hibernate/fetching/model/OrderDetail.java | 0 .../hibernate/fetching/model/UserEager.java | 0 .../hibernate/fetching/model/UserLazy.java | 0 .../fetching/util/HibernateUtil.java | 0 .../fetching/view/FetchingAppView.java | 0 .../config/HibernateAnnotationUtil.java | 0 .../HibernateOneToManyAnnotationMain.java | 0 .../hibernate/oneToMany/model/Cart.java | 0 .../hibernate/oneToMany/model/Items.java | 0 .../persistence/dao/IBarAuditableDao.java | 0 .../persistence/dao/IBarCrudRepository.java | 0 .../com/baeldung/persistence/dao/IBarDao.java | 0 .../baeldung/persistence/dao/IChildDao.java | 0 .../persistence/dao/IFooAuditableDao.java | 0 .../com/baeldung/persistence/dao/IFooDao.java | 0 .../baeldung/persistence/dao/IParentDao.java | 0 .../persistence/dao/common/AbstractDao.java | 0 .../common/AbstractHibernateAuditableDao.java | 0 .../dao/common/AbstractHibernateDao.java | 0 .../dao/common/AbstractJpaDao.java | 0 .../dao/common/GenericHibernateDao.java | 0 .../dao/common/IAuditOperations.java | 0 .../persistence/dao/common/IGenericDao.java | 0 .../persistence/dao/common/IOperations.java | 0 .../persistence/dao/impl/BarAuditableDao.java | 0 .../baeldung/persistence/dao/impl/BarDao.java | 0 .../persistence/dao/impl/BarJpaDao.java | 0 .../persistence/dao/impl/ChildDao.java | 0 .../persistence/dao/impl/FooAuditableDao.java | 0 .../baeldung/persistence/dao/impl/FooDao.java | 0 .../persistence/dao/impl/ParentDao.java | 0 .../com/baeldung/persistence/model/Bar.java | 0 .../com/baeldung/persistence/model/Child.java | 0 .../com/baeldung/persistence/model/Foo.java | 0 .../baeldung/persistence/model/Parent.java | 0 .../baeldung/persistence/model/Person.java | 0 .../service/IBarAuditableService.java | 0 .../persistence/service/IBarService.java | 0 .../persistence/service/IChildService.java | 0 .../service/IFooAuditableService.java | 0 .../persistence/service/IFooService.java | 0 .../persistence/service/IParentService.java | 0 .../AbstractHibernateAuditableService.java | 0 .../common/AbstractHibernateService.java | 0 .../service/common/AbstractJpaService.java | 0 .../service/common/AbstractService.java | 0 .../common/AbstractSpringDataJpaService.java | 0 .../service/impl/BarAuditableService.java | 0 .../service/impl/BarJpaService.java | 0 .../persistence/service/impl/BarService.java | 0 .../service/impl/BarSpringDataJpaService.java | 0 .../service/impl/ChildService.java | 0 .../service/impl/FooAuditableService.java | 0 .../persistence/service/impl/FooService.java | 0 .../service/impl/ParentService.java | 0 .../baeldung/spring/PersistenceConfig.java | 0 .../baeldung/spring/PersistenceXmlConfig.java | 0 .../src/main/resources/fetching.cfg.xml | 0 .../src/main/resources/fetchingLazy.cfg.xml | 0 .../resources/fetching_create_queries.sql | 0 .../resources/hibernate-annotation.cfg.xml | 0 .../src/main/resources/hibernate4Config.xml | 0 .../src/main/resources/immutable.cfg.xml | 0 .../src/main/resources/insert_statements.sql | 0 .../src/main/resources/logback.xml | 0 .../src/main/resources/one_to_many.sql | 0 .../resources/persistence-mysql.properties | 0 .../src/main/resources/stored_procedure.sql | 38 +-- .../src/main/resources/webSecurityConfig.xml | 0 .../HibernateFetchingIntegrationTest.java | 0 ...neToManyAnnotationMainIntegrationTest.java | 0 .../persistence/IntegrationTestSuite.java | 0 .../persistence/audit/AuditTestSuite.java | 0 .../EnversFooBarAuditIntegrationTest.java | 0 .../audit/JPABarAuditIntegrationTest.java | 0 .../SpringDataJPABarAuditIntegrationTest.java | 0 .../persistence/hibernate/FooFixtures.java | 0 ...oPaginationPersistenceIntegrationTest.java | 0 .../FooSortingPersistenceIntegrationTest.java | 0 .../save/SaveMethodsIntegrationTest.java | 0 ...erviceBasicPersistenceIntegrationTest.java | 0 .../FooServicePersistenceIntegrationTest.java | 0 .../service/FooStoredProceduresLiveTest.java | 242 +++++++-------- ...rentServicePersistenceIntegrationTest.java | 0 .../spring/config/PersistenceTestConfig.java | 0 .../SpringContextIntegrationTest.java | 0 .../src/test/resources/.gitignore | 0 .../src/test/resources/fetching.cfg.xml | 0 .../src/test/resources/fetchingLazy.cfg.xml | 0 .../test/resources/persistence-h2.properties | 0 pom.xml | 60 ++-- 360 files changed, 1153 insertions(+), 1148 deletions(-) rename {core-java-persistence => persistence-modules/core-java-persistence}/README.md (100%) rename {core-java-persistence => persistence-modules/core-java-persistence}/pom.xml (95%) rename {core-java-persistence => persistence-modules/core-java-persistence}/src/main/java/com/baeldung/connectionpool/BasicConnectionPool.java (100%) rename {core-java-persistence => persistence-modules/core-java-persistence}/src/main/java/com/baeldung/connectionpool/C3poDataSource.java (100%) rename {core-java-persistence => persistence-modules/core-java-persistence}/src/main/java/com/baeldung/connectionpool/ConnectionPool.java (100%) rename {core-java-persistence => persistence-modules/core-java-persistence}/src/main/java/com/baeldung/connectionpool/DBCPDataSource.java (100%) rename {core-java-persistence => persistence-modules/core-java-persistence}/src/main/java/com/baeldung/connectionpool/HikariCPDataSource.java (100%) rename {core-java-persistence => persistence-modules/core-java-persistence}/src/main/java/com/baeldung/jdbc/BatchProcessing.java (100%) rename {core-java-persistence => persistence-modules/core-java-persistence}/src/main/java/com/baeldung/jdbc/Employee.java (100%) rename {core-java-persistence => persistence-modules/core-java-persistence}/src/main/java/com/baeldung/jdbcrowset/DatabaseConfiguration.java (100%) rename {core-java-persistence => persistence-modules/core-java-persistence}/src/main/java/com/baeldung/jdbcrowset/ExampleListener.java (100%) rename {core-java-persistence => persistence-modules/core-java-persistence}/src/main/java/com/baeldung/jdbcrowset/FilterExample.java (100%) rename {core-java-persistence => persistence-modules/core-java-persistence}/src/main/java/com/baeldung/jdbcrowset/JdbcRowsetApplication.java (100%) rename {core-java-persistence => persistence-modules/core-java-persistence}/src/main/resources/logback.xml (100%) rename {core-java-persistence => persistence-modules/core-java-persistence}/src/test/java/com/baeldung/connectionpool/BasicConnectionPoolUnitTest.java (97%) rename {core-java-persistence => persistence-modules/core-java-persistence}/src/test/java/com/baeldung/connectionpool/C3poDataSourceUnitTest.java (96%) rename {core-java-persistence => persistence-modules/core-java-persistence}/src/test/java/com/baeldung/connectionpool/DBCPDataSourceUnitTest.java (96%) rename {core-java-persistence => persistence-modules/core-java-persistence}/src/test/java/com/baeldung/connectionpool/HikariCPDataSourceUnitTest.java (96%) rename {core-java-persistence => persistence-modules/core-java-persistence}/src/test/java/com/baeldung/jdbc/BatchProcessingLiveTest.java (100%) rename {core-java-persistence => persistence-modules/core-java-persistence}/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java (100%) rename {core-java-persistence => persistence-modules/core-java-persistence}/src/test/java/com/baeldung/jdbcrowset/JdbcRowSetLiveTest.java (100%) rename {deltaspike => persistence-modules/deltaspike}/.gitignore (100%) rename {deltaspike => persistence-modules/deltaspike}/README.md (100%) rename {deltaspike => persistence-modules/deltaspike}/pom.xml (99%) rename {deltaspike => persistence-modules/deltaspike}/src/main/java/baeldung/controller/MemberController.java (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/java/baeldung/data/EntityManagerProducer.java (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/java/baeldung/data/MemberListProducer.java (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/java/baeldung/data/MemberRepository.java (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/java/baeldung/data/QueryDslRepositoryExtension.java (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/java/baeldung/data/QueryDslSupport.java (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/java/baeldung/data/SecondaryEntityManagerProducer.java (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/java/baeldung/data/SecondaryEntityManagerResolver.java (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/java/baeldung/data/SecondaryPersistenceUnit.java (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/java/baeldung/data/SimpleUserRepository.java (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/java/baeldung/data/UserRepository.java (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/java/baeldung/model/Address.java (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/java/baeldung/model/Member.java (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/java/baeldung/model/User.java (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/java/baeldung/rest/JaxRsActivator.java (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/java/baeldung/rest/MemberResourceRESTService.java (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/java/baeldung/service/MemberRegistration.java (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/java/baeldung/util/Resources.java (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/resources/META-INF/apache-deltaspike.properties (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/resources/META-INF/beans.xml (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/resources/META-INF/persistence.xml (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/resources/import.sql (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/resources/logback.xml (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/webapp/WEB-INF/baeldung-jee7-seed-ds.xml (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/webapp/WEB-INF/baeldung-jee7-seed-secondary-ds.xml (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/webapp/WEB-INF/beans.xml (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/webapp/WEB-INF/faces-config.xml (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/webapp/WEB-INF/templates/default.xhtml (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/webapp/index.html (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/webapp/index.xhtml (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/webapp/resources/css/screen.css (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/webapp/resources/gfx/asidebkg.png (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/webapp/resources/gfx/bkg-blkheader.png (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/webapp/resources/gfx/dualbrand_logo.png (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/webapp/resources/gfx/headerbkg.png (100%) rename {deltaspike => persistence-modules/deltaspike}/src/main/webapp/resources/gfx/wildfly_400x130.jpg (100%) rename {deltaspike => persistence-modules/deltaspike}/src/test/java/baeldung/ValidatorProducer.java (100%) rename {deltaspike => persistence-modules/deltaspike}/src/test/java/baeldung/data/TestEntityManagerProducer.java (100%) rename {deltaspike => persistence-modules/deltaspike}/src/test/java/baeldung/test/MemberRegistrationLiveTest.java (100%) rename {deltaspike => persistence-modules/deltaspike}/src/test/java/baeldung/test/SimpleUserRepositoryUnitTest.java (100%) rename {deltaspike => persistence-modules/deltaspike}/src/test/java/baeldung/test/UserRepositoryUnitTest.java (100%) rename {deltaspike => persistence-modules/deltaspike}/src/test/resources/META-INF/apache-deltaspike.properties (100%) rename {deltaspike => persistence-modules/deltaspike}/src/test/resources/META-INF/beans.xml (100%) rename {deltaspike => persistence-modules/deltaspike}/src/test/resources/META-INF/persistence.xml (100%) rename {deltaspike => persistence-modules/deltaspike}/src/test/resources/arquillian.xml (100%) rename {deltaspike => persistence-modules/deltaspike}/src/test/resources/import.sql (100%) rename {deltaspike => persistence-modules/deltaspike}/src/test/resources/test-ds.xml (100%) rename {deltaspike => persistence-modules/deltaspike}/src/test/resources/test-secondary-ds.xml (100%) rename {influxdb => persistence-modules/influxdb}/README.md (100%) rename {influxdb => persistence-modules/influxdb}/pom.xml (96%) rename {influxdb => persistence-modules/influxdb}/src/main/java/com/baeldung/influxdb/MemoryPoint.java (100%) rename {influxdb => persistence-modules/influxdb}/src/main/resources/logback.xml (100%) rename {influxdb => persistence-modules/influxdb}/src/test/java/com/baeldung/influxdb/InfluxDBConnectionLiveTest.java (100%) rename {influxdb => persistence-modules/influxdb}/src/test/resources/logback.xml (100%) rename {orientdb => persistence-modules/orientdb}/.gitignore (100%) rename {orientdb => persistence-modules/orientdb}/.mvn/wrapper/maven-wrapper.jar (100%) rename {orientdb => persistence-modules/orientdb}/.mvn/wrapper/maven-wrapper.properties (100%) rename {orientdb => persistence-modules/orientdb}/README.md (100%) rename {orientdb => persistence-modules/orientdb}/mvnw (100%) mode change 100755 => 100644 rename {orientdb => persistence-modules/orientdb}/mvnw.cmd (100%) rename {orientdb => persistence-modules/orientdb}/pom.xml (97%) rename {orientdb => persistence-modules/orientdb}/src/main/java/com/baeldung/orientdb/Author.java (100%) rename {orientdb => persistence-modules/orientdb}/src/main/resources/logback.xml (100%) rename {orientdb => persistence-modules/orientdb}/src/test/java/com/baeldung/orientdb/OrientDBDocumentAPILiveTest.java (100%) rename {orientdb => persistence-modules/orientdb}/src/test/java/com/baeldung/orientdb/OrientDBGraphAPILiveTest.java (100%) rename {orientdb => persistence-modules/orientdb}/src/test/java/com/baeldung/orientdb/OrientDBObjectAPILiveTest.java (100%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/.gitignore (89%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/.mvn/wrapper/maven-wrapper.properties (100%) mode change 100755 => 100644 rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/README.MD (100%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/mvnw (100%) mode change 100755 => 100644 rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/mvnw.cmd (97%) mode change 100755 => 100644 rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/pom.xml (93%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/src/main/java/com/baeldung/Application.java (100%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/src/main/java/com/baeldung/boot/config/H2JpaConfig.java (100%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/src/main/java/com/baeldung/domain/Country.java (100%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/src/main/java/com/baeldung/domain/User.java (100%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/src/main/java/com/baeldung/repository/UserRepository.java (100%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/src/main/java/com/baeldung/tomcatconnectionpool/application/SpringBootConsoleApplication.java (97%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/src/main/java/com/baeldung/tomcatconnectionpool/application/entities/Customer.java (95%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/src/main/java/com/baeldung/tomcatconnectionpool/application/repositories/CustomerRepository.java (97%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/src/main/java/com/baeldung/tomcatconnectionpool/application/runners/CommandLineCrudRunner.java (97%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/src/main/java/org/baeldung/boot/domain/GenericEntity.java (100%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/src/main/java/org/baeldung/boot/repository/GenericEntityRepository.java (100%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/src/main/resources/application.properties (100%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/src/main/resources/data.sql (100%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/src/main/resources/logback.xml (100%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/src/main/resources/persistence-generic-entity.properties (100%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/src/main/resources/schema.sql (100%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/src/test/java/com/baeldung/SpringBootH2IntegrationTest.java (100%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/src/test/java/com/baeldung/SpringBootJPAIntegrationTest.java (100%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/src/test/java/com/baeldung/SpringBootProfileIntegrationTest.java (100%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/src/test/java/com/baeldung/repository/UserRepositoryIntegrationTest.java (100%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/src/test/java/com/baeldung/tomcatconnectionpool/test/application/SpringBootTomcatConnectionPoolIntegrationTest.java (97%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/src/test/java/org/baeldung/config/H2TestProfileJPAConfig.java (100%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/src/test/resources/application.properties (100%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/src/test/resources/import_active_users.sql (100%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/src/test/resources/import_inactive_users.sql (100%) rename {spring-boot-persistence => persistence-modules/spring-boot-persistence}/src/test/resources/migrated_users.sql (100%) rename {spring-data-elasticsearch => persistence-modules/spring-data-elasticsearch}/README.md (100%) rename {spring-data-elasticsearch => persistence-modules/spring-data-elasticsearch}/pom.xml (98%) rename {spring-data-elasticsearch => persistence-modules/spring-data-elasticsearch}/src/main/java/com/baeldung/elasticsearch/Person.java (100%) rename {spring-data-elasticsearch => persistence-modules/spring-data-elasticsearch}/src/main/java/com/baeldung/spring/data/es/config/Config.java (100%) rename {spring-data-elasticsearch => persistence-modules/spring-data-elasticsearch}/src/main/java/com/baeldung/spring/data/es/model/Article.java (100%) rename {spring-data-elasticsearch => persistence-modules/spring-data-elasticsearch}/src/main/java/com/baeldung/spring/data/es/model/Author.java (100%) rename {spring-data-elasticsearch => persistence-modules/spring-data-elasticsearch}/src/main/java/com/baeldung/spring/data/es/repository/ArticleRepository.java (100%) rename {spring-data-elasticsearch => persistence-modules/spring-data-elasticsearch}/src/main/java/com/baeldung/spring/data/es/service/ArticleService.java (100%) rename {spring-data-elasticsearch => persistence-modules/spring-data-elasticsearch}/src/main/java/com/baeldung/spring/data/es/service/ArticleServiceImpl.java (100%) rename {spring-data-elasticsearch => persistence-modules/spring-data-elasticsearch}/src/main/resources/log4j2.properties (100%) rename {spring-data-elasticsearch => persistence-modules/spring-data-elasticsearch}/src/test/java/com/baeldung/elasticsearch/ElasticSearchManualTest.java (100%) rename {spring-data-elasticsearch => persistence-modules/spring-data-elasticsearch}/src/test/java/com/baeldung/elasticsearch/GeoQueriesIntegrationTest.java (100%) rename {spring-data-elasticsearch => persistence-modules/spring-data-elasticsearch}/src/test/java/com/baeldung/spring/data/es/ElasticSearchIntegrationTest.java (100%) rename {spring-data-elasticsearch => persistence-modules/spring-data-elasticsearch}/src/test/java/com/baeldung/spring/data/es/ElasticSearchQueryIntegrationTest.java (100%) rename {spring-data-elasticsearch => persistence-modules/spring-data-elasticsearch}/src/test/java/org/baeldung/SpringContextIntegrationTest.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/README.md (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/pom.xml (95%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/Application.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/config/PersistenceConfiguration.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/config/PersistenceProductConfiguration.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/config/PersistenceUserConfiguration.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/dao/IFooDao.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/dao/repositories/ArticleRepository.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/dao/repositories/CustomItemRepository.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/dao/repositories/CustomItemTypeRepository.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/dao/repositories/ExtendedRepository.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/dao/repositories/ExtendedStudentRepository.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/dao/repositories/IBarCrudRepository.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/dao/repositories/InventoryRepository.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/dao/repositories/ItemTypeRepository.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/dao/repositories/LocationRepository.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/dao/repositories/ReadOnlyLocationRepository.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/dao/repositories/StoreRepository.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/dao/repositories/impl/CustomItemRepositoryImpl.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/dao/repositories/impl/CustomItemTypeRepositoryImpl.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/dao/repositories/impl/ExtendedRepositoryImpl.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/dao/repositories/product/ProductRepository.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/dao/repositories/user/PossessionRepository.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/dao/repositories/user/UserRepository.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/ddd/event/Aggregate.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/ddd/event/Aggregate2.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/ddd/event/Aggregate2Repository.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/ddd/event/Aggregate3.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/ddd/event/Aggregate3Repository.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/ddd/event/AggregateRepository.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/ddd/event/DddConfig.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/ddd/event/DomainEvent.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/ddd/event/DomainService.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/domain/Article.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/domain/Bar.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/domain/Foo.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/domain/Item.java (94%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/domain/ItemType.java (94%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/domain/KVTag.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/domain/Location.java (95%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/domain/MerchandiseEntity.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/domain/SkillTag.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/domain/Store.java (95%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/domain/Student.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/domain/product/Product.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/domain/user/Possession.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/domain/user/User.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/services/IBarService.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/services/IFooService.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/services/IOperations.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/services/impl/AbstractService.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/services/impl/AbstractSpringDataJpaService.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/services/impl/BarSpringDataJpaService.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/java/com/baeldung/services/impl/FooService.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/resources/application.properties (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/resources/ddd.properties (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/resources/logback.xml (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/resources/persistence-multiple-db.properties (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/main/resources/persistence.properties (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/test/java/com/baeldung/dao/repositories/ArticleRepositoryIntegrationTest.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/test/java/com/baeldung/dao/repositories/ExtendedStudentRepositoryIntegrationTest.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/test/java/com/baeldung/dao/repositories/InventoryRepositoryIntegrationTest.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/test/java/com/baeldung/dao/repositories/JpaRepositoriesIntegrationTest.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/test/java/com/baeldung/dao/repositories/UserRepositoryIntegrationTest.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/test/java/com/baeldung/ddd/event/Aggregate2EventsIntegrationTest.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/test/java/com/baeldung/ddd/event/Aggregate3EventsIntegrationTest.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/test/java/com/baeldung/ddd/event/AggregateEventsIntegrationTest.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/test/java/com/baeldung/ddd/event/TestEventHandler.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/test/java/com/baeldung/services/AbstractServicePersistenceIntegrationTest.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/test/java/com/baeldung/services/FooServicePersistenceIntegrationTest.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/test/java/com/baeldung/services/JpaMultipleDBIntegrationTest.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/test/java/com/baeldung/services/SpringDataJPABarAuditIntegrationTest.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/test/java/com/baeldung/util/IDUtil.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/test/java/org/baeldung/SpringContextIntegrationTest.java (100%) rename {spring-data-jpa => persistence-modules/spring-data-jpa}/src/test/resources/import_entities.sql (100%) rename {spring-data-keyvalue => persistence-modules/spring-data-keyvalue}/README.md (100%) rename {spring-data-keyvalue => persistence-modules/spring-data-keyvalue}/pom.xml (93%) rename {spring-data-keyvalue => persistence-modules/spring-data-keyvalue}/src/main/java/com/baeldung/spring/data/keyvalue/Configurations.java (100%) rename {spring-data-keyvalue => persistence-modules/spring-data-keyvalue}/src/main/java/com/baeldung/spring/data/keyvalue/SpringDataKeyValueApplication.java (100%) rename {spring-data-keyvalue => persistence-modules/spring-data-keyvalue}/src/main/java/com/baeldung/spring/data/keyvalue/repositories/EmployeeRepository.java (100%) rename {spring-data-keyvalue => persistence-modules/spring-data-keyvalue}/src/main/java/com/baeldung/spring/data/keyvalue/services/EmployeeService.java (100%) rename {spring-data-keyvalue => persistence-modules/spring-data-keyvalue}/src/main/java/com/baeldung/spring/data/keyvalue/services/impl/EmployeeServicesWithKeyValueTemplate.java (100%) rename {spring-data-keyvalue => persistence-modules/spring-data-keyvalue}/src/main/java/com/baeldung/spring/data/keyvalue/services/impl/EmployeeServicesWithRepository.java (100%) rename {spring-data-keyvalue => persistence-modules/spring-data-keyvalue}/src/main/java/com/baeldung/spring/data/keyvalue/vo/Employee.java (100%) rename {spring-data-keyvalue => persistence-modules/spring-data-keyvalue}/src/main/resources/logback.xml (100%) rename {spring-data-keyvalue => persistence-modules/spring-data-keyvalue}/src/test/java/com/baeldung/spring/data/keyvalue/services/test/EmployeeServicesWithKeyValueRepositoryIntegrationTest.java (100%) rename {spring-data-keyvalue => persistence-modules/spring-data-keyvalue}/src/test/java/com/baeldung/spring/data/keyvalue/services/test/EmployeeServicesWithRepositoryIntegrationTest.java (100%) rename {spring-data-keyvalue => persistence-modules/spring-data-keyvalue}/src/test/java/org/baeldung/SpringContextIntegrationTest.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/README.md (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/pom.xml (98%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/main/java/com/baeldung/annotation/CascadeSave.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/main/java/com/baeldung/config/MongoConfig.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/main/java/com/baeldung/config/MongoReactiveConfig.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/main/java/com/baeldung/config/SimpleMongoConfig.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/main/java/com/baeldung/converter/UserWriterConverter.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/main/java/com/baeldung/event/CascadeCallback.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/main/java/com/baeldung/event/CascadeSaveMongoEventListener.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/main/java/com/baeldung/event/FieldCallback.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/main/java/com/baeldung/event/UserCascadeSaveMongoEventListener.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/main/java/com/baeldung/model/EmailAddress.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/main/java/com/baeldung/model/User.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/main/java/com/baeldung/reactive/repository/UserRepository.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/main/java/com/baeldung/repository/UserRepository.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/main/resources/logback.xml (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/main/resources/mongoConfig.xml (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/main/resources/test.png (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/test/java/com/baeldung/aggregation/ZipsAggregationLiveTest.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/test/java/com/baeldung/aggregation/model/StatePopulation.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/test/java/com/baeldung/gridfs/GridFSLiveTest.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/test/java/com/baeldung/mongotemplate/DocumentQueryLiveTest.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/test/java/com/baeldung/mongotemplate/MongoTemplateProjectionLiveTest.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/test/java/com/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/test/java/com/baeldung/repository/BaseQueryLiveTest.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/test/java/com/baeldung/repository/DSLQueryLiveTest.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/test/java/com/baeldung/repository/JSONQueryLiveTest.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/test/java/com/baeldung/repository/QueryMethodsLiveTest.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/test/java/com/baeldung/repository/UserRepositoryLiveTest.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/test/java/com/baeldung/repository/UserRepositoryProjectionLiveTest.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/test/java/com/baeldung/transaction/MongoTransactionReactiveIntegrationTest.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/test/java/com/baeldung/transaction/MongoTransactionTemplateIntegrationTest.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/test/java/com/baeldung/transaction/MongoTransactionalIntegrationTest.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/test/java/org/baeldung/SpringContextIntegrationTest.java (100%) rename {spring-data-mongodb => persistence-modules/spring-data-mongodb}/src/test/resources/zips.json (100%) rename {spring-hibernate3 => persistence-modules/spring-hibernate3}/README.md (100%) rename {spring-hibernate3 => persistence-modules/spring-hibernate3}/src/main/java/org/baeldung/spring/PersistenceConfigHibernate3.java (97%) rename {spring-hibernate3 => persistence-modules/spring-hibernate3}/src/main/resources/logback.xml (100%) rename {spring-hibernate3 => persistence-modules/spring-hibernate3}/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen1MainIntegrationTest.java (97%) rename {spring-hibernate3 => persistence-modules/spring-hibernate3}/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen2MainIntegrationTest.java (97%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/.gitignore (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/README.md (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/pom.xml (99%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/hibernate/criteria/model/Item.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/hibernate/fetching/model/OrderDetail.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/hibernate/fetching/model/UserEager.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/hibernate/fetching/model/UserLazy.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/hibernate/fetching/util/HibernateUtil.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/hibernate/fetching/view/FetchingAppView.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/hibernate/oneToMany/config/HibernateAnnotationUtil.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/hibernate/oneToMany/main/HibernateOneToManyAnnotationMain.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/hibernate/oneToMany/model/Cart.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/hibernate/oneToMany/model/Items.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/dao/IBarAuditableDao.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/dao/IBarCrudRepository.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/dao/IBarDao.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/dao/IChildDao.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/dao/IFooAuditableDao.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/dao/IFooDao.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/dao/IParentDao.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateAuditableDao.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/dao/common/AbstractJpaDao.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/dao/common/IAuditOperations.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/dao/common/IOperations.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/dao/impl/BarAuditableDao.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/dao/impl/BarDao.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/dao/impl/BarJpaDao.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/dao/impl/FooAuditableDao.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/model/Bar.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/model/Child.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/model/Foo.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/model/Parent.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/model/Person.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/service/IBarAuditableService.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/service/IBarService.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/service/IChildService.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/service/IFooAuditableService.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/service/IFooService.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/service/IParentService.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateAuditableService.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateService.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/service/common/AbstractJpaService.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/service/common/AbstractService.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/service/common/AbstractSpringDataJpaService.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/service/impl/BarAuditableService.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/service/impl/BarJpaService.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/service/impl/BarService.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/service/impl/BarSpringDataJpaService.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/service/impl/ChildService.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/service/impl/FooAuditableService.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/service/impl/FooService.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/persistence/service/impl/ParentService.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/spring/PersistenceConfig.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/java/com/baeldung/spring/PersistenceXmlConfig.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/resources/fetching.cfg.xml (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/resources/fetchingLazy.cfg.xml (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/resources/fetching_create_queries.sql (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/resources/hibernate-annotation.cfg.xml (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/resources/hibernate4Config.xml (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/resources/immutable.cfg.xml (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/resources/insert_statements.sql (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/resources/logback.xml (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/resources/one_to_many.sql (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/resources/persistence-mysql.properties (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/resources/stored_procedure.sql (93%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/main/resources/webSecurityConfig.xml (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/test/java/com/baeldung/hibernate/oneToMany/main/HibernateOneToManyAnnotationMainIntegrationTest.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/test/java/com/baeldung/persistence/IntegrationTestSuite.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/test/java/com/baeldung/persistence/audit/AuditTestSuite.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/test/java/com/baeldung/persistence/audit/EnversFooBarAuditIntegrationTest.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/test/java/com/baeldung/persistence/audit/JPABarAuditIntegrationTest.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/test/java/com/baeldung/persistence/audit/SpringDataJPABarAuditIntegrationTest.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/test/java/com/baeldung/persistence/hibernate/FooFixtures.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/test/java/com/baeldung/persistence/hibernate/FooPaginationPersistenceIntegrationTest.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/test/java/com/baeldung/persistence/hibernate/FooSortingPersistenceIntegrationTest.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/test/java/com/baeldung/persistence/save/SaveMethodsIntegrationTest.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/test/java/com/baeldung/persistence/service/FooServiceBasicPersistenceIntegrationTest.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java (97%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/test/java/com/baeldung/persistence/service/ParentServicePersistenceIntegrationTest.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/test/java/com/baeldung/spring/config/PersistenceTestConfig.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/test/java/org/baeldung/SpringContextIntegrationTest.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/test/resources/.gitignore (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/test/resources/fetching.cfg.xml (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/test/resources/fetchingLazy.cfg.xml (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate4}/src/test/resources/persistence-h2.properties (100%) diff --git a/core-java-persistence/README.md b/persistence-modules/core-java-persistence/README.md similarity index 100% rename from core-java-persistence/README.md rename to persistence-modules/core-java-persistence/README.md diff --git a/core-java-persistence/pom.xml b/persistence-modules/core-java-persistence/pom.xml similarity index 95% rename from core-java-persistence/pom.xml rename to persistence-modules/core-java-persistence/pom.xml index 7279fd763b..f012d60ee6 100644 --- a/core-java-persistence/pom.xml +++ b/persistence-modules/core-java-persistence/pom.xml @@ -1,71 +1,71 @@ - - 4.0.0 - com.baeldung.core-java-persistence - core-java-persistence - 0.1.0-SNAPSHOT - jar - core-java-persistence - - com.baeldung - parent-java - 0.0.1-SNAPSHOT - ../parent-java - - - - org.assertj - assertj-core - ${assertj-core.version} - test - - - com.h2database - h2 - ${h2database.version} - - - org.apache.commons - commons-dbcp2 - ${commons-dbcp2.version} - - - com.zaxxer - HikariCP - ${HikariCP.version} - - - com.mchange - c3p0 - ${c3p0.version} - - - org.springframework - spring-web - ${springframework.spring-web.version} - - - org.springframework.boot - spring-boot-starter - ${springframework.boot.spring-boot-starter.version} - - - - core-java-persistence - - - src/main/resources - true - - - - - 3.10.0 - 1.4.197 - 2.4.0 - 3.2.0 - 0.9.5.2 - 1.5.8.RELEASE - 4.3.4.RELEASE - + + 4.0.0 + com.baeldung.core-java-persistence + core-java-persistence + 0.1.0-SNAPSHOT + jar + core-java-persistence + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../../parent-java + + + + org.assertj + assertj-core + ${assertj-core.version} + test + + + com.h2database + h2 + ${h2database.version} + + + org.apache.commons + commons-dbcp2 + ${commons-dbcp2.version} + + + com.zaxxer + HikariCP + ${HikariCP.version} + + + com.mchange + c3p0 + ${c3p0.version} + + + org.springframework + spring-web + ${springframework.spring-web.version} + + + org.springframework.boot + spring-boot-starter + ${springframework.boot.spring-boot-starter.version} + + + + core-java-persistence + + + src/main/resources + true + + + + + 3.10.0 + 1.4.197 + 2.4.0 + 3.2.0 + 0.9.5.2 + 1.5.8.RELEASE + 4.3.4.RELEASE + \ No newline at end of file diff --git a/core-java-persistence/src/main/java/com/baeldung/connectionpool/BasicConnectionPool.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/BasicConnectionPool.java similarity index 100% rename from core-java-persistence/src/main/java/com/baeldung/connectionpool/BasicConnectionPool.java rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/BasicConnectionPool.java diff --git a/core-java-persistence/src/main/java/com/baeldung/connectionpool/C3poDataSource.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/C3poDataSource.java similarity index 100% rename from core-java-persistence/src/main/java/com/baeldung/connectionpool/C3poDataSource.java rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/C3poDataSource.java diff --git a/core-java-persistence/src/main/java/com/baeldung/connectionpool/ConnectionPool.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/ConnectionPool.java similarity index 100% rename from core-java-persistence/src/main/java/com/baeldung/connectionpool/ConnectionPool.java rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/ConnectionPool.java diff --git a/core-java-persistence/src/main/java/com/baeldung/connectionpool/DBCPDataSource.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/DBCPDataSource.java similarity index 100% rename from core-java-persistence/src/main/java/com/baeldung/connectionpool/DBCPDataSource.java rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/DBCPDataSource.java diff --git a/core-java-persistence/src/main/java/com/baeldung/connectionpool/HikariCPDataSource.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/HikariCPDataSource.java similarity index 100% rename from core-java-persistence/src/main/java/com/baeldung/connectionpool/HikariCPDataSource.java rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/HikariCPDataSource.java diff --git a/core-java-persistence/src/main/java/com/baeldung/jdbc/BatchProcessing.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbc/BatchProcessing.java similarity index 100% rename from core-java-persistence/src/main/java/com/baeldung/jdbc/BatchProcessing.java rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbc/BatchProcessing.java diff --git a/core-java-persistence/src/main/java/com/baeldung/jdbc/Employee.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbc/Employee.java similarity index 100% rename from core-java-persistence/src/main/java/com/baeldung/jdbc/Employee.java rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbc/Employee.java diff --git a/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/DatabaseConfiguration.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/DatabaseConfiguration.java similarity index 100% rename from core-java-persistence/src/main/java/com/baeldung/jdbcrowset/DatabaseConfiguration.java rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/DatabaseConfiguration.java diff --git a/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/ExampleListener.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/ExampleListener.java similarity index 100% rename from core-java-persistence/src/main/java/com/baeldung/jdbcrowset/ExampleListener.java rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/ExampleListener.java diff --git a/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/FilterExample.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/FilterExample.java similarity index 100% rename from core-java-persistence/src/main/java/com/baeldung/jdbcrowset/FilterExample.java rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/FilterExample.java diff --git a/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/JdbcRowsetApplication.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/JdbcRowsetApplication.java similarity index 100% rename from core-java-persistence/src/main/java/com/baeldung/jdbcrowset/JdbcRowsetApplication.java rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/JdbcRowsetApplication.java diff --git a/core-java-persistence/src/main/resources/logback.xml b/persistence-modules/core-java-persistence/src/main/resources/logback.xml similarity index 100% rename from core-java-persistence/src/main/resources/logback.xml rename to persistence-modules/core-java-persistence/src/main/resources/logback.xml diff --git a/core-java-persistence/src/test/java/com/baeldung/connectionpool/BasicConnectionPoolUnitTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/BasicConnectionPoolUnitTest.java similarity index 97% rename from core-java-persistence/src/test/java/com/baeldung/connectionpool/BasicConnectionPoolUnitTest.java rename to persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/BasicConnectionPoolUnitTest.java index 479cd0db25..3b3c9870fb 100644 --- a/core-java-persistence/src/test/java/com/baeldung/connectionpool/BasicConnectionPoolUnitTest.java +++ b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/BasicConnectionPoolUnitTest.java @@ -1,67 +1,67 @@ -package com.baeldung.connectionpool; - -import java.sql.Connection; -import java.sql.SQLException; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import org.junit.BeforeClass; -import org.junit.Test; - -public class BasicConnectionPoolUnitTest { - - private static ConnectionPool connectionPool; - - @BeforeClass - public static void setUpBasicConnectionPoolInstance() throws SQLException { - connectionPool = BasicConnectionPool.create("jdbc:h2:mem:test", "user", "password"); - } - - @Test - public void givenBasicConnectionPoolInstance_whenCalledgetConnection_thenCorrect() throws Exception { - assertTrue(connectionPool.getConnection().isValid(1)); - } - - @Test - public void givenBasicConnectionPoolInstance_whenCalledreleaseConnection_thenCorrect() throws Exception { - Connection connection = connectionPool.getConnection(); - assertThat(connectionPool.releaseConnection(connection)).isTrue(); - } - - @Test - public void givenBasicConnectionPoolInstance_whenCalledgetUrl_thenCorrect() { - assertThat(connectionPool.getUrl()).isEqualTo("jdbc:h2:mem:test"); - } - - @Test - public void givenBasicConnectionPoolInstance_whenCalledgetUser_thenCorrect() { - assertThat(connectionPool.getUser()).isEqualTo("user"); - } - - @Test - public void givenBasicConnectionPoolInstance_whenCalledgetPassword_thenCorrect() { - assertThat(connectionPool.getPassword()).isEqualTo("password"); - } - - @Test(expected = RuntimeException.class) - public void givenBasicConnectionPoolInstance_whenAskedForMoreThanMax_thenError() throws Exception { - // this test needs to be independent so it doesn't share the same connection pool as other tests - ConnectionPool cp = BasicConnectionPool.create("jdbc:h2:mem:test", "user", "password"); - final int MAX_POOL_SIZE = 20; - for (int i = 0; i < MAX_POOL_SIZE + 1; i++) { - cp.getConnection(); - } - fail(); - } - - @Test - public void givenBasicConnectionPoolInstance_whenSutdown_thenEmpty() throws Exception { - ConnectionPool cp = BasicConnectionPool.create("jdbc:h2:mem:test", "user", "password"); - assertThat(((BasicConnectionPool)cp).getSize()).isEqualTo(10); - - ((BasicConnectionPool) cp).shutdown(); - assertThat(((BasicConnectionPool)cp).getSize()).isEqualTo(0); - } -} +package com.baeldung.connectionpool; + +import java.sql.Connection; +import java.sql.SQLException; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.junit.BeforeClass; +import org.junit.Test; + +public class BasicConnectionPoolUnitTest { + + private static ConnectionPool connectionPool; + + @BeforeClass + public static void setUpBasicConnectionPoolInstance() throws SQLException { + connectionPool = BasicConnectionPool.create("jdbc:h2:mem:test", "user", "password"); + } + + @Test + public void givenBasicConnectionPoolInstance_whenCalledgetConnection_thenCorrect() throws Exception { + assertTrue(connectionPool.getConnection().isValid(1)); + } + + @Test + public void givenBasicConnectionPoolInstance_whenCalledreleaseConnection_thenCorrect() throws Exception { + Connection connection = connectionPool.getConnection(); + assertThat(connectionPool.releaseConnection(connection)).isTrue(); + } + + @Test + public void givenBasicConnectionPoolInstance_whenCalledgetUrl_thenCorrect() { + assertThat(connectionPool.getUrl()).isEqualTo("jdbc:h2:mem:test"); + } + + @Test + public void givenBasicConnectionPoolInstance_whenCalledgetUser_thenCorrect() { + assertThat(connectionPool.getUser()).isEqualTo("user"); + } + + @Test + public void givenBasicConnectionPoolInstance_whenCalledgetPassword_thenCorrect() { + assertThat(connectionPool.getPassword()).isEqualTo("password"); + } + + @Test(expected = RuntimeException.class) + public void givenBasicConnectionPoolInstance_whenAskedForMoreThanMax_thenError() throws Exception { + // this test needs to be independent so it doesn't share the same connection pool as other tests + ConnectionPool cp = BasicConnectionPool.create("jdbc:h2:mem:test", "user", "password"); + final int MAX_POOL_SIZE = 20; + for (int i = 0; i < MAX_POOL_SIZE + 1; i++) { + cp.getConnection(); + } + fail(); + } + + @Test + public void givenBasicConnectionPoolInstance_whenSutdown_thenEmpty() throws Exception { + ConnectionPool cp = BasicConnectionPool.create("jdbc:h2:mem:test", "user", "password"); + assertThat(((BasicConnectionPool)cp).getSize()).isEqualTo(10); + + ((BasicConnectionPool) cp).shutdown(); + assertThat(((BasicConnectionPool)cp).getSize()).isEqualTo(0); + } +} diff --git a/core-java-persistence/src/test/java/com/baeldung/connectionpool/C3poDataSourceUnitTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/C3poDataSourceUnitTest.java similarity index 96% rename from core-java-persistence/src/test/java/com/baeldung/connectionpool/C3poDataSourceUnitTest.java rename to persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/C3poDataSourceUnitTest.java index a07fa9e74b..acad9fe5e4 100644 --- a/core-java-persistence/src/test/java/com/baeldung/connectionpool/C3poDataSourceUnitTest.java +++ b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/C3poDataSourceUnitTest.java @@ -1,13 +1,13 @@ -package com.baeldung.connectionpool; - -import java.sql.SQLException; -import static org.junit.Assert.assertTrue; -import org.junit.Test; - -public class C3poDataSourceUnitTest { - - @Test - public void givenC3poDataSourceClass_whenCalledgetConnection_thenCorrect() throws SQLException { - assertTrue(C3poDataSource.getConnection().isValid(1)); - } +package com.baeldung.connectionpool; + +import java.sql.SQLException; +import static org.junit.Assert.assertTrue; +import org.junit.Test; + +public class C3poDataSourceUnitTest { + + @Test + public void givenC3poDataSourceClass_whenCalledgetConnection_thenCorrect() throws SQLException { + assertTrue(C3poDataSource.getConnection().isValid(1)); + } } \ No newline at end of file diff --git a/core-java-persistence/src/test/java/com/baeldung/connectionpool/DBCPDataSourceUnitTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/DBCPDataSourceUnitTest.java similarity index 96% rename from core-java-persistence/src/test/java/com/baeldung/connectionpool/DBCPDataSourceUnitTest.java rename to persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/DBCPDataSourceUnitTest.java index 43aaf330b6..4882d2af73 100644 --- a/core-java-persistence/src/test/java/com/baeldung/connectionpool/DBCPDataSourceUnitTest.java +++ b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/DBCPDataSourceUnitTest.java @@ -1,13 +1,13 @@ -package com.baeldung.connectionpool; - -import java.sql.SQLException; -import static org.junit.Assert.assertTrue; -import org.junit.Test; - -public class DBCPDataSourceUnitTest { - - @Test - public void givenDBCPDataSourceClass_whenCalledgetConnection_thenCorrect() throws SQLException { - assertTrue(DBCPDataSource.getConnection().isValid(1)); - } +package com.baeldung.connectionpool; + +import java.sql.SQLException; +import static org.junit.Assert.assertTrue; +import org.junit.Test; + +public class DBCPDataSourceUnitTest { + + @Test + public void givenDBCPDataSourceClass_whenCalledgetConnection_thenCorrect() throws SQLException { + assertTrue(DBCPDataSource.getConnection().isValid(1)); + } } \ No newline at end of file diff --git a/core-java-persistence/src/test/java/com/baeldung/connectionpool/HikariCPDataSourceUnitTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/HikariCPDataSourceUnitTest.java similarity index 96% rename from core-java-persistence/src/test/java/com/baeldung/connectionpool/HikariCPDataSourceUnitTest.java rename to persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/HikariCPDataSourceUnitTest.java index b20ce70efd..885743ab2b 100644 --- a/core-java-persistence/src/test/java/com/baeldung/connectionpool/HikariCPDataSourceUnitTest.java +++ b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/HikariCPDataSourceUnitTest.java @@ -1,13 +1,13 @@ -package com.baeldung.connectionpool; - -import java.sql.SQLException; -import static org.junit.Assert.assertTrue; -import org.junit.Test; - -public class HikariCPDataSourceUnitTest { - - @Test - public void givenHikariDataSourceClass_whenCalledgetConnection_thenCorrect() throws SQLException { - assertTrue(HikariCPDataSource.getConnection().isValid(1)); - } +package com.baeldung.connectionpool; + +import java.sql.SQLException; +import static org.junit.Assert.assertTrue; +import org.junit.Test; + +public class HikariCPDataSourceUnitTest { + + @Test + public void givenHikariDataSourceClass_whenCalledgetConnection_thenCorrect() throws SQLException { + assertTrue(HikariCPDataSource.getConnection().isValid(1)); + } } \ No newline at end of file diff --git a/core-java-persistence/src/test/java/com/baeldung/jdbc/BatchProcessingLiveTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/BatchProcessingLiveTest.java similarity index 100% rename from core-java-persistence/src/test/java/com/baeldung/jdbc/BatchProcessingLiveTest.java rename to persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/BatchProcessingLiveTest.java diff --git a/core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java similarity index 100% rename from core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java rename to persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java diff --git a/core-java-persistence/src/test/java/com/baeldung/jdbcrowset/JdbcRowSetLiveTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbcrowset/JdbcRowSetLiveTest.java similarity index 100% rename from core-java-persistence/src/test/java/com/baeldung/jdbcrowset/JdbcRowSetLiveTest.java rename to persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbcrowset/JdbcRowSetLiveTest.java diff --git a/deltaspike/.gitignore b/persistence-modules/deltaspike/.gitignore similarity index 100% rename from deltaspike/.gitignore rename to persistence-modules/deltaspike/.gitignore diff --git a/deltaspike/README.md b/persistence-modules/deltaspike/README.md similarity index 100% rename from deltaspike/README.md rename to persistence-modules/deltaspike/README.md diff --git a/deltaspike/pom.xml b/persistence-modules/deltaspike/pom.xml similarity index 99% rename from deltaspike/pom.xml rename to persistence-modules/deltaspike/pom.xml index 8ab3e3fd80..b798d2f39e 100644 --- a/deltaspike/pom.xml +++ b/persistence-modules/deltaspike/pom.xml @@ -14,6 +14,7 @@ com.baeldung parent-modules 1.0.0-SNAPSHOT + ../../ diff --git a/deltaspike/src/main/java/baeldung/controller/MemberController.java b/persistence-modules/deltaspike/src/main/java/baeldung/controller/MemberController.java similarity index 100% rename from deltaspike/src/main/java/baeldung/controller/MemberController.java rename to persistence-modules/deltaspike/src/main/java/baeldung/controller/MemberController.java diff --git a/deltaspike/src/main/java/baeldung/data/EntityManagerProducer.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/EntityManagerProducer.java similarity index 100% rename from deltaspike/src/main/java/baeldung/data/EntityManagerProducer.java rename to persistence-modules/deltaspike/src/main/java/baeldung/data/EntityManagerProducer.java diff --git a/deltaspike/src/main/java/baeldung/data/MemberListProducer.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/MemberListProducer.java similarity index 100% rename from deltaspike/src/main/java/baeldung/data/MemberListProducer.java rename to persistence-modules/deltaspike/src/main/java/baeldung/data/MemberListProducer.java diff --git a/deltaspike/src/main/java/baeldung/data/MemberRepository.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/MemberRepository.java similarity index 100% rename from deltaspike/src/main/java/baeldung/data/MemberRepository.java rename to persistence-modules/deltaspike/src/main/java/baeldung/data/MemberRepository.java diff --git a/deltaspike/src/main/java/baeldung/data/QueryDslRepositoryExtension.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/QueryDslRepositoryExtension.java similarity index 100% rename from deltaspike/src/main/java/baeldung/data/QueryDslRepositoryExtension.java rename to persistence-modules/deltaspike/src/main/java/baeldung/data/QueryDslRepositoryExtension.java diff --git a/deltaspike/src/main/java/baeldung/data/QueryDslSupport.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/QueryDslSupport.java similarity index 100% rename from deltaspike/src/main/java/baeldung/data/QueryDslSupport.java rename to persistence-modules/deltaspike/src/main/java/baeldung/data/QueryDslSupport.java diff --git a/deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerProducer.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerProducer.java similarity index 100% rename from deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerProducer.java rename to persistence-modules/deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerProducer.java diff --git a/deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerResolver.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerResolver.java similarity index 100% rename from deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerResolver.java rename to persistence-modules/deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerResolver.java diff --git a/deltaspike/src/main/java/baeldung/data/SecondaryPersistenceUnit.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/SecondaryPersistenceUnit.java similarity index 100% rename from deltaspike/src/main/java/baeldung/data/SecondaryPersistenceUnit.java rename to persistence-modules/deltaspike/src/main/java/baeldung/data/SecondaryPersistenceUnit.java diff --git a/deltaspike/src/main/java/baeldung/data/SimpleUserRepository.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/SimpleUserRepository.java similarity index 100% rename from deltaspike/src/main/java/baeldung/data/SimpleUserRepository.java rename to persistence-modules/deltaspike/src/main/java/baeldung/data/SimpleUserRepository.java diff --git a/deltaspike/src/main/java/baeldung/data/UserRepository.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/UserRepository.java similarity index 100% rename from deltaspike/src/main/java/baeldung/data/UserRepository.java rename to persistence-modules/deltaspike/src/main/java/baeldung/data/UserRepository.java diff --git a/deltaspike/src/main/java/baeldung/model/Address.java b/persistence-modules/deltaspike/src/main/java/baeldung/model/Address.java similarity index 100% rename from deltaspike/src/main/java/baeldung/model/Address.java rename to persistence-modules/deltaspike/src/main/java/baeldung/model/Address.java diff --git a/deltaspike/src/main/java/baeldung/model/Member.java b/persistence-modules/deltaspike/src/main/java/baeldung/model/Member.java similarity index 100% rename from deltaspike/src/main/java/baeldung/model/Member.java rename to persistence-modules/deltaspike/src/main/java/baeldung/model/Member.java diff --git a/deltaspike/src/main/java/baeldung/model/User.java b/persistence-modules/deltaspike/src/main/java/baeldung/model/User.java similarity index 100% rename from deltaspike/src/main/java/baeldung/model/User.java rename to persistence-modules/deltaspike/src/main/java/baeldung/model/User.java diff --git a/deltaspike/src/main/java/baeldung/rest/JaxRsActivator.java b/persistence-modules/deltaspike/src/main/java/baeldung/rest/JaxRsActivator.java similarity index 100% rename from deltaspike/src/main/java/baeldung/rest/JaxRsActivator.java rename to persistence-modules/deltaspike/src/main/java/baeldung/rest/JaxRsActivator.java diff --git a/deltaspike/src/main/java/baeldung/rest/MemberResourceRESTService.java b/persistence-modules/deltaspike/src/main/java/baeldung/rest/MemberResourceRESTService.java similarity index 100% rename from deltaspike/src/main/java/baeldung/rest/MemberResourceRESTService.java rename to persistence-modules/deltaspike/src/main/java/baeldung/rest/MemberResourceRESTService.java diff --git a/deltaspike/src/main/java/baeldung/service/MemberRegistration.java b/persistence-modules/deltaspike/src/main/java/baeldung/service/MemberRegistration.java similarity index 100% rename from deltaspike/src/main/java/baeldung/service/MemberRegistration.java rename to persistence-modules/deltaspike/src/main/java/baeldung/service/MemberRegistration.java diff --git a/deltaspike/src/main/java/baeldung/util/Resources.java b/persistence-modules/deltaspike/src/main/java/baeldung/util/Resources.java similarity index 100% rename from deltaspike/src/main/java/baeldung/util/Resources.java rename to persistence-modules/deltaspike/src/main/java/baeldung/util/Resources.java diff --git a/deltaspike/src/main/resources/META-INF/apache-deltaspike.properties b/persistence-modules/deltaspike/src/main/resources/META-INF/apache-deltaspike.properties similarity index 100% rename from deltaspike/src/main/resources/META-INF/apache-deltaspike.properties rename to persistence-modules/deltaspike/src/main/resources/META-INF/apache-deltaspike.properties diff --git a/deltaspike/src/main/resources/META-INF/beans.xml b/persistence-modules/deltaspike/src/main/resources/META-INF/beans.xml similarity index 100% rename from deltaspike/src/main/resources/META-INF/beans.xml rename to persistence-modules/deltaspike/src/main/resources/META-INF/beans.xml diff --git a/deltaspike/src/main/resources/META-INF/persistence.xml b/persistence-modules/deltaspike/src/main/resources/META-INF/persistence.xml similarity index 100% rename from deltaspike/src/main/resources/META-INF/persistence.xml rename to persistence-modules/deltaspike/src/main/resources/META-INF/persistence.xml diff --git a/deltaspike/src/main/resources/import.sql b/persistence-modules/deltaspike/src/main/resources/import.sql similarity index 100% rename from deltaspike/src/main/resources/import.sql rename to persistence-modules/deltaspike/src/main/resources/import.sql diff --git a/deltaspike/src/main/resources/logback.xml b/persistence-modules/deltaspike/src/main/resources/logback.xml similarity index 100% rename from deltaspike/src/main/resources/logback.xml rename to persistence-modules/deltaspike/src/main/resources/logback.xml diff --git a/deltaspike/src/main/webapp/WEB-INF/baeldung-jee7-seed-ds.xml b/persistence-modules/deltaspike/src/main/webapp/WEB-INF/baeldung-jee7-seed-ds.xml similarity index 100% rename from deltaspike/src/main/webapp/WEB-INF/baeldung-jee7-seed-ds.xml rename to persistence-modules/deltaspike/src/main/webapp/WEB-INF/baeldung-jee7-seed-ds.xml diff --git a/deltaspike/src/main/webapp/WEB-INF/baeldung-jee7-seed-secondary-ds.xml b/persistence-modules/deltaspike/src/main/webapp/WEB-INF/baeldung-jee7-seed-secondary-ds.xml similarity index 100% rename from deltaspike/src/main/webapp/WEB-INF/baeldung-jee7-seed-secondary-ds.xml rename to persistence-modules/deltaspike/src/main/webapp/WEB-INF/baeldung-jee7-seed-secondary-ds.xml diff --git a/deltaspike/src/main/webapp/WEB-INF/beans.xml b/persistence-modules/deltaspike/src/main/webapp/WEB-INF/beans.xml similarity index 100% rename from deltaspike/src/main/webapp/WEB-INF/beans.xml rename to persistence-modules/deltaspike/src/main/webapp/WEB-INF/beans.xml diff --git a/deltaspike/src/main/webapp/WEB-INF/faces-config.xml b/persistence-modules/deltaspike/src/main/webapp/WEB-INF/faces-config.xml similarity index 100% rename from deltaspike/src/main/webapp/WEB-INF/faces-config.xml rename to persistence-modules/deltaspike/src/main/webapp/WEB-INF/faces-config.xml diff --git a/deltaspike/src/main/webapp/WEB-INF/templates/default.xhtml b/persistence-modules/deltaspike/src/main/webapp/WEB-INF/templates/default.xhtml similarity index 100% rename from deltaspike/src/main/webapp/WEB-INF/templates/default.xhtml rename to persistence-modules/deltaspike/src/main/webapp/WEB-INF/templates/default.xhtml diff --git a/deltaspike/src/main/webapp/index.html b/persistence-modules/deltaspike/src/main/webapp/index.html similarity index 100% rename from deltaspike/src/main/webapp/index.html rename to persistence-modules/deltaspike/src/main/webapp/index.html diff --git a/deltaspike/src/main/webapp/index.xhtml b/persistence-modules/deltaspike/src/main/webapp/index.xhtml similarity index 100% rename from deltaspike/src/main/webapp/index.xhtml rename to persistence-modules/deltaspike/src/main/webapp/index.xhtml diff --git a/deltaspike/src/main/webapp/resources/css/screen.css b/persistence-modules/deltaspike/src/main/webapp/resources/css/screen.css similarity index 100% rename from deltaspike/src/main/webapp/resources/css/screen.css rename to persistence-modules/deltaspike/src/main/webapp/resources/css/screen.css diff --git a/deltaspike/src/main/webapp/resources/gfx/asidebkg.png b/persistence-modules/deltaspike/src/main/webapp/resources/gfx/asidebkg.png similarity index 100% rename from deltaspike/src/main/webapp/resources/gfx/asidebkg.png rename to persistence-modules/deltaspike/src/main/webapp/resources/gfx/asidebkg.png diff --git a/deltaspike/src/main/webapp/resources/gfx/bkg-blkheader.png b/persistence-modules/deltaspike/src/main/webapp/resources/gfx/bkg-blkheader.png similarity index 100% rename from deltaspike/src/main/webapp/resources/gfx/bkg-blkheader.png rename to persistence-modules/deltaspike/src/main/webapp/resources/gfx/bkg-blkheader.png diff --git a/deltaspike/src/main/webapp/resources/gfx/dualbrand_logo.png b/persistence-modules/deltaspike/src/main/webapp/resources/gfx/dualbrand_logo.png similarity index 100% rename from deltaspike/src/main/webapp/resources/gfx/dualbrand_logo.png rename to persistence-modules/deltaspike/src/main/webapp/resources/gfx/dualbrand_logo.png diff --git a/deltaspike/src/main/webapp/resources/gfx/headerbkg.png b/persistence-modules/deltaspike/src/main/webapp/resources/gfx/headerbkg.png similarity index 100% rename from deltaspike/src/main/webapp/resources/gfx/headerbkg.png rename to persistence-modules/deltaspike/src/main/webapp/resources/gfx/headerbkg.png diff --git a/deltaspike/src/main/webapp/resources/gfx/wildfly_400x130.jpg b/persistence-modules/deltaspike/src/main/webapp/resources/gfx/wildfly_400x130.jpg similarity index 100% rename from deltaspike/src/main/webapp/resources/gfx/wildfly_400x130.jpg rename to persistence-modules/deltaspike/src/main/webapp/resources/gfx/wildfly_400x130.jpg diff --git a/deltaspike/src/test/java/baeldung/ValidatorProducer.java b/persistence-modules/deltaspike/src/test/java/baeldung/ValidatorProducer.java similarity index 100% rename from deltaspike/src/test/java/baeldung/ValidatorProducer.java rename to persistence-modules/deltaspike/src/test/java/baeldung/ValidatorProducer.java diff --git a/deltaspike/src/test/java/baeldung/data/TestEntityManagerProducer.java b/persistence-modules/deltaspike/src/test/java/baeldung/data/TestEntityManagerProducer.java similarity index 100% rename from deltaspike/src/test/java/baeldung/data/TestEntityManagerProducer.java rename to persistence-modules/deltaspike/src/test/java/baeldung/data/TestEntityManagerProducer.java diff --git a/deltaspike/src/test/java/baeldung/test/MemberRegistrationLiveTest.java b/persistence-modules/deltaspike/src/test/java/baeldung/test/MemberRegistrationLiveTest.java similarity index 100% rename from deltaspike/src/test/java/baeldung/test/MemberRegistrationLiveTest.java rename to persistence-modules/deltaspike/src/test/java/baeldung/test/MemberRegistrationLiveTest.java diff --git a/deltaspike/src/test/java/baeldung/test/SimpleUserRepositoryUnitTest.java b/persistence-modules/deltaspike/src/test/java/baeldung/test/SimpleUserRepositoryUnitTest.java similarity index 100% rename from deltaspike/src/test/java/baeldung/test/SimpleUserRepositoryUnitTest.java rename to persistence-modules/deltaspike/src/test/java/baeldung/test/SimpleUserRepositoryUnitTest.java diff --git a/deltaspike/src/test/java/baeldung/test/UserRepositoryUnitTest.java b/persistence-modules/deltaspike/src/test/java/baeldung/test/UserRepositoryUnitTest.java similarity index 100% rename from deltaspike/src/test/java/baeldung/test/UserRepositoryUnitTest.java rename to persistence-modules/deltaspike/src/test/java/baeldung/test/UserRepositoryUnitTest.java diff --git a/deltaspike/src/test/resources/META-INF/apache-deltaspike.properties b/persistence-modules/deltaspike/src/test/resources/META-INF/apache-deltaspike.properties similarity index 100% rename from deltaspike/src/test/resources/META-INF/apache-deltaspike.properties rename to persistence-modules/deltaspike/src/test/resources/META-INF/apache-deltaspike.properties diff --git a/deltaspike/src/test/resources/META-INF/beans.xml b/persistence-modules/deltaspike/src/test/resources/META-INF/beans.xml similarity index 100% rename from deltaspike/src/test/resources/META-INF/beans.xml rename to persistence-modules/deltaspike/src/test/resources/META-INF/beans.xml diff --git a/deltaspike/src/test/resources/META-INF/persistence.xml b/persistence-modules/deltaspike/src/test/resources/META-INF/persistence.xml similarity index 100% rename from deltaspike/src/test/resources/META-INF/persistence.xml rename to persistence-modules/deltaspike/src/test/resources/META-INF/persistence.xml diff --git a/deltaspike/src/test/resources/arquillian.xml b/persistence-modules/deltaspike/src/test/resources/arquillian.xml similarity index 100% rename from deltaspike/src/test/resources/arquillian.xml rename to persistence-modules/deltaspike/src/test/resources/arquillian.xml diff --git a/deltaspike/src/test/resources/import.sql b/persistence-modules/deltaspike/src/test/resources/import.sql similarity index 100% rename from deltaspike/src/test/resources/import.sql rename to persistence-modules/deltaspike/src/test/resources/import.sql diff --git a/deltaspike/src/test/resources/test-ds.xml b/persistence-modules/deltaspike/src/test/resources/test-ds.xml similarity index 100% rename from deltaspike/src/test/resources/test-ds.xml rename to persistence-modules/deltaspike/src/test/resources/test-ds.xml diff --git a/deltaspike/src/test/resources/test-secondary-ds.xml b/persistence-modules/deltaspike/src/test/resources/test-secondary-ds.xml similarity index 100% rename from deltaspike/src/test/resources/test-secondary-ds.xml rename to persistence-modules/deltaspike/src/test/resources/test-secondary-ds.xml diff --git a/influxdb/README.md b/persistence-modules/influxdb/README.md similarity index 100% rename from influxdb/README.md rename to persistence-modules/influxdb/README.md diff --git a/influxdb/pom.xml b/persistence-modules/influxdb/pom.xml similarity index 96% rename from influxdb/pom.xml rename to persistence-modules/influxdb/pom.xml index 5bb94bb6e2..5043d61897 100644 --- a/influxdb/pom.xml +++ b/persistence-modules/influxdb/pom.xml @@ -12,6 +12,7 @@ com.baeldung parent-modules 1.0.0-SNAPSHOT + ../../ diff --git a/influxdb/src/main/java/com/baeldung/influxdb/MemoryPoint.java b/persistence-modules/influxdb/src/main/java/com/baeldung/influxdb/MemoryPoint.java similarity index 100% rename from influxdb/src/main/java/com/baeldung/influxdb/MemoryPoint.java rename to persistence-modules/influxdb/src/main/java/com/baeldung/influxdb/MemoryPoint.java diff --git a/influxdb/src/main/resources/logback.xml b/persistence-modules/influxdb/src/main/resources/logback.xml similarity index 100% rename from influxdb/src/main/resources/logback.xml rename to persistence-modules/influxdb/src/main/resources/logback.xml diff --git a/influxdb/src/test/java/com/baeldung/influxdb/InfluxDBConnectionLiveTest.java b/persistence-modules/influxdb/src/test/java/com/baeldung/influxdb/InfluxDBConnectionLiveTest.java similarity index 100% rename from influxdb/src/test/java/com/baeldung/influxdb/InfluxDBConnectionLiveTest.java rename to persistence-modules/influxdb/src/test/java/com/baeldung/influxdb/InfluxDBConnectionLiveTest.java diff --git a/influxdb/src/test/resources/logback.xml b/persistence-modules/influxdb/src/test/resources/logback.xml similarity index 100% rename from influxdb/src/test/resources/logback.xml rename to persistence-modules/influxdb/src/test/resources/logback.xml diff --git a/orientdb/.gitignore b/persistence-modules/orientdb/.gitignore similarity index 100% rename from orientdb/.gitignore rename to persistence-modules/orientdb/.gitignore diff --git a/orientdb/.mvn/wrapper/maven-wrapper.jar b/persistence-modules/orientdb/.mvn/wrapper/maven-wrapper.jar similarity index 100% rename from orientdb/.mvn/wrapper/maven-wrapper.jar rename to persistence-modules/orientdb/.mvn/wrapper/maven-wrapper.jar diff --git a/orientdb/.mvn/wrapper/maven-wrapper.properties b/persistence-modules/orientdb/.mvn/wrapper/maven-wrapper.properties similarity index 100% rename from orientdb/.mvn/wrapper/maven-wrapper.properties rename to persistence-modules/orientdb/.mvn/wrapper/maven-wrapper.properties diff --git a/orientdb/README.md b/persistence-modules/orientdb/README.md similarity index 100% rename from orientdb/README.md rename to persistence-modules/orientdb/README.md diff --git a/orientdb/mvnw b/persistence-modules/orientdb/mvnw old mode 100755 new mode 100644 similarity index 100% rename from orientdb/mvnw rename to persistence-modules/orientdb/mvnw diff --git a/orientdb/mvnw.cmd b/persistence-modules/orientdb/mvnw.cmd similarity index 100% rename from orientdb/mvnw.cmd rename to persistence-modules/orientdb/mvnw.cmd diff --git a/orientdb/pom.xml b/persistence-modules/orientdb/pom.xml similarity index 97% rename from orientdb/pom.xml rename to persistence-modules/orientdb/pom.xml index e1c7ac42bb..e4bc9a0585 100644 --- a/orientdb/pom.xml +++ b/persistence-modules/orientdb/pom.xml @@ -12,6 +12,7 @@ com.baeldung parent-modules 1.0.0-SNAPSHOT + ../../ diff --git a/orientdb/src/main/java/com/baeldung/orientdb/Author.java b/persistence-modules/orientdb/src/main/java/com/baeldung/orientdb/Author.java similarity index 100% rename from orientdb/src/main/java/com/baeldung/orientdb/Author.java rename to persistence-modules/orientdb/src/main/java/com/baeldung/orientdb/Author.java diff --git a/orientdb/src/main/resources/logback.xml b/persistence-modules/orientdb/src/main/resources/logback.xml similarity index 100% rename from orientdb/src/main/resources/logback.xml rename to persistence-modules/orientdb/src/main/resources/logback.xml diff --git a/orientdb/src/test/java/com/baeldung/orientdb/OrientDBDocumentAPILiveTest.java b/persistence-modules/orientdb/src/test/java/com/baeldung/orientdb/OrientDBDocumentAPILiveTest.java similarity index 100% rename from orientdb/src/test/java/com/baeldung/orientdb/OrientDBDocumentAPILiveTest.java rename to persistence-modules/orientdb/src/test/java/com/baeldung/orientdb/OrientDBDocumentAPILiveTest.java diff --git a/orientdb/src/test/java/com/baeldung/orientdb/OrientDBGraphAPILiveTest.java b/persistence-modules/orientdb/src/test/java/com/baeldung/orientdb/OrientDBGraphAPILiveTest.java similarity index 100% rename from orientdb/src/test/java/com/baeldung/orientdb/OrientDBGraphAPILiveTest.java rename to persistence-modules/orientdb/src/test/java/com/baeldung/orientdb/OrientDBGraphAPILiveTest.java diff --git a/orientdb/src/test/java/com/baeldung/orientdb/OrientDBObjectAPILiveTest.java b/persistence-modules/orientdb/src/test/java/com/baeldung/orientdb/OrientDBObjectAPILiveTest.java similarity index 100% rename from orientdb/src/test/java/com/baeldung/orientdb/OrientDBObjectAPILiveTest.java rename to persistence-modules/orientdb/src/test/java/com/baeldung/orientdb/OrientDBObjectAPILiveTest.java diff --git a/spring-boot-persistence/.gitignore b/persistence-modules/spring-boot-persistence/.gitignore similarity index 89% rename from spring-boot-persistence/.gitignore rename to persistence-modules/spring-boot-persistence/.gitignore index 88e3308e9d..da7c2c5c0a 100644 --- a/spring-boot-persistence/.gitignore +++ b/persistence-modules/spring-boot-persistence/.gitignore @@ -1,5 +1,5 @@ -/target/ -.settings/ -.classpath -.project - +/target/ +.settings/ +.classpath +.project + diff --git a/spring-boot-persistence/.mvn/wrapper/maven-wrapper.properties b/persistence-modules/spring-boot-persistence/.mvn/wrapper/maven-wrapper.properties old mode 100755 new mode 100644 similarity index 100% rename from spring-boot-persistence/.mvn/wrapper/maven-wrapper.properties rename to persistence-modules/spring-boot-persistence/.mvn/wrapper/maven-wrapper.properties diff --git a/spring-boot-persistence/README.MD b/persistence-modules/spring-boot-persistence/README.MD similarity index 100% rename from spring-boot-persistence/README.MD rename to persistence-modules/spring-boot-persistence/README.MD diff --git a/spring-boot-persistence/mvnw b/persistence-modules/spring-boot-persistence/mvnw old mode 100755 new mode 100644 similarity index 100% rename from spring-boot-persistence/mvnw rename to persistence-modules/spring-boot-persistence/mvnw diff --git a/spring-boot-persistence/mvnw.cmd b/persistence-modules/spring-boot-persistence/mvnw.cmd old mode 100755 new mode 100644 similarity index 97% rename from spring-boot-persistence/mvnw.cmd rename to persistence-modules/spring-boot-persistence/mvnw.cmd index 4f0b068a03..6a6eec39ba --- a/spring-boot-persistence/mvnw.cmd +++ b/persistence-modules/spring-boot-persistence/mvnw.cmd @@ -1,145 +1,145 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM set title of command window -title %0 -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" - -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven2 Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" + +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/spring-boot-persistence/pom.xml b/persistence-modules/spring-boot-persistence/pom.xml similarity index 93% rename from spring-boot-persistence/pom.xml rename to persistence-modules/spring-boot-persistence/pom.xml index 08989edfa9..b34e33e38a 100644 --- a/spring-boot-persistence/pom.xml +++ b/persistence-modules/spring-boot-persistence/pom.xml @@ -1,75 +1,75 @@ - - - 4.0.0 - - com.baeldung - spring-boot-persistence - 0.1.0 - - - parent-boot-2 - com.baeldung - 0.0.1-SNAPSHOT - ../parent-boot-2 - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - com.zaxxer - HikariCP - - - - - org.springframework.boot - spring-boot-starter-test - test - - - org.apache.tomcat - tomcat-jdbc - ${tomcat-jdbc.version} - - - mysql - mysql-connector-java - ${mysql-connector-java.version} - - - com.h2database - h2 - ${h2database.version} - runtime - - - - - UTF-8 - 1.8 - 8.0.12 - 9.0.10 - 1.4.197 - - - - spring-boot-persistence - - - src/main/resources - true - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - + + + 4.0.0 + + com.baeldung + spring-boot-persistence + 0.1.0 + + + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + com.zaxxer + HikariCP + + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.apache.tomcat + tomcat-jdbc + ${tomcat-jdbc.version} + + + mysql + mysql-connector-java + ${mysql-connector-java.version} + + + com.h2database + h2 + ${h2database.version} + runtime + + + + + UTF-8 + 1.8 + 8.0.12 + 9.0.10 + 1.4.197 + + + + spring-boot-persistence + + + src/main/resources + true + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + diff --git a/spring-boot-persistence/src/main/java/com/baeldung/Application.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/Application.java similarity index 100% rename from spring-boot-persistence/src/main/java/com/baeldung/Application.java rename to persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/Application.java diff --git a/spring-boot-persistence/src/main/java/com/baeldung/boot/config/H2JpaConfig.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/boot/config/H2JpaConfig.java similarity index 100% rename from spring-boot-persistence/src/main/java/com/baeldung/boot/config/H2JpaConfig.java rename to persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/boot/config/H2JpaConfig.java diff --git a/spring-boot-persistence/src/main/java/com/baeldung/domain/Country.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/domain/Country.java similarity index 100% rename from spring-boot-persistence/src/main/java/com/baeldung/domain/Country.java rename to persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/domain/Country.java diff --git a/spring-boot-persistence/src/main/java/com/baeldung/domain/User.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/domain/User.java similarity index 100% rename from spring-boot-persistence/src/main/java/com/baeldung/domain/User.java rename to persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/domain/User.java diff --git a/spring-boot-persistence/src/main/java/com/baeldung/repository/UserRepository.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/repository/UserRepository.java similarity index 100% rename from spring-boot-persistence/src/main/java/com/baeldung/repository/UserRepository.java rename to persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/repository/UserRepository.java diff --git a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/SpringBootConsoleApplication.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/SpringBootConsoleApplication.java similarity index 97% rename from spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/SpringBootConsoleApplication.java rename to persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/SpringBootConsoleApplication.java index ff37442cd4..5be61b972f 100644 --- a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/SpringBootConsoleApplication.java +++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/SpringBootConsoleApplication.java @@ -1,22 +1,22 @@ -package com.baeldung.tomcatconnectionpool.application; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.domain.EntityScan; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -@SpringBootApplication -@EnableAutoConfiguration -@ComponentScan(basePackages={"com.baeldung.tomcatconnectionpool.application"}) -@EnableJpaRepositories(basePackages="com.baeldung.tomcatconnectionpool.application.repositories") -@EnableTransactionManagement -@EntityScan(basePackages="com.baeldung.tomcatconnectionpool.application.entities") -public class SpringBootConsoleApplication { - - public static void main(String[] args) { - SpringApplication.run(SpringBootConsoleApplication.class); - } -} +package com.baeldung.tomcatconnectionpool.application; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.domain.EntityScan; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@SpringBootApplication +@EnableAutoConfiguration +@ComponentScan(basePackages={"com.baeldung.tomcatconnectionpool.application"}) +@EnableJpaRepositories(basePackages="com.baeldung.tomcatconnectionpool.application.repositories") +@EnableTransactionManagement +@EntityScan(basePackages="com.baeldung.tomcatconnectionpool.application.entities") +public class SpringBootConsoleApplication { + + public static void main(String[] args) { + SpringApplication.run(SpringBootConsoleApplication.class); + } +} diff --git a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/entities/Customer.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/entities/Customer.java similarity index 95% rename from spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/entities/Customer.java rename to persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/entities/Customer.java index 4003d5aca9..712506eb98 100644 --- a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/entities/Customer.java +++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/entities/Customer.java @@ -1,53 +1,53 @@ -package com.baeldung.tomcatconnectionpool.application.entities; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -@Entity -@Table(name = "customers") -public class Customer { - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - private long id; - @Column(name = "first_name") - private String firstName; - @Column(name = "last_name") - private String lastName; - - public Customer() {} - - public Customer(String firstName, String lastName) { - this.firstName = firstName; - this.lastName = lastName; - } - - public long getId() { - return id; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - @Override - public String toString() { - return "Customer{" + "id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + '}'; - } -} +package com.baeldung.tomcatconnectionpool.application.entities; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name = "customers") +public class Customer { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private long id; + @Column(name = "first_name") + private String firstName; + @Column(name = "last_name") + private String lastName; + + public Customer() {} + + public Customer(String firstName, String lastName) { + this.firstName = firstName; + this.lastName = lastName; + } + + public long getId() { + return id; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + @Override + public String toString() { + return "Customer{" + "id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + '}'; + } +} diff --git a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/repositories/CustomerRepository.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/repositories/CustomerRepository.java similarity index 97% rename from spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/repositories/CustomerRepository.java rename to persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/repositories/CustomerRepository.java index 770906439c..c461243cf8 100644 --- a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/repositories/CustomerRepository.java +++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/repositories/CustomerRepository.java @@ -1,12 +1,12 @@ -package com.baeldung.tomcatconnectionpool.application.repositories; - -import com.baeldung.tomcatconnectionpool.application.entities.Customer; -import java.util.List; -import org.springframework.data.repository.CrudRepository; -import org.springframework.stereotype.Repository; - -@Repository -public interface CustomerRepository extends CrudRepository { - - List findByLastName(String lastName); -} +package com.baeldung.tomcatconnectionpool.application.repositories; + +import com.baeldung.tomcatconnectionpool.application.entities.Customer; +import java.util.List; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface CustomerRepository extends CrudRepository { + + List findByLastName(String lastName); +} diff --git a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/runners/CommandLineCrudRunner.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/runners/CommandLineCrudRunner.java similarity index 97% rename from spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/runners/CommandLineCrudRunner.java rename to persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/runners/CommandLineCrudRunner.java index 9666bac5a5..722c7582a1 100644 --- a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/runners/CommandLineCrudRunner.java +++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/runners/CommandLineCrudRunner.java @@ -1,37 +1,37 @@ -package com.baeldung.tomcatconnectionpool.application.runners; - -import com.baeldung.tomcatconnectionpool.application.entities.Customer; -import com.baeldung.tomcatconnectionpool.application.repositories.CustomerRepository; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.CommandLineRunner; -import org.springframework.stereotype.Component; - -@Component -public class CommandLineCrudRunner implements CommandLineRunner { - - private static final Logger logger = LoggerFactory.getLogger(CommandLineCrudRunner.class); - - @Autowired - private CustomerRepository customerRepository; - - @Override - public void run(String... args) throws Exception { - customerRepository.save(new Customer("John", "Doe")); - customerRepository.save(new Customer("Jennifer", "Wilson")); - - logger.info("Customers found with findAll():"); - customerRepository.findAll().forEach(c -> logger.info(c.toString())); - - logger.info("Customer found with findById(1L):"); - Customer customer = customerRepository.findById(1L) - .orElseGet(() -> new Customer("Non-existing customer", "")); - logger.info(customer.toString()); - - logger.info("Customer found with findByLastName('Wilson'):"); - customerRepository.findByLastName("Wilson").forEach(c -> { - logger.info(c.toString()); - }); - } -} +package com.baeldung.tomcatconnectionpool.application.runners; + +import com.baeldung.tomcatconnectionpool.application.entities.Customer; +import com.baeldung.tomcatconnectionpool.application.repositories.CustomerRepository; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.CommandLineRunner; +import org.springframework.stereotype.Component; + +@Component +public class CommandLineCrudRunner implements CommandLineRunner { + + private static final Logger logger = LoggerFactory.getLogger(CommandLineCrudRunner.class); + + @Autowired + private CustomerRepository customerRepository; + + @Override + public void run(String... args) throws Exception { + customerRepository.save(new Customer("John", "Doe")); + customerRepository.save(new Customer("Jennifer", "Wilson")); + + logger.info("Customers found with findAll():"); + customerRepository.findAll().forEach(c -> logger.info(c.toString())); + + logger.info("Customer found with findById(1L):"); + Customer customer = customerRepository.findById(1L) + .orElseGet(() -> new Customer("Non-existing customer", "")); + logger.info(customer.toString()); + + logger.info("Customer found with findByLastName('Wilson'):"); + customerRepository.findByLastName("Wilson").forEach(c -> { + logger.info(c.toString()); + }); + } +} diff --git a/spring-boot-persistence/src/main/java/org/baeldung/boot/domain/GenericEntity.java b/persistence-modules/spring-boot-persistence/src/main/java/org/baeldung/boot/domain/GenericEntity.java similarity index 100% rename from spring-boot-persistence/src/main/java/org/baeldung/boot/domain/GenericEntity.java rename to persistence-modules/spring-boot-persistence/src/main/java/org/baeldung/boot/domain/GenericEntity.java diff --git a/spring-boot-persistence/src/main/java/org/baeldung/boot/repository/GenericEntityRepository.java b/persistence-modules/spring-boot-persistence/src/main/java/org/baeldung/boot/repository/GenericEntityRepository.java similarity index 100% rename from spring-boot-persistence/src/main/java/org/baeldung/boot/repository/GenericEntityRepository.java rename to persistence-modules/spring-boot-persistence/src/main/java/org/baeldung/boot/repository/GenericEntityRepository.java diff --git a/spring-boot-persistence/src/main/resources/application.properties b/persistence-modules/spring-boot-persistence/src/main/resources/application.properties similarity index 100% rename from spring-boot-persistence/src/main/resources/application.properties rename to persistence-modules/spring-boot-persistence/src/main/resources/application.properties diff --git a/spring-boot-persistence/src/main/resources/data.sql b/persistence-modules/spring-boot-persistence/src/main/resources/data.sql similarity index 100% rename from spring-boot-persistence/src/main/resources/data.sql rename to persistence-modules/spring-boot-persistence/src/main/resources/data.sql diff --git a/spring-boot-persistence/src/main/resources/logback.xml b/persistence-modules/spring-boot-persistence/src/main/resources/logback.xml similarity index 100% rename from spring-boot-persistence/src/main/resources/logback.xml rename to persistence-modules/spring-boot-persistence/src/main/resources/logback.xml diff --git a/spring-boot-persistence/src/main/resources/persistence-generic-entity.properties b/persistence-modules/spring-boot-persistence/src/main/resources/persistence-generic-entity.properties similarity index 100% rename from spring-boot-persistence/src/main/resources/persistence-generic-entity.properties rename to persistence-modules/spring-boot-persistence/src/main/resources/persistence-generic-entity.properties diff --git a/spring-boot-persistence/src/main/resources/schema.sql b/persistence-modules/spring-boot-persistence/src/main/resources/schema.sql similarity index 100% rename from spring-boot-persistence/src/main/resources/schema.sql rename to persistence-modules/spring-boot-persistence/src/main/resources/schema.sql diff --git a/spring-boot-persistence/src/test/java/com/baeldung/SpringBootH2IntegrationTest.java b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/SpringBootH2IntegrationTest.java similarity index 100% rename from spring-boot-persistence/src/test/java/com/baeldung/SpringBootH2IntegrationTest.java rename to persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/SpringBootH2IntegrationTest.java diff --git a/spring-boot-persistence/src/test/java/com/baeldung/SpringBootJPAIntegrationTest.java b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/SpringBootJPAIntegrationTest.java similarity index 100% rename from spring-boot-persistence/src/test/java/com/baeldung/SpringBootJPAIntegrationTest.java rename to persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/SpringBootJPAIntegrationTest.java diff --git a/spring-boot-persistence/src/test/java/com/baeldung/SpringBootProfileIntegrationTest.java b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/SpringBootProfileIntegrationTest.java similarity index 100% rename from spring-boot-persistence/src/test/java/com/baeldung/SpringBootProfileIntegrationTest.java rename to persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/SpringBootProfileIntegrationTest.java diff --git a/spring-boot-persistence/src/test/java/com/baeldung/repository/UserRepositoryIntegrationTest.java b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/repository/UserRepositoryIntegrationTest.java similarity index 100% rename from spring-boot-persistence/src/test/java/com/baeldung/repository/UserRepositoryIntegrationTest.java rename to persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/repository/UserRepositoryIntegrationTest.java diff --git a/spring-boot-persistence/src/test/java/com/baeldung/tomcatconnectionpool/test/application/SpringBootTomcatConnectionPoolIntegrationTest.java b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/tomcatconnectionpool/test/application/SpringBootTomcatConnectionPoolIntegrationTest.java similarity index 97% rename from spring-boot-persistence/src/test/java/com/baeldung/tomcatconnectionpool/test/application/SpringBootTomcatConnectionPoolIntegrationTest.java rename to persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/tomcatconnectionpool/test/application/SpringBootTomcatConnectionPoolIntegrationTest.java index c68e137fb0..eb000bbc09 100644 --- a/spring-boot-persistence/src/test/java/com/baeldung/tomcatconnectionpool/test/application/SpringBootTomcatConnectionPoolIntegrationTest.java +++ b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/tomcatconnectionpool/test/application/SpringBootTomcatConnectionPoolIntegrationTest.java @@ -1,22 +1,22 @@ -package com.baeldung.tomcatconnectionpool.test.application; - -import javax.sql.DataSource; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.junit4.SpringRunner; -import static org.assertj.core.api.Assertions.*; -import org.springframework.boot.test.context.SpringBootTest; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class SpringBootTomcatConnectionPoolIntegrationTest { - - @Autowired - private DataSource dataSource; - - @Test - public void givenTomcatConnectionPoolInstance_whenCheckedPoolClassName_thenCorrect() { - assertThat(dataSource.getClass().getName()).isEqualTo("org.apache.tomcat.jdbc.pool.DataSource"); - } -} +package com.baeldung.tomcatconnectionpool.test.application; + +import javax.sql.DataSource; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.junit4.SpringRunner; +import static org.assertj.core.api.Assertions.*; +import org.springframework.boot.test.context.SpringBootTest; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class SpringBootTomcatConnectionPoolIntegrationTest { + + @Autowired + private DataSource dataSource; + + @Test + public void givenTomcatConnectionPoolInstance_whenCheckedPoolClassName_thenCorrect() { + assertThat(dataSource.getClass().getName()).isEqualTo("org.apache.tomcat.jdbc.pool.DataSource"); + } +} diff --git a/spring-boot-persistence/src/test/java/org/baeldung/config/H2TestProfileJPAConfig.java b/persistence-modules/spring-boot-persistence/src/test/java/org/baeldung/config/H2TestProfileJPAConfig.java similarity index 100% rename from spring-boot-persistence/src/test/java/org/baeldung/config/H2TestProfileJPAConfig.java rename to persistence-modules/spring-boot-persistence/src/test/java/org/baeldung/config/H2TestProfileJPAConfig.java diff --git a/spring-boot-persistence/src/test/resources/application.properties b/persistence-modules/spring-boot-persistence/src/test/resources/application.properties similarity index 100% rename from spring-boot-persistence/src/test/resources/application.properties rename to persistence-modules/spring-boot-persistence/src/test/resources/application.properties diff --git a/spring-boot-persistence/src/test/resources/import_active_users.sql b/persistence-modules/spring-boot-persistence/src/test/resources/import_active_users.sql similarity index 100% rename from spring-boot-persistence/src/test/resources/import_active_users.sql rename to persistence-modules/spring-boot-persistence/src/test/resources/import_active_users.sql diff --git a/spring-boot-persistence/src/test/resources/import_inactive_users.sql b/persistence-modules/spring-boot-persistence/src/test/resources/import_inactive_users.sql similarity index 100% rename from spring-boot-persistence/src/test/resources/import_inactive_users.sql rename to persistence-modules/spring-boot-persistence/src/test/resources/import_inactive_users.sql diff --git a/spring-boot-persistence/src/test/resources/migrated_users.sql b/persistence-modules/spring-boot-persistence/src/test/resources/migrated_users.sql similarity index 100% rename from spring-boot-persistence/src/test/resources/migrated_users.sql rename to persistence-modules/spring-boot-persistence/src/test/resources/migrated_users.sql diff --git a/spring-data-elasticsearch/README.md b/persistence-modules/spring-data-elasticsearch/README.md similarity index 100% rename from spring-data-elasticsearch/README.md rename to persistence-modules/spring-data-elasticsearch/README.md diff --git a/spring-data-elasticsearch/pom.xml b/persistence-modules/spring-data-elasticsearch/pom.xml similarity index 98% rename from spring-data-elasticsearch/pom.xml rename to persistence-modules/spring-data-elasticsearch/pom.xml index 99d8a70807..ee9e71a1cb 100644 --- a/spring-data-elasticsearch/pom.xml +++ b/persistence-modules/spring-data-elasticsearch/pom.xml @@ -11,7 +11,7 @@ com.baeldung parent-spring-5 0.0.1-SNAPSHOT - ../parent-spring-5 + ../../parent-spring-5 diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/elasticsearch/Person.java b/persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/elasticsearch/Person.java similarity index 100% rename from spring-data-elasticsearch/src/main/java/com/baeldung/elasticsearch/Person.java rename to persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/elasticsearch/Person.java diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/config/Config.java b/persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/config/Config.java similarity index 100% rename from spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/config/Config.java rename to persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/config/Config.java diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Article.java b/persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Article.java similarity index 100% rename from spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Article.java rename to persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Article.java diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Author.java b/persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Author.java similarity index 100% rename from spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Author.java rename to persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Author.java diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/repository/ArticleRepository.java b/persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/repository/ArticleRepository.java similarity index 100% rename from spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/repository/ArticleRepository.java rename to persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/repository/ArticleRepository.java diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleService.java b/persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleService.java similarity index 100% rename from spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleService.java rename to persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleService.java diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleServiceImpl.java b/persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleServiceImpl.java similarity index 100% rename from spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleServiceImpl.java rename to persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleServiceImpl.java diff --git a/spring-data-elasticsearch/src/main/resources/log4j2.properties b/persistence-modules/spring-data-elasticsearch/src/main/resources/log4j2.properties similarity index 100% rename from spring-data-elasticsearch/src/main/resources/log4j2.properties rename to persistence-modules/spring-data-elasticsearch/src/main/resources/log4j2.properties diff --git a/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/ElasticSearchManualTest.java b/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/ElasticSearchManualTest.java similarity index 100% rename from spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/ElasticSearchManualTest.java rename to persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/ElasticSearchManualTest.java diff --git a/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/GeoQueriesIntegrationTest.java b/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/GeoQueriesIntegrationTest.java similarity index 100% rename from spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/GeoQueriesIntegrationTest.java rename to persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/GeoQueriesIntegrationTest.java diff --git a/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchIntegrationTest.java b/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchIntegrationTest.java similarity index 100% rename from spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchIntegrationTest.java rename to persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchIntegrationTest.java diff --git a/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchQueryIntegrationTest.java b/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchQueryIntegrationTest.java similarity index 100% rename from spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchQueryIntegrationTest.java rename to persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchQueryIntegrationTest.java diff --git a/spring-data-elasticsearch/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-elasticsearch/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 100% rename from spring-data-elasticsearch/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to persistence-modules/spring-data-elasticsearch/src/test/java/org/baeldung/SpringContextIntegrationTest.java diff --git a/spring-data-jpa/README.md b/persistence-modules/spring-data-jpa/README.md similarity index 100% rename from spring-data-jpa/README.md rename to persistence-modules/spring-data-jpa/README.md diff --git a/spring-data-jpa/pom.xml b/persistence-modules/spring-data-jpa/pom.xml similarity index 95% rename from spring-data-jpa/pom.xml rename to persistence-modules/spring-data-jpa/pom.xml index 8691ce1f09..643210ab89 100644 --- a/spring-data-jpa/pom.xml +++ b/persistence-modules/spring-data-jpa/pom.xml @@ -2,15 +2,16 @@ + 4.0.0 + com.baeldung + spring-data-jpa + parent-boot-2 com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-2 + ../../parent-boot-2 - 4.0.0 - - spring-data-jpa diff --git a/spring-data-jpa/src/main/java/com/baeldung/Application.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/Application.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/Application.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/Application.java diff --git a/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 similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/config/PersistenceConfiguration.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceConfiguration.java diff --git a/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 similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/config/PersistenceProductConfiguration.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceProductConfiguration.java diff --git a/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 similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/config/PersistenceUserConfiguration.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceUserConfiguration.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/IFooDao.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/IFooDao.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/IFooDao.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/IFooDao.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ArticleRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ArticleRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ArticleRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ArticleRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/CustomItemRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/CustomItemRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/CustomItemRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/CustomItemRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/CustomItemTypeRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/CustomItemTypeRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/CustomItemTypeRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/CustomItemTypeRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ExtendedRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ExtendedRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ExtendedRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ExtendedRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ExtendedStudentRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ExtendedStudentRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ExtendedStudentRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ExtendedStudentRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/IBarCrudRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/IBarCrudRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/IBarCrudRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/IBarCrudRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/InventoryRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/InventoryRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/InventoryRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/InventoryRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ItemTypeRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ItemTypeRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ItemTypeRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ItemTypeRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/LocationRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/LocationRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/LocationRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/LocationRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ReadOnlyLocationRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ReadOnlyLocationRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ReadOnlyLocationRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ReadOnlyLocationRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/StoreRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/StoreRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/StoreRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/StoreRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/CustomItemRepositoryImpl.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/CustomItemRepositoryImpl.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/CustomItemRepositoryImpl.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/CustomItemRepositoryImpl.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/CustomItemTypeRepositoryImpl.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/CustomItemTypeRepositoryImpl.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/CustomItemTypeRepositoryImpl.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/CustomItemTypeRepositoryImpl.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/ExtendedRepositoryImpl.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/ExtendedRepositoryImpl.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/ExtendedRepositoryImpl.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/ExtendedRepositoryImpl.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/product/ProductRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/product/ProductRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/product/ProductRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/product/ProductRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/PossessionRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/PossessionRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/PossessionRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/PossessionRepository.java diff --git a/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 similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/UserRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/UserRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate2.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate2.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate2.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate2.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate2Repository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate2Repository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate2Repository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate2Repository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate3.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate3.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate3.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate3.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate3Repository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate3Repository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate3Repository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate3Repository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/ddd/event/AggregateRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/AggregateRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/ddd/event/AggregateRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/AggregateRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/ddd/event/DddConfig.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/DddConfig.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/ddd/event/DddConfig.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/DddConfig.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/ddd/event/DomainEvent.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/DomainEvent.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/ddd/event/DomainEvent.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/DomainEvent.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/ddd/event/DomainService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/DomainService.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/ddd/event/DomainService.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/DomainService.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/Article.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Article.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/domain/Article.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Article.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/Bar.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Bar.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/domain/Bar.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Bar.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/Foo.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Foo.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/domain/Foo.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Foo.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/Item.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Item.java similarity index 94% rename from spring-data-jpa/src/main/java/com/baeldung/domain/Item.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Item.java index 97ce14d92d..1e58fb25ba 100644 --- a/spring-data-jpa/src/main/java/com/baeldung/domain/Item.java +++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Item.java @@ -1,81 +1,81 @@ -package com.baeldung.domain; - -import java.math.BigDecimal; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.ManyToOne; - -@Entity -public class Item { - - private String color; - private String grade; - - @Id - private Long id; - - @ManyToOne - private ItemType itemType; - - private String name; - private BigDecimal price; - @ManyToOne - private Store store; - - public String getColor() { - return color; - } - - public String getGrade() { - return grade; - } - - public Long getId() { - return id; - } - - public ItemType getItemType() { - return itemType; - } - - public String getName() { - return name; - } - - public BigDecimal getPrice() { - return price; - } - - public Store getStore() { - return store; - } - - public void setColor(String color) { - this.color = color; - } - - public void setGrade(String grade) { - this.grade = grade; - } - - public void setId(Long id) { - this.id = id; - } - - public void setItemType(ItemType itemType) { - this.itemType = itemType; - } - - public void setName(String name) { - this.name = name; - } - - public void setPrice(BigDecimal price) { - this.price = price; - } - - public void setStore(Store store) { - this.store = store; - } -} +package com.baeldung.domain; + +import java.math.BigDecimal; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.ManyToOne; + +@Entity +public class Item { + + private String color; + private String grade; + + @Id + private Long id; + + @ManyToOne + private ItemType itemType; + + private String name; + private BigDecimal price; + @ManyToOne + private Store store; + + public String getColor() { + return color; + } + + public String getGrade() { + return grade; + } + + public Long getId() { + return id; + } + + public ItemType getItemType() { + return itemType; + } + + public String getName() { + return name; + } + + public BigDecimal getPrice() { + return price; + } + + public Store getStore() { + return store; + } + + public void setColor(String color) { + this.color = color; + } + + public void setGrade(String grade) { + this.grade = grade; + } + + public void setId(Long id) { + this.id = id; + } + + public void setItemType(ItemType itemType) { + this.itemType = itemType; + } + + public void setName(String name) { + this.name = name; + } + + public void setPrice(BigDecimal price) { + this.price = price; + } + + public void setStore(Store store) { + this.store = store; + } +} diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/ItemType.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/ItemType.java similarity index 94% rename from spring-data-jpa/src/main/java/com/baeldung/domain/ItemType.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/ItemType.java index 412079c2ae..b0349e0471 100644 --- a/spring-data-jpa/src/main/java/com/baeldung/domain/ItemType.java +++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/ItemType.java @@ -1,46 +1,46 @@ -package com.baeldung.domain; - -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.CascadeType; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.OneToMany; - -@Entity -public class ItemType { - - @Id - private Long id; - @OneToMany(cascade = CascadeType.ALL) - @JoinColumn(name = "ITEM_TYPE_ID") - private List items = new ArrayList<>(); - - private String name; - - public Long getId() { - return id; - } - - public List getItems() { - return items; - } - - public String getName() { - return name; - } - - public void setId(Long id) { - this.id = id; - } - - public void setItems(List items) { - this.items = items; - } - - public void setName(String name) { - this.name = name; - } -} +package com.baeldung.domain; + +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; + +@Entity +public class ItemType { + + @Id + private Long id; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "ITEM_TYPE_ID") + private List items = new ArrayList<>(); + + private String name; + + public Long getId() { + return id; + } + + public List getItems() { + return items; + } + + public String getName() { + return name; + } + + public void setId(Long id) { + this.id = id; + } + + public void setItems(List items) { + this.items = items; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/KVTag.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/KVTag.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/domain/KVTag.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/KVTag.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/Location.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Location.java similarity index 95% rename from spring-data-jpa/src/main/java/com/baeldung/domain/Location.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Location.java index 2178d378eb..4ca7295986 100644 --- a/spring-data-jpa/src/main/java/com/baeldung/domain/Location.java +++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Location.java @@ -1,55 +1,55 @@ -package com.baeldung.domain; - -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.CascadeType; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.OneToMany; - -@Entity -public class Location { - - private String city; - private String country; - @Id - private Long id; - - @OneToMany(cascade = CascadeType.ALL) - @JoinColumn(name = "LOCATION_ID") - private List stores = new ArrayList<>(); - - public String getCity() { - return city; - } - - public String getCountry() { - return country; - } - - public Long getId() { - return id; - } - - public List getStores() { - return stores; - } - - public void setCity(String city) { - this.city = city; - } - - public void setCountry(String country) { - this.country = country; - } - - public void setId(Long id) { - this.id = id; - } - - public void setStores(List stores) { - this.stores = stores; - } -} +package com.baeldung.domain; + +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; + +@Entity +public class Location { + + private String city; + private String country; + @Id + private Long id; + + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "LOCATION_ID") + private List stores = new ArrayList<>(); + + public String getCity() { + return city; + } + + public String getCountry() { + return country; + } + + public Long getId() { + return id; + } + + public List getStores() { + return stores; + } + + public void setCity(String city) { + this.city = city; + } + + public void setCountry(String country) { + this.country = country; + } + + public void setId(Long id) { + this.id = id; + } + + public void setStores(List stores) { + this.stores = stores; + } +} diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/MerchandiseEntity.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/MerchandiseEntity.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/domain/MerchandiseEntity.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/MerchandiseEntity.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/SkillTag.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/SkillTag.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/domain/SkillTag.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/SkillTag.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/Store.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Store.java similarity index 95% rename from spring-data-jpa/src/main/java/com/baeldung/domain/Store.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Store.java index e04684c479..4172051c71 100644 --- a/spring-data-jpa/src/main/java/com/baeldung/domain/Store.java +++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Store.java @@ -1,76 +1,76 @@ -package com.baeldung.domain; - -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.CascadeType; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; - -@Entity -public class Store { - - private Boolean active; - @Id - private Long id; - @OneToMany(cascade = CascadeType.ALL) - @JoinColumn(name = "STORE_ID") - private List items = new ArrayList<>(); - private Long itemsSold; - - @ManyToOne - private Location location; - - private String name; - - public Boolean getActive() { - return active; - } - - public Long getId() { - return id; - } - - public List getItems() { - return items; - } - - public Long getItemsSold() { - return itemsSold; - } - - public Location getLocation() { - return location; - } - - public String getName() { - return name; - } - - public void setActive(Boolean active) { - this.active = active; - } - - public void setId(Long id) { - this.id = id; - } - - public void setItems(List items) { - this.items = items; - } - - public void setItemsSold(Long itemsSold) { - this.itemsSold = itemsSold; - } - - public void setLocation(Location location) { - this.location = location; - } - - public void setName(String name) { - this.name = name; - } -} +package com.baeldung.domain; + +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; + +@Entity +public class Store { + + private Boolean active; + @Id + private Long id; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "STORE_ID") + private List items = new ArrayList<>(); + private Long itemsSold; + + @ManyToOne + private Location location; + + private String name; + + public Boolean getActive() { + return active; + } + + public Long getId() { + return id; + } + + public List getItems() { + return items; + } + + public Long getItemsSold() { + return itemsSold; + } + + public Location getLocation() { + return location; + } + + public String getName() { + return name; + } + + public void setActive(Boolean active) { + this.active = active; + } + + public void setId(Long id) { + this.id = id; + } + + public void setItems(List items) { + this.items = items; + } + + public void setItemsSold(Long itemsSold) { + this.itemsSold = itemsSold; + } + + public void setLocation(Location location) { + this.location = location; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/Student.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Student.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/domain/Student.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Student.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/product/Product.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/product/Product.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/domain/product/Product.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/product/Product.java diff --git a/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 similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/domain/user/Possession.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/user/Possession.java diff --git a/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 similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/domain/user/User.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/user/User.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/services/IBarService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/IBarService.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/services/IBarService.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/IBarService.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/services/IFooService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/IFooService.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/services/IFooService.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/IFooService.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/services/IOperations.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/IOperations.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/services/IOperations.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/IOperations.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/services/impl/AbstractService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/impl/AbstractService.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/services/impl/AbstractService.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/impl/AbstractService.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/services/impl/AbstractSpringDataJpaService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/impl/AbstractSpringDataJpaService.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/services/impl/AbstractSpringDataJpaService.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/impl/AbstractSpringDataJpaService.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/services/impl/BarSpringDataJpaService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/impl/BarSpringDataJpaService.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/services/impl/BarSpringDataJpaService.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/impl/BarSpringDataJpaService.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/services/impl/FooService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/impl/FooService.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/services/impl/FooService.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/impl/FooService.java diff --git a/spring-data-jpa/src/main/resources/application.properties b/persistence-modules/spring-data-jpa/src/main/resources/application.properties similarity index 100% rename from spring-data-jpa/src/main/resources/application.properties rename to persistence-modules/spring-data-jpa/src/main/resources/application.properties diff --git a/spring-data-jpa/src/main/resources/ddd.properties b/persistence-modules/spring-data-jpa/src/main/resources/ddd.properties similarity index 100% rename from spring-data-jpa/src/main/resources/ddd.properties rename to persistence-modules/spring-data-jpa/src/main/resources/ddd.properties diff --git a/spring-data-jpa/src/main/resources/logback.xml b/persistence-modules/spring-data-jpa/src/main/resources/logback.xml similarity index 100% rename from spring-data-jpa/src/main/resources/logback.xml rename to persistence-modules/spring-data-jpa/src/main/resources/logback.xml diff --git a/spring-data-jpa/src/main/resources/persistence-multiple-db.properties b/persistence-modules/spring-data-jpa/src/main/resources/persistence-multiple-db.properties similarity index 100% rename from spring-data-jpa/src/main/resources/persistence-multiple-db.properties rename to persistence-modules/spring-data-jpa/src/main/resources/persistence-multiple-db.properties diff --git a/spring-data-jpa/src/main/resources/persistence.properties b/persistence-modules/spring-data-jpa/src/main/resources/persistence.properties similarity index 100% rename from spring-data-jpa/src/main/resources/persistence.properties rename to persistence-modules/spring-data-jpa/src/main/resources/persistence.properties diff --git a/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/ArticleRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/ArticleRepositoryIntegrationTest.java similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/dao/repositories/ArticleRepositoryIntegrationTest.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/ArticleRepositoryIntegrationTest.java diff --git a/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/ExtendedStudentRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/ExtendedStudentRepositoryIntegrationTest.java similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/dao/repositories/ExtendedStudentRepositoryIntegrationTest.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/ExtendedStudentRepositoryIntegrationTest.java diff --git a/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/InventoryRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/InventoryRepositoryIntegrationTest.java similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/dao/repositories/InventoryRepositoryIntegrationTest.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/InventoryRepositoryIntegrationTest.java diff --git a/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/JpaRepositoriesIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/JpaRepositoriesIntegrationTest.java similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/dao/repositories/JpaRepositoriesIntegrationTest.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/JpaRepositoriesIntegrationTest.java diff --git a/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 similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryIntegrationTest.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryIntegrationTest.java diff --git a/spring-data-jpa/src/test/java/com/baeldung/ddd/event/Aggregate2EventsIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/ddd/event/Aggregate2EventsIntegrationTest.java similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/ddd/event/Aggregate2EventsIntegrationTest.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/ddd/event/Aggregate2EventsIntegrationTest.java diff --git a/spring-data-jpa/src/test/java/com/baeldung/ddd/event/Aggregate3EventsIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/ddd/event/Aggregate3EventsIntegrationTest.java similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/ddd/event/Aggregate3EventsIntegrationTest.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/ddd/event/Aggregate3EventsIntegrationTest.java diff --git a/spring-data-jpa/src/test/java/com/baeldung/ddd/event/AggregateEventsIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/ddd/event/AggregateEventsIntegrationTest.java similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/ddd/event/AggregateEventsIntegrationTest.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/ddd/event/AggregateEventsIntegrationTest.java diff --git a/spring-data-jpa/src/test/java/com/baeldung/ddd/event/TestEventHandler.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/ddd/event/TestEventHandler.java similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/ddd/event/TestEventHandler.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/ddd/event/TestEventHandler.java diff --git a/spring-data-jpa/src/test/java/com/baeldung/services/AbstractServicePersistenceIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/services/AbstractServicePersistenceIntegrationTest.java similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/services/AbstractServicePersistenceIntegrationTest.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/services/AbstractServicePersistenceIntegrationTest.java diff --git a/spring-data-jpa/src/test/java/com/baeldung/services/FooServicePersistenceIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/services/FooServicePersistenceIntegrationTest.java similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/services/FooServicePersistenceIntegrationTest.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/services/FooServicePersistenceIntegrationTest.java diff --git a/spring-data-jpa/src/test/java/com/baeldung/services/JpaMultipleDBIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/services/JpaMultipleDBIntegrationTest.java similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/services/JpaMultipleDBIntegrationTest.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/services/JpaMultipleDBIntegrationTest.java diff --git a/spring-data-jpa/src/test/java/com/baeldung/services/SpringDataJPABarAuditIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/services/SpringDataJPABarAuditIntegrationTest.java similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/services/SpringDataJPABarAuditIntegrationTest.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/services/SpringDataJPABarAuditIntegrationTest.java diff --git a/spring-data-jpa/src/test/java/com/baeldung/util/IDUtil.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/util/IDUtil.java similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/util/IDUtil.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/util/IDUtil.java diff --git a/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 100% rename from spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to persistence-modules/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java diff --git a/spring-data-jpa/src/test/resources/import_entities.sql b/persistence-modules/spring-data-jpa/src/test/resources/import_entities.sql similarity index 100% rename from spring-data-jpa/src/test/resources/import_entities.sql rename to persistence-modules/spring-data-jpa/src/test/resources/import_entities.sql diff --git a/spring-data-keyvalue/README.md b/persistence-modules/spring-data-keyvalue/README.md similarity index 100% rename from spring-data-keyvalue/README.md rename to persistence-modules/spring-data-keyvalue/README.md diff --git a/spring-data-keyvalue/pom.xml b/persistence-modules/spring-data-keyvalue/pom.xml similarity index 93% rename from spring-data-keyvalue/pom.xml rename to persistence-modules/spring-data-keyvalue/pom.xml index edd8967b97..6675595f2b 100644 --- a/spring-data-keyvalue/pom.xml +++ b/persistence-modules/spring-data-keyvalue/pom.xml @@ -7,7 +7,7 @@ parent-boot-2 com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-2 + ../../parent-boot-2 diff --git a/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/Configurations.java b/persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/Configurations.java similarity index 100% rename from spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/Configurations.java rename to persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/Configurations.java diff --git a/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/SpringDataKeyValueApplication.java b/persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/SpringDataKeyValueApplication.java similarity index 100% rename from spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/SpringDataKeyValueApplication.java rename to persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/SpringDataKeyValueApplication.java diff --git a/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/repositories/EmployeeRepository.java b/persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/repositories/EmployeeRepository.java similarity index 100% rename from spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/repositories/EmployeeRepository.java rename to persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/repositories/EmployeeRepository.java diff --git a/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/EmployeeService.java b/persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/EmployeeService.java similarity index 100% rename from spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/EmployeeService.java rename to persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/EmployeeService.java diff --git a/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/impl/EmployeeServicesWithKeyValueTemplate.java b/persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/impl/EmployeeServicesWithKeyValueTemplate.java similarity index 100% rename from spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/impl/EmployeeServicesWithKeyValueTemplate.java rename to persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/impl/EmployeeServicesWithKeyValueTemplate.java diff --git a/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/impl/EmployeeServicesWithRepository.java b/persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/impl/EmployeeServicesWithRepository.java similarity index 100% rename from spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/impl/EmployeeServicesWithRepository.java rename to persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/impl/EmployeeServicesWithRepository.java diff --git a/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/vo/Employee.java b/persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/vo/Employee.java similarity index 100% rename from spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/vo/Employee.java rename to persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/vo/Employee.java diff --git a/spring-data-keyvalue/src/main/resources/logback.xml b/persistence-modules/spring-data-keyvalue/src/main/resources/logback.xml similarity index 100% rename from spring-data-keyvalue/src/main/resources/logback.xml rename to persistence-modules/spring-data-keyvalue/src/main/resources/logback.xml diff --git a/spring-data-keyvalue/src/test/java/com/baeldung/spring/data/keyvalue/services/test/EmployeeServicesWithKeyValueRepositoryIntegrationTest.java b/persistence-modules/spring-data-keyvalue/src/test/java/com/baeldung/spring/data/keyvalue/services/test/EmployeeServicesWithKeyValueRepositoryIntegrationTest.java similarity index 100% rename from spring-data-keyvalue/src/test/java/com/baeldung/spring/data/keyvalue/services/test/EmployeeServicesWithKeyValueRepositoryIntegrationTest.java rename to persistence-modules/spring-data-keyvalue/src/test/java/com/baeldung/spring/data/keyvalue/services/test/EmployeeServicesWithKeyValueRepositoryIntegrationTest.java diff --git a/spring-data-keyvalue/src/test/java/com/baeldung/spring/data/keyvalue/services/test/EmployeeServicesWithRepositoryIntegrationTest.java b/persistence-modules/spring-data-keyvalue/src/test/java/com/baeldung/spring/data/keyvalue/services/test/EmployeeServicesWithRepositoryIntegrationTest.java similarity index 100% rename from spring-data-keyvalue/src/test/java/com/baeldung/spring/data/keyvalue/services/test/EmployeeServicesWithRepositoryIntegrationTest.java rename to persistence-modules/spring-data-keyvalue/src/test/java/com/baeldung/spring/data/keyvalue/services/test/EmployeeServicesWithRepositoryIntegrationTest.java diff --git a/spring-data-keyvalue/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-keyvalue/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 100% rename from spring-data-keyvalue/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to persistence-modules/spring-data-keyvalue/src/test/java/org/baeldung/SpringContextIntegrationTest.java diff --git a/spring-data-mongodb/README.md b/persistence-modules/spring-data-mongodb/README.md similarity index 100% rename from spring-data-mongodb/README.md rename to persistence-modules/spring-data-mongodb/README.md diff --git a/spring-data-mongodb/pom.xml b/persistence-modules/spring-data-mongodb/pom.xml similarity index 98% rename from spring-data-mongodb/pom.xml rename to persistence-modules/spring-data-mongodb/pom.xml index 072ed7a2ac..466acf5a43 100644 --- a/spring-data-mongodb/pom.xml +++ b/persistence-modules/spring-data-mongodb/pom.xml @@ -10,7 +10,7 @@ com.baeldung parent-spring-5 0.0.1-SNAPSHOT - ../parent-spring-5 + ../../parent-spring-5 diff --git a/spring-data-mongodb/src/main/java/com/baeldung/annotation/CascadeSave.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/annotation/CascadeSave.java similarity index 100% rename from spring-data-mongodb/src/main/java/com/baeldung/annotation/CascadeSave.java rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/annotation/CascadeSave.java diff --git a/spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java similarity index 100% rename from spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java diff --git a/spring-data-mongodb/src/main/java/com/baeldung/config/MongoReactiveConfig.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/MongoReactiveConfig.java similarity index 100% rename from spring-data-mongodb/src/main/java/com/baeldung/config/MongoReactiveConfig.java rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/MongoReactiveConfig.java diff --git a/spring-data-mongodb/src/main/java/com/baeldung/config/SimpleMongoConfig.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/SimpleMongoConfig.java similarity index 100% rename from spring-data-mongodb/src/main/java/com/baeldung/config/SimpleMongoConfig.java rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/SimpleMongoConfig.java diff --git a/spring-data-mongodb/src/main/java/com/baeldung/converter/UserWriterConverter.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/converter/UserWriterConverter.java similarity index 100% rename from spring-data-mongodb/src/main/java/com/baeldung/converter/UserWriterConverter.java rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/converter/UserWriterConverter.java diff --git a/spring-data-mongodb/src/main/java/com/baeldung/event/CascadeCallback.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/event/CascadeCallback.java similarity index 100% rename from spring-data-mongodb/src/main/java/com/baeldung/event/CascadeCallback.java rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/event/CascadeCallback.java diff --git a/spring-data-mongodb/src/main/java/com/baeldung/event/CascadeSaveMongoEventListener.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/event/CascadeSaveMongoEventListener.java similarity index 100% rename from spring-data-mongodb/src/main/java/com/baeldung/event/CascadeSaveMongoEventListener.java rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/event/CascadeSaveMongoEventListener.java diff --git a/spring-data-mongodb/src/main/java/com/baeldung/event/FieldCallback.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/event/FieldCallback.java similarity index 100% rename from spring-data-mongodb/src/main/java/com/baeldung/event/FieldCallback.java rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/event/FieldCallback.java diff --git a/spring-data-mongodb/src/main/java/com/baeldung/event/UserCascadeSaveMongoEventListener.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/event/UserCascadeSaveMongoEventListener.java similarity index 100% rename from spring-data-mongodb/src/main/java/com/baeldung/event/UserCascadeSaveMongoEventListener.java rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/event/UserCascadeSaveMongoEventListener.java diff --git a/spring-data-mongodb/src/main/java/com/baeldung/model/EmailAddress.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/model/EmailAddress.java similarity index 100% rename from spring-data-mongodb/src/main/java/com/baeldung/model/EmailAddress.java rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/model/EmailAddress.java diff --git a/spring-data-mongodb/src/main/java/com/baeldung/model/User.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/model/User.java similarity index 100% rename from spring-data-mongodb/src/main/java/com/baeldung/model/User.java rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/model/User.java diff --git a/spring-data-mongodb/src/main/java/com/baeldung/reactive/repository/UserRepository.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/reactive/repository/UserRepository.java similarity index 100% rename from spring-data-mongodb/src/main/java/com/baeldung/reactive/repository/UserRepository.java rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/reactive/repository/UserRepository.java diff --git a/spring-data-mongodb/src/main/java/com/baeldung/repository/UserRepository.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/repository/UserRepository.java similarity index 100% rename from spring-data-mongodb/src/main/java/com/baeldung/repository/UserRepository.java rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/repository/UserRepository.java diff --git a/spring-data-mongodb/src/main/resources/logback.xml b/persistence-modules/spring-data-mongodb/src/main/resources/logback.xml similarity index 100% rename from spring-data-mongodb/src/main/resources/logback.xml rename to persistence-modules/spring-data-mongodb/src/main/resources/logback.xml diff --git a/spring-data-mongodb/src/main/resources/mongoConfig.xml b/persistence-modules/spring-data-mongodb/src/main/resources/mongoConfig.xml similarity index 100% rename from spring-data-mongodb/src/main/resources/mongoConfig.xml rename to persistence-modules/spring-data-mongodb/src/main/resources/mongoConfig.xml diff --git a/spring-data-mongodb/src/main/resources/test.png b/persistence-modules/spring-data-mongodb/src/main/resources/test.png similarity index 100% rename from spring-data-mongodb/src/main/resources/test.png rename to persistence-modules/spring-data-mongodb/src/main/resources/test.png diff --git a/spring-data-mongodb/src/test/java/com/baeldung/aggregation/ZipsAggregationLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/aggregation/ZipsAggregationLiveTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/aggregation/ZipsAggregationLiveTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/aggregation/ZipsAggregationLiveTest.java diff --git a/spring-data-mongodb/src/test/java/com/baeldung/aggregation/model/StatePopulation.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/aggregation/model/StatePopulation.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/aggregation/model/StatePopulation.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/aggregation/model/StatePopulation.java diff --git a/spring-data-mongodb/src/test/java/com/baeldung/gridfs/GridFSLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/gridfs/GridFSLiveTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/gridfs/GridFSLiveTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/gridfs/GridFSLiveTest.java diff --git a/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/DocumentQueryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/DocumentQueryLiveTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/DocumentQueryLiveTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/DocumentQueryLiveTest.java diff --git a/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateProjectionLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateProjectionLiveTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateProjectionLiveTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateProjectionLiveTest.java diff --git a/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java diff --git a/spring-data-mongodb/src/test/java/com/baeldung/repository/BaseQueryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/BaseQueryLiveTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/repository/BaseQueryLiveTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/BaseQueryLiveTest.java diff --git a/spring-data-mongodb/src/test/java/com/baeldung/repository/DSLQueryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/DSLQueryLiveTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/repository/DSLQueryLiveTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/DSLQueryLiveTest.java diff --git a/spring-data-mongodb/src/test/java/com/baeldung/repository/JSONQueryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/JSONQueryLiveTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/repository/JSONQueryLiveTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/JSONQueryLiveTest.java diff --git a/spring-data-mongodb/src/test/java/com/baeldung/repository/QueryMethodsLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/QueryMethodsLiveTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/repository/QueryMethodsLiveTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/QueryMethodsLiveTest.java diff --git a/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryLiveTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryLiveTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryLiveTest.java diff --git a/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryProjectionLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryProjectionLiveTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryProjectionLiveTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryProjectionLiveTest.java diff --git a/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionReactiveIntegrationTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionReactiveIntegrationTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionReactiveIntegrationTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionReactiveIntegrationTest.java diff --git a/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionTemplateIntegrationTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionTemplateIntegrationTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionTemplateIntegrationTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionTemplateIntegrationTest.java diff --git a/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionalIntegrationTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionalIntegrationTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionalIntegrationTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionalIntegrationTest.java diff --git a/spring-data-mongodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-mongodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java diff --git a/spring-data-mongodb/src/test/resources/zips.json b/persistence-modules/spring-data-mongodb/src/test/resources/zips.json similarity index 100% rename from spring-data-mongodb/src/test/resources/zips.json rename to persistence-modules/spring-data-mongodb/src/test/resources/zips.json diff --git a/spring-hibernate3/README.md b/persistence-modules/spring-hibernate3/README.md similarity index 100% rename from spring-hibernate3/README.md rename to persistence-modules/spring-hibernate3/README.md diff --git a/spring-hibernate3/src/main/java/org/baeldung/spring/PersistenceConfigHibernate3.java b/persistence-modules/spring-hibernate3/src/main/java/org/baeldung/spring/PersistenceConfigHibernate3.java similarity index 97% rename from spring-hibernate3/src/main/java/org/baeldung/spring/PersistenceConfigHibernate3.java rename to persistence-modules/spring-hibernate3/src/main/java/org/baeldung/spring/PersistenceConfigHibernate3.java index a128d8848c..f38da21dc0 100644 --- a/spring-hibernate3/src/main/java/org/baeldung/spring/PersistenceConfigHibernate3.java +++ b/persistence-modules/spring-hibernate3/src/main/java/org/baeldung/spring/PersistenceConfigHibernate3.java @@ -1,81 +1,81 @@ -package org.baeldung.spring; - -import java.util.Properties; - -import javax.sql.DataSource; - -import org.apache.tomcat.dbcp.dbcp2.BasicDataSource; -import org.hibernate.SessionFactory; -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.core.env.Environment; -import org.springframework.core.io.ClassPathResource; -import org.springframework.core.io.Resource; -import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; -import org.springframework.orm.hibernate3.HibernateTransactionManager; -import org.springframework.orm.hibernate3.LocalSessionFactoryBean; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -import com.google.common.base.Preconditions; - -@Configuration -@EnableTransactionManagement -@PropertySource({ "classpath:persistence-h2.properties" }) -@ComponentScan({ "org.baeldung.persistence.dao", "org.baeldung.persistence.service" }) -public class PersistenceConfigHibernate3 { - - @Autowired - private Environment env; - - public PersistenceConfigHibernate3() { - super(); - } - - @Bean - public LocalSessionFactoryBean sessionFactory() { - final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); - Resource config = new ClassPathResource("exceptionDemo.cfg.xml"); - sessionFactory.setDataSource(dataSource()); - sessionFactory.setConfigLocation(config); - sessionFactory.setHibernateProperties(hibernateProperties()); - - return sessionFactory; - } - - @Bean - public DataSource dataSource() { - final BasicDataSource dataSource = new BasicDataSource(); - dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName"))); - dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("jdbc.url"))); - dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user"))); - dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass"))); - - return dataSource; - } - - @Bean - @Autowired - public HibernateTransactionManager transactionManager(final SessionFactory sessionFactory) { - final HibernateTransactionManager txManager = new HibernateTransactionManager(); - txManager.setSessionFactory(sessionFactory); - - return txManager; - } - - @Bean - public PersistenceExceptionTranslationPostProcessor exceptionTranslation() { - return new PersistenceExceptionTranslationPostProcessor(); - } - - final Properties hibernateProperties() { - final Properties hibernateProperties = new Properties(); - hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); - hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect")); - // hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", "true"); - return hibernateProperties; - } - -} +package org.baeldung.spring; + +import java.util.Properties; + +import javax.sql.DataSource; + +import org.apache.tomcat.dbcp.dbcp2.BasicDataSource; +import org.hibernate.SessionFactory; +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.core.env.Environment; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; +import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; +import org.springframework.orm.hibernate3.HibernateTransactionManager; +import org.springframework.orm.hibernate3.LocalSessionFactoryBean; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import com.google.common.base.Preconditions; + +@Configuration +@EnableTransactionManagement +@PropertySource({ "classpath:persistence-h2.properties" }) +@ComponentScan({ "org.baeldung.persistence.dao", "org.baeldung.persistence.service" }) +public class PersistenceConfigHibernate3 { + + @Autowired + private Environment env; + + public PersistenceConfigHibernate3() { + super(); + } + + @Bean + public LocalSessionFactoryBean sessionFactory() { + final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); + Resource config = new ClassPathResource("exceptionDemo.cfg.xml"); + sessionFactory.setDataSource(dataSource()); + sessionFactory.setConfigLocation(config); + sessionFactory.setHibernateProperties(hibernateProperties()); + + return sessionFactory; + } + + @Bean + public DataSource dataSource() { + final BasicDataSource dataSource = new BasicDataSource(); + dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName"))); + dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("jdbc.url"))); + dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user"))); + dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass"))); + + return dataSource; + } + + @Bean + @Autowired + public HibernateTransactionManager transactionManager(final SessionFactory sessionFactory) { + final HibernateTransactionManager txManager = new HibernateTransactionManager(); + txManager.setSessionFactory(sessionFactory); + + return txManager; + } + + @Bean + public PersistenceExceptionTranslationPostProcessor exceptionTranslation() { + return new PersistenceExceptionTranslationPostProcessor(); + } + + final Properties hibernateProperties() { + final Properties hibernateProperties = new Properties(); + hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); + hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect")); + // hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", "true"); + return hibernateProperties; + } + +} diff --git a/spring-hibernate3/src/main/resources/logback.xml b/persistence-modules/spring-hibernate3/src/main/resources/logback.xml similarity index 100% rename from spring-hibernate3/src/main/resources/logback.xml rename to persistence-modules/spring-hibernate3/src/main/resources/logback.xml diff --git a/spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen1MainIntegrationTest.java b/persistence-modules/spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen1MainIntegrationTest.java similarity index 97% rename from spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen1MainIntegrationTest.java rename to persistence-modules/spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen1MainIntegrationTest.java index d53c4445a8..bbbf074c1a 100644 --- a/spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen1MainIntegrationTest.java +++ b/persistence-modules/spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen1MainIntegrationTest.java @@ -1,43 +1,43 @@ -package org.baeldung.persistence.service; - -import java.util.List; - -import org.baeldung.persistence.model.Event; -import org.baeldung.spring.PersistenceConfigHibernate3; -import org.hamcrest.core.IsInstanceOf; -import org.hibernate.HibernateException; -import org.junit.Ignore; -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.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceConfigHibernate3.class }, loader = AnnotationConfigContextLoader.class) -public class HibernateExceptionScen1MainIntegrationTest { - - @Autowired - EventService service; - - @Rule - public ExpectedException expectedEx = ExpectedException.none(); - - @Test - public final void whenEntityIsCreated_thenNoExceptions() { - service.create(new Event("from LocalSessionFactoryBean")); - } - - @Test - @Ignore - public final void whenNoTransBoundToSession_thenException() { - expectedEx.expectCause(IsInstanceOf.instanceOf(HibernateException.class)); - expectedEx.expectMessage("No Hibernate Session bound to thread, " - + "and configuration does not allow creation " - + "of non-transactional one here"); - service.create(new Event("from LocalSessionFactoryBean")); - } -} +package org.baeldung.persistence.service; + +import java.util.List; + +import org.baeldung.persistence.model.Event; +import org.baeldung.spring.PersistenceConfigHibernate3; +import org.hamcrest.core.IsInstanceOf; +import org.hibernate.HibernateException; +import org.junit.Ignore; +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.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { PersistenceConfigHibernate3.class }, loader = AnnotationConfigContextLoader.class) +public class HibernateExceptionScen1MainIntegrationTest { + + @Autowired + EventService service; + + @Rule + public ExpectedException expectedEx = ExpectedException.none(); + + @Test + public final void whenEntityIsCreated_thenNoExceptions() { + service.create(new Event("from LocalSessionFactoryBean")); + } + + @Test + @Ignore + public final void whenNoTransBoundToSession_thenException() { + expectedEx.expectCause(IsInstanceOf.instanceOf(HibernateException.class)); + expectedEx.expectMessage("No Hibernate Session bound to thread, " + + "and configuration does not allow creation " + + "of non-transactional one here"); + service.create(new Event("from LocalSessionFactoryBean")); + } +} diff --git a/spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen2MainIntegrationTest.java b/persistence-modules/spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen2MainIntegrationTest.java similarity index 97% rename from spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen2MainIntegrationTest.java rename to persistence-modules/spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen2MainIntegrationTest.java index 84cafe0536..d8810f0e90 100644 --- a/spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen2MainIntegrationTest.java +++ b/persistence-modules/spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen2MainIntegrationTest.java @@ -1,45 +1,45 @@ -package org.baeldung.persistence.service; - -import java.util.List; - -import org.baeldung.persistence.model.Event; -import org.baeldung.spring.PersistenceConfig; -import org.hamcrest.core.IsInstanceOf; -import org.hibernate.HibernateException; -import org.junit.Ignore; -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.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) -public class HibernateExceptionScen2MainIntegrationTest { - - @Autowired - EventService service; - - @Rule - public ExpectedException expectedEx = ExpectedException.none(); - - @Test - public final void whenEntityIsCreated_thenNoExceptions() { - service.create(new Event("from AnnotationSessionFactoryBean")); - } - - @Test - @Ignore - public final void whenNoTransBoundToSession_thenException() { - expectedEx.expectCause(IsInstanceOf.instanceOf(HibernateException.class)); - expectedEx.expectMessage("No Hibernate Session bound to thread, " - + "and configuration does not allow creation " - + "of non-transactional one here"); - service.create(new Event("from AnnotationSessionFactoryBean")); - } - -} +package org.baeldung.persistence.service; + +import java.util.List; + +import org.baeldung.persistence.model.Event; +import org.baeldung.spring.PersistenceConfig; +import org.hamcrest.core.IsInstanceOf; +import org.hibernate.HibernateException; +import org.junit.Ignore; +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.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) +public class HibernateExceptionScen2MainIntegrationTest { + + @Autowired + EventService service; + + @Rule + public ExpectedException expectedEx = ExpectedException.none(); + + @Test + public final void whenEntityIsCreated_thenNoExceptions() { + service.create(new Event("from AnnotationSessionFactoryBean")); + } + + @Test + @Ignore + public final void whenNoTransBoundToSession_thenException() { + expectedEx.expectCause(IsInstanceOf.instanceOf(HibernateException.class)); + expectedEx.expectMessage("No Hibernate Session bound to thread, " + + "and configuration does not allow creation " + + "of non-transactional one here"); + service.create(new Event("from AnnotationSessionFactoryBean")); + } + +} diff --git a/spring-hibernate4/.gitignore b/persistence-modules/spring-hibernate4/.gitignore similarity index 100% rename from spring-hibernate4/.gitignore rename to persistence-modules/spring-hibernate4/.gitignore diff --git a/spring-hibernate4/README.md b/persistence-modules/spring-hibernate4/README.md similarity index 100% rename from spring-hibernate4/README.md rename to persistence-modules/spring-hibernate4/README.md diff --git a/spring-hibernate4/pom.xml b/persistence-modules/spring-hibernate4/pom.xml similarity index 99% rename from spring-hibernate4/pom.xml rename to persistence-modules/spring-hibernate4/pom.xml index 505a218a94..fad84870df 100644 --- a/spring-hibernate4/pom.xml +++ b/persistence-modules/spring-hibernate4/pom.xml @@ -10,6 +10,7 @@ com.baeldung parent-modules 1.0.0-SNAPSHOT + ../../ diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/criteria/model/Item.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/criteria/model/Item.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/criteria/model/Item.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/criteria/model/Item.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/OrderDetail.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/OrderDetail.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/OrderDetail.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/OrderDetail.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserEager.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserEager.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserEager.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserEager.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserLazy.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserLazy.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserLazy.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserLazy.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/util/HibernateUtil.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/util/HibernateUtil.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/util/HibernateUtil.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/util/HibernateUtil.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/view/FetchingAppView.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/view/FetchingAppView.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/view/FetchingAppView.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/view/FetchingAppView.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/config/HibernateAnnotationUtil.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/config/HibernateAnnotationUtil.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/config/HibernateAnnotationUtil.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/config/HibernateAnnotationUtil.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/main/HibernateOneToManyAnnotationMain.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/main/HibernateOneToManyAnnotationMain.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/main/HibernateOneToManyAnnotationMain.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/main/HibernateOneToManyAnnotationMain.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/model/Cart.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/model/Cart.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/model/Cart.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/model/Cart.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/model/Items.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/model/Items.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/model/Items.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/model/Items.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarAuditableDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarAuditableDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarAuditableDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarAuditableDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarCrudRepository.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarCrudRepository.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarCrudRepository.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarCrudRepository.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IChildDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IChildDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IChildDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IChildDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooAuditableDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooAuditableDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooAuditableDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooAuditableDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IParentDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IParentDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IParentDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IParentDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateAuditableDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateAuditableDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateAuditableDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateAuditableDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractJpaDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractJpaDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractJpaDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractJpaDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IAuditOperations.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IAuditOperations.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IAuditOperations.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IAuditOperations.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IOperations.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IOperations.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IOperations.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IOperations.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarAuditableDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarAuditableDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarAuditableDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarAuditableDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarJpaDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarJpaDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarJpaDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarJpaDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooAuditableDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooAuditableDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooAuditableDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooAuditableDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Bar.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Bar.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/model/Bar.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Bar.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Child.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Child.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/model/Child.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Child.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Foo.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Foo.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/model/Foo.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Foo.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Parent.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Parent.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/model/Parent.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Parent.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Person.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Person.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/model/Person.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Person.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarAuditableService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarAuditableService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarAuditableService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarAuditableService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IChildService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IChildService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/IChildService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IChildService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooAuditableService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooAuditableService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooAuditableService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooAuditableService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IParentService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IParentService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/IParentService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IParentService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateAuditableService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateAuditableService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateAuditableService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateAuditableService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractJpaService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractJpaService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractJpaService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractJpaService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractSpringDataJpaService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractSpringDataJpaService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractSpringDataJpaService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractSpringDataJpaService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarAuditableService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarAuditableService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarAuditableService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarAuditableService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarJpaService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarJpaService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarJpaService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarJpaService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarSpringDataJpaService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarSpringDataJpaService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarSpringDataJpaService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarSpringDataJpaService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ChildService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ChildService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ChildService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ChildService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooAuditableService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooAuditableService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooAuditableService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooAuditableService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ParentService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ParentService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ParentService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ParentService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceConfig.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceConfig.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceConfig.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceConfig.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceXmlConfig.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceXmlConfig.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceXmlConfig.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceXmlConfig.java diff --git a/spring-hibernate4/src/main/resources/fetching.cfg.xml b/persistence-modules/spring-hibernate4/src/main/resources/fetching.cfg.xml similarity index 100% rename from spring-hibernate4/src/main/resources/fetching.cfg.xml rename to persistence-modules/spring-hibernate4/src/main/resources/fetching.cfg.xml diff --git a/spring-hibernate4/src/main/resources/fetchingLazy.cfg.xml b/persistence-modules/spring-hibernate4/src/main/resources/fetchingLazy.cfg.xml similarity index 100% rename from spring-hibernate4/src/main/resources/fetchingLazy.cfg.xml rename to persistence-modules/spring-hibernate4/src/main/resources/fetchingLazy.cfg.xml diff --git a/spring-hibernate4/src/main/resources/fetching_create_queries.sql b/persistence-modules/spring-hibernate4/src/main/resources/fetching_create_queries.sql similarity index 100% rename from spring-hibernate4/src/main/resources/fetching_create_queries.sql rename to persistence-modules/spring-hibernate4/src/main/resources/fetching_create_queries.sql diff --git a/spring-hibernate4/src/main/resources/hibernate-annotation.cfg.xml b/persistence-modules/spring-hibernate4/src/main/resources/hibernate-annotation.cfg.xml similarity index 100% rename from spring-hibernate4/src/main/resources/hibernate-annotation.cfg.xml rename to persistence-modules/spring-hibernate4/src/main/resources/hibernate-annotation.cfg.xml diff --git a/spring-hibernate4/src/main/resources/hibernate4Config.xml b/persistence-modules/spring-hibernate4/src/main/resources/hibernate4Config.xml similarity index 100% rename from spring-hibernate4/src/main/resources/hibernate4Config.xml rename to persistence-modules/spring-hibernate4/src/main/resources/hibernate4Config.xml diff --git a/spring-hibernate4/src/main/resources/immutable.cfg.xml b/persistence-modules/spring-hibernate4/src/main/resources/immutable.cfg.xml similarity index 100% rename from spring-hibernate4/src/main/resources/immutable.cfg.xml rename to persistence-modules/spring-hibernate4/src/main/resources/immutable.cfg.xml diff --git a/spring-hibernate4/src/main/resources/insert_statements.sql b/persistence-modules/spring-hibernate4/src/main/resources/insert_statements.sql similarity index 100% rename from spring-hibernate4/src/main/resources/insert_statements.sql rename to persistence-modules/spring-hibernate4/src/main/resources/insert_statements.sql diff --git a/spring-hibernate4/src/main/resources/logback.xml b/persistence-modules/spring-hibernate4/src/main/resources/logback.xml similarity index 100% rename from spring-hibernate4/src/main/resources/logback.xml rename to persistence-modules/spring-hibernate4/src/main/resources/logback.xml diff --git a/spring-hibernate4/src/main/resources/one_to_many.sql b/persistence-modules/spring-hibernate4/src/main/resources/one_to_many.sql similarity index 100% rename from spring-hibernate4/src/main/resources/one_to_many.sql rename to persistence-modules/spring-hibernate4/src/main/resources/one_to_many.sql diff --git a/spring-hibernate4/src/main/resources/persistence-mysql.properties b/persistence-modules/spring-hibernate4/src/main/resources/persistence-mysql.properties similarity index 100% rename from spring-hibernate4/src/main/resources/persistence-mysql.properties rename to persistence-modules/spring-hibernate4/src/main/resources/persistence-mysql.properties diff --git a/spring-hibernate4/src/main/resources/stored_procedure.sql b/persistence-modules/spring-hibernate4/src/main/resources/stored_procedure.sql similarity index 93% rename from spring-hibernate4/src/main/resources/stored_procedure.sql rename to persistence-modules/spring-hibernate4/src/main/resources/stored_procedure.sql index 8e1bdf57dd..9cedb75c37 100644 --- a/spring-hibernate4/src/main/resources/stored_procedure.sql +++ b/persistence-modules/spring-hibernate4/src/main/resources/stored_procedure.sql @@ -1,20 +1,20 @@ -DELIMITER // - CREATE PROCEDURE GetFoosByName(IN fooName VARCHAR(255)) - LANGUAGE SQL - DETERMINISTIC - SQL SECURITY DEFINER - BEGIN - SELECT * FROM foo WHERE name = fooName; - END // -DELIMITER ; - - -DELIMITER // - CREATE PROCEDURE GetAllFoos() - LANGUAGE SQL - DETERMINISTIC - SQL SECURITY DEFINER - BEGIN - SELECT * FROM foo; - END // +DELIMITER // + CREATE PROCEDURE GetFoosByName(IN fooName VARCHAR(255)) + LANGUAGE SQL + DETERMINISTIC + SQL SECURITY DEFINER + BEGIN + SELECT * FROM foo WHERE name = fooName; + END // +DELIMITER ; + + +DELIMITER // + CREATE PROCEDURE GetAllFoos() + LANGUAGE SQL + DETERMINISTIC + SQL SECURITY DEFINER + BEGIN + SELECT * FROM foo; + END // DELIMITER ; \ No newline at end of file diff --git a/spring-hibernate4/src/main/resources/webSecurityConfig.xml b/persistence-modules/spring-hibernate4/src/main/resources/webSecurityConfig.xml similarity index 100% rename from spring-hibernate4/src/main/resources/webSecurityConfig.xml rename to persistence-modules/spring-hibernate4/src/main/resources/webSecurityConfig.xml diff --git a/spring-hibernate4/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/hibernate/oneToMany/main/HibernateOneToManyAnnotationMainIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/hibernate/oneToMany/main/HibernateOneToManyAnnotationMainIntegrationTest.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/hibernate/oneToMany/main/HibernateOneToManyAnnotationMainIntegrationTest.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/hibernate/oneToMany/main/HibernateOneToManyAnnotationMainIntegrationTest.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/IntegrationTestSuite.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/IntegrationTestSuite.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/persistence/IntegrationTestSuite.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/IntegrationTestSuite.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/AuditTestSuite.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/AuditTestSuite.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/persistence/audit/AuditTestSuite.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/AuditTestSuite.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/EnversFooBarAuditIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/EnversFooBarAuditIntegrationTest.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/persistence/audit/EnversFooBarAuditIntegrationTest.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/EnversFooBarAuditIntegrationTest.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/JPABarAuditIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/JPABarAuditIntegrationTest.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/persistence/audit/JPABarAuditIntegrationTest.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/JPABarAuditIntegrationTest.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/SpringDataJPABarAuditIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/SpringDataJPABarAuditIntegrationTest.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/persistence/audit/SpringDataJPABarAuditIntegrationTest.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/SpringDataJPABarAuditIntegrationTest.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooFixtures.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooFixtures.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooFixtures.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooFixtures.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooPaginationPersistenceIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooPaginationPersistenceIntegrationTest.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooPaginationPersistenceIntegrationTest.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooPaginationPersistenceIntegrationTest.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooSortingPersistenceIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooSortingPersistenceIntegrationTest.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooSortingPersistenceIntegrationTest.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooSortingPersistenceIntegrationTest.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/save/SaveMethodsIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/save/SaveMethodsIntegrationTest.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/persistence/save/SaveMethodsIntegrationTest.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/save/SaveMethodsIntegrationTest.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServiceBasicPersistenceIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServiceBasicPersistenceIntegrationTest.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServiceBasicPersistenceIntegrationTest.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServiceBasicPersistenceIntegrationTest.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java similarity index 97% rename from spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java index 9ec04d297c..d9353f1ad1 100644 --- a/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java +++ b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java @@ -1,121 +1,121 @@ -package com.baeldung.persistence.service; - -import java.util.List; - -import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; -import static org.junit.Assert.assertEquals; - -import org.hibernate.Query; -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.hibernate.exception.SQLGrammarException; -import org.junit.After; -import org.junit.Assume; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import com.baeldung.persistence.model.Foo; -import com.baeldung.spring.PersistenceConfig; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) -public class FooStoredProceduresLiveTest { - - private static final Logger LOGGER = LoggerFactory.getLogger(FooStoredProceduresLiveTest.class); - - @Autowired - private SessionFactory sessionFactory; - - @Autowired - private IFooService fooService; - - private Session session; - - @Before - public final void before() { - session = sessionFactory.openSession(); - Assume.assumeTrue(getAllFoosExists()); - Assume.assumeTrue(getFoosByNameExists()); - } - - private boolean getFoosByNameExists() { - try { - Query sqlQuery = session.createSQLQuery("CALL GetAllFoos()").addEntity(Foo.class); - sqlQuery.list(); - return true; - } catch (SQLGrammarException e) { - LOGGER.error("WARNING : GetFoosByName() Procedure is may be missing ", e); - return false; - } - } - - private boolean getAllFoosExists() { - try { - Query sqlQuery = session.createSQLQuery("CALL GetAllFoos()").addEntity(Foo.class); - sqlQuery.list(); - return true; - } catch (SQLGrammarException e) { - LOGGER.error("WARNING : GetAllFoos() Procedure is may be missing ", e); - return false; - } - } - - @After - public final void after() { - session.close(); - } - - @Test - public final void getAllFoosUsingStoredProcedures() { - - fooService.create(new Foo(randomAlphabetic(6))); - - // Stored procedure getAllFoos using createSQLQuery - Query sqlQuery = session.createSQLQuery("CALL GetAllFoos()").addEntity(Foo.class); - @SuppressWarnings("unchecked") - List allFoos = sqlQuery.list(); - for (Foo foo : allFoos) { - LOGGER.info("getAllFoos() SQL Query result : {}", foo.getName()); - } - assertEquals(allFoos.size(), fooService.findAll().size()); - - // Stored procedure getAllFoos using a Named Query - Query namedQuery = session.getNamedQuery("callGetAllFoos"); - @SuppressWarnings("unchecked") - List allFoos2 = namedQuery.list(); - for (Foo foo : allFoos2) { - LOGGER.info("getAllFoos() NamedQuery result : {}", foo.getName()); - } - assertEquals(allFoos2.size(), fooService.findAll().size()); - } - - @Test - public final void getFoosByNameUsingStoredProcedures() { - - fooService.create(new Foo("NewFooName")); - - // Stored procedure getFoosByName using createSQLQuery() - Query sqlQuery = session.createSQLQuery("CALL GetFoosByName(:fooName)").addEntity(Foo.class).setParameter("fooName", "NewFooName"); - @SuppressWarnings("unchecked") - List allFoosByName = sqlQuery.list(); - for (Foo foo : allFoosByName) { - LOGGER.info("getFoosByName() using SQL Query : found => {}", foo.toString()); - } - - // Stored procedure getFoosByName using getNamedQuery() - Query namedQuery = session.getNamedQuery("callGetFoosByName").setParameter("fooName", "NewFooName"); - @SuppressWarnings("unchecked") - List allFoosByName2 = namedQuery.list(); - for (Foo foo : allFoosByName2) { - LOGGER.info("getFoosByName() using Native Query : found => {}", foo.toString()); - } - - } -} +package com.baeldung.persistence.service; + +import java.util.List; + +import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; +import static org.junit.Assert.assertEquals; + +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.exception.SQLGrammarException; +import org.junit.After; +import org.junit.Assume; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.persistence.model.Foo; +import com.baeldung.spring.PersistenceConfig; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) +public class FooStoredProceduresLiveTest { + + private static final Logger LOGGER = LoggerFactory.getLogger(FooStoredProceduresLiveTest.class); + + @Autowired + private SessionFactory sessionFactory; + + @Autowired + private IFooService fooService; + + private Session session; + + @Before + public final void before() { + session = sessionFactory.openSession(); + Assume.assumeTrue(getAllFoosExists()); + Assume.assumeTrue(getFoosByNameExists()); + } + + private boolean getFoosByNameExists() { + try { + Query sqlQuery = session.createSQLQuery("CALL GetAllFoos()").addEntity(Foo.class); + sqlQuery.list(); + return true; + } catch (SQLGrammarException e) { + LOGGER.error("WARNING : GetFoosByName() Procedure is may be missing ", e); + return false; + } + } + + private boolean getAllFoosExists() { + try { + Query sqlQuery = session.createSQLQuery("CALL GetAllFoos()").addEntity(Foo.class); + sqlQuery.list(); + return true; + } catch (SQLGrammarException e) { + LOGGER.error("WARNING : GetAllFoos() Procedure is may be missing ", e); + return false; + } + } + + @After + public final void after() { + session.close(); + } + + @Test + public final void getAllFoosUsingStoredProcedures() { + + fooService.create(new Foo(randomAlphabetic(6))); + + // Stored procedure getAllFoos using createSQLQuery + Query sqlQuery = session.createSQLQuery("CALL GetAllFoos()").addEntity(Foo.class); + @SuppressWarnings("unchecked") + List allFoos = sqlQuery.list(); + for (Foo foo : allFoos) { + LOGGER.info("getAllFoos() SQL Query result : {}", foo.getName()); + } + assertEquals(allFoos.size(), fooService.findAll().size()); + + // Stored procedure getAllFoos using a Named Query + Query namedQuery = session.getNamedQuery("callGetAllFoos"); + @SuppressWarnings("unchecked") + List allFoos2 = namedQuery.list(); + for (Foo foo : allFoos2) { + LOGGER.info("getAllFoos() NamedQuery result : {}", foo.getName()); + } + assertEquals(allFoos2.size(), fooService.findAll().size()); + } + + @Test + public final void getFoosByNameUsingStoredProcedures() { + + fooService.create(new Foo("NewFooName")); + + // Stored procedure getFoosByName using createSQLQuery() + Query sqlQuery = session.createSQLQuery("CALL GetFoosByName(:fooName)").addEntity(Foo.class).setParameter("fooName", "NewFooName"); + @SuppressWarnings("unchecked") + List allFoosByName = sqlQuery.list(); + for (Foo foo : allFoosByName) { + LOGGER.info("getFoosByName() using SQL Query : found => {}", foo.toString()); + } + + // Stored procedure getFoosByName using getNamedQuery() + Query namedQuery = session.getNamedQuery("callGetFoosByName").setParameter("fooName", "NewFooName"); + @SuppressWarnings("unchecked") + List allFoosByName2 = namedQuery.list(); + for (Foo foo : allFoosByName2) { + LOGGER.info("getFoosByName() using Native Query : found => {}", foo.toString()); + } + + } +} diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/service/ParentServicePersistenceIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/ParentServicePersistenceIntegrationTest.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/persistence/service/ParentServicePersistenceIntegrationTest.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/ParentServicePersistenceIntegrationTest.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/spring/config/PersistenceTestConfig.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/spring/config/PersistenceTestConfig.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/spring/config/PersistenceTestConfig.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/spring/config/PersistenceTestConfig.java diff --git a/spring-hibernate4/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 100% rename from spring-hibernate4/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to persistence-modules/spring-hibernate4/src/test/java/org/baeldung/SpringContextIntegrationTest.java diff --git a/spring-hibernate4/src/test/resources/.gitignore b/persistence-modules/spring-hibernate4/src/test/resources/.gitignore similarity index 100% rename from spring-hibernate4/src/test/resources/.gitignore rename to persistence-modules/spring-hibernate4/src/test/resources/.gitignore diff --git a/spring-hibernate4/src/test/resources/fetching.cfg.xml b/persistence-modules/spring-hibernate4/src/test/resources/fetching.cfg.xml similarity index 100% rename from spring-hibernate4/src/test/resources/fetching.cfg.xml rename to persistence-modules/spring-hibernate4/src/test/resources/fetching.cfg.xml diff --git a/spring-hibernate4/src/test/resources/fetchingLazy.cfg.xml b/persistence-modules/spring-hibernate4/src/test/resources/fetchingLazy.cfg.xml similarity index 100% rename from spring-hibernate4/src/test/resources/fetchingLazy.cfg.xml rename to persistence-modules/spring-hibernate4/src/test/resources/fetchingLazy.cfg.xml diff --git a/spring-hibernate4/src/test/resources/persistence-h2.properties b/persistence-modules/spring-hibernate4/src/test/resources/persistence-h2.properties similarity index 100% rename from spring-hibernate4/src/test/resources/persistence-h2.properties rename to persistence-modules/spring-hibernate4/src/test/resources/persistence-h2.properties diff --git a/pom.xml b/pom.xml index ed7ca7d6d3..5ba509798d 100644 --- a/pom.xml +++ b/pom.xml @@ -357,14 +357,14 @@ core-java-io core-java-8 java-streams - core-java-persistence + persistence-modules/core-java-persistence core-kotlin kotlin-libraries core-groovy core-java-concurrency core-java-concurrency-collections couchbase - deltaspike + persistence-modules/deltaspike dozer ethereum ejb @@ -392,7 +392,7 @@ hystrix image-processing immutables - influxdb + persistence-modules/influxdb jackson persistence-modules/java-cassandra vavr @@ -436,7 +436,7 @@ mustache mvn-wrapper noexception - orientdb + persistence-modules/orientdb osgi orika patterns @@ -477,7 +477,7 @@ spring-boot-admin spring-boot-camel spring-boot-ops - spring-boot-persistence + persistence-modules/spring-boot-persistence spring-boot-security spring-boot-mvc spring-boot-vue @@ -494,10 +494,10 @@ persistence-modules/spring-data-cassandra spring-data-couchbase-2 persistence-modules/spring-data-dynamodb - spring-data-elasticsearch - spring-data-jpa - spring-data-keyvalue - spring-data-mongodb + persistence-modules/spring-data-elasticsearch + persistence-modules/spring-data-jpa + persistence-modules/spring-data-keyvalue + persistence-modules/spring-data-mongodb persistence-modules/spring-data-neo4j persistence-modules/spring-data-redis spring-data-rest @@ -506,7 +506,7 @@ spring-exceptions spring-freemarker persistence-modules/spring-hibernate-3 - spring-hibernate4 + persistence-modules/spring-hibernate4 persistence-modules/spring-hibernate-5 persistence-modules/spring-data-eclipselink spring-integration @@ -806,13 +806,13 @@ spring-cloud/spring-cloud-data-flow/time-processor spring-cloud/spring-cloud-data-flow/time-source spring-cucumber - spring-data-keyvalue + persistence-modules/spring-data-keyvalue spring-data-rest spring-dispatcher-servlet spring-drools spring-freemarker - spring-hibernate-3 - spring-hibernate4 + persistence-modules/spring-hibernate-3 + persistence-modules/spring-hibernate4 spring-integration spring-jenkins-pipeline spring-jersey @@ -941,7 +941,7 @@ azure bootique cdi core-java core-java-collections core-java-io core-java-8 core-kotlin core-groovy core-java-concurrency - couchbase deltaspike dozer + couchbase persistence-modules/deltaspike dozer ethereum ejb feign flips geotools testing-modules/groovy-spock testing-modules/gatling google-cloud google-web-toolkit gson @@ -949,7 +949,7 @@ guava-modules/guava-21 guice disruptor spring-static-resources hazelcast hbase hibernate5 httpclient hystrix - image-processing immutables influxdb + image-processing immutables persistence-modules/influxdb jackson persistence-modules/java-cassandra vavr java-lite java-numbers java-rmi java-vavr-stream javax-servlets @@ -974,7 +974,7 @@ mustache mvn-wrapper noexception - orientdb + persistence-modules/orientdb osgi orika patterns @@ -1021,7 +1021,7 @@ spring-boot-admin spring-boot-camel spring-boot-ops - spring-boot-persistence + persistence-modules/spring-boot-persistence spring-boot-security spring-boot-mvc spring-boot-logging-log4j2 @@ -1037,10 +1037,10 @@ persistence-modules/spring-data-cassandra spring-data-couchbase-2 persistence-modules/spring-data-dynamodb - spring-data-elasticsearch - spring-data-keyvalue - spring-data-mongodb - spring-data-jpa + persistence-modules/spring-data-elasticsearch + persistence-modules/spring-data-keyvalue + persistence-modules/spring-data-mongodb + persistence-modules/spring-data-jpa persistence-modules/spring-data-neo4j persistence-modules/spring-data-redis spring-data-rest @@ -1055,7 +1055,7 @@ spring-exceptions spring-freemarker persistence-modules/spring-hibernate-3 - spring-hibernate4 + persistence-modules/spring-hibernate4 persistence-modules/spring-hibernate-5 persistence-modules/spring-data-eclipselink spring-integration @@ -1278,7 +1278,7 @@ core-groovy couchbase - deltaspike + persistence-modules/deltaspike dozer ethereum feign @@ -1300,7 +1300,7 @@ hystrix image-processing immutables - influxdb + persistence-modules/influxdb jackson vavr java-lite @@ -1341,7 +1341,7 @@ mustache mvn-wrapper noexception - orientdb + persistence-modules/orientdb osgi orika patterns @@ -1378,7 +1378,7 @@ spring-boot-bootstrap spring-boot-admin spring-boot-camel - spring-boot-persistence + persistence-modules/spring-boot-persistence spring-boot-security spring-boot-mvc spring-boot-logging-log4j2 @@ -1393,8 +1393,8 @@ spring-aop persistence-modules/spring-data-dynamodb - spring-data-keyvalue - spring-data-mongodb + persistence-modules/spring-data-keyvalue + persistence-modules/spring-data-mongodb persistence-modules/spring-data-neo4j spring-data-rest @@ -1509,7 +1509,7 @@ maven-archetype apache-meecrowave - spring-hibernate4 + persistence-modules/spring-hibernate4 xml vertx metrics @@ -1603,7 +1603,7 @@ google-web-toolkit spring-security-mvc-custom hibernate5 - spring-data-elasticsearch + persistence-modules/spring-data-elasticsearch core-java-concurrency core-java-concurrency-collections From b79874af3b590128e65006980b01bfef7413ef3f Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 20 Oct 2018 10:18:28 +0300 Subject: [PATCH 73/87] Update pom.xml --- parent-boot-1/pom.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/parent-boot-1/pom.xml b/parent-boot-1/pom.xml index 0f1086fa31..a5c38f277f 100644 --- a/parent-boot-1/pom.xml +++ b/parent-boot-1/pom.xml @@ -52,5 +52,4 @@ 3.1.0 1.5.16.RELEASE - - \ No newline at end of file + From dc9b1354171f75cd60474040ae76029e1a14106c Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sat, 20 Oct 2018 15:22:59 +0530 Subject: [PATCH 74/87] [BAEL-9517] - Upgraded parent-spring-4 to the latest version of Spring 4.3.20 --- parent-spring-4/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parent-spring-4/pom.xml b/parent-spring-4/pom.xml index d1b1298013..9b3c42599b 100644 --- a/parent-spring-4/pom.xml +++ b/parent-spring-4/pom.xml @@ -29,7 +29,7 @@ - 4.3.17.RELEASE + 4.3.20.RELEASE 5.0.2 From d639ab24957ec7f796c43d7578f5b1b866760712 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 20 Oct 2018 15:10:00 +0300 Subject: [PATCH 75/87] Update README.md --- java-collections-maps/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java-collections-maps/README.md b/java-collections-maps/README.md index 4883e0e1b6..ca7fee1d21 100644 --- a/java-collections-maps/README.md +++ b/java-collections-maps/README.md @@ -14,4 +14,5 @@ - [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap) - [Get the Key for a Value from a Java Map](https://www.baeldung.com/java-map-key-from-value) - [Sort a HashMap in Java](https://www.baeldung.com/java-hashmap-sort) -- [Finding the Highest Value in a Java Map](https://www.baeldung.com/java-find-map-max) \ No newline at end of file +- [Finding the Highest Value in a Java Map](https://www.baeldung.com/java-find-map-max) +- [Merging Two Maps with Java 8](https://www.baeldung.com/java-merge-maps) From 6be1833b3d54b296bc053109f9c78f6de926ab44 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sat, 20 Oct 2018 23:11:32 +0530 Subject: [PATCH 76/87] [BAEL-9550] - Moved GuavaBiMapUnitTest from core-java to java-collections-map module --- .../src/test/java/com/baeldung/guava/GuavaBiMapUnitTest.java | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {core-java => java-collections-maps}/src/test/java/com/baeldung/guava/GuavaBiMapUnitTest.java (100%) diff --git a/core-java/src/test/java/com/baeldung/guava/GuavaBiMapUnitTest.java b/java-collections-maps/src/test/java/com/baeldung/guava/GuavaBiMapUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/guava/GuavaBiMapUnitTest.java rename to java-collections-maps/src/test/java/com/baeldung/guava/GuavaBiMapUnitTest.java From 294d52e7e45773dbfa7d9bd061bae0bbdb4c072a Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 20 Oct 2018 20:41:36 +0300 Subject: [PATCH 77/87] change setup of spring-ejb-client --- spring-ejb/pom.xml | 1 + spring-ejb/spring-ejb-client/pom.xml | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/spring-ejb/pom.xml b/spring-ejb/pom.xml index 31cde720f9..055df9ea04 100755 --- a/spring-ejb/pom.xml +++ b/spring-ejb/pom.xml @@ -73,6 +73,7 @@ ejb-remote-for-spring ejb-beans + spring-ejb-client diff --git a/spring-ejb/spring-ejb-client/pom.xml b/spring-ejb/spring-ejb-client/pom.xml index c935e1f14a..50337e8b21 100644 --- a/spring-ejb/spring-ejb-client/pom.xml +++ b/spring-ejb/spring-ejb-client/pom.xml @@ -10,11 +10,22 @@ Spring EJB Client - com.baeldung - parent-boot-2 - 0.0.1-SNAPSHOT - ../../parent-boot-2 + com.baeldung.spring.ejb + spring-ejb + 1.0.1 + + + + + org.springframework.boot + spring-boot-dependencies + 2.0.4.RELEASE + pom + import + + + @@ -54,6 +65,7 @@ org.springframework.boot spring-boot-maven-plugin + 2.0.4.RELEASE From f8a7e1a29185adfdf61f1a46c3c50fb6ab225795 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 20 Oct 2018 20:48:22 +0300 Subject: [PATCH 78/87] remove from main pom --- pom.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/pom.xml b/pom.xml index ed7ca7d6d3..0952a9f8e2 100644 --- a/pom.xml +++ b/pom.xml @@ -489,7 +489,6 @@ spring-core spring-cucumber spring-ejb - spring-ejb/spring-ejb-client spring-aop persistence-modules/spring-data-cassandra spring-data-couchbase-2 @@ -1032,7 +1031,6 @@ spring-core spring-cucumber spring-ejb - spring-ejb/spring-ejb-client spring-aop persistence-modules/spring-data-cassandra spring-data-couchbase-2 @@ -1389,7 +1387,6 @@ spring-core spring-cucumber spring-ejb - spring-ejb/spring-ejb-client spring-aop persistence-modules/spring-data-dynamodb From bb380406b286eb578f7ddbbaa14ef90983847cb2 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 20 Oct 2018 21:53:54 +0300 Subject: [PATCH 79/87] Update pom.xml --- parent-boot-2/pom.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/parent-boot-2/pom.xml b/parent-boot-2/pom.xml index ba98898987..bcfcfdec44 100644 --- a/parent-boot-2/pom.xml +++ b/parent-boot-2/pom.xml @@ -75,5 +75,4 @@ 1.0.11.RELEASE 2.0.5.RELEASE - - \ No newline at end of file + From cf56156f338c69af789b5eb5be76d1a821546c05 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 20 Oct 2018 22:02:24 +0300 Subject: [PATCH 80/87] fix custom starter setup --- .../greeter-spring-boot-sample-app/pom.xml | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/spring-boot-custom-starter/greeter-spring-boot-sample-app/pom.xml b/spring-boot-custom-starter/greeter-spring-boot-sample-app/pom.xml index 4eac7eba19..88c5d1caf5 100644 --- a/spring-boot-custom-starter/greeter-spring-boot-sample-app/pom.xml +++ b/spring-boot-custom-starter/greeter-spring-boot-sample-app/pom.xml @@ -7,11 +7,23 @@ 0.0.1-SNAPSHOT - parent-boot-1 + spring-boot-custom-starter com.baeldung 0.0.1-SNAPSHOT - ../../parent-boot-1 + ../../spring-boot-custom-starter + + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + @@ -19,9 +31,27 @@ greeter-spring-boot-starter ${greeter-starter.version} + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + + + + 1.5.15.RELEASE 0.0.1-SNAPSHOT From d10f6b56ed57e159f1c503028c1d34e73fb625a4 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 20 Oct 2018 22:08:41 +0300 Subject: [PATCH 81/87] trigger parent build --- spring-boot-custom-starter/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-boot-custom-starter/pom.xml b/spring-boot-custom-starter/pom.xml index b8ad8fa12c..97b33ce2b8 100644 --- a/spring-boot-custom-starter/pom.xml +++ b/spring-boot-custom-starter/pom.xml @@ -18,5 +18,6 @@ greeter-spring-boot-starter greeter-spring-boot-sample-app + \ No newline at end of file From d166c0bb2e8c3b71dc4fb504de31ae94692257ab Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 20 Oct 2018 22:26:50 +0300 Subject: [PATCH 82/87] Update pom.xml --- parent-boot-1/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/parent-boot-1/pom.xml b/parent-boot-1/pom.xml index a5c38f277f..c61b791ef3 100644 --- a/parent-boot-1/pom.xml +++ b/parent-boot-1/pom.xml @@ -52,4 +52,5 @@ 3.1.0 1.5.16.RELEASE + From a658ab4834f80817d16b8a915c4f1ad2b2863c83 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 21 Oct 2018 10:20:13 +0300 Subject: [PATCH 83/87] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index d896ac0715..f3fe5e3bf0 100644 --- a/README.md +++ b/README.md @@ -35,3 +35,4 @@ To run a Spring Boot module run the command: `mvn spring-boot:run -Dgib.enabled= + From 5bfec51157b2b478eb5f961f84034e9c651bb8a1 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 21 Oct 2018 10:53:15 +0300 Subject: [PATCH 84/87] fix main class of activiti boot --- spring-activiti/pom.xml | 14 +++++++++++++- .../activitiwithspring/ActivitiController.java | 2 +- .../ActivitiWithSpringApplication.java | 2 +- .../activitiwithspring/TaskRepresentation.java | 2 +- .../servicetasks/SendEmailServiceTask.java | 2 +- .../baeldung/SpringContextIntegrationTest.java | 4 ++-- .../ActivitiControllerIntegrationTest.java | 3 ++- .../ActivitiSpringSecurityIntegrationTest.java | 2 +- ...tivitiWithSpringApplicationIntegrationTest.java | 2 +- .../ProcessEngineCreationIntegrationTest.java | 2 +- .../ProcessExecutionIntegrationTest.java | 2 +- 11 files changed, 25 insertions(+), 12 deletions(-) rename spring-activiti/src/main/java/com/{example => baeldung}/activitiwithspring/ActivitiController.java (97%) rename spring-activiti/src/main/java/com/{example => baeldung}/activitiwithspring/ActivitiWithSpringApplication.java (91%) rename spring-activiti/src/main/java/com/{example => baeldung}/activitiwithspring/TaskRepresentation.java (90%) rename spring-activiti/src/main/java/com/{example => baeldung}/activitiwithspring/servicetasks/SendEmailServiceTask.java (83%) rename spring-activiti/src/test/java/{org => com}/baeldung/SpringContextIntegrationTest.java (81%) rename spring-activiti/src/test/java/com/{example => baeldung}/activitiwithspring/ActivitiControllerIntegrationTest.java (97%) rename spring-activiti/src/test/java/com/{example => baeldung}/activitiwithspring/ActivitiSpringSecurityIntegrationTest.java (96%) rename spring-activiti/src/test/java/com/{example => baeldung}/activitiwithspring/ActivitiWithSpringApplicationIntegrationTest.java (89%) rename spring-activiti/src/test/java/com/{example => baeldung}/activitiwithspring/ProcessEngineCreationIntegrationTest.java (98%) rename spring-activiti/src/test/java/com/{example => baeldung}/activitiwithspring/ProcessExecutionIntegrationTest.java (99%) diff --git a/spring-activiti/pom.xml b/spring-activiti/pom.xml index 0a19f483c1..4e21c5b032 100644 --- a/spring-activiti/pom.xml +++ b/spring-activiti/pom.xml @@ -41,9 +41,21 @@ test + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + com.baeldung.activitiwithspring.ActivitiWithSpringApplication + + + + - com.example.activitiwithspring.ActivitiWithSpringApplication UTF-8 UTF-8 6.0.0 diff --git a/spring-activiti/src/main/java/com/example/activitiwithspring/ActivitiController.java b/spring-activiti/src/main/java/com/baeldung/activitiwithspring/ActivitiController.java similarity index 97% rename from spring-activiti/src/main/java/com/example/activitiwithspring/ActivitiController.java rename to spring-activiti/src/main/java/com/baeldung/activitiwithspring/ActivitiController.java index 96b551c03c..54dd4670f0 100644 --- a/spring-activiti/src/main/java/com/example/activitiwithspring/ActivitiController.java +++ b/spring-activiti/src/main/java/com/baeldung/activitiwithspring/ActivitiController.java @@ -1,4 +1,4 @@ -package com.example.activitiwithspring; +package com.baeldung.activitiwithspring; import org.activiti.engine.RuntimeService; import org.activiti.engine.TaskService; diff --git a/spring-activiti/src/main/java/com/example/activitiwithspring/ActivitiWithSpringApplication.java b/spring-activiti/src/main/java/com/baeldung/activitiwithspring/ActivitiWithSpringApplication.java similarity index 91% rename from spring-activiti/src/main/java/com/example/activitiwithspring/ActivitiWithSpringApplication.java rename to spring-activiti/src/main/java/com/baeldung/activitiwithspring/ActivitiWithSpringApplication.java index a9cd1301eb..d43ae3cc35 100644 --- a/spring-activiti/src/main/java/com/example/activitiwithspring/ActivitiWithSpringApplication.java +++ b/spring-activiti/src/main/java/com/baeldung/activitiwithspring/ActivitiWithSpringApplication.java @@ -1,4 +1,4 @@ -package com.example.activitiwithspring; +package com.baeldung.activitiwithspring; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/spring-activiti/src/main/java/com/example/activitiwithspring/TaskRepresentation.java b/spring-activiti/src/main/java/com/baeldung/activitiwithspring/TaskRepresentation.java similarity index 90% rename from spring-activiti/src/main/java/com/example/activitiwithspring/TaskRepresentation.java rename to spring-activiti/src/main/java/com/baeldung/activitiwithspring/TaskRepresentation.java index bb1412b057..de1ad88ba9 100644 --- a/spring-activiti/src/main/java/com/example/activitiwithspring/TaskRepresentation.java +++ b/spring-activiti/src/main/java/com/baeldung/activitiwithspring/TaskRepresentation.java @@ -1,4 +1,4 @@ -package com.example.activitiwithspring; +package com.baeldung.activitiwithspring; class TaskRepresentation { diff --git a/spring-activiti/src/main/java/com/example/activitiwithspring/servicetasks/SendEmailServiceTask.java b/spring-activiti/src/main/java/com/baeldung/activitiwithspring/servicetasks/SendEmailServiceTask.java similarity index 83% rename from spring-activiti/src/main/java/com/example/activitiwithspring/servicetasks/SendEmailServiceTask.java rename to spring-activiti/src/main/java/com/baeldung/activitiwithspring/servicetasks/SendEmailServiceTask.java index c11b48f37a..c174b6ae4a 100644 --- a/spring-activiti/src/main/java/com/example/activitiwithspring/servicetasks/SendEmailServiceTask.java +++ b/spring-activiti/src/main/java/com/baeldung/activitiwithspring/servicetasks/SendEmailServiceTask.java @@ -1,4 +1,4 @@ -package com.example.activitiwithspring.servicetasks; +package com.baeldung.activitiwithspring.servicetasks; import org.activiti.engine.delegate.DelegateExecution; import org.activiti.engine.delegate.JavaDelegate; diff --git a/spring-activiti/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-activiti/src/test/java/com/baeldung/SpringContextIntegrationTest.java similarity index 81% rename from spring-activiti/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to spring-activiti/src/test/java/com/baeldung/SpringContextIntegrationTest.java index ae37e77f86..ce48080753 100644 --- a/spring-activiti/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/spring-activiti/src/test/java/com/baeldung/SpringContextIntegrationTest.java @@ -1,11 +1,11 @@ -package org.baeldung; +package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; -import com.example.activitiwithspring.ActivitiWithSpringApplication; +import com.baeldung.activitiwithspring.ActivitiWithSpringApplication; @RunWith(SpringRunner.class) @SpringBootTest(classes = ActivitiWithSpringApplication.class) diff --git a/spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiControllerIntegrationTest.java b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiControllerIntegrationTest.java similarity index 97% rename from spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiControllerIntegrationTest.java rename to spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiControllerIntegrationTest.java index 65fd33bfc6..12c855e5ff 100644 --- a/spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiControllerIntegrationTest.java +++ b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiControllerIntegrationTest.java @@ -1,5 +1,6 @@ -package com.example.activitiwithspring; +package com.baeldung.activitiwithspring; +import com.baeldung.activitiwithspring.TaskRepresentation; import com.fasterxml.jackson.databind.ObjectMapper; import org.activiti.engine.RuntimeService; import org.activiti.engine.runtime.ProcessInstance; diff --git a/spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiSpringSecurityIntegrationTest.java b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiSpringSecurityIntegrationTest.java similarity index 96% rename from spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiSpringSecurityIntegrationTest.java rename to spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiSpringSecurityIntegrationTest.java index c2eeb96555..53bdcee888 100644 --- a/spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiSpringSecurityIntegrationTest.java +++ b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiSpringSecurityIntegrationTest.java @@ -1,4 +1,4 @@ -package com.example.activitiwithspring; +package com.baeldung.activitiwithspring; import org.activiti.engine.IdentityService; import org.junit.Test; diff --git a/spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiWithSpringApplicationIntegrationTest.java b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiWithSpringApplicationIntegrationTest.java similarity index 89% rename from spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiWithSpringApplicationIntegrationTest.java rename to spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiWithSpringApplicationIntegrationTest.java index 7460c302d8..8c1e400215 100644 --- a/spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiWithSpringApplicationIntegrationTest.java +++ b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiWithSpringApplicationIntegrationTest.java @@ -1,4 +1,4 @@ -package com.example.activitiwithspring; +package com.baeldung.activitiwithspring; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-activiti/src/test/java/com/example/activitiwithspring/ProcessEngineCreationIntegrationTest.java b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ProcessEngineCreationIntegrationTest.java similarity index 98% rename from spring-activiti/src/test/java/com/example/activitiwithspring/ProcessEngineCreationIntegrationTest.java rename to spring-activiti/src/test/java/com/baeldung/activitiwithspring/ProcessEngineCreationIntegrationTest.java index 00afd14590..00538f8e6e 100644 --- a/spring-activiti/src/test/java/com/example/activitiwithspring/ProcessEngineCreationIntegrationTest.java +++ b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ProcessEngineCreationIntegrationTest.java @@ -1,4 +1,4 @@ -package com.example.activitiwithspring; +package com.baeldung.activitiwithspring; import org.activiti.engine.ProcessEngine; import org.activiti.engine.ProcessEngineConfiguration; diff --git a/spring-activiti/src/test/java/com/example/activitiwithspring/ProcessExecutionIntegrationTest.java b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ProcessExecutionIntegrationTest.java similarity index 99% rename from spring-activiti/src/test/java/com/example/activitiwithspring/ProcessExecutionIntegrationTest.java rename to spring-activiti/src/test/java/com/baeldung/activitiwithspring/ProcessExecutionIntegrationTest.java index 9c35ea413b..4342590ea9 100644 --- a/spring-activiti/src/test/java/com/example/activitiwithspring/ProcessExecutionIntegrationTest.java +++ b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ProcessExecutionIntegrationTest.java @@ -1,4 +1,4 @@ -package com.example.activitiwithspring; +package com.baeldung.activitiwithspring; import org.activiti.engine.ActivitiException; From a7276eb191eabaa52138388366c5e28c1e1f1584 Mon Sep 17 00:00:00 2001 From: Sjmillington Date: Sun, 21 Oct 2018 17:42:54 +0100 Subject: [PATCH 85/87] [BAEL-2256] Guide to simple date format unit tests --- .../SimpleDateFormatUnitTest.java | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 core-java/src/test/java/com/baeldung/simpledateformat/SimpleDateFormatUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/simpledateformat/SimpleDateFormatUnitTest.java b/core-java/src/test/java/com/baeldung/simpledateformat/SimpleDateFormatUnitTest.java new file mode 100644 index 0000000000..ee994247a4 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/simpledateformat/SimpleDateFormatUnitTest.java @@ -0,0 +1,59 @@ +package com.baeldung; + +import org.junit.Test; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Locale; +import java.util.TimeZone; +import java.util.logging.Logger; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + + +public class SimpleDateFormatUnitTest { + + private static final Logger logger = Logger.getLogger(SimpleDateFormatUnitTest.class.getName()); + + @Test + public void givenSpecificDate_whenFormatted_checkFormatCorrect() throws Exception { + SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy"); + assertEquals("24-05-1977", formatter.format(new Date(233345223232L))); + } + + @Test + public void givenSpecificDate_whenFormattedUsingDateFormat_checkFormatCorrect() throws Exception { + DateFormat formatter = DateFormat.getDateInstance(DateFormat.SHORT); + assertEquals("5/24/77", formatter.format(new Date(233345223232L))); + } + + @Test + public void givenStringDate_whenParsed_checkDateCorrect() throws Exception{ + SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy"); + Date myDate = new Date(233276400000L); + Date parsedDate = formatter.parse("24-05-1977"); + assertEquals(myDate.getTime(), parsedDate.getTime()); + } + + @Test + public void givenFranceLocale_whenFormatted_checkFormatCorrect() throws Exception{ + SimpleDateFormat franceDateFormatter = new SimpleDateFormat("EEEEE dd-MMMMMMM-yyyy", Locale.FRANCE); + Date myWednesday = new Date(1539341312904L); + assertTrue(franceDateFormatter.format(myWednesday).startsWith("vendredi")); + } + + @Test + public void given2TimeZones_whenFormatted_checkTimeDifference() throws Exception { + Date now = new Date(); + + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEEE dd-MMM-yy HH:mm:ssZ"); + + simpleDateFormat.setTimeZone(TimeZone.getTimeZone("Europe/London")); + logger.info(simpleDateFormat.format(now)); + //change the date format + simpleDateFormat.setTimeZone(TimeZone.getTimeZone("America/New_York")); + logger.info(simpleDateFormat.format(now)); + } +} From 06be85c4a183549f2bc6a6e99f35276014e0dafb Mon Sep 17 00:00:00 2001 From: Sam Millington Date: Sun, 21 Oct 2018 18:06:39 +0100 Subject: [PATCH 86/87] Added 'thens' to conform with given_when_then format --- .../simpledateformat/SimpleDateFormatUnitTest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core-java/src/test/java/com/baeldung/simpledateformat/SimpleDateFormatUnitTest.java b/core-java/src/test/java/com/baeldung/simpledateformat/SimpleDateFormatUnitTest.java index ee994247a4..ba4ea32e21 100644 --- a/core-java/src/test/java/com/baeldung/simpledateformat/SimpleDateFormatUnitTest.java +++ b/core-java/src/test/java/com/baeldung/simpledateformat/SimpleDateFormatUnitTest.java @@ -18,19 +18,19 @@ public class SimpleDateFormatUnitTest { private static final Logger logger = Logger.getLogger(SimpleDateFormatUnitTest.class.getName()); @Test - public void givenSpecificDate_whenFormatted_checkFormatCorrect() throws Exception { + public void givenSpecificDate_whenFormatted_thenCheckFormatCorrect() throws Exception { SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy"); assertEquals("24-05-1977", formatter.format(new Date(233345223232L))); } @Test - public void givenSpecificDate_whenFormattedUsingDateFormat_checkFormatCorrect() throws Exception { + public void givenSpecificDate_whenFormattedUsingDateFormat_thenCheckFormatCorrect() throws Exception { DateFormat formatter = DateFormat.getDateInstance(DateFormat.SHORT); assertEquals("5/24/77", formatter.format(new Date(233345223232L))); } @Test - public void givenStringDate_whenParsed_checkDateCorrect() throws Exception{ + public void givenStringDate_whenParsed_thenCheckDateCorrect() throws Exception{ SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy"); Date myDate = new Date(233276400000L); Date parsedDate = formatter.parse("24-05-1977"); @@ -38,14 +38,14 @@ public class SimpleDateFormatUnitTest { } @Test - public void givenFranceLocale_whenFormatted_checkFormatCorrect() throws Exception{ + public void givenFranceLocale_whenFormatted_thenCheckFormatCorrect() throws Exception{ SimpleDateFormat franceDateFormatter = new SimpleDateFormat("EEEEE dd-MMMMMMM-yyyy", Locale.FRANCE); Date myWednesday = new Date(1539341312904L); assertTrue(franceDateFormatter.format(myWednesday).startsWith("vendredi")); } @Test - public void given2TimeZones_whenFormatted_checkTimeDifference() throws Exception { + public void given2TimeZones_whenFormatted_thenCheckTimeDifference() throws Exception { Date now = new Date(); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEEE dd-MMM-yy HH:mm:ssZ"); From d67ad2151bcadca931f0cc88eb94c886d36c328c Mon Sep 17 00:00:00 2001 From: sandy03934 Date: Mon, 22 Oct 2018 01:11:25 +0530 Subject: [PATCH 87/87] BAEL-2262 Demo Spring Boot App for HTTPS enabled. (#5513) * BAEL-1979 Added examples for SnakeYAML Library * BAEL-1979 Moved the snakeyaml related code to libraries module * BAEL-1979 Removed the System.out.println() statements and converted the assertTrue to assertEquals wherever possible. * BAEL-1979 Removed println statements, small formatting fix in pom.xml * BAEL-1466 Added a new module for apache-geode * BAEL-1466 Updated the Integration Tests. * BAEL-1466 Updated the Integration Tests. * BAEL-1466 Updated the Integration Tests. * BAEL-1466 Removed the Unnecessary code. * BAEL-2262 Added code for demonstration of HTTPS enabled Spring Boot Application --- spring-security-mvc-boot/pom.xml | 6 +- .../baeldung/ssl/HttpsEnabledApplication.java | 14 ++++ .../java/org/baeldung/ssl/SecurityConfig.java | 36 ++++++++++ .../org/baeldung/ssl/WelcomeController.java | 15 ++++ .../main/resources/application-ssl.properties | 20 ++++++ .../src/main/resources/keystore/baeldung.p12 | Bin 0 -> 2603 bytes .../main/resources/templates/ssl/welcome.html | 1 + .../web/HttpsApplicationIntegrationTest.java | 67 ++++++++++++++++++ 8 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 spring-security-mvc-boot/src/main/java/org/baeldung/ssl/HttpsEnabledApplication.java create mode 100644 spring-security-mvc-boot/src/main/java/org/baeldung/ssl/SecurityConfig.java create mode 100644 spring-security-mvc-boot/src/main/java/org/baeldung/ssl/WelcomeController.java create mode 100644 spring-security-mvc-boot/src/main/resources/application-ssl.properties create mode 100644 spring-security-mvc-boot/src/main/resources/keystore/baeldung.p12 create mode 100644 spring-security-mvc-boot/src/main/resources/templates/ssl/welcome.html create mode 100644 spring-security-mvc-boot/src/test/java/org/baeldung/web/HttpsApplicationIntegrationTest.java diff --git a/spring-security-mvc-boot/pom.xml b/spring-security-mvc-boot/pom.xml index 4090beab99..d2316ddca5 100644 --- a/spring-security-mvc-boot/pom.xml +++ b/spring-security-mvc-boot/pom.xml @@ -229,12 +229,16 @@ - + + + 1.1.2 1.2 1.6.1 2.6.11 + 1.8 diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/HttpsEnabledApplication.java b/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/HttpsEnabledApplication.java new file mode 100644 index 0000000000..70fe30abdc --- /dev/null +++ b/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/HttpsEnabledApplication.java @@ -0,0 +1,14 @@ +package org.baeldung.ssl; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class HttpsEnabledApplication { + + public static void main(String... args) { + SpringApplication application = new SpringApplication(HttpsEnabledApplication.class); + application.setAdditionalProfiles("ssl"); + application.run(args); + } +} diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/SecurityConfig.java b/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/SecurityConfig.java new file mode 100644 index 0000000000..98a59b11bb --- /dev/null +++ b/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/SecurityConfig.java @@ -0,0 +1,36 @@ +package org.baeldung.ssl; + +import org.springframework.context.annotation.Bean; +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; + +@EnableWebSecurity +public class SecurityConfig extends WebSecurityConfigurerAdapter { + + @Override + public void configure(AuthenticationManagerBuilder auth) throws Exception { + + auth.inMemoryAuthentication() + .withUser("memuser") + .password(passwordEncoder().encode("pass")) + .roles("USER"); + } + + @Override + protected void configure(HttpSecurity http) throws Exception { + http.httpBasic() + .and() + .authorizeRequests() + .antMatchers("/**") + .authenticated(); + } + + @Bean + public PasswordEncoder passwordEncoder() { + return new BCryptPasswordEncoder(); + } +} diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/WelcomeController.java b/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/WelcomeController.java new file mode 100644 index 0000000000..72ad8abb85 --- /dev/null +++ b/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/WelcomeController.java @@ -0,0 +1,15 @@ +package org.baeldung.ssl; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +public class WelcomeController { + + @GetMapping("/welcome") + public String welcome() { + return "ssl/welcome"; + } + +} diff --git a/spring-security-mvc-boot/src/main/resources/application-ssl.properties b/spring-security-mvc-boot/src/main/resources/application-ssl.properties new file mode 100644 index 0000000000..090b775d03 --- /dev/null +++ b/spring-security-mvc-boot/src/main/resources/application-ssl.properties @@ -0,0 +1,20 @@ + +http.port=8080 + +server.port=8443 + +security.require-ssl=true + +# The format used for the keystore +server.ssl.key-store-type=PKCS12 +# The path to the keystore containing the certificate +server.ssl.key-store=classpath:keystore/baeldung.p12 +# The password used to generate the certificate +server.ssl.key-store-password=password +# The alias mapped to the certificate +server.ssl.key-alias=baeldung + +#trust store location +trust.store=classpath:keystore/baeldung.p12 +#trust store password +trust.store.password=password diff --git a/spring-security-mvc-boot/src/main/resources/keystore/baeldung.p12 b/spring-security-mvc-boot/src/main/resources/keystore/baeldung.p12 new file mode 100644 index 0000000000000000000000000000000000000000..cd8eb284297009e987aa1a1d6b53c48af587776e GIT binary patch literal 2603 zcmY+EXEYlM8^;r3M9o+w1hFbbqGHbuyEIm+snTk!hO1FpR7GP|aZ6j;auK8UtQAG7 zV$YhT2qmc9Vcsg&`=0l`_uLQ9dCvL$|IhRBhaz(+vH)38WbiCI7!hqAy~_jS08+@{ zK@b_-cZ|DGWH#S_MQko0G8^s~V~@v<{lx#SxVeBV6f)>1iVWICDY0|?A0I!5f`s^3 zu&dJJ6F~Z?bJm7OhKe^z>^=)CfQ|u?L7h6GkAgI65DwJB{KM&_MXKTI9lIqxhN`1} z`A*KRClYJWaEY_s^N|voc6A00ThR7qHjQvZX+gn$-BvCy^h*XXd@(9FFl&uIA(ye3~t$x%OvdtZ6kea z?f2mYKd}#kcfPd2Qj@BWsJYAQV?UWEV$3xr?2MMkh<@aOLyI5fS+HWE`b(`(J^ht} zkR*eWyqT*v5%MaZOvmUzs+mdtjCG$7e zk&q|W%V|!jeWjxuJY*Pp@C-pN0z$3MU$4}90$#HPd)>y0K?<6Y7T0Chq0uke7wbomuc|C+P#-z{m`4c1|1GBI(woGP!Qhl7t_2@B=gTCU}klA|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)KSNh5GdGhbD-AIfz3o9_1@)sB) B#c}`u literal 0 HcmV?d00001 diff --git a/spring-security-mvc-boot/src/main/resources/templates/ssl/welcome.html b/spring-security-mvc-boot/src/main/resources/templates/ssl/welcome.html new file mode 100644 index 0000000000..93b3577f5c --- /dev/null +++ b/spring-security-mvc-boot/src/main/resources/templates/ssl/welcome.html @@ -0,0 +1 @@ +

Welcome to Secured Site

\ No newline at end of file diff --git a/spring-security-mvc-boot/src/test/java/org/baeldung/web/HttpsApplicationIntegrationTest.java b/spring-security-mvc-boot/src/test/java/org/baeldung/web/HttpsApplicationIntegrationTest.java new file mode 100644 index 0000000000..63b421604a --- /dev/null +++ b/spring-security-mvc-boot/src/test/java/org/baeldung/web/HttpsApplicationIntegrationTest.java @@ -0,0 +1,67 @@ +package org.baeldung.web; + +import org.apache.http.client.HttpClient; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.ssl.SSLContextBuilder; +import org.baeldung.ssl.HttpsEnabledApplication; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.core.io.Resource; +import org.springframework.http.*; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.web.client.RestTemplate; + +import javax.net.ssl.SSLContext; +import java.util.Base64; + +import static org.junit.Assert.assertEquals; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = HttpsEnabledApplication.class, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT) +@ActiveProfiles("ssl") +public class HttpsApplicationIntegrationTest { + + private static final String WELCOME_URL = "https://localhost:8443/welcome"; + + @Value("${trust.store}") + private Resource trustStore; + + @Value("${trust.store.password}") + private String trustStorePassword; + + @Test + public void whenGETanHTTPSResource_thenCorrectResponse() throws Exception { + ResponseEntity response = restTemplate().exchange(WELCOME_URL, HttpMethod.GET, new HttpEntity(withAuthorization("memuser", "pass")), String.class); + + assertEquals("

Welcome to Secured Site

", response.getBody()); + assertEquals(HttpStatus.OK, response.getStatusCode()); + } + + RestTemplate restTemplate() throws Exception { + SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(trustStore.getURL(), trustStorePassword.toCharArray()) + .build(); + SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(sslContext); + HttpClient httpClient = HttpClients.custom() + .setSSLSocketFactory(socketFactory) + .build(); + HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(httpClient); + return new RestTemplate(factory); + } + + HttpHeaders withAuthorization(String userName, String password) { + return new HttpHeaders() { + { + String auth = userName + ":" + password; + String authHeader = "Basic " + new String(Base64.getEncoder() + .encode(auth.getBytes())); + set("Authorization", authHeader); + } + }; + } + +}