diff --git a/README.md b/README.md index 4cad075cc3..5307efa008 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +**UPDATE**: The price of "Learn Spring Security OAuth" will permanently change on the 11th of December, along with the upcoming OAuth2 material: http://bit.ly/github-lss The Courses ============================== diff --git a/akka-http/pom.xml b/akka-http/pom.xml index 6d73f2f2e6..e276ef1aa4 100644 --- a/akka-http/pom.xml +++ b/akka-http/pom.xml @@ -1,47 +1,46 @@ -<?xml version="1.0"?> -<project - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" - xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +<?xml version="1.0" encoding="UTF-8"?> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + <artifactId>akka-http</artifactId> + <name>akka-http</name> - <modelVersion>4.0.0</modelVersion> - <artifactId>akka-http</artifactId> - <name>akka-http</name> + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> - <parent> - <artifactId>parent-modules</artifactId> - <groupId>com.baeldung</groupId> - <version>1.0.0-SNAPSHOT</version> - </parent> + <dependencies> + <dependency> + <groupId>com.typesafe.akka</groupId> + <artifactId>akka-http_2.12</artifactId> + <version>${akka.http.version}</version> + </dependency> + <dependency> + <groupId>com.typesafe.akka</groupId> + <artifactId>akka-stream_2.12</artifactId> + <version>${akka.stream.version}</version> + </dependency> + <dependency> + <groupId>com.typesafe.akka</groupId> + <artifactId>akka-http-jackson_2.12</artifactId> + <version>${akka.http.version}</version> + </dependency> + <dependency> + <groupId>com.typesafe.akka</groupId> + <artifactId>akka-http-testkit_2.12</artifactId> + <version>${akka.http.version}</version> + <scope>test</scope> + </dependency> + </dependencies> - <dependencies> - <dependency> - <groupId>com.typesafe.akka</groupId> - <artifactId>akka-http_2.12</artifactId> - <version>${akka.http.version}</version> - </dependency> - <dependency> - <groupId>com.typesafe.akka</groupId> - <artifactId>akka-stream_2.12</artifactId> - <version>${akka.stream.version}</version> - </dependency> - <dependency> - <groupId>com.typesafe.akka</groupId> - <artifactId>akka-http-jackson_2.12</artifactId> - <version>${akka.http.version}</version> - </dependency> - <dependency> - <groupId>com.typesafe.akka</groupId> - <artifactId>akka-http-testkit_2.12</artifactId> - <version>${akka.http.version}</version> - <scope>test</scope> - </dependency> - </dependencies> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <akka.http.version>10.0.11</akka.http.version> + <akka.stream.version>2.5.11</akka.stream.version> + </properties> - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - <akka.http.version>10.0.11</akka.http.version> - <akka.stream.version>2.5.11</akka.stream.version> - </properties> </project> diff --git a/akka-streams/pom.xml b/akka-streams/pom.xml index 7719bb7351..967556d976 100644 --- a/akka-streams/pom.xml +++ b/akka-streams/pom.xml @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>akka-streams</artifactId> <name>akka-streams</name> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> diff --git a/algorithms-genetic/pom.xml b/algorithms-genetic/pom.xml index 56f6a31525..eeccb89d6f 100644 --- a/algorithms-genetic/pom.xml +++ b/algorithms-genetic/pom.xml @@ -1,10 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>algorithms-genetic</artifactId> <version>0.0.1-SNAPSHOT</version> <name>algorithms-genetic</name> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> @@ -60,5 +61,4 @@ <commons-codec.version>1.11</commons-codec.version> </properties> - </project> diff --git a/algorithms-miscellaneous-1/README.md b/algorithms-miscellaneous-1/README.md index 6a25f8cac8..25e2733538 100644 --- a/algorithms-miscellaneous-1/README.md +++ b/algorithms-miscellaneous-1/README.md @@ -7,8 +7,6 @@ This module contains articles about algorithms. Some classes of algorithms, e.g. - [Validating Input With Finite Automata in Java](https://www.baeldung.com/java-finite-automata) - [Example of Hill Climbing Algorithm](https://www.baeldung.com/java-hill-climbing-algorithm) -- [Monte Carlo Tree Search for Tic-Tac-Toe Game](https://www.baeldung.com/java-monte-carlo-tree-search) -- [Binary Search Algorithm in Java](https://www.baeldung.com/java-binary-search) - [Introduction to Minimax Algorithm](https://www.baeldung.com/java-minimax-algorithm) - [How to Calculate Levenshtein Distance in Java?](https://www.baeldung.com/java-levenshtein-distance) - [How to Find the Kth Largest Element in Java](https://www.baeldung.com/java-kth-largest-element) diff --git a/algorithms-miscellaneous-1/pom.xml b/algorithms-miscellaneous-1/pom.xml index affa66f147..a2183f7474 100644 --- a/algorithms-miscellaneous-1/pom.xml +++ b/algorithms-miscellaneous-1/pom.xml @@ -1,10 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>algorithms-miscellaneous-1</artifactId> <version>0.0.1-SNAPSHOT</version> <name>algorithms-miscellaneous-1</name> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> @@ -43,7 +44,7 @@ <groupId>com.github.dpaukov</groupId> <artifactId>combinatoricslib3</artifactId> <version>${combinatoricslib3.version}</version> - </dependency> + </dependency> </dependencies> <build> diff --git a/algorithms-miscellaneous-2/pom.xml b/algorithms-miscellaneous-2/pom.xml index e85dd456a3..e4f4e5c2ea 100644 --- a/algorithms-miscellaneous-2/pom.xml +++ b/algorithms-miscellaneous-2/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>algorithms-miscellaneous-2</artifactId> <version>0.0.1-SNAPSHOT</version> @@ -34,9 +35,9 @@ <version>${org.jgrapht.core.version}</version> </dependency> <dependency> - <groupId>org.jgrapht</groupId> - <artifactId>jgrapht-ext</artifactId> - <version>${org.jgrapht.ext.version}</version> + <groupId>org.jgrapht</groupId> + <artifactId>jgrapht-ext</artifactId> + <version>${org.jgrapht.ext.version}</version> </dependency> <dependency> <groupId>pl.allegro.finance</groupId> diff --git a/algorithms-miscellaneous-3/README.md b/algorithms-miscellaneous-3/README.md index 93426b3e0d..23a10258a3 100644 --- a/algorithms-miscellaneous-3/README.md +++ b/algorithms-miscellaneous-3/README.md @@ -14,8 +14,6 @@ This module contains articles about algorithms. Some classes of algorithms, e.g. - [A Guide to the Folding Technique in Java](https://www.baeldung.com/folding-hashing-technique) - [Creating a Triangle with for Loops in Java](https://www.baeldung.com/java-print-triangle) - [Efficient Word Frequency Calculator in Java](https://www.baeldung.com/java-word-frequency) -- [Interpolation Search in Java](https://www.baeldung.com/java-interpolation-search) - [The K-Means Clustering Algorithm in Java](https://www.baeldung.com/java-k-means-clustering-algorithm) - [Creating a Custom Annotation in Java](https://www.baeldung.com/java-custom-annotation) -- [Breadth-First Search Algorithm in Java](https://www.baeldung.com/java-breadth-first-search) - More articles: [[<-- prev]](/algorithms-miscellaneous-2) [[next -->]](/algorithms-miscellaneous-4) diff --git a/algorithms-miscellaneous-3/pom.xml b/algorithms-miscellaneous-3/pom.xml index 67923d37d7..a893f0a045 100644 --- a/algorithms-miscellaneous-3/pom.xml +++ b/algorithms-miscellaneous-3/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -91,4 +92,5 @@ <jmh-core.version>1.19</jmh-core.version> <jmh-generator.version>1.19</jmh-generator.version> </properties> + </project> \ No newline at end of file diff --git a/algorithms-miscellaneous-4/README.md b/algorithms-miscellaneous-4/README.md index df2eafb733..fd33b58d72 100644 --- a/algorithms-miscellaneous-4/README.md +++ b/algorithms-miscellaneous-4/README.md @@ -5,10 +5,10 @@ This module contains articles about algorithms. Some classes of algorithms, e.g. ### Relevant articles: - [Multi-Swarm Optimization Algorithm in Java](https://www.baeldung.com/java-multi-swarm-algorithm) -- [String Search Algorithms for Large Texts](https://www.baeldung.com/java-full-text-search-algorithms) - [Check If a String Contains All The Letters of The Alphabet](https://www.baeldung.com/java-string-contains-all-letters) - [Find the Middle Element of a Linked List](https://www.baeldung.com/java-linked-list-middle-element) - [Find Substrings That Are Palindromes in Java](https://www.baeldung.com/java-palindrome-substrings) - [Find the Longest Substring without Repeating Characters](https://www.baeldung.com/java-longest-substring-without-repeated-characters) - [Permutations of an Array in Java](https://www.baeldung.com/java-array-permutations) +- [Find the Smallest Missing Integer in an Array](https://www.baeldung.com/java-smallest-missing-integer-in-array) - More articles: [[<-- prev]](/algorithms-miscellaneous-3) [[next -->]](/algorithms-miscellaneous-5) diff --git a/algorithms-miscellaneous-4/pom.xml b/algorithms-miscellaneous-4/pom.xml index 8fd8f807ba..682234ad07 100644 --- a/algorithms-miscellaneous-4/pom.xml +++ b/algorithms-miscellaneous-4/pom.xml @@ -1,10 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>algorithms-miscellaneous-4</artifactId> <version>0.0.1-SNAPSHOT</version> <name>algorithms-miscellaneous-4</name> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> diff --git a/algorithms-miscellaneous-4/src/test/java/com/baeldung/algorithms/StringSearchAlgorithmsUnitTest.java b/algorithms-miscellaneous-4/src/test/java/com/baeldung/algorithms/StringSearchAlgorithmsUnitTest.java deleted file mode 100755 index dfe015aad2..0000000000 --- a/algorithms-miscellaneous-4/src/test/java/com/baeldung/algorithms/StringSearchAlgorithmsUnitTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.baeldung.algorithms; - - -import org.junit.Assert; -import org.junit.Test; - -import com.baeldung.algorithms.string.search.StringSearchAlgorithms; - -public class StringSearchAlgorithmsUnitTest { - - - @Test - public void testStringSearchAlgorithms(){ - String text = "This is some nice text."; - String pattern = "some"; - - int realPosition = text.indexOf(pattern); - Assert.assertTrue(realPosition == StringSearchAlgorithms.simpleTextSearch(pattern.toCharArray(), text.toCharArray())); - Assert.assertTrue(realPosition == StringSearchAlgorithms.RabinKarpMethod(pattern.toCharArray(), text.toCharArray())); - Assert.assertTrue(realPosition == StringSearchAlgorithms.KnuthMorrisPrattSearch(pattern.toCharArray(), text.toCharArray())); - Assert.assertTrue(realPosition == StringSearchAlgorithms.BoyerMooreHorspoolSimpleSearch(pattern.toCharArray(), text.toCharArray())); - Assert.assertTrue(realPosition == StringSearchAlgorithms.BoyerMooreHorspoolSearch(pattern.toCharArray(), text.toCharArray())); - } - -} diff --git a/algorithms-miscellaneous-4/src/test/java/com/baeldung/algorithms/smallestinteger/SmallestMissingPositiveIntegerUnitTest.java b/algorithms-miscellaneous-4/src/test/java/com/baeldung/algorithms/smallestinteger/SmallestMissingPositiveIntegerUnitTest.java index 8bb7151b41..a1b1bfaa25 100644 --- a/algorithms-miscellaneous-4/src/test/java/com/baeldung/algorithms/smallestinteger/SmallestMissingPositiveIntegerUnitTest.java +++ b/algorithms-miscellaneous-4/src/test/java/com/baeldung/algorithms/smallestinteger/SmallestMissingPositiveIntegerUnitTest.java @@ -85,4 +85,13 @@ class SmallestMissingPositiveIntegerUnitTest { assertThat(result).isEqualTo(input.length); } + + @Test + void givenArrayWithoutZero_whenSearchInUnsortedArrayBooleanArray_thenZero() { + int[] input = new int[] {11, 13, 14, 15}; + + int result = SmallestMissingPositiveInteger.searchInUnsortedArrayBooleanArray(input); + + assertThat(result).isEqualTo(0); + } } \ No newline at end of file diff --git a/algorithms-miscellaneous-5/README.md b/algorithms-miscellaneous-5/README.md index 598fbab8b5..27ab303210 100644 --- a/algorithms-miscellaneous-5/README.md +++ b/algorithms-miscellaneous-5/README.md @@ -9,4 +9,5 @@ This module contains articles about algorithms. Some classes of algorithms, e.g. - [Reversing a Binary Tree in Java](https://www.baeldung.com/java-reversing-a-binary-tree) - [Find If Two Numbers Are Relatively Prime in Java](https://www.baeldung.com/java-two-relatively-prime-numbers) - [Knapsack Problem Implementation in Java](https://www.baeldung.com/java-knapsack) +- [How to Determine if a Binary Tree is Balanced](https://www.baeldung.com/java-balanced-binary-tree) - More articles: [[<-- prev]](/../algorithms-miscellaneous-4) diff --git a/algorithms-miscellaneous-5/pom.xml b/algorithms-miscellaneous-5/pom.xml index 98a7f33474..2f530958e3 100644 --- a/algorithms-miscellaneous-5/pom.xml +++ b/algorithms-miscellaneous-5/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>algorithms-miscellaneous-5</artifactId> <version>0.0.1-SNAPSHOT</version> diff --git a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/combinatorics/Combinatorics.java b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/combinatorics/Combinatorics.java new file mode 100644 index 0000000000..a5c4b325a4 --- /dev/null +++ b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/combinatorics/Combinatorics.java @@ -0,0 +1,67 @@ +package com.baeldung.algorithms.combinatorics; + +import java.util.*; + +import static java.util.Collections.swap; + +public class Combinatorics { + + public static List<List<Integer>> permutations(List<Integer> sequence) { + List<List<Integer>> results = new ArrayList<>(); + permutationsInternal(sequence, results, 0); + return results; + } + + private static void permutationsInternal(List<Integer> sequence, List<List<Integer>> results, int index) { + if (index == sequence.size() - 1) { + results.add(new ArrayList<>(sequence)); + } + + for (int i = index; i < sequence.size(); i++) { + swap(sequence, i, index); + permutationsInternal(sequence, results, index + 1); + swap(sequence, i, index); + } + } + + public static List<List<Integer>> combinations(List<Integer> inputSet, int k) { + List<List<Integer>> results = new ArrayList<>(); + combinationsInternal(inputSet, k, results, new ArrayList<>(), 0); + return results; + } + + private static void combinationsInternal( + List<Integer> inputSet, int k, List<List<Integer>> results, ArrayList<Integer> accumulator, int index) { + int leftToAccumulate = k - accumulator.size(); + int possibleToAcculumate = inputSet.size() - index; + + if (accumulator.size() == k) { + results.add(new ArrayList<>(accumulator)); + } else if (leftToAccumulate <= possibleToAcculumate) { + combinationsInternal(inputSet, k, results, accumulator, index + 1); + + accumulator.add(inputSet.get(index)); + combinationsInternal(inputSet, k, results, accumulator, index + 1); + accumulator.remove(accumulator.size() - 1); + } + } + + public static List<List<Character>> powerSet(List<Character> sequence) { + List<List<Character>> results = new ArrayList<>(); + powerSetInternal(sequence, results, new ArrayList<>(), 0); + return results; + } + + private static void powerSetInternal( + List<Character> set, List<List<Character>> powerSet, List<Character> accumulator, int index) { + if (index == set.size()) { + powerSet.add(new ArrayList<>(accumulator)); + } else { + accumulator.add(set.get(index)); + + powerSetInternal(set, powerSet, accumulator, index + 1); + accumulator.remove(accumulator.size() - 1); + powerSetInternal(set, powerSet, accumulator, index + 1); + } + } +} diff --git a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/maximumsubarray/BruteForceAlgorithm.java b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/maximumsubarray/BruteForceAlgorithm.java new file mode 100644 index 0000000000..932ded5018 --- /dev/null +++ b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/maximumsubarray/BruteForceAlgorithm.java @@ -0,0 +1,35 @@ +package com.baeldung.algorithms.maximumsubarray; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class BruteForceAlgorithm { + + private Logger logger = LoggerFactory.getLogger(BruteForceAlgorithm.class.getName()); + + public int maxSubArray(int[] arr) { + + int size = arr.length; + int maximumSubArraySum = Integer.MIN_VALUE; + int start = 0; + int end = 0; + + for (int left = 0; left < size; left++) { + + int runningWindowSum = 0; + + for (int right = left; right < size; right++) { + runningWindowSum += arr[right]; + + if (runningWindowSum > maximumSubArraySum) { + maximumSubArraySum = runningWindowSum; + start = left; + end = right; + } + } + } + logger.info("Found Maximum Subarray between {} and {}", start, end); + return maximumSubArraySum; + } + +} diff --git a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/maximumsubarray/KadaneAlgorithm.java b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/maximumsubarray/KadaneAlgorithm.java new file mode 100644 index 0000000000..0aaa1b6c23 --- /dev/null +++ b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/maximumsubarray/KadaneAlgorithm.java @@ -0,0 +1,34 @@ +package com.baeldung.algorithms.maximumsubarray; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class KadaneAlgorithm { + + private Logger logger = LoggerFactory.getLogger(BruteForceAlgorithm.class.getName()); + + public int maxSubArraySum(int[] arr) { + + int size = arr.length; + int start = 0; + int end = 0; + + int maxSoFar = 0, maxEndingHere = 0; + + for (int i = 0; i < size; i++) { + + if (arr[i] > maxEndingHere + arr[i]) { + start = i; + maxEndingHere = arr[i]; + } else + maxEndingHere = maxEndingHere + arr[i]; + + if (maxSoFar < maxEndingHere) { + maxSoFar = maxEndingHere; + end = i; + } + } + logger.info("Found Maximum Subarray between {} and {}", start, end); + return maxSoFar; + } +} diff --git a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/mergesortedarrays/SortedArrays.java b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/mergesortedarrays/SortedArrays.java new file mode 100644 index 0000000000..5d1c4af650 --- /dev/null +++ b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/mergesortedarrays/SortedArrays.java @@ -0,0 +1,33 @@ +package com.baeldung.algorithms.mergesortedarrays; + +public class SortedArrays { + + public static int[] merge(int[] foo, int[] bar) { + + int fooLength = foo.length; + int barLength = bar.length; + + int[] merged = new int[fooLength + barLength]; + + int fooPosition, barPosition, mergedPosition; + fooPosition = barPosition = mergedPosition = 0; + + while (fooPosition < fooLength && barPosition < barLength) { + if (foo[fooPosition] < bar[barPosition]) { + merged[mergedPosition++] = foo[fooPosition++]; + } else { + merged[mergedPosition++] = bar[barPosition++]; + } + } + + while (fooPosition < fooLength) { + merged[mergedPosition++] = foo[fooPosition++]; + } + + while (barPosition < barLength) { + merged[mergedPosition++] = bar[barPosition++]; + } + + return merged; + } +} diff --git a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/prim/Edge.java b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/prim/Edge.java new file mode 100644 index 0000000000..52ec4ef534 --- /dev/null +++ b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/prim/Edge.java @@ -0,0 +1,36 @@ +package com.baeldung.algorithms.prim; + +public class Edge { + + private int weight; + private boolean isIncluded = false; + private boolean isPrinted = false; + + public Edge(int weight) { + this.weight = weight; + } + + public int getWeight() { + return weight; + } + + public void setWeight(int weight) { + this.weight = weight; + } + + public boolean isIncluded() { + return isIncluded; + } + + public void setIncluded(boolean included) { + isIncluded = included; + } + + public boolean isPrinted() { + return isPrinted; + } + + public void setPrinted(boolean printed) { + isPrinted = printed; + } +} diff --git a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/prim/Prim.java b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/prim/Prim.java new file mode 100644 index 0000000000..365dca6b62 --- /dev/null +++ b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/prim/Prim.java @@ -0,0 +1,73 @@ +package com.baeldung.algorithms.prim; + +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.commons.math3.util.Pair; + +public class Prim { + + private List<Vertex> graph; + + public Prim(List<Vertex> graph){ + this.graph = graph; + } + + public void run(){ + if (graph.size() > 0){ + graph.get(0).setVisited(true); + } + while (isDisconnected()){ + Edge nextMinimum = new Edge(Integer.MAX_VALUE); + Vertex nextVertex = graph.get(0); + for (Vertex vertex : graph){ + if (vertex.isVisited()){ + Pair<Vertex, Edge> candidate = vertex.nextMinimum(); + if (candidate.getValue().getWeight() < nextMinimum.getWeight()){ + nextMinimum = candidate.getValue(); + nextVertex = candidate.getKey(); + } + } + } + nextMinimum.setIncluded(true); + nextVertex.setVisited(true); + } + } + + private boolean isDisconnected(){ + for (Vertex vertex : graph){ + if (!vertex.isVisited()){ + return true; + } + } + return false; + } + + public String originalGraphToString(){ + StringBuilder sb = new StringBuilder(); + for (Vertex vertex : graph){ + sb.append(vertex.originalToString()); + } + return sb.toString(); + } + + public void resetPrintHistory(){ + for (Vertex vertex : graph){ + Iterator<Map.Entry<Vertex,Edge>> it = vertex.getEdges().entrySet().iterator(); + while (it.hasNext()) { + Map.Entry<Vertex,Edge> pair = it.next(); + pair.getValue().setPrinted(false); + } + } + } + + public String minimumSpanningTreeToString(){ + StringBuilder sb = new StringBuilder(); + for (Vertex vertex : graph){ + sb.append(vertex.includedToString()); + } + return sb.toString(); + } + +} diff --git a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/prim/Vertex.java b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/prim/Vertex.java new file mode 100644 index 0000000000..982d9331bc --- /dev/null +++ b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/prim/Vertex.java @@ -0,0 +1,106 @@ +package com.baeldung.algorithms.prim; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.apache.commons.math3.util.Pair; + +public class Vertex { + + private String label = null; + private Map<Vertex, Edge> edges = new HashMap<>(); + private boolean isVisited = false; + + public Vertex(String label){ + this.label = label; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public Map<Vertex, Edge> getEdges() { + return edges; + } + + public void addEdge(Vertex vertex, Edge edge){ + if (this.edges.containsKey(vertex)){ + if (edge.getWeight() < this.edges.get(vertex).getWeight()){ + this.edges.replace(vertex, edge); + } + } else { + this.edges.put(vertex, edge); + } + } + + public boolean isVisited() { + return isVisited; + } + + public void setVisited(boolean visited) { + isVisited = visited; + } + + public Pair<Vertex, Edge> nextMinimum(){ + Edge nextMinimum = new Edge(Integer.MAX_VALUE); + Vertex nextVertex = this; + Iterator<Map.Entry<Vertex,Edge>> it = edges.entrySet().iterator(); + while (it.hasNext()) { + Map.Entry<Vertex,Edge> pair = it.next(); + if (!pair.getKey().isVisited()){ + if (!pair.getValue().isIncluded()) { + if (pair.getValue().getWeight() < nextMinimum.getWeight()) { + nextMinimum = pair.getValue(); + nextVertex = pair.getKey(); + } + } + } + } + return new Pair<>(nextVertex, nextMinimum); + } + + public String originalToString(){ + StringBuilder sb = new StringBuilder(); + Iterator<Map.Entry<Vertex,Edge>> it = edges.entrySet().iterator(); + while (it.hasNext()) { + Map.Entry<Vertex,Edge> pair = it.next(); + if (!pair.getValue().isPrinted()) { + sb.append(getLabel()); + sb.append(" --- "); + sb.append(pair.getValue().getWeight()); + sb.append(" --- "); + sb.append(pair.getKey().getLabel()); + sb.append("\n"); + pair.getValue().setPrinted(true); + } + } + return sb.toString(); + } + + public String includedToString(){ + StringBuilder sb = new StringBuilder(); + if (isVisited()) { + Iterator<Map.Entry<Vertex,Edge>> it = edges.entrySet().iterator(); + while (it.hasNext()) { + Map.Entry<Vertex,Edge> pair = it.next(); + if (pair.getValue().isIncluded()) { + if (!pair.getValue().isPrinted()) { + sb.append(getLabel()); + sb.append(" --- "); + sb.append(pair.getValue().getWeight()); + sb.append(" --- "); + sb.append(pair.getKey().getLabel()); + sb.append("\n"); + pair.getValue().setPrinted(true); + } + } + } + } + return sb.toString(); + } +} diff --git a/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/combinatorics/CombinatoricsUnitTest.java b/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/combinatorics/CombinatoricsUnitTest.java new file mode 100644 index 0000000000..95ffdec239 --- /dev/null +++ b/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/combinatorics/CombinatoricsUnitTest.java @@ -0,0 +1,80 @@ +package com.baeldung.algorithms.combinatorics; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; + +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertSame; + +public class CombinatoricsUnitTest { + + @Test + public void givenEmptySequence_whenCallingPermutations_ShouldReturnEmptyList() { + List<Integer> sequence = Arrays.asList(); + + List<List<Integer>> permutations = Combinatorics.permutations(sequence); + + assertEquals(0, permutations.size()); + } + + @Test + public void givenOneElementSequence_whenCallingPermutations_ShouldReturnPermutations() { + List<Integer> sequence = Arrays.asList(1); + + List<List<Integer>> permutations = Combinatorics.permutations(sequence); + + assertEquals(1, permutations.size()); + assertEquals(1, permutations.get(0).size()); + assertSame(1, permutations.get(0).get(0)); + } + + @Test + public void givenFourElementsSequence_whenCallingPermutations_ShouldReturnPermutations() { + List<Integer> sequence = Arrays.asList(1, 2, 3, 4); + + List<List<Integer>> permutations = Combinatorics.permutations(sequence); + + assertEquals(24, permutations.size()); + assertEquals(24, new HashSet<>(permutations).size()); + } + + @Test + public void givenTwoElements_whenCalling3Combinations_ShouldReturnEmptyList() { + List<Integer> set = Arrays.asList(1, 2); + + List<List<Integer>> combinations = Combinatorics.combinations(set, 3); + + assertEquals(0, combinations.size()); + } + + @Test + public void givenThreeElements_whenCalling3Combinations_ShouldReturnOneCombination() { + List<Integer> set = Arrays.asList(1, 2, 3); + + List<List<Integer>> combinations = Combinatorics.combinations(set, 3); + + assertEquals(1, combinations.size()); + assertEquals(combinations.get(0), Arrays.asList(1, 2, 3)); + } + + @Test + public void givenFourElements_whenCalling2Combinations_ShouldReturnCombinations() { + List<Integer> set = Arrays.asList(1, 2, 3, 4); + + List<List<Integer>> combinations = Combinatorics.combinations(set, 2); + + assertEquals(6, combinations.size()); + assertEquals(6, new HashSet<>(combinations).size()); + } + + @Test + public void givenFourElements_whenCallingPowerSet_ShouldReturn15Sets() { + List<Character> sequence = Arrays.asList('a', 'b', 'c', 'd'); + + List<List<Character>> combinations = Combinatorics.powerSet(sequence); + + assertEquals(16, combinations.size()); + } +} diff --git a/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/maximumsubarray/BruteForceAlgorithmUnitTest.java b/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/maximumsubarray/BruteForceAlgorithmUnitTest.java new file mode 100644 index 0000000000..b818046b2a --- /dev/null +++ b/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/maximumsubarray/BruteForceAlgorithmUnitTest.java @@ -0,0 +1,19 @@ +package com.baeldung.algorithms.maximumsubarray; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +class BruteForceAlgorithmUnitTest { + + @Test + void givenArrayWithNegativeNumberWhenMaximumSubarrayThenReturns6() { + //given + int[] arr = new int[]{-3, 1, -8, 4, -1, 2, 1, -5, 5}; + //when + BruteForceAlgorithm algorithm = new BruteForceAlgorithm(); + int maximumSum = algorithm.maxSubArray(arr); + //then + assertEquals(6, maximumSum); + } +} \ No newline at end of file diff --git a/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/maximumsubarray/KadaneAlgorithmUnitTest.java b/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/maximumsubarray/KadaneAlgorithmUnitTest.java new file mode 100644 index 0000000000..9bece56f5b --- /dev/null +++ b/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/maximumsubarray/KadaneAlgorithmUnitTest.java @@ -0,0 +1,19 @@ +package com.baeldung.algorithms.maximumsubarray; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +class KadaneAlgorithmUnitTest { + + @Test + void givenArrayWithNegativeNumberWhenMaximumSubarrayThenReturns6() { + //given + int[] arr = new int[]{-3, 1, -8, 4, -1, 2, 1, -5, 5}; + //when + KadaneAlgorithm algorithm = new KadaneAlgorithm(); + int maxSum = algorithm.maxSubArraySum(arr); + //then + assertEquals(6, maxSum); + } +} \ No newline at end of file diff --git a/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/mergesortedarrays/SortedArraysUnitTest.java b/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/mergesortedarrays/SortedArraysUnitTest.java new file mode 100644 index 0000000000..76eeb7b116 --- /dev/null +++ b/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/mergesortedarrays/SortedArraysUnitTest.java @@ -0,0 +1,29 @@ +package com.baeldung.algorithms.mergesortedarrays; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import org.junit.jupiter.api.Test; + +import com.baeldung.algorithms.mergesortedarrays.SortedArrays; + +public class SortedArraysUnitTest { + + @Test + public void givenTwoSortedArrays_whenMerged_thenReturnMergedSortedArray() { + + int[] foo = { 3, 7 }; + int[] bar = { 4, 8, 11 }; + int[] merged = { 3, 4, 7, 8, 11 }; + + assertArrayEquals(merged, SortedArrays.merge(foo, bar)); + } + + @Test + public void givenTwoSortedArraysWithDuplicates_whenMerged_thenReturnMergedSortedArray() { + + int[] foo = { 3, 3, 7 }; + int[] bar = { 4, 8, 8, 11 }; + int[] merged = { 3, 3, 4, 7, 8, 8, 11 }; + + assertArrayEquals(merged, SortedArrays.merge(foo, bar)); + } +} diff --git a/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/prim/PrimUnitTest.java b/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/prim/PrimUnitTest.java new file mode 100644 index 0000000000..41e53fc9f2 --- /dev/null +++ b/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/prim/PrimUnitTest.java @@ -0,0 +1,54 @@ +package com.baeldung.algorithms.prim; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +public class PrimUnitTest { + + @Test + public void givenAGraph_whenPrimRuns_thenPrintMST() { + Prim prim = new Prim(createGraph()); + System.out.println(prim.originalGraphToString()); + System.out.println("----------------"); + prim.run(); + System.out.println(); + prim.resetPrintHistory(); + System.out.println(prim.minimumSpanningTreeToString()); + } + + public static List<Vertex> createGraph() { + List<Vertex> graph = new ArrayList<>(); + Vertex a = new Vertex("A"); + Vertex b = new Vertex("B"); + Vertex c = new Vertex("C"); + Vertex d = new Vertex("D"); + Vertex e = new Vertex("E"); + Edge ab = new Edge(2); + a.addEdge(b, ab); + b.addEdge(a, ab); + Edge ac = new Edge(3); + a.addEdge(c, ac); + c.addEdge(a, ac); + Edge bc = new Edge(2); + b.addEdge(c, bc); + c.addEdge(b, bc); + Edge be = new Edge(5); + b.addEdge(e, be); + e.addEdge(b, be); + Edge cd = new Edge(1); + c.addEdge(d, cd); + d.addEdge(c, cd); + Edge ce = new Edge(1); + c.addEdge(e, ce); + e.addEdge(c, ce); + graph.add(a); + graph.add(b); + graph.add(c); + graph.add(d); + graph.add(e); + return graph; + } + +} diff --git a/algorithms-searching/README.md b/algorithms-searching/README.md new file mode 100644 index 0000000000..d86c3e3de8 --- /dev/null +++ b/algorithms-searching/README.md @@ -0,0 +1,11 @@ +## Algorithms - Searching + +This module contains articles about searching algorithms. + +### Relevant articles: +- [Binary Search Algorithm in Java](https://www.baeldung.com/java-binary-search) +- [Depth First Search in Java](https://www.baeldung.com/java-depth-first-search) +- [Interpolation Search in Java](https://www.baeldung.com/java-interpolation-search) +- [Breadth-First Search Algorithm in Java](https://www.baeldung.com/java-breadth-first-search) +- [String Search Algorithms for Large Texts](https://www.baeldung.com/java-full-text-search-algorithms) +- [Monte Carlo Tree Search for Tic-Tac-Toe Game](https://www.baeldung.com/java-monte-carlo-tree-search) diff --git a/algorithms-searching/pom.xml b/algorithms-searching/pom.xml new file mode 100644 index 0000000000..da32874a18 --- /dev/null +++ b/algorithms-searching/pom.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>algorithms-searching</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>algorithms-searching</name> + + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> + + <dependencies> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <version>${org.assertj.core.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <finalName>algorithms-searching</finalName> + <resources> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + </resource> + </resources> + </build> + + <properties> + <org.assertj.core.version>3.9.0</org.assertj.core.version> + </properties> + +</project> \ No newline at end of file diff --git a/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/binarysearch/BinarySearch.java b/algorithms-searching/src/main/java/com/baeldung/algorithms/binarysearch/BinarySearch.java similarity index 96% rename from algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/binarysearch/BinarySearch.java rename to algorithms-searching/src/main/java/com/baeldung/algorithms/binarysearch/BinarySearch.java index 5b2ac49d4e..82aefe282b 100644 --- a/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/binarysearch/BinarySearch.java +++ b/algorithms-searching/src/main/java/com/baeldung/algorithms/binarysearch/BinarySearch.java @@ -1,55 +1,55 @@ -package com.baeldung.algorithms.binarysearch; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -public class BinarySearch { - - public int runBinarySearchIteratively(int[] sortedArray, int key, int low, int high) { - - int index = Integer.MAX_VALUE; - - while (low <= high) { - - int mid = (low + high) / 2; - - if (sortedArray[mid] < key) { - low = mid + 1; - } else if (sortedArray[mid] > key) { - high = mid - 1; - } else if (sortedArray[mid] == key) { - index = mid; - break; - } - } - return index; - } - - public int runBinarySearchRecursively(int[] sortedArray, int key, int low, int high) { - - int middle = (low + high) / 2; - if (high < low) { - return -1; - } - - if (key == sortedArray[middle]) { - return middle; - } else if (key < sortedArray[middle]) { - return runBinarySearchRecursively(sortedArray, key, low, middle - 1); - } else { - return runBinarySearchRecursively(sortedArray, key, middle + 1, high); - } - } - - public int runBinarySearchUsingJavaArrays(int[] sortedArray, Integer key) { - int index = Arrays.binarySearch(sortedArray, key); - return index; - } - - public int runBinarySearchUsingJavaCollections(List<Integer> sortedList, Integer key) { - int index = Collections.binarySearch(sortedList, key); - return index; - } - -} +package com.baeldung.algorithms.binarysearch; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public class BinarySearch { + + public int runBinarySearchIteratively(int[] sortedArray, int key, int low, int high) { + + int index = Integer.MAX_VALUE; + + while (low <= high) { + + int mid = (low + high) / 2; + + if (sortedArray[mid] < key) { + low = mid + 1; + } else if (sortedArray[mid] > key) { + high = mid - 1; + } else if (sortedArray[mid] == key) { + index = mid; + break; + } + } + return index; + } + + public int runBinarySearchRecursively(int[] sortedArray, int key, int low, int high) { + + int middle = (low + high) / 2; + if (high < low) { + return -1; + } + + if (key == sortedArray[middle]) { + return middle; + } else if (key < sortedArray[middle]) { + return runBinarySearchRecursively(sortedArray, key, low, middle - 1); + } else { + return runBinarySearchRecursively(sortedArray, key, middle + 1, high); + } + } + + public int runBinarySearchUsingJavaArrays(int[] sortedArray, Integer key) { + int index = Arrays.binarySearch(sortedArray, key); + return index; + } + + public int runBinarySearchUsingJavaCollections(List<Integer> sortedList, Integer key) { + int index = Collections.binarySearch(sortedList, key); + return index; + } + +} diff --git a/algorithms-miscellaneous-3/src/main/java/com/baeldung/algorithms/breadthfirstsearch/BreadthFirstSearchAlgorithm.java b/algorithms-searching/src/main/java/com/baeldung/algorithms/breadthfirstsearch/BreadthFirstSearchAlgorithm.java similarity index 100% rename from algorithms-miscellaneous-3/src/main/java/com/baeldung/algorithms/breadthfirstsearch/BreadthFirstSearchAlgorithm.java rename to algorithms-searching/src/main/java/com/baeldung/algorithms/breadthfirstsearch/BreadthFirstSearchAlgorithm.java diff --git a/algorithms-miscellaneous-3/src/main/java/com/baeldung/algorithms/breadthfirstsearch/Node.java b/algorithms-searching/src/main/java/com/baeldung/algorithms/breadthfirstsearch/Node.java similarity index 100% rename from algorithms-miscellaneous-3/src/main/java/com/baeldung/algorithms/breadthfirstsearch/Node.java rename to algorithms-searching/src/main/java/com/baeldung/algorithms/breadthfirstsearch/Node.java diff --git a/algorithms-miscellaneous-3/src/main/java/com/baeldung/algorithms/breadthfirstsearch/Tree.java b/algorithms-searching/src/main/java/com/baeldung/algorithms/breadthfirstsearch/Tree.java similarity index 100% rename from algorithms-miscellaneous-3/src/main/java/com/baeldung/algorithms/breadthfirstsearch/Tree.java rename to algorithms-searching/src/main/java/com/baeldung/algorithms/breadthfirstsearch/Tree.java diff --git a/algorithms-searching/src/main/java/com/baeldung/algorithms/dfs/BinaryTree.java b/algorithms-searching/src/main/java/com/baeldung/algorithms/dfs/BinaryTree.java new file mode 100644 index 0000000000..a6019ea9f9 --- /dev/null +++ b/algorithms-searching/src/main/java/com/baeldung/algorithms/dfs/BinaryTree.java @@ -0,0 +1,227 @@ +package com.baeldung.algorithms.dfs; + +import java.util.LinkedList; +import java.util.Queue; +import java.util.Stack; + +public class BinaryTree { + + Node root; + + public void add(int value) { + root = addRecursive(root, value); + } + + private Node addRecursive(Node current, int value) { + + if (current == null) { + return new Node(value); + } + + if (value < current.value) { + current.left = addRecursive(current.left, value); + } else if (value > current.value) { + current.right = addRecursive(current.right, value); + } + + return current; + } + + public boolean isEmpty() { + return root == null; + } + + public int getSize() { + return getSizeRecursive(root); + } + + private int getSizeRecursive(Node current) { + return current == null ? 0 : getSizeRecursive(current.left) + 1 + getSizeRecursive(current.right); + } + + public boolean containsNode(int value) { + return containsNodeRecursive(root, value); + } + + private boolean containsNodeRecursive(Node current, int value) { + if (current == null) { + return false; + } + + if (value == current.value) { + return true; + } + + return value < current.value + ? containsNodeRecursive(current.left, value) + : containsNodeRecursive(current.right, value); + } + + public void delete(int value) { + root = deleteRecursive(root, value); + } + + private Node deleteRecursive(Node current, int value) { + if (current == null) { + return null; + } + + if (value == current.value) { + // Case 1: no children + if (current.left == null && current.right == null) { + return null; + } + + // Case 2: only 1 child + if (current.right == null) { + return current.left; + } + + if (current.left == null) { + return current.right; + } + + // Case 3: 2 children + int smallestValue = findSmallestValue(current.right); + current.value = smallestValue; + current.right = deleteRecursive(current.right, smallestValue); + return current; + } + if (value < current.value) { + current.left = deleteRecursive(current.left, value); + return current; + } + + current.right = deleteRecursive(current.right, value); + return current; + } + + private int findSmallestValue(Node root) { + return root.left == null ? root.value : findSmallestValue(root.left); + } + + public void traverseInOrder(Node node) { + if (node != null) { + traverseInOrder(node.left); + visit(node.value); + traverseInOrder(node.right); + } + } + + public void traversePreOrder(Node node) { + if (node != null) { + visit(node.value); + traversePreOrder(node.left); + traversePreOrder(node.right); + } + } + + public void traversePostOrder(Node node) { + if (node != null) { + traversePostOrder(node.left); + traversePostOrder(node.right); + visit(node.value); + } + } + + public void traverseLevelOrder() { + if (root == null) { + return; + } + + Queue<Node> nodes = new LinkedList<>(); + nodes.add(root); + + while (!nodes.isEmpty()) { + + Node node = nodes.remove(); + + System.out.print(" " + node.value); + + if (node.left != null) { + nodes.add(node.left); + } + + if (node.left != null) { + nodes.add(node.right); + } + } + } + + + public void traverseInOrderWithoutRecursion() { + Stack<Node> stack = new Stack<Node>(); + Node current = root; + stack.push(root); + while(! stack.isEmpty()) { + while(current.left != null) { + current = current.left; + stack.push(current); + } + current = stack.pop(); + visit(current.value); + if(current.right != null) { + current = current.right; + stack.push(current); + } + } + } + + public void traversePreOrderWithoutRecursion() { + Stack<Node> stack = new Stack<Node>(); + Node current = root; + stack.push(root); + while(! stack.isEmpty()) { + current = stack.pop(); + visit(current.value); + + if(current.right != null) + stack.push(current.right); + + if(current.left != null) + stack.push(current.left); + } + } + + public void traversePostOrderWithoutRecursion() { + Stack<Node> stack = new Stack<Node>(); + Node prev = root; + Node current = root; + stack.push(root); + + while (!stack.isEmpty()) { + current = stack.peek(); + boolean hasChild = (current.left != null || current.right != null); + boolean isPrevLastChild = (prev == current.right || (prev == current.left && current.right == null)); + + if (!hasChild || isPrevLastChild) { + current = stack.pop(); + visit(current.value); + prev = current; + } else { + if (current.right != null) { + stack.push(current.right); + } + if (current.left != null) { + stack.push(current.left); + } + } + } + } + + private void visit(int value) { + System.out.print(" " + value); + } + + class Node { + int value; + Node left; + Node right; + + Node(int value) { + this.value = value; + right = null; + left = null; + } + } +} diff --git a/data-structures/src/main/java/com/baeldung/graph/Graph.java b/algorithms-searching/src/main/java/com/baeldung/algorithms/dfs/Graph.java similarity index 98% rename from data-structures/src/main/java/com/baeldung/graph/Graph.java rename to algorithms-searching/src/main/java/com/baeldung/algorithms/dfs/Graph.java index 40df2c713a..d2cc723cf9 100644 --- a/data-structures/src/main/java/com/baeldung/graph/Graph.java +++ b/algorithms-searching/src/main/java/com/baeldung/algorithms/dfs/Graph.java @@ -1,4 +1,4 @@ -package com.baeldung.graph; +package com.baeldung.algorithms.dfs; import java.util.ArrayList; import java.util.HashMap; diff --git a/algorithms-miscellaneous-3/src/main/java/com/baeldung/algorithms/interpolationsearch/InterpolationSearch.java b/algorithms-searching/src/main/java/com/baeldung/algorithms/interpolationsearch/InterpolationSearch.java similarity index 100% rename from algorithms-miscellaneous-3/src/main/java/com/baeldung/algorithms/interpolationsearch/InterpolationSearch.java rename to algorithms-searching/src/main/java/com/baeldung/algorithms/interpolationsearch/InterpolationSearch.java diff --git a/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/montecarlo/MonteCarloTreeSearch.java b/algorithms-searching/src/main/java/com/baeldung/algorithms/mcts/montecarlo/MonteCarloTreeSearch.java similarity index 100% rename from algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/montecarlo/MonteCarloTreeSearch.java rename to algorithms-searching/src/main/java/com/baeldung/algorithms/mcts/montecarlo/MonteCarloTreeSearch.java diff --git a/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/montecarlo/State.java b/algorithms-searching/src/main/java/com/baeldung/algorithms/mcts/montecarlo/State.java similarity index 100% rename from algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/montecarlo/State.java rename to algorithms-searching/src/main/java/com/baeldung/algorithms/mcts/montecarlo/State.java diff --git a/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/montecarlo/UCT.java b/algorithms-searching/src/main/java/com/baeldung/algorithms/mcts/montecarlo/UCT.java similarity index 100% rename from algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/montecarlo/UCT.java rename to algorithms-searching/src/main/java/com/baeldung/algorithms/mcts/montecarlo/UCT.java diff --git a/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/tictactoe/Board.java b/algorithms-searching/src/main/java/com/baeldung/algorithms/mcts/tictactoe/Board.java similarity index 100% rename from algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/tictactoe/Board.java rename to algorithms-searching/src/main/java/com/baeldung/algorithms/mcts/tictactoe/Board.java diff --git a/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/tictactoe/Position.java b/algorithms-searching/src/main/java/com/baeldung/algorithms/mcts/tictactoe/Position.java similarity index 100% rename from algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/tictactoe/Position.java rename to algorithms-searching/src/main/java/com/baeldung/algorithms/mcts/tictactoe/Position.java diff --git a/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/tree/Node.java b/algorithms-searching/src/main/java/com/baeldung/algorithms/mcts/tree/Node.java similarity index 100% rename from algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/tree/Node.java rename to algorithms-searching/src/main/java/com/baeldung/algorithms/mcts/tree/Node.java diff --git a/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/tree/Tree.java b/algorithms-searching/src/main/java/com/baeldung/algorithms/mcts/tree/Tree.java similarity index 100% rename from algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/tree/Tree.java rename to algorithms-searching/src/main/java/com/baeldung/algorithms/mcts/tree/Tree.java diff --git a/algorithms-miscellaneous-4/src/main/java/com/baeldung/algorithms/string/search/StringSearchAlgorithms.java b/algorithms-searching/src/main/java/com/baeldung/algorithms/textsearch/TextSearchAlgorithms.java old mode 100755 new mode 100644 similarity index 94% rename from algorithms-miscellaneous-4/src/main/java/com/baeldung/algorithms/string/search/StringSearchAlgorithms.java rename to algorithms-searching/src/main/java/com/baeldung/algorithms/textsearch/TextSearchAlgorithms.java index 45ac53e039..16b45ed886 --- a/algorithms-miscellaneous-4/src/main/java/com/baeldung/algorithms/string/search/StringSearchAlgorithms.java +++ b/algorithms-searching/src/main/java/com/baeldung/algorithms/textsearch/TextSearchAlgorithms.java @@ -1,194 +1,194 @@ -package com.baeldung.algorithms.string.search; - -import java.math.BigInteger; -import java.util.Random; - -public class StringSearchAlgorithms { - public static long getBiggerPrime(int m) { - BigInteger prime = BigInteger.probablePrime(getNumberOfBits(m) + 1, new Random()); - return prime.longValue(); - } - - public static long getLowerPrime(long number) { - BigInteger prime = BigInteger.probablePrime(getNumberOfBits(number) - 1, new Random()); - return prime.longValue(); - } - - private static int getNumberOfBits(final int number) { - return Integer.SIZE - Integer.numberOfLeadingZeros(number); - } - - private static int getNumberOfBits(final long number) { - return Long.SIZE - Long.numberOfLeadingZeros(number); - } - - public static int simpleTextSearch(char[] pattern, char[] text) { - int patternSize = pattern.length; - int textSize = text.length; - - int i = 0; - - while ((i + patternSize) <= textSize) { - int j = 0; - while (text[i + j] == pattern[j]) { - j += 1; - if (j >= patternSize) - return i; - } - i += 1; - } - - return -1; - } - - public static int RabinKarpMethod(char[] pattern, char[] text) { - int patternSize = pattern.length; // m - int textSize = text.length; // n - - long prime = getBiggerPrime(patternSize); - - long r = 1; - for (int i = 0; i < patternSize - 1; i++) { - r *= 2; - r = r % prime; - } - - long[] t = new long[textSize]; - t[0] = 0; - - long pfinger = 0; - - for (int j = 0; j < patternSize; j++) { - t[0] = (2 * t[0] + text[j]) % prime; - pfinger = (2 * pfinger + pattern[j]) % prime; - } - - int i = 0; - boolean passed = false; - - int diff = textSize - patternSize; - for (i = 0; i <= diff; i++) { - if (t[i] == pfinger) { - passed = true; - for (int k = 0; k < patternSize; k++) { - if (text[i + k] != pattern[k]) { - passed = false; - break; - } - } - - if (passed) { - return i; - } - } - - if (i < diff) { - long value = 2 * (t[i] - r * text[i]) + text[i + patternSize]; - t[i + 1] = ((value % prime) + prime) % prime; - } - } - return -1; - - } - - public static int KnuthMorrisPrattSearch(char[] pattern, char[] text) { - int patternSize = pattern.length; // m - int textSize = text.length; // n - - int i = 0, j = 0; - - int[] shift = KnuthMorrisPrattShift(pattern); - - while ((i + patternSize) <= textSize) { - while (text[i + j] == pattern[j]) { - j += 1; - if (j >= patternSize) - return i; - } - - if (j > 0) { - i += shift[j - 1]; - j = Math.max(j - shift[j - 1], 0); - } else { - i++; - j = 0; - } - } - return -1; - } - - public static int[] KnuthMorrisPrattShift(char[] pattern) { - int patternSize = pattern.length; - - int[] shift = new int[patternSize]; - shift[0] = 1; - - int i = 1, j = 0; - - while ((i + j) < patternSize) { - if (pattern[i + j] == pattern[j]) { - shift[i + j] = i; - j++; - } else { - if (j == 0) - shift[i] = i + 1; - - if (j > 0) { - i = i + shift[j - 1]; - j = Math.max(j - shift[j - 1], 0); - } else { - i = i + 1; - j = 0; - } - } - } - return shift; - } - - public static int BoyerMooreHorspoolSimpleSearch(char[] pattern, char[] text) { - int patternSize = pattern.length; - int textSize = text.length; - - int i = 0, j = 0; - - while ((i + patternSize) <= textSize) { - j = patternSize - 1; - while (text[i + j] == pattern[j]) { - j--; - if (j < 0) - return i; - } - i++; - } - return -1; - } - - public static int BoyerMooreHorspoolSearch(char[] pattern, char[] text) { - - int shift[] = new int[256]; - - for (int k = 0; k < 256; k++) { - shift[k] = pattern.length; - } - - for (int k = 0; k < pattern.length - 1; k++) { - shift[pattern[k]] = pattern.length - 1 - k; - } - - int i = 0, j = 0; - - while ((i + pattern.length) <= text.length) { - j = pattern.length - 1; - - while (text[i + j] == pattern[j]) { - j -= 1; - if (j < 0) - return i; - } - - i = i + shift[text[i + pattern.length - 1]]; - - } - return -1; - } -} +package com.baeldung.algorithms.textsearch; + +import java.math.BigInteger; +import java.util.Random; + +public class TextSearchAlgorithms { + public static long getBiggerPrime(int m) { + BigInteger prime = BigInteger.probablePrime(getNumberOfBits(m) + 1, new Random()); + return prime.longValue(); + } + + public static long getLowerPrime(long number) { + BigInteger prime = BigInteger.probablePrime(getNumberOfBits(number) - 1, new Random()); + return prime.longValue(); + } + + private static int getNumberOfBits(final int number) { + return Integer.SIZE - Integer.numberOfLeadingZeros(number); + } + + private static int getNumberOfBits(final long number) { + return Long.SIZE - Long.numberOfLeadingZeros(number); + } + + public static int simpleTextSearch(char[] pattern, char[] text) { + int patternSize = pattern.length; + int textSize = text.length; + + int i = 0; + + while ((i + patternSize) <= textSize) { + int j = 0; + while (text[i + j] == pattern[j]) { + j += 1; + if (j >= patternSize) + return i; + } + i += 1; + } + + return -1; + } + + public static int RabinKarpMethod(char[] pattern, char[] text) { + int patternSize = pattern.length; // m + int textSize = text.length; // n + + long prime = getBiggerPrime(patternSize); + + long r = 1; + for (int i = 0; i < patternSize - 1; i++) { + r *= 2; + r = r % prime; + } + + long[] t = new long[textSize]; + t[0] = 0; + + long pfinger = 0; + + for (int j = 0; j < patternSize; j++) { + t[0] = (2 * t[0] + text[j]) % prime; + pfinger = (2 * pfinger + pattern[j]) % prime; + } + + int i = 0; + boolean passed = false; + + int diff = textSize - patternSize; + for (i = 0; i <= diff; i++) { + if (t[i] == pfinger) { + passed = true; + for (int k = 0; k < patternSize; k++) { + if (text[i + k] != pattern[k]) { + passed = false; + break; + } + } + + if (passed) { + return i; + } + } + + if (i < diff) { + long value = 2 * (t[i] - r * text[i]) + text[i + patternSize]; + t[i + 1] = ((value % prime) + prime) % prime; + } + } + return -1; + + } + + public static int KnuthMorrisPrattSearch(char[] pattern, char[] text) { + int patternSize = pattern.length; // m + int textSize = text.length; // n + + int i = 0, j = 0; + + int[] shift = KnuthMorrisPrattShift(pattern); + + while ((i + patternSize) <= textSize) { + while (text[i + j] == pattern[j]) { + j += 1; + if (j >= patternSize) + return i; + } + + if (j > 0) { + i += shift[j - 1]; + j = Math.max(j - shift[j - 1], 0); + } else { + i++; + j = 0; + } + } + return -1; + } + + public static int[] KnuthMorrisPrattShift(char[] pattern) { + int patternSize = pattern.length; + + int[] shift = new int[patternSize]; + shift[0] = 1; + + int i = 1, j = 0; + + while ((i + j) < patternSize) { + if (pattern[i + j] == pattern[j]) { + shift[i + j] = i; + j++; + } else { + if (j == 0) + shift[i] = i + 1; + + if (j > 0) { + i = i + shift[j - 1]; + j = Math.max(j - shift[j - 1], 0); + } else { + i = i + 1; + j = 0; + } + } + } + return shift; + } + + public static int BoyerMooreHorspoolSimpleSearch(char[] pattern, char[] text) { + int patternSize = pattern.length; + int textSize = text.length; + + int i = 0, j = 0; + + while ((i + patternSize) <= textSize) { + j = patternSize - 1; + while (text[i + j] == pattern[j]) { + j--; + if (j < 0) + return i; + } + i++; + } + return -1; + } + + public static int BoyerMooreHorspoolSearch(char[] pattern, char[] text) { + + int shift[] = new int[256]; + + for (int k = 0; k < 256; k++) { + shift[k] = pattern.length; + } + + for (int k = 0; k < pattern.length - 1; k++) { + shift[pattern[k]] = pattern.length - 1 - k; + } + + int i = 0, j = 0; + + while ((i + pattern.length) <= text.length) { + j = pattern.length - 1; + + while (text[i + j] == pattern[j]) { + j -= 1; + if (j < 0) + return i; + } + + i = i + shift[text[i + pattern.length - 1]]; + + } + return -1; + } +} diff --git a/jackson-2/src/main/resources/logback.xml b/algorithms-searching/src/main/resources/logback.xml similarity index 100% rename from jackson-2/src/main/resources/logback.xml rename to algorithms-searching/src/main/resources/logback.xml diff --git a/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/binarysearch/BinarySearchUnitTest.java b/algorithms-searching/src/test/java/com/baeldung/algorithms/binarysearch/BinarySearchUnitTest.java similarity index 94% rename from algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/binarysearch/BinarySearchUnitTest.java rename to algorithms-searching/src/test/java/com/baeldung/algorithms/binarysearch/BinarySearchUnitTest.java index 826682d373..eb3fb4f718 100644 --- a/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/binarysearch/BinarySearchUnitTest.java +++ b/algorithms-searching/src/test/java/com/baeldung/algorithms/binarysearch/BinarySearchUnitTest.java @@ -1,43 +1,41 @@ -package com.baeldung.algorithms.binarysearch; - -import java.util.Arrays; -import java.util.List; - -import org.junit.Assert; -import org.junit.Test; -import com.baeldung.algorithms.binarysearch.BinarySearch; - -public class BinarySearchUnitTest { - - int[] sortedArray = { 0, 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 9 }; - int key = 6; - int expectedIndexForSearchKey = 7; - int low = 0; - int high = sortedArray.length - 1; - List<Integer> sortedList = Arrays.asList(0, 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 9); - - @Test - public void givenASortedArrayOfIntegers_whenBinarySearchRunIterativelyForANumber_thenGetIndexOfTheNumber() { - BinarySearch binSearch = new BinarySearch(); - Assert.assertEquals(expectedIndexForSearchKey, binSearch.runBinarySearchIteratively(sortedArray, key, low, high)); - } - - @Test - public void givenASortedArrayOfIntegers_whenBinarySearchRunRecursivelyForANumber_thenGetIndexOfTheNumber() { - BinarySearch binSearch = new BinarySearch(); - Assert.assertEquals(expectedIndexForSearchKey, binSearch.runBinarySearchRecursively(sortedArray, key, low, high)); - } - - @Test - public void givenASortedArrayOfIntegers_whenBinarySearchRunUsingArraysClassStaticMethodForANumber_thenGetIndexOfTheNumber() { - BinarySearch binSearch = new BinarySearch(); - Assert.assertEquals(expectedIndexForSearchKey, binSearch.runBinarySearchUsingJavaArrays(sortedArray, key)); - } - - @Test - public void givenASortedListOfIntegers_whenBinarySearchRunUsingCollectionsClassStaticMethodForANumber_thenGetIndexOfTheNumber() { - BinarySearch binSearch = new BinarySearch(); - Assert.assertEquals(expectedIndexForSearchKey, binSearch.runBinarySearchUsingJavaCollections(sortedList, key)); - } - -} +package com.baeldung.algorithms.binarysearch; + +import java.util.Arrays; +import java.util.List; +import org.junit.Assert; +import org.junit.Test; + +public class BinarySearchUnitTest { + + int[] sortedArray = { 0, 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 9 }; + int key = 6; + int expectedIndexForSearchKey = 7; + int low = 0; + int high = sortedArray.length - 1; + List<Integer> sortedList = Arrays.asList(0, 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 9); + + @Test + public void givenASortedArrayOfIntegers_whenBinarySearchRunIterativelyForANumber_thenGetIndexOfTheNumber() { + BinarySearch binSearch = new BinarySearch(); + Assert.assertEquals(expectedIndexForSearchKey, binSearch.runBinarySearchIteratively(sortedArray, key, low, high)); + } + + @Test + public void givenASortedArrayOfIntegers_whenBinarySearchRunRecursivelyForANumber_thenGetIndexOfTheNumber() { + BinarySearch binSearch = new BinarySearch(); + Assert.assertEquals(expectedIndexForSearchKey, binSearch.runBinarySearchRecursively(sortedArray, key, low, high)); + } + + @Test + public void givenASortedArrayOfIntegers_whenBinarySearchRunUsingArraysClassStaticMethodForANumber_thenGetIndexOfTheNumber() { + BinarySearch binSearch = new BinarySearch(); + Assert.assertEquals(expectedIndexForSearchKey, binSearch.runBinarySearchUsingJavaArrays(sortedArray, key)); + } + + @Test + public void givenASortedListOfIntegers_whenBinarySearchRunUsingCollectionsClassStaticMethodForANumber_thenGetIndexOfTheNumber() { + BinarySearch binSearch = new BinarySearch(); + Assert.assertEquals(expectedIndexForSearchKey, binSearch.runBinarySearchUsingJavaCollections(sortedList, key)); + } + +} diff --git a/algorithms-miscellaneous-3/src/test/java/com/baeldung/algorithms/breadthfirstsearch/BreadthFirstSearchAlgorithmUnitTest.java b/algorithms-searching/src/test/java/com/baeldung/algorithms/breadthfirstsearch/BreadthFirstSearchAlgorithmUnitTest.java similarity index 100% rename from algorithms-miscellaneous-3/src/test/java/com/baeldung/algorithms/breadthfirstsearch/BreadthFirstSearchAlgorithmUnitTest.java rename to algorithms-searching/src/test/java/com/baeldung/algorithms/breadthfirstsearch/BreadthFirstSearchAlgorithmUnitTest.java diff --git a/algorithms-searching/src/test/java/com/baeldung/algorithms/dfs/BinaryTreeUnitTest.java b/algorithms-searching/src/test/java/com/baeldung/algorithms/dfs/BinaryTreeUnitTest.java new file mode 100644 index 0000000000..076da14f81 --- /dev/null +++ b/algorithms-searching/src/test/java/com/baeldung/algorithms/dfs/BinaryTreeUnitTest.java @@ -0,0 +1,136 @@ +package com.baeldung.algorithms.dfs; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +public class BinaryTreeUnitTest { + + @Test + public void givenABinaryTree_WhenAddingElements_ThenTreeNotEmpty() { + + BinaryTree bt = createBinaryTree(); + + assertTrue(!bt.isEmpty()); + } + + @Test + public void givenABinaryTree_WhenAddingElements_ThenTreeContainsThoseElements() { + + BinaryTree bt = createBinaryTree(); + + assertTrue(bt.containsNode(6)); + assertTrue(bt.containsNode(4)); + + assertFalse(bt.containsNode(1)); + } + + @Test + public void givenABinaryTree_WhenAddingExistingElement_ThenElementIsNotAdded() { + + BinaryTree bt = createBinaryTree(); + + int initialSize = bt.getSize(); + + assertTrue(bt.containsNode(3)); + bt.add(3); + assertEquals(initialSize, bt.getSize()); + } + + @Test + public void givenABinaryTree_WhenLookingForNonExistingElement_ThenReturnsFalse() { + + BinaryTree bt = createBinaryTree(); + + assertFalse(bt.containsNode(99)); + } + + @Test + public void givenABinaryTree_WhenDeletingElements_ThenTreeDoesNotContainThoseElements() { + + BinaryTree bt = createBinaryTree(); + + assertTrue(bt.containsNode(9)); + bt.delete(9); + assertFalse(bt.containsNode(9)); + } + + @Test + public void givenABinaryTree_WhenDeletingNonExistingElement_ThenTreeDoesNotDelete() { + + BinaryTree bt = createBinaryTree(); + + int initialSize = bt.getSize(); + + assertFalse(bt.containsNode(99)); + bt.delete(99); + assertFalse(bt.containsNode(99)); + assertEquals(initialSize, bt.getSize()); + } + + @Test + public void it_deletes_the_root() { + int value = 12; + BinaryTree bt = new BinaryTree(); + bt.add(value); + + assertTrue(bt.containsNode(value)); + bt.delete(value); + assertFalse(bt.containsNode(value)); + } + + @Test + public void givenABinaryTree_WhenTraversingInOrder_ThenPrintValues() { + + BinaryTree bt = createBinaryTree(); + + bt.traverseInOrder(bt.root); + System.out.println(); + bt.traverseInOrderWithoutRecursion(); + } + + @Test + public void givenABinaryTree_WhenTraversingPreOrder_ThenPrintValues() { + + BinaryTree bt = createBinaryTree(); + + bt.traversePreOrder(bt.root); + System.out.println(); + bt.traversePreOrderWithoutRecursion(); + } + + @Test + public void givenABinaryTree_WhenTraversingPostOrder_ThenPrintValues() { + + BinaryTree bt = createBinaryTree(); + + bt.traversePostOrder(bt.root); + System.out.println(); + bt.traversePostOrderWithoutRecursion(); + } + + @Test + public void givenABinaryTree_WhenTraversingLevelOrder_ThenPrintValues() { + + BinaryTree bt = createBinaryTree(); + + bt.traverseLevelOrder(); + } + + private BinaryTree createBinaryTree() { + BinaryTree bt = new BinaryTree(); + + bt.add(6); + bt.add(4); + bt.add(8); + bt.add(3); + bt.add(5); + bt.add(7); + bt.add(9); + + return bt; + } + +} diff --git a/data-structures/src/test/java/com/baeldung/graph/GraphUnitTest.java b/algorithms-searching/src/test/java/com/baeldung/algorithms/dfs/GraphUnitTest.java similarity index 92% rename from data-structures/src/test/java/com/baeldung/graph/GraphUnitTest.java rename to algorithms-searching/src/test/java/com/baeldung/algorithms/dfs/GraphUnitTest.java index 09b92115d2..715bb55fcb 100644 --- a/data-structures/src/test/java/com/baeldung/graph/GraphUnitTest.java +++ b/algorithms-searching/src/test/java/com/baeldung/algorithms/dfs/GraphUnitTest.java @@ -1,7 +1,8 @@ -package com.baeldung.graph; +package com.baeldung.algorithms.dfs; import java.util.List; +import com.baeldung.algorithms.dfs.Graph; import org.junit.Test; public class GraphUnitTest { diff --git a/algorithms-miscellaneous-3/src/test/java/com/baeldung/algorithms/interpolationsearch/InterpolationSearchUnitTest.java b/algorithms-searching/src/test/java/com/baeldung/algorithms/interpolationsearch/InterpolationSearchUnitTest.java similarity index 100% rename from algorithms-miscellaneous-3/src/test/java/com/baeldung/algorithms/interpolationsearch/InterpolationSearchUnitTest.java rename to algorithms-searching/src/test/java/com/baeldung/algorithms/interpolationsearch/InterpolationSearchUnitTest.java index 8ad962055e..cabedcefad 100644 --- a/algorithms-miscellaneous-3/src/test/java/com/baeldung/algorithms/interpolationsearch/InterpolationSearchUnitTest.java +++ b/algorithms-searching/src/test/java/com/baeldung/algorithms/interpolationsearch/InterpolationSearchUnitTest.java @@ -1,10 +1,10 @@ package com.baeldung.algorithms.interpolationsearch; -import static org.junit.jupiter.api.Assertions.assertEquals; - import org.junit.Before; import org.junit.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class InterpolationSearchUnitTest { private int[] myData; diff --git a/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/mcts/MCTSUnitTest.java b/algorithms-searching/src/test/java/com/baeldung/algorithms/mcts/MCTSUnitTest.java similarity index 100% rename from algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/mcts/MCTSUnitTest.java rename to algorithms-searching/src/test/java/com/baeldung/algorithms/mcts/MCTSUnitTest.java diff --git a/algorithms-searching/src/test/java/com/baeldung/algorithms/textsearch/TextSearchAlgorithmsUnitTest.java b/algorithms-searching/src/test/java/com/baeldung/algorithms/textsearch/TextSearchAlgorithmsUnitTest.java new file mode 100644 index 0000000000..543ccb912f --- /dev/null +++ b/algorithms-searching/src/test/java/com/baeldung/algorithms/textsearch/TextSearchAlgorithmsUnitTest.java @@ -0,0 +1,23 @@ +package com.baeldung.algorithms.textsearch; + + +import org.junit.Assert; +import org.junit.Test; + +public class TextSearchAlgorithmsUnitTest { + + + @Test + public void testStringSearchAlgorithms() { + String text = "This is some nice text."; + String pattern = "some"; + + int realPosition = text.indexOf(pattern); + Assert.assertTrue(realPosition == TextSearchAlgorithms.simpleTextSearch(pattern.toCharArray(), text.toCharArray())); + Assert.assertTrue(realPosition == TextSearchAlgorithms.RabinKarpMethod(pattern.toCharArray(), text.toCharArray())); + Assert.assertTrue(realPosition == TextSearchAlgorithms.KnuthMorrisPrattSearch(pattern.toCharArray(), text.toCharArray())); + Assert.assertTrue(realPosition == TextSearchAlgorithms.BoyerMooreHorspoolSimpleSearch(pattern.toCharArray(), text.toCharArray())); + Assert.assertTrue(realPosition == TextSearchAlgorithms.BoyerMooreHorspoolSearch(pattern.toCharArray(), text.toCharArray())); + } + +} diff --git a/algorithms-sorting/pom.xml b/algorithms-sorting/pom.xml index 5bb19a8069..84856235d9 100644 --- a/algorithms-sorting/pom.xml +++ b/algorithms-sorting/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>algorithms-sorting</artifactId> <version>0.0.1-SNAPSHOT</version> diff --git a/animal-sniffer-mvn-plugin/pom.xml b/animal-sniffer-mvn-plugin/pom.xml index fd8f6d3d8c..d04581aaac 100644 --- a/animal-sniffer-mvn-plugin/pom.xml +++ b/animal-sniffer-mvn-plugin/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>animal-sniffer-mvn-plugin</artifactId> <version>1.0-SNAPSHOT</version> @@ -43,4 +44,5 @@ <animal-sniffer-maven-plugin.version>1.16</animal-sniffer-maven-plugin.version> <org.codehaus.mojo.signature.java16.version>1.0</org.codehaus.mojo.signature.java16.version> </properties> + </project> \ No newline at end of file diff --git a/annotations/annotation-processing/pom.xml b/annotations/annotation-processing/pom.xml index d9aca6040d..645bbd7a0f 100644 --- a/annotations/annotation-processing/pom.xml +++ b/annotations/annotation-processing/pom.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>annotation-processing</artifactId> <name>annotation-processing</name> - + <parent> <groupId>com.baeldung</groupId> <version>1.0.0-SNAPSHOT</version> diff --git a/annotations/annotation-user/pom.xml b/annotations/annotation-user/pom.xml index 422cc7f119..ae47e19f05 100644 --- a/annotations/annotation-user/pom.xml +++ b/annotations/annotation-user/pom.xml @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>annotation-user</artifactId> <name>annotation-user</name> <parent> - <artifactId>annotations</artifactId> <groupId>com.baeldung</groupId> + <artifactId>annotations</artifactId> <version>1.0.0-SNAPSHOT</version> <relativePath>../</relativePath> </parent> diff --git a/annotations/pom.xml b/annotations/pom.xml index 5fe89adf0a..41e1e8735b 100644 --- a/annotations/pom.xml +++ b/annotations/pom.xml @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>annotations</artifactId> <name>annotations</name> <packaging>pom</packaging> - + <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> diff --git a/antlr/pom.xml b/antlr/pom.xml index 91b939a882..641382d450 100644 --- a/antlr/pom.xml +++ b/antlr/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>antlr</artifactId> <name>antlr</name> @@ -52,9 +53,10 @@ </plugin> </plugins> </build> - + <properties> <antlr.version>4.7.1</antlr.version> <mojo.version>3.0.0</mojo.version> </properties> + </project> \ No newline at end of file diff --git a/apache-avro/pom.xml b/apache-avro/pom.xml index 6baae9c541..35898711c8 100644 --- a/apache-avro/pom.xml +++ b/apache-avro/pom.xml @@ -5,7 +5,7 @@ <modelVersion>4.0.0</modelVersion> <artifactId>apache-avro</artifactId> <version>0.0.1-SNAPSHOT</version> - <name>apache-avro</name> + <name>apache-avro</name> <parent> <groupId>com.baeldung</groupId> @@ -67,5 +67,5 @@ <avro.version>1.8.2</avro.version> <slf4j.version>1.7.25</slf4j.version> </properties> - + </project> diff --git a/apache-bval/pom.xml b/apache-bval/pom.xml index 786f587fb1..4254242e55 100644 --- a/apache-bval/pom.xml +++ b/apache-bval/pom.xml @@ -1,11 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>apache-bval</groupId> <artifactId>apache-bval</artifactId> <version>0.0.1-SNAPSHOT</version> <name>apache-bval</name> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> diff --git a/apache-curator/pom.xml b/apache-curator/pom.xml index 259319d547..ea8fb358ad 100644 --- a/apache-curator/pom.xml +++ b/apache-curator/pom.xml @@ -1,9 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>apache-curator</artifactId> <version>0.0.1-SNAPSHOT</version> - <name>apache-curator</name> + <name>apache-curator</name> <packaging>jar</packaging> <parent> diff --git a/apache-cxf/cxf-aegis/README.md b/apache-cxf/cxf-aegis/README.md new file mode 100644 index 0000000000..e055826554 --- /dev/null +++ b/apache-cxf/cxf-aegis/README.md @@ -0,0 +1,3 @@ +### Relevant Articles + +- [Introduction to Apache CXF Aegis Data Binding](https://www.baeldung.com/aegis-data-binding-in-apache-cxf) diff --git a/apache-cxf/cxf-aegis/pom.xml b/apache-cxf/cxf-aegis/pom.xml index 1d36178b82..6e6c5b093c 100644 --- a/apache-cxf/cxf-aegis/pom.xml +++ b/apache-cxf/cxf-aegis/pom.xml @@ -1,9 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>cxf-aegis</artifactId> - <name>cxf-aegis</name> - + <name>cxf-aegis</name> + <parent> <groupId>com.baeldung</groupId> <artifactId>apache-cxf</artifactId> diff --git a/apache-cxf/cxf-introduction/pom.xml b/apache-cxf/cxf-introduction/pom.xml index 17f03afd25..0572b01a9d 100644 --- a/apache-cxf/cxf-introduction/pom.xml +++ b/apache-cxf/cxf-introduction/pom.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> - <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>cxf-introduction</artifactId> - <name>cxf-introduction</name> - + <name>cxf-introduction</name> + <parent> <groupId>com.baeldung</groupId> <artifactId>apache-cxf</artifactId> diff --git a/apache-cxf/cxf-jaxrs-implementation/pom.xml b/apache-cxf/cxf-jaxrs-implementation/pom.xml index 03d0f67c90..37b81882bb 100644 --- a/apache-cxf/cxf-jaxrs-implementation/pom.xml +++ b/apache-cxf/cxf-jaxrs-implementation/pom.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> - <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>cxf-jaxrs-implementation</artifactId> - <name>cxf-jaxrs-implementation</name> - + <name>cxf-jaxrs-implementation</name> + <parent> <groupId>com.baeldung</groupId> <artifactId>apache-cxf</artifactId> diff --git a/apache-cxf/cxf-spring/README.md b/apache-cxf/cxf-spring/README.md new file mode 100644 index 0000000000..c4d55a5c94 --- /dev/null +++ b/apache-cxf/cxf-spring/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [A Guide to Apache CXF with Spring](https://www.baeldung.com/apache-cxf-with-spring) diff --git a/apache-cxf/cxf-spring/pom.xml b/apache-cxf/cxf-spring/pom.xml index 97715af54c..01ee7d9411 100644 --- a/apache-cxf/cxf-spring/pom.xml +++ b/apache-cxf/cxf-spring/pom.xml @@ -1,9 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>cxf-spring</artifactId> + <name>cxf-spring</name> <packaging>war</packaging> - <name>cxf-spring</name> <parent> <groupId>com.baeldung</groupId> @@ -98,7 +99,6 @@ </plugins> </build> </profile> - </profiles> <properties> diff --git a/apache-cxf/pom.xml b/apache-cxf/pom.xml index 0016f33d70..c993eff3a5 100644 --- a/apache-cxf/pom.xml +++ b/apache-cxf/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> diff --git a/apache-cxf/sse-jaxrs/pom.xml b/apache-cxf/sse-jaxrs/pom.xml index cb5c96660a..89bd5d4191 100644 --- a/apache-cxf/sse-jaxrs/pom.xml +++ b/apache-cxf/sse-jaxrs/pom.xml @@ -16,6 +16,6 @@ <modules> <module>sse-jaxrs-server</module> <module>sse-jaxrs-client</module> - </modules> + </modules> </project> diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-client/pom.xml b/apache-cxf/sse-jaxrs/sse-jaxrs-client/pom.xml index be2138e172..37a068003c 100644 --- a/apache-cxf/sse-jaxrs/sse-jaxrs-client/pom.xml +++ b/apache-cxf/sse-jaxrs/sse-jaxrs-client/pom.xml @@ -5,7 +5,7 @@ <modelVersion>4.0.0</modelVersion> <artifactId>sse-jaxrs-client</artifactId> <name>sse-jaxrs-client</name> - + <parent> <groupId>com.baeldung</groupId> <artifactId>sse-jaxrs</artifactId> diff --git a/apache-fop/pom.xml b/apache-fop/pom.xml index 150756d51d..41a6761eaf 100644 --- a/apache-fop/pom.xml +++ b/apache-fop/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>apache-fop</artifactId> <version>0.1-SNAPSHOT</version> diff --git a/apache-geode/pom.xml b/apache-geode/pom.xml index 195dfadd20..78c6390f80 100644 --- a/apache-geode/pom.xml +++ b/apache-geode/pom.xml @@ -6,7 +6,7 @@ <artifactId>apache-geode</artifactId> <version>1.0-SNAPSHOT</version> <name>apache-geode</name> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> @@ -20,8 +20,9 @@ <version>${geode.core}</version> </dependency> </dependencies> - + <properties> <geode.core>1.6.0</geode.core> </properties> + </project> \ No newline at end of file diff --git a/apache-meecrowave/pom.xml b/apache-meecrowave/pom.xml index 51c6514992..9e79780e22 100644 --- a/apache-meecrowave/pom.xml +++ b/apache-meecrowave/pom.xml @@ -1,11 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>apache-meecrowave</artifactId> <version>0.0.1</version> <name>apache-meecrowave</name> <description>A sample REST API application with Meecrowave</description> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> @@ -38,7 +39,7 @@ <scope>test</scope> </dependency> </dependencies> - + <build> <plugins> <plugin> @@ -48,14 +49,15 @@ </plugin> </plugins> </build> - + <properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> - <meecrowave-junit.version>1.2.0</meecrowave-junit.version> - <okhttp.version>3.10.0</okhttp.version> - <meecrowave-jpa.version>1.2.1</meecrowave-jpa.version> - <meecrowave-core.version>1.2.1</meecrowave-core.version> - <meecrowave-maven-plugin.version>1.2.1</meecrowave-maven-plugin.version> + <meecrowave-junit.version>1.2.0</meecrowave-junit.version> + <okhttp.version>3.10.0</okhttp.version> + <meecrowave-jpa.version>1.2.1</meecrowave-jpa.version> + <meecrowave-core.version>1.2.1</meecrowave-core.version> + <meecrowave-maven-plugin.version>1.2.1</meecrowave-maven-plugin.version> </properties> + </project> \ No newline at end of file diff --git a/apache-olingo/olingo2/README.md b/apache-olingo/olingo2/README.md new file mode 100644 index 0000000000..b1cb23d822 --- /dev/null +++ b/apache-olingo/olingo2/README.md @@ -0,0 +1,4 @@ +### Relevant Articles: + +- [OData Protocol Guide](https://www.baeldung.com/odata) +- [Intro to OData with Olingo](https://www.baeldung.com/olingo) diff --git a/apache-olingo/olingo2/pom.xml b/apache-olingo/olingo2/pom.xml index 95b123efbc..fdbc9b4390 100644 --- a/apache-olingo/olingo2/pom.xml +++ b/apache-olingo/olingo2/pom.xml @@ -1,87 +1,87 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>org.baeldung.examples.olingo2</groupId> - <artifactId>olingo2</artifactId> - <name>olingo2</name> - <description>Sample Olingo 2 Project</description> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.baeldung.examples.olingo2</groupId> + <artifactId>olingo2</artifactId> + <name>olingo2</name> + <description>Sample Olingo 2 Project</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-2</relativePath> </parent> - <dependencies> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-jersey</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-data-jpa</artifactId> - </dependency> - <dependency> - <groupId>com.h2database</groupId> - <artifactId>h2</artifactId> - <scope>runtime</scope> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-configuration-processor</artifactId> - <optional>true</optional> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-jersey</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-jpa</artifactId> + </dependency> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-configuration-processor</artifactId> + <optional>true</optional> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> - <!-- Olingo 2 Dependencies --> - <dependency> - <groupId>org.apache.olingo</groupId> - <artifactId>olingo-odata2-core</artifactId> - <version>${olingo2.version}</version> - <!-- Avoid jax-rs version conflict by excluding Olingo's version --> - <exclusions> - <exclusion> - <groupId>javax.ws.rs</groupId> - <artifactId>javax.ws.rs-api</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.olingo</groupId> - <artifactId>olingo-odata2-jpa-processor-core</artifactId> - <version>${olingo2.version}</version> - </dependency> - <dependency> - <groupId>org.apache.olingo</groupId> - <artifactId>olingo-odata2-jpa-processor-ref</artifactId> - <version>${olingo2.version}</version> - <exclusions> - <exclusion> - <groupId>org.eclipse.persistence</groupId> - <artifactId>eclipselink</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> + <!-- Olingo 2 Dependencies --> + <dependency> + <groupId>org.apache.olingo</groupId> + <artifactId>olingo-odata2-core</artifactId> + <version>${olingo2.version}</version> + <!-- Avoid jax-rs version conflict by excluding Olingo's version --> + <exclusions> + <exclusion> + <groupId>javax.ws.rs</groupId> + <artifactId>javax.ws.rs-api</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.olingo</groupId> + <artifactId>olingo-odata2-jpa-processor-core</artifactId> + <version>${olingo2.version}</version> + </dependency> + <dependency> + <groupId>org.apache.olingo</groupId> + <artifactId>olingo-odata2-jpa-processor-ref</artifactId> + <version>${olingo2.version}</version> + <exclusions> + <exclusion> + <groupId>org.eclipse.persistence</groupId> + <artifactId>eclipselink</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + </plugins> + </build> - <properties> - <olingo2.version>2.0.11</olingo2.version> - </properties> + <properties> + <olingo2.version>2.0.11</olingo2.version> + </properties> </project> diff --git a/apache-opennlp/pom.xml b/apache-opennlp/pom.xml index 6b2e6a9729..701d33c6fd 100644 --- a/apache-opennlp/pom.xml +++ b/apache-opennlp/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>apache-opennlp</artifactId> <version>1.0-SNAPSHOT</version> diff --git a/apache-poi/pom.xml b/apache-poi/pom.xml index 54c3e8e928..a114946c47 100644 --- a/apache-poi/pom.xml +++ b/apache-poi/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>apache-poi</artifactId> <version>0.0.1-SNAPSHOT</version> diff --git a/apache-pulsar/pom.xml b/apache-pulsar/pom.xml index fdd9ae1e95..206e1ab74d 100644 --- a/apache-pulsar/pom.xml +++ b/apache-pulsar/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.pulsar</groupId> <artifactId>apache-pulsar</artifactId> @@ -22,8 +22,9 @@ <scope>compile</scope> </dependency> </dependencies> - + <properties> - <pulsar-client.version>2.1.1-incubating</pulsar-client.version> + <pulsar-client.version>2.1.1-incubating</pulsar-client.version> </properties> + </project> diff --git a/apache-shiro/pom.xml b/apache-shiro/pom.xml index 7f0d07589c..0458ba783f 100644 --- a/apache-shiro/pom.xml +++ b/apache-shiro/pom.xml @@ -6,10 +6,10 @@ <artifactId>apache-shiro</artifactId> <version>1.0-SNAPSHOT</version> <name>apache-shiro</name> - + <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-1</relativePath> </parent> diff --git a/apache-solrj/pom.xml b/apache-solrj/pom.xml index b19ceb1e48..b25fd0fb04 100644 --- a/apache-solrj/pom.xml +++ b/apache-solrj/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>apache-solrj</artifactId> <version>0.0.1-SNAPSHOT</version> diff --git a/apache-spark/pom.xml b/apache-spark/pom.xml index 41fd51d9fd..59843adc71 100644 --- a/apache-spark/pom.xml +++ b/apache-spark/pom.xml @@ -1,90 +1,112 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <artifactId>apache-spark</artifactId> - <version>1.0-SNAPSHOT</version> - <name>apache-spark</name> - <packaging>jar</packaging> - <url>http://maven.apache.org</url> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>apache-spark</artifactId> + <version>1.0-SNAPSHOT</version> + <name>apache-spark</name> + <packaging>jar</packaging> + <url>http://maven.apache.org</url> - <parent> - <groupId>com.baeldung</groupId> - <artifactId>parent-modules</artifactId> - <version>1.0.0-SNAPSHOT</version> - </parent> + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> - <dependencies> - <dependency> - <groupId>org.apache.spark</groupId> - <artifactId>spark-core_2.11</artifactId> - <version>${org.apache.spark.spark-core.version}</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.apache.spark</groupId> - <artifactId>spark-sql_2.11</artifactId> - <version>${org.apache.spark.spark-sql.version}</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.apache.spark</groupId> - <artifactId>spark-streaming_2.11</artifactId> - <version>${org.apache.spark.spark-streaming.version}</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.apache.spark</groupId> - <artifactId>spark-mllib_2.11</artifactId> - <version>${org.apache.spark.spark-mllib.version}</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.apache.spark</groupId> - <artifactId>spark-streaming-kafka-0-10_2.11</artifactId> - <version>${org.apache.spark.spark-streaming-kafka.version}</version> - </dependency> - <dependency> - <groupId>com.datastax.spark</groupId> - <artifactId>spark-cassandra-connector_2.11</artifactId> - <version>${com.datastax.spark.spark-cassandra-connector.version}</version> - </dependency> - <dependency> - <groupId>com.datastax.spark</groupId> - <artifactId>spark-cassandra-connector-java_2.11</artifactId> - <version>${com.datastax.spark.spark-cassandra-connector-java.version}</version> - </dependency> - </dependencies> + <dependencies> + <dependency> + <groupId>org.apache.spark</groupId> + <artifactId>spark-core_2.11</artifactId> + <version>${org.apache.spark.spark-core.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.spark</groupId> + <artifactId>spark-sql_2.11</artifactId> + <version>${org.apache.spark.spark-sql.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.spark</groupId> + <artifactId>spark-graphx_2.11</artifactId> + <version>${org.apache.spark.spark-graphx.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>graphframes</groupId> + <artifactId>graphframes</artifactId> + <version>${graphframes.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.spark</groupId> + <artifactId>spark-streaming_2.11</artifactId> + <version>${org.apache.spark.spark-streaming.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.spark</groupId> + <artifactId>spark-mllib_2.11</artifactId> + <version>${org.apache.spark.spark-mllib.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.spark</groupId> + <artifactId>spark-streaming-kafka-0-10_2.11</artifactId> + <version>${org.apache.spark.spark-streaming-kafka.version}</version> + </dependency> + <dependency> + <groupId>com.datastax.spark</groupId> + <artifactId>spark-cassandra-connector_2.11</artifactId> + <version>${com.datastax.spark.spark-cassandra-connector.version}</version> + </dependency> + <dependency> + <groupId>com.datastax.spark</groupId> + <artifactId>spark-cassandra-connector-java_2.11</artifactId> + <version>${com.datastax.spark.spark-cassandra-connector-java.version}</version> + </dependency> + </dependencies> - <build> - <plugins> - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - </execution> - </executions> - <configuration> - <descriptorRefs> - <descriptorRef>jar-with-dependencies</descriptorRef> - </descriptorRefs> - </configuration> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + </execution> + </executions> + <configuration> + <descriptorRefs> + <descriptorRef>jar-with-dependencies</descriptorRef> + </descriptorRefs> + </configuration> + </plugin> + </plugins> + </build> - <properties> - <org.apache.spark.spark-core.version>2.3.0</org.apache.spark.spark-core.version> - <org.apache.spark.spark-sql.version>2.3.0</org.apache.spark.spark-sql.version> - <org.apache.spark.spark-streaming.version>2.3.0</org.apache.spark.spark-streaming.version> - <org.apache.spark.spark-mllib.version>2.3.0</org.apache.spark.spark-mllib.version> - <org.apache.spark.spark-streaming-kafka.version>2.3.0</org.apache.spark.spark-streaming-kafka.version> - <com.datastax.spark.spark-cassandra-connector.version>2.3.0</com.datastax.spark.spark-cassandra-connector.version> - <com.datastax.spark.spark-cassandra-connector-java.version>1.5.2</com.datastax.spark.spark-cassandra-connector-java.version> - </properties> + <repositories> + <repository> + <id>SparkPackagesRepo</id> + <url>http://dl.bintray.com/spark-packages/maven</url> + </repository> + </repositories> + + <properties> + <org.apache.spark.spark-core.version>2.3.0</org.apache.spark.spark-core.version> + <org.apache.spark.spark-sql.version>2.3.0</org.apache.spark.spark-sql.version> + <org.apache.spark.spark-streaming.version>2.3.0</org.apache.spark.spark-streaming.version> + <org.apache.spark.spark-mllib.version>2.3.0</org.apache.spark.spark-mllib.version> + <org.apache.spark.spark-graphx.version>2.3.0</org.apache.spark.spark-graphx.version> + <graphframes.version>0.7.0-spark2.4-s_2.11</graphframes.version> + <org.apache.spark.spark-streaming-kafka.version>2.3.0</org.apache.spark.spark-streaming-kafka.version> + <com.datastax.spark.spark-cassandra-connector.version>2.3.0</com.datastax.spark.spark-cassandra-connector.version> + <com.datastax.spark.spark-cassandra-connector-java.version>1.5.2</com.datastax.spark.spark-cassandra-connector-java.version> + </properties> </project> diff --git a/apache-spark/src/main/java/com/baeldung/graphframes/GraphExperiments.java b/apache-spark/src/main/java/com/baeldung/graphframes/GraphExperiments.java new file mode 100644 index 0000000000..30524a8c8b --- /dev/null +++ b/apache-spark/src/main/java/com/baeldung/graphframes/GraphExperiments.java @@ -0,0 +1,52 @@ +package com.baeldung.graphframes; + +import org.apache.log4j.Level; +import org.apache.log4j.Logger; +import org.apache.spark.api.java.function.VoidFunction; +import org.apache.spark.graphx.Edge; +import org.apache.spark.graphx.Graph; +import org.apache.spark.graphx.VertexRDD; +import org.graphframes.GraphFrame; +import scala.Tuple2; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +public class GraphExperiments { + public static Map<Long, User> USERS = new HashMap<>(); + + public static void main(String[] args) throws IOException { + Logger.getLogger("org").setLevel(Level.OFF); + GraphLoader loader = new GraphLoader(); + GraphFrame graph = loader.getGraphFrameUserRelationship(); + + GraphExperiments experiments = new GraphExperiments(); + experiments.doGraphFrameOperations(graph); + experiments.doGraphFrameAlgorithms(graph); + } + + private void doGraphFrameOperations(GraphFrame graph) { + graph.vertices().show(); + graph.edges().show(); + + graph.vertices().filter("name = 'Martin'").show(); + + graph.filterEdges("type = 'Friend'") + .dropIsolatedVertices().vertices().show(); + + graph.degrees().show(); + graph.inDegrees().show(); + graph.outDegrees().show(); + } + + private void doGraphFrameAlgorithms(GraphFrame graph) { + + graph.pageRank().maxIter(20).resetProbability(0.15).run().vertices().show(); + + graph.connectedComponents().run().show(); + + graph.triangleCount().run().show(); + } + +} diff --git a/apache-spark/src/main/java/com/baeldung/graphframes/GraphLoader.java b/apache-spark/src/main/java/com/baeldung/graphframes/GraphLoader.java new file mode 100644 index 0000000000..cad1fb4e26 --- /dev/null +++ b/apache-spark/src/main/java/com/baeldung/graphframes/GraphLoader.java @@ -0,0 +1,72 @@ +package com.baeldung.graphframes; + +import org.apache.spark.SparkConf; +import org.apache.spark.api.java.JavaSparkContext; +import org.apache.spark.sql.Dataset; +import org.apache.spark.sql.Row; +import org.apache.spark.sql.SparkSession; +import org.graphframes.GraphFrame; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; + +public class GraphLoader { + + public JavaSparkContext getSparkContext() throws IOException { + Path temp = Files.createTempDirectory("sparkGraphFrames"); + SparkConf sparkConf = new SparkConf().setAppName("SparkGraphX").setMaster("local[*]"); + JavaSparkContext javaSparkContext = new JavaSparkContext(sparkConf); + javaSparkContext.setCheckpointDir(temp.toString()); + return javaSparkContext; + } + + public GraphFrame getGraphFrameUserRelationship() throws IOException { + Path temp = Files.createTempDirectory("sparkGraphFrames"); + SparkSession session = SparkSession.builder() + .appName("SparkGraphFrameSample") + .config("spark.sql.warehouse.dir", temp.toString()) + .sparkContext(getSparkContext().sc()) + .master("local[*]") + .getOrCreate(); + List<User> users = loadUsers(); + + Dataset<Row> userDataset = session.createDataFrame(users, User.class); + + List<Relationship> relationshipsList = getRelations(); + Dataset<Row> relationshipDataset = session.createDataFrame(relationshipsList, Relationship.class); + + GraphFrame graphFrame = new GraphFrame(userDataset, relationshipDataset); + + return graphFrame; + } + + public List<Relationship> getRelations() { + List<Relationship> relationships = new ArrayList<>(); + relationships.add(new Relationship("Friend", "1", "2")); + relationships.add(new Relationship("Following", "1", "4")); + relationships.add(new Relationship("Friend", "2", "4")); + relationships.add(new Relationship("Relative", "3", "1")); + relationships.add(new Relationship("Relative", "3", "4")); + + return relationships; + } + + private List<User> loadUsers() { + User john = new User(1L, "John"); + User martin = new User(2L, "Martin"); + User peter = new User(3L, "Peter"); + User alicia = new User(4L, "Alicia"); + + List<User> users = new ArrayList<>(); + + users.add(new User(1L, "John")); + users.add(new User(2L, "Martin")); + users.add(new User(3L, "Peter")); + users.add(new User(4L, "Alicia")); + + return users; + } +} diff --git a/apache-spark/src/main/java/com/baeldung/graphframes/Relationship.java b/apache-spark/src/main/java/com/baeldung/graphframes/Relationship.java new file mode 100644 index 0000000000..ce1780ea3f --- /dev/null +++ b/apache-spark/src/main/java/com/baeldung/graphframes/Relationship.java @@ -0,0 +1,39 @@ +package com.baeldung.graphframes; + +import java.io.Serializable; +import java.util.UUID; + +public class Relationship implements Serializable { + private String type; + private String src; + private String dst; + private UUID id; + + public Relationship(String type, String src, String dst) { + this.type = type; + this.src = src; + this.dst = dst; + this.id = UUID.randomUUID(); + } + + public String getId() { + return id.toString(); + } + + public String getType() { + return type; + } + + public String getSrc() { + return src; + } + + public String getDst() { + return dst; + } + + @Override + public String toString() { + return getSrc() + " -- " + getType() + " --> " + getDst(); + } +} diff --git a/apache-spark/src/main/java/com/baeldung/graphframes/User.java b/apache-spark/src/main/java/com/baeldung/graphframes/User.java new file mode 100644 index 0000000000..50022a1da1 --- /dev/null +++ b/apache-spark/src/main/java/com/baeldung/graphframes/User.java @@ -0,0 +1,27 @@ +package com.baeldung.graphframes; + +import java.io.Serializable; + +public class User implements Serializable { + + private Long id; + private String name; + + public User(long id, String name) { + this.id = id; + this.name = name; + } + + public String getId() { + return id.toString(); + } + + public String getName() { + return name; + } + + @Override + public String toString() { + return "<" + id + "," + name + ">"; + } +} diff --git a/apache-tapestry/pom.xml b/apache-tapestry/pom.xml new file mode 100644 index 0000000000..e306b56b4a --- /dev/null +++ b/apache-tapestry/pom.xml @@ -0,0 +1,149 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"> + <modelVersion>4.0.0</modelVersion> + <groupId>com.baeldung</groupId> + <artifactId>apache-tapestry</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>apache-tapestry</name> + <packaging>war</packaging> + + <dependencies> + <!-- To set up an application with a database, change the artifactId below to + tapestry-hibernate, and add a dependency on your JDBC driver. You'll also + need to add Hibernate configuration files, such as hibernate.cfg.xml. --> + <dependency> + <groupId>org.apache.tapestry</groupId> + <artifactId>tapestry-core</artifactId> + <version>${tapestry-release-version}</version> + </dependency> + + <!-- Include the Log4j implementation for the SLF4J logging framework --> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>${slf4j-release-version}</version> + </dependency> + + <dependency> + <groupId>org.apache.tapestry</groupId> + <artifactId>tapestry-webresources</artifactId> + <version>${tapestry-release-version}</version> + </dependency> + + <!-- Uncomment this to add support for file uploads: --> + <!-- + <dependency> + <groupId>org.apache.tapestry</groupId> + <artifactId>tapestry-upload</artifactId> + <version>${tapestry-release-version}</version> + </dependency> + --> + + <!-- A dependency on either JUnit or TestNG is required, or the surefire plugin (which runs the tests) +will fail, preventing Maven from packaging the WAR. Tapestry includes a large number +of testing facilities designed for use with TestNG (http://testng.org/), so it's recommended. --> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <version>${testng-release-version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tapestry</groupId> + <artifactId>tapestry-test</artifactId> + <version>${tapestry-release-version}</version> + <scope>test</scope> + </dependency> + + <!-- Provided by the servlet container, but sometimes referenced in the application + code. --> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <version>${servlet-api-release-version}</version> + <scope>provided</scope> + </dependency> + + <!-- Provide dependency to the Tapestry javadoc taglet which replaces the Maven component report --> + <dependency> + <groupId>org.apache.tapestry</groupId> + <artifactId>tapestry-javadoc</artifactId> + <version>${tapestry-release-version}</version> + <scope>provided</scope> + </dependency> + </dependencies> + + <build> + <finalName>apache-tapestry</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>2.3.2</version> + <configuration> + <source>1.8</source> + <target>1.8</target> + <optimize>true</optimize> + </configuration> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>2.7.2</version> + <configuration> + <systemPropertyVariables> + <tapestry.execution-mode>Qa</tapestry.execution-mode> + </systemPropertyVariables> + </configuration> + </plugin> + + <!-- Run the application using "mvn jetty:run" --> + <plugin> + <groupId>org.mortbay.jetty</groupId> + <artifactId>maven-jetty-plugin</artifactId> + <version>6.1.16</version> + <configuration> + <!-- Log to the console. --> + <requestLog implementation="org.mortbay.jetty.NCSARequestLog"> + <!-- This doesn't do anything for Jetty, but is a workaround for a Maven bug + that prevents the requestLog from being set. --> + <append>true</append> + </requestLog> + <systemProperties> + <systemProperty> + <name>tapestry.execution-mode</name> + <value>development</value> + </systemProperty> + </systemProperties> + </configuration> + </plugin> + </plugins> + </build> + + <reporting/> + + <repositories> + <repository> + <id>jboss</id> + <url>http://repository.jboss.org/nexus/content/groups/public/</url> + </repository> + + <!-- This repository is only needed when the Tapestry version is a preview release, rather + than a final release. --> + <repository> + <id>apache-staging</id> + <url>https://repository.apache.org/content/groups/staging/</url> + </repository> + </repositories> + + <properties> + <tapestry-release-version>5.4.5</tapestry-release-version> + <servlet-api-release-version>2.5</servlet-api-release-version> + <testng-release-version>6.8.21</testng-release-version> + <slf4j-release-version>1.7.19</slf4j-release-version> + </properties> + +</project> diff --git a/apache-tapestry/src/main/java/com/baeldung/tapestry/components/Layout.java b/apache-tapestry/src/main/java/com/baeldung/tapestry/components/Layout.java new file mode 100644 index 0000000000..5316bd9722 --- /dev/null +++ b/apache-tapestry/src/main/java/com/baeldung/tapestry/components/Layout.java @@ -0,0 +1,16 @@ +package com.baeldung.tapestry.components; + +import org.apache.tapestry5.BindingConstants; +import org.apache.tapestry5.annotations.Parameter; +import org.apache.tapestry5.annotations.Property; + +/** + * Layout component for pages of application. + */ +public class Layout { + + @Property + @Parameter(required = true, defaultPrefix = BindingConstants.LITERAL) + private String title; + +} diff --git a/apache-tapestry/src/main/java/com/baeldung/tapestry/pages/Error404.java b/apache-tapestry/src/main/java/com/baeldung/tapestry/pages/Error404.java new file mode 100644 index 0000000000..c629b82d01 --- /dev/null +++ b/apache-tapestry/src/main/java/com/baeldung/tapestry/pages/Error404.java @@ -0,0 +1,5 @@ +package com.baeldung.tapestry.pages; + +public class Error404 { + +} diff --git a/apache-tapestry/src/main/java/com/baeldung/tapestry/pages/Home.java b/apache-tapestry/src/main/java/com/baeldung/tapestry/pages/Home.java new file mode 100644 index 0000000000..34e99a9cce --- /dev/null +++ b/apache-tapestry/src/main/java/com/baeldung/tapestry/pages/Home.java @@ -0,0 +1,36 @@ +package com.baeldung.tapestry.pages; + +import java.util.Date; + +import org.apache.tapestry5.Block; +import org.apache.tapestry5.annotations.Log; +import org.apache.tapestry5.annotations.Property; +import org.apache.tapestry5.ioc.annotations.Inject; +import org.apache.tapestry5.services.ajax.AjaxResponseRenderer; +import org.slf4j.Logger; + +public class Home { + + @Property + private String appName = "apache-tapestry"; + + public Date getCurrentTime() { + return new Date(); + } + + @Inject + private Logger logger; + + @Inject + private AjaxResponseRenderer ajaxResponseRenderer; + + @Inject + private Block ajaxBlock; + + @Log + void onCallAjax() { + logger.info("Ajax call"); + ajaxResponseRenderer.addRender("ajaxZone", ajaxBlock); + } + +} diff --git a/apache-tapestry/src/main/java/com/baeldung/tapestry/pages/Index.java b/apache-tapestry/src/main/java/com/baeldung/tapestry/pages/Index.java new file mode 100644 index 0000000000..7d9e9a1aaa --- /dev/null +++ b/apache-tapestry/src/main/java/com/baeldung/tapestry/pages/Index.java @@ -0,0 +1,59 @@ +package com.baeldung.tapestry.pages; + + +import org.apache.tapestry5.Block; +import org.apache.tapestry5.EventContext; +import org.apache.tapestry5.SymbolConstants; +import org.apache.tapestry5.annotations.InjectPage; +import org.apache.tapestry5.annotations.Log; +import org.apache.tapestry5.annotations.Property; +import org.apache.tapestry5.ioc.annotations.Inject; +import org.apache.tapestry5.ioc.annotations.Symbol; +import org.apache.tapestry5.services.HttpError; +import org.apache.tapestry5.services.ajax.AjaxResponseRenderer; +import org.slf4j.Logger; + +import java.util.Date; + +/** + * Start page of application apache-tapestry. + */ +public class Index { + @Inject + private Logger logger; + + @Inject + private AjaxResponseRenderer ajaxResponseRenderer; + + @Property + @Inject + @Symbol(SymbolConstants.TAPESTRY_VERSION) + private String tapestryVersion; + + @Inject + private Block block; + + // Handle call with an unwanted context + Object onActivate(EventContext eventContext) { + return eventContext.getCount() > 0 ? + new HttpError(404, "Resource not found") : + null; + } + + @Log + void onComplete() { + logger.info("Complete call on Index page"); + } + + @Log + void onAjax() { + logger.info("Ajax call on Index page"); + + ajaxResponseRenderer.addRender("middlezone", block); + } + + public Date getCurrentTime() { + return new Date(); + } + +} diff --git a/apache-tapestry/src/main/java/com/baeldung/tapestry/pages/Login.java b/apache-tapestry/src/main/java/com/baeldung/tapestry/pages/Login.java new file mode 100644 index 0000000000..c5005f11f5 --- /dev/null +++ b/apache-tapestry/src/main/java/com/baeldung/tapestry/pages/Login.java @@ -0,0 +1,42 @@ +package com.baeldung.tapestry.pages; + +import org.apache.tapestry5.alerts.AlertManager; +import org.apache.tapestry5.annotations.InjectComponent; +import org.apache.tapestry5.annotations.Property; +import org.apache.tapestry5.corelib.components.Form; +import org.apache.tapestry5.ioc.annotations.Inject; +import org.slf4j.Logger; + +public class Login { + @Inject + private Logger logger; + + @Inject + private AlertManager alertManager; + + @InjectComponent + private Form login; + + @Property + private String email; + + @Property + private String password; + + void onValidateFromLogin() { + if(email == null || password == null) { + alertManager.error("Email/Password is null"); + login.recordError("Validation failed"); + } + } + + Object onSuccessFromLogin() { + alertManager.success("Welcome! Login Successful"); + return Home.class; + } + + void onFailureFromLogin() { + alertManager.error("Please try again with correct credentials"); + } + +} diff --git a/apache-tapestry/src/main/java/com/baeldung/tapestry/services/AppModule.java b/apache-tapestry/src/main/java/com/baeldung/tapestry/services/AppModule.java new file mode 100644 index 0000000000..c4d57d5b86 --- /dev/null +++ b/apache-tapestry/src/main/java/com/baeldung/tapestry/services/AppModule.java @@ -0,0 +1,128 @@ +package com.baeldung.tapestry.services; + +import java.io.IOException; + +import org.apache.tapestry5.SymbolConstants; +import org.apache.tapestry5.ioc.MappedConfiguration; +import org.apache.tapestry5.ioc.OrderedConfiguration; +import org.apache.tapestry5.ioc.ServiceBinder; +import org.apache.tapestry5.ioc.annotations.Contribute; +import org.apache.tapestry5.ioc.annotations.Local; +import org.apache.tapestry5.ioc.services.ApplicationDefaults; +import org.apache.tapestry5.ioc.services.SymbolProvider; +import org.apache.tapestry5.services.Request; +import org.apache.tapestry5.services.RequestFilter; +import org.apache.tapestry5.services.RequestHandler; +import org.apache.tapestry5.services.Response; +import org.slf4j.Logger; + +/** + * This module is automatically included as part of the Tapestry IoC Registry, it's a good place to + * configure and extend Tapestry, or to place your own service definitions. + */ +public class AppModule { + public static void bind(ServiceBinder binder) { + // binder.bind(MyServiceInterface.class, MyServiceImpl.class); + + // Make bind() calls on the binder object to define most IoC services. + // Use service builder methods (example below) when the implementation + // is provided inline, or requires more initialization than simply + // invoking the constructor. + } + + public static void contributeFactoryDefaults( + MappedConfiguration<String, Object> configuration) { + // The values defined here (as factory default overrides) are themselves + // overridden with application defaults by DevelopmentModule and QaModule. + + // The application version is primarily useful as it appears in + // any exception reports (HTML or textual). + configuration.override(SymbolConstants.APPLICATION_VERSION, "0.0.1-SNAPSHOT"); + + // This is something that should be removed when going to production, but is useful + // in the early stages of development. + configuration.override(SymbolConstants.PRODUCTION_MODE, false); + } + + public static void contributeApplicationDefaults( + MappedConfiguration<String, Object> configuration) { + // Contributions to ApplicationDefaults will override any contributions to + // FactoryDefaults (with the same key). Here we're restricting the supported + // locales to just "en" (English). As you add localised message catalogs and other assets, + // you can extend this list of locales (it's a comma separated series of locale names; + // the first locale name is the default when there's no reasonable match). + configuration.add(SymbolConstants.SUPPORTED_LOCALES, "en"); + + // You should change the passphrase immediately; the HMAC passphrase is used to secure + // the hidden field data stored in forms to encrypt and digitally sign client-side data. + configuration.add(SymbolConstants.HMAC_PASSPHRASE, "change this immediately"); + } + + /** + * Use annotation or method naming convention: <code>contributeApplicationDefaults</code> + */ + @Contribute(SymbolProvider.class) + @ApplicationDefaults + public static void setupEnvironment(MappedConfiguration<String, Object> configuration) { + // Support for jQuery is new in Tapestry 5.4 and will become the only supported + // option in 5.5. + configuration.add(SymbolConstants.JAVASCRIPT_INFRASTRUCTURE_PROVIDER, "jquery"); + configuration.add(SymbolConstants.BOOTSTRAP_ROOT, "context:mybootstrap"); + } + + + /** + * This is a service definition, the service will be named "TimingFilter". The interface, + * RequestFilter, is used within the RequestHandler service pipeline, which is built from the + * RequestHandler service configuration. Tapestry IoC is responsible for passing in an + * appropriate Logger instance. Requests for static resources are handled at a higher level, so + * this filter will only be invoked for Tapestry related requests. + * + * + * Service builder methods are useful when the implementation is inline as an inner class + * (as here) or require some other kind of special initialization. In most cases, + * use the static bind() method instead. + * + * + * If this method was named "build", then the service id would be taken from the + * service interface and would be "RequestFilter". Since Tapestry already defines + * a service named "RequestFilter" we use an explicit service id that we can reference + * inside the contribution method. + */ + public RequestFilter buildTimingFilter(final Logger log) { + return new RequestFilter() { + public boolean service(Request request, Response response, RequestHandler handler) + throws IOException { + long startTime = System.currentTimeMillis(); + + try { + // The responsibility of a filter is to invoke the corresponding method + // in the handler. When you chain multiple filters together, each filter + // received a handler that is a bridge to the next filter. + + return handler.service(request, response); + } finally { + long elapsed = System.currentTimeMillis() - startTime; + + log.info("Request time: {} ms", elapsed); + } + } + }; + } + + /** + * This is a contribution to the RequestHandler service configuration. This is how we extend + * Tapestry using the timing filter. A common use for this kind of filter is transaction + * management or security. The @Local annotation selects the desired service by type, but only + * from the same module. Without @Local, there would be an error due to the other service(s) + * that implement RequestFilter (defined in other modules). + */ + @Contribute(RequestHandler.class) + public void addTimingFilter(OrderedConfiguration<RequestFilter> configuration, @Local RequestFilter filter) { + // Each contribution to an ordered configuration has a name, When necessary, you may + // set constraints to precisely control the invocation order of the contributed filter + // within the pipeline. + + configuration.add("Timing", filter); + } +} diff --git a/apache-tapestry/src/main/java/com/baeldung/tapestry/services/DevelopmentModule.java b/apache-tapestry/src/main/java/com/baeldung/tapestry/services/DevelopmentModule.java new file mode 100644 index 0000000000..d9c8493e39 --- /dev/null +++ b/apache-tapestry/src/main/java/com/baeldung/tapestry/services/DevelopmentModule.java @@ -0,0 +1,24 @@ +package com.baeldung.tapestry.services; + +import org.apache.tapestry5.SymbolConstants; +import org.apache.tapestry5.ioc.MappedConfiguration; + +/** + * This module is automatically included as part of the Tapestry IoC Registry if <em>tapestry.execution-mode</em> + * includes <code>development</code>. + */ +public class DevelopmentModule { + public static void contributeApplicationDefaults( + MappedConfiguration<String, Object> configuration) { + // The factory default is true but during the early stages of an application + // overriding to false is a good idea. In addition, this is often overridden + // on the command line as -Dtapestry.production-mode=false + configuration.add(SymbolConstants.PRODUCTION_MODE, false); + + // The application version number is incorprated into URLs for some + // assets. Web browsers will cache assets because of the far future expires + // header. If existing assets are changed, the version number should also + // change, to force the browser to download new versions. + configuration.add(SymbolConstants.APPLICATION_VERSION, "0.0.1-SNAPSHOT-DEV"); + } +} diff --git a/apache-tapestry/src/main/java/com/baeldung/tapestry/services/QaModule.java b/apache-tapestry/src/main/java/com/baeldung/tapestry/services/QaModule.java new file mode 100644 index 0000000000..fc6fb595e9 --- /dev/null +++ b/apache-tapestry/src/main/java/com/baeldung/tapestry/services/QaModule.java @@ -0,0 +1,34 @@ +package com.baeldung.tapestry.services; + +import org.apache.tapestry5.SymbolConstants; +import org.apache.tapestry5.ioc.MappedConfiguration; +import org.apache.tapestry5.ioc.ServiceBinder; + +/** + * This module is automatically included as part of the Tapestry IoC Registry if <em>tapestry.execution-mode</em> + * includes <code>qa</code> ("quality assurance"). + */ +public class QaModule +{ + public static void bind(ServiceBinder binder) + { + // Bind any services needed by the QA team to produce their reports + // binder.bind(MyServiceMonitorInterface.class, MyServiceMonitorImpl.class); + } + + + public static void contributeApplicationDefaults( + MappedConfiguration<String, Object> configuration) + { + // The factory default is true but during the early stages of an application + // overriding to false is a good idea. In addition, this is often overridden + // on the command line as -Dtapestry.production-mode=false + configuration.add(SymbolConstants.PRODUCTION_MODE, false); + + // The application version number is incorprated into URLs for some + // assets. Web browsers will cache assets because of the far future expires + // header. If existing assets are changed, the version number should also + // change, to force the browser to download new versions. + configuration.add(SymbolConstants.APPLICATION_VERSION, "0.0.1-SNAPSHOT-QA"); + } +} diff --git a/apache-tapestry/src/main/resources/com/baeldung/tapestry/components/Layout.tml b/apache-tapestry/src/main/resources/com/baeldung/tapestry/components/Layout.tml new file mode 100644 index 0000000000..baa17aef8e --- /dev/null +++ b/apache-tapestry/src/main/resources/com/baeldung/tapestry/components/Layout.tml @@ -0,0 +1,21 @@ +<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd"> + <head> + <title>${title}</title> + </head> + <body> + <div class="container"> + <div class="row"> + <div class="span12"> + <t:alerts/> + </div> + </div> + </div> + <div class="container"> + <t:body /> + <hr /> + <footer> + <p>© Your Company</p> + </footer> + </div> + </body> +</html> diff --git a/apache-tapestry/src/main/resources/com/baeldung/tapestry/logback.xml b/apache-tapestry/src/main/resources/com/baeldung/tapestry/logback.xml new file mode 100644 index 0000000000..2997ecb099 --- /dev/null +++ b/apache-tapestry/src/main/resources/com/baeldung/tapestry/logback.xml @@ -0,0 +1,13 @@ +<configuration> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <layout class="ch.qos.logback.classic.PatternLayout"> + <Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern> + </layout> + </appender> + + <logger name="com.baeldung.tapestry" level="TRACE"/> + + <root level="info"> + <appender-ref ref="STDOUT"/> + </root> +</configuration> diff --git a/apache-tapestry/src/main/resources/com/baeldung/tapestry/pages/Error404.tml b/apache-tapestry/src/main/resources/com/baeldung/tapestry/pages/Error404.tml new file mode 100644 index 0000000000..b18492221e --- /dev/null +++ b/apache-tapestry/src/main/resources/com/baeldung/tapestry/pages/Error404.tml @@ -0,0 +1,11 @@ +<html t:type="layout" title="Not found apache-tapestry" + xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd" + xmlns:p="tapestry:parameter"> + + <div class="row"> + <div class="span12"> + <h1>Requested page not found!</h1> + </div> + </div> + +</html> diff --git a/apache-tapestry/src/main/resources/com/baeldung/tapestry/pages/Home.properties b/apache-tapestry/src/main/resources/com/baeldung/tapestry/pages/Home.properties new file mode 100644 index 0000000000..4647845163 --- /dev/null +++ b/apache-tapestry/src/main/resources/com/baeldung/tapestry/pages/Home.properties @@ -0,0 +1 @@ +introMsg=Welcome to the Apache Tapestry Tutorial diff --git a/apache-tapestry/src/main/resources/com/baeldung/tapestry/pages/Home.tml b/apache-tapestry/src/main/resources/com/baeldung/tapestry/pages/Home.tml new file mode 100644 index 0000000000..3dafb63f0a --- /dev/null +++ b/apache-tapestry/src/main/resources/com/baeldung/tapestry/pages/Home.tml @@ -0,0 +1,14 @@ +<html t:type="layout" title="apache-tapestry Home" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd"> + + <h1>Home! ${appName}</h1> + <h2>${message:introMsg}</h2> + <h3>${currentTime}</h3> + <p><t:eventlink event="callAjax" zone="ajaxZone" class="btn btn-default">Call Ajax</t:eventlink></p> + <t:zone t:id="ajaxZone" class="span4"></t:zone> + <t:block t:id="ajaxBlock"> + <hr/> + <h2>Rendered through Ajax</h2> + <p>The current time is: <strong>${currentTime}</strong></p> + </t:block> + +</html> diff --git a/apache-tapestry/src/main/resources/com/baeldung/tapestry/pages/Index.properties b/apache-tapestry/src/main/resources/com/baeldung/tapestry/pages/Index.properties new file mode 100644 index 0000000000..bc49edd53f --- /dev/null +++ b/apache-tapestry/src/main/resources/com/baeldung/tapestry/pages/Index.properties @@ -0,0 +1 @@ +greeting=Welcome to Tapestry 5! We hope that this project template will get you going in style. diff --git a/apache-tapestry/src/main/resources/com/baeldung/tapestry/pages/Index.tml b/apache-tapestry/src/main/resources/com/baeldung/tapestry/pages/Index.tml new file mode 100644 index 0000000000..625a3c2fcc --- /dev/null +++ b/apache-tapestry/src/main/resources/com/baeldung/tapestry/pages/Index.tml @@ -0,0 +1,46 @@ +<html t:type="layout" title="apache-tapestry Index" + xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd" + > + + <!-- Most of the page content, including <head>, <body>, etc. tags, comes from Layout.tml --> + + <!-- Main hero unit for a primary marketing message or call to action --> + <div class="hero-unit"> + <p> + <img src="${asset:context:images/tapestry.png}" + alt="${message:greeting}" title="${message:greeting}"/> + </p> + <h3>${message:greeting}</h3> + <p>The current time is: <strong>${currentTime}</strong></p> + <p> + This is a template for a simple marketing or informational website. It includes a large callout called + the hero unit and three supporting pieces of content. Use it as a starting point to create something + more unique. + </p> + <p><t:actionlink t:id="learnmore" class="btn btn-primary btn-large">Learn more »</t:actionlink></p> + </div> + + <!-- Example row of columns --> + <div class="row"> + <div class="span4"> + <h2>Normal link</h2> + <p>Clink the bottom link and the page refresh with event <code>complete</code></p> + <p><t:eventlink event="complete" class="btn btn-default">Complete»</t:eventlink></p> + </div> + <t:zone t:id="middlezone" class="span4"> + + </t:zone> + <div class="span4"> + <h2>Ajax link</h2> + <p>Click the bottom link to update just the middle column with Ajax call with event <code>ajax</code></p> + <p><t:eventlink event="ajax" zone="middlezone" class="btn btn-default">Ajax»</t:eventlink></p> + </div> + </div> + + <t:block t:id="block"> + <h2>Ajax updated</h2> + <p>I'v been updated through AJAX call</p> + <p>The current time is: <strong>${currentTime}</strong></p> + </t:block> + +</html> diff --git a/apache-tapestry/src/main/resources/com/baeldung/tapestry/pages/Login.tml b/apache-tapestry/src/main/resources/com/baeldung/tapestry/pages/Login.tml new file mode 100644 index 0000000000..ac78a55341 --- /dev/null +++ b/apache-tapestry/src/main/resources/com/baeldung/tapestry/pages/Login.tml @@ -0,0 +1,16 @@ +<html t:type="layout" title="apache-tapestry com.example" + xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd" + xmlns:p="tapestry:parameter"> + +<div class="row"> + <div class="span4 offset3"> + <t:form t:id="login"> + <h2>Please sign in</h2> + <t:textfield t:id="email" class="input-block-level" placeholder="Email address"/> + <t:passwordfield t:id="password" class="input-block-level" placeholder="Password"/> + <t:submit class="btn btn-large btn-primary" value="Sign in"/> + </t:form> + </div> +</div> + +</html> diff --git a/apache-tapestry/src/main/resources/log4j.properties b/apache-tapestry/src/main/resources/log4j.properties new file mode 100644 index 0000000000..bd90a762ca --- /dev/null +++ b/apache-tapestry/src/main/resources/log4j.properties @@ -0,0 +1,44 @@ +# Default to info level output; this is very handy if you eventually use Hibernate as well. +log4j.rootCategory=info, A1 + +# A1 is set to be a ConsoleAppender. +log4j.appender.A1=org.apache.log4j.ConsoleAppender + +# A1 uses PatternLayout. +log4j.appender.A1.layout=org.apache.log4j.PatternLayout +log4j.appender.A1.layout.ConversionPattern=[%p] %c{2} %m%n + +# Service category names are the name of the defining module class +# and then the service id. +log4j.category.com.baeldung.tapestry.services.AppModule.TimingFilter=info + +# Outputs a list of pages, components and mixins at startup. +log4j.category.org.apache.tapestry5.modules.TapestryModule.ComponentClassResolver=info + +# Outputs startup statistics; elapsed time to setup and initialize the registry, a list of +# available services, and a launch banner that includes the Tapestry version number. +log4j.category.org.apache.tapestry5.TapestryFilter=info + + +# Turning on debug mode for a page's or component's transformer logger +# will show all of the code changes that occur when the +# class is loaded. + +# log4j.category.tapestry.transformer.com.baeldung.tapestry.pages.Index=debug + +# Turning on debug mode for a component's events logger will show all the events triggered on the +# component, and which component methods are invoked as a result. + +# log4j.category.tapestry.events.com.baeldung.tapestry.pages.Index=debug + +# Turning on trace mode for a page's render logger provides extended information about every step +# in rendering (this is not generally helpful). Turning on debug mode will add a one-line +# summary that includes the elapsed render time, which can be useful in tracking down +# performance issues. + +# log4j.category.tapestry.render.com.baeldung.tapestry.pages.Index=debug + +# Turn on some verbose debugging about everything in the application. This is nice initially, +# while getting everything set up. You'll probably want to remove this once you are +# up and running, replacing it with more selective debugging output. +log4j.category.com.baeldung.tapestry=debug diff --git a/apache-tapestry/src/main/webapp/WEB-INF/app.properties b/apache-tapestry/src/main/webapp/WEB-INF/app.properties new file mode 100644 index 0000000000..1c299311bb --- /dev/null +++ b/apache-tapestry/src/main/webapp/WEB-INF/app.properties @@ -0,0 +1,4 @@ +# This is where global application properties go. +# You can also have individual message catalogs for each page and each +# component that override these defaults. +# The name of this file is based on the <filter-name> element in web. \ No newline at end of file diff --git a/apache-tapestry/src/main/webapp/WEB-INF/web.xml b/apache-tapestry/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..c5bdfd415c --- /dev/null +++ b/apache-tapestry/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" + version="2.4"> + + <display-name>apache-tapestry Tapestry 5 Application</display-name> + <context-param> + <!-- + The only significant configuration for Tapestry 5, this informs Tapestry + of where to look for pages, components and mixins. + --> + <param-name>tapestry.app-package</param-name> + <param-value>com.baeldung.tapestry</param-value> + </context-param> + + <!-- + Specify some additional Modules for two different execution + modes: development and qa. + Remember that the default execution mode is production + --> + <context-param> + <param-name>tapestry.development-modules</param-name> + <param-value> + com.baeldung.tapestry.services.DevelopmentModule + </param-value> + </context-param> + <context-param> + <param-name>tapestry.qa-modules</param-name> + <param-value> + com.baeldung.tapestry.services.QaModule + </param-value> + </context-param> + + + <!-- Filter configuration --> + <filter> + <filter-name>app</filter-name> + <filter-class>org.apache.tapestry5.TapestryFilter</filter-class> + </filter> + + <filter-mapping> + <filter-name>app</filter-name> + <url-pattern>/*</url-pattern> + <dispatcher>REQUEST</dispatcher> + <dispatcher>ERROR</dispatcher> + </filter-mapping> + + <error-page> + <error-code>404</error-code> + <location>/error404</location> + </error-page> + +</web-app> \ No newline at end of file diff --git a/apache-tapestry/src/main/webapp/favicon.ico b/apache-tapestry/src/main/webapp/favicon.ico new file mode 100644 index 0000000000..b9715a2aed Binary files /dev/null and b/apache-tapestry/src/main/webapp/favicon.ico differ diff --git a/apache-tapestry/src/main/webapp/images/tapestry.png b/apache-tapestry/src/main/webapp/images/tapestry.png new file mode 100644 index 0000000000..eba58883c6 Binary files /dev/null and b/apache-tapestry/src/main/webapp/images/tapestry.png differ diff --git a/apache-tapestry/src/main/webapp/mybootstrap/css/bootstrap-theme.css b/apache-tapestry/src/main/webapp/mybootstrap/css/bootstrap-theme.css new file mode 100644 index 0000000000..374a7e314a --- /dev/null +++ b/apache-tapestry/src/main/webapp/mybootstrap/css/bootstrap-theme.css @@ -0,0 +1,476 @@ +/*! + * Bootstrap v3.3.4 (http://getbootstrap.com) + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + */ + +.btn-default, +.btn-primary, +.btn-success, +.btn-info, +.btn-warning, +.btn-danger { + text-shadow: 0 -1px 0 rgba(0, 0, 0, .2); + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075); +} +.btn-default:active, +.btn-primary:active, +.btn-success:active, +.btn-info:active, +.btn-warning:active, +.btn-danger:active, +.btn-default.active, +.btn-primary.active, +.btn-success.active, +.btn-info.active, +.btn-warning.active, +.btn-danger.active { + -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); + box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); +} +.btn-default .badge, +.btn-primary .badge, +.btn-success .badge, +.btn-info .badge, +.btn-warning .badge, +.btn-danger .badge { + text-shadow: none; +} +.btn:active, +.btn.active { + background-image: none; +} +.btn-default { + text-shadow: 0 1px 0 #fff; + background-image: -webkit-linear-gradient(top, #fff 0%, #e0e0e0 100%); + background-image: -o-linear-gradient(top, #fff 0%, #e0e0e0 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#e0e0e0)); + background-image: linear-gradient(to bottom, #fff 0%, #e0e0e0 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0); + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + background-repeat: repeat-x; + border-color: #dbdbdb; + border-color: #ccc; +} +.btn-default:hover, +.btn-default:focus { + background-color: #e0e0e0; + background-position: 0 -15px; +} +.btn-default:active, +.btn-default.active { + background-color: #e0e0e0; + border-color: #dbdbdb; +} +.btn-default.disabled, +.btn-default:disabled, +.btn-default[disabled] { + background-color: #e0e0e0; + background-image: none; +} +.btn-primary { + background-image: -webkit-linear-gradient(top, #337ab7 0%, #265a88 100%); + background-image: -o-linear-gradient(top, #337ab7 0%, #265a88 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#265a88)); + background-image: linear-gradient(to bottom, #337ab7 0%, #265a88 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff265a88', GradientType=0); + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + background-repeat: repeat-x; + border-color: #245580; +} +.btn-primary:hover, +.btn-primary:focus { + background-color: #265a88; + background-position: 0 -15px; +} +.btn-primary:active, +.btn-primary.active { + background-color: #265a88; + border-color: #245580; +} +.btn-primary.disabled, +.btn-primary:disabled, +.btn-primary[disabled] { + background-color: #265a88; + background-image: none; +} +.btn-success { + background-image: -webkit-linear-gradient(top, #5cb85c 0%, #419641 100%); + background-image: -o-linear-gradient(top, #5cb85c 0%, #419641 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#419641)); + background-image: linear-gradient(to bottom, #5cb85c 0%, #419641 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0); + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + background-repeat: repeat-x; + border-color: #3e8f3e; +} +.btn-success:hover, +.btn-success:focus { + background-color: #419641; + background-position: 0 -15px; +} +.btn-success:active, +.btn-success.active { + background-color: #419641; + border-color: #3e8f3e; +} +.btn-success.disabled, +.btn-success:disabled, +.btn-success[disabled] { + background-color: #419641; + background-image: none; +} +.btn-info { + background-image: -webkit-linear-gradient(top, #5bc0de 0%, #2aabd2 100%); + background-image: -o-linear-gradient(top, #5bc0de 0%, #2aabd2 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#2aabd2)); + background-image: linear-gradient(to bottom, #5bc0de 0%, #2aabd2 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0); + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + background-repeat: repeat-x; + border-color: #28a4c9; +} +.btn-info:hover, +.btn-info:focus { + background-color: #2aabd2; + background-position: 0 -15px; +} +.btn-info:active, +.btn-info.active { + background-color: #2aabd2; + border-color: #28a4c9; +} +.btn-info.disabled, +.btn-info:disabled, +.btn-info[disabled] { + background-color: #2aabd2; + background-image: none; +} +.btn-warning { + background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #eb9316 100%); + background-image: -o-linear-gradient(top, #f0ad4e 0%, #eb9316 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#eb9316)); + background-image: linear-gradient(to bottom, #f0ad4e 0%, #eb9316 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0); + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + background-repeat: repeat-x; + border-color: #e38d13; +} +.btn-warning:hover, +.btn-warning:focus { + background-color: #eb9316; + background-position: 0 -15px; +} +.btn-warning:active, +.btn-warning.active { + background-color: #eb9316; + border-color: #e38d13; +} +.btn-warning.disabled, +.btn-warning:disabled, +.btn-warning[disabled] { + background-color: #eb9316; + background-image: none; +} +.btn-danger { + background-image: -webkit-linear-gradient(top, #d9534f 0%, #c12e2a 100%); + background-image: -o-linear-gradient(top, #d9534f 0%, #c12e2a 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c12e2a)); + background-image: linear-gradient(to bottom, #d9534f 0%, #c12e2a 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0); + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + background-repeat: repeat-x; + border-color: #b92c28; +} +.btn-danger:hover, +.btn-danger:focus { + background-color: #c12e2a; + background-position: 0 -15px; +} +.btn-danger:active, +.btn-danger.active { + background-color: #c12e2a; + border-color: #b92c28; +} +.btn-danger.disabled, +.btn-danger:disabled, +.btn-danger[disabled] { + background-color: #c12e2a; + background-image: none; +} +.thumbnail, +.img-thumbnail { + -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075); + box-shadow: 0 1px 2px rgba(0, 0, 0, .075); +} +.dropdown-menu > li > a:hover, +.dropdown-menu > li > a:focus { + background-color: #e8e8e8; + background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); + background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8)); + background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0); + background-repeat: repeat-x; +} +.dropdown-menu > .active > a, +.dropdown-menu > .active > a:hover, +.dropdown-menu > .active > a:focus { + background-color: #2e6da4; + background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%); + background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4)); + background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0); + background-repeat: repeat-x; +} +.navbar-default { + background-image: -webkit-linear-gradient(top, #fff 0%, #f8f8f8 100%); + background-image: -o-linear-gradient(top, #fff 0%, #f8f8f8 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#f8f8f8)); + background-image: linear-gradient(to bottom, #fff 0%, #f8f8f8 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0); + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + background-repeat: repeat-x; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075); +} +.navbar-default .navbar-nav > .open > a, +.navbar-default .navbar-nav > .active > a { + background-image: -webkit-linear-gradient(top, #dbdbdb 0%, #e2e2e2 100%); + background-image: -o-linear-gradient(top, #dbdbdb 0%, #e2e2e2 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#dbdbdb), to(#e2e2e2)); + background-image: linear-gradient(to bottom, #dbdbdb 0%, #e2e2e2 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdbdbdb', endColorstr='#ffe2e2e2', GradientType=0); + background-repeat: repeat-x; + -webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075); + box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075); +} +.navbar-brand, +.navbar-nav > li > a { + text-shadow: 0 1px 0 rgba(255, 255, 255, .25); +} +.navbar-inverse { + background-image: -webkit-linear-gradient(top, #3c3c3c 0%, #222 100%); + background-image: -o-linear-gradient(top, #3c3c3c 0%, #222 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#3c3c3c), to(#222)); + background-image: linear-gradient(to bottom, #3c3c3c 0%, #222 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0); + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + background-repeat: repeat-x; +} +.navbar-inverse .navbar-nav > .open > a, +.navbar-inverse .navbar-nav > .active > a { + background-image: -webkit-linear-gradient(top, #080808 0%, #0f0f0f 100%); + background-image: -o-linear-gradient(top, #080808 0%, #0f0f0f 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#080808), to(#0f0f0f)); + background-image: linear-gradient(to bottom, #080808 0%, #0f0f0f 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff080808', endColorstr='#ff0f0f0f', GradientType=0); + background-repeat: repeat-x; + -webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25); + box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25); +} +.navbar-inverse .navbar-brand, +.navbar-inverse .navbar-nav > li > a { + text-shadow: 0 -1px 0 rgba(0, 0, 0, .25); +} +.navbar-static-top, +.navbar-fixed-top, +.navbar-fixed-bottom { + border-radius: 0; +} +@media (max-width: 767px) { + .navbar .navbar-nav .open .dropdown-menu > .active > a, + .navbar .navbar-nav .open .dropdown-menu > .active > a:hover, + .navbar .navbar-nav .open .dropdown-menu > .active > a:focus { + color: #fff; + background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%); + background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4)); + background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0); + background-repeat: repeat-x; + } +} +.alert { + text-shadow: 0 1px 0 rgba(255, 255, 255, .2); + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05); +} +.alert-success { + background-image: -webkit-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%); + background-image: -o-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#c8e5bc)); + background-image: linear-gradient(to bottom, #dff0d8 0%, #c8e5bc 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0); + background-repeat: repeat-x; + border-color: #b2dba1; +} +.alert-info { + background-image: -webkit-linear-gradient(top, #d9edf7 0%, #b9def0 100%); + background-image: -o-linear-gradient(top, #d9edf7 0%, #b9def0 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#b9def0)); + background-image: linear-gradient(to bottom, #d9edf7 0%, #b9def0 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0); + background-repeat: repeat-x; + border-color: #9acfea; +} +.alert-warning { + background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%); + background-image: -o-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#f8efc0)); + background-image: linear-gradient(to bottom, #fcf8e3 0%, #f8efc0 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0); + background-repeat: repeat-x; + border-color: #f5e79e; +} +.alert-danger { + background-image: -webkit-linear-gradient(top, #f2dede 0%, #e7c3c3 100%); + background-image: -o-linear-gradient(top, #f2dede 0%, #e7c3c3 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#e7c3c3)); + background-image: linear-gradient(to bottom, #f2dede 0%, #e7c3c3 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0); + background-repeat: repeat-x; + border-color: #dca7a7; +} +.progress { + background-image: -webkit-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%); + background-image: -o-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#ebebeb), to(#f5f5f5)); + background-image: linear-gradient(to bottom, #ebebeb 0%, #f5f5f5 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0); + background-repeat: repeat-x; +} +.progress-bar { + background-image: -webkit-linear-gradient(top, #337ab7 0%, #286090 100%); + background-image: -o-linear-gradient(top, #337ab7 0%, #286090 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#286090)); + background-image: linear-gradient(to bottom, #337ab7 0%, #286090 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff286090', GradientType=0); + background-repeat: repeat-x; +} +.progress-bar-success { + background-image: -webkit-linear-gradient(top, #5cb85c 0%, #449d44 100%); + background-image: -o-linear-gradient(top, #5cb85c 0%, #449d44 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#449d44)); + background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0); + background-repeat: repeat-x; +} +.progress-bar-info { + background-image: -webkit-linear-gradient(top, #5bc0de 0%, #31b0d5 100%); + background-image: -o-linear-gradient(top, #5bc0de 0%, #31b0d5 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#31b0d5)); + background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0); + background-repeat: repeat-x; +} +.progress-bar-warning { + background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #ec971f 100%); + background-image: -o-linear-gradient(top, #f0ad4e 0%, #ec971f 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#ec971f)); + background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0); + background-repeat: repeat-x; +} +.progress-bar-danger { + background-image: -webkit-linear-gradient(top, #d9534f 0%, #c9302c 100%); + background-image: -o-linear-gradient(top, #d9534f 0%, #c9302c 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c9302c)); + background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0); + background-repeat: repeat-x; +} +.progress-bar-striped { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); +} +.list-group { + border-radius: 4px; + -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075); + box-shadow: 0 1px 2px rgba(0, 0, 0, .075); +} +.list-group-item.active, +.list-group-item.active:hover, +.list-group-item.active:focus { + text-shadow: 0 -1px 0 #286090; + background-image: -webkit-linear-gradient(top, #337ab7 0%, #2b669a 100%); + background-image: -o-linear-gradient(top, #337ab7 0%, #2b669a 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2b669a)); + background-image: linear-gradient(to bottom, #337ab7 0%, #2b669a 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2b669a', GradientType=0); + background-repeat: repeat-x; + border-color: #2b669a; +} +.list-group-item.active .badge, +.list-group-item.active:hover .badge, +.list-group-item.active:focus .badge { + text-shadow: none; +} +.panel { + -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05); + box-shadow: 0 1px 2px rgba(0, 0, 0, .05); +} +.panel-default > .panel-heading { + background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); + background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8)); + background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0); + background-repeat: repeat-x; +} +.panel-primary > .panel-heading { + background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%); + background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4)); + background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0); + background-repeat: repeat-x; +} +.panel-success > .panel-heading { + background-image: -webkit-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%); + background-image: -o-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#d0e9c6)); + background-image: linear-gradient(to bottom, #dff0d8 0%, #d0e9c6 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0); + background-repeat: repeat-x; +} +.panel-info > .panel-heading { + background-image: -webkit-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%); + background-image: -o-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#c4e3f3)); + background-image: linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0); + background-repeat: repeat-x; +} +.panel-warning > .panel-heading { + background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%); + background-image: -o-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#faf2cc)); + background-image: linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0); + background-repeat: repeat-x; +} +.panel-danger > .panel-heading { + background-image: -webkit-linear-gradient(top, #f2dede 0%, #ebcccc 100%); + background-image: -o-linear-gradient(top, #f2dede 0%, #ebcccc 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#ebcccc)); + background-image: linear-gradient(to bottom, #f2dede 0%, #ebcccc 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0); + background-repeat: repeat-x; +} +.well { + background-image: -webkit-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%); + background-image: -o-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#e8e8e8), to(#f5f5f5)); + background-image: linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0); + background-repeat: repeat-x; + border-color: #dcdcdc; + -webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1); + box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1); +} + diff --git a/apache-tapestry/src/main/webapp/mybootstrap/css/bootstrap.css b/apache-tapestry/src/main/webapp/mybootstrap/css/bootstrap.css new file mode 100644 index 0000000000..057ff46dae --- /dev/null +++ b/apache-tapestry/src/main/webapp/mybootstrap/css/bootstrap.css @@ -0,0 +1,6588 @@ +/*! + * Bootstrap v3.3.4 (http://getbootstrap.com) + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + */ + +/*! normalize.css v3.0.2 | MIT License | git.io/normalize */ +html { + font-family: sans-serif; + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; +} +body { + margin: 0; +} +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +menu, +nav, +section, +summary { + display: block; +} +audio, +canvas, +progress, +video { + display: inline-block; + vertical-align: baseline; +} +audio:not([controls]) { + display: none; + height: 0; +} +[hidden], +template { + display: none; +} +a { + background-color: transparent; +} +a:active, +a:hover { + outline: 0; +} +abbr[title] { + border-bottom: 1px dotted; +} +b, +strong { + font-weight: bold; +} +dfn { + font-style: italic; +} +h1 { + margin: .67em 0; + font-size: 2em; +} +mark { + color: #000; + background: #ff0; +} +small { + font-size: 80%; +} +sub, +sup { + position: relative; + font-size: 75%; + line-height: 0; + vertical-align: baseline; +} +sup { + top: -.5em; +} +sub { + bottom: -.25em; +} +img { + border: 0; +} +svg:not(:root) { + overflow: hidden; +} +figure { + margin: 1em 40px; +} +hr { + height: 0; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; +} +pre { + overflow: auto; +} +code, +kbd, +pre, +samp { + font-family: monospace, monospace; + font-size: 1em; +} +button, +input, +optgroup, +select, +textarea { + margin: 0; + font: inherit; + color: inherit; +} +button { + overflow: visible; +} +button, +select { + text-transform: none; +} +button, +html input[type="button"], +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; + cursor: pointer; +} +button[disabled], +html input[disabled] { + cursor: default; +} +button::-moz-focus-inner, +input::-moz-focus-inner { + padding: 0; + border: 0; +} +input { + line-height: normal; +} +input[type="checkbox"], +input[type="radio"] { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + padding: 0; +} +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + height: auto; +} +input[type="search"] { + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + -webkit-appearance: textfield; +} +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} +fieldset { + padding: .35em .625em .75em; + margin: 0 2px; + border: 1px solid #c0c0c0; +} +legend { + padding: 0; + border: 0; +} +textarea { + overflow: auto; +} +optgroup { + font-weight: bold; +} +table { + border-spacing: 0; + border-collapse: collapse; +} +td, +th { + padding: 0; +} +/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */ +@media print { + *, + *:before, + *:after { + color: #000 !important; + text-shadow: none !important; + background: transparent !important; + -webkit-box-shadow: none !important; + box-shadow: none !important; + } + a, + a:visited { + text-decoration: underline; + } + a[href]:after { + content: " (" attr(href) ")"; + } + abbr[title]:after { + content: " (" attr(title) ")"; + } + a[href^="#"]:after, + a[href^="javascript:"]:after { + content: ""; + } + pre, + blockquote { + border: 1px solid #999; + + page-break-inside: avoid; + } + thead { + display: table-header-group; + } + tr, + img { + page-break-inside: avoid; + } + img { + max-width: 100% !important; + } + p, + h2, + h3 { + orphans: 3; + widows: 3; + } + h2, + h3 { + page-break-after: avoid; + } + select { + background: #fff !important; + } + .navbar { + display: none; + } + .btn > .caret, + .dropup > .btn > .caret { + border-top-color: #000 !important; + } + .label { + border: 1px solid #000; + } + .table { + border-collapse: collapse !important; + } + .table td, + .table th { + background-color: #fff !important; + } + .table-bordered th, + .table-bordered td { + border: 1px solid #ddd !important; + } +} +@font-face { + font-family: 'Glyphicons Halflings'; + + src: url('../fonts/glyphicons-halflings-regular.eot'); + src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff2') format('woff2'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg'); +} +.glyphicon { + position: relative; + top: 1px; + display: inline-block; + font-family: 'Glyphicons Halflings'; + font-style: normal; + font-weight: normal; + line-height: 1; + + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} +.glyphicon-asterisk:before { + content: "\2a"; +} +.glyphicon-plus:before { + content: "\2b"; +} +.glyphicon-euro:before, +.glyphicon-eur:before { + content: "\20ac"; +} +.glyphicon-minus:before { + content: "\2212"; +} +.glyphicon-cloud:before { + content: "\2601"; +} +.glyphicon-envelope:before { + content: "\2709"; +} +.glyphicon-pencil:before { + content: "\270f"; +} +.glyphicon-glass:before { + content: "\e001"; +} +.glyphicon-music:before { + content: "\e002"; +} +.glyphicon-search:before { + content: "\e003"; +} +.glyphicon-heart:before { + content: "\e005"; +} +.glyphicon-star:before { + content: "\e006"; +} +.glyphicon-star-empty:before { + content: "\e007"; +} +.glyphicon-user:before { + content: "\e008"; +} +.glyphicon-film:before { + content: "\e009"; +} +.glyphicon-th-large:before { + content: "\e010"; +} +.glyphicon-th:before { + content: "\e011"; +} +.glyphicon-th-list:before { + content: "\e012"; +} +.glyphicon-ok:before { + content: "\e013"; +} +.glyphicon-remove:before { + content: "\e014"; +} +.glyphicon-zoom-in:before { + content: "\e015"; +} +.glyphicon-zoom-out:before { + content: "\e016"; +} +.glyphicon-off:before { + content: "\e017"; +} +.glyphicon-signal:before { + content: "\e018"; +} +.glyphicon-cog:before { + content: "\e019"; +} +.glyphicon-trash:before { + content: "\e020"; +} +.glyphicon-home:before { + content: "\e021"; +} +.glyphicon-file:before { + content: "\e022"; +} +.glyphicon-time:before { + content: "\e023"; +} +.glyphicon-road:before { + content: "\e024"; +} +.glyphicon-download-alt:before { + content: "\e025"; +} +.glyphicon-download:before { + content: "\e026"; +} +.glyphicon-upload:before { + content: "\e027"; +} +.glyphicon-inbox:before { + content: "\e028"; +} +.glyphicon-play-circle:before { + content: "\e029"; +} +.glyphicon-repeat:before { + content: "\e030"; +} +.glyphicon-refresh:before { + content: "\e031"; +} +.glyphicon-list-alt:before { + content: "\e032"; +} +.glyphicon-lock:before { + content: "\e033"; +} +.glyphicon-flag:before { + content: "\e034"; +} +.glyphicon-headphones:before { + content: "\e035"; +} +.glyphicon-volume-off:before { + content: "\e036"; +} +.glyphicon-volume-down:before { + content: "\e037"; +} +.glyphicon-volume-up:before { + content: "\e038"; +} +.glyphicon-qrcode:before { + content: "\e039"; +} +.glyphicon-barcode:before { + content: "\e040"; +} +.glyphicon-tag:before { + content: "\e041"; +} +.glyphicon-tags:before { + content: "\e042"; +} +.glyphicon-book:before { + content: "\e043"; +} +.glyphicon-bookmark:before { + content: "\e044"; +} +.glyphicon-print:before { + content: "\e045"; +} +.glyphicon-camera:before { + content: "\e046"; +} +.glyphicon-font:before { + content: "\e047"; +} +.glyphicon-bold:before { + content: "\e048"; +} +.glyphicon-italic:before { + content: "\e049"; +} +.glyphicon-text-height:before { + content: "\e050"; +} +.glyphicon-text-width:before { + content: "\e051"; +} +.glyphicon-align-left:before { + content: "\e052"; +} +.glyphicon-align-center:before { + content: "\e053"; +} +.glyphicon-align-right:before { + content: "\e054"; +} +.glyphicon-align-justify:before { + content: "\e055"; +} +.glyphicon-list:before { + content: "\e056"; +} +.glyphicon-indent-left:before { + content: "\e057"; +} +.glyphicon-indent-right:before { + content: "\e058"; +} +.glyphicon-facetime-video:before { + content: "\e059"; +} +.glyphicon-picture:before { + content: "\e060"; +} +.glyphicon-map-marker:before { + content: "\e062"; +} +.glyphicon-adjust:before { + content: "\e063"; +} +.glyphicon-tint:before { + content: "\e064"; +} +.glyphicon-edit:before { + content: "\e065"; +} +.glyphicon-share:before { + content: "\e066"; +} +.glyphicon-check:before { + content: "\e067"; +} +.glyphicon-move:before { + content: "\e068"; +} +.glyphicon-step-backward:before { + content: "\e069"; +} +.glyphicon-fast-backward:before { + content: "\e070"; +} +.glyphicon-backward:before { + content: "\e071"; +} +.glyphicon-play:before { + content: "\e072"; +} +.glyphicon-pause:before { + content: "\e073"; +} +.glyphicon-stop:before { + content: "\e074"; +} +.glyphicon-forward:before { + content: "\e075"; +} +.glyphicon-fast-forward:before { + content: "\e076"; +} +.glyphicon-step-forward:before { + content: "\e077"; +} +.glyphicon-eject:before { + content: "\e078"; +} +.glyphicon-chevron-left:before { + content: "\e079"; +} +.glyphicon-chevron-right:before { + content: "\e080"; +} +.glyphicon-plus-sign:before { + content: "\e081"; +} +.glyphicon-minus-sign:before { + content: "\e082"; +} +.glyphicon-remove-sign:before { + content: "\e083"; +} +.glyphicon-ok-sign:before { + content: "\e084"; +} +.glyphicon-question-sign:before { + content: "\e085"; +} +.glyphicon-info-sign:before { + content: "\e086"; +} +.glyphicon-screenshot:before { + content: "\e087"; +} +.glyphicon-remove-circle:before { + content: "\e088"; +} +.glyphicon-ok-circle:before { + content: "\e089"; +} +.glyphicon-ban-circle:before { + content: "\e090"; +} +.glyphicon-arrow-left:before { + content: "\e091"; +} +.glyphicon-arrow-right:before { + content: "\e092"; +} +.glyphicon-arrow-up:before { + content: "\e093"; +} +.glyphicon-arrow-down:before { + content: "\e094"; +} +.glyphicon-share-alt:before { + content: "\e095"; +} +.glyphicon-resize-full:before { + content: "\e096"; +} +.glyphicon-resize-small:before { + content: "\e097"; +} +.glyphicon-exclamation-sign:before { + content: "\e101"; +} +.glyphicon-gift:before { + content: "\e102"; +} +.glyphicon-leaf:before { + content: "\e103"; +} +.glyphicon-fire:before { + content: "\e104"; +} +.glyphicon-eye-open:before { + content: "\e105"; +} +.glyphicon-eye-close:before { + content: "\e106"; +} +.glyphicon-warning-sign:before { + content: "\e107"; +} +.glyphicon-plane:before { + content: "\e108"; +} +.glyphicon-calendar:before { + content: "\e109"; +} +.glyphicon-random:before { + content: "\e110"; +} +.glyphicon-comment:before { + content: "\e111"; +} +.glyphicon-magnet:before { + content: "\e112"; +} +.glyphicon-chevron-up:before { + content: "\e113"; +} +.glyphicon-chevron-down:before { + content: "\e114"; +} +.glyphicon-retweet:before { + content: "\e115"; +} +.glyphicon-shopping-cart:before { + content: "\e116"; +} +.glyphicon-folder-close:before { + content: "\e117"; +} +.glyphicon-folder-open:before { + content: "\e118"; +} +.glyphicon-resize-vertical:before { + content: "\e119"; +} +.glyphicon-resize-horizontal:before { + content: "\e120"; +} +.glyphicon-hdd:before { + content: "\e121"; +} +.glyphicon-bullhorn:before { + content: "\e122"; +} +.glyphicon-bell:before { + content: "\e123"; +} +.glyphicon-certificate:before { + content: "\e124"; +} +.glyphicon-thumbs-up:before { + content: "\e125"; +} +.glyphicon-thumbs-down:before { + content: "\e126"; +} +.glyphicon-hand-right:before { + content: "\e127"; +} +.glyphicon-hand-left:before { + content: "\e128"; +} +.glyphicon-hand-up:before { + content: "\e129"; +} +.glyphicon-hand-down:before { + content: "\e130"; +} +.glyphicon-circle-arrow-right:before { + content: "\e131"; +} +.glyphicon-circle-arrow-left:before { + content: "\e132"; +} +.glyphicon-circle-arrow-up:before { + content: "\e133"; +} +.glyphicon-circle-arrow-down:before { + content: "\e134"; +} +.glyphicon-globe:before { + content: "\e135"; +} +.glyphicon-wrench:before { + content: "\e136"; +} +.glyphicon-tasks:before { + content: "\e137"; +} +.glyphicon-filter:before { + content: "\e138"; +} +.glyphicon-briefcase:before { + content: "\e139"; +} +.glyphicon-fullscreen:before { + content: "\e140"; +} +.glyphicon-dashboard:before { + content: "\e141"; +} +.glyphicon-paperclip:before { + content: "\e142"; +} +.glyphicon-heart-empty:before { + content: "\e143"; +} +.glyphicon-link:before { + content: "\e144"; +} +.glyphicon-phone:before { + content: "\e145"; +} +.glyphicon-pushpin:before { + content: "\e146"; +} +.glyphicon-usd:before { + content: "\e148"; +} +.glyphicon-gbp:before { + content: "\e149"; +} +.glyphicon-sort:before { + content: "\e150"; +} +.glyphicon-sort-by-alphabet:before { + content: "\e151"; +} +.glyphicon-sort-by-alphabet-alt:before { + content: "\e152"; +} +.glyphicon-sort-by-order:before { + content: "\e153"; +} +.glyphicon-sort-by-order-alt:before { + content: "\e154"; +} +.glyphicon-sort-by-attributes:before { + content: "\e155"; +} +.glyphicon-sort-by-attributes-alt:before { + content: "\e156"; +} +.glyphicon-unchecked:before { + content: "\e157"; +} +.glyphicon-expand:before { + content: "\e158"; +} +.glyphicon-collapse-down:before { + content: "\e159"; +} +.glyphicon-collapse-up:before { + content: "\e160"; +} +.glyphicon-log-in:before { + content: "\e161"; +} +.glyphicon-flash:before { + content: "\e162"; +} +.glyphicon-log-out:before { + content: "\e163"; +} +.glyphicon-new-window:before { + content: "\e164"; +} +.glyphicon-record:before { + content: "\e165"; +} +.glyphicon-save:before { + content: "\e166"; +} +.glyphicon-open:before { + content: "\e167"; +} +.glyphicon-saved:before { + content: "\e168"; +} +.glyphicon-import:before { + content: "\e169"; +} +.glyphicon-export:before { + content: "\e170"; +} +.glyphicon-send:before { + content: "\e171"; +} +.glyphicon-floppy-disk:before { + content: "\e172"; +} +.glyphicon-floppy-saved:before { + content: "\e173"; +} +.glyphicon-floppy-remove:before { + content: "\e174"; +} +.glyphicon-floppy-save:before { + content: "\e175"; +} +.glyphicon-floppy-open:before { + content: "\e176"; +} +.glyphicon-credit-card:before { + content: "\e177"; +} +.glyphicon-transfer:before { + content: "\e178"; +} +.glyphicon-cutlery:before { + content: "\e179"; +} +.glyphicon-header:before { + content: "\e180"; +} +.glyphicon-compressed:before { + content: "\e181"; +} +.glyphicon-earphone:before { + content: "\e182"; +} +.glyphicon-phone-alt:before { + content: "\e183"; +} +.glyphicon-tower:before { + content: "\e184"; +} +.glyphicon-stats:before { + content: "\e185"; +} +.glyphicon-sd-video:before { + content: "\e186"; +} +.glyphicon-hd-video:before { + content: "\e187"; +} +.glyphicon-subtitles:before { + content: "\e188"; +} +.glyphicon-sound-stereo:before { + content: "\e189"; +} +.glyphicon-sound-dolby:before { + content: "\e190"; +} +.glyphicon-sound-5-1:before { + content: "\e191"; +} +.glyphicon-sound-6-1:before { + content: "\e192"; +} +.glyphicon-sound-7-1:before { + content: "\e193"; +} +.glyphicon-copyright-mark:before { + content: "\e194"; +} +.glyphicon-registration-mark:before { + content: "\e195"; +} +.glyphicon-cloud-download:before { + content: "\e197"; +} +.glyphicon-cloud-upload:before { + content: "\e198"; +} +.glyphicon-tree-conifer:before { + content: "\e199"; +} +.glyphicon-tree-deciduous:before { + content: "\e200"; +} +.glyphicon-cd:before { + content: "\e201"; +} +.glyphicon-save-file:before { + content: "\e202"; +} +.glyphicon-open-file:before { + content: "\e203"; +} +.glyphicon-level-up:before { + content: "\e204"; +} +.glyphicon-copy:before { + content: "\e205"; +} +.glyphicon-paste:before { + content: "\e206"; +} +.glyphicon-alert:before { + content: "\e209"; +} +.glyphicon-equalizer:before { + content: "\e210"; +} +.glyphicon-king:before { + content: "\e211"; +} +.glyphicon-queen:before { + content: "\e212"; +} +.glyphicon-pawn:before { + content: "\e213"; +} +.glyphicon-bishop:before { + content: "\e214"; +} +.glyphicon-knight:before { + content: "\e215"; +} +.glyphicon-baby-formula:before { + content: "\e216"; +} +.glyphicon-tent:before { + content: "\26fa"; +} +.glyphicon-blackboard:before { + content: "\e218"; +} +.glyphicon-bed:before { + content: "\e219"; +} +.glyphicon-apple:before { + content: "\f8ff"; +} +.glyphicon-erase:before { + content: "\e221"; +} +.glyphicon-hourglass:before { + content: "\231b"; +} +.glyphicon-lamp:before { + content: "\e223"; +} +.glyphicon-duplicate:before { + content: "\e224"; +} +.glyphicon-piggy-bank:before { + content: "\e225"; +} +.glyphicon-scissors:before { + content: "\e226"; +} +.glyphicon-bitcoin:before { + content: "\e227"; +} +.glyphicon-btc:before { + content: "\e227"; +} +.glyphicon-xbt:before { + content: "\e227"; +} +.glyphicon-yen:before { + content: "\00a5"; +} +.glyphicon-jpy:before { + content: "\00a5"; +} +.glyphicon-ruble:before { + content: "\20bd"; +} +.glyphicon-rub:before { + content: "\20bd"; +} +.glyphicon-scale:before { + content: "\e230"; +} +.glyphicon-ice-lolly:before { + content: "\e231"; +} +.glyphicon-ice-lolly-tasted:before { + content: "\e232"; +} +.glyphicon-education:before { + content: "\e233"; +} +.glyphicon-option-horizontal:before { + content: "\e234"; +} +.glyphicon-option-vertical:before { + content: "\e235"; +} +.glyphicon-menu-hamburger:before { + content: "\e236"; +} +.glyphicon-modal-window:before { + content: "\e237"; +} +.glyphicon-oil:before { + content: "\e238"; +} +.glyphicon-grain:before { + content: "\e239"; +} +.glyphicon-sunglasses:before { + content: "\e240"; +} +.glyphicon-text-size:before { + content: "\e241"; +} +.glyphicon-text-color:before { + content: "\e242"; +} +.glyphicon-text-background:before { + content: "\e243"; +} +.glyphicon-object-align-top:before { + content: "\e244"; +} +.glyphicon-object-align-bottom:before { + content: "\e245"; +} +.glyphicon-object-align-horizontal:before { + content: "\e246"; +} +.glyphicon-object-align-left:before { + content: "\e247"; +} +.glyphicon-object-align-vertical:before { + content: "\e248"; +} +.glyphicon-object-align-right:before { + content: "\e249"; +} +.glyphicon-triangle-right:before { + content: "\e250"; +} +.glyphicon-triangle-left:before { + content: "\e251"; +} +.glyphicon-triangle-bottom:before { + content: "\e252"; +} +.glyphicon-triangle-top:before { + content: "\e253"; +} +.glyphicon-console:before { + content: "\e254"; +} +.glyphicon-superscript:before { + content: "\e255"; +} +.glyphicon-subscript:before { + content: "\e256"; +} +.glyphicon-menu-left:before { + content: "\e257"; +} +.glyphicon-menu-right:before { + content: "\e258"; +} +.glyphicon-menu-down:before { + content: "\e259"; +} +.glyphicon-menu-up:before { + content: "\e260"; +} +* { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +*:before, +*:after { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +html { + font-size: 10px; + + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); +} +body { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 14px; + line-height: 1.42857143; + color: #333; + background-color: #fff; +} +input, +button, +select, +textarea { + font-family: inherit; + font-size: inherit; + line-height: inherit; +} +a { + color: #337ab7; + text-decoration: none; +} +a:hover, +a:focus { + color: #23527c; + text-decoration: underline; +} +a:focus { + outline: thin dotted; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; +} +figure { + margin: 0; +} +img { + vertical-align: middle; +} +.img-responsive, +.thumbnail > img, +.thumbnail a > img, +.carousel-inner > .item > img, +.carousel-inner > .item > a > img { + display: block; + max-width: 100%; + height: auto; +} +.img-rounded { + border-radius: 6px; +} +.img-thumbnail { + display: inline-block; + max-width: 100%; + height: auto; + padding: 4px; + line-height: 1.42857143; + background-color: #fff; + border: 1px solid #ddd; + border-radius: 4px; + -webkit-transition: all .2s ease-in-out; + -o-transition: all .2s ease-in-out; + transition: all .2s ease-in-out; +} +.img-circle { + border-radius: 50%; +} +hr { + margin-top: 20px; + margin-bottom: 20px; + border: 0; + border-top: 1px solid #eee; +} +.sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + border: 0; +} +.sr-only-focusable:active, +.sr-only-focusable:focus { + position: static; + width: auto; + height: auto; + margin: 0; + overflow: visible; + clip: auto; +} +[role="button"] { + cursor: pointer; +} +h1, +h2, +h3, +h4, +h5, +h6, +.h1, +.h2, +.h3, +.h4, +.h5, +.h6 { + font-family: inherit; + font-weight: 500; + line-height: 1.1; + color: inherit; +} +h1 small, +h2 small, +h3 small, +h4 small, +h5 small, +h6 small, +.h1 small, +.h2 small, +.h3 small, +.h4 small, +.h5 small, +.h6 small, +h1 .small, +h2 .small, +h3 .small, +h4 .small, +h5 .small, +h6 .small, +.h1 .small, +.h2 .small, +.h3 .small, +.h4 .small, +.h5 .small, +.h6 .small { + font-weight: normal; + line-height: 1; + color: #777; +} +h1, +.h1, +h2, +.h2, +h3, +.h3 { + margin-top: 20px; + margin-bottom: 10px; +} +h1 small, +.h1 small, +h2 small, +.h2 small, +h3 small, +.h3 small, +h1 .small, +.h1 .small, +h2 .small, +.h2 .small, +h3 .small, +.h3 .small { + font-size: 65%; +} +h4, +.h4, +h5, +.h5, +h6, +.h6 { + margin-top: 10px; + margin-bottom: 10px; +} +h4 small, +.h4 small, +h5 small, +.h5 small, +h6 small, +.h6 small, +h4 .small, +.h4 .small, +h5 .small, +.h5 .small, +h6 .small, +.h6 .small { + font-size: 75%; +} +h1, +.h1 { + font-size: 36px; +} +h2, +.h2 { + font-size: 30px; +} +h3, +.h3 { + font-size: 24px; +} +h4, +.h4 { + font-size: 18px; +} +h5, +.h5 { + font-size: 14px; +} +h6, +.h6 { + font-size: 12px; +} +p { + margin: 0 0 10px; +} +.lead { + margin-bottom: 20px; + font-size: 16px; + font-weight: 300; + line-height: 1.4; +} +@media (min-width: 768px) { + .lead { + font-size: 21px; + } +} +small, +.small { + font-size: 85%; +} +mark, +.mark { + padding: .2em; + background-color: #fcf8e3; +} +.text-left { + text-align: left; +} +.text-right { + text-align: right; +} +.text-center { + text-align: center; +} +.text-justify { + text-align: justify; +} +.text-nowrap { + white-space: nowrap; +} +.text-lowercase { + text-transform: lowercase; +} +.text-uppercase { + text-transform: uppercase; +} +.text-capitalize { + text-transform: capitalize; +} +.text-muted { + color: #777; +} +.text-primary { + color: #337ab7; +} +a.text-primary:hover { + color: #286090; +} +.text-success { + color: #3c763d; +} +a.text-success:hover { + color: #2b542c; +} +.text-info { + color: #31708f; +} +a.text-info:hover { + color: #245269; +} +.text-warning { + color: #8a6d3b; +} +a.text-warning:hover { + color: #66512c; +} +.text-danger { + color: #a94442; +} +a.text-danger:hover { + color: #843534; +} +.bg-primary { + color: #fff; + background-color: #337ab7; +} +a.bg-primary:hover { + background-color: #286090; +} +.bg-success { + background-color: #dff0d8; +} +a.bg-success:hover { + background-color: #c1e2b3; +} +.bg-info { + background-color: #d9edf7; +} +a.bg-info:hover { + background-color: #afd9ee; +} +.bg-warning { + background-color: #fcf8e3; +} +a.bg-warning:hover { + background-color: #f7ecb5; +} +.bg-danger { + background-color: #f2dede; +} +a.bg-danger:hover { + background-color: #e4b9b9; +} +.page-header { + padding-bottom: 9px; + margin: 40px 0 20px; + border-bottom: 1px solid #eee; +} +ul, +ol { + margin-top: 0; + margin-bottom: 10px; +} +ul ul, +ol ul, +ul ol, +ol ol { + margin-bottom: 0; +} +.list-unstyled { + padding-left: 0; + list-style: none; +} +.list-inline { + padding-left: 0; + margin-left: -5px; + list-style: none; +} +.list-inline > li { + display: inline-block; + padding-right: 5px; + padding-left: 5px; +} +dl { + margin-top: 0; + margin-bottom: 20px; +} +dt, +dd { + line-height: 1.42857143; +} +dt { + font-weight: bold; +} +dd { + margin-left: 0; +} +@media (min-width: 768px) { + .dl-horizontal dt { + float: left; + width: 160px; + overflow: hidden; + clear: left; + text-align: right; + text-overflow: ellipsis; + white-space: nowrap; + } + .dl-horizontal dd { + margin-left: 180px; + } +} +abbr[title], +abbr[data-original-title] { + cursor: help; + border-bottom: 1px dotted #777; +} +.initialism { + font-size: 90%; + text-transform: uppercase; +} +blockquote { + padding: 10px 20px; + margin: 0 0 20px; + font-size: 17.5px; + border-left: 5px solid #eee; +} +blockquote p:last-child, +blockquote ul:last-child, +blockquote ol:last-child { + margin-bottom: 0; +} +blockquote footer, +blockquote small, +blockquote .small { + display: block; + font-size: 80%; + line-height: 1.42857143; + color: #777; +} +blockquote footer:before, +blockquote small:before, +blockquote .small:before { + content: '\2014 \00A0'; +} +.blockquote-reverse, +blockquote.pull-right { + padding-right: 15px; + padding-left: 0; + text-align: right; + border-right: 5px solid #eee; + border-left: 0; +} +.blockquote-reverse footer:before, +blockquote.pull-right footer:before, +.blockquote-reverse small:before, +blockquote.pull-right small:before, +.blockquote-reverse .small:before, +blockquote.pull-right .small:before { + content: ''; +} +.blockquote-reverse footer:after, +blockquote.pull-right footer:after, +.blockquote-reverse small:after, +blockquote.pull-right small:after, +.blockquote-reverse .small:after, +blockquote.pull-right .small:after { + content: '\00A0 \2014'; +} +address { + margin-bottom: 20px; + font-style: normal; + line-height: 1.42857143; +} +code, +kbd, +pre, +samp { + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; +} +code { + padding: 2px 4px; + font-size: 90%; + color: #c7254e; + background-color: #f9f2f4; + border-radius: 4px; +} +kbd { + padding: 2px 4px; + font-size: 90%; + color: #fff; + background-color: #333; + border-radius: 3px; + -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25); + box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25); +} +kbd kbd { + padding: 0; + font-size: 100%; + font-weight: bold; + -webkit-box-shadow: none; + box-shadow: none; +} +pre { + display: block; + padding: 9.5px; + margin: 0 0 10px; + font-size: 13px; + line-height: 1.42857143; + color: #333; + word-break: break-all; + word-wrap: break-word; + background-color: #f5f5f5; + border: 1px solid #ccc; + border-radius: 4px; +} +pre code { + padding: 0; + font-size: inherit; + color: inherit; + white-space: pre-wrap; + background-color: transparent; + border-radius: 0; +} +.pre-scrollable { + max-height: 340px; + overflow-y: scroll; +} +.container { + padding-right: 15px; + padding-left: 15px; + margin-right: auto; + margin-left: auto; +} +@media (min-width: 768px) { + .container { + width: 750px; + } +} +@media (min-width: 992px) { + .container { + width: 970px; + } +} +@media (min-width: 1200px) { + .container { + width: 1170px; + } +} +.container-fluid { + padding-right: 15px; + padding-left: 15px; + margin-right: auto; + margin-left: auto; +} +.row { + margin-right: -15px; + margin-left: -15px; +} +.col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 { + position: relative; + min-height: 1px; + padding-right: 15px; + padding-left: 15px; +} +.col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 { + float: left; +} +.col-xs-12 { + width: 100%; +} +.col-xs-11 { + width: 91.66666667%; +} +.col-xs-10 { + width: 83.33333333%; +} +.col-xs-9 { + width: 75%; +} +.col-xs-8 { + width: 66.66666667%; +} +.col-xs-7 { + width: 58.33333333%; +} +.col-xs-6 { + width: 50%; +} +.col-xs-5 { + width: 41.66666667%; +} +.col-xs-4 { + width: 33.33333333%; +} +.col-xs-3 { + width: 25%; +} +.col-xs-2 { + width: 16.66666667%; +} +.col-xs-1 { + width: 8.33333333%; +} +.col-xs-pull-12 { + right: 100%; +} +.col-xs-pull-11 { + right: 91.66666667%; +} +.col-xs-pull-10 { + right: 83.33333333%; +} +.col-xs-pull-9 { + right: 75%; +} +.col-xs-pull-8 { + right: 66.66666667%; +} +.col-xs-pull-7 { + right: 58.33333333%; +} +.col-xs-pull-6 { + right: 50%; +} +.col-xs-pull-5 { + right: 41.66666667%; +} +.col-xs-pull-4 { + right: 33.33333333%; +} +.col-xs-pull-3 { + right: 25%; +} +.col-xs-pull-2 { + right: 16.66666667%; +} +.col-xs-pull-1 { + right: 8.33333333%; +} +.col-xs-pull-0 { + right: auto; +} +.col-xs-push-12 { + left: 100%; +} +.col-xs-push-11 { + left: 91.66666667%; +} +.col-xs-push-10 { + left: 83.33333333%; +} +.col-xs-push-9 { + left: 75%; +} +.col-xs-push-8 { + left: 66.66666667%; +} +.col-xs-push-7 { + left: 58.33333333%; +} +.col-xs-push-6 { + left: 50%; +} +.col-xs-push-5 { + left: 41.66666667%; +} +.col-xs-push-4 { + left: 33.33333333%; +} +.col-xs-push-3 { + left: 25%; +} +.col-xs-push-2 { + left: 16.66666667%; +} +.col-xs-push-1 { + left: 8.33333333%; +} +.col-xs-push-0 { + left: auto; +} +.col-xs-offset-12 { + margin-left: 100%; +} +.col-xs-offset-11 { + margin-left: 91.66666667%; +} +.col-xs-offset-10 { + margin-left: 83.33333333%; +} +.col-xs-offset-9 { + margin-left: 75%; +} +.col-xs-offset-8 { + margin-left: 66.66666667%; +} +.col-xs-offset-7 { + margin-left: 58.33333333%; +} +.col-xs-offset-6 { + margin-left: 50%; +} +.col-xs-offset-5 { + margin-left: 41.66666667%; +} +.col-xs-offset-4 { + margin-left: 33.33333333%; +} +.col-xs-offset-3 { + margin-left: 25%; +} +.col-xs-offset-2 { + margin-left: 16.66666667%; +} +.col-xs-offset-1 { + margin-left: 8.33333333%; +} +.col-xs-offset-0 { + margin-left: 0; +} +@media (min-width: 768px) { + .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 { + float: left; + } + .col-sm-12 { + width: 100%; + } + .col-sm-11 { + width: 91.66666667%; + } + .col-sm-10 { + width: 83.33333333%; + } + .col-sm-9 { + width: 75%; + } + .col-sm-8 { + width: 66.66666667%; + } + .col-sm-7 { + width: 58.33333333%; + } + .col-sm-6 { + width: 50%; + } + .col-sm-5 { + width: 41.66666667%; + } + .col-sm-4 { + width: 33.33333333%; + } + .col-sm-3 { + width: 25%; + } + .col-sm-2 { + width: 16.66666667%; + } + .col-sm-1 { + width: 8.33333333%; + } + .col-sm-pull-12 { + right: 100%; + } + .col-sm-pull-11 { + right: 91.66666667%; + } + .col-sm-pull-10 { + right: 83.33333333%; + } + .col-sm-pull-9 { + right: 75%; + } + .col-sm-pull-8 { + right: 66.66666667%; + } + .col-sm-pull-7 { + right: 58.33333333%; + } + .col-sm-pull-6 { + right: 50%; + } + .col-sm-pull-5 { + right: 41.66666667%; + } + .col-sm-pull-4 { + right: 33.33333333%; + } + .col-sm-pull-3 { + right: 25%; + } + .col-sm-pull-2 { + right: 16.66666667%; + } + .col-sm-pull-1 { + right: 8.33333333%; + } + .col-sm-pull-0 { + right: auto; + } + .col-sm-push-12 { + left: 100%; + } + .col-sm-push-11 { + left: 91.66666667%; + } + .col-sm-push-10 { + left: 83.33333333%; + } + .col-sm-push-9 { + left: 75%; + } + .col-sm-push-8 { + left: 66.66666667%; + } + .col-sm-push-7 { + left: 58.33333333%; + } + .col-sm-push-6 { + left: 50%; + } + .col-sm-push-5 { + left: 41.66666667%; + } + .col-sm-push-4 { + left: 33.33333333%; + } + .col-sm-push-3 { + left: 25%; + } + .col-sm-push-2 { + left: 16.66666667%; + } + .col-sm-push-1 { + left: 8.33333333%; + } + .col-sm-push-0 { + left: auto; + } + .col-sm-offset-12 { + margin-left: 100%; + } + .col-sm-offset-11 { + margin-left: 91.66666667%; + } + .col-sm-offset-10 { + margin-left: 83.33333333%; + } + .col-sm-offset-9 { + margin-left: 75%; + } + .col-sm-offset-8 { + margin-left: 66.66666667%; + } + .col-sm-offset-7 { + margin-left: 58.33333333%; + } + .col-sm-offset-6 { + margin-left: 50%; + } + .col-sm-offset-5 { + margin-left: 41.66666667%; + } + .col-sm-offset-4 { + margin-left: 33.33333333%; + } + .col-sm-offset-3 { + margin-left: 25%; + } + .col-sm-offset-2 { + margin-left: 16.66666667%; + } + .col-sm-offset-1 { + margin-left: 8.33333333%; + } + .col-sm-offset-0 { + margin-left: 0; + } +} +@media (min-width: 992px) { + .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 { + float: left; + } + .col-md-12 { + width: 100%; + } + .col-md-11 { + width: 91.66666667%; + } + .col-md-10 { + width: 83.33333333%; + } + .col-md-9 { + width: 75%; + } + .col-md-8 { + width: 66.66666667%; + } + .col-md-7 { + width: 58.33333333%; + } + .col-md-6 { + width: 50%; + } + .col-md-5 { + width: 41.66666667%; + } + .col-md-4 { + width: 33.33333333%; + } + .col-md-3 { + width: 25%; + } + .col-md-2 { + width: 16.66666667%; + } + .col-md-1 { + width: 8.33333333%; + } + .col-md-pull-12 { + right: 100%; + } + .col-md-pull-11 { + right: 91.66666667%; + } + .col-md-pull-10 { + right: 83.33333333%; + } + .col-md-pull-9 { + right: 75%; + } + .col-md-pull-8 { + right: 66.66666667%; + } + .col-md-pull-7 { + right: 58.33333333%; + } + .col-md-pull-6 { + right: 50%; + } + .col-md-pull-5 { + right: 41.66666667%; + } + .col-md-pull-4 { + right: 33.33333333%; + } + .col-md-pull-3 { + right: 25%; + } + .col-md-pull-2 { + right: 16.66666667%; + } + .col-md-pull-1 { + right: 8.33333333%; + } + .col-md-pull-0 { + right: auto; + } + .col-md-push-12 { + left: 100%; + } + .col-md-push-11 { + left: 91.66666667%; + } + .col-md-push-10 { + left: 83.33333333%; + } + .col-md-push-9 { + left: 75%; + } + .col-md-push-8 { + left: 66.66666667%; + } + .col-md-push-7 { + left: 58.33333333%; + } + .col-md-push-6 { + left: 50%; + } + .col-md-push-5 { + left: 41.66666667%; + } + .col-md-push-4 { + left: 33.33333333%; + } + .col-md-push-3 { + left: 25%; + } + .col-md-push-2 { + left: 16.66666667%; + } + .col-md-push-1 { + left: 8.33333333%; + } + .col-md-push-0 { + left: auto; + } + .col-md-offset-12 { + margin-left: 100%; + } + .col-md-offset-11 { + margin-left: 91.66666667%; + } + .col-md-offset-10 { + margin-left: 83.33333333%; + } + .col-md-offset-9 { + margin-left: 75%; + } + .col-md-offset-8 { + margin-left: 66.66666667%; + } + .col-md-offset-7 { + margin-left: 58.33333333%; + } + .col-md-offset-6 { + margin-left: 50%; + } + .col-md-offset-5 { + margin-left: 41.66666667%; + } + .col-md-offset-4 { + margin-left: 33.33333333%; + } + .col-md-offset-3 { + margin-left: 25%; + } + .col-md-offset-2 { + margin-left: 16.66666667%; + } + .col-md-offset-1 { + margin-left: 8.33333333%; + } + .col-md-offset-0 { + margin-left: 0; + } +} +@media (min-width: 1200px) { + .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 { + float: left; + } + .col-lg-12 { + width: 100%; + } + .col-lg-11 { + width: 91.66666667%; + } + .col-lg-10 { + width: 83.33333333%; + } + .col-lg-9 { + width: 75%; + } + .col-lg-8 { + width: 66.66666667%; + } + .col-lg-7 { + width: 58.33333333%; + } + .col-lg-6 { + width: 50%; + } + .col-lg-5 { + width: 41.66666667%; + } + .col-lg-4 { + width: 33.33333333%; + } + .col-lg-3 { + width: 25%; + } + .col-lg-2 { + width: 16.66666667%; + } + .col-lg-1 { + width: 8.33333333%; + } + .col-lg-pull-12 { + right: 100%; + } + .col-lg-pull-11 { + right: 91.66666667%; + } + .col-lg-pull-10 { + right: 83.33333333%; + } + .col-lg-pull-9 { + right: 75%; + } + .col-lg-pull-8 { + right: 66.66666667%; + } + .col-lg-pull-7 { + right: 58.33333333%; + } + .col-lg-pull-6 { + right: 50%; + } + .col-lg-pull-5 { + right: 41.66666667%; + } + .col-lg-pull-4 { + right: 33.33333333%; + } + .col-lg-pull-3 { + right: 25%; + } + .col-lg-pull-2 { + right: 16.66666667%; + } + .col-lg-pull-1 { + right: 8.33333333%; + } + .col-lg-pull-0 { + right: auto; + } + .col-lg-push-12 { + left: 100%; + } + .col-lg-push-11 { + left: 91.66666667%; + } + .col-lg-push-10 { + left: 83.33333333%; + } + .col-lg-push-9 { + left: 75%; + } + .col-lg-push-8 { + left: 66.66666667%; + } + .col-lg-push-7 { + left: 58.33333333%; + } + .col-lg-push-6 { + left: 50%; + } + .col-lg-push-5 { + left: 41.66666667%; + } + .col-lg-push-4 { + left: 33.33333333%; + } + .col-lg-push-3 { + left: 25%; + } + .col-lg-push-2 { + left: 16.66666667%; + } + .col-lg-push-1 { + left: 8.33333333%; + } + .col-lg-push-0 { + left: auto; + } + .col-lg-offset-12 { + margin-left: 100%; + } + .col-lg-offset-11 { + margin-left: 91.66666667%; + } + .col-lg-offset-10 { + margin-left: 83.33333333%; + } + .col-lg-offset-9 { + margin-left: 75%; + } + .col-lg-offset-8 { + margin-left: 66.66666667%; + } + .col-lg-offset-7 { + margin-left: 58.33333333%; + } + .col-lg-offset-6 { + margin-left: 50%; + } + .col-lg-offset-5 { + margin-left: 41.66666667%; + } + .col-lg-offset-4 { + margin-left: 33.33333333%; + } + .col-lg-offset-3 { + margin-left: 25%; + } + .col-lg-offset-2 { + margin-left: 16.66666667%; + } + .col-lg-offset-1 { + margin-left: 8.33333333%; + } + .col-lg-offset-0 { + margin-left: 0; + } +} +table { + background-color: transparent; +} +caption { + padding-top: 8px; + padding-bottom: 8px; + color: #777; + text-align: left; +} +th { + text-align: left; +} +.table { + width: 100%; + max-width: 100%; + margin-bottom: 20px; +} +.table > thead > tr > th, +.table > tbody > tr > th, +.table > tfoot > tr > th, +.table > thead > tr > td, +.table > tbody > tr > td, +.table > tfoot > tr > td { + padding: 8px; + line-height: 1.42857143; + vertical-align: top; + border-top: 1px solid #ddd; +} +.table > thead > tr > th { + vertical-align: bottom; + border-bottom: 2px solid #ddd; +} +.table > caption + thead > tr:first-child > th, +.table > colgroup + thead > tr:first-child > th, +.table > thead:first-child > tr:first-child > th, +.table > caption + thead > tr:first-child > td, +.table > colgroup + thead > tr:first-child > td, +.table > thead:first-child > tr:first-child > td { + border-top: 0; +} +.table > tbody + tbody { + border-top: 2px solid #ddd; +} +.table .table { + background-color: #fff; +} +.table-condensed > thead > tr > th, +.table-condensed > tbody > tr > th, +.table-condensed > tfoot > tr > th, +.table-condensed > thead > tr > td, +.table-condensed > tbody > tr > td, +.table-condensed > tfoot > tr > td { + padding: 5px; +} +.table-bordered { + border: 1px solid #ddd; +} +.table-bordered > thead > tr > th, +.table-bordered > tbody > tr > th, +.table-bordered > tfoot > tr > th, +.table-bordered > thead > tr > td, +.table-bordered > tbody > tr > td, +.table-bordered > tfoot > tr > td { + border: 1px solid #ddd; +} +.table-bordered > thead > tr > th, +.table-bordered > thead > tr > td { + border-bottom-width: 2px; +} +.table-striped > tbody > tr:nth-of-type(odd) { + background-color: #f9f9f9; +} +.table-hover > tbody > tr:hover { + background-color: #f5f5f5; +} +table col[class*="col-"] { + position: static; + display: table-column; + float: none; +} +table td[class*="col-"], +table th[class*="col-"] { + position: static; + display: table-cell; + float: none; +} +.table > thead > tr > td.active, +.table > tbody > tr > td.active, +.table > tfoot > tr > td.active, +.table > thead > tr > th.active, +.table > tbody > tr > th.active, +.table > tfoot > tr > th.active, +.table > thead > tr.active > td, +.table > tbody > tr.active > td, +.table > tfoot > tr.active > td, +.table > thead > tr.active > th, +.table > tbody > tr.active > th, +.table > tfoot > tr.active > th { + background-color: #f5f5f5; +} +.table-hover > tbody > tr > td.active:hover, +.table-hover > tbody > tr > th.active:hover, +.table-hover > tbody > tr.active:hover > td, +.table-hover > tbody > tr:hover > .active, +.table-hover > tbody > tr.active:hover > th { + background-color: #e8e8e8; +} +.table > thead > tr > td.success, +.table > tbody > tr > td.success, +.table > tfoot > tr > td.success, +.table > thead > tr > th.success, +.table > tbody > tr > th.success, +.table > tfoot > tr > th.success, +.table > thead > tr.success > td, +.table > tbody > tr.success > td, +.table > tfoot > tr.success > td, +.table > thead > tr.success > th, +.table > tbody > tr.success > th, +.table > tfoot > tr.success > th { + background-color: #dff0d8; +} +.table-hover > tbody > tr > td.success:hover, +.table-hover > tbody > tr > th.success:hover, +.table-hover > tbody > tr.success:hover > td, +.table-hover > tbody > tr:hover > .success, +.table-hover > tbody > tr.success:hover > th { + background-color: #d0e9c6; +} +.table > thead > tr > td.info, +.table > tbody > tr > td.info, +.table > tfoot > tr > td.info, +.table > thead > tr > th.info, +.table > tbody > tr > th.info, +.table > tfoot > tr > th.info, +.table > thead > tr.info > td, +.table > tbody > tr.info > td, +.table > tfoot > tr.info > td, +.table > thead > tr.info > th, +.table > tbody > tr.info > th, +.table > tfoot > tr.info > th { + background-color: #d9edf7; +} +.table-hover > tbody > tr > td.info:hover, +.table-hover > tbody > tr > th.info:hover, +.table-hover > tbody > tr.info:hover > td, +.table-hover > tbody > tr:hover > .info, +.table-hover > tbody > tr.info:hover > th { + background-color: #c4e3f3; +} +.table > thead > tr > td.warning, +.table > tbody > tr > td.warning, +.table > tfoot > tr > td.warning, +.table > thead > tr > th.warning, +.table > tbody > tr > th.warning, +.table > tfoot > tr > th.warning, +.table > thead > tr.warning > td, +.table > tbody > tr.warning > td, +.table > tfoot > tr.warning > td, +.table > thead > tr.warning > th, +.table > tbody > tr.warning > th, +.table > tfoot > tr.warning > th { + background-color: #fcf8e3; +} +.table-hover > tbody > tr > td.warning:hover, +.table-hover > tbody > tr > th.warning:hover, +.table-hover > tbody > tr.warning:hover > td, +.table-hover > tbody > tr:hover > .warning, +.table-hover > tbody > tr.warning:hover > th { + background-color: #faf2cc; +} +.table > thead > tr > td.danger, +.table > tbody > tr > td.danger, +.table > tfoot > tr > td.danger, +.table > thead > tr > th.danger, +.table > tbody > tr > th.danger, +.table > tfoot > tr > th.danger, +.table > thead > tr.danger > td, +.table > tbody > tr.danger > td, +.table > tfoot > tr.danger > td, +.table > thead > tr.danger > th, +.table > tbody > tr.danger > th, +.table > tfoot > tr.danger > th { + background-color: #f2dede; +} +.table-hover > tbody > tr > td.danger:hover, +.table-hover > tbody > tr > th.danger:hover, +.table-hover > tbody > tr.danger:hover > td, +.table-hover > tbody > tr:hover > .danger, +.table-hover > tbody > tr.danger:hover > th { + background-color: #ebcccc; +} +.table-responsive { + min-height: .01%; + overflow-x: auto; +} +@media screen and (max-width: 767px) { + .table-responsive { + width: 100%; + margin-bottom: 15px; + overflow-y: hidden; + -ms-overflow-style: -ms-autohiding-scrollbar; + border: 1px solid #ddd; + } + .table-responsive > .table { + margin-bottom: 0; + } + .table-responsive > .table > thead > tr > th, + .table-responsive > .table > tbody > tr > th, + .table-responsive > .table > tfoot > tr > th, + .table-responsive > .table > thead > tr > td, + .table-responsive > .table > tbody > tr > td, + .table-responsive > .table > tfoot > tr > td { + white-space: nowrap; + } + .table-responsive > .table-bordered { + border: 0; + } + .table-responsive > .table-bordered > thead > tr > th:first-child, + .table-responsive > .table-bordered > tbody > tr > th:first-child, + .table-responsive > .table-bordered > tfoot > tr > th:first-child, + .table-responsive > .table-bordered > thead > tr > td:first-child, + .table-responsive > .table-bordered > tbody > tr > td:first-child, + .table-responsive > .table-bordered > tfoot > tr > td:first-child { + border-left: 0; + } + .table-responsive > .table-bordered > thead > tr > th:last-child, + .table-responsive > .table-bordered > tbody > tr > th:last-child, + .table-responsive > .table-bordered > tfoot > tr > th:last-child, + .table-responsive > .table-bordered > thead > tr > td:last-child, + .table-responsive > .table-bordered > tbody > tr > td:last-child, + .table-responsive > .table-bordered > tfoot > tr > td:last-child { + border-right: 0; + } + .table-responsive > .table-bordered > tbody > tr:last-child > th, + .table-responsive > .table-bordered > tfoot > tr:last-child > th, + .table-responsive > .table-bordered > tbody > tr:last-child > td, + .table-responsive > .table-bordered > tfoot > tr:last-child > td { + border-bottom: 0; + } +} +fieldset { + min-width: 0; + padding: 0; + margin: 0; + border: 0; +} +legend { + display: block; + width: 100%; + padding: 0; + margin-bottom: 20px; + font-size: 21px; + line-height: inherit; + color: #333; + border: 0; + border-bottom: 1px solid #e5e5e5; +} +label { + display: inline-block; + max-width: 100%; + margin-bottom: 5px; + font-weight: bold; +} +input[type="search"] { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +input[type="radio"], +input[type="checkbox"] { + margin: 4px 0 0; + margin-top: 1px \9; + line-height: normal; +} +input[type="file"] { + display: block; +} +input[type="range"] { + display: block; + width: 100%; +} +select[multiple], +select[size] { + height: auto; +} +input[type="file"]:focus, +input[type="radio"]:focus, +input[type="checkbox"]:focus { + outline: thin dotted; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; +} +output { + display: block; + padding-top: 7px; + font-size: 14px; + line-height: 1.42857143; + color: #555; +} +.form-control { + display: block; + width: 100%; + height: 34px; + padding: 6px 12px; + font-size: 14px; + line-height: 1.42857143; + color: #555; + background-color: #fff; + background-image: none; + border: 1px solid #ccc; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); + -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s; + -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; + transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; +} +.form-control:focus { + border-color: #66afe9; + outline: 0; + -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6); + box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6); +} +.form-control::-moz-placeholder { + color: #999; + opacity: 1; +} +.form-control:-ms-input-placeholder { + color: #999; +} +.form-control::-webkit-input-placeholder { + color: #999; +} +.form-control[disabled], +.form-control[readonly], +fieldset[disabled] .form-control { + background-color: #eee; + opacity: 1; +} +.form-control[disabled], +fieldset[disabled] .form-control { + cursor: not-allowed; +} +textarea.form-control { + height: auto; +} +input[type="search"] { + -webkit-appearance: none; +} +@media screen and (-webkit-min-device-pixel-ratio: 0) { + input[type="date"], + input[type="time"], + input[type="datetime-local"], + input[type="month"] { + line-height: 34px; + } + input[type="date"].input-sm, + input[type="time"].input-sm, + input[type="datetime-local"].input-sm, + input[type="month"].input-sm, + .input-group-sm input[type="date"], + .input-group-sm input[type="time"], + .input-group-sm input[type="datetime-local"], + .input-group-sm input[type="month"] { + line-height: 30px; + } + input[type="date"].input-lg, + input[type="time"].input-lg, + input[type="datetime-local"].input-lg, + input[type="month"].input-lg, + .input-group-lg input[type="date"], + .input-group-lg input[type="time"], + .input-group-lg input[type="datetime-local"], + .input-group-lg input[type="month"] { + line-height: 46px; + } +} +.form-group { + margin-bottom: 15px; +} +.radio, +.checkbox { + position: relative; + display: block; + margin-top: 10px; + margin-bottom: 10px; +} +.radio label, +.checkbox label { + min-height: 20px; + padding-left: 20px; + margin-bottom: 0; + font-weight: normal; + cursor: pointer; +} +.radio input[type="radio"], +.radio-inline input[type="radio"], +.checkbox input[type="checkbox"], +.checkbox-inline input[type="checkbox"] { + position: absolute; + margin-top: 4px \9; + margin-left: -20px; +} +.radio + .radio, +.checkbox + .checkbox { + margin-top: -5px; +} +.radio-inline, +.checkbox-inline { + position: relative; + display: inline-block; + padding-left: 20px; + margin-bottom: 0; + font-weight: normal; + vertical-align: middle; + cursor: pointer; +} +.radio-inline + .radio-inline, +.checkbox-inline + .checkbox-inline { + margin-top: 0; + margin-left: 10px; +} +input[type="radio"][disabled], +input[type="checkbox"][disabled], +input[type="radio"].disabled, +input[type="checkbox"].disabled, +fieldset[disabled] input[type="radio"], +fieldset[disabled] input[type="checkbox"] { + cursor: not-allowed; +} +.radio-inline.disabled, +.checkbox-inline.disabled, +fieldset[disabled] .radio-inline, +fieldset[disabled] .checkbox-inline { + cursor: not-allowed; +} +.radio.disabled label, +.checkbox.disabled label, +fieldset[disabled] .radio label, +fieldset[disabled] .checkbox label { + cursor: not-allowed; +} +.form-control-static { + min-height: 34px; + padding-top: 7px; + padding-bottom: 7px; + margin-bottom: 0; +} +.form-control-static.input-lg, +.form-control-static.input-sm { + padding-right: 0; + padding-left: 0; +} +.input-sm { + height: 30px; + padding: 5px 10px; + font-size: 12px; + line-height: 1.5; + border-radius: 3px; +} +select.input-sm { + height: 30px; + line-height: 30px; +} +textarea.input-sm, +select[multiple].input-sm { + height: auto; +} +.form-group-sm .form-control { + height: 30px; + padding: 5px 10px; + font-size: 12px; + line-height: 1.5; + border-radius: 3px; +} +select.form-group-sm .form-control { + height: 30px; + line-height: 30px; +} +textarea.form-group-sm .form-control, +select[multiple].form-group-sm .form-control { + height: auto; +} +.form-group-sm .form-control-static { + height: 30px; + min-height: 32px; + padding: 5px 10px; + font-size: 12px; + line-height: 1.5; +} +.input-lg { + height: 46px; + padding: 10px 16px; + font-size: 18px; + line-height: 1.3333333; + border-radius: 6px; +} +select.input-lg { + height: 46px; + line-height: 46px; +} +textarea.input-lg, +select[multiple].input-lg { + height: auto; +} +.form-group-lg .form-control { + height: 46px; + padding: 10px 16px; + font-size: 18px; + line-height: 1.3333333; + border-radius: 6px; +} +select.form-group-lg .form-control { + height: 46px; + line-height: 46px; +} +textarea.form-group-lg .form-control, +select[multiple].form-group-lg .form-control { + height: auto; +} +.form-group-lg .form-control-static { + height: 46px; + min-height: 38px; + padding: 10px 16px; + font-size: 18px; + line-height: 1.3333333; +} +.has-feedback { + position: relative; +} +.has-feedback .form-control { + padding-right: 42.5px; +} +.form-control-feedback { + position: absolute; + top: 0; + right: 0; + z-index: 2; + display: block; + width: 34px; + height: 34px; + line-height: 34px; + text-align: center; + pointer-events: none; +} +.input-lg + .form-control-feedback { + width: 46px; + height: 46px; + line-height: 46px; +} +.input-sm + .form-control-feedback { + width: 30px; + height: 30px; + line-height: 30px; +} +.has-success .help-block, +.has-success .control-label, +.has-success .radio, +.has-success .checkbox, +.has-success .radio-inline, +.has-success .checkbox-inline, +.has-success.radio label, +.has-success.checkbox label, +.has-success.radio-inline label, +.has-success.checkbox-inline label { + color: #3c763d; +} +.has-success .form-control { + border-color: #3c763d; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); +} +.has-success .form-control:focus { + border-color: #2b542c; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #67b168; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #67b168; +} +.has-success .input-group-addon { + color: #3c763d; + background-color: #dff0d8; + border-color: #3c763d; +} +.has-success .form-control-feedback { + color: #3c763d; +} +.has-warning .help-block, +.has-warning .control-label, +.has-warning .radio, +.has-warning .checkbox, +.has-warning .radio-inline, +.has-warning .checkbox-inline, +.has-warning.radio label, +.has-warning.checkbox label, +.has-warning.radio-inline label, +.has-warning.checkbox-inline label { + color: #8a6d3b; +} +.has-warning .form-control { + border-color: #8a6d3b; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); +} +.has-warning .form-control:focus { + border-color: #66512c; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #c0a16b; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #c0a16b; +} +.has-warning .input-group-addon { + color: #8a6d3b; + background-color: #fcf8e3; + border-color: #8a6d3b; +} +.has-warning .form-control-feedback { + color: #8a6d3b; +} +.has-error .help-block, +.has-error .control-label, +.has-error .radio, +.has-error .checkbox, +.has-error .radio-inline, +.has-error .checkbox-inline, +.has-error.radio label, +.has-error.checkbox label, +.has-error.radio-inline label, +.has-error.checkbox-inline label { + color: #a94442; +} +.has-error .form-control { + border-color: #a94442; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); +} +.has-error .form-control:focus { + border-color: #843534; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #ce8483; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #ce8483; +} +.has-error .input-group-addon { + color: #a94442; + background-color: #f2dede; + border-color: #a94442; +} +.has-error .form-control-feedback { + color: #a94442; +} +.has-feedback label ~ .form-control-feedback { + top: 25px; +} +.has-feedback label.sr-only ~ .form-control-feedback { + top: 0; +} +.help-block { + display: block; + margin-top: 5px; + margin-bottom: 10px; + color: #737373; +} +@media (min-width: 768px) { + .form-inline .form-group { + display: inline-block; + margin-bottom: 0; + vertical-align: middle; + } + .form-inline .form-control { + display: inline-block; + width: auto; + vertical-align: middle; + } + .form-inline .form-control-static { + display: inline-block; + } + .form-inline .input-group { + display: inline-table; + vertical-align: middle; + } + .form-inline .input-group .input-group-addon, + .form-inline .input-group .input-group-btn, + .form-inline .input-group .form-control { + width: auto; + } + .form-inline .input-group > .form-control { + width: 100%; + } + .form-inline .control-label { + margin-bottom: 0; + vertical-align: middle; + } + .form-inline .radio, + .form-inline .checkbox { + display: inline-block; + margin-top: 0; + margin-bottom: 0; + vertical-align: middle; + } + .form-inline .radio label, + .form-inline .checkbox label { + padding-left: 0; + } + .form-inline .radio input[type="radio"], + .form-inline .checkbox input[type="checkbox"] { + position: relative; + margin-left: 0; + } + .form-inline .has-feedback .form-control-feedback { + top: 0; + } +} +.form-horizontal .radio, +.form-horizontal .checkbox, +.form-horizontal .radio-inline, +.form-horizontal .checkbox-inline { + padding-top: 7px; + margin-top: 0; + margin-bottom: 0; +} +.form-horizontal .radio, +.form-horizontal .checkbox { + min-height: 27px; +} +.form-horizontal .form-group { + margin-right: -15px; + margin-left: -15px; +} +@media (min-width: 768px) { + .form-horizontal .control-label { + padding-top: 7px; + margin-bottom: 0; + text-align: right; + } +} +.form-horizontal .has-feedback .form-control-feedback { + right: 15px; +} +@media (min-width: 768px) { + .form-horizontal .form-group-lg .control-label { + padding-top: 14.333333px; + } +} +@media (min-width: 768px) { + .form-horizontal .form-group-sm .control-label { + padding-top: 6px; + } +} +.btn { + display: inline-block; + padding: 6px 12px; + margin-bottom: 0; + font-size: 14px; + font-weight: normal; + line-height: 1.42857143; + text-align: center; + white-space: nowrap; + vertical-align: middle; + -ms-touch-action: manipulation; + touch-action: manipulation; + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + background-image: none; + border: 1px solid transparent; + border-radius: 4px; +} +.btn:focus, +.btn:active:focus, +.btn.active:focus, +.btn.focus, +.btn:active.focus, +.btn.active.focus { + outline: thin dotted; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; +} +.btn:hover, +.btn:focus, +.btn.focus { + color: #333; + text-decoration: none; +} +.btn:active, +.btn.active { + background-image: none; + outline: 0; + -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); + box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); +} +.btn.disabled, +.btn[disabled], +fieldset[disabled] .btn { + pointer-events: none; + cursor: not-allowed; + filter: alpha(opacity=65); + -webkit-box-shadow: none; + box-shadow: none; + opacity: .65; +} +.btn-default { + color: #333; + background-color: #fff; + border-color: #ccc; +} +.btn-default:hover, +.btn-default:focus, +.btn-default.focus, +.btn-default:active, +.btn-default.active, +.open > .dropdown-toggle.btn-default { + color: #333; + background-color: #e6e6e6; + border-color: #adadad; +} +.btn-default:active, +.btn-default.active, +.open > .dropdown-toggle.btn-default { + background-image: none; +} +.btn-default.disabled, +.btn-default[disabled], +fieldset[disabled] .btn-default, +.btn-default.disabled:hover, +.btn-default[disabled]:hover, +fieldset[disabled] .btn-default:hover, +.btn-default.disabled:focus, +.btn-default[disabled]:focus, +fieldset[disabled] .btn-default:focus, +.btn-default.disabled.focus, +.btn-default[disabled].focus, +fieldset[disabled] .btn-default.focus, +.btn-default.disabled:active, +.btn-default[disabled]:active, +fieldset[disabled] .btn-default:active, +.btn-default.disabled.active, +.btn-default[disabled].active, +fieldset[disabled] .btn-default.active { + background-color: #fff; + border-color: #ccc; +} +.btn-default .badge { + color: #fff; + background-color: #333; +} +.btn-primary { + color: #fff; + background-color: #337ab7; + border-color: #2e6da4; +} +.btn-primary:hover, +.btn-primary:focus, +.btn-primary.focus, +.btn-primary:active, +.btn-primary.active, +.open > .dropdown-toggle.btn-primary { + color: #fff; + background-color: #286090; + border-color: #204d74; +} +.btn-primary:active, +.btn-primary.active, +.open > .dropdown-toggle.btn-primary { + background-image: none; +} +.btn-primary.disabled, +.btn-primary[disabled], +fieldset[disabled] .btn-primary, +.btn-primary.disabled:hover, +.btn-primary[disabled]:hover, +fieldset[disabled] .btn-primary:hover, +.btn-primary.disabled:focus, +.btn-primary[disabled]:focus, +fieldset[disabled] .btn-primary:focus, +.btn-primary.disabled.focus, +.btn-primary[disabled].focus, +fieldset[disabled] .btn-primary.focus, +.btn-primary.disabled:active, +.btn-primary[disabled]:active, +fieldset[disabled] .btn-primary:active, +.btn-primary.disabled.active, +.btn-primary[disabled].active, +fieldset[disabled] .btn-primary.active { + background-color: #337ab7; + border-color: #2e6da4; +} +.btn-primary .badge { + color: #337ab7; + background-color: #fff; +} +.btn-success { + color: #fff; + background-color: #5cb85c; + border-color: #4cae4c; +} +.btn-success:hover, +.btn-success:focus, +.btn-success.focus, +.btn-success:active, +.btn-success.active, +.open > .dropdown-toggle.btn-success { + color: #fff; + background-color: #449d44; + border-color: #398439; +} +.btn-success:active, +.btn-success.active, +.open > .dropdown-toggle.btn-success { + background-image: none; +} +.btn-success.disabled, +.btn-success[disabled], +fieldset[disabled] .btn-success, +.btn-success.disabled:hover, +.btn-success[disabled]:hover, +fieldset[disabled] .btn-success:hover, +.btn-success.disabled:focus, +.btn-success[disabled]:focus, +fieldset[disabled] .btn-success:focus, +.btn-success.disabled.focus, +.btn-success[disabled].focus, +fieldset[disabled] .btn-success.focus, +.btn-success.disabled:active, +.btn-success[disabled]:active, +fieldset[disabled] .btn-success:active, +.btn-success.disabled.active, +.btn-success[disabled].active, +fieldset[disabled] .btn-success.active { + background-color: #5cb85c; + border-color: #4cae4c; +} +.btn-success .badge { + color: #5cb85c; + background-color: #fff; +} +.btn-info { + color: #fff; + background-color: #5bc0de; + border-color: #46b8da; +} +.btn-info:hover, +.btn-info:focus, +.btn-info.focus, +.btn-info:active, +.btn-info.active, +.open > .dropdown-toggle.btn-info { + color: #fff; + background-color: #31b0d5; + border-color: #269abc; +} +.btn-info:active, +.btn-info.active, +.open > .dropdown-toggle.btn-info { + background-image: none; +} +.btn-info.disabled, +.btn-info[disabled], +fieldset[disabled] .btn-info, +.btn-info.disabled:hover, +.btn-info[disabled]:hover, +fieldset[disabled] .btn-info:hover, +.btn-info.disabled:focus, +.btn-info[disabled]:focus, +fieldset[disabled] .btn-info:focus, +.btn-info.disabled.focus, +.btn-info[disabled].focus, +fieldset[disabled] .btn-info.focus, +.btn-info.disabled:active, +.btn-info[disabled]:active, +fieldset[disabled] .btn-info:active, +.btn-info.disabled.active, +.btn-info[disabled].active, +fieldset[disabled] .btn-info.active { + background-color: #5bc0de; + border-color: #46b8da; +} +.btn-info .badge { + color: #5bc0de; + background-color: #fff; +} +.btn-warning { + color: #fff; + background-color: #f0ad4e; + border-color: #eea236; +} +.btn-warning:hover, +.btn-warning:focus, +.btn-warning.focus, +.btn-warning:active, +.btn-warning.active, +.open > .dropdown-toggle.btn-warning { + color: #fff; + background-color: #ec971f; + border-color: #d58512; +} +.btn-warning:active, +.btn-warning.active, +.open > .dropdown-toggle.btn-warning { + background-image: none; +} +.btn-warning.disabled, +.btn-warning[disabled], +fieldset[disabled] .btn-warning, +.btn-warning.disabled:hover, +.btn-warning[disabled]:hover, +fieldset[disabled] .btn-warning:hover, +.btn-warning.disabled:focus, +.btn-warning[disabled]:focus, +fieldset[disabled] .btn-warning:focus, +.btn-warning.disabled.focus, +.btn-warning[disabled].focus, +fieldset[disabled] .btn-warning.focus, +.btn-warning.disabled:active, +.btn-warning[disabled]:active, +fieldset[disabled] .btn-warning:active, +.btn-warning.disabled.active, +.btn-warning[disabled].active, +fieldset[disabled] .btn-warning.active { + background-color: #f0ad4e; + border-color: #eea236; +} +.btn-warning .badge { + color: #f0ad4e; + background-color: #fff; +} +.btn-danger { + color: #fff; + background-color: #d9534f; + border-color: #d43f3a; +} +.btn-danger:hover, +.btn-danger:focus, +.btn-danger.focus, +.btn-danger:active, +.btn-danger.active, +.open > .dropdown-toggle.btn-danger { + color: #fff; + background-color: #c9302c; + border-color: #ac2925; +} +.btn-danger:active, +.btn-danger.active, +.open > .dropdown-toggle.btn-danger { + background-image: none; +} +.btn-danger.disabled, +.btn-danger[disabled], +fieldset[disabled] .btn-danger, +.btn-danger.disabled:hover, +.btn-danger[disabled]:hover, +fieldset[disabled] .btn-danger:hover, +.btn-danger.disabled:focus, +.btn-danger[disabled]:focus, +fieldset[disabled] .btn-danger:focus, +.btn-danger.disabled.focus, +.btn-danger[disabled].focus, +fieldset[disabled] .btn-danger.focus, +.btn-danger.disabled:active, +.btn-danger[disabled]:active, +fieldset[disabled] .btn-danger:active, +.btn-danger.disabled.active, +.btn-danger[disabled].active, +fieldset[disabled] .btn-danger.active { + background-color: #d9534f; + border-color: #d43f3a; +} +.btn-danger .badge { + color: #d9534f; + background-color: #fff; +} +.btn-link { + font-weight: normal; + color: #337ab7; + border-radius: 0; +} +.btn-link, +.btn-link:active, +.btn-link.active, +.btn-link[disabled], +fieldset[disabled] .btn-link { + background-color: transparent; + -webkit-box-shadow: none; + box-shadow: none; +} +.btn-link, +.btn-link:hover, +.btn-link:focus, +.btn-link:active { + border-color: transparent; +} +.btn-link:hover, +.btn-link:focus { + color: #23527c; + text-decoration: underline; + background-color: transparent; +} +.btn-link[disabled]:hover, +fieldset[disabled] .btn-link:hover, +.btn-link[disabled]:focus, +fieldset[disabled] .btn-link:focus { + color: #777; + text-decoration: none; +} +.btn-lg, +.btn-group-lg > .btn { + padding: 10px 16px; + font-size: 18px; + line-height: 1.3333333; + border-radius: 6px; +} +.btn-sm, +.btn-group-sm > .btn { + padding: 5px 10px; + font-size: 12px; + line-height: 1.5; + border-radius: 3px; +} +.btn-xs, +.btn-group-xs > .btn { + padding: 1px 5px; + font-size: 12px; + line-height: 1.5; + border-radius: 3px; +} +.btn-block { + display: block; + width: 100%; +} +.btn-block + .btn-block { + margin-top: 5px; +} +input[type="submit"].btn-block, +input[type="reset"].btn-block, +input[type="button"].btn-block { + width: 100%; +} +.fade { + opacity: 0; + -webkit-transition: opacity .15s linear; + -o-transition: opacity .15s linear; + transition: opacity .15s linear; +} +.fade.in { + opacity: 1; +} +.collapse { + display: none; +} +.collapse.in { + display: block; +} +tr.collapse.in { + display: table-row; +} +tbody.collapse.in { + display: table-row-group; +} +.collapsing { + position: relative; + height: 0; + overflow: hidden; + -webkit-transition-timing-function: ease; + -o-transition-timing-function: ease; + transition-timing-function: ease; + -webkit-transition-duration: .35s; + -o-transition-duration: .35s; + transition-duration: .35s; + -webkit-transition-property: height, visibility; + -o-transition-property: height, visibility; + transition-property: height, visibility; +} +.caret { + display: inline-block; + width: 0; + height: 0; + margin-left: 2px; + vertical-align: middle; + border-top: 4px dashed; + border-right: 4px solid transparent; + border-left: 4px solid transparent; +} +.dropup, +.dropdown { + position: relative; +} +.dropdown-toggle:focus { + outline: 0; +} +.dropdown-menu { + position: absolute; + top: 100%; + left: 0; + z-index: 1000; + display: none; + float: left; + min-width: 160px; + padding: 5px 0; + margin: 2px 0 0; + font-size: 14px; + text-align: left; + list-style: none; + background-color: #fff; + -webkit-background-clip: padding-box; + background-clip: padding-box; + border: 1px solid #ccc; + border: 1px solid rgba(0, 0, 0, .15); + border-radius: 4px; + -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175); + box-shadow: 0 6px 12px rgba(0, 0, 0, .175); +} +.dropdown-menu.pull-right { + right: 0; + left: auto; +} +.dropdown-menu .divider { + height: 1px; + margin: 9px 0; + overflow: hidden; + background-color: #e5e5e5; +} +.dropdown-menu > li > a { + display: block; + padding: 3px 20px; + clear: both; + font-weight: normal; + line-height: 1.42857143; + color: #333; + white-space: nowrap; +} +.dropdown-menu > li > a:hover, +.dropdown-menu > li > a:focus { + color: #262626; + text-decoration: none; + background-color: #f5f5f5; +} +.dropdown-menu > .active > a, +.dropdown-menu > .active > a:hover, +.dropdown-menu > .active > a:focus { + color: #fff; + text-decoration: none; + background-color: #337ab7; + outline: 0; +} +.dropdown-menu > .disabled > a, +.dropdown-menu > .disabled > a:hover, +.dropdown-menu > .disabled > a:focus { + color: #777; +} +.dropdown-menu > .disabled > a:hover, +.dropdown-menu > .disabled > a:focus { + text-decoration: none; + cursor: not-allowed; + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); +} +.open > .dropdown-menu { + display: block; +} +.open > a { + outline: 0; +} +.dropdown-menu-right { + right: 0; + left: auto; +} +.dropdown-menu-left { + right: auto; + left: 0; +} +.dropdown-header { + display: block; + padding: 3px 20px; + font-size: 12px; + line-height: 1.42857143; + color: #777; + white-space: nowrap; +} +.dropdown-backdrop { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 990; +} +.pull-right > .dropdown-menu { + right: 0; + left: auto; +} +.dropup .caret, +.navbar-fixed-bottom .dropdown .caret { + content: ""; + border-top: 0; + border-bottom: 4px solid; +} +.dropup .dropdown-menu, +.navbar-fixed-bottom .dropdown .dropdown-menu { + top: auto; + bottom: 100%; + margin-bottom: 2px; +} +@media (min-width: 768px) { + .navbar-right .dropdown-menu { + right: 0; + left: auto; + } + .navbar-right .dropdown-menu-left { + right: auto; + left: 0; + } +} +.btn-group, +.btn-group-vertical { + position: relative; + display: inline-block; + vertical-align: middle; +} +.btn-group > .btn, +.btn-group-vertical > .btn { + position: relative; + float: left; +} +.btn-group > .btn:hover, +.btn-group-vertical > .btn:hover, +.btn-group > .btn:focus, +.btn-group-vertical > .btn:focus, +.btn-group > .btn:active, +.btn-group-vertical > .btn:active, +.btn-group > .btn.active, +.btn-group-vertical > .btn.active { + z-index: 2; +} +.btn-group .btn + .btn, +.btn-group .btn + .btn-group, +.btn-group .btn-group + .btn, +.btn-group .btn-group + .btn-group { + margin-left: -1px; +} +.btn-toolbar { + margin-left: -5px; +} +.btn-toolbar .btn-group, +.btn-toolbar .input-group { + float: left; +} +.btn-toolbar > .btn, +.btn-toolbar > .btn-group, +.btn-toolbar > .input-group { + margin-left: 5px; +} +.btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) { + border-radius: 0; +} +.btn-group > .btn:first-child { + margin-left: 0; +} +.btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) { + border-top-right-radius: 0; + border-bottom-right-radius: 0; +} +.btn-group > .btn:last-child:not(:first-child), +.btn-group > .dropdown-toggle:not(:first-child) { + border-top-left-radius: 0; + border-bottom-left-radius: 0; +} +.btn-group > .btn-group { + float: left; +} +.btn-group > .btn-group:not(:first-child):not(:last-child) > .btn { + border-radius: 0; +} +.btn-group > .btn-group:first-child:not(:last-child) > .btn:last-child, +.btn-group > .btn-group:first-child:not(:last-child) > .dropdown-toggle { + border-top-right-radius: 0; + border-bottom-right-radius: 0; +} +.btn-group > .btn-group:last-child:not(:first-child) > .btn:first-child { + border-top-left-radius: 0; + border-bottom-left-radius: 0; +} +.btn-group .dropdown-toggle:active, +.btn-group.open .dropdown-toggle { + outline: 0; +} +.btn-group > .btn + .dropdown-toggle { + padding-right: 8px; + padding-left: 8px; +} +.btn-group > .btn-lg + .dropdown-toggle { + padding-right: 12px; + padding-left: 12px; +} +.btn-group.open .dropdown-toggle { + -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); + box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); +} +.btn-group.open .dropdown-toggle.btn-link { + -webkit-box-shadow: none; + box-shadow: none; +} +.btn .caret { + margin-left: 0; +} +.btn-lg .caret { + border-width: 5px 5px 0; + border-bottom-width: 0; +} +.dropup .btn-lg .caret { + border-width: 0 5px 5px; +} +.btn-group-vertical > .btn, +.btn-group-vertical > .btn-group, +.btn-group-vertical > .btn-group > .btn { + display: block; + float: none; + width: 100%; + max-width: 100%; +} +.btn-group-vertical > .btn-group > .btn { + float: none; +} +.btn-group-vertical > .btn + .btn, +.btn-group-vertical > .btn + .btn-group, +.btn-group-vertical > .btn-group + .btn, +.btn-group-vertical > .btn-group + .btn-group { + margin-top: -1px; + margin-left: 0; +} +.btn-group-vertical > .btn:not(:first-child):not(:last-child) { + border-radius: 0; +} +.btn-group-vertical > .btn:first-child:not(:last-child) { + border-top-right-radius: 4px; + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} +.btn-group-vertical > .btn:last-child:not(:first-child) { + border-top-left-radius: 0; + border-top-right-radius: 0; + border-bottom-left-radius: 4px; +} +.btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn { + border-radius: 0; +} +.btn-group-vertical > .btn-group:first-child:not(:last-child) > .btn:last-child, +.btn-group-vertical > .btn-group:first-child:not(:last-child) > .dropdown-toggle { + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} +.btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child { + border-top-left-radius: 0; + border-top-right-radius: 0; +} +.btn-group-justified { + display: table; + width: 100%; + table-layout: fixed; + border-collapse: separate; +} +.btn-group-justified > .btn, +.btn-group-justified > .btn-group { + display: table-cell; + float: none; + width: 1%; +} +.btn-group-justified > .btn-group .btn { + width: 100%; +} +.btn-group-justified > .btn-group .dropdown-menu { + left: auto; +} +[data-toggle="buttons"] > .btn input[type="radio"], +[data-toggle="buttons"] > .btn-group > .btn input[type="radio"], +[data-toggle="buttons"] > .btn input[type="checkbox"], +[data-toggle="buttons"] > .btn-group > .btn input[type="checkbox"] { + position: absolute; + clip: rect(0, 0, 0, 0); + pointer-events: none; +} +.input-group { + position: relative; + display: table; + border-collapse: separate; +} +.input-group[class*="col-"] { + float: none; + padding-right: 0; + padding-left: 0; +} +.input-group .form-control { + position: relative; + z-index: 2; + float: left; + width: 100%; + margin-bottom: 0; +} +.input-group-lg > .form-control, +.input-group-lg > .input-group-addon, +.input-group-lg > .input-group-btn > .btn { + height: 46px; + padding: 10px 16px; + font-size: 18px; + line-height: 1.3333333; + border-radius: 6px; +} +select.input-group-lg > .form-control, +select.input-group-lg > .input-group-addon, +select.input-group-lg > .input-group-btn > .btn { + height: 46px; + line-height: 46px; +} +textarea.input-group-lg > .form-control, +textarea.input-group-lg > .input-group-addon, +textarea.input-group-lg > .input-group-btn > .btn, +select[multiple].input-group-lg > .form-control, +select[multiple].input-group-lg > .input-group-addon, +select[multiple].input-group-lg > .input-group-btn > .btn { + height: auto; +} +.input-group-sm > .form-control, +.input-group-sm > .input-group-addon, +.input-group-sm > .input-group-btn > .btn { + height: 30px; + padding: 5px 10px; + font-size: 12px; + line-height: 1.5; + border-radius: 3px; +} +select.input-group-sm > .form-control, +select.input-group-sm > .input-group-addon, +select.input-group-sm > .input-group-btn > .btn { + height: 30px; + line-height: 30px; +} +textarea.input-group-sm > .form-control, +textarea.input-group-sm > .input-group-addon, +textarea.input-group-sm > .input-group-btn > .btn, +select[multiple].input-group-sm > .form-control, +select[multiple].input-group-sm > .input-group-addon, +select[multiple].input-group-sm > .input-group-btn > .btn { + height: auto; +} +.input-group-addon, +.input-group-btn, +.input-group .form-control { + display: table-cell; +} +.input-group-addon:not(:first-child):not(:last-child), +.input-group-btn:not(:first-child):not(:last-child), +.input-group .form-control:not(:first-child):not(:last-child) { + border-radius: 0; +} +.input-group-addon, +.input-group-btn { + width: 1%; + white-space: nowrap; + vertical-align: middle; +} +.input-group-addon { + padding: 6px 12px; + font-size: 14px; + font-weight: normal; + line-height: 1; + color: #555; + text-align: center; + background-color: #eee; + border: 1px solid #ccc; + border-radius: 4px; +} +.input-group-addon.input-sm { + padding: 5px 10px; + font-size: 12px; + border-radius: 3px; +} +.input-group-addon.input-lg { + padding: 10px 16px; + font-size: 18px; + border-radius: 6px; +} +.input-group-addon input[type="radio"], +.input-group-addon input[type="checkbox"] { + margin-top: 0; +} +.input-group .form-control:first-child, +.input-group-addon:first-child, +.input-group-btn:first-child > .btn, +.input-group-btn:first-child > .btn-group > .btn, +.input-group-btn:first-child > .dropdown-toggle, +.input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle), +.input-group-btn:last-child > .btn-group:not(:last-child) > .btn { + border-top-right-radius: 0; + border-bottom-right-radius: 0; +} +.input-group-addon:first-child { + border-right: 0; +} +.input-group .form-control:last-child, +.input-group-addon:last-child, +.input-group-btn:last-child > .btn, +.input-group-btn:last-child > .btn-group > .btn, +.input-group-btn:last-child > .dropdown-toggle, +.input-group-btn:first-child > .btn:not(:first-child), +.input-group-btn:first-child > .btn-group:not(:first-child) > .btn { + border-top-left-radius: 0; + border-bottom-left-radius: 0; +} +.input-group-addon:last-child { + border-left: 0; +} +.input-group-btn { + position: relative; + font-size: 0; + white-space: nowrap; +} +.input-group-btn > .btn { + position: relative; +} +.input-group-btn > .btn + .btn { + margin-left: -1px; +} +.input-group-btn > .btn:hover, +.input-group-btn > .btn:focus, +.input-group-btn > .btn:active { + z-index: 2; +} +.input-group-btn:first-child > .btn, +.input-group-btn:first-child > .btn-group { + margin-right: -1px; +} +.input-group-btn:last-child > .btn, +.input-group-btn:last-child > .btn-group { + margin-left: -1px; +} +.nav { + padding-left: 0; + margin-bottom: 0; + list-style: none; +} +.nav > li { + position: relative; + display: block; +} +.nav > li > a { + position: relative; + display: block; + padding: 10px 15px; +} +.nav > li > a:hover, +.nav > li > a:focus { + text-decoration: none; + background-color: #eee; +} +.nav > li.disabled > a { + color: #777; +} +.nav > li.disabled > a:hover, +.nav > li.disabled > a:focus { + color: #777; + text-decoration: none; + cursor: not-allowed; + background-color: transparent; +} +.nav .open > a, +.nav .open > a:hover, +.nav .open > a:focus { + background-color: #eee; + border-color: #337ab7; +} +.nav .nav-divider { + height: 1px; + margin: 9px 0; + overflow: hidden; + background-color: #e5e5e5; +} +.nav > li > a > img { + max-width: none; +} +.nav-tabs { + border-bottom: 1px solid #ddd; +} +.nav-tabs > li { + float: left; + margin-bottom: -1px; +} +.nav-tabs > li > a { + margin-right: 2px; + line-height: 1.42857143; + border: 1px solid transparent; + border-radius: 4px 4px 0 0; +} +.nav-tabs > li > a:hover { + border-color: #eee #eee #ddd; +} +.nav-tabs > li.active > a, +.nav-tabs > li.active > a:hover, +.nav-tabs > li.active > a:focus { + color: #555; + cursor: default; + background-color: #fff; + border: 1px solid #ddd; + border-bottom-color: transparent; +} +.nav-tabs.nav-justified { + width: 100%; + border-bottom: 0; +} +.nav-tabs.nav-justified > li { + float: none; +} +.nav-tabs.nav-justified > li > a { + margin-bottom: 5px; + text-align: center; +} +.nav-tabs.nav-justified > .dropdown .dropdown-menu { + top: auto; + left: auto; +} +@media (min-width: 768px) { + .nav-tabs.nav-justified > li { + display: table-cell; + width: 1%; + } + .nav-tabs.nav-justified > li > a { + margin-bottom: 0; + } +} +.nav-tabs.nav-justified > li > a { + margin-right: 0; + border-radius: 4px; +} +.nav-tabs.nav-justified > .active > a, +.nav-tabs.nav-justified > .active > a:hover, +.nav-tabs.nav-justified > .active > a:focus { + border: 1px solid #ddd; +} +@media (min-width: 768px) { + .nav-tabs.nav-justified > li > a { + border-bottom: 1px solid #ddd; + border-radius: 4px 4px 0 0; + } + .nav-tabs.nav-justified > .active > a, + .nav-tabs.nav-justified > .active > a:hover, + .nav-tabs.nav-justified > .active > a:focus { + border-bottom-color: #fff; + } +} +.nav-pills > li { + float: left; +} +.nav-pills > li > a { + border-radius: 4px; +} +.nav-pills > li + li { + margin-left: 2px; +} +.nav-pills > li.active > a, +.nav-pills > li.active > a:hover, +.nav-pills > li.active > a:focus { + color: #fff; + background-color: #337ab7; +} +.nav-stacked > li { + float: none; +} +.nav-stacked > li + li { + margin-top: 2px; + margin-left: 0; +} +.nav-justified { + width: 100%; +} +.nav-justified > li { + float: none; +} +.nav-justified > li > a { + margin-bottom: 5px; + text-align: center; +} +.nav-justified > .dropdown .dropdown-menu { + top: auto; + left: auto; +} +@media (min-width: 768px) { + .nav-justified > li { + display: table-cell; + width: 1%; + } + .nav-justified > li > a { + margin-bottom: 0; + } +} +.nav-tabs-justified { + border-bottom: 0; +} +.nav-tabs-justified > li > a { + margin-right: 0; + border-radius: 4px; +} +.nav-tabs-justified > .active > a, +.nav-tabs-justified > .active > a:hover, +.nav-tabs-justified > .active > a:focus { + border: 1px solid #ddd; +} +@media (min-width: 768px) { + .nav-tabs-justified > li > a { + border-bottom: 1px solid #ddd; + border-radius: 4px 4px 0 0; + } + .nav-tabs-justified > .active > a, + .nav-tabs-justified > .active > a:hover, + .nav-tabs-justified > .active > a:focus { + border-bottom-color: #fff; + } +} +.tab-content > .tab-pane { + display: none; +} +.tab-content > .active { + display: block; +} +.nav-tabs .dropdown-menu { + margin-top: -1px; + border-top-left-radius: 0; + border-top-right-radius: 0; +} +.navbar { + position: relative; + min-height: 50px; + margin-bottom: 20px; + border: 1px solid transparent; +} +@media (min-width: 768px) { + .navbar { + border-radius: 4px; + } +} +@media (min-width: 768px) { + .navbar-header { + float: left; + } +} +.navbar-collapse { + padding-right: 15px; + padding-left: 15px; + overflow-x: visible; + -webkit-overflow-scrolling: touch; + border-top: 1px solid transparent; + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1); +} +.navbar-collapse.in { + overflow-y: auto; +} +@media (min-width: 768px) { + .navbar-collapse { + width: auto; + border-top: 0; + -webkit-box-shadow: none; + box-shadow: none; + } + .navbar-collapse.collapse { + display: block !important; + height: auto !important; + padding-bottom: 0; + overflow: visible !important; + } + .navbar-collapse.in { + overflow-y: visible; + } + .navbar-fixed-top .navbar-collapse, + .navbar-static-top .navbar-collapse, + .navbar-fixed-bottom .navbar-collapse { + padding-right: 0; + padding-left: 0; + } +} +.navbar-fixed-top .navbar-collapse, +.navbar-fixed-bottom .navbar-collapse { + max-height: 340px; +} +@media (max-device-width: 480px) and (orientation: landscape) { + .navbar-fixed-top .navbar-collapse, + .navbar-fixed-bottom .navbar-collapse { + max-height: 200px; + } +} +.container > .navbar-header, +.container-fluid > .navbar-header, +.container > .navbar-collapse, +.container-fluid > .navbar-collapse { + margin-right: -15px; + margin-left: -15px; +} +@media (min-width: 768px) { + .container > .navbar-header, + .container-fluid > .navbar-header, + .container > .navbar-collapse, + .container-fluid > .navbar-collapse { + margin-right: 0; + margin-left: 0; + } +} +.navbar-static-top { + z-index: 1000; + border-width: 0 0 1px; +} +@media (min-width: 768px) { + .navbar-static-top { + border-radius: 0; + } +} +.navbar-fixed-top, +.navbar-fixed-bottom { + position: fixed; + right: 0; + left: 0; + z-index: 1030; +} +@media (min-width: 768px) { + .navbar-fixed-top, + .navbar-fixed-bottom { + border-radius: 0; + } +} +.navbar-fixed-top { + top: 0; + border-width: 0 0 1px; +} +.navbar-fixed-bottom { + bottom: 0; + margin-bottom: 0; + border-width: 1px 0 0; +} +.navbar-brand { + float: left; + height: 50px; + padding: 15px 15px; + font-size: 18px; + line-height: 20px; +} +.navbar-brand:hover, +.navbar-brand:focus { + text-decoration: none; +} +.navbar-brand > img { + display: block; +} +@media (min-width: 768px) { + .navbar > .container .navbar-brand, + .navbar > .container-fluid .navbar-brand { + margin-left: -15px; + } +} +.navbar-toggle { + position: relative; + float: right; + padding: 9px 10px; + margin-top: 8px; + margin-right: 15px; + margin-bottom: 8px; + background-color: transparent; + background-image: none; + border: 1px solid transparent; + border-radius: 4px; +} +.navbar-toggle:focus { + outline: 0; +} +.navbar-toggle .icon-bar { + display: block; + width: 22px; + height: 2px; + border-radius: 1px; +} +.navbar-toggle .icon-bar + .icon-bar { + margin-top: 4px; +} +@media (min-width: 768px) { + .navbar-toggle { + display: none; + } +} +.navbar-nav { + margin: 7.5px -15px; +} +.navbar-nav > li > a { + padding-top: 10px; + padding-bottom: 10px; + line-height: 20px; +} +@media (max-width: 767px) { + .navbar-nav .open .dropdown-menu { + position: static; + float: none; + width: auto; + margin-top: 0; + background-color: transparent; + border: 0; + -webkit-box-shadow: none; + box-shadow: none; + } + .navbar-nav .open .dropdown-menu > li > a, + .navbar-nav .open .dropdown-menu .dropdown-header { + padding: 5px 15px 5px 25px; + } + .navbar-nav .open .dropdown-menu > li > a { + line-height: 20px; + } + .navbar-nav .open .dropdown-menu > li > a:hover, + .navbar-nav .open .dropdown-menu > li > a:focus { + background-image: none; + } +} +@media (min-width: 768px) { + .navbar-nav { + float: left; + margin: 0; + } + .navbar-nav > li { + float: left; + } + .navbar-nav > li > a { + padding-top: 15px; + padding-bottom: 15px; + } +} +.navbar-form { + padding: 10px 15px; + margin-top: 8px; + margin-right: -15px; + margin-bottom: 8px; + margin-left: -15px; + border-top: 1px solid transparent; + border-bottom: 1px solid transparent; + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 rgba(255, 255, 255, .1); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 rgba(255, 255, 255, .1); +} +@media (min-width: 768px) { + .navbar-form .form-group { + display: inline-block; + margin-bottom: 0; + vertical-align: middle; + } + .navbar-form .form-control { + display: inline-block; + width: auto; + vertical-align: middle; + } + .navbar-form .form-control-static { + display: inline-block; + } + .navbar-form .input-group { + display: inline-table; + vertical-align: middle; + } + .navbar-form .input-group .input-group-addon, + .navbar-form .input-group .input-group-btn, + .navbar-form .input-group .form-control { + width: auto; + } + .navbar-form .input-group > .form-control { + width: 100%; + } + .navbar-form .control-label { + margin-bottom: 0; + vertical-align: middle; + } + .navbar-form .radio, + .navbar-form .checkbox { + display: inline-block; + margin-top: 0; + margin-bottom: 0; + vertical-align: middle; + } + .navbar-form .radio label, + .navbar-form .checkbox label { + padding-left: 0; + } + .navbar-form .radio input[type="radio"], + .navbar-form .checkbox input[type="checkbox"] { + position: relative; + margin-left: 0; + } + .navbar-form .has-feedback .form-control-feedback { + top: 0; + } +} +@media (max-width: 767px) { + .navbar-form .form-group { + margin-bottom: 5px; + } + .navbar-form .form-group:last-child { + margin-bottom: 0; + } +} +@media (min-width: 768px) { + .navbar-form { + width: auto; + padding-top: 0; + padding-bottom: 0; + margin-right: 0; + margin-left: 0; + border: 0; + -webkit-box-shadow: none; + box-shadow: none; + } +} +.navbar-nav > li > .dropdown-menu { + margin-top: 0; + border-top-left-radius: 0; + border-top-right-radius: 0; +} +.navbar-fixed-bottom .navbar-nav > li > .dropdown-menu { + margin-bottom: 0; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} +.navbar-btn { + margin-top: 8px; + margin-bottom: 8px; +} +.navbar-btn.btn-sm { + margin-top: 10px; + margin-bottom: 10px; +} +.navbar-btn.btn-xs { + margin-top: 14px; + margin-bottom: 14px; +} +.navbar-text { + margin-top: 15px; + margin-bottom: 15px; +} +@media (min-width: 768px) { + .navbar-text { + float: left; + margin-right: 15px; + margin-left: 15px; + } +} +@media (min-width: 768px) { + .navbar-left { + float: left !important; + } + .navbar-right { + float: right !important; + margin-right: -15px; + } + .navbar-right ~ .navbar-right { + margin-right: 0; + } +} +.navbar-default { + background-color: #f8f8f8; + border-color: #e7e7e7; +} +.navbar-default .navbar-brand { + color: #777; +} +.navbar-default .navbar-brand:hover, +.navbar-default .navbar-brand:focus { + color: #5e5e5e; + background-color: transparent; +} +.navbar-default .navbar-text { + color: #777; +} +.navbar-default .navbar-nav > li > a { + color: #777; +} +.navbar-default .navbar-nav > li > a:hover, +.navbar-default .navbar-nav > li > a:focus { + color: #333; + background-color: transparent; +} +.navbar-default .navbar-nav > .active > a, +.navbar-default .navbar-nav > .active > a:hover, +.navbar-default .navbar-nav > .active > a:focus { + color: #555; + background-color: #e7e7e7; +} +.navbar-default .navbar-nav > .disabled > a, +.navbar-default .navbar-nav > .disabled > a:hover, +.navbar-default .navbar-nav > .disabled > a:focus { + color: #ccc; + background-color: transparent; +} +.navbar-default .navbar-toggle { + border-color: #ddd; +} +.navbar-default .navbar-toggle:hover, +.navbar-default .navbar-toggle:focus { + background-color: #ddd; +} +.navbar-default .navbar-toggle .icon-bar { + background-color: #888; +} +.navbar-default .navbar-collapse, +.navbar-default .navbar-form { + border-color: #e7e7e7; +} +.navbar-default .navbar-nav > .open > a, +.navbar-default .navbar-nav > .open > a:hover, +.navbar-default .navbar-nav > .open > a:focus { + color: #555; + background-color: #e7e7e7; +} +@media (max-width: 767px) { + .navbar-default .navbar-nav .open .dropdown-menu > li > a { + color: #777; + } + .navbar-default .navbar-nav .open .dropdown-menu > li > a:hover, + .navbar-default .navbar-nav .open .dropdown-menu > li > a:focus { + color: #333; + background-color: transparent; + } + .navbar-default .navbar-nav .open .dropdown-menu > .active > a, + .navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover, + .navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus { + color: #555; + background-color: #e7e7e7; + } + .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a, + .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:hover, + .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:focus { + color: #ccc; + background-color: transparent; + } +} +.navbar-default .navbar-link { + color: #777; +} +.navbar-default .navbar-link:hover { + color: #333; +} +.navbar-default .btn-link { + color: #777; +} +.navbar-default .btn-link:hover, +.navbar-default .btn-link:focus { + color: #333; +} +.navbar-default .btn-link[disabled]:hover, +fieldset[disabled] .navbar-default .btn-link:hover, +.navbar-default .btn-link[disabled]:focus, +fieldset[disabled] .navbar-default .btn-link:focus { + color: #ccc; +} +.navbar-inverse { + background-color: #222; + border-color: #080808; +} +.navbar-inverse .navbar-brand { + color: #9d9d9d; +} +.navbar-inverse .navbar-brand:hover, +.navbar-inverse .navbar-brand:focus { + color: #fff; + background-color: transparent; +} +.navbar-inverse .navbar-text { + color: #9d9d9d; +} +.navbar-inverse .navbar-nav > li > a { + color: #9d9d9d; +} +.navbar-inverse .navbar-nav > li > a:hover, +.navbar-inverse .navbar-nav > li > a:focus { + color: #fff; + background-color: transparent; +} +.navbar-inverse .navbar-nav > .active > a, +.navbar-inverse .navbar-nav > .active > a:hover, +.navbar-inverse .navbar-nav > .active > a:focus { + color: #fff; + background-color: #080808; +} +.navbar-inverse .navbar-nav > .disabled > a, +.navbar-inverse .navbar-nav > .disabled > a:hover, +.navbar-inverse .navbar-nav > .disabled > a:focus { + color: #444; + background-color: transparent; +} +.navbar-inverse .navbar-toggle { + border-color: #333; +} +.navbar-inverse .navbar-toggle:hover, +.navbar-inverse .navbar-toggle:focus { + background-color: #333; +} +.navbar-inverse .navbar-toggle .icon-bar { + background-color: #fff; +} +.navbar-inverse .navbar-collapse, +.navbar-inverse .navbar-form { + border-color: #101010; +} +.navbar-inverse .navbar-nav > .open > a, +.navbar-inverse .navbar-nav > .open > a:hover, +.navbar-inverse .navbar-nav > .open > a:focus { + color: #fff; + background-color: #080808; +} +@media (max-width: 767px) { + .navbar-inverse .navbar-nav .open .dropdown-menu > .dropdown-header { + border-color: #080808; + } + .navbar-inverse .navbar-nav .open .dropdown-menu .divider { + background-color: #080808; + } + .navbar-inverse .navbar-nav .open .dropdown-menu > li > a { + color: #9d9d9d; + } + .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:hover, + .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:focus { + color: #fff; + background-color: transparent; + } + .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a, + .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:hover, + .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:focus { + color: #fff; + background-color: #080808; + } + .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a, + .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:hover, + .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:focus { + color: #444; + background-color: transparent; + } +} +.navbar-inverse .navbar-link { + color: #9d9d9d; +} +.navbar-inverse .navbar-link:hover { + color: #fff; +} +.navbar-inverse .btn-link { + color: #9d9d9d; +} +.navbar-inverse .btn-link:hover, +.navbar-inverse .btn-link:focus { + color: #fff; +} +.navbar-inverse .btn-link[disabled]:hover, +fieldset[disabled] .navbar-inverse .btn-link:hover, +.navbar-inverse .btn-link[disabled]:focus, +fieldset[disabled] .navbar-inverse .btn-link:focus { + color: #444; +} +.breadcrumb { + padding: 8px 15px; + margin-bottom: 20px; + list-style: none; + background-color: #f5f5f5; + border-radius: 4px; +} +.breadcrumb > li { + display: inline-block; +} +.breadcrumb > li + li:before { + padding: 0 5px; + color: #ccc; + content: "/\00a0"; +} +.breadcrumb > .active { + color: #777; +} +.pagination { + display: inline-block; + padding-left: 0; + margin: 20px 0; + border-radius: 4px; +} +.pagination > li { + display: inline; +} +.pagination > li > a, +.pagination > li > span { + position: relative; + float: left; + padding: 6px 12px; + margin-left: -1px; + line-height: 1.42857143; + color: #337ab7; + text-decoration: none; + background-color: #fff; + border: 1px solid #ddd; +} +.pagination > li:first-child > a, +.pagination > li:first-child > span { + margin-left: 0; + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; +} +.pagination > li:last-child > a, +.pagination > li:last-child > span { + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; +} +.pagination > li > a:hover, +.pagination > li > span:hover, +.pagination > li > a:focus, +.pagination > li > span:focus { + color: #23527c; + background-color: #eee; + border-color: #ddd; +} +.pagination > .active > a, +.pagination > .active > span, +.pagination > .active > a:hover, +.pagination > .active > span:hover, +.pagination > .active > a:focus, +.pagination > .active > span:focus { + z-index: 2; + color: #fff; + cursor: default; + background-color: #337ab7; + border-color: #337ab7; +} +.pagination > .disabled > span, +.pagination > .disabled > span:hover, +.pagination > .disabled > span:focus, +.pagination > .disabled > a, +.pagination > .disabled > a:hover, +.pagination > .disabled > a:focus { + color: #777; + cursor: not-allowed; + background-color: #fff; + border-color: #ddd; +} +.pagination-lg > li > a, +.pagination-lg > li > span { + padding: 10px 16px; + font-size: 18px; +} +.pagination-lg > li:first-child > a, +.pagination-lg > li:first-child > span { + border-top-left-radius: 6px; + border-bottom-left-radius: 6px; +} +.pagination-lg > li:last-child > a, +.pagination-lg > li:last-child > span { + border-top-right-radius: 6px; + border-bottom-right-radius: 6px; +} +.pagination-sm > li > a, +.pagination-sm > li > span { + padding: 5px 10px; + font-size: 12px; +} +.pagination-sm > li:first-child > a, +.pagination-sm > li:first-child > span { + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; +} +.pagination-sm > li:last-child > a, +.pagination-sm > li:last-child > span { + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; +} +.pager { + padding-left: 0; + margin: 20px 0; + text-align: center; + list-style: none; +} +.pager li { + display: inline; +} +.pager li > a, +.pager li > span { + display: inline-block; + padding: 5px 14px; + background-color: #fff; + border: 1px solid #ddd; + border-radius: 15px; +} +.pager li > a:hover, +.pager li > a:focus { + text-decoration: none; + background-color: #eee; +} +.pager .next > a, +.pager .next > span { + float: right; +} +.pager .previous > a, +.pager .previous > span { + float: left; +} +.pager .disabled > a, +.pager .disabled > a:hover, +.pager .disabled > a:focus, +.pager .disabled > span { + color: #777; + cursor: not-allowed; + background-color: #fff; +} +.label { + display: inline; + padding: .2em .6em .3em; + font-size: 75%; + font-weight: bold; + line-height: 1; + color: #fff; + text-align: center; + white-space: nowrap; + vertical-align: baseline; + border-radius: .25em; +} +a.label:hover, +a.label:focus { + color: #fff; + text-decoration: none; + cursor: pointer; +} +.label:empty { + display: none; +} +.btn .label { + position: relative; + top: -1px; +} +.label-default { + background-color: #777; +} +.label-default[href]:hover, +.label-default[href]:focus { + background-color: #5e5e5e; +} +.label-primary { + background-color: #337ab7; +} +.label-primary[href]:hover, +.label-primary[href]:focus { + background-color: #286090; +} +.label-success { + background-color: #5cb85c; +} +.label-success[href]:hover, +.label-success[href]:focus { + background-color: #449d44; +} +.label-info { + background-color: #5bc0de; +} +.label-info[href]:hover, +.label-info[href]:focus { + background-color: #31b0d5; +} +.label-warning { + background-color: #f0ad4e; +} +.label-warning[href]:hover, +.label-warning[href]:focus { + background-color: #ec971f; +} +.label-danger { + background-color: #d9534f; +} +.label-danger[href]:hover, +.label-danger[href]:focus { + background-color: #c9302c; +} +.badge { + display: inline-block; + min-width: 10px; + padding: 3px 7px; + font-size: 12px; + font-weight: bold; + line-height: 1; + color: #fff; + text-align: center; + white-space: nowrap; + vertical-align: baseline; + background-color: #777; + border-radius: 10px; +} +.badge:empty { + display: none; +} +.btn .badge { + position: relative; + top: -1px; +} +.btn-xs .badge, +.btn-group-xs > .btn .badge { + top: 0; + padding: 1px 5px; +} +a.badge:hover, +a.badge:focus { + color: #fff; + text-decoration: none; + cursor: pointer; +} +.list-group-item.active > .badge, +.nav-pills > .active > a > .badge { + color: #337ab7; + background-color: #fff; +} +.list-group-item > .badge { + float: right; +} +.list-group-item > .badge + .badge { + margin-right: 5px; +} +.nav-pills > li > a > .badge { + margin-left: 3px; +} +.jumbotron { + padding: 30px 15px; + margin-bottom: 30px; + color: inherit; + background-color: #eee; +} +.jumbotron h1, +.jumbotron .h1 { + color: inherit; +} +.jumbotron p { + margin-bottom: 15px; + font-size: 21px; + font-weight: 200; +} +.jumbotron > hr { + border-top-color: #d5d5d5; +} +.container .jumbotron, +.container-fluid .jumbotron { + border-radius: 6px; +} +.jumbotron .container { + max-width: 100%; +} +@media screen and (min-width: 768px) { + .jumbotron { + padding: 48px 0; + } + .container .jumbotron, + .container-fluid .jumbotron { + padding-right: 60px; + padding-left: 60px; + } + .jumbotron h1, + .jumbotron .h1 { + font-size: 63px; + } +} +.thumbnail { + display: block; + padding: 4px; + margin-bottom: 20px; + line-height: 1.42857143; + background-color: #fff; + border: 1px solid #ddd; + border-radius: 4px; + -webkit-transition: border .2s ease-in-out; + -o-transition: border .2s ease-in-out; + transition: border .2s ease-in-out; +} +.thumbnail > img, +.thumbnail a > img { + margin-right: auto; + margin-left: auto; +} +a.thumbnail:hover, +a.thumbnail:focus, +a.thumbnail.active { + border-color: #337ab7; +} +.thumbnail .caption { + padding: 9px; + color: #333; +} +.alert { + padding: 15px; + margin-bottom: 20px; + border: 1px solid transparent; + border-radius: 4px; +} +.alert h4 { + margin-top: 0; + color: inherit; +} +.alert .alert-link { + font-weight: bold; +} +.alert > p, +.alert > ul { + margin-bottom: 0; +} +.alert > p + p { + margin-top: 5px; +} +.alert-dismissable, +.alert-dismissible { + padding-right: 35px; +} +.alert-dismissable .close, +.alert-dismissible .close { + position: relative; + top: -2px; + right: -21px; + color: inherit; +} +.alert-success { + color: #3c763d; + background-color: #dff0d8; + border-color: #d6e9c6; +} +.alert-success hr { + border-top-color: #c9e2b3; +} +.alert-success .alert-link { + color: #2b542c; +} +.alert-info { + color: #31708f; + background-color: #d9edf7; + border-color: #bce8f1; +} +.alert-info hr { + border-top-color: #a6e1ec; +} +.alert-info .alert-link { + color: #245269; +} +.alert-warning { + color: #8a6d3b; + background-color: #fcf8e3; + border-color: #faebcc; +} +.alert-warning hr { + border-top-color: #f7e1b5; +} +.alert-warning .alert-link { + color: #66512c; +} +.alert-danger { + color: #a94442; + background-color: #f2dede; + border-color: #ebccd1; +} +.alert-danger hr { + border-top-color: #e4b9c0; +} +.alert-danger .alert-link { + color: #843534; +} +@-webkit-keyframes progress-bar-stripes { + from { + background-position: 40px 0; + } + to { + background-position: 0 0; + } +} +@-o-keyframes progress-bar-stripes { + from { + background-position: 40px 0; + } + to { + background-position: 0 0; + } +} +@keyframes progress-bar-stripes { + from { + background-position: 40px 0; + } + to { + background-position: 0 0; + } +} +.progress { + height: 20px; + margin-bottom: 20px; + overflow: hidden; + background-color: #f5f5f5; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1); + box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1); +} +.progress-bar { + float: left; + width: 0; + height: 100%; + font-size: 12px; + line-height: 20px; + color: #fff; + text-align: center; + background-color: #337ab7; + -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15); + box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15); + -webkit-transition: width .6s ease; + -o-transition: width .6s ease; + transition: width .6s ease; +} +.progress-striped .progress-bar, +.progress-bar-striped { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + -webkit-background-size: 40px 40px; + background-size: 40px 40px; +} +.progress.active .progress-bar, +.progress-bar.active { + -webkit-animation: progress-bar-stripes 2s linear infinite; + -o-animation: progress-bar-stripes 2s linear infinite; + animation: progress-bar-stripes 2s linear infinite; +} +.progress-bar-success { + background-color: #5cb85c; +} +.progress-striped .progress-bar-success { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); +} +.progress-bar-info { + background-color: #5bc0de; +} +.progress-striped .progress-bar-info { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); +} +.progress-bar-warning { + background-color: #f0ad4e; +} +.progress-striped .progress-bar-warning { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); +} +.progress-bar-danger { + background-color: #d9534f; +} +.progress-striped .progress-bar-danger { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); +} +.media { + margin-top: 15px; +} +.media:first-child { + margin-top: 0; +} +.media, +.media-body { + overflow: hidden; + zoom: 1; +} +.media-body { + width: 10000px; +} +.media-object { + display: block; +} +.media-right, +.media > .pull-right { + padding-left: 10px; +} +.media-left, +.media > .pull-left { + padding-right: 10px; +} +.media-left, +.media-right, +.media-body { + display: table-cell; + vertical-align: top; +} +.media-middle { + vertical-align: middle; +} +.media-bottom { + vertical-align: bottom; +} +.media-heading { + margin-top: 0; + margin-bottom: 5px; +} +.media-list { + padding-left: 0; + list-style: none; +} +.list-group { + padding-left: 0; + margin-bottom: 20px; +} +.list-group-item { + position: relative; + display: block; + padding: 10px 15px; + margin-bottom: -1px; + background-color: #fff; + border: 1px solid #ddd; +} +.list-group-item:first-child { + border-top-left-radius: 4px; + border-top-right-radius: 4px; +} +.list-group-item:last-child { + margin-bottom: 0; + border-bottom-right-radius: 4px; + border-bottom-left-radius: 4px; +} +a.list-group-item { + color: #555; +} +a.list-group-item .list-group-item-heading { + color: #333; +} +a.list-group-item:hover, +a.list-group-item:focus { + color: #555; + text-decoration: none; + background-color: #f5f5f5; +} +.list-group-item.disabled, +.list-group-item.disabled:hover, +.list-group-item.disabled:focus { + color: #777; + cursor: not-allowed; + background-color: #eee; +} +.list-group-item.disabled .list-group-item-heading, +.list-group-item.disabled:hover .list-group-item-heading, +.list-group-item.disabled:focus .list-group-item-heading { + color: inherit; +} +.list-group-item.disabled .list-group-item-text, +.list-group-item.disabled:hover .list-group-item-text, +.list-group-item.disabled:focus .list-group-item-text { + color: #777; +} +.list-group-item.active, +.list-group-item.active:hover, +.list-group-item.active:focus { + z-index: 2; + color: #fff; + background-color: #337ab7; + border-color: #337ab7; +} +.list-group-item.active .list-group-item-heading, +.list-group-item.active:hover .list-group-item-heading, +.list-group-item.active:focus .list-group-item-heading, +.list-group-item.active .list-group-item-heading > small, +.list-group-item.active:hover .list-group-item-heading > small, +.list-group-item.active:focus .list-group-item-heading > small, +.list-group-item.active .list-group-item-heading > .small, +.list-group-item.active:hover .list-group-item-heading > .small, +.list-group-item.active:focus .list-group-item-heading > .small { + color: inherit; +} +.list-group-item.active .list-group-item-text, +.list-group-item.active:hover .list-group-item-text, +.list-group-item.active:focus .list-group-item-text { + color: #c7ddef; +} +.list-group-item-success { + color: #3c763d; + background-color: #dff0d8; +} +a.list-group-item-success { + color: #3c763d; +} +a.list-group-item-success .list-group-item-heading { + color: inherit; +} +a.list-group-item-success:hover, +a.list-group-item-success:focus { + color: #3c763d; + background-color: #d0e9c6; +} +a.list-group-item-success.active, +a.list-group-item-success.active:hover, +a.list-group-item-success.active:focus { + color: #fff; + background-color: #3c763d; + border-color: #3c763d; +} +.list-group-item-info { + color: #31708f; + background-color: #d9edf7; +} +a.list-group-item-info { + color: #31708f; +} +a.list-group-item-info .list-group-item-heading { + color: inherit; +} +a.list-group-item-info:hover, +a.list-group-item-info:focus { + color: #31708f; + background-color: #c4e3f3; +} +a.list-group-item-info.active, +a.list-group-item-info.active:hover, +a.list-group-item-info.active:focus { + color: #fff; + background-color: #31708f; + border-color: #31708f; +} +.list-group-item-warning { + color: #8a6d3b; + background-color: #fcf8e3; +} +a.list-group-item-warning { + color: #8a6d3b; +} +a.list-group-item-warning .list-group-item-heading { + color: inherit; +} +a.list-group-item-warning:hover, +a.list-group-item-warning:focus { + color: #8a6d3b; + background-color: #faf2cc; +} +a.list-group-item-warning.active, +a.list-group-item-warning.active:hover, +a.list-group-item-warning.active:focus { + color: #fff; + background-color: #8a6d3b; + border-color: #8a6d3b; +} +.list-group-item-danger { + color: #a94442; + background-color: #f2dede; +} +a.list-group-item-danger { + color: #a94442; +} +a.list-group-item-danger .list-group-item-heading { + color: inherit; +} +a.list-group-item-danger:hover, +a.list-group-item-danger:focus { + color: #a94442; + background-color: #ebcccc; +} +a.list-group-item-danger.active, +a.list-group-item-danger.active:hover, +a.list-group-item-danger.active:focus { + color: #fff; + background-color: #a94442; + border-color: #a94442; +} +.list-group-item-heading { + margin-top: 0; + margin-bottom: 5px; +} +.list-group-item-text { + margin-bottom: 0; + line-height: 1.3; +} +.panel { + margin-bottom: 20px; + background-color: #fff; + border: 1px solid transparent; + border-radius: 4px; + -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .05); + box-shadow: 0 1px 1px rgba(0, 0, 0, .05); +} +.panel-body { + padding: 15px; +} +.panel-heading { + padding: 10px 15px; + border-bottom: 1px solid transparent; + border-top-left-radius: 3px; + border-top-right-radius: 3px; +} +.panel-heading > .dropdown .dropdown-toggle { + color: inherit; +} +.panel-title { + margin-top: 0; + margin-bottom: 0; + font-size: 16px; + color: inherit; +} +.panel-title > a, +.panel-title > small, +.panel-title > .small, +.panel-title > small > a, +.panel-title > .small > a { + color: inherit; +} +.panel-footer { + padding: 10px 15px; + background-color: #f5f5f5; + border-top: 1px solid #ddd; + border-bottom-right-radius: 3px; + border-bottom-left-radius: 3px; +} +.panel > .list-group, +.panel > .panel-collapse > .list-group { + margin-bottom: 0; +} +.panel > .list-group .list-group-item, +.panel > .panel-collapse > .list-group .list-group-item { + border-width: 1px 0; + border-radius: 0; +} +.panel > .list-group:first-child .list-group-item:first-child, +.panel > .panel-collapse > .list-group:first-child .list-group-item:first-child { + border-top: 0; + border-top-left-radius: 3px; + border-top-right-radius: 3px; +} +.panel > .list-group:last-child .list-group-item:last-child, +.panel > .panel-collapse > .list-group:last-child .list-group-item:last-child { + border-bottom: 0; + border-bottom-right-radius: 3px; + border-bottom-left-radius: 3px; +} +.panel-heading + .list-group .list-group-item:first-child { + border-top-width: 0; +} +.list-group + .panel-footer { + border-top-width: 0; +} +.panel > .table, +.panel > .table-responsive > .table, +.panel > .panel-collapse > .table { + margin-bottom: 0; +} +.panel > .table caption, +.panel > .table-responsive > .table caption, +.panel > .panel-collapse > .table caption { + padding-right: 15px; + padding-left: 15px; +} +.panel > .table:first-child, +.panel > .table-responsive:first-child > .table:first-child { + border-top-left-radius: 3px; + border-top-right-radius: 3px; +} +.panel > .table:first-child > thead:first-child > tr:first-child, +.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child, +.panel > .table:first-child > tbody:first-child > tr:first-child, +.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child { + border-top-left-radius: 3px; + border-top-right-radius: 3px; +} +.panel > .table:first-child > thead:first-child > tr:first-child td:first-child, +.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:first-child, +.panel > .table:first-child > tbody:first-child > tr:first-child td:first-child, +.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:first-child, +.panel > .table:first-child > thead:first-child > tr:first-child th:first-child, +.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:first-child, +.panel > .table:first-child > tbody:first-child > tr:first-child th:first-child, +.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:first-child { + border-top-left-radius: 3px; +} +.panel > .table:first-child > thead:first-child > tr:first-child td:last-child, +.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:last-child, +.panel > .table:first-child > tbody:first-child > tr:first-child td:last-child, +.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:last-child, +.panel > .table:first-child > thead:first-child > tr:first-child th:last-child, +.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:last-child, +.panel > .table:first-child > tbody:first-child > tr:first-child th:last-child, +.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:last-child { + border-top-right-radius: 3px; +} +.panel > .table:last-child, +.panel > .table-responsive:last-child > .table:last-child { + border-bottom-right-radius: 3px; + border-bottom-left-radius: 3px; +} +.panel > .table:last-child > tbody:last-child > tr:last-child, +.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child, +.panel > .table:last-child > tfoot:last-child > tr:last-child, +.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child { + border-bottom-right-radius: 3px; + border-bottom-left-radius: 3px; +} +.panel > .table:last-child > tbody:last-child > tr:last-child td:first-child, +.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:first-child, +.panel > .table:last-child > tfoot:last-child > tr:last-child td:first-child, +.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:first-child, +.panel > .table:last-child > tbody:last-child > tr:last-child th:first-child, +.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:first-child, +.panel > .table:last-child > tfoot:last-child > tr:last-child th:first-child, +.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:first-child { + border-bottom-left-radius: 3px; +} +.panel > .table:last-child > tbody:last-child > tr:last-child td:last-child, +.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:last-child, +.panel > .table:last-child > tfoot:last-child > tr:last-child td:last-child, +.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:last-child, +.panel > .table:last-child > tbody:last-child > tr:last-child th:last-child, +.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:last-child, +.panel > .table:last-child > tfoot:last-child > tr:last-child th:last-child, +.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:last-child { + border-bottom-right-radius: 3px; +} +.panel > .panel-body + .table, +.panel > .panel-body + .table-responsive, +.panel > .table + .panel-body, +.panel > .table-responsive + .panel-body { + border-top: 1px solid #ddd; +} +.panel > .table > tbody:first-child > tr:first-child th, +.panel > .table > tbody:first-child > tr:first-child td { + border-top: 0; +} +.panel > .table-bordered, +.panel > .table-responsive > .table-bordered { + border: 0; +} +.panel > .table-bordered > thead > tr > th:first-child, +.panel > .table-responsive > .table-bordered > thead > tr > th:first-child, +.panel > .table-bordered > tbody > tr > th:first-child, +.panel > .table-responsive > .table-bordered > tbody > tr > th:first-child, +.panel > .table-bordered > tfoot > tr > th:first-child, +.panel > .table-responsive > .table-bordered > tfoot > tr > th:first-child, +.panel > .table-bordered > thead > tr > td:first-child, +.panel > .table-responsive > .table-bordered > thead > tr > td:first-child, +.panel > .table-bordered > tbody > tr > td:first-child, +.panel > .table-responsive > .table-bordered > tbody > tr > td:first-child, +.panel > .table-bordered > tfoot > tr > td:first-child, +.panel > .table-responsive > .table-bordered > tfoot > tr > td:first-child { + border-left: 0; +} +.panel > .table-bordered > thead > tr > th:last-child, +.panel > .table-responsive > .table-bordered > thead > tr > th:last-child, +.panel > .table-bordered > tbody > tr > th:last-child, +.panel > .table-responsive > .table-bordered > tbody > tr > th:last-child, +.panel > .table-bordered > tfoot > tr > th:last-child, +.panel > .table-responsive > .table-bordered > tfoot > tr > th:last-child, +.panel > .table-bordered > thead > tr > td:last-child, +.panel > .table-responsive > .table-bordered > thead > tr > td:last-child, +.panel > .table-bordered > tbody > tr > td:last-child, +.panel > .table-responsive > .table-bordered > tbody > tr > td:last-child, +.panel > .table-bordered > tfoot > tr > td:last-child, +.panel > .table-responsive > .table-bordered > tfoot > tr > td:last-child { + border-right: 0; +} +.panel > .table-bordered > thead > tr:first-child > td, +.panel > .table-responsive > .table-bordered > thead > tr:first-child > td, +.panel > .table-bordered > tbody > tr:first-child > td, +.panel > .table-responsive > .table-bordered > tbody > tr:first-child > td, +.panel > .table-bordered > thead > tr:first-child > th, +.panel > .table-responsive > .table-bordered > thead > tr:first-child > th, +.panel > .table-bordered > tbody > tr:first-child > th, +.panel > .table-responsive > .table-bordered > tbody > tr:first-child > th { + border-bottom: 0; +} +.panel > .table-bordered > tbody > tr:last-child > td, +.panel > .table-responsive > .table-bordered > tbody > tr:last-child > td, +.panel > .table-bordered > tfoot > tr:last-child > td, +.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > td, +.panel > .table-bordered > tbody > tr:last-child > th, +.panel > .table-responsive > .table-bordered > tbody > tr:last-child > th, +.panel > .table-bordered > tfoot > tr:last-child > th, +.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > th { + border-bottom: 0; +} +.panel > .table-responsive { + margin-bottom: 0; + border: 0; +} +.panel-group { + margin-bottom: 20px; +} +.panel-group .panel { + margin-bottom: 0; + border-radius: 4px; +} +.panel-group .panel + .panel { + margin-top: 5px; +} +.panel-group .panel-heading { + border-bottom: 0; +} +.panel-group .panel-heading + .panel-collapse > .panel-body, +.panel-group .panel-heading + .panel-collapse > .list-group { + border-top: 1px solid #ddd; +} +.panel-group .panel-footer { + border-top: 0; +} +.panel-group .panel-footer + .panel-collapse .panel-body { + border-bottom: 1px solid #ddd; +} +.panel-default { + border-color: #ddd; +} +.panel-default > .panel-heading { + color: #333; + background-color: #f5f5f5; + border-color: #ddd; +} +.panel-default > .panel-heading + .panel-collapse > .panel-body { + border-top-color: #ddd; +} +.panel-default > .panel-heading .badge { + color: #f5f5f5; + background-color: #333; +} +.panel-default > .panel-footer + .panel-collapse > .panel-body { + border-bottom-color: #ddd; +} +.panel-primary { + border-color: #337ab7; +} +.panel-primary > .panel-heading { + color: #fff; + background-color: #337ab7; + border-color: #337ab7; +} +.panel-primary > .panel-heading + .panel-collapse > .panel-body { + border-top-color: #337ab7; +} +.panel-primary > .panel-heading .badge { + color: #337ab7; + background-color: #fff; +} +.panel-primary > .panel-footer + .panel-collapse > .panel-body { + border-bottom-color: #337ab7; +} +.panel-success { + border-color: #d6e9c6; +} +.panel-success > .panel-heading { + color: #3c763d; + background-color: #dff0d8; + border-color: #d6e9c6; +} +.panel-success > .panel-heading + .panel-collapse > .panel-body { + border-top-color: #d6e9c6; +} +.panel-success > .panel-heading .badge { + color: #dff0d8; + background-color: #3c763d; +} +.panel-success > .panel-footer + .panel-collapse > .panel-body { + border-bottom-color: #d6e9c6; +} +.panel-info { + border-color: #bce8f1; +} +.panel-info > .panel-heading { + color: #31708f; + background-color: #d9edf7; + border-color: #bce8f1; +} +.panel-info > .panel-heading + .panel-collapse > .panel-body { + border-top-color: #bce8f1; +} +.panel-info > .panel-heading .badge { + color: #d9edf7; + background-color: #31708f; +} +.panel-info > .panel-footer + .panel-collapse > .panel-body { + border-bottom-color: #bce8f1; +} +.panel-warning { + border-color: #faebcc; +} +.panel-warning > .panel-heading { + color: #8a6d3b; + background-color: #fcf8e3; + border-color: #faebcc; +} +.panel-warning > .panel-heading + .panel-collapse > .panel-body { + border-top-color: #faebcc; +} +.panel-warning > .panel-heading .badge { + color: #fcf8e3; + background-color: #8a6d3b; +} +.panel-warning > .panel-footer + .panel-collapse > .panel-body { + border-bottom-color: #faebcc; +} +.panel-danger { + border-color: #ebccd1; +} +.panel-danger > .panel-heading { + color: #a94442; + background-color: #f2dede; + border-color: #ebccd1; +} +.panel-danger > .panel-heading + .panel-collapse > .panel-body { + border-top-color: #ebccd1; +} +.panel-danger > .panel-heading .badge { + color: #f2dede; + background-color: #a94442; +} +.panel-danger > .panel-footer + .panel-collapse > .panel-body { + border-bottom-color: #ebccd1; +} +.embed-responsive { + position: relative; + display: block; + height: 0; + padding: 0; + overflow: hidden; +} +.embed-responsive .embed-responsive-item, +.embed-responsive iframe, +.embed-responsive embed, +.embed-responsive object, +.embed-responsive video { + position: absolute; + top: 0; + bottom: 0; + left: 0; + width: 100%; + height: 100%; + border: 0; +} +.embed-responsive-16by9 { + padding-bottom: 56.25%; +} +.embed-responsive-4by3 { + padding-bottom: 75%; +} +.well { + min-height: 20px; + padding: 19px; + margin-bottom: 20px; + background-color: #f5f5f5; + border: 1px solid #e3e3e3; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05); +} +.well blockquote { + border-color: #ddd; + border-color: rgba(0, 0, 0, .15); +} +.well-lg { + padding: 24px; + border-radius: 6px; +} +.well-sm { + padding: 9px; + border-radius: 3px; +} +.close { + float: right; + font-size: 21px; + font-weight: bold; + line-height: 1; + color: #000; + text-shadow: 0 1px 0 #fff; + filter: alpha(opacity=20); + opacity: .2; +} +.close:hover, +.close:focus { + color: #000; + text-decoration: none; + cursor: pointer; + filter: alpha(opacity=50); + opacity: .5; +} +button.close { + -webkit-appearance: none; + padding: 0; + cursor: pointer; + background: transparent; + border: 0; +} +.modal-open { + overflow: hidden; +} +.modal { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 1050; + display: none; + overflow: hidden; + -webkit-overflow-scrolling: touch; + outline: 0; +} +.modal.fade .modal-dialog { + -webkit-transition: -webkit-transform .3s ease-out; + -o-transition: -o-transform .3s ease-out; + transition: transform .3s ease-out; + -webkit-transform: translate(0, -25%); + -ms-transform: translate(0, -25%); + -o-transform: translate(0, -25%); + transform: translate(0, -25%); +} +.modal.in .modal-dialog { + -webkit-transform: translate(0, 0); + -ms-transform: translate(0, 0); + -o-transform: translate(0, 0); + transform: translate(0, 0); +} +.modal-open .modal { + overflow-x: hidden; + overflow-y: auto; +} +.modal-dialog { + position: relative; + width: auto; + margin: 10px; +} +.modal-content { + position: relative; + background-color: #fff; + -webkit-background-clip: padding-box; + background-clip: padding-box; + border: 1px solid #999; + border: 1px solid rgba(0, 0, 0, .2); + border-radius: 6px; + outline: 0; + -webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, .5); + box-shadow: 0 3px 9px rgba(0, 0, 0, .5); +} +.modal-backdrop { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 1040; + background-color: #000; +} +.modal-backdrop.fade { + filter: alpha(opacity=0); + opacity: 0; +} +.modal-backdrop.in { + filter: alpha(opacity=50); + opacity: .5; +} +.modal-header { + min-height: 16.42857143px; + padding: 15px; + border-bottom: 1px solid #e5e5e5; +} +.modal-header .close { + margin-top: -2px; +} +.modal-title { + margin: 0; + line-height: 1.42857143; +} +.modal-body { + position: relative; + padding: 15px; +} +.modal-footer { + padding: 15px; + text-align: right; + border-top: 1px solid #e5e5e5; +} +.modal-footer .btn + .btn { + margin-bottom: 0; + margin-left: 5px; +} +.modal-footer .btn-group .btn + .btn { + margin-left: -1px; +} +.modal-footer .btn-block + .btn-block { + margin-left: 0; +} +.modal-scrollbar-measure { + position: absolute; + top: -9999px; + width: 50px; + height: 50px; + overflow: scroll; +} +@media (min-width: 768px) { + .modal-dialog { + width: 600px; + margin: 30px auto; + } + .modal-content { + -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, .5); + box-shadow: 0 5px 15px rgba(0, 0, 0, .5); + } + .modal-sm { + width: 300px; + } +} +@media (min-width: 992px) { + .modal-lg { + width: 900px; + } +} +.tooltip { + position: absolute; + z-index: 1070; + display: block; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 12px; + font-weight: normal; + line-height: 1.4; + filter: alpha(opacity=0); + opacity: 0; +} +.tooltip.in { + filter: alpha(opacity=90); + opacity: .9; +} +.tooltip.top { + padding: 5px 0; + margin-top: -3px; +} +.tooltip.right { + padding: 0 5px; + margin-left: 3px; +} +.tooltip.bottom { + padding: 5px 0; + margin-top: 3px; +} +.tooltip.left { + padding: 0 5px; + margin-left: -3px; +} +.tooltip-inner { + max-width: 200px; + padding: 3px 8px; + color: #fff; + text-align: center; + text-decoration: none; + background-color: #000; + border-radius: 4px; +} +.tooltip-arrow { + position: absolute; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; +} +.tooltip.top .tooltip-arrow { + bottom: 0; + left: 50%; + margin-left: -5px; + border-width: 5px 5px 0; + border-top-color: #000; +} +.tooltip.top-left .tooltip-arrow { + right: 5px; + bottom: 0; + margin-bottom: -5px; + border-width: 5px 5px 0; + border-top-color: #000; +} +.tooltip.top-right .tooltip-arrow { + bottom: 0; + left: 5px; + margin-bottom: -5px; + border-width: 5px 5px 0; + border-top-color: #000; +} +.tooltip.right .tooltip-arrow { + top: 50%; + left: 0; + margin-top: -5px; + border-width: 5px 5px 5px 0; + border-right-color: #000; +} +.tooltip.left .tooltip-arrow { + top: 50%; + right: 0; + margin-top: -5px; + border-width: 5px 0 5px 5px; + border-left-color: #000; +} +.tooltip.bottom .tooltip-arrow { + top: 0; + left: 50%; + margin-left: -5px; + border-width: 0 5px 5px; + border-bottom-color: #000; +} +.tooltip.bottom-left .tooltip-arrow { + top: 0; + right: 5px; + margin-top: -5px; + border-width: 0 5px 5px; + border-bottom-color: #000; +} +.tooltip.bottom-right .tooltip-arrow { + top: 0; + left: 5px; + margin-top: -5px; + border-width: 0 5px 5px; + border-bottom-color: #000; +} +.popover { + position: absolute; + top: 0; + left: 0; + z-index: 1060; + display: none; + max-width: 276px; + padding: 1px; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 14px; + font-weight: normal; + line-height: 1.42857143; + text-align: left; + white-space: normal; + background-color: #fff; + -webkit-background-clip: padding-box; + background-clip: padding-box; + border: 1px solid #ccc; + border: 1px solid rgba(0, 0, 0, .2); + border-radius: 6px; + -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, .2); + box-shadow: 0 5px 10px rgba(0, 0, 0, .2); +} +.popover.top { + margin-top: -10px; +} +.popover.right { + margin-left: 10px; +} +.popover.bottom { + margin-top: 10px; +} +.popover.left { + margin-left: -10px; +} +.popover-title { + padding: 8px 14px; + margin: 0; + font-size: 14px; + background-color: #f7f7f7; + border-bottom: 1px solid #ebebeb; + border-radius: 5px 5px 0 0; +} +.popover-content { + padding: 9px 14px; +} +.popover > .arrow, +.popover > .arrow:after { + position: absolute; + display: block; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; +} +.popover > .arrow { + border-width: 11px; +} +.popover > .arrow:after { + content: ""; + border-width: 10px; +} +.popover.top > .arrow { + bottom: -11px; + left: 50%; + margin-left: -11px; + border-top-color: #999; + border-top-color: rgba(0, 0, 0, .25); + border-bottom-width: 0; +} +.popover.top > .arrow:after { + bottom: 1px; + margin-left: -10px; + content: " "; + border-top-color: #fff; + border-bottom-width: 0; +} +.popover.right > .arrow { + top: 50%; + left: -11px; + margin-top: -11px; + border-right-color: #999; + border-right-color: rgba(0, 0, 0, .25); + border-left-width: 0; +} +.popover.right > .arrow:after { + bottom: -10px; + left: 1px; + content: " "; + border-right-color: #fff; + border-left-width: 0; +} +.popover.bottom > .arrow { + top: -11px; + left: 50%; + margin-left: -11px; + border-top-width: 0; + border-bottom-color: #999; + border-bottom-color: rgba(0, 0, 0, .25); +} +.popover.bottom > .arrow:after { + top: 1px; + margin-left: -10px; + content: " "; + border-top-width: 0; + border-bottom-color: #fff; +} +.popover.left > .arrow { + top: 50%; + right: -11px; + margin-top: -11px; + border-right-width: 0; + border-left-color: #999; + border-left-color: rgba(0, 0, 0, .25); +} +.popover.left > .arrow:after { + right: 1px; + bottom: -10px; + content: " "; + border-right-width: 0; + border-left-color: #fff; +} +.carousel { + position: relative; +} +.carousel-inner { + position: relative; + width: 100%; + overflow: hidden; +} +.carousel-inner > .item { + position: relative; + display: none; + -webkit-transition: .6s ease-in-out left; + -o-transition: .6s ease-in-out left; + transition: .6s ease-in-out left; +} +.carousel-inner > .item > img, +.carousel-inner > .item > a > img { + line-height: 1; +} +@media all and (transform-3d), (-webkit-transform-3d) { + .carousel-inner > .item { + -webkit-transition: -webkit-transform .6s ease-in-out; + -o-transition: -o-transform .6s ease-in-out; + transition: transform .6s ease-in-out; + + -webkit-backface-visibility: hidden; + backface-visibility: hidden; + -webkit-perspective: 1000; + perspective: 1000; + } + .carousel-inner > .item.next, + .carousel-inner > .item.active.right { + left: 0; + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + } + .carousel-inner > .item.prev, + .carousel-inner > .item.active.left { + left: 0; + -webkit-transform: translate3d(-100%, 0, 0); + transform: translate3d(-100%, 0, 0); + } + .carousel-inner > .item.next.left, + .carousel-inner > .item.prev.right, + .carousel-inner > .item.active { + left: 0; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} +.carousel-inner > .active, +.carousel-inner > .next, +.carousel-inner > .prev { + display: block; +} +.carousel-inner > .active { + left: 0; +} +.carousel-inner > .next, +.carousel-inner > .prev { + position: absolute; + top: 0; + width: 100%; +} +.carousel-inner > .next { + left: 100%; +} +.carousel-inner > .prev { + left: -100%; +} +.carousel-inner > .next.left, +.carousel-inner > .prev.right { + left: 0; +} +.carousel-inner > .active.left { + left: -100%; +} +.carousel-inner > .active.right { + left: 100%; +} +.carousel-control { + position: absolute; + top: 0; + bottom: 0; + left: 0; + width: 15%; + font-size: 20px; + color: #fff; + text-align: center; + text-shadow: 0 1px 2px rgba(0, 0, 0, .6); + filter: alpha(opacity=50); + opacity: .5; +} +.carousel-control.left { + background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%); + background-image: -o-linear-gradient(left, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%); + background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, .5)), to(rgba(0, 0, 0, .0001))); + background-image: linear-gradient(to right, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1); + background-repeat: repeat-x; +} +.carousel-control.right { + right: 0; + left: auto; + background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .0001) 0%, rgba(0, 0, 0, .5) 100%); + background-image: -o-linear-gradient(left, rgba(0, 0, 0, .0001) 0%, rgba(0, 0, 0, .5) 100%); + background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, .0001)), to(rgba(0, 0, 0, .5))); + background-image: linear-gradient(to right, rgba(0, 0, 0, .0001) 0%, rgba(0, 0, 0, .5) 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1); + background-repeat: repeat-x; +} +.carousel-control:hover, +.carousel-control:focus { + color: #fff; + text-decoration: none; + filter: alpha(opacity=90); + outline: 0; + opacity: .9; +} +.carousel-control .icon-prev, +.carousel-control .icon-next, +.carousel-control .glyphicon-chevron-left, +.carousel-control .glyphicon-chevron-right { + position: absolute; + top: 50%; + z-index: 5; + display: inline-block; +} +.carousel-control .icon-prev, +.carousel-control .glyphicon-chevron-left { + left: 50%; + margin-left: -10px; +} +.carousel-control .icon-next, +.carousel-control .glyphicon-chevron-right { + right: 50%; + margin-right: -10px; +} +.carousel-control .icon-prev, +.carousel-control .icon-next { + width: 20px; + height: 20px; + margin-top: -10px; + font-family: serif; + line-height: 1; +} +.carousel-control .icon-prev:before { + content: '\2039'; +} +.carousel-control .icon-next:before { + content: '\203a'; +} +.carousel-indicators { + position: absolute; + bottom: 10px; + left: 50%; + z-index: 15; + width: 60%; + padding-left: 0; + margin-left: -30%; + text-align: center; + list-style: none; +} +.carousel-indicators li { + display: inline-block; + width: 10px; + height: 10px; + margin: 1px; + text-indent: -999px; + cursor: pointer; + background-color: #000 \9; + background-color: rgba(0, 0, 0, 0); + border: 1px solid #fff; + border-radius: 10px; +} +.carousel-indicators .active { + width: 12px; + height: 12px; + margin: 0; + background-color: #fff; +} +.carousel-caption { + position: absolute; + right: 15%; + bottom: 20px; + left: 15%; + z-index: 10; + padding-top: 20px; + padding-bottom: 20px; + color: #fff; + text-align: center; + text-shadow: 0 1px 2px rgba(0, 0, 0, .6); +} +.carousel-caption .btn { + text-shadow: none; +} +@media screen and (min-width: 768px) { + .carousel-control .glyphicon-chevron-left, + .carousel-control .glyphicon-chevron-right, + .carousel-control .icon-prev, + .carousel-control .icon-next { + width: 30px; + height: 30px; + margin-top: -15px; + font-size: 30px; + } + .carousel-control .glyphicon-chevron-left, + .carousel-control .icon-prev { + margin-left: -15px; + } + .carousel-control .glyphicon-chevron-right, + .carousel-control .icon-next { + margin-right: -15px; + } + .carousel-caption { + right: 20%; + left: 20%; + padding-bottom: 30px; + } + .carousel-indicators { + bottom: 20px; + } +} +.clearfix:before, +.clearfix:after, +.dl-horizontal dd:before, +.dl-horizontal dd:after, +.container:before, +.container:after, +.container-fluid:before, +.container-fluid:after, +.row:before, +.row:after, +.form-horizontal .form-group:before, +.form-horizontal .form-group:after, +.btn-toolbar:before, +.btn-toolbar:after, +.btn-group-vertical > .btn-group:before, +.btn-group-vertical > .btn-group:after, +.nav:before, +.nav:after, +.navbar:before, +.navbar:after, +.navbar-header:before, +.navbar-header:after, +.navbar-collapse:before, +.navbar-collapse:after, +.pager:before, +.pager:after, +.panel-body:before, +.panel-body:after, +.modal-footer:before, +.modal-footer:after { + display: table; + content: " "; +} +.clearfix:after, +.dl-horizontal dd:after, +.container:after, +.container-fluid:after, +.row:after, +.form-horizontal .form-group:after, +.btn-toolbar:after, +.btn-group-vertical > .btn-group:after, +.nav:after, +.navbar:after, +.navbar-header:after, +.navbar-collapse:after, +.pager:after, +.panel-body:after, +.modal-footer:after { + clear: both; +} +.center-block { + display: block; + margin-right: auto; + margin-left: auto; +} +.pull-right { + float: right !important; +} +.pull-left { + float: left !important; +} +.hide { + display: none !important; +} +.show { + display: block !important; +} +.invisible { + visibility: hidden; +} +.text-hide { + font: 0/0 a; + color: transparent; + text-shadow: none; + background-color: transparent; + border: 0; +} +.hidden { + display: none !important; +} +.affix { + position: fixed; +} +@-ms-viewport { + width: device-width; +} +.visible-xs, +.visible-sm, +.visible-md, +.visible-lg { + display: none !important; +} +.visible-xs-block, +.visible-xs-inline, +.visible-xs-inline-block, +.visible-sm-block, +.visible-sm-inline, +.visible-sm-inline-block, +.visible-md-block, +.visible-md-inline, +.visible-md-inline-block, +.visible-lg-block, +.visible-lg-inline, +.visible-lg-inline-block { + display: none !important; +} +@media (max-width: 767px) { + .visible-xs { + display: block !important; + } + table.visible-xs { + display: table; + } + tr.visible-xs { + display: table-row !important; + } + th.visible-xs, + td.visible-xs { + display: table-cell !important; + } +} +@media (max-width: 767px) { + .visible-xs-block { + display: block !important; + } +} +@media (max-width: 767px) { + .visible-xs-inline { + display: inline !important; + } +} +@media (max-width: 767px) { + .visible-xs-inline-block { + display: inline-block !important; + } +} +@media (min-width: 768px) and (max-width: 991px) { + .visible-sm { + display: block !important; + } + table.visible-sm { + display: table; + } + tr.visible-sm { + display: table-row !important; + } + th.visible-sm, + td.visible-sm { + display: table-cell !important; + } +} +@media (min-width: 768px) and (max-width: 991px) { + .visible-sm-block { + display: block !important; + } +} +@media (min-width: 768px) and (max-width: 991px) { + .visible-sm-inline { + display: inline !important; + } +} +@media (min-width: 768px) and (max-width: 991px) { + .visible-sm-inline-block { + display: inline-block !important; + } +} +@media (min-width: 992px) and (max-width: 1199px) { + .visible-md { + display: block !important; + } + table.visible-md { + display: table; + } + tr.visible-md { + display: table-row !important; + } + th.visible-md, + td.visible-md { + display: table-cell !important; + } +} +@media (min-width: 992px) and (max-width: 1199px) { + .visible-md-block { + display: block !important; + } +} +@media (min-width: 992px) and (max-width: 1199px) { + .visible-md-inline { + display: inline !important; + } +} +@media (min-width: 992px) and (max-width: 1199px) { + .visible-md-inline-block { + display: inline-block !important; + } +} +@media (min-width: 1200px) { + .visible-lg { + display: block !important; + } + table.visible-lg { + display: table; + } + tr.visible-lg { + display: table-row !important; + } + th.visible-lg, + td.visible-lg { + display: table-cell !important; + } +} +@media (min-width: 1200px) { + .visible-lg-block { + display: block !important; + } +} +@media (min-width: 1200px) { + .visible-lg-inline { + display: inline !important; + } +} +@media (min-width: 1200px) { + .visible-lg-inline-block { + display: inline-block !important; + } +} +@media (max-width: 767px) { + .hidden-xs { + display: none !important; + } +} +@media (min-width: 768px) and (max-width: 991px) { + .hidden-sm { + display: none !important; + } +} +@media (min-width: 992px) and (max-width: 1199px) { + .hidden-md { + display: none !important; + } +} +@media (min-width: 1200px) { + .hidden-lg { + display: none !important; + } +} +.visible-print { + display: none !important; +} +@media print { + .visible-print { + display: block !important; + } + table.visible-print { + display: table; + } + tr.visible-print { + display: table-row !important; + } + th.visible-print, + td.visible-print { + display: table-cell !important; + } +} +.visible-print-block { + display: none !important; +} +@media print { + .visible-print-block { + display: block !important; + } +} +.visible-print-inline { + display: none !important; +} +@media print { + .visible-print-inline { + display: inline !important; + } +} +.visible-print-inline-block { + display: none !important; +} +@media print { + .visible-print-inline-block { + display: inline-block !important; + } +} +@media print { + .hidden-print { + display: none !important; + } +} + +/* tapestry-quickstart customizations start here: */ + +body { padding-top: 70px; } + diff --git a/apache-tapestry/src/main/webapp/mybootstrap/fonts/glyphicons-halflings-regular.eot b/apache-tapestry/src/main/webapp/mybootstrap/fonts/glyphicons-halflings-regular.eot new file mode 100644 index 0000000000..9879fec538 Binary files /dev/null and b/apache-tapestry/src/main/webapp/mybootstrap/fonts/glyphicons-halflings-regular.eot differ diff --git a/apache-tapestry/src/main/webapp/mybootstrap/fonts/glyphicons-halflings-regular.svg b/apache-tapestry/src/main/webapp/mybootstrap/fonts/glyphicons-halflings-regular.svg new file mode 100644 index 0000000000..94fb5490a2 --- /dev/null +++ b/apache-tapestry/src/main/webapp/mybootstrap/fonts/glyphicons-halflings-regular.svg @@ -0,0 +1,288 @@ +<?xml version="1.0" standalone="no"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" > +<svg xmlns="http://www.w3.org/2000/svg"> +<metadata></metadata> +<defs> +<font id="glyphicons_halflingsregular" horiz-adv-x="1200" > +<font-face units-per-em="1200" ascent="960" descent="-240" /> +<missing-glyph horiz-adv-x="500" /> +<glyph horiz-adv-x="0" /> +<glyph horiz-adv-x="400" /> +<glyph unicode=" " /> +<glyph unicode="*" d="M600 1100q15 0 34 -1.5t30 -3.5l11 -1q10 -2 17.5 -10.5t7.5 -18.5v-224l158 158q7 7 18 8t19 -6l106 -106q7 -8 6 -19t-8 -18l-158 -158h224q10 0 18.5 -7.5t10.5 -17.5q6 -41 6 -75q0 -15 -1.5 -34t-3.5 -30l-1 -11q-2 -10 -10.5 -17.5t-18.5 -7.5h-224l158 -158 q7 -7 8 -18t-6 -19l-106 -106q-8 -7 -19 -6t-18 8l-158 158v-224q0 -10 -7.5 -18.5t-17.5 -10.5q-41 -6 -75 -6q-15 0 -34 1.5t-30 3.5l-11 1q-10 2 -17.5 10.5t-7.5 18.5v224l-158 -158q-7 -7 -18 -8t-19 6l-106 106q-7 8 -6 19t8 18l158 158h-224q-10 0 -18.5 7.5 t-10.5 17.5q-6 41 -6 75q0 15 1.5 34t3.5 30l1 11q2 10 10.5 17.5t18.5 7.5h224l-158 158q-7 7 -8 18t6 19l106 106q8 7 19 6t18 -8l158 -158v224q0 10 7.5 18.5t17.5 10.5q41 6 75 6z" /> +<glyph unicode="+" d="M450 1100h200q21 0 35.5 -14.5t14.5 -35.5v-350h350q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-350v-350q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v350h-350q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5 h350v350q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode=" " /> +<glyph unicode="¥" d="M825 1100h250q10 0 12.5 -5t-5.5 -13l-364 -364q-6 -6 -11 -18h268q10 0 13 -6t-3 -14l-120 -160q-6 -8 -18 -14t-22 -6h-125v-100h275q10 0 13 -6t-3 -14l-120 -160q-6 -8 -18 -14t-22 -6h-125v-174q0 -11 -7.5 -18.5t-18.5 -7.5h-148q-11 0 -18.5 7.5t-7.5 18.5v174 h-275q-10 0 -13 6t3 14l120 160q6 8 18 14t22 6h125v100h-275q-10 0 -13 6t3 14l120 160q6 8 18 14t22 6h118q-5 12 -11 18l-364 364q-8 8 -5.5 13t12.5 5h250q25 0 43 -18l164 -164q8 -8 18 -8t18 8l164 164q18 18 43 18z" /> +<glyph unicode=" " horiz-adv-x="650" /> +<glyph unicode=" " horiz-adv-x="1300" /> +<glyph unicode=" " horiz-adv-x="650" /> +<glyph unicode=" " horiz-adv-x="1300" /> +<glyph unicode=" " horiz-adv-x="433" /> +<glyph unicode=" " horiz-adv-x="325" /> +<glyph unicode=" " horiz-adv-x="216" /> +<glyph unicode=" " horiz-adv-x="216" /> +<glyph unicode=" " horiz-adv-x="162" /> +<glyph unicode=" " horiz-adv-x="260" /> +<glyph unicode=" " horiz-adv-x="72" /> +<glyph unicode=" " horiz-adv-x="260" /> +<glyph unicode=" " horiz-adv-x="325" /> +<glyph unicode="€" d="M744 1198q242 0 354 -189q60 -104 66 -209h-181q0 45 -17.5 82.5t-43.5 61.5t-58 40.5t-60.5 24t-51.5 7.5q-19 0 -40.5 -5.5t-49.5 -20.5t-53 -38t-49 -62.5t-39 -89.5h379l-100 -100h-300q-6 -50 -6 -100h406l-100 -100h-300q9 -74 33 -132t52.5 -91t61.5 -54.5t59 -29 t47 -7.5q22 0 50.5 7.5t60.5 24.5t58 41t43.5 61t17.5 80h174q-30 -171 -128 -278q-107 -117 -274 -117q-206 0 -324 158q-36 48 -69 133t-45 204h-217l100 100h112q1 47 6 100h-218l100 100h134q20 87 51 153.5t62 103.5q117 141 297 141z" /> +<glyph unicode="₽" d="M428 1200h350q67 0 120 -13t86 -31t57 -49.5t35 -56.5t17 -64.5t6.5 -60.5t0.5 -57v-16.5v-16.5q0 -36 -0.5 -57t-6.5 -61t-17 -65t-35 -57t-57 -50.5t-86 -31.5t-120 -13h-178l-2 -100h288q10 0 13 -6t-3 -14l-120 -160q-6 -8 -18 -14t-22 -6h-138v-175q0 -11 -5.5 -18 t-15.5 -7h-149q-10 0 -17.5 7.5t-7.5 17.5v175h-267q-10 0 -13 6t3 14l120 160q6 8 18 14t22 6h117v100h-267q-10 0 -13 6t3 14l120 160q6 8 18 14t22 6h117v475q0 10 7.5 17.5t17.5 7.5zM600 1000v-300h203q64 0 86.5 33t22.5 119q0 84 -22.5 116t-86.5 32h-203z" /> +<glyph unicode="−" d="M250 700h800q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="⌛" d="M1000 1200v-150q0 -21 -14.5 -35.5t-35.5 -14.5h-50v-100q0 -91 -49.5 -165.5t-130.5 -109.5q81 -35 130.5 -109.5t49.5 -165.5v-150h50q21 0 35.5 -14.5t14.5 -35.5v-150h-800v150q0 21 14.5 35.5t35.5 14.5h50v150q0 91 49.5 165.5t130.5 109.5q-81 35 -130.5 109.5 t-49.5 165.5v100h-50q-21 0 -35.5 14.5t-14.5 35.5v150h800zM400 1000v-100q0 -60 32.5 -109.5t87.5 -73.5q28 -12 44 -37t16 -55t-16 -55t-44 -37q-55 -24 -87.5 -73.5t-32.5 -109.5v-150h400v150q0 60 -32.5 109.5t-87.5 73.5q-28 12 -44 37t-16 55t16 55t44 37 q55 24 87.5 73.5t32.5 109.5v100h-400z" /> +<glyph unicode="◼" horiz-adv-x="500" d="M0 0z" /> +<glyph unicode="☁" d="M503 1089q110 0 200.5 -59.5t134.5 -156.5q44 14 90 14q120 0 205 -86.5t85 -206.5q0 -121 -85 -207.5t-205 -86.5h-750q-79 0 -135.5 57t-56.5 137q0 69 42.5 122.5t108.5 67.5q-2 12 -2 37q0 153 108 260.5t260 107.5z" /> +<glyph unicode="⛺" d="M774 1193.5q16 -9.5 20.5 -27t-5.5 -33.5l-136 -187l467 -746h30q20 0 35 -18.5t15 -39.5v-42h-1200v42q0 21 15 39.5t35 18.5h30l468 746l-135 183q-10 16 -5.5 34t20.5 28t34 5.5t28 -20.5l111 -148l112 150q9 16 27 20.5t34 -5zM600 200h377l-182 112l-195 534v-646z " /> +<glyph unicode="✉" d="M25 1100h1150q10 0 12.5 -5t-5.5 -13l-564 -567q-8 -8 -18 -8t-18 8l-564 567q-8 8 -5.5 13t12.5 5zM18 882l264 -264q8 -8 8 -18t-8 -18l-264 -264q-8 -8 -13 -5.5t-5 12.5v550q0 10 5 12.5t13 -5.5zM918 618l264 264q8 8 13 5.5t5 -12.5v-550q0 -10 -5 -12.5t-13 5.5 l-264 264q-8 8 -8 18t8 18zM818 482l364 -364q8 -8 5.5 -13t-12.5 -5h-1150q-10 0 -12.5 5t5.5 13l364 364q8 8 18 8t18 -8l164 -164q8 -8 18 -8t18 8l164 164q8 8 18 8t18 -8z" /> +<glyph unicode="✏" d="M1011 1210q19 0 33 -13l153 -153q13 -14 13 -33t-13 -33l-99 -92l-214 214l95 96q13 14 32 14zM1013 800l-615 -614l-214 214l614 614zM317 96l-333 -112l110 335z" /> +<glyph unicode="" d="M700 650v-550h250q21 0 35.5 -14.5t14.5 -35.5v-50h-800v50q0 21 14.5 35.5t35.5 14.5h250v550l-500 550h1200z" /> +<glyph unicode="" d="M368 1017l645 163q39 15 63 0t24 -49v-831q0 -55 -41.5 -95.5t-111.5 -63.5q-79 -25 -147 -4.5t-86 75t25.5 111.5t122.5 82q72 24 138 8v521l-600 -155v-606q0 -42 -44 -90t-109 -69q-79 -26 -147 -5.5t-86 75.5t25.5 111.5t122.5 82.5q72 24 138 7v639q0 38 14.5 59 t53.5 34z" /> +<glyph unicode="" d="M500 1191q100 0 191 -39t156.5 -104.5t104.5 -156.5t39 -191l-1 -2l1 -5q0 -141 -78 -262l275 -274q23 -26 22.5 -44.5t-22.5 -42.5l-59 -58q-26 -20 -46.5 -20t-39.5 20l-275 274q-119 -77 -261 -77l-5 1l-2 -1q-100 0 -191 39t-156.5 104.5t-104.5 156.5t-39 191 t39 191t104.5 156.5t156.5 104.5t191 39zM500 1022q-88 0 -162 -43t-117 -117t-43 -162t43 -162t117 -117t162 -43t162 43t117 117t43 162t-43 162t-117 117t-162 43z" /> +<glyph unicode="" d="M649 949q48 68 109.5 104t121.5 38.5t118.5 -20t102.5 -64t71 -100.5t27 -123q0 -57 -33.5 -117.5t-94 -124.5t-126.5 -127.5t-150 -152.5t-146 -174q-62 85 -145.5 174t-150 152.5t-126.5 127.5t-93.5 124.5t-33.5 117.5q0 64 28 123t73 100.5t104 64t119 20 t120.5 -38.5t104.5 -104z" /> +<glyph unicode="" d="M407 800l131 353q7 19 17.5 19t17.5 -19l129 -353h421q21 0 24 -8.5t-14 -20.5l-342 -249l130 -401q7 -20 -0.5 -25.5t-24.5 6.5l-343 246l-342 -247q-17 -12 -24.5 -6.5t-0.5 25.5l130 400l-347 251q-17 12 -14 20.5t23 8.5h429z" /> +<glyph unicode="" d="M407 800l131 353q7 19 17.5 19t17.5 -19l129 -353h421q21 0 24 -8.5t-14 -20.5l-342 -249l130 -401q7 -20 -0.5 -25.5t-24.5 6.5l-343 246l-342 -247q-17 -12 -24.5 -6.5t-0.5 25.5l130 400l-347 251q-17 12 -14 20.5t23 8.5h429zM477 700h-240l197 -142l-74 -226 l193 139l195 -140l-74 229l192 140h-234l-78 211z" /> +<glyph unicode="" d="M600 1200q124 0 212 -88t88 -212v-250q0 -46 -31 -98t-69 -52v-75q0 -10 6 -21.5t15 -17.5l358 -230q9 -5 15 -16.5t6 -21.5v-93q0 -10 -7.5 -17.5t-17.5 -7.5h-1150q-10 0 -17.5 7.5t-7.5 17.5v93q0 10 6 21.5t15 16.5l358 230q9 6 15 17.5t6 21.5v75q-38 0 -69 52 t-31 98v250q0 124 88 212t212 88z" /> +<glyph unicode="" d="M25 1100h1150q10 0 17.5 -7.5t7.5 -17.5v-1050q0 -10 -7.5 -17.5t-17.5 -7.5h-1150q-10 0 -17.5 7.5t-7.5 17.5v1050q0 10 7.5 17.5t17.5 7.5zM100 1000v-100h100v100h-100zM875 1000h-550q-10 0 -17.5 -7.5t-7.5 -17.5v-350q0 -10 7.5 -17.5t17.5 -7.5h550 q10 0 17.5 7.5t7.5 17.5v350q0 10 -7.5 17.5t-17.5 7.5zM1000 1000v-100h100v100h-100zM100 800v-100h100v100h-100zM1000 800v-100h100v100h-100zM100 600v-100h100v100h-100zM1000 600v-100h100v100h-100zM875 500h-550q-10 0 -17.5 -7.5t-7.5 -17.5v-350q0 -10 7.5 -17.5 t17.5 -7.5h550q10 0 17.5 7.5t7.5 17.5v350q0 10 -7.5 17.5t-17.5 7.5zM100 400v-100h100v100h-100zM1000 400v-100h100v100h-100zM100 200v-100h100v100h-100zM1000 200v-100h100v100h-100z" /> +<glyph unicode="" d="M50 1100h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM650 1100h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400 q0 21 14.5 35.5t35.5 14.5zM50 500h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM650 500h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400 q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M50 1100h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM450 1100h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200 q0 21 14.5 35.5t35.5 14.5zM850 1100h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM50 700h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200 q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM450 700h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM850 700h200q21 0 35.5 -14.5t14.5 -35.5v-200 q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM50 300h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM450 300h200 q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM850 300h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5 t35.5 14.5z" /> +<glyph unicode="" d="M50 1100h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM450 1100h700q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-700q-21 0 -35.5 14.5t-14.5 35.5v200 q0 21 14.5 35.5t35.5 14.5zM50 700h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM450 700h700q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-700 q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM50 300h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM450 300h700q21 0 35.5 -14.5t14.5 -35.5v-200 q0 -21 -14.5 -35.5t-35.5 -14.5h-700q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M465 477l571 571q8 8 18 8t17 -8l177 -177q8 -7 8 -17t-8 -18l-783 -784q-7 -8 -17.5 -8t-17.5 8l-384 384q-8 8 -8 18t8 17l177 177q7 8 17 8t18 -8l171 -171q7 -7 18 -7t18 7z" /> +<glyph unicode="" d="M904 1083l178 -179q8 -8 8 -18.5t-8 -17.5l-267 -268l267 -268q8 -7 8 -17.5t-8 -18.5l-178 -178q-8 -8 -18.5 -8t-17.5 8l-268 267l-268 -267q-7 -8 -17.5 -8t-18.5 8l-178 178q-8 8 -8 18.5t8 17.5l267 268l-267 268q-8 7 -8 17.5t8 18.5l178 178q8 8 18.5 8t17.5 -8 l268 -267l268 268q7 7 17.5 7t18.5 -7z" /> +<glyph unicode="" d="M507 1177q98 0 187.5 -38.5t154.5 -103.5t103.5 -154.5t38.5 -187.5q0 -141 -78 -262l300 -299q8 -8 8 -18.5t-8 -18.5l-109 -108q-7 -8 -17.5 -8t-18.5 8l-300 299q-119 -77 -261 -77q-98 0 -188 38.5t-154.5 103t-103 154.5t-38.5 188t38.5 187.5t103 154.5 t154.5 103.5t188 38.5zM506.5 1023q-89.5 0 -165.5 -44t-120 -120.5t-44 -166t44 -165.5t120 -120t165.5 -44t166 44t120.5 120t44 165.5t-44 166t-120.5 120.5t-166 44zM425 900h150q10 0 17.5 -7.5t7.5 -17.5v-75h75q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5 t-17.5 -7.5h-75v-75q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v75h-75q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5h75v75q0 10 7.5 17.5t17.5 7.5z" /> +<glyph unicode="" d="M507 1177q98 0 187.5 -38.5t154.5 -103.5t103.5 -154.5t38.5 -187.5q0 -141 -78 -262l300 -299q8 -8 8 -18.5t-8 -18.5l-109 -108q-7 -8 -17.5 -8t-18.5 8l-300 299q-119 -77 -261 -77q-98 0 -188 38.5t-154.5 103t-103 154.5t-38.5 188t38.5 187.5t103 154.5 t154.5 103.5t188 38.5zM506.5 1023q-89.5 0 -165.5 -44t-120 -120.5t-44 -166t44 -165.5t120 -120t165.5 -44t166 44t120.5 120t44 165.5t-44 166t-120.5 120.5t-166 44zM325 800h350q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-350q-10 0 -17.5 7.5 t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5z" /> +<glyph unicode="" d="M550 1200h100q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM800 975v166q167 -62 272 -209.5t105 -331.5q0 -117 -45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5 t-184.5 123t-123 184.5t-45.5 224q0 184 105 331.5t272 209.5v-166q-103 -55 -165 -155t-62 -220q0 -116 57 -214.5t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5q0 120 -62 220t-165 155z" /> +<glyph unicode="" d="M1025 1200h150q10 0 17.5 -7.5t7.5 -17.5v-1150q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v1150q0 10 7.5 17.5t17.5 7.5zM725 800h150q10 0 17.5 -7.5t7.5 -17.5v-750q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v750 q0 10 7.5 17.5t17.5 7.5zM425 500h150q10 0 17.5 -7.5t7.5 -17.5v-450q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v450q0 10 7.5 17.5t17.5 7.5zM125 300h150q10 0 17.5 -7.5t7.5 -17.5v-250q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5 v250q0 10 7.5 17.5t17.5 7.5z" /> +<glyph unicode="" d="M600 1174q33 0 74 -5l38 -152l5 -1q49 -14 94 -39l5 -2l134 80q61 -48 104 -105l-80 -134l3 -5q25 -44 39 -93l1 -6l152 -38q5 -43 5 -73q0 -34 -5 -74l-152 -38l-1 -6q-15 -49 -39 -93l-3 -5l80 -134q-48 -61 -104 -105l-134 81l-5 -3q-44 -25 -94 -39l-5 -2l-38 -151 q-43 -5 -74 -5q-33 0 -74 5l-38 151l-5 2q-49 14 -94 39l-5 3l-134 -81q-60 48 -104 105l80 134l-3 5q-25 45 -38 93l-2 6l-151 38q-6 42 -6 74q0 33 6 73l151 38l2 6q13 48 38 93l3 5l-80 134q47 61 105 105l133 -80l5 2q45 25 94 39l5 1l38 152q43 5 74 5zM600 815 q-89 0 -152 -63t-63 -151.5t63 -151.5t152 -63t152 63t63 151.5t-63 151.5t-152 63z" /> +<glyph unicode="" d="M500 1300h300q41 0 70.5 -29.5t29.5 -70.5v-100h275q10 0 17.5 -7.5t7.5 -17.5v-75h-1100v75q0 10 7.5 17.5t17.5 7.5h275v100q0 41 29.5 70.5t70.5 29.5zM500 1200v-100h300v100h-300zM1100 900v-800q0 -41 -29.5 -70.5t-70.5 -29.5h-700q-41 0 -70.5 29.5t-29.5 70.5 v800h900zM300 800v-700h100v700h-100zM500 800v-700h100v700h-100zM700 800v-700h100v700h-100zM900 800v-700h100v700h-100z" /> +<glyph unicode="" d="M18 618l620 608q8 7 18.5 7t17.5 -7l608 -608q8 -8 5.5 -13t-12.5 -5h-175v-575q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v375h-300v-375q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v575h-175q-10 0 -12.5 5t5.5 13z" /> +<glyph unicode="" d="M600 1200v-400q0 -41 29.5 -70.5t70.5 -29.5h300v-650q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v1100q0 21 14.5 35.5t35.5 14.5h450zM1000 800h-250q-21 0 -35.5 14.5t-14.5 35.5v250z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5t-57 214.5t-155.5 155.5t-214.5 57zM525 900h50q10 0 17.5 -7.5t7.5 -17.5v-275h175q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v350q0 10 7.5 17.5t17.5 7.5z" /> +<glyph unicode="" d="M1300 0h-538l-41 400h-242l-41 -400h-538l431 1200h209l-21 -300h162l-20 300h208zM515 800l-27 -300h224l-27 300h-170z" /> +<glyph unicode="" d="M550 1200h200q21 0 35.5 -14.5t14.5 -35.5v-450h191q20 0 25.5 -11.5t-7.5 -27.5l-327 -400q-13 -16 -32 -16t-32 16l-327 400q-13 16 -7.5 27.5t25.5 11.5h191v450q0 21 14.5 35.5t35.5 14.5zM1125 400h50q10 0 17.5 -7.5t7.5 -17.5v-350q0 -10 -7.5 -17.5t-17.5 -7.5 h-1050q-10 0 -17.5 7.5t-7.5 17.5v350q0 10 7.5 17.5t17.5 7.5h50q10 0 17.5 -7.5t7.5 -17.5v-175h900v175q0 10 7.5 17.5t17.5 7.5z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5t-57 214.5t-155.5 155.5t-214.5 57zM525 900h150q10 0 17.5 -7.5t7.5 -17.5v-275h137q21 0 26 -11.5t-8 -27.5l-223 -275q-13 -16 -32 -16t-32 16l-223 275q-13 16 -8 27.5t26 11.5h137v275q0 10 7.5 17.5t17.5 7.5z " /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5t-57 214.5t-155.5 155.5t-214.5 57zM632 914l223 -275q13 -16 8 -27.5t-26 -11.5h-137v-275q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v275h-137q-21 0 -26 11.5t8 27.5l223 275q13 16 32 16 t32 -16z" /> +<glyph unicode="" d="M225 1200h750q10 0 19.5 -7t12.5 -17l186 -652q7 -24 7 -49v-425q0 -12 -4 -27t-9 -17q-12 -6 -37 -6h-1100q-12 0 -27 4t-17 8q-6 13 -6 38l1 425q0 25 7 49l185 652q3 10 12.5 17t19.5 7zM878 1000h-556q-10 0 -19 -7t-11 -18l-87 -450q-2 -11 4 -18t16 -7h150 q10 0 19.5 -7t11.5 -17l38 -152q2 -10 11.5 -17t19.5 -7h250q10 0 19.5 7t11.5 17l38 152q2 10 11.5 17t19.5 7h150q10 0 16 7t4 18l-87 450q-2 11 -11 18t-19 7z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5t-57 214.5t-155.5 155.5t-214.5 57zM540 820l253 -190q17 -12 17 -30t-17 -30l-253 -190q-16 -12 -28 -6.5t-12 26.5v400q0 21 12 26.5t28 -6.5z" /> +<glyph unicode="" d="M947 1060l135 135q7 7 12.5 5t5.5 -13v-362q0 -10 -7.5 -17.5t-17.5 -7.5h-362q-11 0 -13 5.5t5 12.5l133 133q-109 76 -238 76q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5h150q0 -117 -45.5 -224 t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5q192 0 347 -117z" /> +<glyph unicode="" d="M947 1060l135 135q7 7 12.5 5t5.5 -13v-361q0 -11 -7.5 -18.5t-18.5 -7.5h-361q-11 0 -13 5.5t5 12.5l134 134q-110 75 -239 75q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5h-150q0 117 45.5 224t123 184.5t184.5 123t224 45.5q192 0 347 -117zM1027 600h150 q0 -117 -45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5q-192 0 -348 118l-134 -134q-7 -8 -12.5 -5.5t-5.5 12.5v360q0 11 7.5 18.5t18.5 7.5h360q10 0 12.5 -5.5t-5.5 -12.5l-133 -133q110 -76 240 -76q116 0 214.5 57t155.5 155.5t57 214.5z" /> +<glyph unicode="" d="M125 1200h1050q10 0 17.5 -7.5t7.5 -17.5v-1150q0 -10 -7.5 -17.5t-17.5 -7.5h-1050q-10 0 -17.5 7.5t-7.5 17.5v1150q0 10 7.5 17.5t17.5 7.5zM1075 1000h-850q-10 0 -17.5 -7.5t-7.5 -17.5v-850q0 -10 7.5 -17.5t17.5 -7.5h850q10 0 17.5 7.5t7.5 17.5v850 q0 10 -7.5 17.5t-17.5 7.5zM325 900h50q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-50q-10 0 -17.5 7.5t-7.5 17.5v50q0 10 7.5 17.5t17.5 7.5zM525 900h450q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-450q-10 0 -17.5 7.5t-7.5 17.5v50 q0 10 7.5 17.5t17.5 7.5zM325 700h50q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-50q-10 0 -17.5 7.5t-7.5 17.5v50q0 10 7.5 17.5t17.5 7.5zM525 700h450q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-450q-10 0 -17.5 7.5t-7.5 17.5v50 q0 10 7.5 17.5t17.5 7.5zM325 500h50q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-50q-10 0 -17.5 7.5t-7.5 17.5v50q0 10 7.5 17.5t17.5 7.5zM525 500h450q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-450q-10 0 -17.5 7.5t-7.5 17.5v50 q0 10 7.5 17.5t17.5 7.5zM325 300h50q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-50q-10 0 -17.5 7.5t-7.5 17.5v50q0 10 7.5 17.5t17.5 7.5zM525 300h450q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-450q-10 0 -17.5 7.5t-7.5 17.5v50 q0 10 7.5 17.5t17.5 7.5z" /> +<glyph unicode="" d="M900 800v200q0 83 -58.5 141.5t-141.5 58.5h-300q-82 0 -141 -59t-59 -141v-200h-100q-41 0 -70.5 -29.5t-29.5 -70.5v-600q0 -41 29.5 -70.5t70.5 -29.5h900q41 0 70.5 29.5t29.5 70.5v600q0 41 -29.5 70.5t-70.5 29.5h-100zM400 800v150q0 21 15 35.5t35 14.5h200 q20 0 35 -14.5t15 -35.5v-150h-300z" /> +<glyph unicode="" d="M125 1100h50q10 0 17.5 -7.5t7.5 -17.5v-1075h-100v1075q0 10 7.5 17.5t17.5 7.5zM1075 1052q4 0 9 -2q16 -6 16 -23v-421q0 -6 -3 -12q-33 -59 -66.5 -99t-65.5 -58t-56.5 -24.5t-52.5 -6.5q-26 0 -57.5 6.5t-52.5 13.5t-60 21q-41 15 -63 22.5t-57.5 15t-65.5 7.5 q-85 0 -160 -57q-7 -5 -15 -5q-6 0 -11 3q-14 7 -14 22v438q22 55 82 98.5t119 46.5q23 2 43 0.5t43 -7t32.5 -8.5t38 -13t32.5 -11q41 -14 63.5 -21t57 -14t63.5 -7q103 0 183 87q7 8 18 8z" /> +<glyph unicode="" d="M600 1175q116 0 227 -49.5t192.5 -131t131 -192.5t49.5 -227v-300q0 -10 -7.5 -17.5t-17.5 -7.5h-50q-10 0 -17.5 7.5t-7.5 17.5v300q0 127 -70.5 231.5t-184.5 161.5t-245 57t-245 -57t-184.5 -161.5t-70.5 -231.5v-300q0 -10 -7.5 -17.5t-17.5 -7.5h-50 q-10 0 -17.5 7.5t-7.5 17.5v300q0 116 49.5 227t131 192.5t192.5 131t227 49.5zM220 500h160q8 0 14 -6t6 -14v-460q0 -8 -6 -14t-14 -6h-160q-8 0 -14 6t-6 14v460q0 8 6 14t14 6zM820 500h160q8 0 14 -6t6 -14v-460q0 -8 -6 -14t-14 -6h-160q-8 0 -14 6t-6 14v460 q0 8 6 14t14 6z" /> +<glyph unicode="" d="M321 814l258 172q9 6 15 2.5t6 -13.5v-750q0 -10 -6 -13.5t-15 2.5l-258 172q-21 14 -46 14h-250q-10 0 -17.5 7.5t-7.5 17.5v350q0 10 7.5 17.5t17.5 7.5h250q25 0 46 14zM900 668l120 120q7 7 17 7t17 -7l34 -34q7 -7 7 -17t-7 -17l-120 -120l120 -120q7 -7 7 -17 t-7 -17l-34 -34q-7 -7 -17 -7t-17 7l-120 119l-120 -119q-7 -7 -17 -7t-17 7l-34 34q-7 7 -7 17t7 17l119 120l-119 120q-7 7 -7 17t7 17l34 34q7 8 17 8t17 -8z" /> +<glyph unicode="" d="M321 814l258 172q9 6 15 2.5t6 -13.5v-750q0 -10 -6 -13.5t-15 2.5l-258 172q-21 14 -46 14h-250q-10 0 -17.5 7.5t-7.5 17.5v350q0 10 7.5 17.5t17.5 7.5h250q25 0 46 14zM766 900h4q10 -1 16 -10q96 -129 96 -290q0 -154 -90 -281q-6 -9 -17 -10l-3 -1q-9 0 -16 6 l-29 23q-7 7 -8.5 16.5t4.5 17.5q72 103 72 229q0 132 -78 238q-6 8 -4.5 18t9.5 17l29 22q7 5 15 5z" /> +<glyph unicode="" d="M967 1004h3q11 -1 17 -10q135 -179 135 -396q0 -105 -34 -206.5t-98 -185.5q-7 -9 -17 -10h-3q-9 0 -16 6l-42 34q-8 6 -9 16t5 18q111 150 111 328q0 90 -29.5 176t-84.5 157q-6 9 -5 19t10 16l42 33q7 5 15 5zM321 814l258 172q9 6 15 2.5t6 -13.5v-750q0 -10 -6 -13.5 t-15 2.5l-258 172q-21 14 -46 14h-250q-10 0 -17.5 7.5t-7.5 17.5v350q0 10 7.5 17.5t17.5 7.5h250q25 0 46 14zM766 900h4q10 -1 16 -10q96 -129 96 -290q0 -154 -90 -281q-6 -9 -17 -10l-3 -1q-9 0 -16 6l-29 23q-7 7 -8.5 16.5t4.5 17.5q72 103 72 229q0 132 -78 238 q-6 8 -4.5 18.5t9.5 16.5l29 22q7 5 15 5z" /> +<glyph unicode="" d="M500 900h100v-100h-100v-100h-400v-100h-100v600h500v-300zM1200 700h-200v-100h200v-200h-300v300h-200v300h-100v200h600v-500zM100 1100v-300h300v300h-300zM800 1100v-300h300v300h-300zM300 900h-100v100h100v-100zM1000 900h-100v100h100v-100zM300 500h200v-500 h-500v500h200v100h100v-100zM800 300h200v-100h-100v-100h-200v100h-100v100h100v200h-200v100h300v-300zM100 400v-300h300v300h-300zM300 200h-100v100h100v-100zM1200 200h-100v100h100v-100zM700 0h-100v100h100v-100zM1200 0h-300v100h300v-100z" /> +<glyph unicode="" d="M100 200h-100v1000h100v-1000zM300 200h-100v1000h100v-1000zM700 200h-200v1000h200v-1000zM900 200h-100v1000h100v-1000zM1200 200h-200v1000h200v-1000zM400 0h-300v100h300v-100zM600 0h-100v91h100v-91zM800 0h-100v91h100v-91zM1100 0h-200v91h200v-91z" /> +<glyph unicode="" d="M500 1200l682 -682q8 -8 8 -18t-8 -18l-464 -464q-8 -8 -18 -8t-18 8l-682 682l1 475q0 10 7.5 17.5t17.5 7.5h474zM319.5 1024.5q-29.5 29.5 -71 29.5t-71 -29.5t-29.5 -71.5t29.5 -71.5t71 -29.5t71 29.5t29.5 71.5t-29.5 71.5z" /> +<glyph unicode="" d="M500 1200l682 -682q8 -8 8 -18t-8 -18l-464 -464q-8 -8 -18 -8t-18 8l-682 682l1 475q0 10 7.5 17.5t17.5 7.5h474zM800 1200l682 -682q8 -8 8 -18t-8 -18l-464 -464q-8 -8 -18 -8t-18 8l-56 56l424 426l-700 700h150zM319.5 1024.5q-29.5 29.5 -71 29.5t-71 -29.5 t-29.5 -71.5t29.5 -71.5t71 -29.5t71 29.5t29.5 71.5t-29.5 71.5z" /> +<glyph unicode="" d="M300 1200h825q75 0 75 -75v-900q0 -25 -18 -43l-64 -64q-8 -8 -13 -5.5t-5 12.5v950q0 10 -7.5 17.5t-17.5 7.5h-700q-25 0 -43 -18l-64 -64q-8 -8 -5.5 -13t12.5 -5h700q10 0 17.5 -7.5t7.5 -17.5v-950q0 -10 -7.5 -17.5t-17.5 -7.5h-850q-10 0 -17.5 7.5t-7.5 17.5v975 q0 25 18 43l139 139q18 18 43 18z" /> +<glyph unicode="" d="M250 1200h800q21 0 35.5 -14.5t14.5 -35.5v-1150l-450 444l-450 -445v1151q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M822 1200h-444q-11 0 -19 -7.5t-9 -17.5l-78 -301q-7 -24 7 -45l57 -108q6 -9 17.5 -15t21.5 -6h450q10 0 21.5 6t17.5 15l62 108q14 21 7 45l-83 301q-1 10 -9 17.5t-19 7.5zM1175 800h-150q-10 0 -21 -6.5t-15 -15.5l-78 -156q-4 -9 -15 -15.5t-21 -6.5h-550 q-10 0 -21 6.5t-15 15.5l-78 156q-4 9 -15 15.5t-21 6.5h-150q-10 0 -17.5 -7.5t-7.5 -17.5v-650q0 -10 7.5 -17.5t17.5 -7.5h150q10 0 17.5 7.5t7.5 17.5v150q0 10 7.5 17.5t17.5 7.5h750q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 7.5 -17.5t17.5 -7.5h150q10 0 17.5 7.5 t7.5 17.5v650q0 10 -7.5 17.5t-17.5 7.5zM850 200h-500q-10 0 -19.5 -7t-11.5 -17l-38 -152q-2 -10 3.5 -17t15.5 -7h600q10 0 15.5 7t3.5 17l-38 152q-2 10 -11.5 17t-19.5 7z" /> +<glyph unicode="" d="M500 1100h200q56 0 102.5 -20.5t72.5 -50t44 -59t25 -50.5l6 -20h150q41 0 70.5 -29.5t29.5 -70.5v-600q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5v600q0 41 29.5 70.5t70.5 29.5h150q2 8 6.5 21.5t24 48t45 61t72 48t102.5 21.5zM900 800v-100 h100v100h-100zM600 730q-95 0 -162.5 -67.5t-67.5 -162.5t67.5 -162.5t162.5 -67.5t162.5 67.5t67.5 162.5t-67.5 162.5t-162.5 67.5zM600 603q43 0 73 -30t30 -73t-30 -73t-73 -30t-73 30t-30 73t30 73t73 30z" /> +<glyph unicode="" d="M681 1199l385 -998q20 -50 60 -92q18 -19 36.5 -29.5t27.5 -11.5l10 -2v-66h-417v66q53 0 75 43.5t5 88.5l-82 222h-391q-58 -145 -92 -234q-11 -34 -6.5 -57t25.5 -37t46 -20t55 -6v-66h-365v66q56 24 84 52q12 12 25 30.5t20 31.5l7 13l399 1006h93zM416 521h340 l-162 457z" /> +<glyph unicode="" d="M753 641q5 -1 14.5 -4.5t36 -15.5t50.5 -26.5t53.5 -40t50.5 -54.5t35.5 -70t14.5 -87q0 -67 -27.5 -125.5t-71.5 -97.5t-98.5 -66.5t-108.5 -40.5t-102 -13h-500v89q41 7 70.5 32.5t29.5 65.5v827q0 24 -0.5 34t-3.5 24t-8.5 19.5t-17 13.5t-28 12.5t-42.5 11.5v71 l471 -1q57 0 115.5 -20.5t108 -57t80.5 -94t31 -124.5q0 -51 -15.5 -96.5t-38 -74.5t-45 -50.5t-38.5 -30.5zM400 700h139q78 0 130.5 48.5t52.5 122.5q0 41 -8.5 70.5t-29.5 55.5t-62.5 39.5t-103.5 13.5h-118v-350zM400 200h216q80 0 121 50.5t41 130.5q0 90 -62.5 154.5 t-156.5 64.5h-159v-400z" /> +<glyph unicode="" d="M877 1200l2 -57q-83 -19 -116 -45.5t-40 -66.5l-132 -839q-9 -49 13 -69t96 -26v-97h-500v97q186 16 200 98l173 832q3 17 3 30t-1.5 22.5t-9 17.5t-13.5 12.5t-21.5 10t-26 8.5t-33.5 10q-13 3 -19 5v57h425z" /> +<glyph unicode="" d="M1300 900h-50q0 21 -4 37t-9.5 26.5t-18 17.5t-22 11t-28.5 5.5t-31 2t-37 0.5h-200v-850q0 -22 25 -34.5t50 -13.5l25 -2v-100h-400v100q4 0 11 0.5t24 3t30 7t24 15t11 24.5v850h-200q-25 0 -37 -0.5t-31 -2t-28.5 -5.5t-22 -11t-18 -17.5t-9.5 -26.5t-4 -37h-50v300 h1000v-300zM175 1000h-75v-800h75l-125 -167l-125 167h75v800h-75l125 167z" /> +<glyph unicode="" d="M1100 900h-50q0 21 -4 37t-9.5 26.5t-18 17.5t-22 11t-28.5 5.5t-31 2t-37 0.5h-200v-650q0 -22 25 -34.5t50 -13.5l25 -2v-100h-400v100q4 0 11 0.5t24 3t30 7t24 15t11 24.5v650h-200q-25 0 -37 -0.5t-31 -2t-28.5 -5.5t-22 -11t-18 -17.5t-9.5 -26.5t-4 -37h-50v300 h1000v-300zM1167 50l-167 -125v75h-800v-75l-167 125l167 125v-75h800v75z" /> +<glyph unicode="" d="M50 1100h600q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-600q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 800h1000q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1000q-21 0 -35.5 14.5t-14.5 35.5v100 q0 21 14.5 35.5t35.5 14.5zM50 500h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 200h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M250 1100h700q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-700q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 800h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v100 q0 21 14.5 35.5t35.5 14.5zM250 500h700q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-700q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 200h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M500 950v100q0 21 14.5 35.5t35.5 14.5h600q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-600q-21 0 -35.5 14.5t-14.5 35.5zM100 650v100q0 21 14.5 35.5t35.5 14.5h1000q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1000 q-21 0 -35.5 14.5t-14.5 35.5zM300 350v100q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5zM0 50v100q0 21 14.5 35.5t35.5 14.5h1100q21 0 35.5 -14.5t14.5 -35.5v-100 q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5z" /> +<glyph unicode="" d="M50 1100h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 800h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v100 q0 21 14.5 35.5t35.5 14.5zM50 500h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 200h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M50 1100h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM350 1100h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v100 q0 21 14.5 35.5t35.5 14.5zM50 800h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM350 800h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-800 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 500h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM350 500h800q21 0 35.5 -14.5t14.5 -35.5v-100 q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 200h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM350 200h800 q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M400 0h-100v1100h100v-1100zM550 1100h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM550 800h500q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-500 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM267 550l-167 -125v75h-200v100h200v75zM550 500h300q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-300q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM550 200h600 q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-600q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M50 1100h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM900 0h-100v1100h100v-1100zM50 800h500q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-500 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM1100 600h200v-100h-200v-75l-167 125l167 125v-75zM50 500h300q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-300q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 200h600 q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-600q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M75 1000h750q31 0 53 -22t22 -53v-650q0 -31 -22 -53t-53 -22h-750q-31 0 -53 22t-22 53v650q0 31 22 53t53 22zM1200 300l-300 300l300 300v-600z" /> +<glyph unicode="" d="M44 1100h1112q18 0 31 -13t13 -31v-1012q0 -18 -13 -31t-31 -13h-1112q-18 0 -31 13t-13 31v1012q0 18 13 31t31 13zM100 1000v-737l247 182l298 -131l-74 156l293 318l236 -288v500h-1000zM342 884q56 0 95 -39t39 -94.5t-39 -95t-95 -39.5t-95 39.5t-39 95t39 94.5 t95 39z" /> +<glyph unicode="" d="M648 1169q117 0 216 -60t156.5 -161t57.5 -218q0 -115 -70 -258q-69 -109 -158 -225.5t-143 -179.5l-54 -62q-9 8 -25.5 24.5t-63.5 67.5t-91 103t-98.5 128t-95.5 148q-60 132 -60 249q0 88 34 169.5t91.5 142t137 96.5t166.5 36zM652.5 974q-91.5 0 -156.5 -65 t-65 -157t65 -156.5t156.5 -64.5t156.5 64.5t65 156.5t-65 157t-156.5 65z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 173v854q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57z" /> +<glyph unicode="" d="M554 1295q21 -72 57.5 -143.5t76 -130t83 -118t82.5 -117t70 -116t49.5 -126t18.5 -136.5q0 -71 -25.5 -135t-68.5 -111t-99 -82t-118.5 -54t-125.5 -23q-84 5 -161.5 34t-139.5 78.5t-99 125t-37 164.5q0 69 18 136.5t49.5 126.5t69.5 116.5t81.5 117.5t83.5 119 t76.5 131t58.5 143zM344 710q-23 -33 -43.5 -70.5t-40.5 -102.5t-17 -123q1 -37 14.5 -69.5t30 -52t41 -37t38.5 -24.5t33 -15q21 -7 32 -1t13 22l6 34q2 10 -2.5 22t-13.5 19q-5 4 -14 12t-29.5 40.5t-32.5 73.5q-26 89 6 271q2 11 -6 11q-8 1 -15 -10z" /> +<glyph unicode="" d="M1000 1013l108 115q2 1 5 2t13 2t20.5 -1t25 -9.5t28.5 -21.5q22 -22 27 -43t0 -32l-6 -10l-108 -115zM350 1100h400q50 0 105 -13l-187 -187h-368q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v182l200 200v-332 q0 -165 -93.5 -257.5t-256.5 -92.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400q0 165 92.5 257.5t257.5 92.5zM1009 803l-362 -362l-161 -50l55 170l355 355z" /> +<glyph unicode="" d="M350 1100h361q-164 -146 -216 -200h-195q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5l200 153v-103q0 -165 -92.5 -257.5t-257.5 -92.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400q0 165 92.5 257.5t257.5 92.5z M824 1073l339 -301q8 -7 8 -17.5t-8 -17.5l-340 -306q-7 -6 -12.5 -4t-6.5 11v203q-26 1 -54.5 0t-78.5 -7.5t-92 -17.5t-86 -35t-70 -57q10 59 33 108t51.5 81.5t65 58.5t68.5 40.5t67 24.5t56 13.5t40 4.5v210q1 10 6.5 12.5t13.5 -4.5z" /> +<glyph unicode="" d="M350 1100h350q60 0 127 -23l-178 -177h-349q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v69l200 200v-219q0 -165 -92.5 -257.5t-257.5 -92.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400q0 165 92.5 257.5t257.5 92.5z M643 639l395 395q7 7 17.5 7t17.5 -7l101 -101q7 -7 7 -17.5t-7 -17.5l-531 -532q-7 -7 -17.5 -7t-17.5 7l-248 248q-7 7 -7 17.5t7 17.5l101 101q7 7 17.5 7t17.5 -7l111 -111q8 -7 18 -7t18 7z" /> +<glyph unicode="" d="M318 918l264 264q8 8 18 8t18 -8l260 -264q7 -8 4.5 -13t-12.5 -5h-170v-200h200v173q0 10 5 12t13 -5l264 -260q8 -7 8 -17.5t-8 -17.5l-264 -265q-8 -7 -13 -5t-5 12v173h-200v-200h170q10 0 12.5 -5t-4.5 -13l-260 -264q-8 -8 -18 -8t-18 8l-264 264q-8 8 -5.5 13 t12.5 5h175v200h-200v-173q0 -10 -5 -12t-13 5l-264 265q-8 7 -8 17.5t8 17.5l264 260q8 7 13 5t5 -12v-173h200v200h-175q-10 0 -12.5 5t5.5 13z" /> +<glyph unicode="" d="M250 1100h100q21 0 35.5 -14.5t14.5 -35.5v-438l464 453q15 14 25.5 10t10.5 -25v-1000q0 -21 -10.5 -25t-25.5 10l-464 453v-438q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v1000q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M50 1100h100q21 0 35.5 -14.5t14.5 -35.5v-438l464 453q15 14 25.5 10t10.5 -25v-438l464 453q15 14 25.5 10t10.5 -25v-1000q0 -21 -10.5 -25t-25.5 10l-464 453v-438q0 -21 -10.5 -25t-25.5 10l-464 453v-438q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5 t-14.5 35.5v1000q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M1200 1050v-1000q0 -21 -10.5 -25t-25.5 10l-464 453v-438q0 -21 -10.5 -25t-25.5 10l-492 480q-15 14 -15 35t15 35l492 480q15 14 25.5 10t10.5 -25v-438l464 453q15 14 25.5 10t10.5 -25z" /> +<glyph unicode="" d="M243 1074l814 -498q18 -11 18 -26t-18 -26l-814 -498q-18 -11 -30.5 -4t-12.5 28v1000q0 21 12.5 28t30.5 -4z" /> +<glyph unicode="" d="M250 1000h200q21 0 35.5 -14.5t14.5 -35.5v-800q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v800q0 21 14.5 35.5t35.5 14.5zM650 1000h200q21 0 35.5 -14.5t14.5 -35.5v-800q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v800 q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M1100 950v-800q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v800q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5z" /> +<glyph unicode="" d="M500 612v438q0 21 10.5 25t25.5 -10l492 -480q15 -14 15 -35t-15 -35l-492 -480q-15 -14 -25.5 -10t-10.5 25v438l-464 -453q-15 -14 -25.5 -10t-10.5 25v1000q0 21 10.5 25t25.5 -10z" /> +<glyph unicode="" d="M1048 1102l100 1q20 0 35 -14.5t15 -35.5l5 -1000q0 -21 -14.5 -35.5t-35.5 -14.5l-100 -1q-21 0 -35.5 14.5t-14.5 35.5l-2 437l-463 -454q-14 -15 -24.5 -10.5t-10.5 25.5l-2 437l-462 -455q-15 -14 -25.5 -9.5t-10.5 24.5l-5 1000q0 21 10.5 25.5t25.5 -10.5l466 -450 l-2 438q0 20 10.5 24.5t25.5 -9.5l466 -451l-2 438q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M850 1100h100q21 0 35.5 -14.5t14.5 -35.5v-1000q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v438l-464 -453q-15 -14 -25.5 -10t-10.5 25v1000q0 21 10.5 25t25.5 -10l464 -453v438q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M686 1081l501 -540q15 -15 10.5 -26t-26.5 -11h-1042q-22 0 -26.5 11t10.5 26l501 540q15 15 36 15t36 -15zM150 400h1000q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1000q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M885 900l-352 -353l352 -353l-197 -198l-552 552l552 550z" /> +<glyph unicode="" d="M1064 547l-551 -551l-198 198l353 353l-353 353l198 198z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM650 900h-100q-21 0 -35.5 -14.5t-14.5 -35.5v-150h-150 q-21 0 -35.5 -14.5t-14.5 -35.5v-100q0 -21 14.5 -35.5t35.5 -14.5h150v-150q0 -21 14.5 -35.5t35.5 -14.5h100q21 0 35.5 14.5t14.5 35.5v150h150q21 0 35.5 14.5t14.5 35.5v100q0 21 -14.5 35.5t-35.5 14.5h-150v150q0 21 -14.5 35.5t-35.5 14.5z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM850 700h-500q-21 0 -35.5 -14.5t-14.5 -35.5v-100q0 -21 14.5 -35.5 t35.5 -14.5h500q21 0 35.5 14.5t14.5 35.5v100q0 21 -14.5 35.5t-35.5 14.5z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM741.5 913q-12.5 0 -21.5 -9l-120 -120l-120 120q-9 9 -21.5 9 t-21.5 -9l-141 -141q-9 -9 -9 -21.5t9 -21.5l120 -120l-120 -120q-9 -9 -9 -21.5t9 -21.5l141 -141q9 -9 21.5 -9t21.5 9l120 120l120 -120q9 -9 21.5 -9t21.5 9l141 141q9 9 9 21.5t-9 21.5l-120 120l120 120q9 9 9 21.5t-9 21.5l-141 141q-9 9 -21.5 9z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM546 623l-84 85q-7 7 -17.5 7t-18.5 -7l-139 -139q-7 -8 -7 -18t7 -18 l242 -241q7 -8 17.5 -8t17.5 8l375 375q7 7 7 17.5t-7 18.5l-139 139q-7 7 -17.5 7t-17.5 -7z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM588 941q-29 0 -59 -5.5t-63 -20.5t-58 -38.5t-41.5 -63t-16.5 -89.5 q0 -25 20 -25h131q30 -5 35 11q6 20 20.5 28t45.5 8q20 0 31.5 -10.5t11.5 -28.5q0 -23 -7 -34t-26 -18q-1 0 -13.5 -4t-19.5 -7.5t-20 -10.5t-22 -17t-18.5 -24t-15.5 -35t-8 -46q-1 -8 5.5 -16.5t20.5 -8.5h173q7 0 22 8t35 28t37.5 48t29.5 74t12 100q0 47 -17 83 t-42.5 57t-59.5 34.5t-64 18t-59 4.5zM675 400h-150q-10 0 -17.5 -7.5t-7.5 -17.5v-150q0 -10 7.5 -17.5t17.5 -7.5h150q10 0 17.5 7.5t7.5 17.5v150q0 10 -7.5 17.5t-17.5 7.5z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM675 1000h-150q-10 0 -17.5 -7.5t-7.5 -17.5v-150q0 -10 7.5 -17.5 t17.5 -7.5h150q10 0 17.5 7.5t7.5 17.5v150q0 10 -7.5 17.5t-17.5 7.5zM675 700h-250q-10 0 -17.5 -7.5t-7.5 -17.5v-50q0 -10 7.5 -17.5t17.5 -7.5h75v-200h-75q-10 0 -17.5 -7.5t-7.5 -17.5v-50q0 -10 7.5 -17.5t17.5 -7.5h350q10 0 17.5 7.5t7.5 17.5v50q0 10 -7.5 17.5 t-17.5 7.5h-75v275q0 10 -7.5 17.5t-17.5 7.5z" /> +<glyph unicode="" d="M525 1200h150q10 0 17.5 -7.5t7.5 -17.5v-194q103 -27 178.5 -102.5t102.5 -178.5h194q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-194q-27 -103 -102.5 -178.5t-178.5 -102.5v-194q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v194 q-103 27 -178.5 102.5t-102.5 178.5h-194q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5h194q27 103 102.5 178.5t178.5 102.5v194q0 10 7.5 17.5t17.5 7.5zM700 893v-168q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v168q-68 -23 -119 -74 t-74 -119h168q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-168q23 -68 74 -119t119 -74v168q0 10 7.5 17.5t17.5 7.5h150q10 0 17.5 -7.5t7.5 -17.5v-168q68 23 119 74t74 119h-168q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5h168 q-23 68 -74 119t-119 74z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5t-57 214.5t-155.5 155.5t-214.5 57zM759 823l64 -64q7 -7 7 -17.5t-7 -17.5l-124 -124l124 -124q7 -7 7 -17.5t-7 -17.5l-64 -64q-7 -7 -17.5 -7t-17.5 7l-124 124l-124 -124q-7 -7 -17.5 -7t-17.5 7l-64 64 q-7 7 -7 17.5t7 17.5l124 124l-124 124q-7 7 -7 17.5t7 17.5l64 64q7 7 17.5 7t17.5 -7l124 -124l124 124q7 7 17.5 7t17.5 -7z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5t-57 214.5t-155.5 155.5t-214.5 57zM782 788l106 -106q7 -7 7 -17.5t-7 -17.5l-320 -321q-8 -7 -18 -7t-18 7l-202 203q-8 7 -8 17.5t8 17.5l106 106q7 8 17.5 8t17.5 -8l79 -79l197 197q7 7 17.5 7t17.5 -7z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5q0 -120 65 -225 l587 587q-105 65 -225 65zM965 819l-584 -584q104 -62 219 -62q116 0 214.5 57t155.5 155.5t57 214.5q0 115 -62 219z" /> +<glyph unicode="" d="M39 582l522 427q16 13 27.5 8t11.5 -26v-291h550q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-550v-291q0 -21 -11.5 -26t-27.5 8l-522 427q-16 13 -16 32t16 32z" /> +<glyph unicode="" d="M639 1009l522 -427q16 -13 16 -32t-16 -32l-522 -427q-16 -13 -27.5 -8t-11.5 26v291h-550q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5h550v291q0 21 11.5 26t27.5 -8z" /> +<glyph unicode="" d="M682 1161l427 -522q13 -16 8 -27.5t-26 -11.5h-291v-550q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v550h-291q-21 0 -26 11.5t8 27.5l427 522q13 16 32 16t32 -16z" /> +<glyph unicode="" d="M550 1200h200q21 0 35.5 -14.5t14.5 -35.5v-550h291q21 0 26 -11.5t-8 -27.5l-427 -522q-13 -16 -32 -16t-32 16l-427 522q-13 16 -8 27.5t26 11.5h291v550q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M639 1109l522 -427q16 -13 16 -32t-16 -32l-522 -427q-16 -13 -27.5 -8t-11.5 26v291q-94 -2 -182 -20t-170.5 -52t-147 -92.5t-100.5 -135.5q5 105 27 193.5t67.5 167t113 135t167 91.5t225.5 42v262q0 21 11.5 26t27.5 -8z" /> +<glyph unicode="" d="M850 1200h300q21 0 35.5 -14.5t14.5 -35.5v-300q0 -21 -10.5 -25t-24.5 10l-94 94l-249 -249q-8 -7 -18 -7t-18 7l-106 106q-7 8 -7 18t7 18l249 249l-94 94q-14 14 -10 24.5t25 10.5zM350 0h-300q-21 0 -35.5 14.5t-14.5 35.5v300q0 21 10.5 25t24.5 -10l94 -94l249 249 q8 7 18 7t18 -7l106 -106q7 -8 7 -18t-7 -18l-249 -249l94 -94q14 -14 10 -24.5t-25 -10.5z" /> +<glyph unicode="" d="M1014 1120l106 -106q7 -8 7 -18t-7 -18l-249 -249l94 -94q14 -14 10 -24.5t-25 -10.5h-300q-21 0 -35.5 14.5t-14.5 35.5v300q0 21 10.5 25t24.5 -10l94 -94l249 249q8 7 18 7t18 -7zM250 600h300q21 0 35.5 -14.5t14.5 -35.5v-300q0 -21 -10.5 -25t-24.5 10l-94 94 l-249 -249q-8 -7 -18 -7t-18 7l-106 106q-7 8 -7 18t7 18l249 249l-94 94q-14 14 -10 24.5t25 10.5z" /> +<glyph unicode="" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM704 900h-208q-20 0 -32 -14.5t-8 -34.5l58 -302q4 -20 21.5 -34.5 t37.5 -14.5h54q20 0 37.5 14.5t21.5 34.5l58 302q4 20 -8 34.5t-32 14.5zM675 400h-150q-10 0 -17.5 -7.5t-7.5 -17.5v-150q0 -10 7.5 -17.5t17.5 -7.5h150q10 0 17.5 7.5t7.5 17.5v150q0 10 -7.5 17.5t-17.5 7.5z" /> +<glyph unicode="" d="M260 1200q9 0 19 -2t15 -4l5 -2q22 -10 44 -23l196 -118q21 -13 36 -24q29 -21 37 -12q11 13 49 35l196 118q22 13 45 23q17 7 38 7q23 0 47 -16.5t37 -33.5l13 -16q14 -21 18 -45l25 -123l8 -44q1 -9 8.5 -14.5t17.5 -5.5h61q10 0 17.5 -7.5t7.5 -17.5v-50 q0 -10 -7.5 -17.5t-17.5 -7.5h-50q-10 0 -17.5 -7.5t-7.5 -17.5v-175h-400v300h-200v-300h-400v175q0 10 -7.5 17.5t-17.5 7.5h-50q-10 0 -17.5 7.5t-7.5 17.5v50q0 10 7.5 17.5t17.5 7.5h61q11 0 18 3t7 8q0 4 9 52l25 128q5 25 19 45q2 3 5 7t13.5 15t21.5 19.5t26.5 15.5 t29.5 7zM915 1079l-166 -162q-7 -7 -5 -12t12 -5h219q10 0 15 7t2 17l-51 149q-3 10 -11 12t-15 -6zM463 917l-177 157q-8 7 -16 5t-11 -12l-51 -143q-3 -10 2 -17t15 -7h231q11 0 12.5 5t-5.5 12zM500 0h-375q-10 0 -17.5 7.5t-7.5 17.5v375h400v-400zM1100 400v-375 q0 -10 -7.5 -17.5t-17.5 -7.5h-375v400h400z" /> +<glyph unicode="" d="M1165 1190q8 3 21 -6.5t13 -17.5q-2 -178 -24.5 -323.5t-55.5 -245.5t-87 -174.5t-102.5 -118.5t-118 -68.5t-118.5 -33t-120 -4.5t-105 9.5t-90 16.5q-61 12 -78 11q-4 1 -12.5 0t-34 -14.5t-52.5 -40.5l-153 -153q-26 -24 -37 -14.5t-11 43.5q0 64 42 102q8 8 50.5 45 t66.5 58q19 17 35 47t13 61q-9 55 -10 102.5t7 111t37 130t78 129.5q39 51 80 88t89.5 63.5t94.5 45t113.5 36t129 31t157.5 37t182 47.5zM1116 1098q-8 9 -22.5 -3t-45.5 -50q-38 -47 -119 -103.5t-142 -89.5l-62 -33q-56 -30 -102 -57t-104 -68t-102.5 -80.5t-85.5 -91 t-64 -104.5q-24 -56 -31 -86t2 -32t31.5 17.5t55.5 59.5q25 30 94 75.5t125.5 77.5t147.5 81q70 37 118.5 69t102 79.5t99 111t86.5 148.5q22 50 24 60t-6 19z" /> +<glyph unicode="" d="M653 1231q-39 -67 -54.5 -131t-10.5 -114.5t24.5 -96.5t47.5 -80t63.5 -62.5t68.5 -46.5t65 -30q-4 7 -17.5 35t-18.5 39.5t-17 39.5t-17 43t-13 42t-9.5 44.5t-2 42t4 43t13.5 39t23 38.5q96 -42 165 -107.5t105 -138t52 -156t13 -159t-19 -149.5q-13 -55 -44 -106.5 t-68 -87t-78.5 -64.5t-72.5 -45t-53 -22q-72 -22 -127 -11q-31 6 -13 19q6 3 17 7q13 5 32.5 21t41 44t38.5 63.5t21.5 81.5t-6.5 94.5t-50 107t-104 115.5q10 -104 -0.5 -189t-37 -140.5t-65 -93t-84 -52t-93.5 -11t-95 24.5q-80 36 -131.5 114t-53.5 171q-2 23 0 49.5 t4.5 52.5t13.5 56t27.5 60t46 64.5t69.5 68.5q-8 -53 -5 -102.5t17.5 -90t34 -68.5t44.5 -39t49 -2q31 13 38.5 36t-4.5 55t-29 64.5t-36 75t-26 75.5q-15 85 2 161.5t53.5 128.5t85.5 92.5t93.5 61t81.5 25.5z" /> +<glyph unicode="" d="M600 1094q82 0 160.5 -22.5t140 -59t116.5 -82.5t94.5 -95t68 -95t42.5 -82.5t14 -57.5t-14 -57.5t-43 -82.5t-68.5 -95t-94.5 -95t-116.5 -82.5t-140 -59t-159.5 -22.5t-159.5 22.5t-140 59t-116.5 82.5t-94.5 95t-68.5 95t-43 82.5t-14 57.5t14 57.5t42.5 82.5t68 95 t94.5 95t116.5 82.5t140 59t160.5 22.5zM888 829q-15 15 -18 12t5 -22q25 -57 25 -119q0 -124 -88 -212t-212 -88t-212 88t-88 212q0 59 23 114q8 19 4.5 22t-17.5 -12q-70 -69 -160 -184q-13 -16 -15 -40.5t9 -42.5q22 -36 47 -71t70 -82t92.5 -81t113 -58.5t133.5 -24.5 t133.5 24t113 58.5t92.5 81.5t70 81.5t47 70.5q11 18 9 42.5t-14 41.5q-90 117 -163 189zM448 727l-35 -36q-15 -15 -19.5 -38.5t4.5 -41.5q37 -68 93 -116q16 -13 38.5 -11t36.5 17l35 34q14 15 12.5 33.5t-16.5 33.5q-44 44 -89 117q-11 18 -28 20t-32 -12z" /> +<glyph unicode="" d="M592 0h-148l31 120q-91 20 -175.5 68.5t-143.5 106.5t-103.5 119t-66.5 110t-22 76q0 21 14 57.5t42.5 82.5t68 95t94.5 95t116.5 82.5t140 59t160.5 22.5q61 0 126 -15l32 121h148zM944 770l47 181q108 -85 176.5 -192t68.5 -159q0 -26 -19.5 -71t-59.5 -102t-93 -112 t-129 -104.5t-158 -75.5l46 173q77 49 136 117t97 131q11 18 9 42.5t-14 41.5q-54 70 -107 130zM310 824q-70 -69 -160 -184q-13 -16 -15 -40.5t9 -42.5q18 -30 39 -60t57 -70.5t74 -73t90 -61t105 -41.5l41 154q-107 18 -178.5 101.5t-71.5 193.5q0 59 23 114q8 19 4.5 22 t-17.5 -12zM448 727l-35 -36q-15 -15 -19.5 -38.5t4.5 -41.5q37 -68 93 -116q16 -13 38.5 -11t36.5 17l12 11l22 86l-3 4q-44 44 -89 117q-11 18 -28 20t-32 -12z" /> +<glyph unicode="" d="M-90 100l642 1066q20 31 48 28.5t48 -35.5l642 -1056q21 -32 7.5 -67.5t-50.5 -35.5h-1294q-37 0 -50.5 34t7.5 66zM155 200h345v75q0 10 7.5 17.5t17.5 7.5h150q10 0 17.5 -7.5t7.5 -17.5v-75h345l-445 723zM496 700h208q20 0 32 -14.5t8 -34.5l-58 -252 q-4 -20 -21.5 -34.5t-37.5 -14.5h-54q-20 0 -37.5 14.5t-21.5 34.5l-58 252q-4 20 8 34.5t32 14.5z" /> +<glyph unicode="" d="M650 1200q62 0 106 -44t44 -106v-339l363 -325q15 -14 26 -38.5t11 -44.5v-41q0 -20 -12 -26.5t-29 5.5l-359 249v-263q100 -93 100 -113v-64q0 -21 -13 -29t-32 1l-205 128l-205 -128q-19 -9 -32 -1t-13 29v64q0 20 100 113v263l-359 -249q-17 -12 -29 -5.5t-12 26.5v41 q0 20 11 44.5t26 38.5l363 325v339q0 62 44 106t106 44z" /> +<glyph unicode="" d="M850 1200h100q21 0 35.5 -14.5t14.5 -35.5v-50h50q21 0 35.5 -14.5t14.5 -35.5v-150h-1100v150q0 21 14.5 35.5t35.5 14.5h50v50q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-50h500v50q0 21 14.5 35.5t35.5 14.5zM1100 800v-750q0 -21 -14.5 -35.5 t-35.5 -14.5h-1000q-21 0 -35.5 14.5t-14.5 35.5v750h1100zM100 600v-100h100v100h-100zM300 600v-100h100v100h-100zM500 600v-100h100v100h-100zM700 600v-100h100v100h-100zM900 600v-100h100v100h-100zM100 400v-100h100v100h-100zM300 400v-100h100v100h-100zM500 400 v-100h100v100h-100zM700 400v-100h100v100h-100zM900 400v-100h100v100h-100zM100 200v-100h100v100h-100zM300 200v-100h100v100h-100zM500 200v-100h100v100h-100zM700 200v-100h100v100h-100zM900 200v-100h100v100h-100z" /> +<glyph unicode="" d="M1135 1165l249 -230q15 -14 15 -35t-15 -35l-249 -230q-14 -14 -24.5 -10t-10.5 25v150h-159l-600 -600h-291q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h209l600 600h241v150q0 21 10.5 25t24.5 -10zM522 819l-141 -141l-122 122h-209q-21 0 -35.5 14.5 t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h291zM1135 565l249 -230q15 -14 15 -35t-15 -35l-249 -230q-14 -14 -24.5 -10t-10.5 25v150h-241l-181 181l141 141l122 -122h159v150q0 21 10.5 25t24.5 -10z" /> +<glyph unicode="" d="M100 1100h1000q41 0 70.5 -29.5t29.5 -70.5v-600q0 -41 -29.5 -70.5t-70.5 -29.5h-596l-304 -300v300h-100q-41 0 -70.5 29.5t-29.5 70.5v600q0 41 29.5 70.5t70.5 29.5z" /> +<glyph unicode="" d="M150 1200h200q21 0 35.5 -14.5t14.5 -35.5v-250h-300v250q0 21 14.5 35.5t35.5 14.5zM850 1200h200q21 0 35.5 -14.5t14.5 -35.5v-250h-300v250q0 21 14.5 35.5t35.5 14.5zM1100 800v-300q0 -41 -3 -77.5t-15 -89.5t-32 -96t-58 -89t-89 -77t-129 -51t-174 -20t-174 20 t-129 51t-89 77t-58 89t-32 96t-15 89.5t-3 77.5v300h300v-250v-27v-42.5t1.5 -41t5 -38t10 -35t16.5 -30t25.5 -24.5t35 -19t46.5 -12t60 -4t60 4.5t46.5 12.5t35 19.5t25 25.5t17 30.5t10 35t5 38t2 40.5t-0.5 42v25v250h300z" /> +<glyph unicode="" d="M1100 411l-198 -199l-353 353l-353 -353l-197 199l551 551z" /> +<glyph unicode="" d="M1101 789l-550 -551l-551 551l198 199l353 -353l353 353z" /> +<glyph unicode="" d="M404 1000h746q21 0 35.5 -14.5t14.5 -35.5v-551h150q21 0 25 -10.5t-10 -24.5l-230 -249q-14 -15 -35 -15t-35 15l-230 249q-14 14 -10 24.5t25 10.5h150v401h-381zM135 984l230 -249q14 -14 10 -24.5t-25 -10.5h-150v-400h385l215 -200h-750q-21 0 -35.5 14.5 t-14.5 35.5v550h-150q-21 0 -25 10.5t10 24.5l230 249q14 15 35 15t35 -15z" /> +<glyph unicode="" d="M56 1200h94q17 0 31 -11t18 -27l38 -162h896q24 0 39 -18.5t10 -42.5l-100 -475q-5 -21 -27 -42.5t-55 -21.5h-633l48 -200h535q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-50v-50q0 -21 -14.5 -35.5t-35.5 -14.5t-35.5 14.5t-14.5 35.5v50h-300v-50 q0 -21 -14.5 -35.5t-35.5 -14.5t-35.5 14.5t-14.5 35.5v50h-31q-18 0 -32.5 10t-20.5 19l-5 10l-201 961h-54q-20 0 -35 14.5t-15 35.5t15 35.5t35 14.5z" /> +<glyph unicode="" d="M1200 1000v-100h-1200v100h200q0 41 29.5 70.5t70.5 29.5h300q41 0 70.5 -29.5t29.5 -70.5h500zM0 800h1200v-800h-1200v800z" /> +<glyph unicode="" d="M200 800l-200 -400v600h200q0 41 29.5 70.5t70.5 29.5h300q42 0 71 -29.5t29 -70.5h500v-200h-1000zM1500 700l-300 -700h-1200l300 700h1200z" /> +<glyph unicode="" d="M635 1184l230 -249q14 -14 10 -24.5t-25 -10.5h-150v-601h150q21 0 25 -10.5t-10 -24.5l-230 -249q-14 -15 -35 -15t-35 15l-230 249q-14 14 -10 24.5t25 10.5h150v601h-150q-21 0 -25 10.5t10 24.5l230 249q14 15 35 15t35 -15z" /> +<glyph unicode="" d="M936 864l249 -229q14 -15 14 -35.5t-14 -35.5l-249 -229q-15 -15 -25.5 -10.5t-10.5 24.5v151h-600v-151q0 -20 -10.5 -24.5t-25.5 10.5l-249 229q-14 15 -14 35.5t14 35.5l249 229q15 15 25.5 10.5t10.5 -25.5v-149h600v149q0 21 10.5 25.5t25.5 -10.5z" /> +<glyph unicode="" d="M1169 400l-172 732q-5 23 -23 45.5t-38 22.5h-672q-20 0 -38 -20t-23 -41l-172 -739h1138zM1100 300h-1000q-41 0 -70.5 -29.5t-29.5 -70.5v-100q0 -41 29.5 -70.5t70.5 -29.5h1000q41 0 70.5 29.5t29.5 70.5v100q0 41 -29.5 70.5t-70.5 29.5zM800 100v100h100v-100h-100 zM1000 100v100h100v-100h-100z" /> +<glyph unicode="" d="M1150 1100q21 0 35.5 -14.5t14.5 -35.5v-850q0 -21 -14.5 -35.5t-35.5 -14.5t-35.5 14.5t-14.5 35.5v850q0 21 14.5 35.5t35.5 14.5zM1000 200l-675 200h-38l47 -276q3 -16 -5.5 -20t-29.5 -4h-7h-84q-20 0 -34.5 14t-18.5 35q-55 337 -55 351v250v6q0 16 1 23.5t6.5 14 t17.5 6.5h200l675 250v-850zM0 750v-250q-4 0 -11 0.5t-24 6t-30 15t-24 30t-11 48.5v50q0 26 10.5 46t25 30t29 16t25.5 7z" /> +<glyph unicode="" d="M553 1200h94q20 0 29 -10.5t3 -29.5l-18 -37q83 -19 144 -82.5t76 -140.5l63 -327l118 -173h17q19 0 33 -14.5t14 -35t-13 -40.5t-31 -27q-8 -4 -23 -9.5t-65 -19.5t-103 -25t-132.5 -20t-158.5 -9q-57 0 -115 5t-104 12t-88.5 15.5t-73.5 17.5t-54.5 16t-35.5 12l-11 4 q-18 8 -31 28t-13 40.5t14 35t33 14.5h17l118 173l63 327q15 77 76 140t144 83l-18 32q-6 19 3.5 32t28.5 13zM498 110q50 -6 102 -6q53 0 102 6q-12 -49 -39.5 -79.5t-62.5 -30.5t-63 30.5t-39 79.5z" /> +<glyph unicode="" d="M800 946l224 78l-78 -224l234 -45l-180 -155l180 -155l-234 -45l78 -224l-224 78l-45 -234l-155 180l-155 -180l-45 234l-224 -78l78 224l-234 45l180 155l-180 155l234 45l-78 224l224 -78l45 234l155 -180l155 180z" /> +<glyph unicode="" d="M650 1200h50q40 0 70 -40.5t30 -84.5v-150l-28 -125h328q40 0 70 -40.5t30 -84.5v-100q0 -45 -29 -74l-238 -344q-16 -24 -38 -40.5t-45 -16.5h-250q-7 0 -42 25t-66 50l-31 25h-61q-45 0 -72.5 18t-27.5 57v400q0 36 20 63l145 196l96 198q13 28 37.5 48t51.5 20z M650 1100l-100 -212l-150 -213v-375h100l136 -100h214l250 375v125h-450l50 225v175h-50zM50 800h100q21 0 35.5 -14.5t14.5 -35.5v-500q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v500q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M600 1100h250q23 0 45 -16.5t38 -40.5l238 -344q29 -29 29 -74v-100q0 -44 -30 -84.5t-70 -40.5h-328q28 -118 28 -125v-150q0 -44 -30 -84.5t-70 -40.5h-50q-27 0 -51.5 20t-37.5 48l-96 198l-145 196q-20 27 -20 63v400q0 39 27.5 57t72.5 18h61q124 100 139 100z M50 1000h100q21 0 35.5 -14.5t14.5 -35.5v-500q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v500q0 21 14.5 35.5t35.5 14.5zM636 1000l-136 -100h-100v-375l150 -213l100 -212h50v175l-50 225h450v125l-250 375h-214z" /> +<glyph unicode="" d="M356 873l363 230q31 16 53 -6l110 -112q13 -13 13.5 -32t-11.5 -34l-84 -121h302q84 0 138 -38t54 -110t-55 -111t-139 -39h-106l-131 -339q-6 -21 -19.5 -41t-28.5 -20h-342q-7 0 -90 81t-83 94v525q0 17 14 35.5t28 28.5zM400 792v-503l100 -89h293l131 339 q6 21 19.5 41t28.5 20h203q21 0 30.5 25t0.5 50t-31 25h-456h-7h-6h-5.5t-6 0.5t-5 1.5t-5 2t-4 2.5t-4 4t-2.5 4.5q-12 25 5 47l146 183l-86 83zM50 800h100q21 0 35.5 -14.5t14.5 -35.5v-500q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v500 q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M475 1103l366 -230q2 -1 6 -3.5t14 -10.5t18 -16.5t14.5 -20t6.5 -22.5v-525q0 -13 -86 -94t-93 -81h-342q-15 0 -28.5 20t-19.5 41l-131 339h-106q-85 0 -139.5 39t-54.5 111t54 110t138 38h302l-85 121q-11 15 -10.5 34t13.5 32l110 112q22 22 53 6zM370 945l146 -183 q17 -22 5 -47q-2 -2 -3.5 -4.5t-4 -4t-4 -2.5t-5 -2t-5 -1.5t-6 -0.5h-6h-6.5h-6h-475v-100h221q15 0 29 -20t20 -41l130 -339h294l106 89v503l-342 236zM1050 800h100q21 0 35.5 -14.5t14.5 -35.5v-500q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5 v500q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M550 1294q72 0 111 -55t39 -139v-106l339 -131q21 -6 41 -19.5t20 -28.5v-342q0 -7 -81 -90t-94 -83h-525q-17 0 -35.5 14t-28.5 28l-9 14l-230 363q-16 31 6 53l112 110q13 13 32 13.5t34 -11.5l121 -84v302q0 84 38 138t110 54zM600 972v203q0 21 -25 30.5t-50 0.5 t-25 -31v-456v-7v-6v-5.5t-0.5 -6t-1.5 -5t-2 -5t-2.5 -4t-4 -4t-4.5 -2.5q-25 -12 -47 5l-183 146l-83 -86l236 -339h503l89 100v293l-339 131q-21 6 -41 19.5t-20 28.5zM450 200h500q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-500 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M350 1100h500q21 0 35.5 14.5t14.5 35.5v100q0 21 -14.5 35.5t-35.5 14.5h-500q-21 0 -35.5 -14.5t-14.5 -35.5v-100q0 -21 14.5 -35.5t35.5 -14.5zM600 306v-106q0 -84 -39 -139t-111 -55t-110 54t-38 138v302l-121 -84q-15 -12 -34 -11.5t-32 13.5l-112 110 q-22 22 -6 53l230 363q1 2 3.5 6t10.5 13.5t16.5 17t20 13.5t22.5 6h525q13 0 94 -83t81 -90v-342q0 -15 -20 -28.5t-41 -19.5zM308 900l-236 -339l83 -86l183 146q22 17 47 5q2 -1 4.5 -2.5t4 -4t2.5 -4t2 -5t1.5 -5t0.5 -6v-5.5v-6v-7v-456q0 -22 25 -31t50 0.5t25 30.5 v203q0 15 20 28.5t41 19.5l339 131v293l-89 100h-503z" /> +<glyph unicode="" d="M600 1178q118 0 225 -45.5t184.5 -123t123 -184.5t45.5 -225t-45.5 -225t-123 -184.5t-184.5 -123t-225 -45.5t-225 45.5t-184.5 123t-123 184.5t-45.5 225t45.5 225t123 184.5t184.5 123t225 45.5zM914 632l-275 223q-16 13 -27.5 8t-11.5 -26v-137h-275 q-10 0 -17.5 -7.5t-7.5 -17.5v-150q0 -10 7.5 -17.5t17.5 -7.5h275v-137q0 -21 11.5 -26t27.5 8l275 223q16 13 16 32t-16 32z" /> +<glyph unicode="" d="M600 1178q118 0 225 -45.5t184.5 -123t123 -184.5t45.5 -225t-45.5 -225t-123 -184.5t-184.5 -123t-225 -45.5t-225 45.5t-184.5 123t-123 184.5t-45.5 225t45.5 225t123 184.5t184.5 123t225 45.5zM561 855l-275 -223q-16 -13 -16 -32t16 -32l275 -223q16 -13 27.5 -8 t11.5 26v137h275q10 0 17.5 7.5t7.5 17.5v150q0 10 -7.5 17.5t-17.5 7.5h-275v137q0 21 -11.5 26t-27.5 -8z" /> +<glyph unicode="" d="M600 1178q118 0 225 -45.5t184.5 -123t123 -184.5t45.5 -225t-45.5 -225t-123 -184.5t-184.5 -123t-225 -45.5t-225 45.5t-184.5 123t-123 184.5t-45.5 225t45.5 225t123 184.5t184.5 123t225 45.5zM855 639l-223 275q-13 16 -32 16t-32 -16l-223 -275q-13 -16 -8 -27.5 t26 -11.5h137v-275q0 -10 7.5 -17.5t17.5 -7.5h150q10 0 17.5 7.5t7.5 17.5v275h137q21 0 26 11.5t-8 27.5z" /> +<glyph unicode="" d="M600 1178q118 0 225 -45.5t184.5 -123t123 -184.5t45.5 -225t-45.5 -225t-123 -184.5t-184.5 -123t-225 -45.5t-225 45.5t-184.5 123t-123 184.5t-45.5 225t45.5 225t123 184.5t184.5 123t225 45.5zM675 900h-150q-10 0 -17.5 -7.5t-7.5 -17.5v-275h-137q-21 0 -26 -11.5 t8 -27.5l223 -275q13 -16 32 -16t32 16l223 275q13 16 8 27.5t-26 11.5h-137v275q0 10 -7.5 17.5t-17.5 7.5z" /> +<glyph unicode="" d="M600 1176q116 0 222.5 -46t184 -123.5t123.5 -184t46 -222.5t-46 -222.5t-123.5 -184t-184 -123.5t-222.5 -46t-222.5 46t-184 123.5t-123.5 184t-46 222.5t46 222.5t123.5 184t184 123.5t222.5 46zM627 1101q-15 -12 -36.5 -20.5t-35.5 -12t-43 -8t-39 -6.5 q-15 -3 -45.5 0t-45.5 -2q-20 -7 -51.5 -26.5t-34.5 -34.5q-3 -11 6.5 -22.5t8.5 -18.5q-3 -34 -27.5 -91t-29.5 -79q-9 -34 5 -93t8 -87q0 -9 17 -44.5t16 -59.5q12 0 23 -5t23.5 -15t19.5 -14q16 -8 33 -15t40.5 -15t34.5 -12q21 -9 52.5 -32t60 -38t57.5 -11 q7 -15 -3 -34t-22.5 -40t-9.5 -38q13 -21 23 -34.5t27.5 -27.5t36.5 -18q0 -7 -3.5 -16t-3.5 -14t5 -17q104 -2 221 112q30 29 46.5 47t34.5 49t21 63q-13 8 -37 8.5t-36 7.5q-15 7 -49.5 15t-51.5 19q-18 0 -41 -0.5t-43 -1.5t-42 -6.5t-38 -16.5q-51 -35 -66 -12 q-4 1 -3.5 25.5t0.5 25.5q-6 13 -26.5 17.5t-24.5 6.5q1 15 -0.5 30.5t-7 28t-18.5 11.5t-31 -21q-23 -25 -42 4q-19 28 -8 58q6 16 22 22q6 -1 26 -1.5t33.5 -4t19.5 -13.5q7 -12 18 -24t21.5 -20.5t20 -15t15.5 -10.5l5 -3q2 12 7.5 30.5t8 34.5t-0.5 32q-3 18 3.5 29 t18 22.5t15.5 24.5q6 14 10.5 35t8 31t15.5 22.5t34 22.5q-6 18 10 36q8 0 24 -1.5t24.5 -1.5t20 4.5t20.5 15.5q-10 23 -31 42.5t-37.5 29.5t-49 27t-43.5 23q0 1 2 8t3 11.5t1.5 10.5t-1 9.5t-4.5 4.5q31 -13 58.5 -14.5t38.5 2.5l12 5q5 28 -9.5 46t-36.5 24t-50 15 t-41 20q-18 -4 -37 0zM613 994q0 -17 8 -42t17 -45t9 -23q-8 1 -39.5 5.5t-52.5 10t-37 16.5q3 11 16 29.5t16 25.5q10 -10 19 -10t14 6t13.5 14.5t16.5 12.5z" /> +<glyph unicode="" d="M756 1157q164 92 306 -9l-259 -138l145 -232l251 126q6 -89 -34 -156.5t-117 -110.5q-60 -34 -127 -39.5t-126 16.5l-596 -596q-15 -16 -36.5 -16t-36.5 16l-111 110q-15 15 -15 36.5t15 37.5l600 599q-34 101 5.5 201.5t135.5 154.5z" /> +<glyph unicode="" horiz-adv-x="1220" d="M100 1196h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5v100q0 41 29.5 70.5t70.5 29.5zM1100 1096h-200v-100h200v100zM100 796h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000 q-41 0 -70.5 29.5t-29.5 70.5v100q0 41 29.5 70.5t70.5 29.5zM1100 696h-500v-100h500v100zM100 396h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5v100q0 41 29.5 70.5t70.5 29.5zM1100 296h-300v-100h300v100z " /> +<glyph unicode="" d="M150 1200h900q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-900q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM700 500v-300l-200 -200v500l-350 500h900z" /> +<glyph unicode="" d="M500 1200h200q41 0 70.5 -29.5t29.5 -70.5v-100h300q41 0 70.5 -29.5t29.5 -70.5v-400h-500v100h-200v-100h-500v400q0 41 29.5 70.5t70.5 29.5h300v100q0 41 29.5 70.5t70.5 29.5zM500 1100v-100h200v100h-200zM1200 400v-200q0 -41 -29.5 -70.5t-70.5 -29.5h-1000 q-41 0 -70.5 29.5t-29.5 70.5v200h1200z" /> +<glyph unicode="" d="M50 1200h300q21 0 25 -10.5t-10 -24.5l-94 -94l199 -199q7 -8 7 -18t-7 -18l-106 -106q-8 -7 -18 -7t-18 7l-199 199l-94 -94q-14 -14 -24.5 -10t-10.5 25v300q0 21 14.5 35.5t35.5 14.5zM850 1200h300q21 0 35.5 -14.5t14.5 -35.5v-300q0 -21 -10.5 -25t-24.5 10l-94 94 l-199 -199q-8 -7 -18 -7t-18 7l-106 106q-7 8 -7 18t7 18l199 199l-94 94q-14 14 -10 24.5t25 10.5zM364 470l106 -106q7 -8 7 -18t-7 -18l-199 -199l94 -94q14 -14 10 -24.5t-25 -10.5h-300q-21 0 -35.5 14.5t-14.5 35.5v300q0 21 10.5 25t24.5 -10l94 -94l199 199 q8 7 18 7t18 -7zM1071 271l94 94q14 14 24.5 10t10.5 -25v-300q0 -21 -14.5 -35.5t-35.5 -14.5h-300q-21 0 -25 10.5t10 24.5l94 94l-199 199q-7 8 -7 18t7 18l106 106q8 7 18 7t18 -7z" /> +<glyph unicode="" d="M596 1192q121 0 231.5 -47.5t190 -127t127 -190t47.5 -231.5t-47.5 -231.5t-127 -190.5t-190 -127t-231.5 -47t-231.5 47t-190.5 127t-127 190.5t-47 231.5t47 231.5t127 190t190.5 127t231.5 47.5zM596 1010q-112 0 -207.5 -55.5t-151 -151t-55.5 -207.5t55.5 -207.5 t151 -151t207.5 -55.5t207.5 55.5t151 151t55.5 207.5t-55.5 207.5t-151 151t-207.5 55.5zM454.5 905q22.5 0 38.5 -16t16 -38.5t-16 -39t-38.5 -16.5t-38.5 16.5t-16 39t16 38.5t38.5 16zM754.5 905q22.5 0 38.5 -16t16 -38.5t-16 -39t-38 -16.5q-14 0 -29 10l-55 -145 q17 -23 17 -51q0 -36 -25.5 -61.5t-61.5 -25.5t-61.5 25.5t-25.5 61.5q0 32 20.5 56.5t51.5 29.5l122 126l1 1q-9 14 -9 28q0 23 16 39t38.5 16zM345.5 709q22.5 0 38.5 -16t16 -38.5t-16 -38.5t-38.5 -16t-38.5 16t-16 38.5t16 38.5t38.5 16zM854.5 709q22.5 0 38.5 -16 t16 -38.5t-16 -38.5t-38.5 -16t-38.5 16t-16 38.5t16 38.5t38.5 16z" /> +<glyph unicode="" d="M546 173l469 470q91 91 99 192q7 98 -52 175.5t-154 94.5q-22 4 -47 4q-34 0 -66.5 -10t-56.5 -23t-55.5 -38t-48 -41.5t-48.5 -47.5q-376 -375 -391 -390q-30 -27 -45 -41.5t-37.5 -41t-32 -46.5t-16 -47.5t-1.5 -56.5q9 -62 53.5 -95t99.5 -33q74 0 125 51l548 548 q36 36 20 75q-7 16 -21.5 26t-32.5 10q-26 0 -50 -23q-13 -12 -39 -38l-341 -338q-15 -15 -35.5 -15.5t-34.5 13.5t-14 34.5t14 34.5q327 333 361 367q35 35 67.5 51.5t78.5 16.5q14 0 29 -1q44 -8 74.5 -35.5t43.5 -68.5q14 -47 2 -96.5t-47 -84.5q-12 -11 -32 -32 t-79.5 -81t-114.5 -115t-124.5 -123.5t-123 -119.5t-96.5 -89t-57 -45q-56 -27 -120 -27q-70 0 -129 32t-93 89q-48 78 -35 173t81 163l511 511q71 72 111 96q91 55 198 55q80 0 152 -33q78 -36 129.5 -103t66.5 -154q17 -93 -11 -183.5t-94 -156.5l-482 -476 q-15 -15 -36 -16t-37 14t-17.5 34t14.5 35z" /> +<glyph unicode="" d="M649 949q48 68 109.5 104t121.5 38.5t118.5 -20t102.5 -64t71 -100.5t27 -123q0 -57 -33.5 -117.5t-94 -124.5t-126.5 -127.5t-150 -152.5t-146 -174q-62 85 -145.5 174t-150 152.5t-126.5 127.5t-93.5 124.5t-33.5 117.5q0 64 28 123t73 100.5t104 64t119 20 t120.5 -38.5t104.5 -104zM896 972q-33 0 -64.5 -19t-56.5 -46t-47.5 -53.5t-43.5 -45.5t-37.5 -19t-36 19t-40 45.5t-43 53.5t-54 46t-65.5 19q-67 0 -122.5 -55.5t-55.5 -132.5q0 -23 13.5 -51t46 -65t57.5 -63t76 -75l22 -22q15 -14 44 -44t50.5 -51t46 -44t41 -35t23 -12 t23.5 12t42.5 36t46 44t52.5 52t44 43q4 4 12 13q43 41 63.5 62t52 55t46 55t26 46t11.5 44q0 79 -53 133.5t-120 54.5z" /> +<glyph unicode="" d="M776.5 1214q93.5 0 159.5 -66l141 -141q66 -66 66 -160q0 -42 -28 -95.5t-62 -87.5l-29 -29q-31 53 -77 99l-18 18l95 95l-247 248l-389 -389l212 -212l-105 -106l-19 18l-141 141q-66 66 -66 159t66 159l283 283q65 66 158.5 66zM600 706l105 105q10 -8 19 -17l141 -141 q66 -66 66 -159t-66 -159l-283 -283q-66 -66 -159 -66t-159 66l-141 141q-66 66 -66 159.5t66 159.5l55 55q29 -55 75 -102l18 -17l-95 -95l247 -248l389 389z" /> +<glyph unicode="" d="M603 1200q85 0 162 -15t127 -38t79 -48t29 -46v-953q0 -41 -29.5 -70.5t-70.5 -29.5h-600q-41 0 -70.5 29.5t-29.5 70.5v953q0 21 30 46.5t81 48t129 37.5t163 15zM300 1000v-700h600v700h-600zM600 254q-43 0 -73.5 -30.5t-30.5 -73.5t30.5 -73.5t73.5 -30.5t73.5 30.5 t30.5 73.5t-30.5 73.5t-73.5 30.5z" /> +<glyph unicode="" d="M902 1185l283 -282q15 -15 15 -36t-14.5 -35.5t-35.5 -14.5t-35 15l-36 35l-279 -267v-300l-212 210l-308 -307l-280 -203l203 280l307 308l-210 212h300l267 279l-35 36q-15 14 -15 35t14.5 35.5t35.5 14.5t35 -15z" /> +<glyph unicode="" d="M700 1248v-78q38 -5 72.5 -14.5t75.5 -31.5t71 -53.5t52 -84t24 -118.5h-159q-4 36 -10.5 59t-21 45t-40 35.5t-64.5 20.5v-307l64 -13q34 -7 64 -16.5t70 -32t67.5 -52.5t47.5 -80t20 -112q0 -139 -89 -224t-244 -97v-77h-100v79q-150 16 -237 103q-40 40 -52.5 93.5 t-15.5 139.5h139q5 -77 48.5 -126t117.5 -65v335l-27 8q-46 14 -79 26.5t-72 36t-63 52t-40 72.5t-16 98q0 70 25 126t67.5 92t94.5 57t110 27v77h100zM600 754v274q-29 -4 -50 -11t-42 -21.5t-31.5 -41.5t-10.5 -65q0 -29 7 -50.5t16.5 -34t28.5 -22.5t31.5 -14t37.5 -10 q9 -3 13 -4zM700 547v-310q22 2 42.5 6.5t45 15.5t41.5 27t29 42t12 59.5t-12.5 59.5t-38 44.5t-53 31t-66.5 24.5z" /> +<glyph unicode="" d="M561 1197q84 0 160.5 -40t123.5 -109.5t47 -147.5h-153q0 40 -19.5 71.5t-49.5 48.5t-59.5 26t-55.5 9q-37 0 -79 -14.5t-62 -35.5q-41 -44 -41 -101q0 -26 13.5 -63t26.5 -61t37 -66q6 -9 9 -14h241v-100h-197q8 -50 -2.5 -115t-31.5 -95q-45 -62 -99 -112 q34 10 83 17.5t71 7.5q32 1 102 -16t104 -17q83 0 136 30l50 -147q-31 -19 -58 -30.5t-55 -15.5t-42 -4.5t-46 -0.5q-23 0 -76 17t-111 32.5t-96 11.5q-39 -3 -82 -16t-67 -25l-23 -11l-55 145q4 3 16 11t15.5 10.5t13 9t15.5 12t14.5 14t17.5 18.5q48 55 54 126.5 t-30 142.5h-221v100h166q-23 47 -44 104q-7 20 -12 41.5t-6 55.5t6 66.5t29.5 70.5t58.5 71q97 88 263 88z" /> +<glyph unicode="" d="M400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM935 1184l230 -249q14 -14 10 -24.5t-25 -10.5h-150v-900h-200v900h-150q-21 0 -25 10.5t10 24.5l230 249q14 15 35 15t35 -15z" /> +<glyph unicode="" d="M1000 700h-100v100h-100v-100h-100v500h300v-500zM400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM801 1100v-200h100v200h-100zM1000 350l-200 -250h200v-100h-300v150l200 250h-200v100h300v-150z " /> +<glyph unicode="" d="M400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM1000 1050l-200 -250h200v-100h-300v150l200 250h-200v100h300v-150zM1000 0h-100v100h-100v-100h-100v500h300v-500zM801 400v-200h100v200h-100z " /> +<glyph unicode="" d="M400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM1000 700h-100v400h-100v100h200v-500zM1100 0h-100v100h-200v400h300v-500zM901 400v-200h100v200h-100z" /> +<glyph unicode="" d="M400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM1100 700h-100v100h-200v400h300v-500zM901 1100v-200h100v200h-100zM1000 0h-100v400h-100v100h200v-500z" /> +<glyph unicode="" d="M400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM900 1000h-200v200h200v-200zM1000 700h-300v200h300v-200zM1100 400h-400v200h400v-200zM1200 100h-500v200h500v-200z" /> +<glyph unicode="" d="M400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM1200 1000h-500v200h500v-200zM1100 700h-400v200h400v-200zM1000 400h-300v200h300v-200zM900 100h-200v200h200v-200z" /> +<glyph unicode="" d="M350 1100h400q162 0 256 -93.5t94 -256.5v-400q0 -165 -93.5 -257.5t-256.5 -92.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400q0 165 92.5 257.5t257.5 92.5zM800 900h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5 v500q0 41 -29.5 70.5t-70.5 29.5z" /> +<glyph unicode="" d="M350 1100h400q165 0 257.5 -92.5t92.5 -257.5v-400q0 -165 -92.5 -257.5t-257.5 -92.5h-400q-163 0 -256.5 92.5t-93.5 257.5v400q0 163 94 256.5t256 93.5zM800 900h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5 v500q0 41 -29.5 70.5t-70.5 29.5zM440 770l253 -190q17 -12 17 -30t-17 -30l-253 -190q-16 -12 -28 -6.5t-12 26.5v400q0 21 12 26.5t28 -6.5z" /> +<glyph unicode="" d="M350 1100h400q163 0 256.5 -94t93.5 -256v-400q0 -165 -92.5 -257.5t-257.5 -92.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400q0 163 92.5 256.5t257.5 93.5zM800 900h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5 v500q0 41 -29.5 70.5t-70.5 29.5zM350 700h400q21 0 26.5 -12t-6.5 -28l-190 -253q-12 -17 -30 -17t-30 17l-190 253q-12 16 -6.5 28t26.5 12z" /> +<glyph unicode="" d="M350 1100h400q165 0 257.5 -92.5t92.5 -257.5v-400q0 -163 -92.5 -256.5t-257.5 -93.5h-400q-163 0 -256.5 94t-93.5 256v400q0 165 92.5 257.5t257.5 92.5zM800 900h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5 v500q0 41 -29.5 70.5t-70.5 29.5zM580 693l190 -253q12 -16 6.5 -28t-26.5 -12h-400q-21 0 -26.5 12t6.5 28l190 253q12 17 30 17t30 -17z" /> +<glyph unicode="" d="M550 1100h400q165 0 257.5 -92.5t92.5 -257.5v-400q0 -165 -92.5 -257.5t-257.5 -92.5h-400q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h450q41 0 70.5 29.5t29.5 70.5v500q0 41 -29.5 70.5t-70.5 29.5h-450q-21 0 -35.5 14.5t-14.5 35.5v100 q0 21 14.5 35.5t35.5 14.5zM338 867l324 -284q16 -14 16 -33t-16 -33l-324 -284q-16 -14 -27 -9t-11 26v150h-250q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5h250v150q0 21 11 26t27 -9z" /> +<glyph unicode="" d="M793 1182l9 -9q8 -10 5 -27q-3 -11 -79 -225.5t-78 -221.5l300 1q24 0 32.5 -17.5t-5.5 -35.5q-1 0 -133.5 -155t-267 -312.5t-138.5 -162.5q-12 -15 -26 -15h-9l-9 8q-9 11 -4 32q2 9 42 123.5t79 224.5l39 110h-302q-23 0 -31 19q-10 21 6 41q75 86 209.5 237.5 t228 257t98.5 111.5q9 16 25 16h9z" /> +<glyph unicode="" d="M350 1100h400q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-450q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h450q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400 q0 165 92.5 257.5t257.5 92.5zM938 867l324 -284q16 -14 16 -33t-16 -33l-324 -284q-16 -14 -27 -9t-11 26v150h-250q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5h250v150q0 21 11 26t27 -9z" /> +<glyph unicode="" d="M750 1200h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -10.5 -25t-24.5 10l-109 109l-312 -312q-15 -15 -35.5 -15t-35.5 15l-141 141q-15 15 -15 35.5t15 35.5l312 312l-109 109q-14 14 -10 24.5t25 10.5zM456 900h-156q-41 0 -70.5 -29.5t-29.5 -70.5v-500 q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v148l200 200v-298q0 -165 -93.5 -257.5t-256.5 -92.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400q0 165 92.5 257.5t257.5 92.5h300z" /> +<glyph unicode="" d="M600 1186q119 0 227.5 -46.5t187 -125t125 -187t46.5 -227.5t-46.5 -227.5t-125 -187t-187 -125t-227.5 -46.5t-227.5 46.5t-187 125t-125 187t-46.5 227.5t46.5 227.5t125 187t187 125t227.5 46.5zM600 1022q-115 0 -212 -56.5t-153.5 -153.5t-56.5 -212t56.5 -212 t153.5 -153.5t212 -56.5t212 56.5t153.5 153.5t56.5 212t-56.5 212t-153.5 153.5t-212 56.5zM600 794q80 0 137 -57t57 -137t-57 -137t-137 -57t-137 57t-57 137t57 137t137 57z" /> +<glyph unicode="" d="M450 1200h200q21 0 35.5 -14.5t14.5 -35.5v-350h245q20 0 25 -11t-9 -26l-383 -426q-14 -15 -33.5 -15t-32.5 15l-379 426q-13 15 -8.5 26t25.5 11h250v350q0 21 14.5 35.5t35.5 14.5zM50 300h1000q21 0 35.5 -14.5t14.5 -35.5v-250h-1100v250q0 21 14.5 35.5t35.5 14.5z M900 200v-50h100v50h-100z" /> +<glyph unicode="" d="M583 1182l378 -435q14 -15 9 -31t-26 -16h-244v-250q0 -20 -17 -35t-39 -15h-200q-20 0 -32 14.5t-12 35.5v250h-250q-20 0 -25.5 16.5t8.5 31.5l383 431q14 16 33.5 17t33.5 -14zM50 300h1000q21 0 35.5 -14.5t14.5 -35.5v-250h-1100v250q0 21 14.5 35.5t35.5 14.5z M900 200v-50h100v50h-100z" /> +<glyph unicode="" d="M396 723l369 369q7 7 17.5 7t17.5 -7l139 -139q7 -8 7 -18.5t-7 -17.5l-525 -525q-7 -8 -17.5 -8t-17.5 8l-292 291q-7 8 -7 18t7 18l139 139q8 7 18.5 7t17.5 -7zM50 300h1000q21 0 35.5 -14.5t14.5 -35.5v-250h-1100v250q0 21 14.5 35.5t35.5 14.5zM900 200v-50h100v50 h-100z" /> +<glyph unicode="" d="M135 1023l142 142q14 14 35 14t35 -14l77 -77l-212 -212l-77 76q-14 15 -14 36t14 35zM655 855l210 210q14 14 24.5 10t10.5 -25l-2 -599q-1 -20 -15.5 -35t-35.5 -15l-597 -1q-21 0 -25 10.5t10 24.5l208 208l-154 155l212 212zM50 300h1000q21 0 35.5 -14.5t14.5 -35.5 v-250h-1100v250q0 21 14.5 35.5t35.5 14.5zM900 200v-50h100v50h-100z" /> +<glyph unicode="" d="M350 1200l599 -2q20 -1 35 -15.5t15 -35.5l1 -597q0 -21 -10.5 -25t-24.5 10l-208 208l-155 -154l-212 212l155 154l-210 210q-14 14 -10 24.5t25 10.5zM524 512l-76 -77q-15 -14 -36 -14t-35 14l-142 142q-14 14 -14 35t14 35l77 77zM50 300h1000q21 0 35.5 -14.5 t14.5 -35.5v-250h-1100v250q0 21 14.5 35.5t35.5 14.5zM900 200v-50h100v50h-100z" /> +<glyph unicode="" d="M1200 103l-483 276l-314 -399v423h-399l1196 796v-1096zM483 424v-230l683 953z" /> +<glyph unicode="" d="M1100 1000v-850q0 -21 -14.5 -35.5t-35.5 -14.5h-150v400h-700v-400h-150q-21 0 -35.5 14.5t-14.5 35.5v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100zM700 1000h-100v200h100v-200z" /> +<glyph unicode="" d="M1100 1000l-2 -149l-299 -299l-95 95q-9 9 -21.5 9t-21.5 -9l-149 -147h-312v-400h-150q-21 0 -35.5 14.5t-14.5 35.5v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100zM700 1000h-100v200h100v-200zM1132 638l106 -106q7 -7 7 -17.5t-7 -17.5l-420 -421q-8 -7 -18 -7 t-18 7l-202 203q-8 7 -8 17.5t8 17.5l106 106q7 8 17.5 8t17.5 -8l79 -79l297 297q7 7 17.5 7t17.5 -7z" /> +<glyph unicode="" d="M1100 1000v-269l-103 -103l-134 134q-15 15 -33.5 16.5t-34.5 -12.5l-266 -266h-329v-400h-150q-21 0 -35.5 14.5t-14.5 35.5v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100zM700 1000h-100v200h100v-200zM1202 572l70 -70q15 -15 15 -35.5t-15 -35.5l-131 -131 l131 -131q15 -15 15 -35.5t-15 -35.5l-70 -70q-15 -15 -35.5 -15t-35.5 15l-131 131l-131 -131q-15 -15 -35.5 -15t-35.5 15l-70 70q-15 15 -15 35.5t15 35.5l131 131l-131 131q-15 15 -15 35.5t15 35.5l70 70q15 15 35.5 15t35.5 -15l131 -131l131 131q15 15 35.5 15 t35.5 -15z" /> +<glyph unicode="" d="M1100 1000v-300h-350q-21 0 -35.5 -14.5t-14.5 -35.5v-150h-500v-400h-150q-21 0 -35.5 14.5t-14.5 35.5v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100zM700 1000h-100v200h100v-200zM850 600h100q21 0 35.5 -14.5t14.5 -35.5v-250h150q21 0 25 -10.5t-10 -24.5 l-230 -230q-14 -14 -35 -14t-35 14l-230 230q-14 14 -10 24.5t25 10.5h150v250q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M1100 1000v-400l-165 165q-14 15 -35 15t-35 -15l-263 -265h-402v-400h-150q-21 0 -35.5 14.5t-14.5 35.5v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100zM700 1000h-100v200h100v-200zM935 565l230 -229q14 -15 10 -25.5t-25 -10.5h-150v-250q0 -20 -14.5 -35 t-35.5 -15h-100q-21 0 -35.5 15t-14.5 35v250h-150q-21 0 -25 10.5t10 25.5l230 229q14 15 35 15t35 -15z" /> +<glyph unicode="" d="M50 1100h1100q21 0 35.5 -14.5t14.5 -35.5v-150h-1200v150q0 21 14.5 35.5t35.5 14.5zM1200 800v-550q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v550h1200zM100 500v-200h400v200h-400z" /> +<glyph unicode="" d="M935 1165l248 -230q14 -14 14 -35t-14 -35l-248 -230q-14 -14 -24.5 -10t-10.5 25v150h-400v200h400v150q0 21 10.5 25t24.5 -10zM200 800h-50q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h50v-200zM400 800h-100v200h100v-200zM18 435l247 230 q14 14 24.5 10t10.5 -25v-150h400v-200h-400v-150q0 -21 -10.5 -25t-24.5 10l-247 230q-15 14 -15 35t15 35zM900 300h-100v200h100v-200zM1000 500h51q20 0 34.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-34.5 -14.5h-51v200z" /> +<glyph unicode="" d="M862 1073l276 116q25 18 43.5 8t18.5 -41v-1106q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v397q-4 1 -11 5t-24 17.5t-30 29t-24 42t-11 56.5v359q0 31 18.5 65t43.5 52zM550 1200q22 0 34.5 -12.5t14.5 -24.5l1 -13v-450q0 -28 -10.5 -59.5 t-25 -56t-29 -45t-25.5 -31.5l-10 -11v-447q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v447q-4 4 -11 11.5t-24 30.5t-30 46t-24 55t-11 60v450q0 2 0.5 5.5t4 12t8.5 15t14.5 12t22.5 5.5q20 0 32.5 -12.5t14.5 -24.5l3 -13v-350h100v350v5.5t2.5 12 t7 15t15 12t25.5 5.5q23 0 35.5 -12.5t13.5 -24.5l1 -13v-350h100v350q0 2 0.5 5.5t3 12t7 15t15 12t24.5 5.5z" /> +<glyph unicode="" d="M1200 1100v-56q-4 0 -11 -0.5t-24 -3t-30 -7.5t-24 -15t-11 -24v-888q0 -22 25 -34.5t50 -13.5l25 -2v-56h-400v56q75 0 87.5 6.5t12.5 43.5v394h-500v-394q0 -37 12.5 -43.5t87.5 -6.5v-56h-400v56q4 0 11 0.5t24 3t30 7.5t24 15t11 24v888q0 22 -25 34.5t-50 13.5 l-25 2v56h400v-56q-75 0 -87.5 -6.5t-12.5 -43.5v-394h500v394q0 37 -12.5 43.5t-87.5 6.5v56h400z" /> +<glyph unicode="" d="M675 1000h375q21 0 35.5 -14.5t14.5 -35.5v-150h-105l-295 -98v98l-200 200h-400l100 100h375zM100 900h300q41 0 70.5 -29.5t29.5 -70.5v-500q0 -41 -29.5 -70.5t-70.5 -29.5h-300q-41 0 -70.5 29.5t-29.5 70.5v500q0 41 29.5 70.5t70.5 29.5zM100 800v-200h300v200 h-300zM1100 535l-400 -133v163l400 133v-163zM100 500v-200h300v200h-300zM1100 398v-248q0 -21 -14.5 -35.5t-35.5 -14.5h-375l-100 -100h-375l-100 100h400l200 200h105z" /> +<glyph unicode="" d="M17 1007l162 162q17 17 40 14t37 -22l139 -194q14 -20 11 -44.5t-20 -41.5l-119 -118q102 -142 228 -268t267 -227l119 118q17 17 42.5 19t44.5 -12l192 -136q19 -14 22.5 -37.5t-13.5 -40.5l-163 -162q-3 -1 -9.5 -1t-29.5 2t-47.5 6t-62.5 14.5t-77.5 26.5t-90 42.5 t-101.5 60t-111 83t-119 108.5q-74 74 -133.5 150.5t-94.5 138.5t-60 119.5t-34.5 100t-15 74.5t-4.5 48z" /> +<glyph unicode="" d="M600 1100q92 0 175 -10.5t141.5 -27t108.5 -36.5t81.5 -40t53.5 -37t31 -27l9 -10v-200q0 -21 -14.5 -33t-34.5 -9l-202 34q-20 3 -34.5 20t-14.5 38v146q-141 24 -300 24t-300 -24v-146q0 -21 -14.5 -38t-34.5 -20l-202 -34q-20 -3 -34.5 9t-14.5 33v200q3 4 9.5 10.5 t31 26t54 37.5t80.5 39.5t109 37.5t141 26.5t175 10.5zM600 795q56 0 97 -9.5t60 -23.5t30 -28t12 -24l1 -10v-50l365 -303q14 -15 24.5 -40t10.5 -45v-212q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v212q0 20 10.5 45t24.5 40l365 303v50 q0 4 1 10.5t12 23t30 29t60 22.5t97 10z" /> +<glyph unicode="" d="M1100 700l-200 -200h-600l-200 200v500h200v-200h200v200h200v-200h200v200h200v-500zM250 400h700q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-12l137 -100h-950l137 100h-12q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM50 100h1100q21 0 35.5 -14.5 t14.5 -35.5v-50h-1200v50q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M700 1100h-100q-41 0 -70.5 -29.5t-29.5 -70.5v-1000h300v1000q0 41 -29.5 70.5t-70.5 29.5zM1100 800h-100q-41 0 -70.5 -29.5t-29.5 -70.5v-700h300v700q0 41 -29.5 70.5t-70.5 29.5zM400 0h-300v400q0 41 29.5 70.5t70.5 29.5h100q41 0 70.5 -29.5t29.5 -70.5v-400z " /> +<glyph unicode="" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM500 700h-200v-100h200v-300h-300v100h200v100h-200v300h300v-100zM900 700v-300l-100 -100h-200v500h200z M700 700v-300h100v300h-100z" /> +<glyph unicode="" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM500 300h-100v200h-100v-200h-100v500h100v-200h100v200h100v-500zM900 700v-300l-100 -100h-200v500h200z M700 700v-300h100v300h-100z" /> +<glyph unicode="" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM500 700h-200v-300h200v-100h-300v500h300v-100zM900 700h-200v-300h200v-100h-300v500h300v-100z" /> +<glyph unicode="" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM500 400l-300 150l300 150v-300zM900 550l-300 -150v300z" /> +<glyph unicode="" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM900 300h-700v500h700v-500zM800 700h-130q-38 0 -66.5 -43t-28.5 -108t27 -107t68 -42h130v300zM300 700v-300 h130q41 0 68 42t27 107t-28.5 108t-66.5 43h-130z" /> +<glyph unicode="" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM500 700h-200v-100h200v-300h-300v100h200v100h-200v300h300v-100zM900 300h-100v400h-100v100h200v-500z M700 300h-100v100h100v-100z" /> +<glyph unicode="" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM300 700h200v-400h-300v500h100v-100zM900 300h-100v400h-100v100h200v-500zM300 600v-200h100v200h-100z M700 300h-100v100h100v-100z" /> +<glyph unicode="" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM500 500l-199 -200h-100v50l199 200v150h-200v100h300v-300zM900 300h-100v400h-100v100h200v-500zM701 300h-100 v100h100v-100z" /> +<glyph unicode="" d="M600 1191q120 0 229.5 -47t188.5 -126t126 -188.5t47 -229.5t-47 -229.5t-126 -188.5t-188.5 -126t-229.5 -47t-229.5 47t-188.5 126t-126 188.5t-47 229.5t47 229.5t126 188.5t188.5 126t229.5 47zM600 1021q-114 0 -211 -56.5t-153.5 -153.5t-56.5 -211t56.5 -211 t153.5 -153.5t211 -56.5t211 56.5t153.5 153.5t56.5 211t-56.5 211t-153.5 153.5t-211 56.5zM800 700h-300v-200h300v-100h-300l-100 100v200l100 100h300v-100z" /> +<glyph unicode="" d="M600 1191q120 0 229.5 -47t188.5 -126t126 -188.5t47 -229.5t-47 -229.5t-126 -188.5t-188.5 -126t-229.5 -47t-229.5 47t-188.5 126t-126 188.5t-47 229.5t47 229.5t126 188.5t188.5 126t229.5 47zM600 1021q-114 0 -211 -56.5t-153.5 -153.5t-56.5 -211t56.5 -211 t153.5 -153.5t211 -56.5t211 56.5t153.5 153.5t56.5 211t-56.5 211t-153.5 153.5t-211 56.5zM800 700v-100l-50 -50l100 -100v-50h-100l-100 100h-150v-100h-100v400h300zM500 700v-100h200v100h-200z" /> +<glyph unicode="" d="M503 1089q110 0 200.5 -59.5t134.5 -156.5q44 14 90 14q120 0 205 -86.5t85 -207t-85 -207t-205 -86.5h-128v250q0 21 -14.5 35.5t-35.5 14.5h-300q-21 0 -35.5 -14.5t-14.5 -35.5v-250h-222q-80 0 -136 57.5t-56 136.5q0 69 43 122.5t108 67.5q-2 19 -2 37q0 100 49 185 t134 134t185 49zM525 500h150q10 0 17.5 -7.5t7.5 -17.5v-275h137q21 0 26 -11.5t-8 -27.5l-223 -244q-13 -16 -32 -16t-32 16l-223 244q-13 16 -8 27.5t26 11.5h137v275q0 10 7.5 17.5t17.5 7.5z" /> +<glyph unicode="" d="M502 1089q110 0 201 -59.5t135 -156.5q43 15 89 15q121 0 206 -86.5t86 -206.5q0 -99 -60 -181t-150 -110l-378 360q-13 16 -31.5 16t-31.5 -16l-381 -365h-9q-79 0 -135.5 57.5t-56.5 136.5q0 69 43 122.5t108 67.5q-2 19 -2 38q0 100 49 184.5t133.5 134t184.5 49.5z M632 467l223 -228q13 -16 8 -27.5t-26 -11.5h-137v-275q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v275h-137q-21 0 -26 11.5t8 27.5q199 204 223 228q19 19 31.5 19t32.5 -19z" /> +<glyph unicode="" d="M700 100v100h400l-270 300h170l-270 300h170l-300 333l-300 -333h170l-270 -300h170l-270 -300h400v-100h-50q-21 0 -35.5 -14.5t-14.5 -35.5v-50h400v50q0 21 -14.5 35.5t-35.5 14.5h-50z" /> +<glyph unicode="" d="M600 1179q94 0 167.5 -56.5t99.5 -145.5q89 -6 150.5 -71.5t61.5 -155.5q0 -61 -29.5 -112.5t-79.5 -82.5q9 -29 9 -55q0 -74 -52.5 -126.5t-126.5 -52.5q-55 0 -100 30v-251q21 0 35.5 -14.5t14.5 -35.5v-50h-300v50q0 21 14.5 35.5t35.5 14.5v251q-45 -30 -100 -30 q-74 0 -126.5 52.5t-52.5 126.5q0 18 4 38q-47 21 -75.5 65t-28.5 97q0 74 52.5 126.5t126.5 52.5q5 0 23 -2q0 2 -1 10t-1 13q0 116 81.5 197.5t197.5 81.5z" /> +<glyph unicode="" d="M1010 1010q111 -111 150.5 -260.5t0 -299t-150.5 -260.5q-83 -83 -191.5 -126.5t-218.5 -43.5t-218.5 43.5t-191.5 126.5q-111 111 -150.5 260.5t0 299t150.5 260.5q83 83 191.5 126.5t218.5 43.5t218.5 -43.5t191.5 -126.5zM476 1065q-4 0 -8 -1q-121 -34 -209.5 -122.5 t-122.5 -209.5q-4 -12 2.5 -23t18.5 -14l36 -9q3 -1 7 -1q23 0 29 22q27 96 98 166q70 71 166 98q11 3 17.5 13.5t3.5 22.5l-9 35q-3 13 -14 19q-7 4 -15 4zM512 920q-4 0 -9 -2q-80 -24 -138.5 -82.5t-82.5 -138.5q-4 -13 2 -24t19 -14l34 -9q4 -1 8 -1q22 0 28 21 q18 58 58.5 98.5t97.5 58.5q12 3 18 13.5t3 21.5l-9 35q-3 12 -14 19q-7 4 -15 4zM719.5 719.5q-49.5 49.5 -119.5 49.5t-119.5 -49.5t-49.5 -119.5t49.5 -119.5t119.5 -49.5t119.5 49.5t49.5 119.5t-49.5 119.5zM855 551q-22 0 -28 -21q-18 -58 -58.5 -98.5t-98.5 -57.5 q-11 -4 -17 -14.5t-3 -21.5l9 -35q3 -12 14 -19q7 -4 15 -4q4 0 9 2q80 24 138.5 82.5t82.5 138.5q4 13 -2.5 24t-18.5 14l-34 9q-4 1 -8 1zM1000 515q-23 0 -29 -22q-27 -96 -98 -166q-70 -71 -166 -98q-11 -3 -17.5 -13.5t-3.5 -22.5l9 -35q3 -13 14 -19q7 -4 15 -4 q4 0 8 1q121 34 209.5 122.5t122.5 209.5q4 12 -2.5 23t-18.5 14l-36 9q-3 1 -7 1z" /> +<glyph unicode="" d="M700 800h300v-380h-180v200h-340v-200h-380v755q0 10 7.5 17.5t17.5 7.5h575v-400zM1000 900h-200v200zM700 300h162l-212 -212l-212 212h162v200h100v-200zM520 0h-395q-10 0 -17.5 7.5t-7.5 17.5v395zM1000 220v-195q0 -10 -7.5 -17.5t-17.5 -7.5h-195z" /> +<glyph unicode="" d="M700 800h300v-520l-350 350l-550 -550v1095q0 10 7.5 17.5t17.5 7.5h575v-400zM1000 900h-200v200zM862 200h-162v-200h-100v200h-162l212 212zM480 0h-355q-10 0 -17.5 7.5t-7.5 17.5v55h380v-80zM1000 80v-55q0 -10 -7.5 -17.5t-17.5 -7.5h-155v80h180z" /> +<glyph unicode="" d="M1162 800h-162v-200h100l100 -100h-300v300h-162l212 212zM200 800h200q27 0 40 -2t29.5 -10.5t23.5 -30t7 -57.5h300v-100h-600l-200 -350v450h100q0 36 7 57.5t23.5 30t29.5 10.5t40 2zM800 400h240l-240 -400h-800l300 500h500v-100z" /> +<glyph unicode="" d="M650 1100h100q21 0 35.5 -14.5t14.5 -35.5v-50h50q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-300q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h50v50q0 21 14.5 35.5t35.5 14.5zM1000 850v150q41 0 70.5 -29.5t29.5 -70.5v-800 q0 -41 -29.5 -70.5t-70.5 -29.5h-600q-1 0 -20 4l246 246l-326 326v324q0 41 29.5 70.5t70.5 29.5v-150q0 -62 44 -106t106 -44h300q62 0 106 44t44 106zM412 250l-212 -212v162h-200v100h200v162z" /> +<glyph unicode="" d="M450 1100h100q21 0 35.5 -14.5t14.5 -35.5v-50h50q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-300q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h50v50q0 21 14.5 35.5t35.5 14.5zM800 850v150q41 0 70.5 -29.5t29.5 -70.5v-500 h-200v-300h200q0 -36 -7 -57.5t-23.5 -30t-29.5 -10.5t-40 -2h-600q-41 0 -70.5 29.5t-29.5 70.5v800q0 41 29.5 70.5t70.5 29.5v-150q0 -62 44 -106t106 -44h300q62 0 106 44t44 106zM1212 250l-212 -212v162h-200v100h200v162z" /> +<glyph unicode="" d="M658 1197l637 -1104q23 -38 7 -65.5t-60 -27.5h-1276q-44 0 -60 27.5t7 65.5l637 1104q22 39 54 39t54 -39zM704 800h-208q-20 0 -32 -14.5t-8 -34.5l58 -302q4 -20 21.5 -34.5t37.5 -14.5h54q20 0 37.5 14.5t21.5 34.5l58 302q4 20 -8 34.5t-32 14.5zM500 300v-100h200 v100h-200z" /> +<glyph unicode="" d="M425 1100h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5zM425 800h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5 t17.5 7.5zM825 800h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5zM25 500h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150 q0 10 7.5 17.5t17.5 7.5zM425 500h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5zM825 500h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5 v150q0 10 7.5 17.5t17.5 7.5zM25 200h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5zM425 200h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5 t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5zM825 200h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5z" /> +<glyph unicode="" d="M700 1200h100v-200h-100v-100h350q62 0 86.5 -39.5t-3.5 -94.5l-66 -132q-41 -83 -81 -134h-772q-40 51 -81 134l-66 132q-28 55 -3.5 94.5t86.5 39.5h350v100h-100v200h100v100h200v-100zM250 400h700q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-12l137 -100 h-950l138 100h-13q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM50 100h1100q21 0 35.5 -14.5t14.5 -35.5v-50h-1200v50q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M600 1300q40 0 68.5 -29.5t28.5 -70.5h-194q0 41 28.5 70.5t68.5 29.5zM443 1100h314q18 -37 18 -75q0 -8 -3 -25h328q41 0 44.5 -16.5t-30.5 -38.5l-175 -145h-678l-178 145q-34 22 -29 38.5t46 16.5h328q-3 17 -3 25q0 38 18 75zM250 700h700q21 0 35.5 -14.5 t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-150v-200l275 -200h-950l275 200v200h-150q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM50 100h1100q21 0 35.5 -14.5t14.5 -35.5v-50h-1200v50q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M600 1181q75 0 128 -53t53 -128t-53 -128t-128 -53t-128 53t-53 128t53 128t128 53zM602 798h46q34 0 55.5 -28.5t21.5 -86.5q0 -76 39 -183h-324q39 107 39 183q0 58 21.5 86.5t56.5 28.5h45zM250 400h700q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-13 l138 -100h-950l137 100h-12q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM50 100h1100q21 0 35.5 -14.5t14.5 -35.5v-50h-1200v50q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M600 1300q47 0 92.5 -53.5t71 -123t25.5 -123.5q0 -78 -55.5 -133.5t-133.5 -55.5t-133.5 55.5t-55.5 133.5q0 62 34 143l144 -143l111 111l-163 163q34 26 63 26zM602 798h46q34 0 55.5 -28.5t21.5 -86.5q0 -76 39 -183h-324q39 107 39 183q0 58 21.5 86.5t56.5 28.5h45 zM250 400h700q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-13l138 -100h-950l137 100h-12q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM50 100h1100q21 0 35.5 -14.5t14.5 -35.5v-50h-1200v50q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M600 1200l300 -161v-139h-300q0 -57 18.5 -108t50 -91.5t63 -72t70 -67.5t57.5 -61h-530q-60 83 -90.5 177.5t-30.5 178.5t33 164.5t87.5 139.5t126 96.5t145.5 41.5v-98zM250 400h700q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-13l138 -100h-950l137 100 h-12q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM50 100h1100q21 0 35.5 -14.5t14.5 -35.5v-50h-1200v50q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M600 1300q41 0 70.5 -29.5t29.5 -70.5v-78q46 -26 73 -72t27 -100v-50h-400v50q0 54 27 100t73 72v78q0 41 29.5 70.5t70.5 29.5zM400 800h400q54 0 100 -27t72 -73h-172v-100h200v-100h-200v-100h200v-100h-200v-100h200q0 -83 -58.5 -141.5t-141.5 -58.5h-400 q-83 0 -141.5 58.5t-58.5 141.5v400q0 83 58.5 141.5t141.5 58.5z" /> +<glyph unicode="" d="M150 1100h900q21 0 35.5 -14.5t14.5 -35.5v-500q0 -21 -14.5 -35.5t-35.5 -14.5h-900q-21 0 -35.5 14.5t-14.5 35.5v500q0 21 14.5 35.5t35.5 14.5zM125 400h950q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-283l224 -224q13 -13 13 -31.5t-13 -32 t-31.5 -13.5t-31.5 13l-88 88h-524l-87 -88q-13 -13 -32 -13t-32 13.5t-13 32t13 31.5l224 224h-289q-10 0 -17.5 7.5t-7.5 17.5v50q0 10 7.5 17.5t17.5 7.5zM541 300l-100 -100h324l-100 100h-124z" /> +<glyph unicode="" d="M200 1100h800q83 0 141.5 -58.5t58.5 -141.5v-200h-100q0 41 -29.5 70.5t-70.5 29.5h-250q-41 0 -70.5 -29.5t-29.5 -70.5h-100q0 41 -29.5 70.5t-70.5 29.5h-250q-41 0 -70.5 -29.5t-29.5 -70.5h-100v200q0 83 58.5 141.5t141.5 58.5zM100 600h1000q41 0 70.5 -29.5 t29.5 -70.5v-300h-1200v300q0 41 29.5 70.5t70.5 29.5zM300 100v-50q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v50h200zM1100 100v-50q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v50h200z" /> +<glyph unicode="" d="M480 1165l682 -683q31 -31 31 -75.5t-31 -75.5l-131 -131h-481l-517 518q-32 31 -32 75.5t32 75.5l295 296q31 31 75.5 31t76.5 -31zM108 794l342 -342l303 304l-341 341zM250 100h800q21 0 35.5 -14.5t14.5 -35.5v-50h-900v50q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M1057 647l-189 506q-8 19 -27.5 33t-40.5 14h-400q-21 0 -40.5 -14t-27.5 -33l-189 -506q-8 -19 1.5 -33t30.5 -14h625v-150q0 -21 14.5 -35.5t35.5 -14.5t35.5 14.5t14.5 35.5v150h125q21 0 30.5 14t1.5 33zM897 0h-595v50q0 21 14.5 35.5t35.5 14.5h50v50 q0 21 14.5 35.5t35.5 14.5h48v300h200v-300h47q21 0 35.5 -14.5t14.5 -35.5v-50h50q21 0 35.5 -14.5t14.5 -35.5v-50z" /> +<glyph unicode="" d="M900 800h300v-575q0 -10 -7.5 -17.5t-17.5 -7.5h-375v591l-300 300v84q0 10 7.5 17.5t17.5 7.5h375v-400zM1200 900h-200v200zM400 600h300v-575q0 -10 -7.5 -17.5t-17.5 -7.5h-650q-10 0 -17.5 7.5t-7.5 17.5v950q0 10 7.5 17.5t17.5 7.5h375v-400zM700 700h-200v200z " /> +<glyph unicode="" d="M484 1095h195q75 0 146 -32.5t124 -86t89.5 -122.5t48.5 -142q18 -14 35 -20q31 -10 64.5 6.5t43.5 48.5q10 34 -15 71q-19 27 -9 43q5 8 12.5 11t19 -1t23.5 -16q41 -44 39 -105q-3 -63 -46 -106.5t-104 -43.5h-62q-7 -55 -35 -117t-56 -100l-39 -234q-3 -20 -20 -34.5 t-38 -14.5h-100q-21 0 -33 14.5t-9 34.5l12 70q-49 -14 -91 -14h-195q-24 0 -65 8l-11 -64q-3 -20 -20 -34.5t-38 -14.5h-100q-21 0 -33 14.5t-9 34.5l26 157q-84 74 -128 175l-159 53q-19 7 -33 26t-14 40v50q0 21 14.5 35.5t35.5 14.5h124q11 87 56 166l-111 95 q-16 14 -12.5 23.5t24.5 9.5h203q116 101 250 101zM675 1000h-250q-10 0 -17.5 -7.5t-7.5 -17.5v-50q0 -10 7.5 -17.5t17.5 -7.5h250q10 0 17.5 7.5t7.5 17.5v50q0 10 -7.5 17.5t-17.5 7.5z" /> +<glyph unicode="" d="M641 900l423 247q19 8 42 2.5t37 -21.5l32 -38q14 -15 12.5 -36t-17.5 -34l-139 -120h-390zM50 1100h106q67 0 103 -17t66 -71l102 -212h823q21 0 35.5 -14.5t14.5 -35.5v-50q0 -21 -14 -40t-33 -26l-737 -132q-23 -4 -40 6t-26 25q-42 67 -100 67h-300q-62 0 -106 44 t-44 106v200q0 62 44 106t106 44zM173 928h-80q-19 0 -28 -14t-9 -35v-56q0 -51 42 -51h134q16 0 21.5 8t5.5 24q0 11 -16 45t-27 51q-18 28 -43 28zM550 727q-32 0 -54.5 -22.5t-22.5 -54.5t22.5 -54.5t54.5 -22.5t54.5 22.5t22.5 54.5t-22.5 54.5t-54.5 22.5zM130 389 l152 130q18 19 34 24t31 -3.5t24.5 -17.5t25.5 -28q28 -35 50.5 -51t48.5 -13l63 5l48 -179q13 -61 -3.5 -97.5t-67.5 -79.5l-80 -69q-47 -40 -109 -35.5t-103 51.5l-130 151q-40 47 -35.5 109.5t51.5 102.5zM380 377l-102 -88q-31 -27 2 -65l37 -43q13 -15 27.5 -19.5 t31.5 6.5l61 53q19 16 14 49q-2 20 -12 56t-17 45q-11 12 -19 14t-23 -8z" /> +<glyph unicode="" d="M625 1200h150q10 0 17.5 -7.5t7.5 -17.5v-109q79 -33 131 -87.5t53 -128.5q1 -46 -15 -84.5t-39 -61t-46 -38t-39 -21.5l-17 -6q6 0 15 -1.5t35 -9t50 -17.5t53 -30t50 -45t35.5 -64t14.5 -84q0 -59 -11.5 -105.5t-28.5 -76.5t-44 -51t-49.5 -31.5t-54.5 -16t-49.5 -6.5 t-43.5 -1v-75q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v75h-100v-75q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v75h-175q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5h75v600h-75q-10 0 -17.5 7.5t-7.5 17.5v150 q0 10 7.5 17.5t17.5 7.5h175v75q0 10 7.5 17.5t17.5 7.5h150q10 0 17.5 -7.5t7.5 -17.5v-75h100v75q0 10 7.5 17.5t17.5 7.5zM400 900v-200h263q28 0 48.5 10.5t30 25t15 29t5.5 25.5l1 10q0 4 -0.5 11t-6 24t-15 30t-30 24t-48.5 11h-263zM400 500v-200h363q28 0 48.5 10.5 t30 25t15 29t5.5 25.5l1 10q0 4 -0.5 11t-6 24t-15 30t-30 24t-48.5 11h-363z" /> +<glyph unicode="" d="M212 1198h780q86 0 147 -61t61 -147v-416q0 -51 -18 -142.5t-36 -157.5l-18 -66q-29 -87 -93.5 -146.5t-146.5 -59.5h-572q-82 0 -147 59t-93 147q-8 28 -20 73t-32 143.5t-20 149.5v416q0 86 61 147t147 61zM600 1045q-70 0 -132.5 -11.5t-105.5 -30.5t-78.5 -41.5 t-57 -45t-36 -41t-20.5 -30.5l-6 -12l156 -243h560l156 243q-2 5 -6 12.5t-20 29.5t-36.5 42t-57 44.5t-79 42t-105 29.5t-132.5 12zM762 703h-157l195 261z" /> +<glyph unicode="" d="M475 1300h150q103 0 189 -86t86 -189v-500q0 -41 -42 -83t-83 -42h-450q-41 0 -83 42t-42 83v500q0 103 86 189t189 86zM700 300v-225q0 -21 -27 -48t-48 -27h-150q-21 0 -48 27t-27 48v225h300z" /> +<glyph unicode="" d="M475 1300h96q0 -150 89.5 -239.5t239.5 -89.5v-446q0 -41 -42 -83t-83 -42h-450q-41 0 -83 42t-42 83v500q0 103 86 189t189 86zM700 300v-225q0 -21 -27 -48t-48 -27h-150q-21 0 -48 27t-27 48v225h300z" /> +<glyph unicode="" d="M1294 767l-638 -283l-378 170l-78 -60v-224l100 -150v-199l-150 148l-150 -149v200l100 150v250q0 4 -0.5 10.5t0 9.5t1 8t3 8t6.5 6l47 40l-147 65l642 283zM1000 380l-350 -166l-350 166v147l350 -165l350 165v-147z" /> +<glyph unicode="" d="M250 800q62 0 106 -44t44 -106t-44 -106t-106 -44t-106 44t-44 106t44 106t106 44zM650 800q62 0 106 -44t44 -106t-44 -106t-106 -44t-106 44t-44 106t44 106t106 44zM1050 800q62 0 106 -44t44 -106t-44 -106t-106 -44t-106 44t-44 106t44 106t106 44z" /> +<glyph unicode="" d="M550 1100q62 0 106 -44t44 -106t-44 -106t-106 -44t-106 44t-44 106t44 106t106 44zM550 700q62 0 106 -44t44 -106t-44 -106t-106 -44t-106 44t-44 106t44 106t106 44zM550 300q62 0 106 -44t44 -106t-44 -106t-106 -44t-106 44t-44 106t44 106t106 44z" /> +<glyph unicode="" d="M125 1100h950q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-950q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5zM125 700h950q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-950q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5 t17.5 7.5zM125 300h950q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-950q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5z" /> +<glyph unicode="" d="M350 1200h500q162 0 256 -93.5t94 -256.5v-500q0 -165 -93.5 -257.5t-256.5 -92.5h-500q-165 0 -257.5 92.5t-92.5 257.5v500q0 165 92.5 257.5t257.5 92.5zM900 1000h-600q-41 0 -70.5 -29.5t-29.5 -70.5v-600q0 -41 29.5 -70.5t70.5 -29.5h600q41 0 70.5 29.5 t29.5 70.5v600q0 41 -29.5 70.5t-70.5 29.5zM350 900h500q21 0 35.5 -14.5t14.5 -35.5v-300q0 -21 -14.5 -35.5t-35.5 -14.5h-500q-21 0 -35.5 14.5t-14.5 35.5v300q0 21 14.5 35.5t35.5 14.5zM400 800v-200h400v200h-400z" /> +<glyph unicode="" d="M150 1100h1000q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-50v-200h50q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-50v-200h50q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-50v-200h50q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5 t-35.5 -14.5h-1000q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5h50v200h-50q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5h50v200h-50q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5h50v200h-50q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M650 1187q87 -67 118.5 -156t0 -178t-118.5 -155q-87 66 -118.5 155t0 178t118.5 156zM300 800q124 0 212 -88t88 -212q-124 0 -212 88t-88 212zM1000 800q0 -124 -88 -212t-212 -88q0 124 88 212t212 88zM300 500q124 0 212 -88t88 -212q-124 0 -212 88t-88 212z M1000 500q0 -124 -88 -212t-212 -88q0 124 88 212t212 88zM700 199v-144q0 -21 -14.5 -35.5t-35.5 -14.5t-35.5 14.5t-14.5 35.5v142q40 -4 43 -4q17 0 57 6z" /> +<glyph unicode="" d="M745 878l69 19q25 6 45 -12l298 -295q11 -11 15 -26.5t-2 -30.5q-5 -14 -18 -23.5t-28 -9.5h-8q1 0 1 -13q0 -29 -2 -56t-8.5 -62t-20 -63t-33 -53t-51 -39t-72.5 -14h-146q-184 0 -184 288q0 24 10 47q-20 4 -62 4t-63 -4q11 -24 11 -47q0 -288 -184 -288h-142 q-48 0 -84.5 21t-56 51t-32 71.5t-16 75t-3.5 68.5q0 13 2 13h-7q-15 0 -27.5 9.5t-18.5 23.5q-6 15 -2 30.5t15 25.5l298 296q20 18 46 11l76 -19q20 -5 30.5 -22.5t5.5 -37.5t-22.5 -31t-37.5 -5l-51 12l-182 -193h891l-182 193l-44 -12q-20 -5 -37.5 6t-22.5 31t6 37.5 t31 22.5z" /> +<glyph unicode="" d="M1200 900h-50q0 21 -4 37t-9.5 26.5t-18 17.5t-22 11t-28.5 5.5t-31 2t-37 0.5h-200v-850q0 -22 25 -34.5t50 -13.5l25 -2v-100h-400v100q4 0 11 0.5t24 3t30 7t24 15t11 24.5v850h-200q-25 0 -37 -0.5t-31 -2t-28.5 -5.5t-22 -11t-18 -17.5t-9.5 -26.5t-4 -37h-50v300 h1000v-300zM500 450h-25q0 15 -4 24.5t-9 14.5t-17 7.5t-20 3t-25 0.5h-100v-425q0 -11 12.5 -17.5t25.5 -7.5h12v-50h-200v50q50 0 50 25v425h-100q-17 0 -25 -0.5t-20 -3t-17 -7.5t-9 -14.5t-4 -24.5h-25v150h500v-150z" /> +<glyph unicode="" d="M1000 300v50q-25 0 -55 32q-14 14 -25 31t-16 27l-4 11l-289 747h-69l-300 -754q-18 -35 -39 -56q-9 -9 -24.5 -18.5t-26.5 -14.5l-11 -5v-50h273v50q-49 0 -78.5 21.5t-11.5 67.5l69 176h293l61 -166q13 -34 -3.5 -66.5t-55.5 -32.5v-50h312zM412 691l134 342l121 -342 h-255zM1100 150v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1000q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h1000q21 0 35.5 -14.5t14.5 -35.5z" /> +<glyph unicode="" d="M50 1200h1100q21 0 35.5 -14.5t14.5 -35.5v-1100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v1100q0 21 14.5 35.5t35.5 14.5zM611 1118h-70q-13 0 -18 -12l-299 -753q-17 -32 -35 -51q-18 -18 -56 -34q-12 -5 -12 -18v-50q0 -8 5.5 -14t14.5 -6 h273q8 0 14 6t6 14v50q0 8 -6 14t-14 6q-55 0 -71 23q-10 14 0 39l63 163h266l57 -153q11 -31 -6 -55q-12 -17 -36 -17q-8 0 -14 -6t-6 -14v-50q0 -8 6 -14t14 -6h313q8 0 14 6t6 14v50q0 7 -5.5 13t-13.5 7q-17 0 -42 25q-25 27 -40 63h-1l-288 748q-5 12 -19 12zM639 611 h-197l103 264z" /> +<glyph unicode="" d="M1200 1100h-1200v100h1200v-100zM50 1000h400q21 0 35.5 -14.5t14.5 -35.5v-900q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v900q0 21 14.5 35.5t35.5 14.5zM650 1000h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400 q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM700 900v-300h300v300h-300z" /> +<glyph unicode="" d="M50 1200h400q21 0 35.5 -14.5t14.5 -35.5v-900q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v900q0 21 14.5 35.5t35.5 14.5zM650 700h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400 q0 21 14.5 35.5t35.5 14.5zM700 600v-300h300v300h-300zM1200 0h-1200v100h1200v-100z" /> +<glyph unicode="" d="M50 1000h400q21 0 35.5 -14.5t14.5 -35.5v-350h100v150q0 21 14.5 35.5t35.5 14.5h400q21 0 35.5 -14.5t14.5 -35.5v-150h100v-100h-100v-150q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v150h-100v-350q0 -21 -14.5 -35.5t-35.5 -14.5h-400 q-21 0 -35.5 14.5t-14.5 35.5v800q0 21 14.5 35.5t35.5 14.5zM700 700v-300h300v300h-300z" /> +<glyph unicode="" d="M100 0h-100v1200h100v-1200zM250 1100h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM300 1000v-300h300v300h-300zM250 500h900q21 0 35.5 -14.5t14.5 -35.5v-400 q0 -21 -14.5 -35.5t-35.5 -14.5h-900q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M600 1100h150q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-150v-100h450q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-900q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5h350v100h-150q-21 0 -35.5 14.5 t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5h150v100h100v-100zM400 1000v-300h300v300h-300z" /> +<glyph unicode="" d="M1200 0h-100v1200h100v-1200zM550 1100h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM600 1000v-300h300v300h-300zM50 500h900q21 0 35.5 -14.5t14.5 -35.5v-400 q0 -21 -14.5 -35.5t-35.5 -14.5h-900q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5z" /> +<glyph unicode="" d="M865 565l-494 -494q-23 -23 -41 -23q-14 0 -22 13.5t-8 38.5v1000q0 25 8 38.5t22 13.5q18 0 41 -23l494 -494q14 -14 14 -35t-14 -35z" /> +<glyph unicode="" d="M335 635l494 494q29 29 50 20.5t21 -49.5v-1000q0 -41 -21 -49.5t-50 20.5l-494 494q-14 14 -14 35t14 35z" /> +<glyph unicode="" d="M100 900h1000q41 0 49.5 -21t-20.5 -50l-494 -494q-14 -14 -35 -14t-35 14l-494 494q-29 29 -20.5 50t49.5 21z" /> +<glyph unicode="" d="M635 865l494 -494q29 -29 20.5 -50t-49.5 -21h-1000q-41 0 -49.5 21t20.5 50l494 494q14 14 35 14t35 -14z" /> +<glyph unicode="" d="M700 741v-182l-692 -323v221l413 193l-413 193v221zM1200 0h-800v200h800v-200z" /> +<glyph unicode="" d="M1200 900h-200v-100h200v-100h-300v300h200v100h-200v100h300v-300zM0 700h50q0 21 4 37t9.5 26.5t18 17.5t22 11t28.5 5.5t31 2t37 0.5h100v-550q0 -22 -25 -34.5t-50 -13.5l-25 -2v-100h400v100q-4 0 -11 0.5t-24 3t-30 7t-24 15t-11 24.5v550h100q25 0 37 -0.5t31 -2 t28.5 -5.5t22 -11t18 -17.5t9.5 -26.5t4 -37h50v300h-800v-300z" /> +<glyph unicode="" d="M800 700h-50q0 21 -4 37t-9.5 26.5t-18 17.5t-22 11t-28.5 5.5t-31 2t-37 0.5h-100v-550q0 -22 25 -34.5t50 -14.5l25 -1v-100h-400v100q4 0 11 0.5t24 3t30 7t24 15t11 24.5v550h-100q-25 0 -37 -0.5t-31 -2t-28.5 -5.5t-22 -11t-18 -17.5t-9.5 -26.5t-4 -37h-50v300 h800v-300zM1100 200h-200v-100h200v-100h-300v300h200v100h-200v100h300v-300z" /> +<glyph unicode="" d="M701 1098h160q16 0 21 -11t-7 -23l-464 -464l464 -464q12 -12 7 -23t-21 -11h-160q-13 0 -23 9l-471 471q-7 8 -7 18t7 18l471 471q10 9 23 9z" /> +<glyph unicode="" d="M339 1098h160q13 0 23 -9l471 -471q7 -8 7 -18t-7 -18l-471 -471q-10 -9 -23 -9h-160q-16 0 -21 11t7 23l464 464l-464 464q-12 12 -7 23t21 11z" /> +<glyph unicode="" d="M1087 882q11 -5 11 -21v-160q0 -13 -9 -23l-471 -471q-8 -7 -18 -7t-18 7l-471 471q-9 10 -9 23v160q0 16 11 21t23 -7l464 -464l464 464q12 12 23 7z" /> +<glyph unicode="" d="M618 993l471 -471q9 -10 9 -23v-160q0 -16 -11 -21t-23 7l-464 464l-464 -464q-12 -12 -23 -7t-11 21v160q0 13 9 23l471 471q8 7 18 7t18 -7z" /> +<glyph unicode="" d="M1000 1200q0 -124 -88 -212t-212 -88q0 124 88 212t212 88zM450 1000h100q21 0 40 -14t26 -33l79 -194q5 1 16 3q34 6 54 9.5t60 7t65.5 1t61 -10t56.5 -23t42.5 -42t29 -64t5 -92t-19.5 -121.5q-1 -7 -3 -19.5t-11 -50t-20.5 -73t-32.5 -81.5t-46.5 -83t-64 -70 t-82.5 -50q-13 -5 -42 -5t-65.5 2.5t-47.5 2.5q-14 0 -49.5 -3.5t-63 -3.5t-43.5 7q-57 25 -104.5 78.5t-75 111.5t-46.5 112t-26 90l-7 35q-15 63 -18 115t4.5 88.5t26 64t39.5 43.5t52 25.5t58.5 13t62.5 2t59.5 -4.5t55.5 -8l-147 192q-12 18 -5.5 30t27.5 12z" /> +<glyph unicode="🔑" d="M250 1200h600q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-150v-500l-255 -178q-19 -9 -32 -1t-13 29v650h-150q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM400 1100v-100h300v100h-300z" /> +<glyph unicode="🚪" d="M250 1200h750q39 0 69.5 -40.5t30.5 -84.5v-933l-700 -117v950l600 125h-700v-1000h-100v1025q0 23 15.5 49t34.5 26zM500 525v-100l100 20v100z" /> +</font> +</defs></svg> \ No newline at end of file diff --git a/apache-tapestry/src/main/webapp/mybootstrap/fonts/glyphicons-halflings-regular.ttf b/apache-tapestry/src/main/webapp/mybootstrap/fonts/glyphicons-halflings-regular.ttf new file mode 100644 index 0000000000..c0e841e44b Binary files /dev/null and b/apache-tapestry/src/main/webapp/mybootstrap/fonts/glyphicons-halflings-regular.ttf differ diff --git a/apache-tapestry/src/main/webapp/mybootstrap/fonts/glyphicons-halflings-regular.woff b/apache-tapestry/src/main/webapp/mybootstrap/fonts/glyphicons-halflings-regular.woff new file mode 100644 index 0000000000..59d837ee61 Binary files /dev/null and b/apache-tapestry/src/main/webapp/mybootstrap/fonts/glyphicons-halflings-regular.woff differ diff --git a/apache-tapestry/src/main/webapp/mybootstrap/fonts/glyphicons-halflings-regular.woff2 b/apache-tapestry/src/main/webapp/mybootstrap/fonts/glyphicons-halflings-regular.woff2 new file mode 100644 index 0000000000..006d10650b Binary files /dev/null and b/apache-tapestry/src/main/webapp/mybootstrap/fonts/glyphicons-halflings-regular.woff2 differ diff --git a/apache-tapestry/src/main/webapp/mybootstrap/js/affix.js b/apache-tapestry/src/main/webapp/mybootstrap/js/affix.js new file mode 100644 index 0000000000..98197642aa --- /dev/null +++ b/apache-tapestry/src/main/webapp/mybootstrap/js/affix.js @@ -0,0 +1,162 @@ +/* ======================================================================== + * Bootstrap: affix.js v3.3.4 + * http://getbootstrap.com/javascript/#affix + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // AFFIX CLASS DEFINITION + // ====================== + + var Affix = function (element, options) { + this.options = $.extend({}, Affix.DEFAULTS, options) + + this.$target = $(this.options.target) + .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this)) + .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this)) + + this.$element = $(element) + this.affixed = null + this.unpin = null + this.pinnedOffset = null + + this.checkPosition() + } + + Affix.VERSION = '3.3.4' + + Affix.RESET = 'affix affix-top affix-bottom' + + Affix.DEFAULTS = { + offset: 0, + target: window + } + + Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) { + var scrollTop = this.$target.scrollTop() + var position = this.$element.offset() + var targetHeight = this.$target.height() + + if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false + + if (this.affixed == 'bottom') { + if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom' + return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom' + } + + var initializing = this.affixed == null + var colliderTop = initializing ? scrollTop : position.top + var colliderHeight = initializing ? targetHeight : height + + if (offsetTop != null && scrollTop <= offsetTop) return 'top' + if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom' + + return false + } + + Affix.prototype.getPinnedOffset = function () { + if (this.pinnedOffset) return this.pinnedOffset + this.$element.removeClass(Affix.RESET).addClass('affix') + var scrollTop = this.$target.scrollTop() + var position = this.$element.offset() + return (this.pinnedOffset = position.top - scrollTop) + } + + Affix.prototype.checkPositionWithEventLoop = function () { + setTimeout($.proxy(this.checkPosition, this), 1) + } + + Affix.prototype.checkPosition = function () { + if (!this.$element.is(':visible')) return + + var height = this.$element.height() + var offset = this.options.offset + var offsetTop = offset.top + var offsetBottom = offset.bottom + var scrollHeight = $(document.body).height() + + if (typeof offset != 'object') offsetBottom = offsetTop = offset + if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element) + if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element) + + var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom) + + if (this.affixed != affix) { + if (this.unpin != null) this.$element.css('top', '') + + var affixType = 'affix' + (affix ? '-' + affix : '') + var e = $.Event(affixType + '.bs.affix') + + this.$element.trigger(e) + + if (e.isDefaultPrevented()) return + + this.affixed = affix + this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null + + this.$element + .removeClass(Affix.RESET) + .addClass(affixType) + .trigger(affixType.replace('affix', 'affixed') + '.bs.affix') + } + + if (affix == 'bottom') { + this.$element.offset({ + top: scrollHeight - height - offsetBottom + }) + } + } + + + // AFFIX PLUGIN DEFINITION + // ======================= + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.affix') + var options = typeof option == 'object' && option + + if (!data) $this.data('bs.affix', (data = new Affix(this, options))) + if (typeof option == 'string') data[option]() + }) + } + + var old = $.fn.affix + + $.fn.affix = Plugin + $.fn.affix.Constructor = Affix + + + // AFFIX NO CONFLICT + // ================= + + $.fn.affix.noConflict = function () { + $.fn.affix = old + return this + } + + + // AFFIX DATA-API + // ============== + + $(window).on('load', function () { + $('[data-spy="affix"]').each(function () { + var $spy = $(this) + var data = $spy.data() + + data.offset = data.offset || {} + + if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom + if (data.offsetTop != null) data.offset.top = data.offsetTop + + Plugin.call($spy, data) + }) + }) + +}(jQuery); diff --git a/apache-tapestry/src/main/webapp/mybootstrap/js/alert.js b/apache-tapestry/src/main/webapp/mybootstrap/js/alert.js new file mode 100644 index 0000000000..1925ef011c --- /dev/null +++ b/apache-tapestry/src/main/webapp/mybootstrap/js/alert.js @@ -0,0 +1,94 @@ +/* ======================================================================== + * Bootstrap: alert.js v3.3.4 + * http://getbootstrap.com/javascript/#alerts + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // ALERT CLASS DEFINITION + // ====================== + + var dismiss = '[data-dismiss="alert"]' + var Alert = function (el) { + $(el).on('click', dismiss, this.close) + } + + Alert.VERSION = '3.3.4' + + Alert.TRANSITION_DURATION = 150 + + Alert.prototype.close = function (e) { + var $this = $(this) + var selector = $this.attr('data-target') + + if (!selector) { + selector = $this.attr('href') + selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 + } + + var $parent = $(selector) + + if (e) e.preventDefault() + + if (!$parent.length) { + $parent = $this.closest('.alert') + } + + $parent.trigger(e = $.Event('close.bs.alert')) + + if (e.isDefaultPrevented()) return + + $parent.removeClass('in') + + function removeElement() { + // detach from parent, fire event then clean up data + $parent.detach().trigger('closed.bs.alert').remove() + } + + $.support.transition && $parent.hasClass('fade') ? + $parent + .one('bsTransitionEnd', removeElement) + .emulateTransitionEnd(Alert.TRANSITION_DURATION) : + removeElement() + } + + + // ALERT PLUGIN DEFINITION + // ======================= + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.alert') + + if (!data) $this.data('bs.alert', (data = new Alert(this))) + if (typeof option == 'string') data[option].call($this) + }) + } + + var old = $.fn.alert + + $.fn.alert = Plugin + $.fn.alert.Constructor = Alert + + + // ALERT NO CONFLICT + // ================= + + $.fn.alert.noConflict = function () { + $.fn.alert = old + return this + } + + + // ALERT DATA-API + // ============== + + $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) + +}(jQuery); diff --git a/apache-tapestry/src/main/webapp/mybootstrap/js/button.js b/apache-tapestry/src/main/webapp/mybootstrap/js/button.js new file mode 100644 index 0000000000..7c7c021f95 --- /dev/null +++ b/apache-tapestry/src/main/webapp/mybootstrap/js/button.js @@ -0,0 +1,116 @@ +/* ======================================================================== + * Bootstrap: button.js v3.3.4 + * http://getbootstrap.com/javascript/#buttons + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // BUTTON PUBLIC CLASS DEFINITION + // ============================== + + var Button = function (element, options) { + this.$element = $(element) + this.options = $.extend({}, Button.DEFAULTS, options) + this.isLoading = false + } + + Button.VERSION = '3.3.4' + + Button.DEFAULTS = { + loadingText: 'loading...' + } + + Button.prototype.setState = function (state) { + var d = 'disabled' + var $el = this.$element + var val = $el.is('input') ? 'val' : 'html' + var data = $el.data() + + state = state + 'Text' + + if (data.resetText == null) $el.data('resetText', $el[val]()) + + // push to event loop to allow forms to submit + setTimeout($.proxy(function () { + $el[val](data[state] == null ? this.options[state] : data[state]) + + if (state == 'loadingText') { + this.isLoading = true + $el.addClass(d).attr(d, d) + } else if (this.isLoading) { + this.isLoading = false + $el.removeClass(d).removeAttr(d) + } + }, this), 0) + } + + Button.prototype.toggle = function () { + var changed = true + var $parent = this.$element.closest('[data-toggle="buttons"]') + + if ($parent.length) { + var $input = this.$element.find('input') + if ($input.prop('type') == 'radio') { + if ($input.prop('checked') && this.$element.hasClass('active')) changed = false + else $parent.find('.active').removeClass('active') + } + if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change') + } else { + this.$element.attr('aria-pressed', !this.$element.hasClass('active')) + } + + if (changed) this.$element.toggleClass('active') + } + + + // BUTTON PLUGIN DEFINITION + // ======================== + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.button') + var options = typeof option == 'object' && option + + if (!data) $this.data('bs.button', (data = new Button(this, options))) + + if (option == 'toggle') data.toggle() + else if (option) data.setState(option) + }) + } + + var old = $.fn.button + + $.fn.button = Plugin + $.fn.button.Constructor = Button + + + // BUTTON NO CONFLICT + // ================== + + $.fn.button.noConflict = function () { + $.fn.button = old + return this + } + + + // BUTTON DATA-API + // =============== + + $(document) + .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) { + var $btn = $(e.target) + if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') + Plugin.call($btn, 'toggle') + e.preventDefault() + }) + .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) { + $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type)) + }) + +}(jQuery); diff --git a/apache-tapestry/src/main/webapp/mybootstrap/js/carousel.js b/apache-tapestry/src/main/webapp/mybootstrap/js/carousel.js new file mode 100644 index 0000000000..a38ef14d0b --- /dev/null +++ b/apache-tapestry/src/main/webapp/mybootstrap/js/carousel.js @@ -0,0 +1,237 @@ +/* ======================================================================== + * Bootstrap: carousel.js v3.3.4 + * http://getbootstrap.com/javascript/#carousel + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // CAROUSEL CLASS DEFINITION + // ========================= + + var Carousel = function (element, options) { + this.$element = $(element) + this.$indicators = this.$element.find('.carousel-indicators') + this.options = options + this.paused = null + this.sliding = null + this.interval = null + this.$active = null + this.$items = null + + this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this)) + + this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element + .on('mouseenter.bs.carousel', $.proxy(this.pause, this)) + .on('mouseleave.bs.carousel', $.proxy(this.cycle, this)) + } + + Carousel.VERSION = '3.3.4' + + Carousel.TRANSITION_DURATION = 600 + + Carousel.DEFAULTS = { + interval: 5000, + pause: 'hover', + wrap: true, + keyboard: true + } + + Carousel.prototype.keydown = function (e) { + if (/input|textarea/i.test(e.target.tagName)) return + switch (e.which) { + case 37: this.prev(); break + case 39: this.next(); break + default: return + } + + e.preventDefault() + } + + Carousel.prototype.cycle = function (e) { + e || (this.paused = false) + + this.interval && clearInterval(this.interval) + + this.options.interval + && !this.paused + && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) + + return this + } + + Carousel.prototype.getItemIndex = function (item) { + this.$items = item.parent().children('.item') + return this.$items.index(item || this.$active) + } + + Carousel.prototype.getItemForDirection = function (direction, active) { + var activeIndex = this.getItemIndex(active) + var willWrap = (direction == 'prev' && activeIndex === 0) + || (direction == 'next' && activeIndex == (this.$items.length - 1)) + if (willWrap && !this.options.wrap) return active + var delta = direction == 'prev' ? -1 : 1 + var itemIndex = (activeIndex + delta) % this.$items.length + return this.$items.eq(itemIndex) + } + + Carousel.prototype.to = function (pos) { + var that = this + var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active')) + + if (pos > (this.$items.length - 1) || pos < 0) return + + if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid" + if (activeIndex == pos) return this.pause().cycle() + + return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos)) + } + + Carousel.prototype.pause = function (e) { + e || (this.paused = true) + + if (this.$element.find('.next, .prev').length && $.support.transition) { + this.$element.trigger($.support.transition.end) + this.cycle(true) + } + + this.interval = clearInterval(this.interval) + + return this + } + + Carousel.prototype.next = function () { + if (this.sliding) return + return this.slide('next') + } + + Carousel.prototype.prev = function () { + if (this.sliding) return + return this.slide('prev') + } + + Carousel.prototype.slide = function (type, next) { + var $active = this.$element.find('.item.active') + var $next = next || this.getItemForDirection(type, $active) + var isCycling = this.interval + var direction = type == 'next' ? 'left' : 'right' + var that = this + + if ($next.hasClass('active')) return (this.sliding = false) + + var relatedTarget = $next[0] + var slideEvent = $.Event('slide.bs.carousel', { + relatedTarget: relatedTarget, + direction: direction + }) + this.$element.trigger(slideEvent) + if (slideEvent.isDefaultPrevented()) return + + this.sliding = true + + isCycling && this.pause() + + if (this.$indicators.length) { + this.$indicators.find('.active').removeClass('active') + var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)]) + $nextIndicator && $nextIndicator.addClass('active') + } + + var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid" + if ($.support.transition && this.$element.hasClass('slide')) { + $next.addClass(type) + $next[0].offsetWidth // force reflow + $active.addClass(direction) + $next.addClass(direction) + $active + .one('bsTransitionEnd', function () { + $next.removeClass([type, direction].join(' ')).addClass('active') + $active.removeClass(['active', direction].join(' ')) + that.sliding = false + setTimeout(function () { + that.$element.trigger(slidEvent) + }, 0) + }) + .emulateTransitionEnd(Carousel.TRANSITION_DURATION) + } else { + $active.removeClass('active') + $next.addClass('active') + this.sliding = false + this.$element.trigger(slidEvent) + } + + isCycling && this.cycle() + + return this + } + + + // CAROUSEL PLUGIN DEFINITION + // ========================== + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.carousel') + var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option) + var action = typeof option == 'string' ? option : options.slide + + if (!data) $this.data('bs.carousel', (data = new Carousel(this, options))) + if (typeof option == 'number') data.to(option) + else if (action) data[action]() + else if (options.interval) data.pause().cycle() + }) + } + + var old = $.fn.carousel + + $.fn.carousel = Plugin + $.fn.carousel.Constructor = Carousel + + + // CAROUSEL NO CONFLICT + // ==================== + + $.fn.carousel.noConflict = function () { + $.fn.carousel = old + return this + } + + + // CAROUSEL DATA-API + // ================= + + var clickHandler = function (e) { + var href + var $this = $(this) + var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7 + if (!$target.hasClass('carousel')) return + var options = $.extend({}, $target.data(), $this.data()) + var slideIndex = $this.attr('data-slide-to') + if (slideIndex) options.interval = false + + Plugin.call($target, options) + + if (slideIndex) { + $target.data('bs.carousel').to(slideIndex) + } + + e.preventDefault() + } + + $(document) + .on('click.bs.carousel.data-api', '[data-slide]', clickHandler) + .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler) + + $(window).on('load', function () { + $('[data-ride="carousel"]').each(function () { + var $carousel = $(this) + Plugin.call($carousel, $carousel.data()) + }) + }) + +}(jQuery); diff --git a/apache-tapestry/src/main/webapp/mybootstrap/js/collapse.js b/apache-tapestry/src/main/webapp/mybootstrap/js/collapse.js new file mode 100644 index 0000000000..954513c5e1 --- /dev/null +++ b/apache-tapestry/src/main/webapp/mybootstrap/js/collapse.js @@ -0,0 +1,211 @@ +/* ======================================================================== + * Bootstrap: collapse.js v3.3.4 + * http://getbootstrap.com/javascript/#collapse + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // COLLAPSE PUBLIC CLASS DEFINITION + // ================================ + + var Collapse = function (element, options) { + this.$element = $(element) + this.options = $.extend({}, Collapse.DEFAULTS, options) + this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' + + '[data-toggle="collapse"][data-target="#' + element.id + '"]') + this.transitioning = null + + if (this.options.parent) { + this.$parent = this.getParent() + } else { + this.addAriaAndCollapsedClass(this.$element, this.$trigger) + } + + if (this.options.toggle) this.toggle() + } + + Collapse.VERSION = '3.3.4' + + Collapse.TRANSITION_DURATION = 350 + + Collapse.DEFAULTS = { + toggle: true + } + + Collapse.prototype.dimension = function () { + var hasWidth = this.$element.hasClass('width') + return hasWidth ? 'width' : 'height' + } + + Collapse.prototype.show = function () { + if (this.transitioning || this.$element.hasClass('in')) return + + var activesData + var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing') + + if (actives && actives.length) { + activesData = actives.data('bs.collapse') + if (activesData && activesData.transitioning) return + } + + var startEvent = $.Event('show.bs.collapse') + this.$element.trigger(startEvent) + if (startEvent.isDefaultPrevented()) return + + if (actives && actives.length) { + Plugin.call(actives, 'hide') + activesData || actives.data('bs.collapse', null) + } + + var dimension = this.dimension() + + this.$element + .removeClass('collapse') + .addClass('collapsing')[dimension](0) + .attr('aria-expanded', true) + + this.$trigger + .removeClass('collapsed') + .attr('aria-expanded', true) + + this.transitioning = 1 + + var complete = function () { + this.$element + .removeClass('collapsing') + .addClass('collapse in')[dimension]('') + this.transitioning = 0 + this.$element + .trigger('shown.bs.collapse') + } + + if (!$.support.transition) return complete.call(this) + + var scrollSize = $.camelCase(['scroll', dimension].join('-')) + + this.$element + .one('bsTransitionEnd', $.proxy(complete, this)) + .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize]) + } + + Collapse.prototype.hide = function () { + if (this.transitioning || !this.$element.hasClass('in')) return + + var startEvent = $.Event('hide.bs.collapse') + this.$element.trigger(startEvent) + if (startEvent.isDefaultPrevented()) return + + var dimension = this.dimension() + + this.$element[dimension](this.$element[dimension]())[0].offsetHeight + + this.$element + .addClass('collapsing') + .removeClass('collapse in') + .attr('aria-expanded', false) + + this.$trigger + .addClass('collapsed') + .attr('aria-expanded', false) + + this.transitioning = 1 + + var complete = function () { + this.transitioning = 0 + this.$element + .removeClass('collapsing') + .addClass('collapse') + .trigger('hidden.bs.collapse') + } + + if (!$.support.transition) return complete.call(this) + + this.$element + [dimension](0) + .one('bsTransitionEnd', $.proxy(complete, this)) + .emulateTransitionEnd(Collapse.TRANSITION_DURATION) + } + + Collapse.prototype.toggle = function () { + this[this.$element.hasClass('in') ? 'hide' : 'show']() + } + + Collapse.prototype.getParent = function () { + return $(this.options.parent) + .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]') + .each($.proxy(function (i, element) { + var $element = $(element) + this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element) + }, this)) + .end() + } + + Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) { + var isOpen = $element.hasClass('in') + + $element.attr('aria-expanded', isOpen) + $trigger + .toggleClass('collapsed', !isOpen) + .attr('aria-expanded', isOpen) + } + + function getTargetFromTrigger($trigger) { + var href + var target = $trigger.attr('data-target') + || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7 + + return $(target) + } + + + // COLLAPSE PLUGIN DEFINITION + // ========================== + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.collapse') + var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) + + if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false + if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) + if (typeof option == 'string') data[option]() + }) + } + + var old = $.fn.collapse + + $.fn.collapse = Plugin + $.fn.collapse.Constructor = Collapse + + + // COLLAPSE NO CONFLICT + // ==================== + + $.fn.collapse.noConflict = function () { + $.fn.collapse = old + return this + } + + + // COLLAPSE DATA-API + // ================= + + $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) { + var $this = $(this) + + if (!$this.attr('data-target')) e.preventDefault() + + var $target = getTargetFromTrigger($this) + var data = $target.data('bs.collapse') + var option = data ? 'toggle' : $this.data() + + Plugin.call($target, option) + }) + +}(jQuery); diff --git a/apache-tapestry/src/main/webapp/mybootstrap/js/dropdown.js b/apache-tapestry/src/main/webapp/mybootstrap/js/dropdown.js new file mode 100644 index 0000000000..9874600f9d --- /dev/null +++ b/apache-tapestry/src/main/webapp/mybootstrap/js/dropdown.js @@ -0,0 +1,161 @@ +/* ======================================================================== + * Bootstrap: dropdown.js v3.3.4 + * http://getbootstrap.com/javascript/#dropdowns + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // DROPDOWN CLASS DEFINITION + // ========================= + + var backdrop = '.dropdown-backdrop' + var toggle = '[data-toggle="dropdown"]' + var Dropdown = function (element) { + $(element).on('click.bs.dropdown', this.toggle) + } + + Dropdown.VERSION = '3.3.4' + + Dropdown.prototype.toggle = function (e) { + var $this = $(this) + + if ($this.is('.disabled, :disabled')) return + + var $parent = getParent($this) + var isActive = $parent.hasClass('open') + + clearMenus() + + if (!isActive) { + if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) { + // if mobile we use a backdrop because click events don't delegate + $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus) + } + + var relatedTarget = { relatedTarget: this } + $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget)) + + if (e.isDefaultPrevented()) return + + $this + .trigger('focus') + .attr('aria-expanded', 'true') + + $parent + .toggleClass('open') + .trigger('shown.bs.dropdown', relatedTarget) + } + + return false + } + + Dropdown.prototype.keydown = function (e) { + if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return + + var $this = $(this) + + e.preventDefault() + e.stopPropagation() + + if ($this.is('.disabled, :disabled')) return + + var $parent = getParent($this) + var isActive = $parent.hasClass('open') + + if ((!isActive && e.which != 27) || (isActive && e.which == 27)) { + if (e.which == 27) $parent.find(toggle).trigger('focus') + return $this.trigger('click') + } + + var desc = ' li:not(.disabled):visible a' + var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc) + + if (!$items.length) return + + var index = $items.index(e.target) + + if (e.which == 38 && index > 0) index-- // up + if (e.which == 40 && index < $items.length - 1) index++ // down + if (!~index) index = 0 + + $items.eq(index).trigger('focus') + } + + function clearMenus(e) { + if (e && e.which === 3) return + $(backdrop).remove() + $(toggle).each(function () { + var $this = $(this) + var $parent = getParent($this) + var relatedTarget = { relatedTarget: this } + + if (!$parent.hasClass('open')) return + + $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget)) + + if (e.isDefaultPrevented()) return + + $this.attr('aria-expanded', 'false') + $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget) + }) + } + + function getParent($this) { + var selector = $this.attr('data-target') + + if (!selector) { + selector = $this.attr('href') + selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 + } + + var $parent = selector && $(selector) + + return $parent && $parent.length ? $parent : $this.parent() + } + + + // DROPDOWN PLUGIN DEFINITION + // ========================== + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.dropdown') + + if (!data) $this.data('bs.dropdown', (data = new Dropdown(this))) + if (typeof option == 'string') data[option].call($this) + }) + } + + var old = $.fn.dropdown + + $.fn.dropdown = Plugin + $.fn.dropdown.Constructor = Dropdown + + + // DROPDOWN NO CONFLICT + // ==================== + + $.fn.dropdown.noConflict = function () { + $.fn.dropdown = old + return this + } + + + // APPLY TO STANDARD DROPDOWN ELEMENTS + // =================================== + + $(document) + .on('click.bs.dropdown.data-api', clearMenus) + .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) + .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle) + .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown) + .on('keydown.bs.dropdown.data-api', '[role="menu"]', Dropdown.prototype.keydown) + .on('keydown.bs.dropdown.data-api', '[role="listbox"]', Dropdown.prototype.keydown) + +}(jQuery); diff --git a/apache-tapestry/src/main/webapp/mybootstrap/js/modal.js b/apache-tapestry/src/main/webapp/mybootstrap/js/modal.js new file mode 100644 index 0000000000..c1eb2a852b --- /dev/null +++ b/apache-tapestry/src/main/webapp/mybootstrap/js/modal.js @@ -0,0 +1,339 @@ +/* ======================================================================== + * Bootstrap: modal.js v3.3.4 + * http://getbootstrap.com/javascript/#modals + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // MODAL CLASS DEFINITION + // ====================== + + var Modal = function (element, options) { + this.options = options + this.$body = $(document.body) + this.$element = $(element) + this.$dialog = this.$element.find('.modal-dialog') + this.$backdrop = null + this.isShown = null + this.originalBodyPad = null + this.scrollbarWidth = 0 + this.ignoreBackdropClick = false + + if (this.options.remote) { + this.$element + .find('.modal-content') + .load(this.options.remote, $.proxy(function () { + this.$element.trigger('loaded.bs.modal') + }, this)) + } + } + + Modal.VERSION = '3.3.4' + + Modal.TRANSITION_DURATION = 300 + Modal.BACKDROP_TRANSITION_DURATION = 150 + + Modal.DEFAULTS = { + backdrop: true, + keyboard: true, + show: true + } + + Modal.prototype.toggle = function (_relatedTarget) { + return this.isShown ? this.hide() : this.show(_relatedTarget) + } + + Modal.prototype.show = function (_relatedTarget) { + var that = this + var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget }) + + this.$element.trigger(e) + + if (this.isShown || e.isDefaultPrevented()) return + + this.isShown = true + + this.checkScrollbar() + this.setScrollbar() + this.$body.addClass('modal-open') + + this.escape() + this.resize() + + this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) + + this.$dialog.on('mousedown.dismiss.bs.modal', function () { + that.$element.one('mouseup.dismiss.bs.modal', function (e) { + if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true + }) + }) + + this.backdrop(function () { + var transition = $.support.transition && that.$element.hasClass('fade') + + if (!that.$element.parent().length) { + that.$element.appendTo(that.$body) // don't move modals dom position + } + + that.$element + .show() + .scrollTop(0) + + that.adjustDialog() + + if (transition) { + that.$element[0].offsetWidth // force reflow + } + + that.$element + .addClass('in') + .attr('aria-hidden', false) + + that.enforceFocus() + + var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget }) + + transition ? + that.$dialog // wait for modal to slide in + .one('bsTransitionEnd', function () { + that.$element.trigger('focus').trigger(e) + }) + .emulateTransitionEnd(Modal.TRANSITION_DURATION) : + that.$element.trigger('focus').trigger(e) + }) + } + + Modal.prototype.hide = function (e) { + if (e) e.preventDefault() + + e = $.Event('hide.bs.modal') + + this.$element.trigger(e) + + if (!this.isShown || e.isDefaultPrevented()) return + + this.isShown = false + + this.escape() + this.resize() + + $(document).off('focusin.bs.modal') + + this.$element + .removeClass('in') + .attr('aria-hidden', true) + .off('click.dismiss.bs.modal') + .off('mouseup.dismiss.bs.modal') + + this.$dialog.off('mousedown.dismiss.bs.modal') + + $.support.transition && this.$element.hasClass('fade') ? + this.$element + .one('bsTransitionEnd', $.proxy(this.hideModal, this)) + .emulateTransitionEnd(Modal.TRANSITION_DURATION) : + this.hideModal() + } + + Modal.prototype.enforceFocus = function () { + $(document) + .off('focusin.bs.modal') // guard against infinite focus loop + .on('focusin.bs.modal', $.proxy(function (e) { + if (this.$element[0] !== e.target && !this.$element.has(e.target).length) { + this.$element.trigger('focus') + } + }, this)) + } + + Modal.prototype.escape = function () { + if (this.isShown && this.options.keyboard) { + this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) { + e.which == 27 && this.hide() + }, this)) + } else if (!this.isShown) { + this.$element.off('keydown.dismiss.bs.modal') + } + } + + Modal.prototype.resize = function () { + if (this.isShown) { + $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this)) + } else { + $(window).off('resize.bs.modal') + } + } + + Modal.prototype.hideModal = function () { + var that = this + this.$element.hide() + this.backdrop(function () { + that.$body.removeClass('modal-open') + that.resetAdjustments() + that.resetScrollbar() + that.$element.trigger('hidden.bs.modal') + }) + } + + Modal.prototype.removeBackdrop = function () { + this.$backdrop && this.$backdrop.remove() + this.$backdrop = null + } + + Modal.prototype.backdrop = function (callback) { + var that = this + var animate = this.$element.hasClass('fade') ? 'fade' : '' + + if (this.isShown && this.options.backdrop) { + var doAnimate = $.support.transition && animate + + this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />') + .appendTo(this.$body) + + this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) { + if (this.ignoreBackdropClick) { + this.ignoreBackdropClick = false + return + } + if (e.target !== e.currentTarget) return + this.options.backdrop == 'static' + ? this.$element[0].focus() + : this.hide() + }, this)) + + if (doAnimate) this.$backdrop[0].offsetWidth // force reflow + + this.$backdrop.addClass('in') + + if (!callback) return + + doAnimate ? + this.$backdrop + .one('bsTransitionEnd', callback) + .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : + callback() + + } else if (!this.isShown && this.$backdrop) { + this.$backdrop.removeClass('in') + + var callbackRemove = function () { + that.removeBackdrop() + callback && callback() + } + $.support.transition && this.$element.hasClass('fade') ? + this.$backdrop + .one('bsTransitionEnd', callbackRemove) + .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : + callbackRemove() + + } else if (callback) { + callback() + } + } + + // these following methods are used to handle overflowing modals + + Modal.prototype.handleUpdate = function () { + this.adjustDialog() + } + + Modal.prototype.adjustDialog = function () { + var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight + + this.$element.css({ + paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '', + paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : '' + }) + } + + Modal.prototype.resetAdjustments = function () { + this.$element.css({ + paddingLeft: '', + paddingRight: '' + }) + } + + Modal.prototype.checkScrollbar = function () { + var fullWindowWidth = window.innerWidth + if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8 + var documentElementRect = document.documentElement.getBoundingClientRect() + fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left) + } + this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth + this.scrollbarWidth = this.measureScrollbar() + } + + Modal.prototype.setScrollbar = function () { + var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10) + this.originalBodyPad = document.body.style.paddingRight || '' + if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth) + } + + Modal.prototype.resetScrollbar = function () { + this.$body.css('padding-right', this.originalBodyPad) + } + + Modal.prototype.measureScrollbar = function () { // thx walsh + var scrollDiv = document.createElement('div') + scrollDiv.className = 'modal-scrollbar-measure' + this.$body.append(scrollDiv) + var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth + this.$body[0].removeChild(scrollDiv) + return scrollbarWidth + } + + + // MODAL PLUGIN DEFINITION + // ======================= + + function Plugin(option, _relatedTarget) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.modal') + var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option) + + if (!data) $this.data('bs.modal', (data = new Modal(this, options))) + if (typeof option == 'string') data[option](_relatedTarget) + else if (options.show) data.show(_relatedTarget) + }) + } + + var old = $.fn.modal + + $.fn.modal = Plugin + $.fn.modal.Constructor = Modal + + + // MODAL NO CONFLICT + // ================= + + $.fn.modal.noConflict = function () { + $.fn.modal = old + return this + } + + + // MODAL DATA-API + // ============== + + $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) { + var $this = $(this) + var href = $this.attr('href') + var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7 + var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data()) + + if ($this.is('a')) e.preventDefault() + + $target.one('show.bs.modal', function (showEvent) { + if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown + $target.one('hidden.bs.modal', function () { + $this.is(':visible') && $this.trigger('focus') + }) + }) + Plugin.call($target, option, this) + }) + +}(jQuery); diff --git a/apache-tapestry/src/main/webapp/mybootstrap/js/popover.js b/apache-tapestry/src/main/webapp/mybootstrap/js/popover.js new file mode 100644 index 0000000000..0b0755ee27 --- /dev/null +++ b/apache-tapestry/src/main/webapp/mybootstrap/js/popover.js @@ -0,0 +1,108 @@ +/* ======================================================================== + * Bootstrap: popover.js v3.3.4 + * http://getbootstrap.com/javascript/#popovers + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // POPOVER PUBLIC CLASS DEFINITION + // =============================== + + var Popover = function (element, options) { + this.init('popover', element, options) + } + + if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js') + + Popover.VERSION = '3.3.4' + + Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, { + placement: 'right', + trigger: 'click', + content: '', + template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' + }) + + + // NOTE: POPOVER EXTENDS tooltip.js + // ================================ + + Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype) + + Popover.prototype.constructor = Popover + + Popover.prototype.getDefaults = function () { + return Popover.DEFAULTS + } + + Popover.prototype.setContent = function () { + var $tip = this.tip() + var title = this.getTitle() + var content = this.getContent() + + $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) + $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events + this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text' + ](content) + + $tip.removeClass('fade top bottom left right in') + + // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do + // this manually by checking the contents. + if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide() + } + + Popover.prototype.hasContent = function () { + return this.getTitle() || this.getContent() + } + + Popover.prototype.getContent = function () { + var $e = this.$element + var o = this.options + + return $e.attr('data-content') + || (typeof o.content == 'function' ? + o.content.call($e[0]) : + o.content) + } + + Popover.prototype.arrow = function () { + return (this.$arrow = this.$arrow || this.tip().find('.arrow')) + } + + + // POPOVER PLUGIN DEFINITION + // ========================= + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.popover') + var options = typeof option == 'object' && option + + if (!data && /destroy|hide/.test(option)) return + if (!data) $this.data('bs.popover', (data = new Popover(this, options))) + if (typeof option == 'string') data[option]() + }) + } + + var old = $.fn.popover + + $.fn.popover = Plugin + $.fn.popover.Constructor = Popover + + + // POPOVER NO CONFLICT + // =================== + + $.fn.popover.noConflict = function () { + $.fn.popover = old + return this + } + +}(jQuery); diff --git a/apache-tapestry/src/main/webapp/mybootstrap/js/scrollspy.js b/apache-tapestry/src/main/webapp/mybootstrap/js/scrollspy.js new file mode 100644 index 0000000000..f860c1abad --- /dev/null +++ b/apache-tapestry/src/main/webapp/mybootstrap/js/scrollspy.js @@ -0,0 +1,172 @@ +/* ======================================================================== + * Bootstrap: scrollspy.js v3.3.4 + * http://getbootstrap.com/javascript/#scrollspy + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // SCROLLSPY CLASS DEFINITION + // ========================== + + function ScrollSpy(element, options) { + this.$body = $(document.body) + this.$scrollElement = $(element).is(document.body) ? $(window) : $(element) + this.options = $.extend({}, ScrollSpy.DEFAULTS, options) + this.selector = (this.options.target || '') + ' .nav li > a' + this.offsets = [] + this.targets = [] + this.activeTarget = null + this.scrollHeight = 0 + + this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this)) + this.refresh() + this.process() + } + + ScrollSpy.VERSION = '3.3.4' + + ScrollSpy.DEFAULTS = { + offset: 10 + } + + ScrollSpy.prototype.getScrollHeight = function () { + return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight) + } + + ScrollSpy.prototype.refresh = function () { + var that = this + var offsetMethod = 'offset' + var offsetBase = 0 + + this.offsets = [] + this.targets = [] + this.scrollHeight = this.getScrollHeight() + + if (!$.isWindow(this.$scrollElement[0])) { + offsetMethod = 'position' + offsetBase = this.$scrollElement.scrollTop() + } + + this.$body + .find(this.selector) + .map(function () { + var $el = $(this) + var href = $el.data('target') || $el.attr('href') + var $href = /^#./.test(href) && $(href) + + return ($href + && $href.length + && $href.is(':visible') + && [[$href[offsetMethod]().top + offsetBase, href]]) || null + }) + .sort(function (a, b) { return a[0] - b[0] }) + .each(function () { + that.offsets.push(this[0]) + that.targets.push(this[1]) + }) + } + + ScrollSpy.prototype.process = function () { + var scrollTop = this.$scrollElement.scrollTop() + this.options.offset + var scrollHeight = this.getScrollHeight() + var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height() + var offsets = this.offsets + var targets = this.targets + var activeTarget = this.activeTarget + var i + + if (this.scrollHeight != scrollHeight) { + this.refresh() + } + + if (scrollTop >= maxScroll) { + return activeTarget != (i = targets[targets.length - 1]) && this.activate(i) + } + + if (activeTarget && scrollTop < offsets[0]) { + this.activeTarget = null + return this.clear() + } + + for (i = offsets.length; i--;) { + activeTarget != targets[i] + && scrollTop >= offsets[i] + && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1]) + && this.activate(targets[i]) + } + } + + ScrollSpy.prototype.activate = function (target) { + this.activeTarget = target + + this.clear() + + var selector = this.selector + + '[data-target="' + target + '"],' + + this.selector + '[href="' + target + '"]' + + var active = $(selector) + .parents('li') + .addClass('active') + + if (active.parent('.dropdown-menu').length) { + active = active + .closest('li.dropdown') + .addClass('active') + } + + active.trigger('activate.bs.scrollspy') + } + + ScrollSpy.prototype.clear = function () { + $(this.selector) + .parentsUntil(this.options.target, '.active') + .removeClass('active') + } + + + // SCROLLSPY PLUGIN DEFINITION + // =========================== + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.scrollspy') + var options = typeof option == 'object' && option + + if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options))) + if (typeof option == 'string') data[option]() + }) + } + + var old = $.fn.scrollspy + + $.fn.scrollspy = Plugin + $.fn.scrollspy.Constructor = ScrollSpy + + + // SCROLLSPY NO CONFLICT + // ===================== + + $.fn.scrollspy.noConflict = function () { + $.fn.scrollspy = old + return this + } + + + // SCROLLSPY DATA-API + // ================== + + $(window).on('load.bs.scrollspy.data-api', function () { + $('[data-spy="scroll"]').each(function () { + var $spy = $(this) + Plugin.call($spy, $spy.data()) + }) + }) + +}(jQuery); diff --git a/apache-tapestry/src/main/webapp/mybootstrap/js/tab.js b/apache-tapestry/src/main/webapp/mybootstrap/js/tab.js new file mode 100644 index 0000000000..935d5bc803 --- /dev/null +++ b/apache-tapestry/src/main/webapp/mybootstrap/js/tab.js @@ -0,0 +1,153 @@ +/* ======================================================================== + * Bootstrap: tab.js v3.3.4 + * http://getbootstrap.com/javascript/#tabs + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // TAB CLASS DEFINITION + // ==================== + + var Tab = function (element) { + this.element = $(element) + } + + Tab.VERSION = '3.3.4' + + Tab.TRANSITION_DURATION = 150 + + Tab.prototype.show = function () { + var $this = this.element + var $ul = $this.closest('ul:not(.dropdown-menu)') + var selector = $this.data('target') + + if (!selector) { + selector = $this.attr('href') + selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 + } + + if ($this.parent('li').hasClass('active')) return + + var $previous = $ul.find('.active:last a') + var hideEvent = $.Event('hide.bs.tab', { + relatedTarget: $this[0] + }) + var showEvent = $.Event('show.bs.tab', { + relatedTarget: $previous[0] + }) + + $previous.trigger(hideEvent) + $this.trigger(showEvent) + + if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return + + var $target = $(selector) + + this.activate($this.closest('li'), $ul) + this.activate($target, $target.parent(), function () { + $previous.trigger({ + type: 'hidden.bs.tab', + relatedTarget: $this[0] + }) + $this.trigger({ + type: 'shown.bs.tab', + relatedTarget: $previous[0] + }) + }) + } + + Tab.prototype.activate = function (element, container, callback) { + var $active = container.find('> .active') + var transition = callback + && $.support.transition + && (($active.length && $active.hasClass('fade')) || !!container.find('> .fade').length) + + function next() { + $active + .removeClass('active') + .find('> .dropdown-menu > .active') + .removeClass('active') + .end() + .find('[data-toggle="tab"]') + .attr('aria-expanded', false) + + element + .addClass('active') + .find('[data-toggle="tab"]') + .attr('aria-expanded', true) + + if (transition) { + element[0].offsetWidth // reflow for transition + element.addClass('in') + } else { + element.removeClass('fade') + } + + if (element.parent('.dropdown-menu').length) { + element + .closest('li.dropdown') + .addClass('active') + .end() + .find('[data-toggle="tab"]') + .attr('aria-expanded', true) + } + + callback && callback() + } + + $active.length && transition ? + $active + .one('bsTransitionEnd', next) + .emulateTransitionEnd(Tab.TRANSITION_DURATION) : + next() + + $active.removeClass('in') + } + + + // TAB PLUGIN DEFINITION + // ===================== + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.tab') + + if (!data) $this.data('bs.tab', (data = new Tab(this))) + if (typeof option == 'string') data[option]() + }) + } + + var old = $.fn.tab + + $.fn.tab = Plugin + $.fn.tab.Constructor = Tab + + + // TAB NO CONFLICT + // =============== + + $.fn.tab.noConflict = function () { + $.fn.tab = old + return this + } + + + // TAB DATA-API + // ============ + + var clickHandler = function (e) { + e.preventDefault() + Plugin.call($(this), 'show') + } + + $(document) + .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler) + .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler) + +}(jQuery); diff --git a/apache-tapestry/src/main/webapp/mybootstrap/js/tooltip.js b/apache-tapestry/src/main/webapp/mybootstrap/js/tooltip.js new file mode 100644 index 0000000000..27367880f7 --- /dev/null +++ b/apache-tapestry/src/main/webapp/mybootstrap/js/tooltip.js @@ -0,0 +1,476 @@ +/* ======================================================================== + * Bootstrap: tooltip.js v3.3.4 + * http://getbootstrap.com/javascript/#tooltip + * Inspired by the original jQuery.tipsy by Jason Frame + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // TOOLTIP PUBLIC CLASS DEFINITION + // =============================== + + var Tooltip = function (element, options) { + this.type = null + this.options = null + this.enabled = null + this.timeout = null + this.hoverState = null + this.$element = null + + this.init('tooltip', element, options) + } + + Tooltip.VERSION = '3.3.4' + + Tooltip.TRANSITION_DURATION = 150 + + Tooltip.DEFAULTS = { + animation: true, + placement: 'top', + selector: false, + template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>', + trigger: 'hover focus', + title: '', + delay: 0, + html: false, + container: false, + viewport: { + selector: 'body', + padding: 0 + } + } + + Tooltip.prototype.init = function (type, element, options) { + this.enabled = true + this.type = type + this.$element = $(element) + this.options = this.getOptions(options) + this.$viewport = this.options.viewport && $(this.options.viewport.selector || this.options.viewport) + + if (this.$element[0] instanceof document.constructor && !this.options.selector) { + throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!') + } + + var triggers = this.options.trigger.split(' ') + + for (var i = triggers.length; i--;) { + var trigger = triggers[i] + + if (trigger == 'click') { + this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) + } else if (trigger != 'manual') { + var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin' + var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout' + + this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) + this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) + } + } + + this.options.selector ? + (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : + this.fixTitle() + } + + Tooltip.prototype.getDefaults = function () { + return Tooltip.DEFAULTS + } + + Tooltip.prototype.getOptions = function (options) { + options = $.extend({}, this.getDefaults(), this.$element.data(), options) + + if (options.delay && typeof options.delay == 'number') { + options.delay = { + show: options.delay, + hide: options.delay + } + } + + return options + } + + Tooltip.prototype.getDelegateOptions = function () { + var options = {} + var defaults = this.getDefaults() + + this._options && $.each(this._options, function (key, value) { + if (defaults[key] != value) options[key] = value + }) + + return options + } + + Tooltip.prototype.enter = function (obj) { + var self = obj instanceof this.constructor ? + obj : $(obj.currentTarget).data('bs.' + this.type) + + if (self && self.$tip && self.$tip.is(':visible')) { + self.hoverState = 'in' + return + } + + if (!self) { + self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) + $(obj.currentTarget).data('bs.' + this.type, self) + } + + clearTimeout(self.timeout) + + self.hoverState = 'in' + + if (!self.options.delay || !self.options.delay.show) return self.show() + + self.timeout = setTimeout(function () { + if (self.hoverState == 'in') self.show() + }, self.options.delay.show) + } + + Tooltip.prototype.leave = function (obj) { + var self = obj instanceof this.constructor ? + obj : $(obj.currentTarget).data('bs.' + this.type) + + if (!self) { + self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) + $(obj.currentTarget).data('bs.' + this.type, self) + } + + clearTimeout(self.timeout) + + self.hoverState = 'out' + + if (!self.options.delay || !self.options.delay.hide) return self.hide() + + self.timeout = setTimeout(function () { + if (self.hoverState == 'out') self.hide() + }, self.options.delay.hide) + } + + Tooltip.prototype.show = function () { + var e = $.Event('show.bs.' + this.type) + + if (this.hasContent() && this.enabled) { + this.$element.trigger(e) + + var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0]) + if (e.isDefaultPrevented() || !inDom) return + var that = this + + var $tip = this.tip() + + var tipId = this.getUID(this.type) + + this.setContent() + $tip.attr('id', tipId) + this.$element.attr('aria-describedby', tipId) + + if (this.options.animation) $tip.addClass('fade') + + var placement = typeof this.options.placement == 'function' ? + this.options.placement.call(this, $tip[0], this.$element[0]) : + this.options.placement + + var autoToken = /\s?auto?\s?/i + var autoPlace = autoToken.test(placement) + if (autoPlace) placement = placement.replace(autoToken, '') || 'top' + + $tip + .detach() + .css({ top: 0, left: 0, display: 'block' }) + .addClass(placement) + .data('bs.' + this.type, this) + + this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element) + + var pos = this.getPosition() + var actualWidth = $tip[0].offsetWidth + var actualHeight = $tip[0].offsetHeight + + if (autoPlace) { + var orgPlacement = placement + var $container = this.options.container ? $(this.options.container) : this.$element.parent() + var containerDim = this.getPosition($container) + + placement = placement == 'bottom' && pos.bottom + actualHeight > containerDim.bottom ? 'top' : + placement == 'top' && pos.top - actualHeight < containerDim.top ? 'bottom' : + placement == 'right' && pos.right + actualWidth > containerDim.width ? 'left' : + placement == 'left' && pos.left - actualWidth < containerDim.left ? 'right' : + placement + + $tip + .removeClass(orgPlacement) + .addClass(placement) + } + + var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight) + + this.applyPlacement(calculatedOffset, placement) + + var complete = function () { + var prevHoverState = that.hoverState + that.$element.trigger('shown.bs.' + that.type) + that.hoverState = null + + if (prevHoverState == 'out') that.leave(that) + } + + $.support.transition && this.$tip.hasClass('fade') ? + $tip + .one('bsTransitionEnd', complete) + .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : + complete() + } + } + + Tooltip.prototype.applyPlacement = function (offset, placement) { + var $tip = this.tip() + var width = $tip[0].offsetWidth + var height = $tip[0].offsetHeight + + // manually read margins because getBoundingClientRect includes difference + var marginTop = parseInt($tip.css('margin-top'), 10) + var marginLeft = parseInt($tip.css('margin-left'), 10) + + // we must check for NaN for ie 8/9 + if (isNaN(marginTop)) marginTop = 0 + if (isNaN(marginLeft)) marginLeft = 0 + + offset.top = offset.top + marginTop + offset.left = offset.left + marginLeft + + // $.fn.offset doesn't round pixel values + // so we use setOffset directly with our own function B-0 + $.offset.setOffset($tip[0], $.extend({ + using: function (props) { + $tip.css({ + top: Math.round(props.top), + left: Math.round(props.left) + }) + } + }, offset), 0) + + $tip.addClass('in') + + // check to see if placing tip in new offset caused the tip to resize itself + var actualWidth = $tip[0].offsetWidth + var actualHeight = $tip[0].offsetHeight + + if (placement == 'top' && actualHeight != height) { + offset.top = offset.top + height - actualHeight + } + + var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight) + + if (delta.left) offset.left += delta.left + else offset.top += delta.top + + var isVertical = /top|bottom/.test(placement) + var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight + var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight' + + $tip.offset(offset) + this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical) + } + + Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) { + this.arrow() + .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%') + .css(isVertical ? 'top' : 'left', '') + } + + Tooltip.prototype.setContent = function () { + var $tip = this.tip() + var title = this.getTitle() + + $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) + $tip.removeClass('fade in top bottom left right') + } + + Tooltip.prototype.hide = function (callback) { + var that = this + var $tip = $(this.$tip) + var e = $.Event('hide.bs.' + this.type) + + function complete() { + if (that.hoverState != 'in') $tip.detach() + that.$element + .removeAttr('aria-describedby') + .trigger('hidden.bs.' + that.type) + callback && callback() + } + + this.$element.trigger(e) + + if (e.isDefaultPrevented()) return + + $tip.removeClass('in') + + $.support.transition && $tip.hasClass('fade') ? + $tip + .one('bsTransitionEnd', complete) + .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : + complete() + + this.hoverState = null + + return this + } + + Tooltip.prototype.fixTitle = function () { + var $e = this.$element + if ($e.attr('title') || typeof ($e.attr('data-original-title')) != 'string') { + $e.attr('data-original-title', $e.attr('title') || '').attr('title', '') + } + } + + Tooltip.prototype.hasContent = function () { + return this.getTitle() + } + + Tooltip.prototype.getPosition = function ($element) { + $element = $element || this.$element + + var el = $element[0] + var isBody = el.tagName == 'BODY' + + var elRect = el.getBoundingClientRect() + if (elRect.width == null) { + // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093 + elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top }) + } + var elOffset = isBody ? { top: 0, left: 0 } : $element.offset() + var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() } + var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null + + return $.extend({}, elRect, scroll, outerDims, elOffset) + } + + Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { + return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : + placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : + placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : + /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width } + + } + + Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) { + var delta = { top: 0, left: 0 } + if (!this.$viewport) return delta + + var viewportPadding = this.options.viewport && this.options.viewport.padding || 0 + var viewportDimensions = this.getPosition(this.$viewport) + + if (/right|left/.test(placement)) { + var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll + var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight + if (topEdgeOffset < viewportDimensions.top) { // top overflow + delta.top = viewportDimensions.top - topEdgeOffset + } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow + delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset + } + } else { + var leftEdgeOffset = pos.left - viewportPadding + var rightEdgeOffset = pos.left + viewportPadding + actualWidth + if (leftEdgeOffset < viewportDimensions.left) { // left overflow + delta.left = viewportDimensions.left - leftEdgeOffset + } else if (rightEdgeOffset > viewportDimensions.width) { // right overflow + delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset + } + } + + return delta + } + + Tooltip.prototype.getTitle = function () { + var title + var $e = this.$element + var o = this.options + + title = $e.attr('data-original-title') + || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) + + return title + } + + Tooltip.prototype.getUID = function (prefix) { + do prefix += ~~(Math.random() * 1000000) + while (document.getElementById(prefix)) + return prefix + } + + Tooltip.prototype.tip = function () { + return (this.$tip = this.$tip || $(this.options.template)) + } + + Tooltip.prototype.arrow = function () { + return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')) + } + + Tooltip.prototype.enable = function () { + this.enabled = true + } + + Tooltip.prototype.disable = function () { + this.enabled = false + } + + Tooltip.prototype.toggleEnabled = function () { + this.enabled = !this.enabled + } + + Tooltip.prototype.toggle = function (e) { + var self = this + if (e) { + self = $(e.currentTarget).data('bs.' + this.type) + if (!self) { + self = new this.constructor(e.currentTarget, this.getDelegateOptions()) + $(e.currentTarget).data('bs.' + this.type, self) + } + } + + self.tip().hasClass('in') ? self.leave(self) : self.enter(self) + } + + Tooltip.prototype.destroy = function () { + var that = this + clearTimeout(this.timeout) + this.hide(function () { + that.$element.off('.' + that.type).removeData('bs.' + that.type) + }) + } + + + // TOOLTIP PLUGIN DEFINITION + // ========================= + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.tooltip') + var options = typeof option == 'object' && option + + if (!data && /destroy|hide/.test(option)) return + if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options))) + if (typeof option == 'string') data[option]() + }) + } + + var old = $.fn.tooltip + + $.fn.tooltip = Plugin + $.fn.tooltip.Constructor = Tooltip + + + // TOOLTIP NO CONFLICT + // =================== + + $.fn.tooltip.noConflict = function () { + $.fn.tooltip = old + return this + } + +}(jQuery); diff --git a/apache-tapestry/src/main/webapp/mybootstrap/js/transition.js b/apache-tapestry/src/main/webapp/mybootstrap/js/transition.js new file mode 100644 index 0000000000..f23e6bdfe4 --- /dev/null +++ b/apache-tapestry/src/main/webapp/mybootstrap/js/transition.js @@ -0,0 +1,59 @@ +/* ======================================================================== + * Bootstrap: transition.js v3.3.4 + * http://getbootstrap.com/javascript/#transitions + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/) + // ============================================================ + + function transitionEnd() { + var el = document.createElement('bootstrap') + + var transEndEventNames = { + WebkitTransition : 'webkitTransitionEnd', + MozTransition : 'transitionend', + OTransition : 'oTransitionEnd otransitionend', + transition : 'transitionend' + } + + for (var name in transEndEventNames) { + if (el.style[name] !== undefined) { + return { end: transEndEventNames[name] } + } + } + + return false // explicit for ie8 ( ._.) + } + + // http://blog.alexmaccaw.com/css-transitions + $.fn.emulateTransitionEnd = function (duration) { + var called = false + var $el = this + $(this).one('bsTransitionEnd', function () { called = true }) + var callback = function () { if (!called) $($el).trigger($.support.transition.end) } + setTimeout(callback, duration) + return this + } + + $(function () { + $.support.transition = transitionEnd() + + if (!$.support.transition) return + + $.event.special.bsTransitionEnd = { + bindType: $.support.transition.end, + delegateType: $.support.transition.end, + handle: function (e) { + if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments) + } + } + }) + +}(jQuery); diff --git a/apache-tapestry/src/site/apt/index.apt b/apache-tapestry/src/site/apt/index.apt new file mode 100644 index 0000000000..0e22d10c32 --- /dev/null +++ b/apache-tapestry/src/site/apt/index.apt @@ -0,0 +1,9 @@ + ---- + Module com.baeldung:apache-tapestry + ---- + +com.baeldung:apache-tapestry Documentation + + This is where you can start to document your module. + + Create new files in the Maven APT format, and update the site.xml file to point to them. diff --git a/apache-tapestry/src/site/site.xml b/apache-tapestry/src/site/site.xml new file mode 100644 index 0000000000..774861b479 --- /dev/null +++ b/apache-tapestry/src/site/site.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<project name="Generated site for apache-tapestry"> + + <publishDate format="dd MMM yyyy"/> + + <version/> + + <body> + + <menu name="apache-tapestry Project"> + <item name="About" href="index.html"/> + </menu> + + <menu ref="reports"/> + + </body> +</project> diff --git a/apache-tapestry/src/test/conf/testng.xml b/apache-tapestry/src/test/conf/testng.xml new file mode 100644 index 0000000000..c1c01e64aa --- /dev/null +++ b/apache-tapestry/src/test/conf/testng.xml @@ -0,0 +1,8 @@ +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> +<suite name="apache-tapestry Application Test Suite" annotations="1.5"> + <test name="Unit Tests"> + <packages> + <package name="com.baeldung.tapestry"/> + </packages> + </test> +</suite> diff --git a/apache-tapestry/src/test/conf/webdefault.xml b/apache-tapestry/src/test/conf/webdefault.xml new file mode 100644 index 0000000000..c587ac7a5d --- /dev/null +++ b/apache-tapestry/src/test/conf/webdefault.xml @@ -0,0 +1,278 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<web-app + xmlns="http://java.sun.com/xml/ns/j2ee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" + version="2.4"> + + <description> + Default web.xml file. + This file is applied to a Web application before it's own WEB_INF/web.xml file + </description> + + + <!-- ==================================================================== --> + <!-- Context params to control Session Cookies --> + <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> + <!-- UNCOMMENT TO ACTIVATE + <context-param> + <param-name>org.mortbay.jetty.servlet.SessionDomain</param-name> + <param-value>127.0.0.1</param-value> + </context-param> + + <context-param> + <param-name>org.mortbay.jetty.servlet.SessionPath</param-name> + <param-value>/</param-value> + </context-param> + + <context-param> + <param-name>org.mortbay.jetty.servlet.MaxAge</param-name> + <param-value>-1</param-value> + </context-param> + --> + + + <!-- ==================================================================== --> + <!-- The default servlet. --> + <!-- This servlet, normally mapped to /, provides the handling for static --> + <!-- content, OPTIONS and TRACE methods for the context. --> + <!-- The following initParameters are supported: --> + <!-- --> + <!-- acceptRanges If true, range requests and responses are --> + <!-- supported --> + <!-- --> + <!-- dirAllowed If true, directory listings are returned if no --> + <!-- welcome file is found. Else 403 Forbidden. --> + <!-- --> + <!-- putAllowed If true, the PUT method is allowed --> + <!-- --> + <!-- delAllowed If true, the DELETE method is allowed --> + <!-- --> + <!-- redirectWelcome If true, redirect welcome file requests --> + <!-- else use request dispatcher forwards --> + <!-- --> + <!-- minGzipLength If set to a positive integer, then static content --> + <!-- larger than this will be served as gzip content --> + <!-- encoded if a matching resource is found ending --> + <!-- with ".gz" --> + <!-- --> + <!-- resoureBase Can be set to replace the context resource base --> + <!-- --> + <!-- relativeResourceBase --> + <!-- Set with a pathname relative to the base of the --> + <!-- servlet context root. Useful for only serving --> + <!-- static content from only specific subdirectories. --> + <!-- --> + <!-- The MOVE method is allowed if PUT and DELETE are allowed --> + <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> + <servlet> + <servlet-name>default</servlet-name> + <servlet-class>org.mortbay.jetty.servlet.Default</servlet-class> + <init-param> + <param-name>acceptRanges</param-name> + <param-value>true</param-value> + </init-param> + <init-param> + <param-name>dirAllowed</param-name> + <param-value>true</param-value> + </init-param> + <init-param> + <param-name>putAllowed</param-name> + <param-value>false</param-value> + </init-param> + <init-param> + <param-name>delAllowed</param-name> + <param-value>false</param-value> + </init-param> + <init-param> + <param-name>redirectWelcome</param-name> + <param-value>false</param-value> + </init-param> + <init-param> + <param-name>minGzipLength</param-name> + <param-value>8192</param-value> + </init-param> + <load-on-startup>0</load-on-startup> + </servlet> + + + <servlet-mapping> + <servlet-name>default</servlet-name> + <url-pattern>/</url-pattern> + </servlet-mapping> + + <!-- ==================================================================== --> + <session-config> + <session-timeout>30</session-timeout> + </session-config> + + + <!-- ==================================================================== --> + <welcome-file-list> + <welcome-file>index.html</welcome-file> + <welcome-file>index.htm</welcome-file> + </welcome-file-list> + + <!-- ==================================================================== --> + <locale-encoding-mapping-list> + <locale-encoding-mapping> + <locale>ar</locale> + <encoding>ISO-8859-6</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>be</locale> + <encoding>ISO-8859-5</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>bg</locale> + <encoding>ISO-8859-5</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>ca</locale> + <encoding>ISO-8859-1</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>cs</locale> + <encoding>ISO-8859-2</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>da</locale> + <encoding>ISO-8859-1</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>de</locale> + <encoding>ISO-8859-1</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>el</locale> + <encoding>ISO-8859-7</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>en</locale> + <encoding>ISO-8859-1</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>es</locale> + <encoding>ISO-8859-1</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>et</locale> + <encoding>ISO-8859-1</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>fi</locale> + <encoding>ISO-8859-1</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>fr</locale> + <encoding>ISO-8859-1</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>hr</locale> + <encoding>ISO-8859-2</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>hu</locale> + <encoding>ISO-8859-2</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>is</locale> + <encoding>ISO-8859-1</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>it</locale> + <encoding>ISO-8859-1</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>iw</locale> + <encoding>ISO-8859-8</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>ja</locale> + <encoding>Shift_JIS</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>ko</locale> + <encoding>EUC-KR</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>lt</locale> + <encoding>ISO-8859-2</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>lv</locale> + <encoding>ISO-8859-2</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>mk</locale> + <encoding>ISO-8859-5</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>nl</locale> + <encoding>ISO-8859-1</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>no</locale> + <encoding>ISO-8859-1</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>pl</locale> + <encoding>ISO-8859-2</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>pt</locale> + <encoding>ISO-8859-1</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>ro</locale> + <encoding>ISO-8859-2</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>ru</locale> + <encoding>ISO-8859-5</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>sh</locale> + <encoding>ISO-8859-5</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>sk</locale> + <encoding>ISO-8859-2</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>sl</locale> + <encoding>ISO-8859-2</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>sq</locale> + <encoding>ISO-8859-2</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>sr</locale> + <encoding>ISO-8859-5</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>sv</locale> + <encoding>ISO-8859-1</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>tr</locale> + <encoding>ISO-8859-9</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>uk</locale> + <encoding>ISO-8859-5</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>zh</locale> + <encoding>GB2312</encoding> + </locale-encoding-mapping> + <locale-encoding-mapping> + <locale>zh_TW</locale> + <encoding>Big5</encoding> + </locale-encoding-mapping> + </locale-encoding-mapping-list> + + +</web-app> + diff --git a/apache-thrift/pom.xml b/apache-thrift/pom.xml index ab54fc2cef..409467ccc5 100644 --- a/apache-thrift/pom.xml +++ b/apache-thrift/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>apache-thrift</artifactId> <version>0.0.1-SNAPSHOT</version> diff --git a/apache-tika/pom.xml b/apache-tika/pom.xml index 0399914a5f..24c904aec3 100644 --- a/apache-tika/pom.xml +++ b/apache-tika/pom.xml @@ -1,10 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>apache-tika</artifactId> <version>0.0.1-SNAPSHOT</version> <name>apache-tika</name> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> diff --git a/apache-velocity/pom.xml b/apache-velocity/pom.xml index b370b11cc1..61d7e74498 100644 --- a/apache-velocity/pom.xml +++ b/apache-velocity/pom.xml @@ -1,8 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> - <version>0.1-SNAPSHOT</version> <artifactId>apache-velocity</artifactId> + <version>0.1-SNAPSHOT</version> <name>apache-velocity</name> <packaging>war</packaging> diff --git a/apache-zookeeper/pom.xml b/apache-zookeeper/pom.xml index 53e4217358..0bab6cded6 100644 --- a/apache-zookeeper/pom.xml +++ b/apache-zookeeper/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>apache-zookeeper</artifactId> <version>0.0.1-SNAPSHOT</version> diff --git a/asciidoctor/pom.xml b/asciidoctor/pom.xml index 42ee544eb0..5421df91be 100644 --- a/asciidoctor/pom.xml +++ b/asciidoctor/pom.xml @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>asciidoctor</artifactId> <name>asciidoctor</name> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> @@ -63,7 +63,6 @@ <properties> <asciidoctor-maven-plugin.version>1.5.6</asciidoctor-maven-plugin.version> <asciidoctorj.version>1.5.6</asciidoctorj.version> - <asciidoctorj-pdf.version>1.5.0-alpha.15</asciidoctorj-pdf.version> <asciidoctorj-pdf.plugin.version>1.5.0-alpha.15</asciidoctorj-pdf.plugin.version> </properties> diff --git a/asm/pom.xml b/asm/pom.xml index e56438c808..77dbab964c 100644 --- a/asm/pom.xml +++ b/asm/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.examples</groupId> <artifactId>asm</artifactId> diff --git a/atomix/pom.xml b/atomix/pom.xml index e50c1d867f..7821ef26d7 100644 --- a/atomix/pom.xml +++ b/atomix/pom.xml @@ -1,11 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.atomix.io</groupId> <artifactId>atomix</artifactId> <version>0.0.1-SNAPSHOT</version> <name>atomix</name> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> diff --git a/aws-lambda/pom.xml b/aws-lambda/pom.xml index 1f3c31f87c..12be77baef 100644 --- a/aws-lambda/pom.xml +++ b/aws-lambda/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>aws-lambda</artifactId> <version>0.1.0-SNAPSHOT</version> @@ -8,13 +8,12 @@ <packaging>jar</packaging> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> <dependencies> - <dependency> <groupId>com.amazonaws</groupId> <artifactId>aws-java-sdk-dynamodb</artifactId> @@ -63,7 +62,7 @@ <version>${json-simple.version}</version> </dependency> </dependencies> - + <build> <plugins> <plugin> @@ -84,7 +83,7 @@ </plugin> </plugins> </build> - + <properties> <json-simple.version>1.1.1</json-simple.version> <commons-io.version>2.5</commons-io.version> @@ -94,5 +93,5 @@ <aws-java-sdk.version>1.11.241</aws-java-sdk.version> <maven-shade-plugin.version>3.0.0</maven-shade-plugin.version> </properties> - + </project> \ No newline at end of file diff --git a/aws-reactive/images/rective-upload.png b/aws-reactive/images/rective-upload.png new file mode 100644 index 0000000000..ebe5a7d69c Binary files /dev/null and b/aws-reactive/images/rective-upload.png differ diff --git a/aws-reactive/images/rective-upload.txt b/aws-reactive/images/rective-upload.txt new file mode 100644 index 0000000000..fb5177544e --- /dev/null +++ b/aws-reactive/images/rective-upload.txt @@ -0,0 +1,29 @@ +participant "Client 1" as C1 +participant "Client 2" as C2 +participant "Reactive Web App" as RWS +participant "Backend" as S3 +C1 -> RWS: POST +activate C1 +activate RWS +RWS -> S3: Async POST +deactivate RWS +C2 -> RWS: POST +activate C2 +activate RWS +RWS -> S3: Async POST +deactivate RWS +S3 --> RWS: Async Result +activate RWS +RWS -->C2: Result +deactivate RWS +deactivate C2 +// First file EOF +S3 --> RWS: Async Result +activate RWS +RWS -->C1: Result +deactivate RWS +deactivate C1 + + + + diff --git a/aws-reactive/images/thread-per-client.png b/aws-reactive/images/thread-per-client.png new file mode 100644 index 0000000000..dc75839aa4 Binary files /dev/null and b/aws-reactive/images/thread-per-client.png differ diff --git a/aws-reactive/images/thread-per-client.txt b/aws-reactive/images/thread-per-client.txt new file mode 100644 index 0000000000..a7009e318c --- /dev/null +++ b/aws-reactive/images/thread-per-client.txt @@ -0,0 +1,28 @@ +participant Client 1 +participant Client 2 +participant Controller +participant Backend +Client 1-> Controller: POST Data +activate Client 1 +activate Controller +Controller -> Backend: Save Data +activate Backend +note left of Controller #yellow: Controller blocked\nuntil result received +Backend --> Controller: Result +deactivate Backend +Controller --> Client 1: Result +deactivate Client 1 +deactivate Controller +// 2nd Upload +Client 2-> Controller: POST Data +activate Client 2 +activate Controller +Controller -> Backend: Save Data +activate Backend +note left of Controller #yellow: Controller blocket\nuntil result received +Backend --> Controller: Result +deactivate Backend +Controller --> Client 2: Result +deactivate Controller +deactivate Client 2 + diff --git a/aws-reactive/pom.xml b/aws-reactive/pom.xml new file mode 100644 index 0000000000..b3fcb24902 --- /dev/null +++ b/aws-reactive/pom.xml @@ -0,0 +1,105 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> + + <artifactId>aws-reactive</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>aws-reactive</name> + <description>AWS Reactive Sample</description> + + <properties> + <java.version>1.8</java.version> + </properties> + + <dependencyManagement> + <dependencies> + + <dependency> + <!-- Import dependency management from Spring Boot --> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-dependencies</artifactId> + <version>2.2.1.RELEASE</version> + <type>pom</type> + <scope>import</scope> + </dependency> + + <dependency> + <groupId>software.amazon.awssdk</groupId> + <artifactId>bom</artifactId> + <version>2.10.27</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-webflux</artifactId> + </dependency> + + <dependency> + <groupId>software.amazon.awssdk</groupId> + <artifactId>s3</artifactId> + <scope>compile</scope> + </dependency> + + <dependency> + <artifactId>netty-nio-client</artifactId> + <groupId>software.amazon.awssdk</groupId> + <scope>compile</scope> + </dependency> + + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>org.junit.vintage</groupId> + <artifactId>junit-vintage-engine</artifactId> + </exclusion> + </exclusions> + </dependency> + + + <dependency> + <groupId>io.projectreactor</groupId> + <artifactId>reactor-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-devtools</artifactId> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-configuration-processor</artifactId> + </dependency> + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + </plugins> + </build> + +</project> diff --git a/aws-reactive/src/main/java/com/baeldung/aws/reactive/s3/DownloadFailedException.java b/aws-reactive/src/main/java/com/baeldung/aws/reactive/s3/DownloadFailedException.java new file mode 100644 index 0000000000..a88e1ab010 --- /dev/null +++ b/aws-reactive/src/main/java/com/baeldung/aws/reactive/s3/DownloadFailedException.java @@ -0,0 +1,32 @@ +package com.baeldung.aws.reactive.s3; + +import java.util.Optional; + +import org.springframework.http.HttpStatus; + +import lombok.AllArgsConstructor; +import software.amazon.awssdk.core.SdkResponse; +import software.amazon.awssdk.http.SdkHttpResponse; + +@AllArgsConstructor +public class DownloadFailedException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + private int statusCode; + private Optional<String> statusText; + + public DownloadFailedException(SdkResponse response) { + + SdkHttpResponse httpResponse = response.sdkHttpResponse(); + if (httpResponse != null) { + this.statusCode = httpResponse.statusCode(); + this.statusText = httpResponse.statusText(); + } else { + this.statusCode = HttpStatus.INTERNAL_SERVER_ERROR.value(); + this.statusText = Optional.of("UNKNOWN"); + } + + } + +} diff --git a/aws-reactive/src/main/java/com/baeldung/aws/reactive/s3/DownloadResource.java b/aws-reactive/src/main/java/com/baeldung/aws/reactive/s3/DownloadResource.java new file mode 100644 index 0000000000..838ada1685 --- /dev/null +++ b/aws-reactive/src/main/java/com/baeldung/aws/reactive/s3/DownloadResource.java @@ -0,0 +1,144 @@ +/** + * + */ +package com.baeldung.aws.reactive.s3; + +import java.io.InputStream; +import java.nio.ByteBuffer; +import java.util.Map; +import java.util.Map.Entry; +import java.util.concurrent.CompletableFuture; + +import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.core.io.buffer.DataBufferUtils; +import org.springframework.http.HttpHeaders; +import org.springframework.http.ResponseEntity; +import org.springframework.http.ResponseEntity.BodyBuilder; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import lombok.extern.slf4j.Slf4j; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import software.amazon.awssdk.core.ResponseBytes; +import software.amazon.awssdk.core.SdkResponse; +import software.amazon.awssdk.core.async.AsyncResponseTransformer; +import software.amazon.awssdk.core.async.SdkPublisher; +import software.amazon.awssdk.core.internal.async.ByteArrayAsyncResponseTransformer; +import software.amazon.awssdk.http.SdkHttpResponse; +import software.amazon.awssdk.services.s3.S3AsyncClient; +import software.amazon.awssdk.services.s3.model.GetObjectRequest; +import software.amazon.awssdk.services.s3.model.GetObjectResponse; + +/** + * @author Philippe + * + */ +@RestController +@RequestMapping("/inbox") +@Slf4j +public class DownloadResource { + + + private final S3AsyncClient s3client; + private final S3ClientConfigurarionProperties s3config; + + public DownloadResource(S3AsyncClient s3client, S3ClientConfigurarionProperties s3config) { + this.s3client = s3client; + this.s3config = s3config; + } + + + @GetMapping(path="/{filekey}") + public Mono<ResponseEntity<Flux<ByteBuffer>>> downloadFile(@PathVariable("filekey") String filekey) { + + GetObjectRequest request = GetObjectRequest.builder() + .bucket(s3config.getBucket()) + .key(filekey) + .build(); + + return Mono.fromFuture(s3client.getObject(request,new FluxResponseProvider())) + .map( (response) -> { + checkResult(response.sdkResponse); + String filename = getMetadataItem(response.sdkResponse,"filename",filekey); + + log.info("[I65] filename={}, length={}",filename, response.sdkResponse.contentLength() ); + + return ResponseEntity.ok() + .header(HttpHeaders.CONTENT_TYPE, response.sdkResponse.contentType()) + .header(HttpHeaders.CONTENT_LENGTH, Long.toString(response.sdkResponse.contentLength())) + .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + filename + "\"") + .body(response.flux); + }); + } + + /** + * Lookup a metadata key in a case-insensitive way. + * @param sdkResponse + * @param key + * @param defaultValue + * @return + */ + private String getMetadataItem(GetObjectResponse sdkResponse, String key, String defaultValue) { + for( Entry<String, String> entry : sdkResponse.metadata().entrySet()) { + if ( entry.getKey().equalsIgnoreCase(key)) { + return entry.getValue(); + } + } + return defaultValue; + } + + + // Helper used to check return codes from an API call + private static void checkResult(GetObjectResponse response) { + SdkHttpResponse sdkResponse = response.sdkHttpResponse(); + if ( sdkResponse != null && sdkResponse.isSuccessful()) { + return; + } + + throw new DownloadFailedException(response); + } + + + static class FluxResponseProvider implements AsyncResponseTransformer<GetObjectResponse,FluxResponse> { + + private FluxResponse response; + + @Override + public CompletableFuture<FluxResponse> prepare() { + response = new FluxResponse(); + return response.cf; + } + + @Override + public void onResponse(GetObjectResponse sdkResponse) { + this.response.sdkResponse = sdkResponse; + } + + @Override + public void onStream(SdkPublisher<ByteBuffer> publisher) { + response.flux = Flux.from(publisher); + response.cf.complete(response); + } + + @Override + public void exceptionOccurred(Throwable error) { + response.cf.completeExceptionally(error); + } + + } + + /** + * Holds the API response and stream + * @author Philippe + */ + static class FluxResponse { + + final CompletableFuture<FluxResponse> cf = new CompletableFuture<>(); + GetObjectResponse sdkResponse; + Flux<ByteBuffer> flux; + } + +} diff --git a/aws-reactive/src/main/java/com/baeldung/aws/reactive/s3/ReactiveS3Application.java b/aws-reactive/src/main/java/com/baeldung/aws/reactive/s3/ReactiveS3Application.java new file mode 100644 index 0000000000..b90c085fc9 --- /dev/null +++ b/aws-reactive/src/main/java/com/baeldung/aws/reactive/s3/ReactiveS3Application.java @@ -0,0 +1,13 @@ +package com.baeldung.aws.reactive.s3; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class ReactiveS3Application { + + public static void main(String[] args) { + SpringApplication.run(ReactiveS3Application.class, args); + } + +} diff --git a/aws-reactive/src/main/java/com/baeldung/aws/reactive/s3/S3ClientConfigurarionProperties.java b/aws-reactive/src/main/java/com/baeldung/aws/reactive/s3/S3ClientConfigurarionProperties.java new file mode 100644 index 0000000000..b30bc1e5fa --- /dev/null +++ b/aws-reactive/src/main/java/com/baeldung/aws/reactive/s3/S3ClientConfigurarionProperties.java @@ -0,0 +1,28 @@ +package com.baeldung.aws.reactive.s3; + +import java.net.URI; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +import lombok.Data; +import software.amazon.awssdk.regions.Region; + +@ConfigurationProperties(prefix = "aws.s3") +@Data +public class S3ClientConfigurarionProperties { + + private Region region = Region.US_EAST_1; + private URI endpoint = null; + + private String accessKeyId; + private String secretAccessKey; + + // Bucket name we'll be using as our backend storage + private String bucket; + + // AWS S3 requires that file parts must have at least 5MB, except + // for the last part. This may change for other S3-compatible services, so let't + // define a configuration property for that + private int multipartMinPartSize = 5*1024*1024; + +} diff --git a/aws-reactive/src/main/java/com/baeldung/aws/reactive/s3/S3ClientConfiguration.java b/aws-reactive/src/main/java/com/baeldung/aws/reactive/s3/S3ClientConfiguration.java new file mode 100644 index 0000000000..906ea088a1 --- /dev/null +++ b/aws-reactive/src/main/java/com/baeldung/aws/reactive/s3/S3ClientConfiguration.java @@ -0,0 +1,65 @@ +package com.baeldung.aws.reactive.s3; + +import java.time.Duration; + +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; +import software.amazon.awssdk.auth.credentials.AwsCredentials; +import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider; +import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider; +import software.amazon.awssdk.http.async.SdkAsyncHttpClient; +import software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient; +import software.amazon.awssdk.services.s3.S3AsyncClient; +import software.amazon.awssdk.services.s3.S3AsyncClientBuilder; +import software.amazon.awssdk.services.s3.S3Configuration; +import software.amazon.awssdk.utils.StringUtils; + +@Configuration +@EnableConfigurationProperties(S3ClientConfigurarionProperties.class) +public class S3ClientConfiguration { + + @Bean + public S3AsyncClient s3client(S3ClientConfigurarionProperties s3props, AwsCredentialsProvider credentialsProvider) { + + SdkAsyncHttpClient httpClient = NettyNioAsyncHttpClient.builder() + .writeTimeout(Duration.ZERO) + .maxConcurrency(64) + .build(); + + S3Configuration serviceConfiguration = S3Configuration.builder() + .checksumValidationEnabled(false) + .chunkedEncodingEnabled(true) + .build(); + + S3AsyncClientBuilder b = S3AsyncClient.builder() + .httpClient(httpClient) + .region(s3props.getRegion()) + .credentialsProvider(credentialsProvider) + .serviceConfiguration(serviceConfiguration); + + if (s3props.getEndpoint() != null) { + b = b.endpointOverride(s3props.getEndpoint()); + } + + return b.build(); + } + + @Bean + public AwsCredentialsProvider awsCredentialsProvider(S3ClientConfigurarionProperties s3props) { + + if (StringUtils.isBlank(s3props.getAccessKeyId())) { + // Return default provider + return DefaultCredentialsProvider.create(); + } + else { + // Return custom credentials provider + return () -> { + AwsCredentials creds = AwsBasicCredentials.create(s3props.getAccessKeyId(), s3props.getSecretAccessKey()); + return creds; + }; + } + } +} diff --git a/aws-reactive/src/main/java/com/baeldung/aws/reactive/s3/UploadFailedException.java b/aws-reactive/src/main/java/com/baeldung/aws/reactive/s3/UploadFailedException.java new file mode 100644 index 0000000000..0cfebc85d2 --- /dev/null +++ b/aws-reactive/src/main/java/com/baeldung/aws/reactive/s3/UploadFailedException.java @@ -0,0 +1,32 @@ +package com.baeldung.aws.reactive.s3; + +import java.util.Optional; + +import org.springframework.http.HttpStatus; + +import lombok.AllArgsConstructor; +import software.amazon.awssdk.core.SdkResponse; +import software.amazon.awssdk.http.SdkHttpResponse; + +@AllArgsConstructor +public class UploadFailedException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + private int statusCode; + private Optional<String> statusText; + + public UploadFailedException(SdkResponse response) { + + SdkHttpResponse httpResponse = response.sdkHttpResponse(); + if (httpResponse != null) { + this.statusCode = httpResponse.statusCode(); + this.statusText = httpResponse.statusText(); + } else { + this.statusCode = HttpStatus.INTERNAL_SERVER_ERROR.value(); + this.statusText = Optional.of("UNKNOWN"); + } + + } + +} diff --git a/aws-reactive/src/main/java/com/baeldung/aws/reactive/s3/UploadResource.java b/aws-reactive/src/main/java/com/baeldung/aws/reactive/s3/UploadResource.java new file mode 100644 index 0000000000..fa7bf6a471 --- /dev/null +++ b/aws-reactive/src/main/java/com/baeldung/aws/reactive/s3/UploadResource.java @@ -0,0 +1,308 @@ +/** + * + */ +package com.baeldung.aws.reactive.s3; + +import java.io.File; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collector; +import java.util.stream.Collectors; + +import org.reactivestreams.Publisher; +import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.http.codec.multipart.FilePart; +import org.springframework.http.codec.multipart.Part; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import software.amazon.awssdk.core.SdkResponse; +import software.amazon.awssdk.core.async.AsyncRequestBody; +import software.amazon.awssdk.services.s3.S3AsyncClient; +import software.amazon.awssdk.services.s3.model.CompleteMultipartUploadRequest; +import software.amazon.awssdk.services.s3.model.CompleteMultipartUploadResponse; +import software.amazon.awssdk.services.s3.model.CompletedMultipartUpload; +import software.amazon.awssdk.services.s3.model.CompletedMultipartUpload.Builder; +import software.amazon.awssdk.services.s3.model.CompletedPart; +import software.amazon.awssdk.services.s3.model.CreateMultipartUploadRequest; +import software.amazon.awssdk.services.s3.model.CreateMultipartUploadResponse; +import software.amazon.awssdk.services.s3.model.PutObjectRequest; +import software.amazon.awssdk.services.s3.model.PutObjectResponse; +import software.amazon.awssdk.services.s3.model.UploadPartRequest; +import software.amazon.awssdk.services.s3.model.UploadPartResponse; + +/** + * @author Philippe + * + */ +@RestController +@RequestMapping("/inbox") +@Slf4j +public class UploadResource { + + private final S3AsyncClient s3client; + private final S3ClientConfigurarionProperties s3config; + + public UploadResource(S3AsyncClient s3client, S3ClientConfigurarionProperties s3config) { + this.s3client = s3client; + this.s3config = s3config; + } + + /** + * Standard file upload. + */ + @PostMapping + public Mono<ResponseEntity<UploadResult>> uploadHandler(@RequestHeader HttpHeaders headers, @RequestBody Flux<ByteBuffer> body) { + + long length = headers.getContentLength(); + if (length < 0) { + throw new UploadFailedException(HttpStatus.BAD_REQUEST.value(), Optional.of("required header missing: Content-Length")); + } + + String fileKey = UUID.randomUUID().toString(); + Map<String, String> metadata = new HashMap<String, String>(); + MediaType mediaType = headers.getContentType(); + + if (mediaType == null) { + mediaType = MediaType.APPLICATION_OCTET_STREAM; + } + + log.info("[I95] uploadHandler: mediaType{}, length={}", mediaType, length); + CompletableFuture<PutObjectResponse> future = s3client + .putObject(PutObjectRequest.builder() + .bucket(s3config.getBucket()) + .contentLength(length) + .key(fileKey.toString()) + .contentType(mediaType.toString()) + .metadata(metadata) + .build(), + AsyncRequestBody.fromPublisher(body)); + + return Mono.fromFuture(future) + .map((response) -> { + checkResult(response); + return ResponseEntity + .status(HttpStatus.CREATED) + .body(new UploadResult(HttpStatus.CREATED, new String[] {fileKey})); + }); + } + + + /** + * Multipart file upload + * @param bucket + * @param parts + * @param headers + * @return + */ + @RequestMapping(consumes = MediaType.MULTIPART_FORM_DATA_VALUE, method = {RequestMethod.POST, RequestMethod.PUT}) + public Mono<ResponseEntity<UploadResult>> multipartUploadHandler(@RequestHeader HttpHeaders headers, @RequestBody Flux<Part> parts ) { + + return parts + .ofType(FilePart.class) // We'll ignore other data for now + .flatMap((part) -> saveFile(headers, s3config.getBucket(), part)) + .collect(Collectors.toList()) + .map((keys) -> ResponseEntity.status(HttpStatus.CREATED) + .body(new UploadResult(HttpStatus.CREATED,keys))); + } + + + /** + * Save file using a multipart upload. This method does not require any temporary + * storage at the REST service + * @param headers + * @param bucket Bucket name + * @param part Uploaded file + * @return + */ + protected Mono<String> saveFile(HttpHeaders headers,String bucket, FilePart part) { + + // Generate a filekey for this upload + String filekey = UUID.randomUUID().toString(); + + log.info("[I137] saveFile: filekey={}, filename={}", filekey, part.filename()); + + // Gather metadata + Map<String, String> metadata = new HashMap<String, String>(); + String filename = part.filename(); + if ( filename == null ) { + filename = filekey; + } + + metadata.put("filename", filename); + + MediaType mt = part.headers().getContentType(); + if ( mt == null ) { + mt = MediaType.APPLICATION_OCTET_STREAM; + } + + // Create multipart upload request + CompletableFuture<CreateMultipartUploadResponse> uploadRequest = s3client + .createMultipartUpload(CreateMultipartUploadRequest.builder() + .contentType(mt.toString()) + .key(filekey) + .metadata(metadata) + .bucket(bucket) + .build()); + + // This variable will hold the upload state that we must keep + // around until all uploads complete + final UploadState uploadState = new UploadState(bucket,filekey); + + return Mono + .fromFuture(uploadRequest) + .flatMapMany((response) -> { + checkResult(response); + uploadState.uploadId = response.uploadId(); + log.info("[I183] uploadId={}", response.uploadId()); + return part.content(); + }) + .bufferUntil((buffer) -> { + uploadState.buffered += buffer.readableByteCount(); + if ( uploadState.buffered >= s3config.getMultipartMinPartSize() ) { + log.info("[I173] bufferUntil: returning true, bufferedBytes={}, partCounter={}, uploadId={}", uploadState.buffered, uploadState.partCounter, uploadState.uploadId); + uploadState.buffered = 0; + return true; + } + else { + return false; + } + }) + .map((buffers) -> concatBuffers(buffers)) + .flatMap((buffer) -> uploadPart(uploadState,buffer)) + .onBackpressureBuffer() + .reduce(uploadState,(state,completedPart) -> { + log.info("[I188] completed: partNumber={}, etag={}", completedPart.partNumber(), completedPart.eTag()); + state.completedParts.put(completedPart.partNumber(), completedPart); + return state; + }) + .flatMap((state) -> completeUpload(state)) + .map((response) -> { + checkResult(response); + return uploadState.filekey; + }); + } + + private static ByteBuffer concatBuffers(List<DataBuffer> buffers) { + log.info("[I198] creating BytBuffer from {} chunks", buffers.size()); + + int partSize = 0; + for( DataBuffer b : buffers) { + partSize += b.readableByteCount(); + } + + ByteBuffer partData = ByteBuffer.allocate(partSize); + buffers.forEach((buffer) -> { + partData.put(buffer.asByteBuffer()); + }); + + // Reset read pointer to first byte + partData.rewind(); + + log.info("[I208] partData: size={}", partData.capacity()); + return partData; + + } + + /** + * Upload a single file part to the requested bucket + * @param uploadState + * @param buffer + * @return + */ + private Mono<CompletedPart> uploadPart(UploadState uploadState, ByteBuffer buffer) { + final int partNumber = ++uploadState.partCounter; + log.info("[I218] uploadPart: partNumber={}, contentLength={}",partNumber, buffer.capacity()); + + CompletableFuture<UploadPartResponse> request = s3client.uploadPart(UploadPartRequest.builder() + .bucket(uploadState.bucket) + .key(uploadState.filekey) + .partNumber(partNumber) + .uploadId(uploadState.uploadId) + .contentLength((long) buffer.capacity()) + .build(), + AsyncRequestBody.fromPublisher(Mono.just(buffer))); + + return Mono + .fromFuture(request) + .map((uploadPartResult) -> { + checkResult(uploadPartResult); + log.info("[I230] uploadPart complete: part={}, etag={}",partNumber,uploadPartResult.eTag()); + return CompletedPart.builder() + .eTag(uploadPartResult.eTag()) + .partNumber(partNumber) + .build(); + }); + } + + private Mono<CompleteMultipartUploadResponse> completeUpload(UploadState state) { + log.info("[I202] completeUpload: bucket={}, filekey={}, completedParts.size={}", state.bucket, state.filekey, state.completedParts.size()); + + CompletedMultipartUpload multipartUpload = CompletedMultipartUpload.builder() + .parts(state.completedParts.values()) + .build(); + + return Mono.fromFuture(s3client.completeMultipartUpload(CompleteMultipartUploadRequest.builder() + .bucket(state.bucket) + .uploadId(state.uploadId) + .multipartUpload(multipartUpload) + .key(state.filekey) + .build())); + } + + + /** + * check result from an API call. + * @param result Result from an API call + */ + private static void checkResult(SdkResponse result) { + if (result.sdkHttpResponse() == null || !result.sdkHttpResponse().isSuccessful()) { + throw new UploadFailedException(result); + } + } + + + /** + * Holds upload state during a multipart upload + */ + static class UploadState { + final String bucket; + final String filekey; + + String uploadId; + int partCounter; + Map<Integer, CompletedPart> completedParts = new HashMap<>(); + int buffered = 0; + + UploadState(String bucket, String filekey) { + this.bucket = bucket; + this.filekey = filekey; + } + } + +} diff --git a/aws-reactive/src/main/java/com/baeldung/aws/reactive/s3/UploadResult.java b/aws-reactive/src/main/java/com/baeldung/aws/reactive/s3/UploadResult.java new file mode 100644 index 0000000000..642ad426a5 --- /dev/null +++ b/aws-reactive/src/main/java/com/baeldung/aws/reactive/s3/UploadResult.java @@ -0,0 +1,25 @@ +package com.baeldung.aws.reactive.s3; + +import java.util.List; + +import org.springframework.http.HttpStatus; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; + +@Data +@AllArgsConstructor +@Builder +public class UploadResult { + HttpStatus status; + String[] keys; + + public UploadResult() {} + + public UploadResult(HttpStatus status, List<String> keys) { + this.status = status; + this.keys = keys == null ? new String[] {}: keys.toArray(new String[] {}); + + } +} diff --git a/aws-reactive/src/main/resources/application-minio.yml b/aws-reactive/src/main/resources/application-minio.yml new file mode 100644 index 0000000000..93bc2ff18b --- /dev/null +++ b/aws-reactive/src/main/resources/application-minio.yml @@ -0,0 +1,15 @@ + +# +# Minio profile +# +aws: + s3: + region: sa-east-1 + endpoint: http://localhost:9000 + accessKeyId: 8KLF8U60JER4AP23H0A6 + secretAccessKey: vX4uM7e7nNGPqjcXycVVhceNR7NQkiMQkR9Hoctf + bucket: bucket1 + + + + diff --git a/aws-reactive/src/main/resources/application.yml b/aws-reactive/src/main/resources/application.yml new file mode 100644 index 0000000000..957ebf82c3 --- /dev/null +++ b/aws-reactive/src/main/resources/application.yml @@ -0,0 +1,16 @@ + +# +# Configurações de acesso ao Minio +# +aws: + s3: + region: sa-east-1 +# When using AWS, the library will use one of the available +# credential sources described in the documentation. +# accessKeyId: **** +# secretAccessKey: **** + bucket: dev1.token.com.br + + + + diff --git a/aws-reactive/src/test/java/com/baeldung/aws/reactive/s3/ReactiveS3ApplicationLiveTest.java b/aws-reactive/src/test/java/com/baeldung/aws/reactive/s3/ReactiveS3ApplicationLiveTest.java new file mode 100644 index 0000000000..9e5720225f --- /dev/null +++ b/aws-reactive/src/test/java/com/baeldung/aws/reactive/s3/ReactiveS3ApplicationLiveTest.java @@ -0,0 +1,85 @@ +package com.baeldung.aws.reactive.s3; + +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.nio.file.Files; +import java.nio.file.Paths; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.core.io.Resource; +import org.springframework.http.ContentDisposition; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.util.ResourceUtils; + +import static org.junit.Assert.*; + +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@ActiveProfiles("minio") +class ReactiveS3ApplicationLiveTest { + + @Autowired + private TestRestTemplate restTemplate; + + @LocalServerPort + private int serverPort; + + + @Test + void whenUploadSingleFile_thenSuccess() throws Exception { + + String url = "http://localhost:" + serverPort + "/inbox"; + byte[] data = Files.readAllBytes(Paths.get("src/test/resources/testimage1.png")); + UploadResult result = restTemplate.postForObject(url, data , UploadResult.class); + + assertEquals("Expected CREATED (202)", result.getStatus(), HttpStatus.CREATED ); + + } + + @Test + void whenUploadMultipleFiles_thenSuccess() throws Exception { + + + MultiValueMap<String, Object> body = new LinkedMultiValueMap<>(); + addFileEntity("f1", body, new File("src/test/resources/testimage1.png")); + addFileEntity("f2", body, new File("src/test/resources/testimage2.png")); + + HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(body); + String url = "http://localhost:" + serverPort + "/inbox"; + + ResponseEntity<UploadResult> result = restTemplate.postForEntity(url, requestEntity, UploadResult.class); + + assertEquals("Http Code",HttpStatus.CREATED, result.getStatusCode() ); + assertEquals("File keys",2, result.getBody().getKeys().length); + + } + + private void addFileEntity(String name, MultiValueMap<String, Object> body, File file) throws Exception { + + byte[] data = Files.readAllBytes(file.toPath()); + MultiValueMap<String, String> headers = new LinkedMultiValueMap<>(); + ContentDisposition contentDispositionHeader = ContentDisposition.builder("form-data") + .name(name) + .filename(file.getName()) + .build(); + + headers.add(HttpHeaders.CONTENT_DISPOSITION, contentDispositionHeader.toString()); + + HttpEntity<byte[]> fileEntity = new HttpEntity<>(data, headers); + body.add(name, fileEntity); + } + + +} diff --git a/aws-reactive/src/test/resources/testimage1.png b/aws-reactive/src/test/resources/testimage1.png new file mode 100644 index 0000000000..c61a9b677f Binary files /dev/null and b/aws-reactive/src/test/resources/testimage1.png differ diff --git a/aws-reactive/src/test/resources/testimage2.png b/aws-reactive/src/test/resources/testimage2.png new file mode 100644 index 0000000000..8c4f119ae6 Binary files /dev/null and b/aws-reactive/src/test/resources/testimage2.png differ diff --git a/aws/README.md b/aws/README.md index 9e4ca8b699..fcb9735878 100644 --- a/aws/README.md +++ b/aws/README.md @@ -1,6 +1,6 @@ ## AWS -This module contains articles about AWS +This module contains articles about Amazon Web Services (AWS) ### Relevant articles diff --git a/aws/pom.xml b/aws/pom.xml index 45a30f96ba..19057d48e9 100644 --- a/aws/pom.xml +++ b/aws/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>aws</artifactId> <version>0.1.0-SNAPSHOT</version> @@ -18,7 +19,7 @@ <artifactId>aws-java-sdk</artifactId> <version>${aws-java-sdk.version}</version> </dependency> - <dependency> + <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> <version>${mockito-core.version}</version> diff --git a/aws/src/test/java/com/baeldung/dynamodb/rule/LocalDbCreationRule.java b/aws/src/test/java/com/baeldung/dynamodb/rule/LocalDbCreationRule.java index 45a107103d..cfc9f87a60 100644 --- a/aws/src/test/java/com/baeldung/dynamodb/rule/LocalDbCreationRule.java +++ b/aws/src/test/java/com/baeldung/dynamodb/rule/LocalDbCreationRule.java @@ -15,7 +15,7 @@ public class LocalDbCreationRule extends ExternalResource { @Override protected void before() throws Exception { String port = "8000"; - this.server = ServerRunner.createServerFromCommandLineArgs(new String[]{"-inMemory", "-port", port}); + this.server = ServerRunner.createServerFromCommandLineArgs(new String[]{"-inMemory","-sharedDb" ,"-port", port}); server.start(); } diff --git a/axon/pom.xml b/axon/pom.xml index 21e21f0ef2..be74b38fa6 100644 --- a/axon/pom.xml +++ b/axon/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>axon</artifactId> <name>axon</name> diff --git a/azure/pom.xml b/azure/pom.xml index 3d9c296748..7134a47cd7 100644 --- a/azure/pom.xml +++ b/azure/pom.xml @@ -1,16 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>azure</artifactId> <version>0.1</version> <name>azure</name> - <description>Demo project for Spring Boot on Azure</description> <packaging>war</packaging> + <description>Demo project for Spring Boot on Azure</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -43,7 +43,6 @@ <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> </dependency> - </dependencies> <build> diff --git a/bazel/bazelapp/README.md b/bazel/bazelapp/README.md new file mode 100644 index 0000000000..528f797c21 --- /dev/null +++ b/bazel/bazelapp/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Building Java Applications with Bazel](https://www.baeldung.com/bazel-build-tool) diff --git a/bazel/bazelapp/pom.xml b/bazel/bazelapp/pom.xml index e56cc06ef4..6440c26cd6 100644 --- a/bazel/bazelapp/pom.xml +++ b/bazel/bazelapp/pom.xml @@ -5,10 +5,10 @@ <modelVersion>4.0.0</modelVersion> <artifactId>bazelapp</artifactId> <name>bazelapp</name> - + <parent> - <artifactId>bazel</artifactId> <groupId>com.baeldung</groupId> + <artifactId>bazel</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> diff --git a/bazel/bazelgreeting/README.md b/bazel/bazelgreeting/README.md new file mode 100644 index 0000000000..528f797c21 --- /dev/null +++ b/bazel/bazelgreeting/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Building Java Applications with Bazel](https://www.baeldung.com/bazel-build-tool) diff --git a/bazel/bazelgreeting/pom.xml b/bazel/bazelgreeting/pom.xml index e688a55bd5..ae8a6e4080 100644 --- a/bazel/bazelgreeting/pom.xml +++ b/bazel/bazelgreeting/pom.xml @@ -5,12 +5,11 @@ <modelVersion>4.0.0</modelVersion> <artifactId>bazelgreeting</artifactId> <name>bazelgreeting</name> - + <parent> - <artifactId>bazel</artifactId> <groupId>com.baeldung</groupId> + <artifactId>bazel</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> - </project> \ No newline at end of file diff --git a/bazel/pom.xml b/bazel/pom.xml index cb784ec6e6..b1585cc73b 100644 --- a/bazel/pom.xml +++ b/bazel/pom.xml @@ -4,19 +4,18 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>bazel</artifactId> - <packaging>pom</packaging> <name>bazel</name> - + <packaging>pom</packaging> + <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> - + <modules> <module>bazelgreeting</module> <module>bazelapp</module> </modules> - </project> \ No newline at end of file diff --git a/blade/pom.xml b/blade/pom.xml index 6f8a78852d..e302f33c51 100644 --- a/blade/pom.xml +++ b/blade/pom.xml @@ -1,16 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>blade</artifactId> <name>blade</name> - <parent> - <groupId>com.baeldung</groupId> - <artifactId>parent-modules</artifactId> - <version>1.0.0-SNAPSHOT</version> - </parent> + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> <dependencies> <dependency> @@ -65,8 +65,9 @@ <scope>test</scope> </dependency> </dependencies> + <build> - <finalName>sample-blade-app</finalName> + <finalName>blade</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -121,7 +122,6 @@ </executions> </plugin> - <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>3.1.0</version> @@ -149,17 +149,18 @@ </plugin> </plugins> </build> - + <properties> - <blade-mvc.version>2.0.14.RELEASE</blade-mvc.version> - <bootstrap.version>4.2.1</bootstrap.version> - <commons-lang3.version>3.8.1</commons-lang3.version> - <lombok.version>1.18.4</lombok.version> - <httpclient.version>4.5.6</httpclient.version> - <httpmime.version>4.5.6</httpmime.version> - <httpcore.version>4.4.10</httpcore.version> - <assertj-core.version>3.11.1</assertj-core.version> - <maven-failsafe-plugin.version>3.0.0-M3</maven-failsafe-plugin.version> - <process-exec-maven-plugin.version>0.7</process-exec-maven-plugin.version> + <blade-mvc.version>2.0.14.RELEASE</blade-mvc.version> + <bootstrap.version>4.2.1</bootstrap.version> + <commons-lang3.version>3.8.1</commons-lang3.version> + <lombok.version>1.18.4</lombok.version> + <httpclient.version>4.5.6</httpclient.version> + <httpmime.version>4.5.6</httpmime.version> + <httpcore.version>4.4.10</httpcore.version> + <assertj-core.version>3.11.1</assertj-core.version> + <maven-failsafe-plugin.version>3.0.0-M3</maven-failsafe-plugin.version> + <process-exec-maven-plugin.version>0.7</process-exec-maven-plugin.version> </properties> + </project> diff --git a/bootique/pom.xml b/bootique/pom.xml index 7601321b99..8e40b3ec8d 100644 --- a/bootique/pom.xml +++ b/bootique/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.bootique</groupId> <artifactId>bootique</artifactId> diff --git a/cas/cas-secured-app/pom.xml b/cas/cas-secured-app/pom.xml index 338a9e5653..63d5d43417 100644 --- a/cas/cas-secured-app/pom.xml +++ b/cas/cas-secured-app/pom.xml @@ -1,15 +1,15 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>cas-secured-app</artifactId> <name>cas-secured-app</name> - <description>Demo project for CAS</description> <packaging>jar</packaging> + <description>Demo project for CAS</description> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-1</relativePath> </parent> diff --git a/cas/cas-server/README.md b/cas/cas-server/README.md index bacf45a2a1..44cfa2246c 100644 --- a/cas/cas-server/README.md +++ b/cas/cas-server/README.md @@ -98,4 +98,8 @@ Invokes the CAS Command Line Shell. For a list of commands either use no argumen ```bash ./build.sh cli -``` \ No newline at end of file +``` + +### Relevant Articles: + +- [CAS SSO With Spring Security](https://www.baeldung.com/spring-security-cas-sso) diff --git a/cas/cas-server/pom.xml b/cas/cas-server/pom.xml index 8a1e602114..bfd8f685ac 100644 --- a/cas/cas-server/pom.xml +++ b/cas/cas-server/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd "> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd "> <modelVersion>4.0.0</modelVersion> <artifactId>cas-server</artifactId> <version>1.0</version> @@ -8,12 +8,12 @@ <packaging>war</packaging> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-1</relativePath> </parent> - + <dependencies> <dependency> <groupId>org.apereo.cas</groupId> @@ -198,7 +198,7 @@ <wrapper-maven-plugin.version>0.0.4</wrapper-maven-plugin.version> <maven-war-plugin.version>2.6</maven-war-plugin.version> - + <echo-maven-plugin.version>0.3.0</echo-maven-plugin.version> <pgpverify-maven-plugin.version>1.1.0</pgpverify-maven-plugin.version> </properties> diff --git a/cas/pom.xml b/cas/pom.xml index 6d141277c5..f458b23797 100644 --- a/cas/pom.xml +++ b/cas/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>cas</artifactId> <name>cas</name> diff --git a/cdi/pom.xml b/cdi/pom.xml index 809622a5db..87ad9c111a 100644 --- a/cdi/pom.xml +++ b/cdi/pom.xml @@ -5,7 +5,7 @@ <artifactId>cdi</artifactId> <version>1.0-SNAPSHOT</version> <name>cdi</name> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-spring-4</artifactId> @@ -23,7 +23,7 @@ <groupId>org.jboss.weld.se</groupId> <artifactId>weld-se-core</artifactId> <version>${weld-se-core.version}</version> - </dependency> + </dependency> <dependency> <groupId>org.hamcrest</groupId> <artifactId>hamcrest-core</artifactId> @@ -53,7 +53,7 @@ <scope>test</scope> </dependency> </dependencies> - + <properties> <cdi-api.version>2.0.SP1</cdi-api.version> <weld-se-core.version>3.0.5.Final</weld-se-core.version> @@ -61,4 +61,5 @@ <assertj-core.version>3.10.0</assertj-core.version> <spring.version>5.1.2.RELEASE</spring.version> </properties> + </project> diff --git a/checker-plugin/pom.xml b/checker-plugin/pom.xml index 63def4dbdc..0140d7951a 100644 --- a/checker-plugin/pom.xml +++ b/checker-plugin/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> diff --git a/cloud-foundry-uaa/cf-uaa-oauth2-client/pom.xml b/cloud-foundry-uaa/cf-uaa-oauth2-client/pom.xml index fe1b919905..1429ca8b24 100644 --- a/cloud-foundry-uaa/cf-uaa-oauth2-client/pom.xml +++ b/cloud-foundry-uaa/cf-uaa-oauth2-client/pom.xml @@ -8,8 +8,8 @@ <description>Demo project for Spring Boot</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-2</relativePath> </parent> @@ -33,5 +33,5 @@ </plugin> </plugins> </build> - + </project> diff --git a/cloud-foundry-uaa/cf-uaa-oauth2-resource-server/pom.xml b/cloud-foundry-uaa/cf-uaa-oauth2-resource-server/pom.xml index 7cd47bb7b3..6297c6f673 100644 --- a/cloud-foundry-uaa/cf-uaa-oauth2-resource-server/pom.xml +++ b/cloud-foundry-uaa/cf-uaa-oauth2-resource-server/pom.xml @@ -8,12 +8,12 @@ <description>Demo project for Spring Boot</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-2</relativePath> </parent> - + <dependencies> <dependency> <groupId>org.springframework.boot</groupId> diff --git a/code-generation/README.md b/code-generation/README.md index 289a336f99..d45a113a8f 100644 --- a/code-generation/README.md +++ b/code-generation/README.md @@ -7,3 +7,4 @@ This module contains articles about automatic code generation - [Introduction to AutoValue](https://www.baeldung.com/introduction-to-autovalue) - [Introduction to AutoFactory](https://www.baeldung.com/autofactory) - [Google AutoService](https://www.baeldung.com/google-autoservice) +- [Defensive Copies for Collections Using AutoValue](https://www.baeldung.com/autovalue-defensive-copies) diff --git a/code-generation/pom.xml b/code-generation/pom.xml index 91ce0a4639..7cc076c58f 100644 --- a/code-generation/pom.xml +++ b/code-generation/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>code-generation</artifactId> <version>1.0</version> diff --git a/core-groovy-2/pom.xml b/core-groovy-2/pom.xml index 08526bac9a..e0987de4b3 100644 --- a/core-groovy-2/pom.xml +++ b/core-groovy-2/pom.xml @@ -180,9 +180,10 @@ <junit.platform.version>1.0.0</junit.platform.version> <hsqldb.version>2.4.0</hsqldb.version> <spock-core.version>1.1-groovy-2.4</spock-core.version> - <groovy-wslite.version>1.1.3</groovy-wslite.version> + <groovy-wslite.version>1.1.3</groovy-wslite.version> <logback.version>1.2.3</logback.version> <groovy.version>2.5.7</groovy.version> </properties> + </project> diff --git a/core-groovy-collections/pom.xml b/core-groovy-collections/pom.xml index bf3ae26592..423be5e977 100644 --- a/core-groovy-collections/pom.xml +++ b/core-groovy-collections/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-groovy-collections</artifactId> <version>1.0-SNAPSHOT</version> @@ -101,11 +101,11 @@ <artifactId>maven-surefire-plugin</artifactId> <version>2.20.1</version> <configuration> - <useFile>false</useFile> - <includes> - <include>**/*Test.java</include> - <include>**/*Spec.java</include> - </includes> + <useFile>false</useFile> + <includes> + <include>**/*Test.java</include> + <include>**/*Spec.java</include> + </includes> </configuration> </plugin> </plugins> @@ -127,5 +127,6 @@ <spock-core.version>1.1-groovy-2.4</spock-core.version> <gmavenplus-plugin.version>1.6</gmavenplus-plugin.version> </properties> + </project> diff --git a/core-groovy/pom.xml b/core-groovy/pom.xml index 80d6f8d2d5..6407f7c0c6 100644 --- a/core-groovy/pom.xml +++ b/core-groovy/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-groovy</artifactId> <version>1.0-SNAPSHOT</version> @@ -116,5 +116,6 @@ <spock-core.version>1.1-groovy-2.4</spock-core.version> <gmavenplus-plugin.version>1.6</gmavenplus-plugin.version> </properties> + </project> diff --git a/core-java-modules/core-java-10/pom.xml b/core-java-modules/core-java-10/pom.xml index 7163619679..49ebbfb283 100644 --- a/core-java-modules/core-java-10/pom.xml +++ b/core-java-modules/core-java-10/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>core-java-10</artifactId> <version>0.1.0-SNAPSHOT</version> <name>core-java-10</name> diff --git a/core-java-modules/core-java-11/README.md b/core-java-modules/core-java-11/README.md index 514f24a4ae..93a2c6faf5 100644 --- a/core-java-modules/core-java-11/README.md +++ b/core-java-modules/core-java-11/README.md @@ -12,4 +12,3 @@ This module contains articles about Java 11 core features - [An Introduction to Epsilon GC: A No-Op Experimental Garbage Collector](https://www.baeldung.com/jvm-epsilon-gc-garbage-collector) - [Guide to jlink](https://www.baeldung.com/jlink) - [Negate a Predicate Method Reference with Java 11](https://www.baeldung.com/java-negate-predicate-method-reference) -- [Transforming an Empty String into an Empty Optional](https://www.baeldung.com/java-empty-string-to-empty-optional) diff --git a/core-java-modules/core-java-11/pom.xml b/core-java-modules/core-java-11/pom.xml index 81917b6397..5bebaae00d 100644 --- a/core-java-modules/core-java-11/pom.xml +++ b/core-java-modules/core-java-11/pom.xml @@ -1,9 +1,8 @@ -<project - xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>core-java-11</artifactId> <version>0.1.0-SNAPSHOT</version> <name>core-java-11</name> @@ -110,4 +109,5 @@ <uberjar.name>benchmarks</uberjar.name> <jmh.version>1.22</jmh.version> </properties> + </project> diff --git a/core-java-modules/core-java-12/pom.xml b/core-java-modules/core-java-12/pom.xml index 06c49a0021..171d3f6e73 100644 --- a/core-java-modules/core-java-12/pom.xml +++ b/core-java-modules/core-java-12/pom.xml @@ -1,9 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>core-java-12</artifactId> <version>0.1.0-SNAPSHOT</version> <name>core-java-12</name> diff --git a/core-java-modules/core-java-13/pom.xml b/core-java-modules/core-java-13/pom.xml new file mode 100644 index 0000000000..1f215ae6b0 --- /dev/null +++ b/core-java-modules/core-java-13/pom.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>com.baeldung</groupId> + <artifactId>core-java-13</artifactId> + <version>0.1.0-SNAPSHOT</version> + <name>core-java-13</name> + <packaging>jar</packaging> + <url>http://maven.apache.org</url> + + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> + <version>1.0.0-SNAPSHOT</version> + <relativePath>../../</relativePath> + </parent> + + <dependencies> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <version>${assertj.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>${maven-compiler-plugin.version}</version> + <configuration> + <source>${maven.compiler.source.version}</source> + <target>${maven.compiler.target.version}</target> + <release>13</release> + <compilerArgs>--enable-preview</compilerArgs> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>3.0.0-M3</version> + <configuration> + <argLine>--enable-preview</argLine> + </configuration> + </plugin> + </plugins> + </build> + + <properties> + <maven.compiler.source.version>13</maven.compiler.source.version> + <maven.compiler.target.version>13</maven.compiler.target.version> + <assertj.version>3.6.1</assertj.version> + </properties> + +</project> \ No newline at end of file diff --git a/core-java-modules/core-java-13/src/test/java/com/baeldung/switchExpression/SwitchExpressionsUnitTest.java b/core-java-modules/core-java-13/src/test/java/com/baeldung/switchExpression/SwitchExpressionsUnitTest.java new file mode 100644 index 0000000000..bb9250f000 --- /dev/null +++ b/core-java-modules/core-java-13/src/test/java/com/baeldung/switchExpression/SwitchExpressionsUnitTest.java @@ -0,0 +1,76 @@ +package com.baeldung.switchExpression; + +import static java.time.Month.AUGUST; +import static java.time.Month.JUNE; + +import static org.junit.Assert.assertEquals; + +import java.time.Month; +import java.util.function.Function; + +import org.junit.Test; + +public class SwitchExpressionsUnitTest { + + @Test + @SuppressWarnings ("preview") + public void whenSwitchingOverMonthJune_thenWillReturn3() { + + var month = JUNE; + + var result = switch (month) { + case JANUARY, JUNE, JULY -> 3; + case FEBRUARY, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER -> 1; + case MARCH, MAY, APRIL -> 2; + default -> 0; + }; + + assertEquals(result, 3); + } + + @Test + @SuppressWarnings ("preview") + public void whenSwitchingOverMonthAugust_thenWillReturn24() { + var month = AUGUST; + + var result = switch (month) { + case JANUARY, JUNE, JULY -> 3; + case FEBRUARY, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER -> 1; + case MARCH, MAY, APRIL, AUGUST -> { + int monthLength = month.toString().length(); + yield monthLength * 4; + } + default -> 0; + }; + + assertEquals(24, result); + } + + @Test + @SuppressWarnings ("preview") + public void whenSwitchingOverMonthJanuary_thenWillReturn3() { + + Function<Month, Integer> func = (month) -> { + switch (month) { + case JANUARY, JUNE, JULY -> { return 3; } + default -> { return 0; } + } + }; + + assertEquals(Integer.valueOf(3), func.apply(Month.JANUARY)); + } + + @Test + @SuppressWarnings ("preview") + public void whenSwitchingOverMonthAugust_thenWillReturn2() { + var month = AUGUST; + + var result = switch (month) { + case JANUARY, JUNE, JULY -> 3; + case FEBRUARY, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER -> 1; + case MARCH, MAY, APRIL, AUGUST -> 2; + }; + + assertEquals(result, 2); + } +} diff --git a/core-java-modules/core-java-8-2/README.md b/core-java-modules/core-java-8-2/README.md index 9201add1d7..3d38fbbdbc 100644 --- a/core-java-modules/core-java-8-2/README.md +++ b/core-java-modules/core-java-8-2/README.md @@ -3,9 +3,9 @@ This module contains articles about Java 8 core features ### Relevant Articles: -- [Anonymous Classes in Java](http://www.baeldung.com/) +- [Anonymous Classes in Java](https://www.baeldung.com/java-anonymous-classes) - [How to Delay Code Execution in Java](https://www.baeldung.com/java-delay-code-execution) - [Run a Java Application from the Command Line](https://www.baeldung.com/java-run-jar-with-arguments) - [Java 8 Stream skip() vs limit()](https://www.baeldung.com/java-stream-skip-vs-limit) - [Guide to Java BiFunction Interface](https://www.baeldung.com/java-bifunction-interface) -- [[<-- Prev]](/core-java-modules/core-java-8) \ No newline at end of file +- [[<-- Prev]](/core-java-modules/core-java-8) diff --git a/core-java-modules/core-java-8-2/pom.xml b/core-java-modules/core-java-8-2/pom.xml index 269631e0dd..746755f7a9 100644 --- a/core-java-modules/core-java-8-2/pom.xml +++ b/core-java-modules/core-java-8-2/pom.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-8-2</artifactId> <version>0.1.0-SNAPSHOT</version> @@ -33,4 +33,5 @@ <icu.version>64.2</icu.version> <assertj.version>3.12.2</assertj.version> </properties> + </project> diff --git a/core-java-modules/core-java-8-2/src/main/resources/META-INF/persistence.xml b/core-java-modules/core-java-8-2/src/main/resources/META-INF/persistence.xml index e8cd723ec2..c412ca0839 100644 --- a/core-java-modules/core-java-8-2/src/main/resources/META-INF/persistence.xml +++ b/core-java-modules/core-java-8-2/src/main/resources/META-INF/persistence.xml @@ -5,14 +5,14 @@ version="2.0"> <persistence-unit - name="com.baeldung.optionalReturnType" + name="com.baeldung.optionalreturntype" transaction-type="RESOURCE_LOCAL"> <description>Persist Optional Return Type Demo</description> <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> - <class>com.baeldung.optionalReturnType.User</class> - <class>com.baeldung.optionalReturnType.UserOptional</class> + <class>com.baeldung.optionalreturntype.User</class> + <class>com.baeldung.optionalreturntype.UserOptional</class> <!-- - <class>com.baeldung.optionalReturnType.UserOptionalField</class> + <class>com.baeldung.optionalreturntype.UserOptionalField</class> --> <exclude-unlisted-classes>true</exclude-unlisted-classes> diff --git a/core-java-modules/core-java-8/pom.xml b/core-java-modules/core-java-8/pom.xml index 074359ae54..c2c84a5407 100644 --- a/core-java-modules/core-java-8/pom.xml +++ b/core-java-modules/core-java-8/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -76,4 +77,5 @@ <!-- plugins --> <spring-boot-maven-plugin.version>2.0.4.RELEASE</spring-boot-maven-plugin.version> </properties> + </project> diff --git a/core-java-modules/core-java-8/src/main/java/com/baeldung/streamreduce/entities/Rating.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/streamreduce/entities/Rating.java new file mode 100644 index 0000000000..c4d0276256 --- /dev/null +++ b/core-java-modules/core-java-8/src/main/java/com/baeldung/streamreduce/entities/Rating.java @@ -0,0 +1,39 @@ +package com.baeldung.streamreduce.entities; + +import java.util.ArrayList; +import java.util.List; + +public class Rating { + + double points; + List<Review> reviews = new ArrayList<>(); + + public Rating() {} + + public void add(Review review) { + reviews.add(review); + computeRating(); + } + + private double computeRating() { + double totalPoints = reviews.stream().map(Review::getPoints).reduce(0, Integer::sum); + this.points = totalPoints / reviews.size(); + return this.points; + } + + public static Rating average(Rating r1, Rating r2) { + Rating combined = new Rating(); + combined.reviews = new ArrayList<>(r1.reviews); + combined.reviews.addAll(r2.reviews); + combined.computeRating(); + return combined; + } + + public double getPoints() { + return points; + } + + public List<Review> getReviews() { + return reviews; + } +} diff --git a/core-java-modules/core-java-8/src/main/java/com/baeldung/streamreduce/entities/Review.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/streamreduce/entities/Review.java new file mode 100644 index 0000000000..03cde8a9c8 --- /dev/null +++ b/core-java-modules/core-java-8/src/main/java/com/baeldung/streamreduce/entities/Review.java @@ -0,0 +1,28 @@ +package com.baeldung.streamreduce.entities; + +public class Review { + + int points; + String review; + + public Review(int points, String review) { + this.points = points; + this.review = review; + } + + public int getPoints() { + return points; + } + + public void setPoints(int points) { + this.points = points; + } + + public String getReview() { + return review; + } + + public void setReview(String review) { + this.review = review; + } +} diff --git a/core-java-modules/core-java-8/src/main/java/com/baeldung/streamreduce/entities/User.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/streamreduce/entities/User.java index 39a42beab7..20c12d7920 100644 --- a/core-java-modules/core-java-8/src/main/java/com/baeldung/streamreduce/entities/User.java +++ b/core-java-modules/core-java-8/src/main/java/com/baeldung/streamreduce/entities/User.java @@ -4,6 +4,7 @@ public class User { private final String name; private final int age; + private final Rating rating = new Rating(); public User(String name, int age) { this.name = name; @@ -17,7 +18,11 @@ public class User { public int getAge() { return age; } - + + public Rating getRating() { + return rating; + } + @Override public String toString() { return "User{" + "name=" + name + ", age=" + age + '}'; diff --git a/core-java-modules/core-java-8/src/test/java/com/baeldung/streamreduce/tests/StreamReduceManualTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/streamreduce/tests/StreamReduceManualTest.java index 0bf1a5837e..602bdd069e 100644 --- a/core-java-modules/core-java-8/src/test/java/com/baeldung/streamreduce/tests/StreamReduceManualTest.java +++ b/core-java-modules/core-java-8/src/test/java/com/baeldung/streamreduce/tests/StreamReduceManualTest.java @@ -1,5 +1,7 @@ package com.baeldung.streamreduce.tests; +import com.baeldung.streamreduce.entities.Rating; +import com.baeldung.streamreduce.entities.Review; import com.baeldung.streamreduce.entities.User; import com.baeldung.streamreduce.utilities.NumberUtils; import java.util.ArrayList; @@ -64,6 +66,31 @@ public class StreamReduceManualTest { assertThat(result).isEqualTo(65); } + @Test + public void givenUserList_whenReduceWithGreaterAgeAccumulator_thenFindsOldest() { + List<User> users = Arrays.asList(new User("John", 30), new User("Alex", 40), new User("Julie", 35)); + + User oldest = users.stream().reduce(users.get(0), (user1, user2) -> user1.getAge() >= user2.getAge() ? user1 : user2); + + assertThat(oldest).isEqualTo(users.get(1)); + } + + @Test + public void givenUserListWithRatings_whenReduceWithGreaterAgeAccumulator_thenFindsOldest() { + User john = new User("John", 30); + john.getRating().add(new Review(5, "")); + john.getRating().add(new Review(3, "not bad")); + User julie = new User("Julie", 35); + john.getRating().add(new Review(4, "great!")); + john.getRating().add(new Review(2, "terrible experience")); + john.getRating().add(new Review(4, "")); + List<User> users = Arrays.asList(john, julie); + + Rating averageRating = users.stream().reduce(new Rating(), (rating, user) -> Rating.average(rating, user.getRating()), Rating::average); + + assertThat(averageRating.getPoints()).isEqualTo(3.6); + } + @Test public void givenStringList_whenReduceWithParallelStream_thenCorrect() { List<String> letters = Arrays.asList("a", "b", "c", "d", "e"); diff --git a/core-java-modules/core-java-9-improvements/README.md b/core-java-modules/core-java-9-improvements/README.md index b0baccba7f..5864170e85 100644 --- a/core-java-modules/core-java-9-improvements/README.md +++ b/core-java-modules/core-java-9-improvements/README.md @@ -5,7 +5,6 @@ This module contains articles about the improvements to core Java features intro ### Relevant Articles: - [New Stream Collectors in Java 9](http://www.baeldung.com/java9-stream-collectors) -- [Java 9 Optional API Additions](https://www.baeldung.com/java-9-optional) - [Java 9 Convenience Factory Methods for Collections](https://www.baeldung.com/java-9-collections-factory-methods) - [Java 9 Stream API Improvements](https://www.baeldung.com/java-9-stream-api) - [Java 9 java.util.Objects Additions](https://www.baeldung.com/java-9-objects-new) diff --git a/core-java-modules/core-java-9-improvements/pom.xml b/core-java-modules/core-java-9-improvements/pom.xml index aee289c79f..9958bf9364 100644 --- a/core-java-modules/core-java-9-improvements/pom.xml +++ b/core-java-modules/core-java-9-improvements/pom.xml @@ -1,9 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <artifactId>core-java-9</artifactId> + <artifactId>core-java-9-improvements</artifactId> <version>0.2-SNAPSHOT</version> - <name>core-java-9</name> + <name>core-java-9-improvements</name> <parent> <groupId>com.baeldung</groupId> @@ -39,7 +40,7 @@ </dependencies> <build> - <finalName>core-java-9</finalName> + <finalName>core-java-9-improvements</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> diff --git a/core-java-modules/core-java-9-improvements/src/test/java/com/baeldung/java9/Java9OptionalTest.java b/core-java-modules/core-java-9-improvements/src/test/java/com/baeldung/java9/Java9OptionalTest.java deleted file mode 100644 index cd0efb028d..0000000000 --- a/core-java-modules/core-java-9-improvements/src/test/java/com/baeldung/java9/Java9OptionalTest.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.baeldung.java9; - -public class Java9OptionalTest { - @Test - public void givenOptionalOfSome_whenToStream_thenShouldTreatItAsOneElementStream() { - //given - Optional<String> value = Optional.of("a"); - - //when - List<String> collect = value.stream().map(String::toUpperCase).collect(Collectors.toList()); - - //then - assertThat(collect).hasSameElementsAs(List.of("A")); - } - - @Test - public void givenOptionalOfNone_whenToStream_thenShouldTreatItAsZeroElementStream() { - //given - Optional<String> value = Optional.empty(); - - //when - List<String> collect = value.stream().map(String::toUpperCase).collect(Collectors.toList()); - - //then - assertThat(collect).isEmpty(); - } - - @Test - public void givenOptional_whenPresent_thenShouldExecuteProperCallback() { - //given - Optional<String> value = Optional.of("properValue"); - AtomicInteger successCounter = new AtomicInteger(0); - AtomicInteger onEmptyOptionalCounter = new AtomicInteger(0); - - //when - value.ifPresentOrElse((v) -> successCounter.incrementAndGet(), onEmptyOptionalCounter::incrementAndGet); - - //then - assertThat(successCounter.get()).isEqualTo(1); - assertThat(onEmptyOptionalCounter.get()).isEqualTo(0); - } - - @Test - public void givenOptional_whenNotPresent_thenShouldExecuteProperCallback() { - //given - Optional<String> value = Optional.empty(); - AtomicInteger successCounter = new AtomicInteger(0); - AtomicInteger onEmptyOptionalCounter = new AtomicInteger(0); - - //when - value.ifPresentOrElse((v) -> successCounter.incrementAndGet(), onEmptyOptionalCounter::incrementAndGet); - - //then - assertThat(successCounter.get()).isEqualTo(0); - assertThat(onEmptyOptionalCounter.get()).isEqualTo(1); - } - - @Test - public void givenOptional_whenPresent_thenShouldTakeAValueFromIt() { - //given - String expected = "properValue"; - Optional<String> value = Optional.of(expected); - Optional<String> defaultValue = Optional.of("default"); - - //when - Optional<String> result = value.or(() -> defaultValue); - - //then - assertThat(result.get()).isEqualTo(expected); - } - - @Test - public void givenOptional_whenEmpty_thenShouldTakeAValueFromOr() { - //given - String defaultString = "default"; - Optional<String> value = Optional.empty(); - Optional<String> defaultValue = Optional.of(defaultString); - - //when - Optional<String> result = value.or(() -> defaultValue); - - //then - assertThat(result.get()).isEqualTo(defaultString); - } -} \ No newline at end of file diff --git a/core-java-modules/core-java-9-jigsaw/pom.xml b/core-java-modules/core-java-9-jigsaw/pom.xml index 8194ae9d00..ecb36c365d 100644 --- a/core-java-modules/core-java-9-jigsaw/pom.xml +++ b/core-java-modules/core-java-9-jigsaw/pom.xml @@ -1,9 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-9-jigsaw</artifactId> <version>0.2-SNAPSHOT</version> - <name>core-java-9</name> + <name>core-java-9-jigsaw</name> <parent> <groupId>com.baeldung</groupId> diff --git a/core-java-modules/core-java-9-new-features/pom.xml b/core-java-modules/core-java-9-new-features/pom.xml index cfdbb285d4..9db1112f1d 100644 --- a/core-java-modules/core-java-9-new-features/pom.xml +++ b/core-java-modules/core-java-9-new-features/pom.xml @@ -1,9 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-9-new-features</artifactId> <version>0.2-SNAPSHOT</version> - <name>core-java-9</name> + <name>core-java-9-new-features</name> <parent> <groupId>com.baeldung</groupId> diff --git a/core-java-modules/core-java-9-streams/pom.xml b/core-java-modules/core-java-9-streams/pom.xml index 6e167caf9c..99be29f2b0 100644 --- a/core-java-modules/core-java-9-streams/pom.xml +++ b/core-java-modules/core-java-9-streams/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -13,9 +14,6 @@ <relativePath>../../parent-java</relativePath> </parent> - <dependencies> - </dependencies> - <build> <finalName>core-java-9-streams</finalName> <resources> @@ -26,6 +24,4 @@ </resources> </build> - <properties> - </properties> </project> diff --git a/core-java-modules/core-java-9/README.md b/core-java-modules/core-java-9/README.md index 94f480db67..e2bea5f7e2 100644 --- a/core-java-modules/core-java-9/README.md +++ b/core-java-modules/core-java-9/README.md @@ -4,13 +4,11 @@ This module contains articles about Java 9 core features ### Relevant Articles: -- [Method Handles in Java](http://www.baeldung.com/java-method-handles) -- [Introduction to Chronicle Queue](http://www.baeldung.com/java-chronicle-queue) -- [Optional orElse Optional](http://www.baeldung.com/java-optional-or-else-optional) +- [Method Handles in Java](https://www.baeldung.com/java-method-handles) +- [Introduction to Chronicle Queue](https://www.baeldung.com/java-chronicle-queue) - [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) - [Immutable Set in Java](https://www.baeldung.com/java-immutable-set) -- [Filtering a Stream of Optionals in Java](https://www.baeldung.com/java-filter-stream-of-optional) Note: also contains part of the code for the article [How to Filter a Collection in Java](https://www.baeldung.com/java-collection-filtering). diff --git a/core-java-modules/core-java-9/pom.xml b/core-java-modules/core-java-9/pom.xml index aee289c79f..23a465caa1 100644 --- a/core-java-modules/core-java-9/pom.xml +++ b/core-java-modules/core-java-9/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-9</artifactId> <version>0.2-SNAPSHOT</version> diff --git a/core-java-modules/core-java-9/src/test/java/com/baeldung/optionals/OptionalsTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/optionals/OptionalsTest.java deleted file mode 100644 index 4e5f94c0db..0000000000 --- a/core-java-modules/core-java-9/src/test/java/com/baeldung/optionals/OptionalsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.baeldung.optionals; - -import static org.junit.Assert.assertEquals; - -import java.util.Optional; - -import org.junit.Test; - -public class OptionalsTest { - - @Test - public void givenOptional_whenEmptyValue_thenCustomMessage() { - assertEquals(Optional.of("Name not provided"), Optionals.getName(Optional.ofNullable(null))); - } - - @Test - public void givenOptional_whenValue_thenOptional() { - String name = "Filan Fisteku"; - Optional<String> optionalString = Optional.ofNullable(name); - assertEquals(optionalString, Optionals.getName(optionalString)); - } - - @Test - public void givenOptional_whenValue_thenOptionalGeneralMethod() { - String name = "Filan Fisteku"; - String missingOptional = "Name not provided"; - Optional<String> optionalString = Optional.ofNullable(name); - Optional<String> fallbackOptionalString = Optional.ofNullable(missingOptional); - assertEquals(optionalString, Optionals.or(optionalString, fallbackOptionalString)); - } - - @Test - public void givenEmptyOptional_whenValue_thenOptionalGeneralMethod() { - String missingOptional = "Name not provided"; - Optional<String> optionalString = Optional.empty(); - Optional<String> fallbackOptionalString = Optional.ofNullable(missingOptional); - assertEquals(fallbackOptionalString, Optionals.or(optionalString, fallbackOptionalString)); - } - - @Test - public void givenGuavaOptional_whenInvoke_thenOptional() { - String name = "Filan Fisteku"; - com.google.common.base.Optional<String> stringOptional = com.google.common.base.Optional.of(name); - assertEquals(stringOptional, Optionals.getOptionalGuavaName(stringOptional)); - } - - @Test - public void givenGuavaOptional_whenNull_thenDefaultText() { - assertEquals(com.google.common.base.Optional.of("Name not provided"), Optionals.getOptionalGuavaName(com.google.common.base.Optional.fromNullable(null))); - } -} \ No newline at end of file diff --git a/core-java-modules/core-java-annotations/pom.xml b/core-java-modules/core-java-annotations/pom.xml index 92b5afbd47..a97686a5b5 100644 --- a/core-java-modules/core-java-annotations/pom.xml +++ b/core-java-modules/core-java-annotations/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> diff --git a/core-java-modules/core-java-arrays-2/pom.xml b/core-java-modules/core-java-arrays-2/pom.xml index a1da169f2f..3f6b7094bb 100644 --- a/core-java-modules/core-java-arrays-2/pom.xml +++ b/core-java-modules/core-java-arrays-2/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -39,7 +40,6 @@ </build> <properties> - <!-- util --> <commons-lang3.version>3.9</commons-lang3.version> <!-- testing --> diff --git a/core-java-modules/core-java-arrays/pom.xml b/core-java-modules/core-java-arrays/pom.xml index ca4e262ff9..20a835594f 100644 --- a/core-java-modules/core-java-arrays/pom.xml +++ b/core-java-modules/core-java-arrays/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -171,12 +172,12 @@ <argument>-Xmx300m</argument> <argument>-XX:+UseParallelGC</argument> <argument>-classpath</argument> - <classpath /> + <classpath/> <argument>com.baeldung.outofmemoryerror.OutOfMemoryGCLimitExceed</argument> </arguments> </configuration> </plugin> - + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> @@ -237,7 +238,7 @@ <executable>java</executable> <arguments> <argument>-classpath</argument> - <classpath /> + <classpath/> <argument>org.openjdk.jmh.Main</argument> <argument>.*</argument> </arguments> @@ -356,10 +357,9 @@ </profiles> <properties> - <!-- util --> <commons-lang3.version>3.9</commons-lang3.version> - + <jmh-core.version>1.19</jmh-core.version> <jmh-generator-annprocess.version>1.19</jmh-generator-annprocess.version> diff --git a/core-java-modules/core-java-collections-2/pom.xml b/core-java-modules/core-java-collections-2/pom.xml index 217c1d9258..e0e7dd5c82 100644 --- a/core-java-modules/core-java-collections-2/pom.xml +++ b/core-java-modules/core-java-collections-2/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-collections-2</artifactId> <name>core-java-collections-2</name> @@ -54,4 +55,5 @@ <junit.platform.version>1.2.0</junit.platform.version> <commons-exec.version>1.3</commons-exec.version> </properties> + </project> diff --git a/core-java-modules/core-java-collections-3/pom.xml b/core-java-modules/core-java-collections-3/pom.xml index 84c7865e68..f94ff6f71f 100644 --- a/core-java-modules/core-java-collections-3/pom.xml +++ b/core-java-modules/core-java-collections-3/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-collections-3</artifactId> <version>0.1.0-SNAPSHOT</version> @@ -31,4 +32,5 @@ <openjdk.jmh.version>1.19</openjdk.jmh.version> <assertj.version>3.11.1</assertj.version> </properties> + </project> diff --git a/core-java-modules/core-java-collections-array-list/pom.xml b/core-java-modules/core-java-collections-array-list/pom.xml index 249103152a..cf7889fa58 100644 --- a/core-java-modules/core-java-collections-array-list/pom.xml +++ b/core-java-modules/core-java-collections-array-list/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-collections-array-list</artifactId> <version>0.1.0-SNAPSHOT</version> @@ -31,4 +32,5 @@ <commons-collections4.version>4.1</commons-collections4.version> <assertj.version>3.11.1</assertj.version> </properties> + </project> diff --git a/core-java-modules/core-java-collections-list-2/pom.xml b/core-java-modules/core-java-collections-list-2/pom.xml index 9652a7d79f..05b82a179b 100644 --- a/core-java-modules/core-java-collections-list-2/pom.xml +++ b/core-java-modules/core-java-collections-list-2/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-collections-list-2</artifactId> <version>0.1.0-SNAPSHOT</version> @@ -34,7 +35,8 @@ </dependencies> <properties> - <commons-collections4.version>4.1</commons-collections4.version> + <commons-collections4.version>4.1</commons-collections4.version> <assertj.version>3.11.1</assertj.version> </properties> + </project> diff --git a/core-java-modules/core-java-collections-list-3/README.md b/core-java-modules/core-java-collections-list-3/README.md index 3d4004de6f..65c377bd99 100644 --- a/core-java-modules/core-java-collections-list-3/README.md +++ b/core-java-modules/core-java-collections-list-3/README.md @@ -9,4 +9,5 @@ This module contains articles about the Java List collection - [List of Primitive Integer Values in Java](https://www.baeldung.com/java-list-primitive-int) - [Performance Comparison of Primitive Lists in Java](https://www.baeldung.com/java-list-primitive-performance) - [Filtering a Java Collection by a List](https://www.baeldung.com/java-filter-collection-by-list) +- [How to Count Duplicate Elements in Arraylist](https://www.baeldung.com/java-count-duplicate-elements-arraylist) - [[<-- Prev]](/core-java-modules/core-java-collections-list-2) diff --git a/core-java-modules/core-java-collections-list-3/pom.xml b/core-java-modules/core-java-collections-list-3/pom.xml index dab5058cd3..ced8a732c1 100644 --- a/core-java-modules/core-java-collections-list-3/pom.xml +++ b/core-java-modules/core-java-collections-list-3/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-collections-list-3</artifactId> <version>0.1.0-SNAPSHOT</version> @@ -57,8 +58,9 @@ <properties> <commons-collections4.version>4.1</commons-collections4.version> <assertj.version>3.11.1</assertj.version> - <trove4j.version>3.0.2</trove4j.version> - <fastutil.version>8.1.0</fastutil.version> - <colt.version>1.2.0</colt.version> + <trove4j.version>3.0.2</trove4j.version> + <fastutil.version>8.1.0</fastutil.version> + <colt.version>1.2.0</colt.version> </properties> + </project> diff --git a/core-java-modules/core-java-collections-list/pom.xml b/core-java-modules/core-java-collections-list/pom.xml index c8e881110e..3227c94e78 100644 --- a/core-java-modules/core-java-collections-list/pom.xml +++ b/core-java-modules/core-java-collections-list/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-collections-list</artifactId> <version>0.1.0-SNAPSHOT</version> @@ -37,4 +38,5 @@ <commons-lang3.version>3.8.1</commons-lang3.version> <assertj.version>3.11.1</assertj.version> </properties> + </project> diff --git a/core-java-modules/core-java-collections-set/pom.xml b/core-java-modules/core-java-collections-set/pom.xml index 1dd1e06ca1..d21bbeef77 100644 --- a/core-java-modules/core-java-collections-set/pom.xml +++ b/core-java-modules/core-java-collections-set/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-collections-set</artifactId> <version>0.1.0-SNAPSHOT</version> @@ -35,4 +36,5 @@ <commons-collections4.version>4.3</commons-collections4.version> <gson.version>2.8.5</gson.version> </properties> + </project> \ No newline at end of file diff --git a/core-java-modules/core-java-collections/pom.xml b/core-java-modules/core-java-collections/pom.xml index 62b42b53e7..c9cbe94a4f 100644 --- a/core-java-modules/core-java-collections/pom.xml +++ b/core-java-modules/core-java-collections/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-collections</artifactId> <version>0.1.0-SNAPSHOT</version> @@ -36,4 +37,5 @@ <openjdk.jmh.version>1.19</openjdk.jmh.version> <assertj.version>3.11.1</assertj.version> </properties> + </project> diff --git a/core-java-modules/core-java-concurrency-2/pom.xml b/core-java-modules/core-java-concurrency-2/pom.xml index 6b179a29c7..690fe97ae6 100644 --- a/core-java-modules/core-java-concurrency-2/pom.xml +++ b/core-java-modules/core-java-concurrency-2/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>core-java-concurrency-2</artifactId> <version>0.1.0-SNAPSHOT</version> <name>core-java-concurrency-2</name> diff --git a/core-java-modules/core-java-concurrency-advanced-2/README.md b/core-java-modules/core-java-concurrency-advanced-2/README.md index 988ada9e4a..0e3d25689f 100644 --- a/core-java-modules/core-java-concurrency-advanced-2/README.md +++ b/core-java-modules/core-java-concurrency-advanced-2/README.md @@ -1,5 +1,3 @@ -========= - ## Core Java Concurrency Advanced Examples This module contains articles about advanced topics about multithreading with core Java. diff --git a/core-java-modules/core-java-concurrency-advanced-2/pom.xml b/core-java-modules/core-java-concurrency-advanced-2/pom.xml index cad492b1ea..7e76219c4e 100644 --- a/core-java-modules/core-java-concurrency-advanced-2/pom.xml +++ b/core-java-modules/core-java-concurrency-advanced-2/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>core-java-concurrency-advanced-2</artifactId> <version>0.1.0-SNAPSHOT</version> <name>core-java-concurrency-advanced-2</name> @@ -30,7 +30,7 @@ <artifactId>jmh-generator-annprocess</artifactId> <version>${jmh-generator-annprocess.version}</version> </dependency> - + <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> @@ -52,7 +52,6 @@ <properties> <jmh-core.version>1.19</jmh-core.version> <jmh-generator-annprocess.version>1.19</jmh-generator-annprocess.version> - <assertj.version>3.6.1</assertj.version> </properties> diff --git a/core-java-modules/core-java-concurrency-advanced-3/README.md b/core-java-modules/core-java-concurrency-advanced-3/README.md index d1622b5fe1..409d3aa464 100644 --- a/core-java-modules/core-java-concurrency-advanced-3/README.md +++ b/core-java-modules/core-java-concurrency-advanced-3/README.md @@ -6,4 +6,6 @@ This module contains articles about advanced topics about multithreading with co ### Relevant Articles: +- [Common Concurrency Pitfalls in Java](https://www.baeldung.com/java-common-concurrency-pitfalls) +- [Guide to RejectedExecutionHandler](https://www.baeldung.com/java-rejectedexecutionhandler) [[<-- previous]](/core-java-modules/core-java-concurrency-advanced-2) diff --git a/core-java-modules/core-java-concurrency-advanced-3/pom.xml b/core-java-modules/core-java-concurrency-advanced-3/pom.xml index cc7b7b1e70..df9834181f 100644 --- a/core-java-modules/core-java-concurrency-advanced-3/pom.xml +++ b/core-java-modules/core-java-concurrency-advanced-3/pom.xml @@ -1,7 +1,9 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>core-java-concurrency-advanced-3</artifactId> <version>0.1.0-SNAPSHOT</version> <name>core-java-concurrency-advanced-3</name> @@ -15,10 +17,26 @@ </parent> <dependencies> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <version>${assertj.version}</version> + <scope>test</scope> + </dependency> </dependencies> <build> <finalName>core-java-concurrency-advanced-3</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>${maven.compiler.source}</source> + <target>${maven.compiler.target}</target> + </configuration> + </plugin> + </plugins> <resources> <resource> <directory>src/main/resources</directory> @@ -28,6 +46,9 @@ </build> <properties> + <assertj.version>3.14.0</assertj.version> + <maven.compiler.source>1.8</maven.compiler.source> + <maven.compiler.target>1.8</maven.compiler.target> </properties> </project> diff --git a/core-java-modules/core-java-concurrency-advanced-3/src/main/java/com/baeldung/commonissues/CollectionsConcurrencyIssues.java b/core-java-modules/core-java-concurrency-advanced-3/src/main/java/com/baeldung/commonissues/CollectionsConcurrencyIssues.java new file mode 100644 index 0000000000..cd68bf0709 --- /dev/null +++ b/core-java-modules/core-java-concurrency-advanced-3/src/main/java/com/baeldung/commonissues/CollectionsConcurrencyIssues.java @@ -0,0 +1,53 @@ +package com.baeldung.commonissues; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class CollectionsConcurrencyIssues { + + private void putIfAbsentList_NonAtomicOperation_ProneToConcurrencyIssues() { + List<String> list = Collections.synchronizedList(new ArrayList<>()); + if (!list.contains("foo")) { + list.add("foo"); + } + } + + private void putIfAbsentList_AtomicOperation_ThreadSafe() { + List<String> list = Collections.synchronizedList(new ArrayList<>()); + synchronized (list) { + if (!list.contains("foo")) { + list.add("foo"); + } + } + } + + private void putIfAbsentMap_NonAtomicOperation_ProneToConcurrencyIssues() { + Map<String, String> map = new ConcurrentHashMap<>(); + if (!map.containsKey("foo")) { + map.put("foo", "bar"); + } + } + + private void putIfAbsentMap_AtomicOperation_BetterApproach() { + Map<String, String> map = new ConcurrentHashMap<>(); + synchronized (map) { + if (!map.containsKey("foo")) { + map.put("foo", "bar"); + } + } + } + + private void putIfAbsentMap_AtomicOperation_BestApproach() { + Map<String, String> map = new ConcurrentHashMap<>(); + map.putIfAbsent("foo", "bar"); + } + + private void computeIfAbsentMap_AtomicOperation() { + Map<String, String> map = new ConcurrentHashMap<>(); + map.computeIfAbsent("foo", key -> key + "bar"); + } + +} diff --git a/core-java-modules/core-java-concurrency-advanced-3/src/main/java/com/baeldung/commonissues/Counter.java b/core-java-modules/core-java-concurrency-advanced-3/src/main/java/com/baeldung/commonissues/Counter.java new file mode 100644 index 0000000000..53892b9ad6 --- /dev/null +++ b/core-java-modules/core-java-concurrency-advanced-3/src/main/java/com/baeldung/commonissues/Counter.java @@ -0,0 +1,13 @@ +package com.baeldung.commonissues; + +class Counter { + private int counter = 0; + + public void increment() { + counter++; + } + + public int getValue() { + return counter; + } +} diff --git a/core-java-modules/core-java-concurrency-advanced-3/src/main/java/com/baeldung/commonissues/DeadlockExample.java b/core-java-modules/core-java-concurrency-advanced-3/src/main/java/com/baeldung/commonissues/DeadlockExample.java new file mode 100644 index 0000000000..b7b65d1197 --- /dev/null +++ b/core-java-modules/core-java-concurrency-advanced-3/src/main/java/com/baeldung/commonissues/DeadlockExample.java @@ -0,0 +1,42 @@ +package com.baeldung.commonissues; + +public class DeadlockExample { + + public static Object lock1 = new Object(); + public static Object lock2 = new Object(); + + public static void main(String args[]) { + Thread threadA = new Thread(() -> { + synchronized (lock1) { + System.out.println("ThreadA: Holding lock 1..."); + sleep(); + System.out.println("ThreadA: Waiting for lock 2..."); + + synchronized (lock2) { + System.out.println("ThreadA: Holding lock 1 & 2..."); + } + } + }); + Thread threadB = new Thread(() -> { + synchronized (lock2) { + System.out.println("ThreadB: Holding lock 2..."); + sleep(); + System.out.println("ThreadB: Waiting for lock 1..."); + + synchronized (lock1) { + System.out.println("ThreadB: Holding lock 1 & 2..."); + } + } + }); + threadA.start(); + threadB.start(); + } + + private static void sleep() { + try { + Thread.sleep(100); + } catch (InterruptedException e) { + throw new RuntimeException(); + } + } +} \ No newline at end of file diff --git a/core-java-modules/core-java-concurrency-advanced-3/src/main/java/com/baeldung/commonissues/SimpleDateFormatThreadUnsafetyExample.java b/core-java-modules/core-java-concurrency-advanced-3/src/main/java/com/baeldung/commonissues/SimpleDateFormatThreadUnsafetyExample.java new file mode 100644 index 0000000000..feb2322569 --- /dev/null +++ b/core-java-modules/core-java-concurrency-advanced-3/src/main/java/com/baeldung/commonissues/SimpleDateFormatThreadUnsafetyExample.java @@ -0,0 +1,35 @@ +package com.baeldung.commonissues; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +public class SimpleDateFormatThreadUnsafetyExample { + + private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); + + public static void main(String[] args) { + String dateStr = "2019-10-29T11:12:21"; + + ExecutorService executorService = Executors.newFixedThreadPool(10); + + for (int i = 0; i < 20; i++) { + executorService.submit(() -> parseDate(dateStr)); + } + + executorService.shutdown(); + } + + private static void parseDate(String dateStr) { + try { + Date date = simpleDateFormat.parse(dateStr); + System.out.println("Successfully Parsed Date " + date); + } catch (ParseException e) { + System.out.println("ParseError " + e.getMessage()); + } catch (Exception e) { + e.printStackTrace(); + } + } +} \ No newline at end of file diff --git a/core-java-modules/core-java-concurrency-advanced-3/src/main/java/com/baeldung/commonissues/SynchronizedCounter.java b/core-java-modules/core-java-concurrency-advanced-3/src/main/java/com/baeldung/commonissues/SynchronizedCounter.java new file mode 100644 index 0000000000..7054db6356 --- /dev/null +++ b/core-java-modules/core-java-concurrency-advanced-3/src/main/java/com/baeldung/commonissues/SynchronizedCounter.java @@ -0,0 +1,13 @@ +package com.baeldung.commonissues; + +class SynchronizedCounter { + private int counter = 0; + + public synchronized void increment() { + counter++; + } + + public synchronized int getValue() { + return counter; + } +} \ No newline at end of file diff --git a/core-java-modules/core-java-concurrency-advanced-3/src/main/java/com/baeldung/commonissues/SynchronizedVolatileCounter.java b/core-java-modules/core-java-concurrency-advanced-3/src/main/java/com/baeldung/commonissues/SynchronizedVolatileCounter.java new file mode 100644 index 0000000000..5434365ca9 --- /dev/null +++ b/core-java-modules/core-java-concurrency-advanced-3/src/main/java/com/baeldung/commonissues/SynchronizedVolatileCounter.java @@ -0,0 +1,13 @@ +package com.baeldung.commonissues; + +class SynchronizedVolatileCounter { + private volatile int counter = 0; + + public synchronized void increment() { + counter++; + } + + public int getValue() { + return counter; + } +} \ No newline at end of file diff --git a/core-java-modules/core-java-concurrency-advanced-3/src/test/java/com/baeldung/rejection/SaturationPolicyUnitTest.java b/core-java-modules/core-java-concurrency-advanced-3/src/test/java/com/baeldung/rejection/SaturationPolicyUnitTest.java new file mode 100644 index 0000000000..5016cc1d06 --- /dev/null +++ b/core-java-modules/core-java-concurrency-advanced-3/src/test/java/com/baeldung/rejection/SaturationPolicyUnitTest.java @@ -0,0 +1,136 @@ +package com.baeldung.rejection; + +import org.junit.After; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.*; +import java.util.concurrent.ThreadPoolExecutor.AbortPolicy; +import java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy; +import java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy; +import java.util.concurrent.ThreadPoolExecutor.DiscardPolicy; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; + +import static java.util.concurrent.TimeUnit.MILLISECONDS; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +public class SaturationPolicyUnitTest { + + private ThreadPoolExecutor executor; + + @After + public void shutdownExecutor() { + if (executor != null && !executor.isTerminated()) { + executor.shutdownNow(); + } + } + + @Test + public void givenAbortPolicy_WhenSaturated_ThenShouldThrowRejectedExecutionException() { + executor = new ThreadPoolExecutor(1, 1, 0, MILLISECONDS, new SynchronousQueue<>(), new AbortPolicy()); + executor.execute(() -> waitFor(100)); + + assertThatThrownBy(() -> executor.execute(() -> System.out.println("Will be rejected"))).isInstanceOf(RejectedExecutionException.class); + } + + @Test + public void givenCallerRunsPolicy_WhenSaturated_ThenTheCallerThreadRunsTheTask() { + executor = new ThreadPoolExecutor(1, 1, 0, MILLISECONDS, new SynchronousQueue<>(), new CallerRunsPolicy()); + executor.execute(() -> waitFor(100)); + + long startTime = System.nanoTime(); + executor.execute(() -> waitFor(100)); + double blockedDuration = (System.nanoTime() - startTime) / 1_000_000.0; + + assertThat(blockedDuration).isGreaterThanOrEqualTo(100); + } + + @Test + public void givenDiscardPolicy_WhenSaturated_ThenExecutorDiscardsTheNewTask() throws InterruptedException { + executor = new ThreadPoolExecutor(1, 1, 0, MILLISECONDS, new SynchronousQueue<>(), new DiscardPolicy()); + executor.execute(() -> waitFor(100)); + + BlockingQueue<String> queue = new LinkedBlockingDeque<>(); + executor.execute(() -> queue.offer("Result")); + + assertThat(queue.poll(200, MILLISECONDS)).isNull(); + } + + @Test + public void givenDiscardOldestPolicy_WhenSaturated_ThenExecutorDiscardsTheOldestTask() { + executor = new ThreadPoolExecutor(1, 1, 0, MILLISECONDS, new ArrayBlockingQueue<>(2), new DiscardOldestPolicy()); + executor.execute(() -> waitFor(100)); + + BlockingQueue<String> queue = new LinkedBlockingDeque<>(); + executor.execute(() -> queue.offer("First")); + executor.execute(() -> queue.offer("Second")); + executor.execute(() -> queue.offer("Third")); + + waitFor(150); + List<String> results = new ArrayList<>(); + queue.drainTo(results); + assertThat(results).containsExactlyInAnyOrder("Second", "Third"); + } + + @Test + public void givenGrowPolicy_WhenSaturated_ThenExecutorIncreaseTheMaxPoolSize() { + executor = new ThreadPoolExecutor(1, 1, 0, MILLISECONDS, new ArrayBlockingQueue<>(2), new GrowPolicy()); + executor.execute(() -> waitFor(100)); + + BlockingQueue<String> queue = new LinkedBlockingDeque<>(); + executor.execute(() -> queue.offer("First")); + executor.execute(() -> queue.offer("Second")); + executor.execute(() -> queue.offer("Third")); + + waitFor(150); + List<String> results = new ArrayList<>(); + queue.drainTo(results); + assertThat(results).containsExactlyInAnyOrder("First", "Second", "Third"); + } + + @Test + public void givenExecutorIsTerminated_WhenSubmittedNewTask_ThenTheSaturationPolicyApplies() { + ThreadPoolExecutor executor = new ThreadPoolExecutor(1, 1, 0, MILLISECONDS, new LinkedBlockingQueue<>()); + executor.shutdownNow(); + + assertThatThrownBy(() -> executor.execute(() -> { + })).isInstanceOf(RejectedExecutionException.class); + } + + @Test + public void givenExecutorIsTerminating_WhenSubmittedNewTask_ThenTheSaturationPolicyApplies() { + ThreadPoolExecutor executor = new ThreadPoolExecutor(1, 1, 0, MILLISECONDS, new LinkedBlockingQueue<>()); + executor.execute(() -> waitFor(100)); + executor.shutdown(); + + assertThatThrownBy(() -> executor.execute(() -> { + })).isInstanceOf(RejectedExecutionException.class); + } + + private static class GrowPolicy implements RejectedExecutionHandler { + + private final Lock lock = new ReentrantLock(); + + @Override + public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { + lock.lock(); + try { + executor.setMaximumPoolSize(executor.getMaximumPoolSize() + 1); + } finally { + lock.unlock(); + } + + executor.submit(r); + } + } + + private void waitFor(int millis) { + try { + Thread.sleep(millis); + } catch (InterruptedException ignored) { + } + } +} diff --git a/core-java-modules/core-java-concurrency-advanced/pom.xml b/core-java-modules/core-java-concurrency-advanced/pom.xml index 4a9ee30d65..65ca811737 100644 --- a/core-java-modules/core-java-concurrency-advanced/pom.xml +++ b/core-java-modules/core-java-concurrency-advanced/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>core-java-concurrency-advanced</artifactId> <version>0.1.0-SNAPSHOT</version> <name>core-java-concurrency-advanced</name> diff --git a/core-java-modules/core-java-concurrency-basic-2/README.md b/core-java-modules/core-java-concurrency-basic-2/README.md index e72725b7cb..e3f7a94e14 100644 --- a/core-java-modules/core-java-concurrency-basic-2/README.md +++ b/core-java-modules/core-java-concurrency-basic-2/README.md @@ -1,6 +1,6 @@ -========= +## Core Java Concurrency Basic -## Core Java Concurrency Basic 2 Examples +This module contains articles about basic Java concurrency ### Relevant Articles: - [How to Delay Code Execution in Java](https://www.baeldung.com/java-delay-code-execution) @@ -8,3 +8,4 @@ - [Difference Between Wait and Sleep in Java](https://www.baeldung.com/java-wait-and-sleep) - [Guide to the Synchronized Keyword in Java](https://www.baeldung.com/java-synchronized) - [Life Cycle of a Thread in Java](https://www.baeldung.com/java-thread-lifecycle) +- [[<-- Prev]](/core-java-modules/core-java-concurrency-basic) \ No newline at end of file diff --git a/core-java-modules/core-java-concurrency-basic-2/pom.xml b/core-java-modules/core-java-concurrency-basic-2/pom.xml index 396447ff75..0fee2c04ff 100644 --- a/core-java-modules/core-java-concurrency-basic-2/pom.xml +++ b/core-java-modules/core-java-concurrency-basic-2/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-concurrency-basic-2</artifactId> <version>0.1.0-SNAPSHOT</version> @@ -13,9 +14,6 @@ <relativePath>../../parent-java</relativePath> </parent> - <dependencies> - </dependencies> - <build> <finalName>core-java-concurrency-basic-2</finalName> <resources> diff --git a/core-java-modules/core-java-concurrency-basic/pom.xml b/core-java-modules/core-java-concurrency-basic/pom.xml index 93b8523eb4..9d9d2cb663 100644 --- a/core-java-modules/core-java-concurrency-basic/pom.xml +++ b/core-java-modules/core-java-concurrency-basic/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-concurrency-basic</artifactId> <version>0.1.0-SNAPSHOT</version> diff --git a/core-java-modules/core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/threadsafety/CounterUnitTest.java b/core-java-modules/core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/threadsafety/CounterUnitTest.java index 6761b05282..d8f8ff2b7d 100644 --- a/core-java-modules/core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/threadsafety/CounterUnitTest.java +++ b/core-java-modules/core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/threadsafety/CounterUnitTest.java @@ -18,8 +18,11 @@ public class CounterUnitTest { Counter counter = new Counter(); Future<Integer> future1 = (Future<Integer>) executorService.submit(new CounterCallable(counter)); Future<Integer> future2 = (Future<Integer>) executorService.submit(new CounterCallable(counter)); - - assertThat(future1.get()).isEqualTo(1); - assertThat(future2.get()).isEqualTo(2); + + // Just to make sure both are completed + future1.get(); + future2.get(); + + assertThat(counter.getCounter()).isEqualTo(2); } } diff --git a/core-java-modules/core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/threadsafety/ExtrinsicLockCounterUnitTest.java b/core-java-modules/core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/threadsafety/ExtrinsicLockCounterUnitTest.java index 2dcb846bf4..0fc3dd3a54 100644 --- a/core-java-modules/core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/threadsafety/ExtrinsicLockCounterUnitTest.java +++ b/core-java-modules/core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/threadsafety/ExtrinsicLockCounterUnitTest.java @@ -18,8 +18,11 @@ public class ExtrinsicLockCounterUnitTest { ExtrinsicLockCounter counter = new ExtrinsicLockCounter(); Future<Integer> future1 = (Future<Integer>) executorService.submit(new ExtrinsicLockCounterCallable(counter)); Future<Integer> future2 = (Future<Integer>) executorService.submit(new ExtrinsicLockCounterCallable(counter)); - - assertThat(future1.get()).isEqualTo(1); - assertThat(future2.get()).isEqualTo(2); + + // Just to make sure both are completed + future1.get(); + future2.get(); + + assertThat(counter.getCounter()).isEqualTo(2); } } diff --git a/core-java-modules/core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/threadsafety/ReentrantLockCounterUnitTest.java b/core-java-modules/core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/threadsafety/ReentrantLockCounterUnitTest.java index 330d2d4c86..9932aa9bbc 100644 --- a/core-java-modules/core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/threadsafety/ReentrantLockCounterUnitTest.java +++ b/core-java-modules/core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/threadsafety/ReentrantLockCounterUnitTest.java @@ -11,15 +11,18 @@ import java.util.concurrent.Future; import static org.assertj.core.api.Assertions.assertThat; public class ReentrantLockCounterUnitTest { - + @Test public void whenCalledIncrementCounter_thenCorrect() throws Exception { ExecutorService executorService = Executors.newFixedThreadPool(2); ReentrantLockCounter counter = new ReentrantLockCounter(); Future<Integer> future1 = (Future<Integer>) executorService.submit(new ReentrantLockCounterCallable(counter)); Future<Integer> future2 = (Future<Integer>) executorService.submit(new ReentrantLockCounterCallable(counter)); - - assertThat(future1.get()).isEqualTo(1); - assertThat(future2.get()).isEqualTo(2); + + // Just to make sure both are completed + future1.get(); + future2.get(); + + assertThat(counter.getCounter()).isEqualTo(2); } } diff --git a/core-java-modules/core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/threadsafety/ReentrantReadWriteLockCounterUnitTest.java b/core-java-modules/core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/threadsafety/ReentrantReadWriteLockCounterUnitTest.java index 71fad2c87f..c82cd39074 100644 --- a/core-java-modules/core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/threadsafety/ReentrantReadWriteLockCounterUnitTest.java +++ b/core-java-modules/core-java-concurrency-basic/src/test/java/com/baeldung/concurrent/threadsafety/ReentrantReadWriteLockCounterUnitTest.java @@ -11,16 +11,19 @@ import java.util.concurrent.Future; import static org.assertj.core.api.Assertions.assertThat; public class ReentrantReadWriteLockCounterUnitTest { - + @Test public void whenCalledIncrementCounter_thenCorrect() throws Exception { ExecutorService executorService = Executors.newFixedThreadPool(2); ReentrantReadWriteLockCounter counter = new ReentrantReadWriteLockCounter(); - Future<Integer> future1 = (Future<Integer>) executorService.submit(new ReentranReadWriteLockCounterCallable(counter)); - Future<Integer> future2 = (Future<Integer>) executorService.submit(new ReentranReadWriteLockCounterCallable(counter)); + Future<Integer> future1 = (Future<Integer>) executorService.submit(new ReentranReadWriteLockCounterCallable(counter)); + Future<Integer> future2 = (Future<Integer>) executorService.submit(new ReentranReadWriteLockCounterCallable(counter)); - assertThat(future2.get()).isEqualTo(2); - assertThat(future1.get()).isEqualTo(1); + // Just to make sure both are completed + future1.get(); + future2.get(); + + assertThat(counter.getCounter()).isEqualTo(2); } - + } diff --git a/core-java-modules/core-java-concurrency-collections/pom.xml b/core-java-modules/core-java-concurrency-collections/pom.xml index 0d3a6042ac..f731b1acd1 100644 --- a/core-java-modules/core-java-concurrency-collections/pom.xml +++ b/core-java-modules/core-java-concurrency-collections/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-concurrency-collections</artifactId> <version>0.1.0-SNAPSHOT</version> diff --git a/core-java-modules/core-java-date-operations/README.md b/core-java-modules/core-java-date-operations/README.md new file mode 100644 index 0000000000..24bb493dce --- /dev/null +++ b/core-java-modules/core-java-date-operations/README.md @@ -0,0 +1,8 @@ +## Core Date Operations +This module contains articles about date operations in Java. + +### Relevant Articles: +- [Get the Current Date Prior to Java 8](https://www.baeldung.com/java-get-the-current-date-legacy) +- [Skipping Weekends While Adding Days to LocalDate in Java 8](https://www.baeldung.com/java-localdate-add-days-skip-weekends) +- [Checking If Two Java Dates Are on the Same Day](https://www.baeldung.com/java-check-two-dates-on-same-day) +- [Converting Java Date to OffsetDateTime](https://www.baeldung.com/java-convert-date-to-offsetdatetime) diff --git a/core-java-modules/core-java-date-operations/pom.xml b/core-java-modules/core-java-date-operations/pom.xml index f6e75ca518..4d267964ee 100644 --- a/core-java-modules/core-java-date-operations/pom.xml +++ b/core-java-modules/core-java-date-operations/pom.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-date-operations</artifactId> <version>${project.parent.version}</version> + <name>core-java-date-operations</name> <packaging>jar</packaging> <parent> @@ -14,4 +15,27 @@ <relativePath>../../parent-java</relativePath> </parent> + <dependencies> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>${commons-lang3.version}</version> + </dependency> + <dependency> + <groupId>joda-time</groupId> + <artifactId>joda-time</artifactId> + <version>${joda-time.version}</version> + </dependency> + <dependency> + <groupId>com.darwinsys</groupId> + <artifactId>hirondelle-date4j</artifactId> + <version>${hirondelle-date4j.version}</version> + </dependency> + </dependencies> + + <properties> + <joda-time.version>2.10</joda-time.version> + <hirondelle-date4j.version>1.5.1</hirondelle-date4j.version> + </properties> + </project> \ No newline at end of file diff --git a/core-java-modules/core-java-date-operations/src/main/java/com/baeldung/date/comparison/DateComparisonUtils.java b/core-java-modules/core-java-date-operations/src/main/java/com/baeldung/date/comparison/DateComparisonUtils.java new file mode 100644 index 0000000000..ae8d21c29c --- /dev/null +++ b/core-java-modules/core-java-date-operations/src/main/java/com/baeldung/date/comparison/DateComparisonUtils.java @@ -0,0 +1,55 @@ +package com.baeldung.date.comparison; + +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.ZoneId; +import java.util.Calendar; +import java.util.Date; +import java.util.TimeZone; + +import org.apache.commons.lang3.time.DateUtils; + +import hirondelle.date4j.DateTime; + +public class DateComparisonUtils { + + public static boolean isSameDayUsingLocalDate(Date date1, Date date2) { + LocalDate localDate1 = date1.toInstant() + .atZone(ZoneId.systemDefault()) + .toLocalDate(); + LocalDate localDate2 = date2.toInstant() + .atZone(ZoneId.systemDefault()) + .toLocalDate(); + return localDate1.isEqual(localDate2); + } + + public static boolean isSameDayUsingSimpleDateFormat(Date date1, Date date2) { + SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd"); + return fmt.format(date1) + .equals(fmt.format(date2)); + } + + public static boolean isSameDayUsingCalendar(Date date1, Date date2) { + Calendar calendar1 = Calendar.getInstance(); + calendar1.setTime(date1); + Calendar calendar2 = Calendar.getInstance(); + calendar2.setTime(date2); + return calendar1.get(Calendar.YEAR) == calendar2.get(Calendar.YEAR) && calendar1.get(Calendar.MONTH) == calendar2.get(Calendar.MONTH) && calendar1.get(Calendar.DAY_OF_MONTH) == calendar2.get(Calendar.DAY_OF_MONTH); + } + + public static boolean isSameDayUsingApacheCommons(Date date1, Date date2) { + return DateUtils.isSameDay(date1, date2); + } + + public static boolean isSameDayUsingJoda(Date date1, Date date2) { + org.joda.time.LocalDate localDate1 = new org.joda.time.LocalDate(date1); + org.joda.time.LocalDate localDate2 = new org.joda.time.LocalDate(date2); + return localDate1.equals(localDate2); + } + + public static boolean isSameDayUsingDate4j(Date date1, Date date2) { + DateTime dateObject1 = DateTime.forInstant(date1.getTime(), TimeZone.getDefault()); + DateTime dateObject2 = DateTime.forInstant(date2.getTime(), TimeZone.getDefault()); + return dateObject1.isSameDayAs(dateObject2); + } +} diff --git a/java-dates-2/src/main/java/com/baeldung/date/conversion/ConvertToOffsetDateTime.java b/core-java-modules/core-java-date-operations/src/main/java/com/baeldung/offsetdatetime/ConvertToOffsetDateTime.java similarity index 92% rename from java-dates-2/src/main/java/com/baeldung/date/conversion/ConvertToOffsetDateTime.java rename to core-java-modules/core-java-date-operations/src/main/java/com/baeldung/offsetdatetime/ConvertToOffsetDateTime.java index 34914962f9..defd0a335e 100644 --- a/java-dates-2/src/main/java/com/baeldung/date/conversion/ConvertToOffsetDateTime.java +++ b/core-java-modules/core-java-date-operations/src/main/java/com/baeldung/offsetdatetime/ConvertToOffsetDateTime.java @@ -1,4 +1,4 @@ -package com.baeldung.date.conversion; +package com.baeldung.offsetdatetime; import java.time.OffsetDateTime; import java.time.ZoneOffset; diff --git a/core-java-modules/core-java-date-operations/src/main/java/com/baeldung/datetime/AddSubtractDaysSkippingWeekendsUtils.java b/core-java-modules/core-java-date-operations/src/main/java/com/baeldung/skipweekends/AddSubtractDaysSkippingWeekendsUtils.java similarity index 96% rename from core-java-modules/core-java-date-operations/src/main/java/com/baeldung/datetime/AddSubtractDaysSkippingWeekendsUtils.java rename to core-java-modules/core-java-date-operations/src/main/java/com/baeldung/skipweekends/AddSubtractDaysSkippingWeekendsUtils.java index bf32fdb79a..94adfa0c9d 100644 --- a/core-java-modules/core-java-date-operations/src/main/java/com/baeldung/datetime/AddSubtractDaysSkippingWeekendsUtils.java +++ b/core-java-modules/core-java-date-operations/src/main/java/com/baeldung/skipweekends/AddSubtractDaysSkippingWeekendsUtils.java @@ -1,4 +1,4 @@ -package com.baeldung.datetime; +package com.baeldung.skipweekends; import java.time.DayOfWeek; import java.time.LocalDate; diff --git a/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/date/comparison/DateComparisonUtilsUnitTest.java b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/date/comparison/DateComparisonUtilsUnitTest.java new file mode 100644 index 0000000000..db55aadcca --- /dev/null +++ b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/date/comparison/DateComparisonUtilsUnitTest.java @@ -0,0 +1,53 @@ +package com.baeldung.date.comparison; + +import org.junit.Test; + +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.Date; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class DateComparisonUtilsUnitTest { + + private Date day1Morning = toDate(LocalDateTime.of(2019, 10, 19, 6, 30, 40)); + private Date day1Evening = toDate(LocalDateTime.of(2019, 10, 19, 18, 30, 50)); + private Date day2Morning = toDate(LocalDateTime.of(2019, 10, 20, 6, 30, 50)); + + private Date toDate(LocalDateTime localDateTime) { + return Date.from(localDateTime.atZone(ZoneId.systemDefault()) + .toInstant()); + } + + @Test + public void givenDatesWithDifferentTime_whenIsSameDay_thenReturnsTrue() { + assertTrue(DateComparisonUtils.isSameDayUsingLocalDate(day1Morning, day1Evening)); + assertTrue(DateComparisonUtils.isSameDayUsingSimpleDateFormat(day1Morning, day1Evening)); + assertTrue(DateComparisonUtils.isSameDayUsingCalendar(day1Morning, day1Evening)); + assertTrue(DateComparisonUtils.isSameDayUsingApacheCommons(day1Morning, day1Evening)); + assertTrue(DateComparisonUtils.isSameDayUsingJoda(day1Morning, day1Evening)); + assertTrue(DateComparisonUtils.isSameDayUsingDate4j(day1Morning, day1Evening)); + } + + @Test + public void givenDates_whenIsDifferentDay_thenReturnsFalse() { + assertFalse(DateComparisonUtils.isSameDayUsingLocalDate(day1Morning, day2Morning)); + assertFalse(DateComparisonUtils.isSameDayUsingLocalDate(day1Evening, day2Morning)); + + assertFalse(DateComparisonUtils.isSameDayUsingSimpleDateFormat(day1Morning, day2Morning)); + assertFalse(DateComparisonUtils.isSameDayUsingSimpleDateFormat(day1Evening, day2Morning)); + + assertFalse(DateComparisonUtils.isSameDayUsingCalendar(day1Morning, day2Morning)); + assertFalse(DateComparisonUtils.isSameDayUsingCalendar(day1Evening, day2Morning)); + + assertFalse(DateComparisonUtils.isSameDayUsingApacheCommons(day1Morning, day2Morning)); + assertFalse(DateComparisonUtils.isSameDayUsingApacheCommons(day1Evening, day2Morning)); + + assertFalse(DateComparisonUtils.isSameDayUsingJoda(day1Morning, day2Morning)); + assertFalse(DateComparisonUtils.isSameDayUsingJoda(day1Evening, day2Morning)); + + assertFalse(DateComparisonUtils.isSameDayUsingDate4j(day1Morning, day2Morning)); + assertFalse(DateComparisonUtils.isSameDayUsingDate4j(day1Evening, day2Morning)); + } +} diff --git a/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/datetime/CalendarUtilsUnitTest.java b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/datetime/CalendarUtilsUnitTest.java index 0060162ffb..8c9ed695d7 100644 --- a/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/datetime/CalendarUtilsUnitTest.java +++ b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/datetime/CalendarUtilsUnitTest.java @@ -1,15 +1,12 @@ package com.baeldung.datetime; -import static org.junit.Assert.assertEquals; - import org.junit.Test; -import com.baeldung.datetime.CalendarUtils; -import com.baeldung.datetime.DateUtils; - import java.text.ParseException; import java.util.Date; +import static org.junit.Assert.assertEquals; + public class CalendarUtilsUnitTest { @Test diff --git a/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/datetime/DateUtilsUnitTest.java b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/datetime/DateUtilsUnitTest.java index 62a0fc0b4b..8711455265 100644 --- a/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/datetime/DateUtilsUnitTest.java +++ b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/datetime/DateUtilsUnitTest.java @@ -1,14 +1,12 @@ package com.baeldung.datetime; -import static org.junit.Assert.assertEquals; - import org.junit.Test; -import com.baeldung.datetime.DateUtils; - import java.text.ParseException; import java.util.Date; +import static org.junit.Assert.assertEquals; + public class DateUtilsUnitTest { @Test diff --git a/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/datetime/sql/DateUtilsUnitTest.java b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/datetime/sql/DateUtilsUnitTest.java index a04f64f6dd..945086c86f 100644 --- a/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/datetime/sql/DateUtilsUnitTest.java +++ b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/datetime/sql/DateUtilsUnitTest.java @@ -2,18 +2,16 @@ package com.baeldung.datetime.sql; import static org.junit.Assert.assertEquals; -import org.junit.Test; - -import com.baeldung.datetime.sql.DateUtils; - import java.text.ParseException; -import java.util.Date; +import java.time.LocalDate; + +import org.junit.Test; public class DateUtilsUnitTest { @Test public void givenCurrentDate_thenTodayIsReturned() { - assertEquals(DateUtils.getNow(), new Date()); + assertEquals(DateUtils.getNow().toLocalDate(), LocalDate.now()); } @Test(expected = IllegalArgumentException.class) diff --git a/java-dates-2/src/test/java/com/baeldung/date/conversion/ConvertToOffsetDateTimeUnitTest.java b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/offsetdatetime/ConvertToOffsetDateTimeUnitTest.java similarity index 95% rename from java-dates-2/src/test/java/com/baeldung/date/conversion/ConvertToOffsetDateTimeUnitTest.java rename to core-java-modules/core-java-date-operations/src/test/java/com/baeldung/offsetdatetime/ConvertToOffsetDateTimeUnitTest.java index c927da00c8..a6fd6c03c2 100644 --- a/java-dates-2/src/test/java/com/baeldung/date/conversion/ConvertToOffsetDateTimeUnitTest.java +++ b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/offsetdatetime/ConvertToOffsetDateTimeUnitTest.java @@ -1,12 +1,12 @@ -package com.baeldung.date.conversion; +package com.baeldung.offsetdatetime; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import org.junit.Test; import java.time.OffsetDateTime; import java.util.Date; -import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; public class ConvertToOffsetDateTimeUnitTest { diff --git a/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/datetime/AddSubtractDaysSkippingWeekendsUtilsUnitTest.java b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/skipweekends/AddSubtractDaysSkippingWeekendsUtilsUnitTest.java similarity index 89% rename from core-java-modules/core-java-date-operations/src/test/java/com/baeldung/datetime/AddSubtractDaysSkippingWeekendsUtilsUnitTest.java rename to core-java-modules/core-java-date-operations/src/test/java/com/baeldung/skipweekends/AddSubtractDaysSkippingWeekendsUtilsUnitTest.java index d60a0f4015..76bd9f4558 100644 --- a/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/datetime/AddSubtractDaysSkippingWeekendsUtilsUnitTest.java +++ b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/skipweekends/AddSubtractDaysSkippingWeekendsUtilsUnitTest.java @@ -1,7 +1,8 @@ -package com.baeldung.datetime; +package com.baeldung.skipweekends; import static org.junit.Assert.assertEquals; +import com.baeldung.skipweekends.AddSubtractDaysSkippingWeekendsUtils; import org.junit.Test; import java.time.LocalDate; diff --git a/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/timezone/ModifyDefaultTimezoneUnitTest.java b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/timezone/ModifyDefaultTimezoneUnitTest.java new file mode 100644 index 0000000000..05d36d2c6c --- /dev/null +++ b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/timezone/ModifyDefaultTimezoneUnitTest.java @@ -0,0 +1,22 @@ +package com.baeldung.timezone; + +import org.junit.Test; + +import java.util.Calendar; +import java.util.Date; +import java.util.TimeZone; + +import static org.junit.Assert.assertEquals; + +public class ModifyDefaultTimezoneUnitTest { + + @Test + public void givenDefaultTimezoneSet_thenDateTimezoneIsCorrect() { + TimeZone.setDefault(TimeZone.getTimeZone("Portugal")); + Date date = new Date(); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + assertEquals(calendar.getTimeZone(), TimeZone.getTimeZone("Portugal")); + } + +} diff --git a/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/timezone/ModifyTimezonePropertyUnitTest.java b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/timezone/ModifyTimezonePropertyUnitTest.java new file mode 100644 index 0000000000..8f65f520f8 --- /dev/null +++ b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/timezone/ModifyTimezonePropertyUnitTest.java @@ -0,0 +1,34 @@ +package com.baeldung.timezone; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.util.Calendar; +import java.util.Date; +import java.util.TimeZone; + +import static org.junit.Assert.assertEquals; + +public class ModifyTimezonePropertyUnitTest { + + @Before + public void setup() { + System.setProperty("user.timezone", "IST"); + TimeZone.setDefault(null); + } + + @After + public void teardown() { + System.clearProperty("user.timezone"); + } + + @Test + public void givenTimezonePropertySet_thenDateTimezoneIsCorrect() { + Date date = new Date(); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + assertEquals(calendar.getTimeZone(), TimeZone.getTimeZone("IST")); + } + +} \ No newline at end of file diff --git a/core-java-modules/core-java-datetime-computations/pom.xml b/core-java-modules/core-java-datetime-computations/pom.xml index 934df8018f..af6b110296 100644 --- a/core-java-modules/core-java-datetime-computations/pom.xml +++ b/core-java-modules/core-java-datetime-computations/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-datetime-computations</artifactId> <version>${project.parent.version}</version> @@ -68,4 +69,5 @@ <maven.compiler.source>1.9</maven.compiler.source> <maven.compiler.target>1.9</maven.compiler.target> </properties> + </project> diff --git a/core-java-modules/core-java-datetime-conversion/pom.xml b/core-java-modules/core-java-datetime-conversion/pom.xml index a93eca00af..e2b143aa88 100644 --- a/core-java-modules/core-java-datetime-conversion/pom.xml +++ b/core-java-modules/core-java-datetime-conversion/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-datetime-conversion</artifactId> <version>${project.parent.version}</version> @@ -64,7 +65,8 @@ <joda-time.version>2.10</joda-time.version> <!-- testing --> <assertj.version>3.6.1</assertj.version> - <maven.compiler.source>1.9</maven.compiler.source> + <maven.compiler.source>1.9</maven.compiler.source> <maven.compiler.target>1.9</maven.compiler.target> </properties> + </project> diff --git a/core-java-modules/core-java-datetime-java8/README.md b/core-java-modules/core-java-datetime-java8/README.md index 044f6f3fe3..dfbe9c997f 100644 --- a/core-java-modules/core-java-datetime-java8/README.md +++ b/core-java-modules/core-java-datetime-java8/README.md @@ -13,3 +13,4 @@ This module contains articles about the Date and Time API introduced with Java 8 - [How to Get the Start and the End of a Day using Java](http://www.baeldung.com/java-day-start-end) - [Set the Time Zone of a Date in Java](https://www.baeldung.com/java-set-date-time-zone) - [Comparing Dates in Java](https://www.baeldung.com/java-comparing-dates) +- [Generating Random Dates in Java](https://www.baeldung.com/java-random-dates) diff --git a/core-java-modules/core-java-datetime-java8/pom.xml b/core-java-modules/core-java-datetime-java8/pom.xml index 72d51b5f10..34323fe76c 100644 --- a/core-java-modules/core-java-datetime-java8/pom.xml +++ b/core-java-modules/core-java-datetime-java8/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-datetime-java8</artifactId> <version>${project.parent.version}</version> @@ -61,10 +62,11 @@ </build> <properties> - <maven.compiler.source>1.9</maven.compiler.source> + <maven.compiler.source>1.9</maven.compiler.source> <maven.compiler.target>1.9</maven.compiler.target> <joda-time.version>2.10</joda-time.version> <!-- testing --> <assertj.version>3.6.1</assertj.version> </properties> + </project> diff --git a/java-dates/src/main/java/com/baeldung/datetime/UseDateTimeFormatter.java b/core-java-modules/core-java-datetime-java8/src/main/java/com/baeldung/datetime/UseDateTimeFormatter.java similarity index 100% rename from java-dates/src/main/java/com/baeldung/datetime/UseDateTimeFormatter.java rename to core-java-modules/core-java-datetime-java8/src/main/java/com/baeldung/datetime/UseDateTimeFormatter.java diff --git a/java-dates/src/main/java/com/baeldung/datetime/UseOffsetDateTime.java b/core-java-modules/core-java-datetime-java8/src/main/java/com/baeldung/datetime/UseOffsetDateTime.java similarity index 100% rename from java-dates/src/main/java/com/baeldung/datetime/UseOffsetDateTime.java rename to core-java-modules/core-java-datetime-java8/src/main/java/com/baeldung/datetime/UseOffsetDateTime.java diff --git a/java-dates/src/test/java/com/baeldung/datetime/UseDateTimeFormatterUnitTest.java b/core-java-modules/core-java-datetime-java8/src/test/java/com/baeldung/datetime/UseDateTimeFormatterUnitTest.java similarity index 100% rename from java-dates/src/test/java/com/baeldung/datetime/UseDateTimeFormatterUnitTest.java rename to core-java-modules/core-java-datetime-java8/src/test/java/com/baeldung/datetime/UseDateTimeFormatterUnitTest.java diff --git a/java-dates/src/test/java/com/baeldung/datetime/UseOffsetDateTimeUnitTest.java b/core-java-modules/core-java-datetime-java8/src/test/java/com/baeldung/datetime/UseOffsetDateTimeUnitTest.java similarity index 100% rename from java-dates/src/test/java/com/baeldung/datetime/UseOffsetDateTimeUnitTest.java rename to core-java-modules/core-java-datetime-java8/src/test/java/com/baeldung/datetime/UseOffsetDateTimeUnitTest.java diff --git a/java-dates/src/test/java/com/baeldung/datetime/UseToInstantUnitTest.java b/core-java-modules/core-java-datetime-java8/src/test/java/com/baeldung/datetime/UseToInstantUnitTest.java similarity index 100% rename from java-dates/src/test/java/com/baeldung/datetime/UseToInstantUnitTest.java rename to core-java-modules/core-java-datetime-java8/src/test/java/com/baeldung/datetime/UseToInstantUnitTest.java diff --git a/core-java-modules/core-java-datetime-string/pom.xml b/core-java-modules/core-java-datetime-string/pom.xml index b4e7aff524..dd793f7fe8 100644 --- a/core-java-modules/core-java-datetime-string/pom.xml +++ b/core-java-modules/core-java-datetime-string/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-datetime-string</artifactId> <version>${project.parent.version}</version> @@ -77,7 +78,8 @@ <joda-time.version>2.10</joda-time.version> <!-- testing --> <assertj.version>3.6.1</assertj.version> - <maven.compiler.source>1.9</maven.compiler.source> + <maven.compiler.source>1.9</maven.compiler.source> <maven.compiler.target>1.9</maven.compiler.target> </properties> + </project> diff --git a/core-java-modules/core-java-exceptions-2/README.md b/core-java-modules/core-java-exceptions-2/README.md new file mode 100644 index 0000000000..3ad5189b5e --- /dev/null +++ b/core-java-modules/core-java-exceptions-2/README.md @@ -0,0 +1,5 @@ +## Core Java Exceptions 2 + +This module contains articles about core java exceptions + +### diff --git a/core-java-modules/core-java-exceptions-2/pom.xml b/core-java-modules/core-java-exceptions-2/pom.xml new file mode 100644 index 0000000000..2f7f613faf --- /dev/null +++ b/core-java-modules/core-java-exceptions-2/pom.xml @@ -0,0 +1,24 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <artifactId>core-java-exceptions-2</artifactId> + <name>core-java-exceptions-2</name> + <packaging>jar</packaging> + + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-java</artifactId> + <version>0.0.1-SNAPSHOT</version> + <relativePath>../../parent-java</relativePath> + </parent> + + <description> </description> + <url>http://maven.apache.org</url> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + +</project> diff --git a/core-java-modules/core-java-exceptions-2/src/main/java/com/baeldung/rethrow/RethrowDifferentExceptionDemo.java b/core-java-modules/core-java-exceptions-2/src/main/java/com/baeldung/rethrow/RethrowDifferentExceptionDemo.java new file mode 100644 index 0000000000..ce2fcb2c7a --- /dev/null +++ b/core-java-modules/core-java-exceptions-2/src/main/java/com/baeldung/rethrow/RethrowDifferentExceptionDemo.java @@ -0,0 +1,29 @@ +package com.baeldung.rethrow; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.baeldung.rethrow.custom.InvalidDataException; + +public class RethrowDifferentExceptionDemo { + + private final static Logger LOGGER = Logger.getLogger(RethrowDifferentExceptionDemo.class.getName()); + + public static void main(String[] args) throws Exception { + String name = null; + + try { + + // Below line will throw NullPointerException + if (name.equals("Joe")) { + // Do blah blah.. + } + + } catch (Exception e) { + LOGGER.log(Level.WARNING, "So and so user is unable to cast vote because he is found uneligible"); + throw new InvalidDataException(e); + } + + } + +} diff --git a/core-java-modules/core-java-exceptions-2/src/main/java/com/baeldung/rethrow/RethrowSameExceptionDemo.java b/core-java-modules/core-java-exceptions-2/src/main/java/com/baeldung/rethrow/RethrowSameExceptionDemo.java new file mode 100644 index 0000000000..bf53f67d34 --- /dev/null +++ b/core-java-modules/core-java-exceptions-2/src/main/java/com/baeldung/rethrow/RethrowSameExceptionDemo.java @@ -0,0 +1,27 @@ +package com.baeldung.rethrow; + +import java.util.logging.Level; +import java.util.logging.Logger; + +public class RethrowSameExceptionDemo { + + private final static Logger LOGGER = Logger.getLogger(RethrowDifferentExceptionDemo.class.getName()); + + public static void main(String[] args) throws Exception { + String name = null; + + try { + + // Below line will throw NullPointerException + if (name.equals("Joe")) { + // Do blah blah.. + } + + } catch (Exception e) { + LOGGER.log(Level.WARNING, "Exception occurred due to invalid name"); + throw e; + } + + } + +} diff --git a/core-java-modules/core-java-exceptions-2/src/main/java/com/baeldung/rethrow/custom/InvalidDataException.java b/core-java-modules/core-java-exceptions-2/src/main/java/com/baeldung/rethrow/custom/InvalidDataException.java new file mode 100644 index 0000000000..5a74e32012 --- /dev/null +++ b/core-java-modules/core-java-exceptions-2/src/main/java/com/baeldung/rethrow/custom/InvalidDataException.java @@ -0,0 +1,8 @@ +package com.baeldung.rethrow.custom; + +public class InvalidDataException extends Exception { + + public InvalidDataException(Exception e) { + super(e); + } +} diff --git a/core-java-modules/core-java-exceptions/README.md b/core-java-modules/core-java-exceptions/README.md index f7b0c37e73..b7222540e9 100644 --- a/core-java-modules/core-java-exceptions/README.md +++ b/core-java-modules/core-java-exceptions/README.md @@ -15,5 +15,6 @@ This module contains articles about core java exceptions - [Java – Try with Resources](https://www.baeldung.com/java-try-with-resources) - [Java Global Exception Handler](https://www.baeldung.com/java-global-exception-handler) - [Common Java Exceptions](https://www.baeldung.com/java-common-exceptions) -- [Throw Exception in Optional in Java 8](https://www.baeldung.com/java-optional-throw-exception) - [How to Find an Exception’s Root Cause in Java](https://www.baeldung.com/java-exception-root-cause) +- [Is It a Bad Practice to Catch Throwable?](https://www.baeldung.com/java-catch-throwable-bad-practice) +- [[Next -->]](/core-java-modules/core-java-exceptions-2) \ No newline at end of file diff --git a/core-java-modules/core-java-exceptions/pom.xml b/core-java-modules/core-java-exceptions/pom.xml index da5ec76622..303a09d5b7 100644 --- a/core-java-modules/core-java-exceptions/pom.xml +++ b/core-java-modules/core-java-exceptions/pom.xml @@ -2,8 +2,8 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <groupId>com.baeldung.exceptions</groupId> <modelVersion>4.0.0</modelVersion> + <groupId>com.baeldung.exceptions</groupId> <artifactId>core-java-exceptions</artifactId> <version>0.1.0-SNAPSHOT</version> <name>core-java-exceptions</name> diff --git a/core-java-modules/core-java-function/pom.xml b/core-java-modules/core-java-function/pom.xml index 22b2fd9bda..0e61f73c84 100644 --- a/core-java-modules/core-java-function/pom.xml +++ b/core-java-modules/core-java-function/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -37,4 +38,5 @@ <!-- testing --> <assertj.version>3.6.1</assertj.version> </properties> + </project> diff --git a/core-java-modules/core-java-io-2/pom.xml b/core-java-modules/core-java-io-2/pom.xml index dd0f8931c3..0c271737d9 100644 --- a/core-java-modules/core-java-io-2/pom.xml +++ b/core-java-modules/core-java-io-2/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-io-2</artifactId> <version>0.1.0-SNAPSHOT</version> diff --git a/core-java-modules/core-java-io-apis/pom.xml b/core-java-modules/core-java-io-apis/pom.xml index 0eab844681..6eb869c537 100644 --- a/core-java-modules/core-java-io-apis/pom.xml +++ b/core-java-modules/core-java-io-apis/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-io-apis</artifactId> <version>0.1.0-SNAPSHOT</version> diff --git a/core-java-modules/core-java-io-apis/src/test/java/com/baeldung/file/FileClassUnitTest.java b/core-java-modules/core-java-io-apis/src/test/java/com/baeldung/file/FileClassUnitTest.java index 57e12560bb..a4317af372 100644 --- a/core-java-modules/core-java-io-apis/src/test/java/com/baeldung/file/FileClassUnitTest.java +++ b/core-java-modules/core-java-io-apis/src/test/java/com/baeldung/file/FileClassUnitTest.java @@ -156,10 +156,16 @@ public class FileClassUnitTest { private static File makeDir(String name) { File directory = new File(name); - directory.mkdir(); - if (directory.isDirectory()) { + + // If the directory already exists, make sure we create it 'from scratch', i.e. all the files inside are deleted first + if (directory.exists()) { + removeDir(directory); + } + + if (directory.mkdir()) { return directory; } + throw new RuntimeException("'" + name + "' not made!"); } diff --git a/core-java-modules/core-java-io-conversions/pom.xml b/core-java-modules/core-java-io-conversions/pom.xml index 186dde2721..c3a1b2fe2d 100644 --- a/core-java-modules/core-java-io-conversions/pom.xml +++ b/core-java-modules/core-java-io-conversions/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-io-conversions</artifactId> <version>0.1.0-SNAPSHOT</version> diff --git a/core-java-modules/core-java-io/pom.xml b/core-java-modules/core-java-io/pom.xml index 0244011f78..1c568a610d 100644 --- a/core-java-modules/core-java-io/pom.xml +++ b/core-java-modules/core-java-io/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-io</artifactId> <version>0.1.0-SNAPSHOT</version> @@ -72,7 +73,7 @@ <argument>-Xmx300m</argument> <argument>-XX:+UseParallelGC</argument> <argument>-classpath</argument> - <classpath /> + <classpath/> <argument>com.baeldung.outofmemoryerror.OutOfMemoryGCLimitExceed</argument> </arguments> </configuration> @@ -86,7 +87,7 @@ <target>${maven.compiler.target}</target> </configuration> </plugin> - + <plugin> <!-- Build an executable JAR --> <groupId>org.apache.maven.plugins</groupId> @@ -126,7 +127,7 @@ <executable>java</executable> <arguments> <argument>-classpath</argument> - <classpath /> + <classpath/> <argument>org.openjdk.jmh.Main</argument> <argument>.*</argument> </arguments> diff --git a/core-java-modules/core-java-jar/pom.xml b/core-java-modules/core-java-jar/pom.xml index cd86479d72..a3e8941622 100644 --- a/core-java-modules/core-java-jar/pom.xml +++ b/core-java-modules/core-java-jar/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -63,7 +64,7 @@ </dependencies> <build> - <finalName>core-java</finalName> + <finalName>core-java-jar</finalName> <resources> <resource> <directory>src/main/resources</directory> @@ -195,12 +196,12 @@ <argument>-Xmx300m</argument> <argument>-XX:+UseParallelGC</argument> <argument>-classpath</argument> - <classpath /> + <classpath/> <argument>com.baeldung.outofmemoryerror.OutOfMemoryGCLimitExceed</argument> </arguments> </configuration> </plugin> - + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> @@ -261,7 +262,7 @@ <executable>java</executable> <arguments> <argument>-classpath</argument> - <classpath /> + <classpath/> <argument>org.openjdk.jmh.Main</argument> <argument>.*</argument> </arguments> @@ -383,7 +384,7 @@ <!-- util --> <unix4j.version>0.4</unix4j.version> <grep4j.version>1.8.7</grep4j.version> - + <!-- testing --> <assertj-core.version>3.10.0</assertj-core.version> @@ -397,4 +398,5 @@ <spring-boot-maven-plugin.version>2.0.3.RELEASE</spring-boot-maven-plugin.version> <exec-maven-plugin.version>1.6.0</exec-maven-plugin.version> </properties> + </project> diff --git a/core-java-modules/core-java-jndi/pom.xml b/core-java-modules/core-java-jndi/pom.xml index 7f621af21d..13504886d6 100644 --- a/core-java-modules/core-java-jndi/pom.xml +++ b/core-java-modules/core-java-jndi/pom.xml @@ -3,7 +3,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung.jndi</groupId> <artifactId>core-java-jndi</artifactId> <version>1.0-SNAPSHOT</version> @@ -63,4 +62,5 @@ </plugin> </plugins> </build> + </project> diff --git a/core-java-modules/core-java-jpms/decoupling-pattern1/consumermodule/pom.xml b/core-java-modules/core-java-jpms/decoupling-pattern1/consumermodule/pom.xml index 059075318a..ddf52d8fef 100644 --- a/core-java-modules/core-java-jpms/decoupling-pattern1/consumermodule/pom.xml +++ b/core-java-modules/core-java-jpms/decoupling-pattern1/consumermodule/pom.xml @@ -1,24 +1,25 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>consumermodule</artifactId> - <packaging>jar</packaging> <version>1.0</version> - + <packaging>jar</packaging> + <parent> <groupId>com.baeldung.decoupling-pattern1</groupId> <artifactId>decoupling-pattern1</artifactId> <version>1.0</version> </parent> - + <dependencies> <dependency> <groupId>com.baeldung.servicemodule</groupId> <artifactId>servicemodule</artifactId> - <version>1.0</version> + <version>1.0</version> </dependency> </dependencies> - + <build> <plugins> <plugin> @@ -27,4 +28,5 @@ </plugin> </plugins> </build> + </project> diff --git a/core-java-modules/core-java-jpms/decoupling-pattern1/pom.xml b/core-java-modules/core-java-jpms/decoupling-pattern1/pom.xml index 282723e0a0..78a9d1eaad 100644 --- a/core-java-modules/core-java-jpms/decoupling-pattern1/pom.xml +++ b/core-java-modules/core-java-jpms/decoupling-pattern1/pom.xml @@ -1,18 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.decoupling-pattern1</groupId> <artifactId>decoupling-pattern1</artifactId> <version>1.0</version> <packaging>pom</packaging> - + <modules> <module>servicemodule</module> <module>consumermodule</module> </modules> - + <build> <pluginManagement> <plugins> @@ -28,8 +28,9 @@ </plugins> </pluginManagement> </build> - + <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> + </project> \ No newline at end of file diff --git a/core-java-modules/core-java-jpms/decoupling-pattern1/servicemodule/pom.xml b/core-java-modules/core-java-jpms/decoupling-pattern1/servicemodule/pom.xml index 1bda70f867..ece85fd5dc 100644 --- a/core-java-modules/core-java-jpms/decoupling-pattern1/servicemodule/pom.xml +++ b/core-java-modules/core-java-jpms/decoupling-pattern1/servicemodule/pom.xml @@ -1,17 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung.servicemodule</groupId> <artifactId>servicemodule</artifactId> <packaging>jar</packaging> - + <parent> <groupId>com.baeldung.decoupling-pattern1</groupId> <artifactId>decoupling-pattern1</artifactId> <version>1.0</version> </parent> - + <build> <plugins> <plugin> @@ -20,5 +20,5 @@ </plugin> </plugins> </build> - + </project> \ No newline at end of file diff --git a/core-java-modules/core-java-jpms/decoupling-pattern2/consumermodule/pom.xml b/core-java-modules/core-java-jpms/decoupling-pattern2/consumermodule/pom.xml index 09ca44d9be..734774af0e 100644 --- a/core-java-modules/core-java-jpms/decoupling-pattern2/consumermodule/pom.xml +++ b/core-java-modules/core-java-jpms/decoupling-pattern2/consumermodule/pom.xml @@ -8,8 +8,8 @@ <version>1.0</version> <parent> - <artifactId>com.baeldung.decoupling-pattern2</artifactId> <groupId>decoupling-pattern2</groupId> + <artifactId>com.baeldung.decoupling-pattern2</artifactId> <version>1.0-SNAPSHOT</version> </parent> diff --git a/core-java-modules/core-java-jpms/decoupling-pattern2/pom.xml b/core-java-modules/core-java-jpms/decoupling-pattern2/pom.xml index f8c05d40b8..2f84c69fd6 100644 --- a/core-java-modules/core-java-jpms/decoupling-pattern2/pom.xml +++ b/core-java-modules/core-java-jpms/decoupling-pattern2/pom.xml @@ -3,7 +3,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung.decoupling-pattern2</groupId> <artifactId>decoupling-pattern2</artifactId> <version>1.0-SNAPSHOT</version> diff --git a/core-java-modules/core-java-jpms/decoupling-pattern2/providermodule/pom.xml b/core-java-modules/core-java-jpms/decoupling-pattern2/providermodule/pom.xml index ceeda9049c..5ec36c581e 100644 --- a/core-java-modules/core-java-jpms/decoupling-pattern2/providermodule/pom.xml +++ b/core-java-modules/core-java-jpms/decoupling-pattern2/providermodule/pom.xml @@ -2,15 +2,14 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.providermodule</groupId> <artifactId>providermodule</artifactId> <version>1.0</version> <parent> - <artifactId>com.baeldung.decoupling-pattern2</artifactId> <groupId>decoupling-pattern2</groupId> + <artifactId>com.baeldung.decoupling-pattern2</artifactId> <version>1.0-SNAPSHOT</version> </parent> diff --git a/core-java-modules/core-java-jpms/decoupling-pattern2/servicemodule/pom.xml b/core-java-modules/core-java-jpms/decoupling-pattern2/servicemodule/pom.xml index 861f06f089..9249ea5d89 100644 --- a/core-java-modules/core-java-jpms/decoupling-pattern2/servicemodule/pom.xml +++ b/core-java-modules/core-java-jpms/decoupling-pattern2/servicemodule/pom.xml @@ -8,8 +8,8 @@ <version>1.0</version> <parent> - <artifactId>>com.baeldung.decoupling-pattern2</artifactId> <groupId>decoupling-pattern2</groupId> + <artifactId>>com.baeldung.decoupling-pattern2</artifactId> <version>1.0-SNAPSHOT</version> </parent> diff --git a/core-java-modules/core-java-jvm/pom.xml b/core-java-modules/core-java-jvm/pom.xml index 74960820d7..61c31ce82f 100644 --- a/core-java-modules/core-java-jvm/pom.xml +++ b/core-java-modules/core-java-jvm/pom.xml @@ -1,10 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-jvm</artifactId> <version>0.1.0-SNAPSHOT</version> - <packaging>jar</packaging> <name>core-java-jvm</name> + <packaging>jar</packaging> <parent> <groupId>com.baeldung</groupId> @@ -48,7 +49,6 @@ <scope>system</scope> <systemPath>${java.home}/../lib/tools.jar</systemPath> </dependency> - </dependencies> <properties> @@ -58,4 +58,5 @@ <esapi.version>2.1.0.1</esapi.version> <sun.tools.version>1.8.0</sun.tools.version> </properties> + </project> diff --git a/core-java-modules/core-java-jvm/src/main/java/com/baeldung/exitvshalt/JvmExitAndHaltDemo.java b/core-java-modules/core-java-jvm/src/main/java/com/baeldung/exitvshalt/JvmExitAndHaltDemo.java new file mode 100644 index 0000000000..6d572455fb --- /dev/null +++ b/core-java-modules/core-java-jvm/src/main/java/com/baeldung/exitvshalt/JvmExitAndHaltDemo.java @@ -0,0 +1,34 @@ +package com.baeldung.exitvshalt; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class JvmExitAndHaltDemo { + + private static Logger LOGGER = LoggerFactory.getLogger(JvmExitAndHaltDemo.class); + + static { + Runtime.getRuntime() + .addShutdownHook(new Thread(() -> { + LOGGER.info("Shutdown hook initiated."); + })); + } + + public void processAndExit() { + process(); + LOGGER.info("Calling System.exit()."); + System.exit(0); + } + + public void processAndHalt() { + process(); + LOGGER.info("Calling Runtime.getRuntime().halt()."); + Runtime.getRuntime() + .halt(0); + } + + private void process() { + LOGGER.info("Process started."); + } + +} diff --git a/core-java-modules/core-java-jvm/src/test/java/com/baeldung/exitvshalt/JvmExitDemoUnitTest.java b/core-java-modules/core-java-jvm/src/test/java/com/baeldung/exitvshalt/JvmExitDemoUnitTest.java new file mode 100644 index 0000000000..0c50651af0 --- /dev/null +++ b/core-java-modules/core-java-jvm/src/test/java/com/baeldung/exitvshalt/JvmExitDemoUnitTest.java @@ -0,0 +1,14 @@ +package com.baeldung.exitvshalt; + +import org.junit.Test; + +public class JvmExitDemoUnitTest { + + JvmExitAndHaltDemo jvmExitAndHaltDemo = new JvmExitAndHaltDemo(); + + @Test + public void givenProcessComplete_whenExitCalled_thenTriggerShutdownHook() { + jvmExitAndHaltDemo.processAndExit(); + } + +} diff --git a/core-java-modules/core-java-jvm/src/test/java/com/baeldung/exitvshalt/JvmHaltDemoUnitTest.java b/core-java-modules/core-java-jvm/src/test/java/com/baeldung/exitvshalt/JvmHaltDemoUnitTest.java new file mode 100644 index 0000000000..9f08e95c6a --- /dev/null +++ b/core-java-modules/core-java-jvm/src/test/java/com/baeldung/exitvshalt/JvmHaltDemoUnitTest.java @@ -0,0 +1,14 @@ +package com.baeldung.exitvshalt; + +import org.junit.Test; + +public class JvmHaltDemoUnitTest { + + JvmExitAndHaltDemo jvmExitAndHaltDemo = new JvmExitAndHaltDemo(); + + @Test + public void givenProcessComplete_whenHaltCalled_thenDoNotTriggerShutdownHook() { + jvmExitAndHaltDemo.processAndHalt(); + } + +} diff --git a/core-java-modules/core-java-jvm/src/test/java/com/baeldung/shutdownhook/ShutdownHookUnitTest.java b/core-java-modules/core-java-jvm/src/test/java/com/baeldung/shutdownhook/ShutdownHookUnitTest.java new file mode 100644 index 0000000000..0f97a2eb09 --- /dev/null +++ b/core-java-modules/core-java-jvm/src/test/java/com/baeldung/shutdownhook/ShutdownHookUnitTest.java @@ -0,0 +1,47 @@ +package com.baeldung.shutdownhook; + +import org.junit.Test; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +public class ShutdownHookUnitTest { + + @Test + public void givenAHook_WhenShutsDown_ThenHookShouldBeExecuted() { + Thread printingHook = new Thread(() -> System.out.println("In the middle of a shutdown")); + Runtime.getRuntime().addShutdownHook(printingHook); + } + + @Test + public void addingAHook_WhenThreadAlreadyStarted_ThenThrowsAnException() { + Thread longRunningHook = new Thread(() -> { + try { + Thread.sleep(300); + } catch (InterruptedException ignored) {} + }); + longRunningHook.start(); + + assertThatThrownBy(() -> Runtime.getRuntime().addShutdownHook(longRunningHook)) + .isInstanceOf(IllegalArgumentException.class) + .hasMessage("Hook already running"); + } + + @Test + public void addingAHook_WhenAlreadyExists_ThenAnExceptionWouldBeThrown() { + Thread unfortunateHook = new Thread(() -> {}); + Runtime.getRuntime().addShutdownHook(unfortunateHook); + + assertThatThrownBy(() -> Runtime.getRuntime().addShutdownHook(unfortunateHook)) + .isInstanceOf(IllegalArgumentException.class) + .hasMessage("Hook previously registered"); + } + + @Test + public void removeAHook_WhenItIsAlreadyRegistered_ThenWouldDeRegisterTheHook() { + Thread willNotRun = new Thread(() -> System.out.println("Won't run!")); + Runtime.getRuntime().addShutdownHook(willNotRun); + + assertThat(Runtime.getRuntime().removeShutdownHook(willNotRun)).isTrue(); + } +} diff --git a/core-java-modules/core-java-lambdas/pom.xml b/core-java-modules/core-java-lambdas/pom.xml index 433db0a9ca..fbcd9d5870 100644 --- a/core-java-modules/core-java-lambdas/pom.xml +++ b/core-java-modules/core-java-lambdas/pom.xml @@ -2,24 +2,25 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <artifactId>core-java-lambdas</artifactId> - <version>0.1.0-SNAPSHOT</version> - <name>core-java-lambdas</name> - <packaging>jar</packaging> + <modelVersion>4.0.0</modelVersion> + <artifactId>core-java-lambdas</artifactId> + <version>0.1.0-SNAPSHOT</version> + <name>core-java-lambdas</name> + <packaging>jar</packaging> - <parent> - <groupId>com.baeldung</groupId> - <artifactId>parent-java</artifactId> - <version>0.0.1-SNAPSHOT</version> - <relativePath>../../parent-java</relativePath> - </parent> + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-java</artifactId> + <version>0.0.1-SNAPSHOT</version> + <relativePath>../../parent-java</relativePath> + </parent> + + <dependencies> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>${commons-lang3.version}</version> + </dependency> + </dependencies> - <dependencies> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-lang3</artifactId> - <version>${commons-lang3.version}</version> - </dependency> - </dependencies> </project> \ No newline at end of file diff --git a/core-java-modules/core-java-lang-2/README.md b/core-java-modules/core-java-lang-2/README.md index ee57ec6198..5d51f3cea4 100644 --- a/core-java-modules/core-java-lang-2/README.md +++ b/core-java-modules/core-java-lang-2/README.md @@ -5,4 +5,5 @@ This module contains articles about core features in the Java language ### Relevant Articles: - [Java Primitives versus Objects](https://www.baeldung.com/java-primitives-vs-objects) - [Command-Line Arguments in Java](https://www.baeldung.com/java-command-line-arguments) +- [What is a POJO Class?](https://www.baeldung.com/java-pojo-class) - [[<-- Prev]](/core-java-modules/core-java-lang) diff --git a/core-java-modules/core-java-lang-2/pom.xml b/core-java-modules/core-java-lang-2/pom.xml index 3230498f41..5657e64b17 100644 --- a/core-java-modules/core-java-lang-2/pom.xml +++ b/core-java-modules/core-java-lang-2/pom.xml @@ -1,54 +1,62 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <artifactId>core-java-lang-2</artifactId> - <version>0.1.0-SNAPSHOT</version> - <name>core-java-lang-2</name> - <packaging>jar</packaging> - - <parent> - <groupId>com.baeldung</groupId> - <artifactId>parent-java</artifactId> - <version>0.0.1-SNAPSHOT</version> - <relativePath>../../parent-java</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>commons-beanutils</groupId> - <artifactId>commons-beanutils</artifactId> - <version>1.9.4</version> - </dependency> - <dependency> - <groupId>org.openjdk.jmh</groupId> - <artifactId>jmh-generator-annprocess</artifactId> - <version>${jmh-generator.version}</version> - </dependency> - <dependency> - <groupId>org.openjdk.jmh</groupId> - <artifactId>jmh-generator-bytecode</artifactId> - <version>${jmh-generator.version}</version> - </dependency> - <dependency> - <groupId>org.openjdk.jmh</groupId> - <artifactId>jmh-core</artifactId> - <version>${jmh-core.version}</version> - </dependency> - </dependencies> - - <build> - <finalName>core-java-lang-2</finalName> - <resources> - <resource> - <directory>src/main/resources</directory> - <filtering>true</filtering> - </resource> - </resources> - </build> - - <properties> - <jmh-core.version>1.19</jmh-core.version> - <jmh-generator.version>1.19</jmh-generator.version> - </properties> - -</project> +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>core-java-lang-2</artifactId> + <version>0.1.0-SNAPSHOT</version> + <name>core-java-lang-2</name> + <packaging>jar</packaging> + + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-java</artifactId> + <version>0.0.1-SNAPSHOT</version> + <relativePath>../../parent-java</relativePath> + </parent> + + <dependencies> + <dependency> + <groupId>commons-beanutils</groupId> + <artifactId>commons-beanutils</artifactId> + <version>1.9.4</version> + </dependency> + <dependency> + <groupId>org.openjdk.jmh</groupId> + <artifactId>jmh-generator-annprocess</artifactId> + <version>${jmh-generator.version}</version> + </dependency> + <dependency> + <groupId>org.openjdk.jmh</groupId> + <artifactId>jmh-generator-bytecode</artifactId> + <version>${jmh-generator.version}</version> + </dependency> + <dependency> + <groupId>org.openjdk.jmh</groupId> + <artifactId>jmh-core</artifactId> + <version>${jmh-core.version}</version> + </dependency> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <version>${assertj.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <finalName>core-java-lang-2</finalName> + <resources> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + </resource> + </resources> + </build> + + <properties> + <jmh-core.version>1.19</jmh-core.version> + <jmh-generator.version>1.19</jmh-generator.version> + <assertj.version>3.12.2</assertj.version> + </properties> + +</project> diff --git a/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/defaultparams/Tea.java b/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/defaultparams/Tea.java new file mode 100644 index 0000000000..0680813041 --- /dev/null +++ b/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/defaultparams/Tea.java @@ -0,0 +1,61 @@ +package com.baeldung.defaultparams; + +public class Tea { + + static final int DEFAULT_TEA_POWDER = 1; // add 1 tbsp tea powder by default + + private String name; // mandatory + private int milk; // ml + private boolean herbs; // add herbs or don't + private int sugar; // tbsp + private int teaPowder; // tbsp + + public Tea(String name, int milk, boolean herbs, int sugar, int teaPowder) { + this.name = name; + this.milk = milk; + this.herbs = herbs; + this.sugar = sugar; + this.teaPowder = teaPowder; + } + + // when tea powder is not provided by client, use default value + public Tea(String name, int milk, boolean herbs, int sugar) { + this(name, milk, herbs, sugar, DEFAULT_TEA_POWDER); + } + + // when sugar is not provided by client, don't add it + public Tea(String name, int milk, boolean herbs) { + this(name, milk, herbs, 0); + } + + // when herbs is not provided by client, don't add it + public Tea(String name, int milk) { + this(name, milk, false); + } + + // when milk is not provided by client, don't add it + public Tea(String name) { + this(name, 0); + } + + public String getName() { + return name; + } + + public int getMilk() { + return milk; + } + + public boolean isHerbs() { + return herbs; + } + + public int getSugar() { + return sugar; + } + + public int getTeaPowder() { + return teaPowder; + } + +} diff --git a/core-java-modules/core-java-lang-2/src/test/java/com/baeldung/defaultparams/TeaUnitTest.java b/core-java-modules/core-java-lang-2/src/test/java/com/baeldung/defaultparams/TeaUnitTest.java new file mode 100644 index 0000000000..418e2788aa --- /dev/null +++ b/core-java-modules/core-java-lang-2/src/test/java/com/baeldung/defaultparams/TeaUnitTest.java @@ -0,0 +1,20 @@ +package com.baeldung.defaultparams; + +import static org.assertj.core.api.Assertions.assertThat; +import org.junit.Test; + + +public class TeaUnitTest { + + @Test + public void whenTeaWithOnlyName_thenCreateDefaultTea() { + Tea blackTea = new Tea("Black Tea"); + + assertThat(blackTea.getName()).isEqualTo("Black Tea"); + assertThat(blackTea.getMilk()).isEqualTo(0); + assertThat(blackTea.isHerbs()).isFalse(); + assertThat(blackTea.getSugar()).isEqualTo(0); + assertThat(blackTea.getTeaPowder()).isEqualTo(Tea.DEFAULT_TEA_POWDER); + } + +} diff --git a/core-java-modules/core-java-lang-math/README.md b/core-java-modules/core-java-lang-math/README.md index b316ed1cfb..aec339574b 100644 --- a/core-java-modules/core-java-lang-math/README.md +++ b/core-java-modules/core-java-lang-math/README.md @@ -6,3 +6,4 @@ - [Java 8 Math New Methods](https://www.baeldung.com/java-8-math) - [Java 8 Unsigned Arithmetic Support](https://www.baeldung.com/java-unsigned-arithmetic) - [How to Separate Double into Integer and Decimal Parts](https://www.baeldung.com/java-separate-double-into-integer-decimal-parts) +- [The strictfp Keyword in Java](https://www.baeldung.com/java-strictfp) diff --git a/core-java-modules/core-java-lang-math/pom.xml b/core-java-modules/core-java-lang-math/pom.xml index f884aca3a9..671d5630d2 100644 --- a/core-java-modules/core-java-lang-math/pom.xml +++ b/core-java-modules/core-java-lang-math/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -37,4 +38,5 @@ <!-- testing --> <assertj.version>3.6.1</assertj.version> </properties> + </project> diff --git a/core-java-modules/core-java-lang-math/src/main/java/com/baeldung/calculator/basic/BasicCalculatorIfElse.java b/core-java-modules/core-java-lang-math/src/main/java/com/baeldung/calculator/basic/BasicCalculatorIfElse.java new file mode 100644 index 0000000000..87f274db51 --- /dev/null +++ b/core-java-modules/core-java-lang-math/src/main/java/com/baeldung/calculator/basic/BasicCalculatorIfElse.java @@ -0,0 +1,50 @@ +package com.baeldung.calculator.basic; + +import java.util.InputMismatchException; +import java.util.Scanner; + +public class BasicCalculatorIfElse { + + public static void main(String[] args) { + + System.out.println("---------------------------------- \n" + "Welcome to Basic Calculator \n" + "----------------------------------"); + System.out.println("Following operations are supported : \n" + "1. Addition (+) \n" + "2. Subtraction (-) \n" + "3. Multiplication (* OR x) \n" + "4. Division (/) \n"); + + Scanner scanner = new Scanner(System.in); + try { + System.out.println("Enter an operator: (+ OR - OR * OR /) "); + char operation = scanner.next() + .charAt(0); + + if (!(operation == '+' || operation == '-' || operation == '*' || operation == 'x' || operation == '/')) { + System.err.println("Invalid Operator. Please use only + or - or * or /"); + } + + System.out.println("Enter First Number: "); + double num1 = scanner.nextDouble(); + + System.out.println("Enter Second Number: "); + double num2 = scanner.nextDouble(); + + if (operation == '/' && num2 == 0.0) { + System.err.println("Second Number cannot be zero for Division operation."); + } + + if (operation == '+') { + System.out.println(num1 + " + " + num2 + " = " + (num1 + num2)); + } else if (operation == '-') { + System.out.println(num1 + " - " + num2 + " = " + (num1 - num2)); + } else if (operation == '*' || operation == 'x') { + System.out.println(num1 + " x " + num2 + " = " + (num1 * num2)); + } else if (operation == '/') { + System.out.println(num1 + " / " + num2 + " = " + (num1 / num2)); + } else { + System.err.println("Invalid Operator Specified."); + } + } catch (InputMismatchException exc) { + System.err.println(exc.getMessage()); + } finally { + scanner.close(); + } + } +} \ No newline at end of file diff --git a/core-java-modules/core-java-lang-math/src/main/java/com/baeldung/calculator/basic/BasicCalculatorSwitchCase.java b/core-java-modules/core-java-lang-math/src/main/java/com/baeldung/calculator/basic/BasicCalculatorSwitchCase.java new file mode 100644 index 0000000000..82c181a0fe --- /dev/null +++ b/core-java-modules/core-java-lang-math/src/main/java/com/baeldung/calculator/basic/BasicCalculatorSwitchCase.java @@ -0,0 +1,58 @@ +package com.baeldung.calculator.basic; + +import java.util.InputMismatchException; +import java.util.Scanner; + +public class BasicCalculatorSwitchCase { + public static void main(String[] args) { + + System.out.println("---------------------------------- \n" + "Welcome to Basic Calculator \n" + "----------------------------------"); + System.out.println("Following operations are supported : \n" + "1. Addition (+) \n" + "2. Subtraction (-) \n" + "3. Multiplication (* OR x) \n" + "4. Division (/) \n"); + + Scanner scanner = new Scanner(System.in); + try { + System.out.println("Enter an operator: (+ OR - OR * OR /) "); + char operation = scanner.next() + .charAt(0); + + if (!(operation == '+' || operation == '-' || operation == '*' || operation == 'x' || operation == '/')) { + System.err.println("Invalid Operator. Please use only + or - or * or /"); + } + + System.out.println("Enter First Number: "); + double num1 = scanner.nextDouble(); + + System.out.println("Enter Second Number: "); + double num2 = scanner.nextDouble(); + + if (operation == '/' && num2 == 0.0) { + System.err.println("Second Number cannot be zero for Division operation."); + } + + switch (operation) { + case '+': + System.out.println(num1 + " + " + num2 + " = " + (num1 + num2)); + break; + case '-': + System.out.println(num1 + " - " + num2 + " = " + (num1 - num2)); + break; + case '*': + System.out.println(num1 + " x " + num2 + " = " + (num1 * num2)); + break; + case 'x': + System.out.println(num1 + " x " + num2 + " = " + (num1 * num2)); + break; + case '/': + System.out.println(num1 + " / " + num2 + " = " + (num1 / num2)); + break; + default: + System.err.println("Invalid Operator Specified."); + break; + } + } catch (InputMismatchException exc) { + System.err.println(exc.getMessage()); + } finally { + scanner.close(); + } + } +} \ No newline at end of file diff --git a/core-java-modules/core-java-lang-math/src/main/java/com/baeldung/overflow/Overflow.java b/core-java-modules/core-java-lang-math/src/main/java/com/baeldung/overflow/Overflow.java new file mode 100644 index 0000000000..e08d6f60b7 --- /dev/null +++ b/core-java-modules/core-java-lang-math/src/main/java/com/baeldung/overflow/Overflow.java @@ -0,0 +1,70 @@ +package com.baeldung.overflow; + +import java.math.BigInteger; + +public class Overflow { + + public static void showIntegerOverflow() { + + int value = Integer.MAX_VALUE-1; + + for(int i = 0; i < 4; i++, value++) { + System.out.println(value); + } + } + + public static void noOverflowWithBigInteger() { + + BigInteger largeValue = new BigInteger(Integer.MAX_VALUE + ""); + for(int i = 0; i < 4; i++) { + System.out.println(largeValue); + largeValue = largeValue.add(BigInteger.ONE); + } + } + + public static void exceptionWithAddExact() { + + int value = Integer.MAX_VALUE-1; + for(int i = 0; i < 4; i++) { + System.out.println(value); + value = Math.addExact(value, 1); + } + } + + public static int addExact(int x, int y) { + + int r = x + y; + if (((x ^ r) & (y ^ r)) < 0) { + throw new ArithmeticException("int overflow"); + } + return r; + } + + public static void demonstrateUnderflow() { + + for(int i = 1073; i <= 1076; i++) { + System.out.println("2^" + i + " = " + Math.pow(2, -i)); + } + } + + public static double powExact(double base, double exponent) + { + if(base == 0.0) { + return 0.0; + } + + double result = Math.pow(base, exponent); + + if(result == Double.POSITIVE_INFINITY ) { + throw new ArithmeticException("Double overflow resulting in POSITIVE_INFINITY"); + } else if(result == Double.NEGATIVE_INFINITY) { + throw new ArithmeticException("Double overflow resulting in NEGATIVE_INFINITY"); + } else if(Double.compare(-0.0f, result) == 0) { + throw new ArithmeticException("Double overflow resulting in negative zero"); + } else if(Double.compare(+0.0f, result) == 0) { + throw new ArithmeticException("Double overflow resulting in positive zero"); + } + + return result; + } +} diff --git a/core-java-modules/core-java-lang-math/src/test/java/com/baeldung/math/OverflowUnitTest.java b/core-java-modules/core-java-lang-math/src/test/java/com/baeldung/math/OverflowUnitTest.java new file mode 100644 index 0000000000..4b213eba13 --- /dev/null +++ b/core-java-modules/core-java-lang-math/src/test/java/com/baeldung/math/OverflowUnitTest.java @@ -0,0 +1,22 @@ +package com.baeldung.math; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +public class OverflowUnitTest { + + @Test + public void positive_and_negative_zero_are_not_always_equal() { + + double a = +0f; + double b = -0f; + + assertTrue(a == b); + + assertTrue(1/a == Double.POSITIVE_INFINITY); + assertTrue(1/b == Double.NEGATIVE_INFINITY); + + assertTrue(1/a != 1/b); + } +} diff --git a/core-java-modules/core-java-lang-math/src/test/java/com/baeldung/overflow/OverflowUnitTest.java b/core-java-modules/core-java-lang-math/src/test/java/com/baeldung/overflow/OverflowUnitTest.java new file mode 100644 index 0000000000..b570592c7e --- /dev/null +++ b/core-java-modules/core-java-lang-math/src/test/java/com/baeldung/overflow/OverflowUnitTest.java @@ -0,0 +1,22 @@ +package com.baeldung.overflow; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +public class OverflowUnitTest { + + @Test + public void positive_and_negative_zero_are_not_always_equal() { + + double a = +0f; + double b = -0f; + + assertTrue(a == b); + + assertTrue(1/a == Double.POSITIVE_INFINITY); + assertTrue(1/b == Double.NEGATIVE_INFINITY); + + assertTrue(1/a != 1/b); + } +} diff --git a/core-java-modules/core-java-lang-oop-2/pom.xml b/core-java-modules/core-java-lang-oop-2/pom.xml index 5bca2f0dbf..01bacab0b9 100644 --- a/core-java-modules/core-java-lang-oop-2/pom.xml +++ b/core-java-modules/core-java-lang-oop-2/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-lang-oop-2</artifactId> <version>0.1.0-SNAPSHOT</version> @@ -13,7 +14,7 @@ <relativePath>../../parent-java</relativePath> </parent> - <dependencies> + <dependencies> <!-- test scoped --> <dependency> <groupId>org.assertj</groupId> @@ -27,8 +28,8 @@ <version>${equalsverifier.version}</version> <scope>test</scope> </dependency> - </dependencies> - + </dependencies> + <build> <finalName>core-java-lang-oop-2</finalName> <resources> diff --git a/core-java-modules/core-java-lang-oop-3/pom.xml b/core-java-modules/core-java-lang-oop-3/pom.xml index 1caf17bef3..70939c32c9 100644 --- a/core-java-modules/core-java-lang-oop-3/pom.xml +++ b/core-java-modules/core-java-lang-oop-3/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-lang-oop-3</artifactId> <version>0.1.0-SNAPSHOT</version> diff --git a/core-java-modules/core-java-lang-oop-4/pom.xml b/core-java-modules/core-java-lang-oop-4/pom.xml index 72662a8ea4..9e138afddf 100644 --- a/core-java-modules/core-java-lang-oop-4/pom.xml +++ b/core-java-modules/core-java-lang-oop-4/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-lang-oop-4</artifactId> <version>0.1.0-SNAPSHOT</version> diff --git a/core-java-modules/core-java-lang-oop/pom.xml b/core-java-modules/core-java-lang-oop/pom.xml index bdd9857dfa..a628a4d6c2 100644 --- a/core-java-modules/core-java-lang-oop/pom.xml +++ b/core-java-modules/core-java-lang-oop/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-lang-oop</artifactId> <version>0.1.0-SNAPSHOT</version> diff --git a/core-java-modules/core-java-lang-operators/pom.xml b/core-java-modules/core-java-lang-operators/pom.xml index 81865552dd..03720122cb 100644 --- a/core-java-modules/core-java-lang-operators/pom.xml +++ b/core-java-modules/core-java-lang-operators/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> diff --git a/core-java-modules/core-java-lang-syntax-2/pom.xml b/core-java-modules/core-java-lang-syntax-2/pom.xml index 98eea99fc0..961cf022cb 100644 --- a/core-java-modules/core-java-lang-syntax-2/pom.xml +++ b/core-java-modules/core-java-lang-syntax-2/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -22,4 +23,5 @@ </resource> </resources> </build> + </project> diff --git a/core-java-modules/core-java-lang-syntax/pom.xml b/core-java-modules/core-java-lang-syntax/pom.xml index f4549b689d..c47a1011b7 100644 --- a/core-java-modules/core-java-lang-syntax/pom.xml +++ b/core-java-modules/core-java-lang-syntax/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> diff --git a/core-java-modules/core-java-lang/pom.xml b/core-java-modules/core-java-lang/pom.xml index 10b0526177..5b8fe4133b 100644 --- a/core-java-modules/core-java-lang/pom.xml +++ b/core-java-modules/core-java-lang/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> diff --git a/core-java-modules/core-java-networking-2/pom.xml b/core-java-modules/core-java-networking-2/pom.xml index c3a5891066..2e2eb51809 100644 --- a/core-java-modules/core-java-networking-2/pom.xml +++ b/core-java-modules/core-java-networking-2/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-networking-2</artifactId> <name>core-java-networking-2</name> @@ -44,4 +45,5 @@ <javax.mail.version>1.5.0-b01</javax.mail.version> <async-http-client.version>2.4.5</async-http-client.version> </properties> + </project> diff --git a/core-java-modules/core-java-networking/pom.xml b/core-java-modules/core-java-networking/pom.xml index cd84d2a27c..f5b39625f0 100644 --- a/core-java-modules/core-java-networking/pom.xml +++ b/core-java-modules/core-java-networking/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -27,5 +28,6 @@ <properties> <springframework.spring-web.version>4.3.4.RELEASE</springframework.spring-web.version> - </properties> + </properties> + </project> diff --git a/core-java-modules/core-java-nio-2/pom.xml b/core-java-modules/core-java-nio-2/pom.xml index c1fa423b38..cd5c87d44e 100644 --- a/core-java-modules/core-java-nio-2/pom.xml +++ b/core-java-modules/core-java-nio-2/pom.xml @@ -1,6 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-nio-2</artifactId> <version>0.1.0-SNAPSHOT</version> diff --git a/core-java-modules/core-java-nio/pom.xml b/core-java-modules/core-java-nio/pom.xml index da8759a956..bc7801c398 100644 --- a/core-java-modules/core-java-nio/pom.xml +++ b/core-java-modules/core-java-nio/pom.xml @@ -1,6 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-nio</artifactId> <version>0.1.0-SNAPSHOT</version> diff --git a/core-java-modules/core-java-optional/README.md b/core-java-modules/core-java-optional/README.md index 22ac8736fa..d9d2fe813b 100644 --- a/core-java-modules/core-java-optional/README.md +++ b/core-java-modules/core-java-optional/README.md @@ -1,8 +1,13 @@ -========= +## Java Optional -## Core Java Optional +This module contains articles about Java Optional. ### Relevant Articles: - [Java Optional as Return Type](https://www.baeldung.com/java-optional-return) -- [Guide To Java 8 Optional](https://www.baeldung.com/java-optional) -- [Java Optional – orElse() vs orElseGet()](https://www.baeldung.com/java-optional-or-else-vs-or-else-get) \ No newline at end of file +- [Guide to Java 8 Optional](https://www.baeldung.com/java-optional) +- [Java Optional – orElse() vs orElseGet()](https://www.baeldung.com/java-optional-or-else-vs-or-else-get) +- [Transforming an Empty String into an Empty Optional](https://www.baeldung.com/java-empty-string-to-empty-optional) +- [Filtering a Stream of Optionals in Java](https://www.baeldung.com/java-filter-stream-of-optional) +- [Java 9 Optional API Additions](https://www.baeldung.com/java-9-optional) +- [Throw Exception in Optional in Java 8](https://www.baeldung.com/java-optional-throw-exception) +- [Optional orElse Optional](https://www.baeldung.com/java-optional-or-else-optional) diff --git a/core-java-modules/core-java-optional/pom.xml b/core-java-modules/core-java-optional/pom.xml index 38d7565282..9ab41d5a82 100644 --- a/core-java-modules/core-java-optional/pom.xml +++ b/core-java-modules/core-java-optional/pom.xml @@ -1,16 +1,18 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-optional</artifactId> <version>0.1.0-SNAPSHOT</version> - <packaging>jar</packaging> <name>core-java-optional</name> - + <packaging>jar</packaging> + <parent> <groupId>com.baeldung.core-java-modules</groupId> <artifactId>core-java-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> - + <dependencies> <dependency> <groupId>org.hibernate</groupId> @@ -42,11 +44,32 @@ <artifactId>jmh-generator-bytecode</artifactId> <version>${jmh-generator.version}</version> </dependency> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>${guava.version}</version> + </dependency> + <dependency> + <groupId>io.rest-assured</groupId> + <artifactId>json-path</artifactId> + <version>${rest-assured.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <version>${assertj.version}</version> + <scope>test</scope> + </dependency> </dependencies> <properties> <hibernate.core.version>5.4.0.Final</hibernate.core.version> <jmh-core.version>1.19</jmh-core.version> <jmh-generator.version>1.19</jmh-generator.version> + <guava.version>27.1-jre</guava.version> + <assertj.version>3.10.0</assertj.version> + <rest-assured.version>3.1.1</rest-assured.version> </properties> + </project> \ No newline at end of file diff --git a/core-java-modules/core-java-optional/src/main/java/com/baeldung/optional/OrElseAndOrElseGet.java b/core-java-modules/core-java-optional/src/main/java/com/baeldung/optional/orelse/OrElseAndOrElseGet.java similarity index 96% rename from core-java-modules/core-java-optional/src/main/java/com/baeldung/optional/OrElseAndOrElseGet.java rename to core-java-modules/core-java-optional/src/main/java/com/baeldung/optional/orelse/OrElseAndOrElseGet.java index d4d07291d5..45b47c745e 100644 --- a/core-java-modules/core-java-optional/src/main/java/com/baeldung/optional/OrElseAndOrElseGet.java +++ b/core-java-modules/core-java-optional/src/main/java/com/baeldung/optional/orelse/OrElseAndOrElseGet.java @@ -1,4 +1,4 @@ -package com.baeldung.optional; +package com.baeldung.optional.orelse; import java.util.Arrays; import java.util.List; diff --git a/core-java-modules/core-java-optional/src/main/java/com/baeldung/optional/OrElseAndOrElseGetBenchmarkRunner.java b/core-java-modules/core-java-optional/src/main/java/com/baeldung/optional/orelse/OrElseAndOrElseGetBenchmarkRunner.java similarity index 96% rename from core-java-modules/core-java-optional/src/main/java/com/baeldung/optional/OrElseAndOrElseGetBenchmarkRunner.java rename to core-java-modules/core-java-optional/src/main/java/com/baeldung/optional/orelse/OrElseAndOrElseGetBenchmarkRunner.java index 8bf0b0b25d..1cbb8803d0 100644 --- a/core-java-modules/core-java-optional/src/main/java/com/baeldung/optional/OrElseAndOrElseGetBenchmarkRunner.java +++ b/core-java-modules/core-java-optional/src/main/java/com/baeldung/optional/orelse/OrElseAndOrElseGetBenchmarkRunner.java @@ -1,4 +1,4 @@ -package com.baeldung.optional; +package com.baeldung.optional.orelse; import java.io.IOException; import java.util.concurrent.TimeUnit; diff --git a/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalReturnType/HandleOptionalTypeExample.java b/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalreturntype/HandleOptionalTypeExample.java similarity index 96% rename from core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalReturnType/HandleOptionalTypeExample.java rename to core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalreturntype/HandleOptionalTypeExample.java index c472bab077..a280957a3c 100644 --- a/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalReturnType/HandleOptionalTypeExample.java +++ b/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalreturntype/HandleOptionalTypeExample.java @@ -1,4 +1,4 @@ -package com.baeldung.optionalReturnType; +package com.baeldung.optionalreturntype; import java.util.HashMap; import java.util.Map; diff --git a/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalReturnType/OptionalToJsonExample.java b/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalreturntype/OptionalToJsonExample.java similarity index 93% rename from core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalReturnType/OptionalToJsonExample.java rename to core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalreturntype/OptionalToJsonExample.java index b44a35fae1..1852ecbf65 100644 --- a/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalReturnType/OptionalToJsonExample.java +++ b/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalreturntype/OptionalToJsonExample.java @@ -1,4 +1,4 @@ -package com.baeldung.optionalReturnType; +package com.baeldung.optionalreturntype; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalReturnType/PersistOptionalTypeExample.java b/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalreturntype/PersistOptionalTypeExample.java similarity index 82% rename from core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalReturnType/PersistOptionalTypeExample.java rename to core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalreturntype/PersistOptionalTypeExample.java index 85c96b9bc3..a0c182bb7d 100644 --- a/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalReturnType/PersistOptionalTypeExample.java +++ b/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalreturntype/PersistOptionalTypeExample.java @@ -1,4 +1,4 @@ -package com.baeldung.optionalReturnType; +package com.baeldung.optionalreturntype; import java.util.Optional; @@ -7,13 +7,13 @@ import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; public class PersistOptionalTypeExample { - static String persistenceUnit = "com.baeldung.optionalReturnType"; + static String persistenceUnit = "com.baeldung.optionalreturntype"; static EntityManagerFactory emf = Persistence.createEntityManagerFactory(persistenceUnit); static EntityManager entityManager = emf.createEntityManager(); // to run this app, uncomment the follow line in META-INF/persistence.xml - // <class>com.baeldung.optionalReturnType.UserOptionalField</class> + // <class>com.baeldung.optionalreturntype.UserOptionalField</class> public static void main(String[] args) { UserOptionalField user1 = new UserOptionalField(); user1.setUserId(1l); diff --git a/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalReturnType/PersistOptionalTypeExample2.java b/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalreturntype/PersistOptionalTypeExample2.java similarity index 85% rename from core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalReturnType/PersistOptionalTypeExample2.java rename to core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalreturntype/PersistOptionalTypeExample2.java index 3114e7cefb..5671266b68 100644 --- a/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalReturnType/PersistOptionalTypeExample2.java +++ b/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalreturntype/PersistOptionalTypeExample2.java @@ -1,11 +1,11 @@ -package com.baeldung.optionalReturnType; +package com.baeldung.optionalreturntype; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; public class PersistOptionalTypeExample2 { - static String persistenceUnit = "com.baeldung.optionalReturnType"; + static String persistenceUnit = "com.baeldung.optionalreturntype"; static EntityManagerFactory emf = Persistence.createEntityManagerFactory(persistenceUnit); static EntityManager em = emf.createEntityManager(); diff --git a/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalReturnType/PersistUserExample.java b/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalreturntype/PersistUserExample.java similarity index 84% rename from core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalReturnType/PersistUserExample.java rename to core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalreturntype/PersistUserExample.java index f1284958e7..e26268d8e6 100644 --- a/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalReturnType/PersistUserExample.java +++ b/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalreturntype/PersistUserExample.java @@ -1,11 +1,11 @@ -package com.baeldung.optionalReturnType; +package com.baeldung.optionalreturntype; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; public class PersistUserExample { - static String persistenceUnit = "com.baeldung.optionalReturnType"; + static String persistenceUnit = "com.baeldung.optionalreturntype"; static EntityManagerFactory emf = Persistence.createEntityManagerFactory(persistenceUnit); static EntityManager em = emf.createEntityManager(); diff --git a/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalReturnType/SerializeOptionalTypeExample.java b/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalreturntype/SerializeOptionalTypeExample.java similarity index 96% rename from core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalReturnType/SerializeOptionalTypeExample.java rename to core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalreturntype/SerializeOptionalTypeExample.java index d67337ad98..8566e49a21 100644 --- a/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalReturnType/SerializeOptionalTypeExample.java +++ b/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalreturntype/SerializeOptionalTypeExample.java @@ -1,4 +1,4 @@ -package com.baeldung.optionalReturnType; +package com.baeldung.optionalreturntype; import java.io.FileOutputStream; import java.io.IOException; diff --git a/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalReturnType/User.java b/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalreturntype/User.java similarity index 92% rename from core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalReturnType/User.java rename to core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalreturntype/User.java index 7aa11d78cb..b754b41787 100644 --- a/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalReturnType/User.java +++ b/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalreturntype/User.java @@ -1,4 +1,4 @@ -package com.baeldung.optionalReturnType; +package com.baeldung.optionalreturntype; import java.io.Serializable; diff --git a/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalReturnType/UserOptional.java b/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalreturntype/UserOptional.java similarity index 94% rename from core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalReturnType/UserOptional.java rename to core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalreturntype/UserOptional.java index 0138a84ab9..081553dbe5 100644 --- a/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalReturnType/UserOptional.java +++ b/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalreturntype/UserOptional.java @@ -1,4 +1,4 @@ -package com.baeldung.optionalReturnType; +package com.baeldung.optionalreturntype; import java.io.Serializable; import java.util.Optional; diff --git a/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalReturnType/UserOptionalField.java b/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalreturntype/UserOptionalField.java similarity index 93% rename from core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalReturnType/UserOptionalField.java rename to core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalreturntype/UserOptionalField.java index c02430b1ba..e8c16bfa02 100644 --- a/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalReturnType/UserOptionalField.java +++ b/core-java-modules/core-java-optional/src/main/java/com/baeldung/optionalreturntype/UserOptionalField.java @@ -1,4 +1,4 @@ -package com.baeldung.optionalReturnType; +package com.baeldung.optionalreturntype; import java.io.Serializable; import java.util.Optional; diff --git a/core-java-modules/core-java-9/src/main/java/com/baeldung/optionals/Optionals.java b/core-java-modules/core-java-optional/src/main/java/com/baeldung/orelseoptional/OptionalUtils.java similarity index 54% rename from core-java-modules/core-java-9/src/main/java/com/baeldung/optionals/Optionals.java rename to core-java-modules/core-java-optional/src/main/java/com/baeldung/orelseoptional/OptionalUtils.java index 5efa607f94..f2bf1637dc 100644 --- a/core-java-modules/core-java-9/src/main/java/com/baeldung/optionals/Optionals.java +++ b/core-java-modules/core-java-optional/src/main/java/com/baeldung/orelseoptional/OptionalUtils.java @@ -1,20 +1,20 @@ -package com.baeldung.optionals; +package com.baeldung.orelseoptional; import java.util.Optional; -public class Optionals { +public class OptionalUtils { public static <T> Optional<T> or(Optional<T> optional, Optional<T> fallback) { return optional.isPresent() ? optional : fallback; } - public static Optional<String> getName(Optional<String> name) { - return name.or(() -> getCustomMessage()); - } - - public static com.google.common.base.Optional<String> getOptionalGuavaName(com.google.common.base.Optional<String> name) { - return name.or(getCustomMessageGuava()); - } +// public static Optional<String> getName(Optional<String> name) { +// return name.or(() -> getCustomMessage()); +// } +// +// public static com.google.common.base.Optional<String> getOptionalGuavaName(com.google.common.base.Optional<String> name) { +// return name.or(getCustomMessageGuava()); +// } private static Optional<String> getCustomMessage() { return Optional.of("Name not provided"); diff --git a/core-java-modules/core-java-11/src/test/java/com/baeldung/EmptyStringToEmptyOptionalUnitTest.java b/core-java-modules/core-java-optional/src/test/java/com/baeldung/emptystringoptional/EmptyStringToEmptyOptionalUnitTest.java similarity index 65% rename from core-java-modules/core-java-11/src/test/java/com/baeldung/EmptyStringToEmptyOptionalUnitTest.java rename to core-java-modules/core-java-optional/src/test/java/com/baeldung/emptystringoptional/EmptyStringToEmptyOptionalUnitTest.java index cc429209d4..22e11c9a0b 100644 --- a/core-java-modules/core-java-11/src/test/java/com/baeldung/EmptyStringToEmptyOptionalUnitTest.java +++ b/core-java-modules/core-java-optional/src/test/java/com/baeldung/emptystringoptional/EmptyStringToEmptyOptionalUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung; +package com.baeldung.emptystringoptional; import com.google.common.base.Strings; import org.junit.Assert; @@ -16,12 +16,13 @@ public class EmptyStringToEmptyOptionalUnitTest { Assert.assertFalse(opt.isPresent()); } - @Test - public void givenEmptyString_whenFilteringOnOptionalInJava11_thenEmptyOptionalIsReturned() { - String str = ""; - Optional<String> opt = Optional.ofNullable(str).filter(Predicate.not(String::isEmpty)); - Assert.assertFalse(opt.isPresent()); - } +// Uncomment code when code base is compatible with Java 11 +// @Test +// public void givenEmptyString_whenFilteringOnOptionalInJava11_thenEmptyOptionalIsReturned() { +// String str = ""; +// Optional<String> opt = Optional.ofNullable(str).filter(Predicate.not(String::isEmpty)); +// Assert.assertFalse(opt.isPresent()); +// } @Test public void givenEmptyString_whenPassingResultOfEmptyToNullToOfNullable_thenEmptyOptionalIsReturned() { diff --git a/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/Java9OptionalsStreamUnitTest.java b/core-java-modules/core-java-optional/src/test/java/com/baeldung/filterstream/Java9OptionalsStreamUnitTest.java similarity index 76% rename from core-java-modules/core-java-9/src/test/java/com/baeldung/java9/Java9OptionalsStreamUnitTest.java rename to core-java-modules/core-java-optional/src/test/java/com/baeldung/filterstream/Java9OptionalsStreamUnitTest.java index 7a28a4b977..5341813164 100644 --- a/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/Java9OptionalsStreamUnitTest.java +++ b/core-java-modules/core-java-optional/src/test/java/com/baeldung/filterstream/Java9OptionalsStreamUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.java9; +package com.baeldung.filterstream; import static org.junit.Assert.assertEquals; @@ -47,15 +47,17 @@ public class Java9OptionalsStreamUnitTest { assertEquals("bar", filteredList.get(1)); } - @Test - public void filterOutPresentOptionalsWithJava9() { - assertEquals(4, listOfOptionals.size()); - List<String> filteredList = listOfOptionals.stream().flatMap(Optional::stream).collect(Collectors.toList()); - - assertEquals(2, filteredList.size()); - assertEquals("foo", filteredList.get(0)); - assertEquals("bar", filteredList.get(1)); - } +// Uncomment code when code base is compatible with Java 9 +// @Test +// public void filterOutPresentOptionalsWithJava9() { +// assertEquals(4, listOfOptionals.size()); +// +// List<String> filteredList = listOfOptionals.stream().flatMap(Optional::stream).collect(Collectors.toList()); +// +// assertEquals(2, filteredList.size()); +// assertEquals("foo", filteredList.get(0)); +// assertEquals("bar", filteredList.get(1)); +// } } diff --git a/core-java-modules/core-java-optional/src/test/java/com/baeldung/java9additions/Java9OptionalUnitTest.java b/core-java-modules/core-java-optional/src/test/java/com/baeldung/java9additions/Java9OptionalUnitTest.java new file mode 100644 index 0000000000..ee04432e44 --- /dev/null +++ b/core-java-modules/core-java-optional/src/test/java/com/baeldung/java9additions/Java9OptionalUnitTest.java @@ -0,0 +1,95 @@ +package com.baeldung.java9additions; + +import org.junit.Test; +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.List; +import java.util.Optional; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; + +// Uncomment code when code base is compatible with Java 9 +//public class Java9OptionalUnitTest { +// +// @Test +// public void givenOptionalOfSome_whenToStream_thenShouldTreatItAsOneElementStream() { +// //given +// Optional<String> value = Optional.of("a"); +// +// //when +// List<String> collect = value.stream().map(String::toUpperCase).collect(Collectors.toList()); +// +// //then +// assertThat(collect).hasSameElementsAs(List.of("A")); +// } +// +// @Test +// public void givenOptionalOfNone_whenToStream_thenShouldTreatItAsZeroElementStream() { +// //given +// Optional<String> value = Optional.empty(); +// +// //when +// List<String> collect = value.stream().map(String::toUpperCase).collect(Collectors.toList()); +// +// //then +// assertThat(collect).isEmpty(); +// } +// +// @Test +// public void givenOptional_whenPresent_thenShouldExecuteProperCallback() { +// //given +// Optional<String> value = Optional.of("properValue"); +// AtomicInteger successCounter = new AtomicInteger(0); +// AtomicInteger onEmptyOptionalCounter = new AtomicInteger(0); +// +// //when +// value.ifPresentOrElse((v) -> successCounter.incrementAndGet(), onEmptyOptionalCounter::incrementAndGet); +// +// //then +// assertThat(successCounter.get()).isEqualTo(1); +// assertThat(onEmptyOptionalCounter.get()).isEqualTo(0); +// } +// +// @Test +// public void givenOptional_whenNotPresent_thenShouldExecuteProperCallback() { +// //given +// Optional<String> value = Optional.empty(); +// AtomicInteger successCounter = new AtomicInteger(0); +// AtomicInteger onEmptyOptionalCounter = new AtomicInteger(0); +// +// //when +// value.ifPresentOrElse((v) -> successCounter.incrementAndGet(), onEmptyOptionalCounter::incrementAndGet); +// +// //then +// assertThat(successCounter.get()).isEqualTo(0); +// assertThat(onEmptyOptionalCounter.get()).isEqualTo(1); +// } +// +// @Test +// public void givenOptional_whenPresent_thenShouldTakeAValueFromIt() { +// //given +// String expected = "properValue"; +// Optional<String> value = Optional.of(expected); +// Optional<String> defaultValue = Optional.of("default"); +// +// //when +// Optional<String> result = value.or(() -> defaultValue); +// +// //then +// assertThat(result.get()).isEqualTo(expected); +// } +// +// @Test +// public void givenOptional_whenEmpty_thenShouldTakeAValueFromOr() { +// //given +// String defaultString = "default"; +// Optional<String> value = Optional.empty(); +// Optional<String> defaultValue = Optional.of(defaultString); +// +// //when +// Optional<String> result = value.or(() -> defaultValue); +// +// //then +// assertThat(result.get()).isEqualTo(defaultString); +// } +//} \ No newline at end of file diff --git a/core-java-modules/core-java-optional/src/test/java/com/baeldung/java8/optional/OptionalChainingUnitTest.java b/core-java-modules/core-java-optional/src/test/java/com/baeldung/optional/OptionalChainingUnitTest.java similarity index 98% rename from core-java-modules/core-java-optional/src/test/java/com/baeldung/java8/optional/OptionalChainingUnitTest.java rename to core-java-modules/core-java-optional/src/test/java/com/baeldung/optional/OptionalChainingUnitTest.java index 3e0d752bb6..9ef156501b 100644 --- a/core-java-modules/core-java-optional/src/test/java/com/baeldung/java8/optional/OptionalChainingUnitTest.java +++ b/core-java-modules/core-java-optional/src/test/java/com/baeldung/optional/OptionalChainingUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.java8.optional; +package com.baeldung.optional; import org.junit.Before; import org.junit.Test; diff --git a/core-java-modules/core-java-optional/src/test/java/com/baeldung/java8/optional/OptionalUnitTest.java b/core-java-modules/core-java-optional/src/test/java/com/baeldung/optional/OptionalUnitTest.java similarity index 97% rename from core-java-modules/core-java-optional/src/test/java/com/baeldung/java8/optional/OptionalUnitTest.java rename to core-java-modules/core-java-optional/src/test/java/com/baeldung/optional/OptionalUnitTest.java index bf594610bb..e5c4319bf7 100644 --- a/core-java-modules/core-java-optional/src/test/java/com/baeldung/java8/optional/OptionalUnitTest.java +++ b/core-java-modules/core-java-optional/src/test/java/com/baeldung/optional/OptionalUnitTest.java @@ -1,7 +1,5 @@ -package com.baeldung.java8.optional; +package com.baeldung.optional; -import com.baeldung.optional.Modem; -import com.baeldung.optional.Person; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -260,7 +258,7 @@ public class OptionalUnitTest { return "Default Value"; } -// Uncomment code when code base is compatiable with Java 11 +// Uncomment code when code base is compatible with Java 11 // @Test // public void givenAnEmptyOptional_thenIsEmptyBehavesAsExpected() { // Optional<String> opt = Optional.of("Baeldung"); diff --git a/core-java-modules/core-java-optional/src/test/java/com/baeldung/java8/optional/OrElseAndOrElseGetUnitTest.java b/core-java-modules/core-java-optional/src/test/java/com/baeldung/optional/orelse/OrElseAndOrElseGetUnitTest.java similarity index 94% rename from core-java-modules/core-java-optional/src/test/java/com/baeldung/java8/optional/OrElseAndOrElseGetUnitTest.java rename to core-java-modules/core-java-optional/src/test/java/com/baeldung/optional/orelse/OrElseAndOrElseGetUnitTest.java index c8a631d9f0..8f175c30eb 100644 --- a/core-java-modules/core-java-optional/src/test/java/com/baeldung/java8/optional/OrElseAndOrElseGetUnitTest.java +++ b/core-java-modules/core-java-optional/src/test/java/com/baeldung/optional/orelse/OrElseAndOrElseGetUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.java8.optional; +package com.baeldung.optional.orelse; import org.junit.Test; import org.slf4j.Logger; @@ -6,8 +6,6 @@ import org.slf4j.LoggerFactory; import static org.junit.Assert.*; -import com.baeldung.optional.OrElseAndOrElseGet; - public class OrElseAndOrElseGetUnitTest { private OrElseAndOrElseGet orElsevsOrElseGet = new OrElseAndOrElseGet(); diff --git a/core-java-modules/core-java-optional/src/test/java/com/baeldung/orelseoptional/OrElseOptionalUnitTest.java b/core-java-modules/core-java-optional/src/test/java/com/baeldung/orelseoptional/OrElseOptionalUnitTest.java new file mode 100644 index 0000000000..91aebbeebd --- /dev/null +++ b/core-java-modules/core-java-optional/src/test/java/com/baeldung/orelseoptional/OrElseOptionalUnitTest.java @@ -0,0 +1,52 @@ +package com.baeldung.orelseoptional; + +import static org.junit.Assert.assertEquals; + +import java.util.Optional; + +import org.junit.Test; + +public class OrElseOptionalUnitTest { + + @Test + public void givenOptional_whenValue_thenOptionalGeneralMethod() { + String name = "Filan Fisteku"; + String missingOptional = "Name not provided"; + Optional<String> optionalString = Optional.ofNullable(name); + Optional<String> fallbackOptionalString = Optional.ofNullable(missingOptional); + assertEquals(optionalString, OptionalUtils.or(optionalString, fallbackOptionalString)); + } + + @Test + public void givenEmptyOptional_whenValue_thenOptionalGeneralMethod() { + String missingOptional = "Name not provided"; + Optional<String> optionalString = Optional.empty(); + Optional<String> fallbackOptionalString = Optional.ofNullable(missingOptional); + assertEquals(fallbackOptionalString, OptionalUtils.or(optionalString, fallbackOptionalString)); + } + +// Uncomment code when code base is compatible with Java 9 +// @Test +// public void givenOptional_whenEmptyValue_thenCustomMessage() { +// assertEquals(Optional.of("Name not provided"), OptionalUtils.getName(Optional.ofNullable(null))); +// } +// +// @Test +// public void givenOptional_whenValue_thenOptional() { +// String name = "Filan Fisteku"; +// Optional<String> optionalString = Optional.ofNullable(name); +// assertEquals(optionalString, OptionalUtils.getName(optionalString)); +// } +// +// @Test +// public void givenGuavaOptional_whenInvoke_thenOptional() { +// String name = "Filan Fisteku"; +// com.google.common.base.Optional<String> stringOptional = com.google.common.base.Optional.of(name); +// assertEquals(stringOptional, OptionalUtils.getOptionalGuavaName(stringOptional)); +// } +// +// @Test +// public void givenGuavaOptional_whenNull_thenDefaultText() { +// assertEquals(com.google.common.base.Optional.of("Name not provided"), OptionalUtils.getOptionalGuavaName(com.google.common.base.Optional.fromNullable(null))); +// } +} \ No newline at end of file diff --git a/core-java-modules/core-java-os/pom.xml b/core-java-modules/core-java-os/pom.xml index f09b62ebf2..b934701067 100644 --- a/core-java-modules/core-java-os/pom.xml +++ b/core-java-modules/core-java-os/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>core-java-os</artifactId> <version>0.1.0-SNAPSHOT</version> <name>core-java-os</name> @@ -80,7 +80,7 @@ <!-- util --> <commons-collections4.version>4.1</commons-collections4.version> <collections-generic.version>4.01</collections-generic.version> - + <!-- testing --> <assertj.version>3.6.1</assertj.version> <asspectj.version>1.8.9</asspectj.version> @@ -90,4 +90,5 @@ <unix4j.version>0.4</unix4j.version> <grep4j.version>1.8.7</grep4j.version> </properties> + </project> diff --git a/core-java-modules/core-java-perf/pom.xml b/core-java-modules/core-java-perf/pom.xml index a6e20f198d..18e05c9741 100644 --- a/core-java-modules/core-java-perf/pom.xml +++ b/core-java-modules/core-java-perf/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> diff --git a/core-java-modules/core-java-security-manager/pom.xml b/core-java-modules/core-java-security-manager/pom.xml index f5be1639da..52f1554ace 100644 --- a/core-java-modules/core-java-security-manager/pom.xml +++ b/core-java-modules/core-java-security-manager/pom.xml @@ -1,10 +1,12 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-security-manager</artifactId> <version>0.1.0-SNAPSHOT</version> - <packaging>jar</packaging> <name>core-java-security-manager</name> - + <packaging>jar</packaging> + <parent> <groupId>com.baeldung.core-java-modules</groupId> <artifactId>core-java-modules</artifactId> diff --git a/core-java-modules/core-java-security/pom.xml b/core-java-modules/core-java-security/pom.xml index e882fd823e..cefbd3a8a7 100644 --- a/core-java-modules/core-java-security/pom.xml +++ b/core-java-modules/core-java-security/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -35,14 +36,12 @@ </dependencies> <properties> - <!-- util --> <bouncycastle.version>1.60</bouncycastle.version> <commons-codec.version>1.11</commons-codec.version> <!-- testing --> <assertj-core.version>3.10.0</assertj-core.version> - </properties> </project> diff --git a/core-java-modules/core-java-streams-2/pom.xml b/core-java-modules/core-java-streams-2/pom.xml index 20c028edaa..58f13d658c 100644 --- a/core-java-modules/core-java-streams-2/pom.xml +++ b/core-java-modules/core-java-streams-2/pom.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-streams-2</artifactId> <version>1.0</version> @@ -43,11 +44,12 @@ <scope>test</scope> </dependency> </dependencies> - + <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.9</maven.compiler.source> <maven.compiler.target>1.9</maven.compiler.target> <assertj.version>3.11.1</assertj.version> </properties> + </project> \ No newline at end of file diff --git a/core-java-modules/core-java-streams-3/README.md b/core-java-modules/core-java-streams-3/README.md index 4b2c9ed94c..a739245399 100644 --- a/core-java-modules/core-java-streams-3/README.md +++ b/core-java-modules/core-java-streams-3/README.md @@ -8,4 +8,5 @@ This module contains articles about the Stream API in Java. - [The Difference Between Collection.stream().forEach() and Collection.forEach()](https://www.baeldung.com/java-collection-stream-foreach) - [Guide to Java 8’s Collectors](https://www.baeldung.com/java-8-collectors) - [Primitive Type Streams in Java 8](https://www.baeldung.com/java-8-primitive-streams) -- More articles: [[<-- prev>]](/../core-java-streams-2) \ No newline at end of file +- [Debugging Java 8 Streams with IntelliJ](https://www.baeldung.com/intellij-debugging-java-streams) +- More articles: [[<-- prev>]](/../core-java-streams-2) diff --git a/core-java-modules/core-java-streams-3/pom.xml b/core-java-modules/core-java-streams-3/pom.xml index b5b21a4368..02503d3cab 100644 --- a/core-java-modules/core-java-streams-3/pom.xml +++ b/core-java-modules/core-java-streams-3/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -50,4 +51,5 @@ <!-- plugins --> <maven-surefire-plugin.version>2.22.1</maven-surefire-plugin.version> </properties> + </project> diff --git a/core-java-modules/core-java-streams/pom.xml b/core-java-modules/core-java-streams/pom.xml index 9b68c8dded..56fdd523fe 100644 --- a/core-java-modules/core-java-streams/pom.xml +++ b/core-java-modules/core-java-streams/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -114,8 +115,9 @@ <!-- testing --> <assertj.version>3.11.1</assertj.version> <asspectj.version>1.8.9</asspectj.version> - <maven-compiler-plugin.version>3.1</maven-compiler-plugin.version> + <maven-compiler-plugin.version>3.1</maven-compiler-plugin.version> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> </properties> + </project> diff --git a/core-java-modules/core-java-string-algorithms-2/pom.xml b/core-java-modules/core-java-string-algorithms-2/pom.xml index 5b0e710bb8..a67f1df6d2 100644 --- a/core-java-modules/core-java-string-algorithms-2/pom.xml +++ b/core-java-modules/core-java-string-algorithms-2/pom.xml @@ -1,10 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-string-algorithms-2</artifactId> <version>0.1.0-SNAPSHOT</version> - <packaging>jar</packaging> <name>core-java-string-algorithms-2</name> + <packaging>jar</packaging> <parent> <groupId>com.baeldung</groupId> diff --git a/core-java-modules/core-java-string-algorithms-3/README.md b/core-java-modules/core-java-string-algorithms-3/README.md new file mode 100644 index 0000000000..3aa31cea53 --- /dev/null +++ b/core-java-modules/core-java-string-algorithms-3/README.md @@ -0,0 +1,5 @@ +## Java String Algorithms + +This module contains articles about string-related algorithms. + +### Relevant Articles: diff --git a/core-java-modules/core-java-string-algorithms-3/pom.xml b/core-java-modules/core-java-string-algorithms-3/pom.xml new file mode 100644 index 0000000000..a5dd31c762 --- /dev/null +++ b/core-java-modules/core-java-string-algorithms-3/pom.xml @@ -0,0 +1,69 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>core-java-string-algorithms-3</artifactId> + <version>0.1.0-SNAPSHOT</version> + <packaging>jar</packaging> + <name>core-java-string-algorithms-3</name> + + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-java</artifactId> + <version>0.0.1-SNAPSHOT</version> + <relativePath>../../parent-java</relativePath> + </parent> + + <dependencies> + <!-- test scoped --> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <version>${assertj.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>28.1-jre</version> + </dependency> + + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-api</artifactId> + <version>${junit-jupiter-api.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <finalName>core-java-string-algorithms-3</finalName> + <resources> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + </resource> + </resources> + + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>${maven-compiler-plugin.version}</version> + <configuration> + <source>${java.version}</source> + <target>${java.version}</target> + <compilerArgument>-parameters</compilerArgument> + </configuration> + </plugin> + </plugins> + </build> + + <properties> + <commons-lang3.version>3.8.1</commons-lang3.version> + <assertj.version>3.6.1</assertj.version> + <guava.version>27.0.1-jre</guava.version> + <junit-jupiter-api.version>5.3.1</junit-jupiter-api.version> + </properties> + +</project> diff --git a/core-java-modules/core-java-string-algorithms-3/src/main/java/com/baeldung/anagram/Anagram.java b/core-java-modules/core-java-string-algorithms-3/src/main/java/com/baeldung/anagram/Anagram.java new file mode 100644 index 0000000000..360bc5c6de --- /dev/null +++ b/core-java-modules/core-java-string-algorithms-3/src/main/java/com/baeldung/anagram/Anagram.java @@ -0,0 +1,62 @@ +package com.baeldung.anagram; + +import java.util.Arrays; +import com.google.common.collect.HashMultiset; +import com.google.common.collect.Multiset; + +public class Anagram { + // This definition only works for single byte encoding character set. + // For multibyte encoding, such as UTF-8, 16, 32 etc., + // we need to increase this number so that it can contain all possible characters. + private static int CHARACTER_RANGE = 256; + + public boolean isAnagramSort(String string1, String string2) { + if (string1.length() != string2.length()) { + return false; + } + char[] a1 = string1.toCharArray(); + char[] a2 = string2.toCharArray(); + Arrays.sort(a1); + Arrays.sort(a2); + return Arrays.equals(a1, a2); + } + + public boolean isAnagramCounting(String string1, String string2) { + if (string1.length() != string2.length()) { + return false; + } + int count[] = new int[CHARACTER_RANGE]; + for (int i = 0; i < string1.length(); i++) { + count[string1.charAt(i)]++; + count[string2.charAt(i)]--; + } + for (int i = 0; i < CHARACTER_RANGE; i++) { + if (count[i] != 0) { + return false; + } + } + return true; + } + + public boolean isAnagramMultiset(String string1, String string2) { + if (string1.length() != string2.length()) { + return false; + } + Multiset<Character> multiset1 = HashMultiset.create(); + Multiset<Character> multiset2 = HashMultiset.create(); + for (int i = 0; i < string1.length(); i++) { + multiset1.add(string1.charAt(i)); + multiset2.add(string2.charAt(i)); + } + return multiset1.equals(multiset2); + } + + public boolean isLetterBasedAnagramMultiset(String string1, String string2) { + return isAnagramMultiset(preprocess(string1), preprocess(string2)); + } + + private String preprocess(String source) { + return source.replaceAll("[^a-zA-Z]", "").toLowerCase(); + } + +} diff --git a/core-java-modules/core-java-string-algorithms-3/src/test/java/com/baeldung/anagram/AnagramUnitTest.java b/core-java-modules/core-java-string-algorithms-3/src/test/java/com/baeldung/anagram/AnagramUnitTest.java new file mode 100644 index 0000000000..bedeeb9418 --- /dev/null +++ b/core-java-modules/core-java-string-algorithms-3/src/test/java/com/baeldung/anagram/AnagramUnitTest.java @@ -0,0 +1,72 @@ +package com.baeldung.anagram; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +public class AnagramUnitTest { + @Test + public void givenAnagram_whenUsingSort_thenIdentifyAnagram() { + Anagram anagram = new Anagram(); + String string1 = "abcab"; + String string2 = "cabba"; + assertTrue(anagram.isAnagramSort(string1, string2)); + } + + @Test + public void givenAnagram_whenUsingCounting_thenIdentifyAnagram() { + Anagram anagram = new Anagram(); + String string1 = "abcab"; + String string2 = "cabba"; + assertTrue(anagram.isAnagramCounting(string1, string2)); + } + + @Test + public void givenAnagram_whenUsingMultiset_thenIdentifyAnagram() { + Anagram anagram = new Anagram(); + String string1 = "abcab"; + String string2 = "cabba"; + assertTrue(anagram.isAnagramMultiset(string1, string2)); + } + + @Test + public void givenAnagram_whenUsingLetterBasedMultiset_thenIdentifyAnagram() { + Anagram anagram = new Anagram(); + String string1 = "A decimal point"; + String string2 = "I’m a dot in place."; + assertTrue(anagram.isLetterBasedAnagramMultiset(string1, string2)); + } + + @Test + public void givenNonAnagram_whenUsingSort_thenIdentifyNotAnagram() { + Anagram anagram = new Anagram(); + String string1 = "abcaba"; + String string2 = "cabbac"; + assertFalse(anagram.isAnagramSort(string1, string2)); + } + + @Test + public void givenNonAnagram_whenUsingCounting_thenIdentifyNotAnagram() { + Anagram anagram = new Anagram(); + String string1 = "abcaba"; + String string2 = "cabbac"; + assertFalse(anagram.isAnagramCounting(string1, string2)); + } + + @Test + public void givenNonAnagram_whenUsingMultiset_thenIdentifyNotAnagram() { + Anagram anagram = new Anagram(); + String string1 = "abcaba"; + String string2 = "cabbac"; + assertFalse(anagram.isAnagramMultiset(string1, string2)); + } + + @Test + public void ggivenNonAnagram_whenUsingLetterBasedMultiset_thenIdentifyAnagram() { + Anagram anagram = new Anagram(); + String string1 = "A decimal point"; + String string2 = "I’m dot in place."; + assertFalse(anagram.isAnagramMultiset(string1, string2)); + } +} diff --git a/core-java-modules/core-java-string-algorithms/pom.xml b/core-java-modules/core-java-string-algorithms/pom.xml index f1b7499b6d..6cae320f1d 100644 --- a/core-java-modules/core-java-string-algorithms/pom.xml +++ b/core-java-modules/core-java-string-algorithms/pom.xml @@ -1,10 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-string-algorithms</artifactId> <version>0.1.0-SNAPSHOT</version> - <packaging>jar</packaging> <name>core-java-string-algorithms</name> + <packaging>jar</packaging> <parent> <groupId>com.baeldung</groupId> diff --git a/core-java-modules/core-java-string-apis/pom.xml b/core-java-modules/core-java-string-apis/pom.xml index 7d9d888fa1..6d0fd4c6fd 100644 --- a/core-java-modules/core-java-string-apis/pom.xml +++ b/core-java-modules/core-java-string-apis/pom.xml @@ -1,10 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-string-apis</artifactId> <version>0.1.0-SNAPSHOT</version> - <packaging>jar</packaging> <name>core-java-string-apis</name> + <packaging>jar</packaging> <parent> <groupId>com.baeldung</groupId> diff --git a/core-java-modules/core-java-string-conversions-2/pom.xml b/core-java-modules/core-java-string-conversions-2/pom.xml index 396d836e6b..58b00b757a 100644 --- a/core-java-modules/core-java-string-conversions-2/pom.xml +++ b/core-java-modules/core-java-string-conversions-2/pom.xml @@ -1,10 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-string-conversions-2</artifactId> <version>0.1.0-SNAPSHOT</version> - <packaging>jar</packaging> <name>core-java-string-conversions-2</name> + <packaging>jar</packaging> <parent> <groupId>com.baeldung</groupId> @@ -41,7 +42,6 @@ <filtering>true</filtering> </resource> </resources> - </build> </project> diff --git a/core-java-modules/core-java-string-conversions/pom.xml b/core-java-modules/core-java-string-conversions/pom.xml index 9c968b7f1c..e3d6036e53 100644 --- a/core-java-modules/core-java-string-conversions/pom.xml +++ b/core-java-modules/core-java-string-conversions/pom.xml @@ -1,10 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-string-conversions</artifactId> <version>0.1.0-SNAPSHOT</version> - <packaging>jar</packaging> <name>core-java-string-conversions</name> + <packaging>jar</packaging> <parent> <groupId>com.baeldung</groupId> diff --git a/core-java-modules/core-java-string-operations-2/pom.xml b/core-java-modules/core-java-string-operations-2/pom.xml index 95aeec8fcb..bd1a34f89f 100644 --- a/core-java-modules/core-java-string-operations-2/pom.xml +++ b/core-java-modules/core-java-string-operations-2/pom.xml @@ -1,10 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-string-operations-2</artifactId> <version>0.1.0-SNAPSHOT</version> - <packaging>jar</packaging> <name>core-java-string-operations-2</name> + <packaging>jar</packaging> <parent> <groupId>com.baeldung</groupId> diff --git a/core-java-modules/core-java-string-operations/pom.xml b/core-java-modules/core-java-string-operations/pom.xml index fdddd99433..a1921c029f 100644 --- a/core-java-modules/core-java-string-operations/pom.xml +++ b/core-java-modules/core-java-string-operations/pom.xml @@ -1,10 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-string-operations</artifactId> <version>0.1.0-SNAPSHOT</version> - <packaging>jar</packaging> <name>core-java-string-operations</name> + <packaging>jar</packaging> <parent> <groupId>com.baeldung</groupId> @@ -58,7 +59,7 @@ </build> <properties> - <commons-lang3.version>3.8.1</commons-lang3.version> + <commons-lang3.version>3.9</commons-lang3.version> <assertj.version>3.6.1</assertj.version> <commons-codec.version>1.10</commons-codec.version> </properties> diff --git a/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/isnumeric/Benchmarking.java b/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/isnumeric/Benchmarking.java index 97e7a46757..847b587cdc 100644 --- a/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/isnumeric/Benchmarking.java +++ b/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/isnumeric/Benchmarking.java @@ -1,6 +1,9 @@ package com.baeldung.isnumeric; +import java.util.HashMap; +import java.util.Map; import java.util.concurrent.TimeUnit; +import java.util.function.Function; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; @@ -14,6 +17,8 @@ import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; public class Benchmarking { + private static final TestMode MODE = TestMode.DIVERS; + public static void main(String[] args) throws RunnerException { Options opt = new OptionsBuilder().include(Benchmarking.class.getSimpleName()) .forks(1) @@ -22,52 +27,89 @@ public class Benchmarking { new Runner(opt).run(); } + private static final IsNumeric subject = new IsNumeric(); + @State(Scope.Thread) public static class ExecutionPlan { - public String number = Integer.toString(Integer.MAX_VALUE); - public boolean isNumber = false; - public IsNumeric isNumeric = new IsNumeric(); + private final Map<String, Boolean> testPlan = testPlan(); + + void validate(Function<String, Boolean> functionUnderTest) { + testPlan.forEach((key, value) -> { + Boolean result = functionUnderTest.apply(key); + + assertEquals(value, result, key); + }); + } + + private void assertEquals(Boolean expectedResult, Boolean result, String input) { + if (result != expectedResult) { + throw new IllegalStateException("The output does not match the expected output, for input: " + input); + } + } + + private Map<String, Boolean> testPlan() { + HashMap<String, Boolean> plan = new HashMap<>(); + plan.put(Integer.toString(Integer.MAX_VALUE), true); + + if (MODE == TestMode.SIMPLE) { + return plan; + } + + plan.put("x0", false); + plan.put("0..005", false); + plan.put("--11", false); + plan.put("test", false); + plan.put(null, false); + for (int i = 0; i < 94; i++) { + plan.put(Integer.toString(i), true); + } + return plan; + } } @Benchmark @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) public void usingCoreJava(ExecutionPlan plan) { - plan.isNumber = plan.isNumeric.usingCoreJava(plan.number); + plan.validate(subject::usingCoreJava); } @Benchmark @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) public void usingRegularExpressions(ExecutionPlan plan) { - plan.isNumber = plan.isNumeric.usingRegularExpressions(plan.number); + plan.validate(subject::usingPreCompiledRegularExpressions); } @Benchmark @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) public void usingNumberUtils_isCreatable(ExecutionPlan plan) { - plan.isNumber = plan.isNumeric.usingNumberUtils_isCreatable(plan.number); + plan.validate(subject::usingNumberUtils_isCreatable); } @Benchmark @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) public void usingNumberUtils_isParsable(ExecutionPlan plan) { - plan.isNumber = plan.isNumeric.usingNumberUtils_isParsable(plan.number); + plan.validate(subject::usingNumberUtils_isParsable); } @Benchmark @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) public void usingStringUtils_isNumeric(ExecutionPlan plan) { - plan.isNumber = plan.isNumeric.usingStringUtils_isNumeric(plan.number); + plan.validate(subject::usingStringUtils_isNumeric); } @Benchmark @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) public void usingStringUtils_isNumericSpace(ExecutionPlan plan) { - plan.isNumber = plan.isNumeric.usingStringUtils_isNumericSpace(plan.number); + plan.validate(subject::usingStringUtils_isNumericSpace); + } + + private enum TestMode { + SIMPLE, DIVERS } } \ No newline at end of file diff --git a/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/isnumeric/CheckIntegerInput.java b/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/isnumeric/CheckIntegerInput.java deleted file mode 100644 index 6c08615c74..0000000000 --- a/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/isnumeric/CheckIntegerInput.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung.isnumeric; - -import java.util.Scanner; - -public class CheckIntegerInput { - - public static void main(String[] args) { - try (Scanner scanner = new Scanner(System.in)) { - System.out.println("Enter an integer : "); - - if (scanner.hasNextInt()) { - System.out.println("You entered : " + scanner.nextInt()); - } else { - System.out.println("The input is not an integer"); - } - } - } -} \ No newline at end of file diff --git a/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/isnumeric/IsNumeric.java b/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/isnumeric/IsNumeric.java index 6eed0d777d..4cfaf384c2 100644 --- a/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/isnumeric/IsNumeric.java +++ b/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/isnumeric/IsNumeric.java @@ -1,20 +1,33 @@ package com.baeldung.isnumeric; +import java.util.regex.Pattern; + import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; public class IsNumeric { + private final Pattern pattern = Pattern.compile("-?\\d+(\\.\\d+)?"); + public boolean usingCoreJava(String strNum) { + if (strNum == null) { + return false; + } + try { Double.parseDouble(strNum); - } catch (NumberFormatException | NullPointerException nfe) { + } catch (NumberFormatException nfe) { return false; } return true; } - public boolean usingRegularExpressions(String strNum) { - return strNum.matches("-?\\d+(\\.\\d+)?"); + public boolean usingPreCompiledRegularExpressions(String strNum) { + if (strNum == null) { + return false; + } + + return pattern.matcher(strNum) + .matches(); } public boolean usingNumberUtils_isCreatable(String strNum) { diff --git a/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/isnumeric/IsNumericDriver.java b/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/isnumeric/IsNumericDriver.java index a6c5449696..f174497323 100644 --- a/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/isnumeric/IsNumericDriver.java +++ b/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/isnumeric/IsNumericDriver.java @@ -13,8 +13,8 @@ public class IsNumericDriver { boolean res = isNumeric.usingCoreJava("1001"); LOG.info("Using Core Java : " + res); - res = isNumeric.usingRegularExpressions("1001"); - LOG.info("Using Regular Expressions : " + res); + res = isNumeric.usingPreCompiledRegularExpressions("1001"); + LOG.info("Using Pre-compiled Regular Expressions : " + res); res = isNumeric.usingNumberUtils_isCreatable("1001"); LOG.info("Using NumberUtils.isCreatable : " + res); diff --git a/core-java-modules/core-java-string-operations/src/test/java/com/baeldung/isnumeric/CoreJavaIsNumericUnitTest.java b/core-java-modules/core-java-string-operations/src/test/java/com/baeldung/isnumeric/CoreJavaIsNumericUnitTest.java index 6c03b00e69..5159012aff 100644 --- a/core-java-modules/core-java-string-operations/src/test/java/com/baeldung/isnumeric/CoreJavaIsNumericUnitTest.java +++ b/core-java-modules/core-java-string-operations/src/test/java/com/baeldung/isnumeric/CoreJavaIsNumericUnitTest.java @@ -6,9 +6,13 @@ import org.junit.Test; public class CoreJavaIsNumericUnitTest { public static boolean isNumeric(String strNum) { + if (strNum == null) { + return false; + } + try { - double d = Double.parseDouble(strNum); - } catch (NumberFormatException | NullPointerException nfe) { + Double.parseDouble(strNum); + } catch (NumberFormatException nfe) { return false; } return true; diff --git a/core-java-modules/core-java-string-operations/src/test/java/com/baeldung/isnumeric/RegularExpressionsUnitTest.java b/core-java-modules/core-java-string-operations/src/test/java/com/baeldung/isnumeric/RegularExpressionsUnitTest.java index 04f3de8dc5..48c9825baa 100644 --- a/core-java-modules/core-java-string-operations/src/test/java/com/baeldung/isnumeric/RegularExpressionsUnitTest.java +++ b/core-java-modules/core-java-string-operations/src/test/java/com/baeldung/isnumeric/RegularExpressionsUnitTest.java @@ -2,11 +2,19 @@ package com.baeldung.isnumeric; import static org.assertj.core.api.Assertions.assertThat; +import java.util.regex.Pattern; + import org.junit.Test; public class RegularExpressionsUnitTest { - public static boolean isNumeric(String strNum) { - return strNum.matches("-?\\d+(\\.\\d+)?"); + private final Pattern pattern = Pattern.compile("-?\\d+(\\.\\d+)?"); + + public boolean isNumeric(String strNum) { + if (strNum == null) { + return false; + } + return pattern.matcher(strNum) + .matches(); } @Test @@ -17,6 +25,7 @@ public class RegularExpressionsUnitTest { assertThat(isNumeric("-200")).isTrue(); // Invalid Numbers + assertThat(isNumeric(null)).isFalse(); assertThat(isNumeric("abc")).isFalse(); } } diff --git a/core-java-modules/core-java-strings/pom.xml b/core-java-modules/core-java-strings/pom.xml index 6a80886549..9dfe48527f 100644 --- a/core-java-modules/core-java-strings/pom.xml +++ b/core-java-modules/core-java-strings/pom.xml @@ -1,10 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-strings</artifactId> <version>0.1.0-SNAPSHOT</version> - <packaging>jar</packaging> <name>core-java-strings</name> + <packaging>jar</packaging> <parent> <groupId>com.baeldung</groupId> diff --git a/core-java-modules/core-java-sun/pom.xml b/core-java-modules/core-java-sun/pom.xml index 7774d1f9b3..03b6646fec 100644 --- a/core-java-modules/core-java-sun/pom.xml +++ b/core-java-modules/core-java-sun/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-java-sun</artifactId> <version>0.1.0-SNAPSHOT</version> @@ -31,7 +32,7 @@ </dependencies> <build> - <finalName>core-java</finalName> + <finalName>core-java-sun</finalName> <resources> <resource> <directory>src/main/resources</directory> @@ -64,7 +65,7 @@ <argument>-Xmx300m</argument> <argument>-XX:+UseParallelGC</argument> <argument>-classpath</argument> - <classpath /> + <classpath/> <argument>com.baeldung.outofmemoryerror.OutOfMemoryGCLimitExceed</argument> </arguments> </configuration> @@ -94,7 +95,7 @@ <executable>java</executable> <arguments> <argument>-classpath</argument> - <classpath /> + <classpath/> <argument>org.openjdk.jmh.Main</argument> <argument>.*</argument> </arguments> diff --git a/core-java-modules/core-java-text/pom.xml b/core-java-modules/core-java-text/pom.xml index 43b0df6309..640b90764a 100644 --- a/core-java-modules/core-java-text/pom.xml +++ b/core-java-modules/core-java-text/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> diff --git a/core-java-modules/core-java-time-measurements/pom.xml b/core-java-modules/core-java-time-measurements/pom.xml index 0ff3787051..9377b04690 100644 --- a/core-java-modules/core-java-time-measurements/pom.xml +++ b/core-java-modules/core-java-time-measurements/pom.xml @@ -1,19 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung.exception.numberformat</groupId> - <artifactId>core-java-time-measurements</artifactId> - <version>0.0.1-SNAPSHOT</version> - <packaging>jar</packaging> - <name>core-java-time-measurements</name> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>com.baeldung.exception.numberformat</groupId> + <artifactId>core-java-time-measurements</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>core-java-time-measurements</name> + <packaging>jar</packaging> - <parent> - <groupId>com.baeldung</groupId> - <artifactId>parent-java</artifactId> - <version>0.0.1-SNAPSHOT</version> - <relativePath>../../parent-java</relativePath> - </parent> + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-java</artifactId> + <version>0.0.1-SNAPSHOT</version> + <relativePath>../../parent-java</relativePath> + </parent> <dependencies> <dependency> @@ -99,4 +100,5 @@ <!-- plugins --> <maven-surefire-plugin.version>2.22.1</maven-surefire-plugin.version> </properties> + </project> diff --git a/core-java-modules/core-java/README.md b/core-java-modules/core-java/README.md index dd5e7dc14e..c7ae946ab5 100644 --- a/core-java-modules/core-java/README.md +++ b/core-java-modules/core-java/README.md @@ -23,7 +23,6 @@ - [Java Global Exception Handler](http://www.baeldung.com/java-global-exception-handler) - [How to Get the Size of an Object in Java](http://www.baeldung.com/java-size-of-object) - [Common Java Exceptions](http://www.baeldung.com/java-common-exceptions) -- [Throw Exception in Optional in Java 8](https://www.baeldung.com/java-optional-throw-exception) - [Merging java.util.Properties Objects](https://www.baeldung.com/java-merging-properties) - [Java – Try with Resources](https://www.baeldung.com/java-try-with-resources) - [Guide to Character Encoding](https://www.baeldung.com/java-char-encoding) diff --git a/core-java-modules/core-java/pom.xml b/core-java-modules/core-java/pom.xml index 9d4bee081e..341363f8ed 100644 --- a/core-java-modules/core-java/pom.xml +++ b/core-java-modules/core-java/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -195,12 +196,12 @@ <argument>-Xmx300m</argument> <argument>-XX:+UseParallelGC</argument> <argument>-classpath</argument> - <classpath /> + <classpath/> <argument>com.baeldung.outofmemoryerror.OutOfMemoryGCLimitExceed</argument> </arguments> </configuration> </plugin> - + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> @@ -261,7 +262,7 @@ <executable>java</executable> <arguments> <argument>-classpath</argument> - <classpath /> + <classpath/> <argument>org.openjdk.jmh.Main</argument> <argument>.*</argument> </arguments> @@ -383,7 +384,7 @@ <!-- util --> <unix4j.version>0.4</unix4j.version> <grep4j.version>1.8.7</grep4j.version> - + <!-- testing --> <assertj-core.version>3.10.0</assertj-core.version> @@ -397,4 +398,5 @@ <spring-boot-maven-plugin.version>2.0.3.RELEASE</spring-boot-maven-plugin.version> <exec-maven-plugin.version>1.6.0</exec-maven-plugin.version> </properties> + </project> diff --git a/core-java-modules/multimodulemavenproject/daomodule/pom.xml b/core-java-modules/multimodulemavenproject/daomodule/pom.xml index e98c48aa76..79c2628ea4 100644 --- a/core-java-modules/multimodulemavenproject/daomodule/pom.xml +++ b/core-java-modules/multimodulemavenproject/daomodule/pom.xml @@ -1,17 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.daomodule</groupId> <artifactId>daomodule</artifactId> <version>1.0</version> <packaging>jar</packaging> - + <parent> <groupId>com.baeldung.multimodulemavenproject</groupId> <artifactId>multimodulemavenproject</artifactId> <version>1.0</version> </parent> - + <build> <plugins> <plugin> @@ -20,9 +21,10 @@ </plugin> </plugins> </build> - + <properties> <maven.compiler.source>9</maven.compiler.source> <maven.compiler.target>9</maven.compiler.target> </properties> + </project> \ No newline at end of file diff --git a/core-java-modules/multimodulemavenproject/entitymodule/pom.xml b/core-java-modules/multimodulemavenproject/entitymodule/pom.xml index b90a7ed068..2cc789ffbb 100644 --- a/core-java-modules/multimodulemavenproject/entitymodule/pom.xml +++ b/core-java-modules/multimodulemavenproject/entitymodule/pom.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.entitymodule</groupId> <artifactId>entitymodule</artifactId> @@ -11,7 +12,7 @@ <artifactId>multimodulemavenproject</artifactId> <version>1.0</version> </parent> - + <build> <plugins> <plugin> @@ -20,10 +21,10 @@ </plugin> </plugins> </build> - - <properties> + + <properties> <maven.compiler.source>9</maven.compiler.source> <maven.compiler.target>9</maven.compiler.target> </properties> - + </project> \ No newline at end of file diff --git a/core-java-modules/multimodulemavenproject/mainappmodule/pom.xml b/core-java-modules/multimodulemavenproject/mainappmodule/pom.xml index 1f44a1690c..fa2d92d67f 100644 --- a/core-java-modules/multimodulemavenproject/mainappmodule/pom.xml +++ b/core-java-modules/multimodulemavenproject/mainappmodule/pom.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.mainappmodule</groupId> <artifactId>mainappmodule</artifactId> @@ -11,7 +12,7 @@ <artifactId>multimodulemavenproject</artifactId> <version>1.0</version> </parent> - + <dependencies> <dependency> <groupId>com.baeldung.entitymodule</groupId> @@ -29,7 +30,7 @@ <version>1.0</version> </dependency> </dependencies> - + <build> <plugins> <plugin> @@ -38,9 +39,10 @@ </plugin> </plugins> </build> - + <properties> <maven.compiler.source>9</maven.compiler.source> <maven.compiler.target>9</maven.compiler.target> </properties> + </project> \ No newline at end of file diff --git a/core-java-modules/multimodulemavenproject/pom.xml b/core-java-modules/multimodulemavenproject/pom.xml index ad347a4179..1d4aebf32e 100644 --- a/core-java-modules/multimodulemavenproject/pom.xml +++ b/core-java-modules/multimodulemavenproject/pom.xml @@ -1,26 +1,27 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.multimodulemavenproject</groupId> <artifactId>multimodulemavenproject</artifactId> <version>1.0</version> - <packaging>pom</packaging> <name>multimodulemavenproject</name> - + <packaging>pom</packaging> + <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> <relativePath>../../</relativePath> </parent> - + <modules> <module>entitymodule</module> <module>daomodule</module> <module>userdaomodule</module> <module>mainappmodule</module> </modules> - + <dependencyManagement> <dependencies> <dependency> @@ -37,7 +38,7 @@ </dependency> </dependencies> </dependencyManagement> - + <build> <pluginManagement> <plugins> @@ -46,18 +47,17 @@ <artifactId>maven-compiler-plugin</artifactId> <version>3.8.0</version> <configuration> - <configuration> - <source>1.9</source> - <target>1.9</target> - </configuration> + <source>1.9</source> + <target>1.9</target> </configuration> </plugin> </plugins> </pluginManagement> </build> - + <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <assertj-core.version>3.12.2</assertj-core.version> </properties> + </project> diff --git a/core-java-modules/multimodulemavenproject/userdaomodule/pom.xml b/core-java-modules/multimodulemavenproject/userdaomodule/pom.xml index d3543d5864..19012708cf 100644 --- a/core-java-modules/multimodulemavenproject/userdaomodule/pom.xml +++ b/core-java-modules/multimodulemavenproject/userdaomodule/pom.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.userdaomodule</groupId> <artifactId>userdaomodule</artifactId> @@ -11,7 +12,7 @@ <artifactId>multimodulemavenproject</artifactId> <version>1.0</version> </parent> - + <dependencies> <dependency> <groupId>com.baeldung.entitymodule</groupId> @@ -24,7 +25,7 @@ <version>1.0</version> </dependency> </dependencies> - + <build> <plugins> <plugin> @@ -33,10 +34,10 @@ </plugin> </plugins> </build> - + <properties> <maven.compiler.source>9</maven.compiler.source> <maven.compiler.target>9</maven.compiler.target> </properties> - + </project> \ No newline at end of file diff --git a/core-java-modules/pom.xml b/core-java-modules/pom.xml index 16ec19835a..dcc98d77f6 100644 --- a/core-java-modules/pom.xml +++ b/core-java-modules/pom.xml @@ -1,15 +1,15 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.core-java-modules</groupId> <artifactId>core-java-modules</artifactId> <name>core-java-modules</name> <packaging>pom</packaging> - + <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> @@ -21,5 +21,5 @@ <module>core-java-security-manager</module> <module>core-java-date-operations</module> </modules> - + </project> diff --git a/core-java-modules/pre-jpms/pom.xml b/core-java-modules/pre-jpms/pom.xml index f37daed0a5..cb23427138 100644 --- a/core-java-modules/pre-jpms/pom.xml +++ b/core-java-modules/pre-jpms/pom.xml @@ -1,72 +1,73 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <artifactId>pre-jpms</artifactId> - <version>0.0.1-SNAPSHOT</version> - <packaging>jar</packaging> - <name>pre-jpms</name> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>pre-jpms</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>pre-jpms</name> + <packaging>jar</packaging> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> <relativePath>../../</relativePath> </parent> - <dependencies> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <version>${org.slf4j.version}</version> - </dependency> - </dependencies> + <dependencies> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>${org.slf4j.version}</version> + </dependency> + </dependencies> - <build> - <finalName>pre-jpms</finalName> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.8.0</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-dependency-plugin</artifactId> - <version>3.1.1</version> - <executions> - <execution> - <id>copy-dependencies</id> - <phase>package</phase> - <goals> - <goal>copy-dependencies</goal> - </goals> - <configuration> - <outputDirectory> - ${project.build.directory}/dependency-jars/ - </outputDirectory> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <configuration> - <archive> - <manifest> - <mainClass>com.baeldung.prejpms.App</mainClass> - <addClasspath>true</addClasspath> - <classpathPrefix>dependency-jars/</classpathPrefix> - </manifest> - </archive> - </configuration> - </plugin> - </plugins> - </build> + <build> + <finalName>pre-jpms</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.0</version> + <configuration> + <source>1.8</source> + <target>1.8</target> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <version>3.1.1</version> + <executions> + <execution> + <id>copy-dependencies</id> + <phase>package</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + <configuration> + <outputDirectory> + ${project.build.directory}/dependency-jars/ + </outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifest> + <mainClass>com.baeldung.prejpms.App</mainClass> + <addClasspath>true</addClasspath> + <classpathPrefix>dependency-jars/</classpathPrefix> + </manifest> + </archive> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/core-kotlin-2/README.md b/core-kotlin-2/README.md index 06dda396d9..5a443c1831 100644 --- a/core-kotlin-2/README.md +++ b/core-kotlin-2/README.md @@ -10,7 +10,5 @@ This module contains articles about core Kotlin. - [Kotlin Scope Functions](https://www.baeldung.com/kotlin-scope-functions) - [Kotlin Annotations](https://www.baeldung.com/kotlin-annotations) - [Split a List into Parts in Kotlin](https://www.baeldung.com/kotlin-split-list-into-parts) -- [String Comparison in Kotlin](https://www.baeldung.com/kotlin-string-comparison) -- [Guide to JVM Platform Annotations in Kotlin](https://www.baeldung.com/kotlin-jvm-annotations) - [Finding an Element in a List Using Kotlin](https://www.baeldung.com/kotlin-finding-element-in-list) - More articles: [[<-- prev]](/core-kotlin) diff --git a/core-kotlin-io/.gitignore b/core-kotlin-io/.gitignore deleted file mode 100644 index f521947850..0000000000 --- a/core-kotlin-io/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -/bin/ - -#ignore gradle -.gradle/ - - -#ignore build and generated files -build/ -node/ -target/ -out/ diff --git a/core-kotlin-io/pom.xml b/core-kotlin-io/pom.xml deleted file mode 100644 index 78b36626d6..0000000000 --- a/core-kotlin-io/pom.xml +++ /dev/null @@ -1,97 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <artifactId>core-kotlin-io</artifactId> - <name>core-kotlin-io</name> - <packaging>jar</packaging> - - <parent> - <groupId>com.baeldung</groupId> - <artifactId>parent-kotlin</artifactId> - <version>1.0.0-SNAPSHOT</version> - <relativePath>../parent-kotlin</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>org.jetbrains.kotlin</groupId> - <artifactId>kotlin-stdlib-jdk8</artifactId> - <version>${kotlin.version}</version> - </dependency> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter</artifactId> - <version>${junit-jupiter.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <version>${mockito.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>net.bytebuddy</groupId> - <artifactId>byte-buddy</artifactId> - <version>${byte-buddy.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <version>${assertj.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.jetbrains.kotlin</groupId> - <artifactId>kotlin-test</artifactId> - <version>${kotlin.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.jetbrains.kotlin</groupId> - <artifactId>kotlin-test-junit5</artifactId> - <version>${kotlin.version}</version> - <scope>test</scope> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.jetbrains.kotlin</groupId> - <artifactId>kotlin-maven-plugin</artifactId> - <version>${kotlin.version}</version> - <executions> - <execution> - <id>compile</id> - <phase>compile</phase> - <goals> - <goal>compile</goal> - </goals> - </execution> - <execution> - <id>test-compile</id> - <phase>test-compile</phase> - <goals> - <goal>test-compile</goal> - </goals> - </execution> - </executions> - <configuration> - <jvmTarget>1.8</jvmTarget> - </configuration> - </plugin> - </plugins> - </build> - - <properties> - <kotlin.version>1.3.30</kotlin.version> - <junit-jupiter.version>5.4.2</junit-jupiter.version> - <mockito.version>2.27.0</mockito.version> - <byte-buddy.version>1.9.12</byte-buddy.version> - <assertj.version>3.10.0</assertj.version> - </properties> - -</project> diff --git a/core-kotlin-modules/README.md b/core-kotlin-modules/README.md new file mode 100644 index 0000000000..974db9378a --- /dev/null +++ b/core-kotlin-modules/README.md @@ -0,0 +1,5 @@ +## Core Kotlin + +This module contains articles about core Kotlin. + + diff --git a/core-kotlin-modules/core-kotlin-annotations/README.md b/core-kotlin-modules/core-kotlin-annotations/README.md new file mode 100644 index 0000000000..787b67be11 --- /dev/null +++ b/core-kotlin-modules/core-kotlin-annotations/README.md @@ -0,0 +1,8 @@ +## Core Kotlin Annotations + +This module contains articles about core Kotlin annotations. + +### Relevant articles: +- [Kotlin Annotations](https://www.baeldung.com/kotlin-annotations) +- [Guide to Kotlin @JvmField](https://www.baeldung.com/kotlin-jvm-field-annotation) +- [Guide to JVM Platform Annotations in Kotlin](https://www.baeldung.com/kotlin-jvm-annotations) diff --git a/core-kotlin-modules/core-kotlin-annotations/pom.xml b/core-kotlin-modules/core-kotlin-annotations/pom.xml new file mode 100644 index 0000000000..77670be151 --- /dev/null +++ b/core-kotlin-modules/core-kotlin-annotations/pom.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>core-kotlin-annotations</artifactId> + <name>core-kotlin-annotations</name> + <packaging>jar</packaging> + + <parent> + <groupId>com.baeldung.core-kotlin-modules</groupId> + <artifactId>core-kotlin-modules</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> + + <dependencies> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-stdlib-jdk8</artifactId> + <version>${kotlin.version}</version> + </dependency> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <version>${assertj.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-test</artifactId> + <version>${kotlin.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + + <properties> + <kotlin.version>1.3.30</kotlin.version> + <assertj.version>3.10.0</assertj.version> + </properties> + +</project> \ No newline at end of file diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/annotations/Annotations.kt b/core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/annotations/Annotations.kt similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/annotations/Annotations.kt rename to core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/annotations/Annotations.kt diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/annotations/Item.kt b/core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/annotations/Item.kt similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/annotations/Item.kt rename to core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/annotations/Item.kt diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/annotations/Main.kt b/core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/annotations/Main.kt similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/annotations/Main.kt rename to core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/annotations/Main.kt diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/annotations/Validator.kt b/core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/annotations/Validator.kt similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/annotations/Validator.kt rename to core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/annotations/Validator.kt diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/Document.kt b/core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmannotations/Document.kt similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/Document.kt rename to core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmannotations/Document.kt diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/HtmlDocument.java b/core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmannotations/HtmlDocument.java similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/HtmlDocument.java rename to core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmannotations/HtmlDocument.java diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/Message.kt b/core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmannotations/Message.kt similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/Message.kt rename to core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmannotations/Message.kt diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/MessageConverter.kt b/core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmannotations/MessageConverter.kt similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/MessageConverter.kt rename to core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmannotations/MessageConverter.kt diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/TextDocument.kt b/core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmannotations/TextDocument.kt similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/TextDocument.kt rename to core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmannotations/TextDocument.kt diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/XmlDocument.kt b/core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmannotations/XmlDocument.kt similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/XmlDocument.kt rename to core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmannotations/XmlDocument.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/JvmSample.kt b/core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmfield/JvmSample.kt similarity index 84% rename from core-kotlin/src/main/kotlin/com/baeldung/kotlin/JvmSample.kt rename to core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmfield/JvmSample.kt index 610d5282b2..e60894ba88 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/JvmSample.kt +++ b/core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmfield/JvmSample.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin +package com.baeldung.jvmfield class JvmSample(text:String) { @JvmField diff --git a/core-kotlin-2/src/test/kotlin/com/baeldung/annotations/ValidationTest.kt b/core-kotlin-modules/core-kotlin-annotations/src/test/kotlin/com/baeldung/annotations/ValidationTest.kt similarity index 100% rename from core-kotlin-2/src/test/kotlin/com/baeldung/annotations/ValidationTest.kt rename to core-kotlin-modules/core-kotlin-annotations/src/test/kotlin/com/baeldung/annotations/ValidationTest.kt diff --git a/core-kotlin-2/src/test/kotlin/com/baeldung/range/DocumentTest.kt b/core-kotlin-modules/core-kotlin-annotations/src/test/kotlin/com/baeldung/jvmannotations/DocumentTest.kt similarity index 100% rename from core-kotlin-2/src/test/kotlin/com/baeldung/range/DocumentTest.kt rename to core-kotlin-modules/core-kotlin-annotations/src/test/kotlin/com/baeldung/jvmannotations/DocumentTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/JvmSampleTest.kt b/core-kotlin-modules/core-kotlin-annotations/src/test/kotlin/com/baeldung/jvmfield/JvmSampleTest.kt similarity index 94% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/JvmSampleTest.kt rename to core-kotlin-modules/core-kotlin-annotations/src/test/kotlin/com/baeldung/jvmfield/JvmSampleTest.kt index abe6edec92..769c0311c4 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/JvmSampleTest.kt +++ b/core-kotlin-modules/core-kotlin-annotations/src/test/kotlin/com/baeldung/jvmfield/JvmSampleTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin +package com.baeldung.jvmfield import org.junit.Before import org.junit.Test diff --git a/core-kotlin-io/README.md b/core-kotlin-modules/core-kotlin-io/README.md similarity index 62% rename from core-kotlin-io/README.md rename to core-kotlin-modules/core-kotlin-io/README.md index ad4c503895..89f9534d4b 100644 --- a/core-kotlin-io/README.md +++ b/core-kotlin-modules/core-kotlin-io/README.md @@ -3,7 +3,7 @@ This module contains articles about core Kotlin I/O. ### Relevant articles: - - [InputStream to String in Kotlin](https://www.baeldung.com/kotlin-inputstream-to-string) - [Console I/O in Kotlin](https://www.baeldung.com/kotlin-console-io) - +- [Reading from a File in Kotlin](https://www.baeldung.com/kotlin-read-file) +- [Writing to a File in Kotlin](https://www.baeldung.com/kotlin-write-file) diff --git a/core-kotlin-modules/core-kotlin-io/pom.xml b/core-kotlin-modules/core-kotlin-io/pom.xml new file mode 100644 index 0000000000..9443cd0d5b --- /dev/null +++ b/core-kotlin-modules/core-kotlin-io/pom.xml @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>core-kotlin-io</artifactId> + <name>core-kotlin-io</name> + <packaging>jar</packaging> + + <parent> + <groupId>com.baeldung.core-kotlin-modules</groupId> + <artifactId>core-kotlin-modules</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> + + <dependencies> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-stdlib-jdk8</artifactId> + <version>${kotlin.version}</version> + </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter</artifactId> + <version>${junit-jupiter.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <version>${mockito.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <version>${assertj.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-test</artifactId> + <version>${kotlin.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + + <properties> + <junit-jupiter.version>5.4.2</junit-jupiter.version> + <mockito.version>2.27.0</mockito.version> + <assertj.version>3.10.0</assertj.version> + </properties> + +</project> \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/filesystem/FileReader.kt b/core-kotlin-modules/core-kotlin-io/src/main/kotlin/com/baeldung/filesystem/FileReader.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/filesystem/FileReader.kt rename to core-kotlin-modules/core-kotlin-io/src/main/kotlin/com/baeldung/filesystem/FileReader.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/filesystem/FileWriter.kt b/core-kotlin-modules/core-kotlin-io/src/main/kotlin/com/baeldung/filesystem/FileWriter.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/filesystem/FileWriter.kt rename to core-kotlin-modules/core-kotlin-io/src/main/kotlin/com/baeldung/filesystem/FileWriter.kt diff --git a/core-kotlin-io/src/main/kotlin/com/baeldung/inputstream/InputStreamExtension.kt b/core-kotlin-modules/core-kotlin-io/src/main/kotlin/com/baeldung/inputstream/InputStreamExtension.kt similarity index 100% rename from core-kotlin-io/src/main/kotlin/com/baeldung/inputstream/InputStreamExtension.kt rename to core-kotlin-modules/core-kotlin-io/src/main/kotlin/com/baeldung/inputstream/InputStreamExtension.kt diff --git a/core-kotlin-io/src/test/kotlin/com/baeldung/console/ConsoleIOUnitTest.kt b/core-kotlin-modules/core-kotlin-io/src/test/kotlin/com/baeldung/console/ConsoleIOUnitTest.kt similarity index 100% rename from core-kotlin-io/src/test/kotlin/com/baeldung/console/ConsoleIOUnitTest.kt rename to core-kotlin-modules/core-kotlin-io/src/test/kotlin/com/baeldung/console/ConsoleIOUnitTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/filesystem/FileReaderTest.kt b/core-kotlin-modules/core-kotlin-io/src/test/kotlin/com/baeldung/filesystem/FileReaderTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/filesystem/FileReaderTest.kt rename to core-kotlin-modules/core-kotlin-io/src/test/kotlin/com/baeldung/filesystem/FileReaderTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/filesystem/FileWriterTest.kt b/core-kotlin-modules/core-kotlin-io/src/test/kotlin/com/baeldung/filesystem/FileWriterTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/filesystem/FileWriterTest.kt rename to core-kotlin-modules/core-kotlin-io/src/test/kotlin/com/baeldung/filesystem/FileWriterTest.kt diff --git a/core-kotlin-io/src/test/kotlin/com/baeldung/inputstream/InputStreamToStringTest.kt b/core-kotlin-modules/core-kotlin-io/src/test/kotlin/com/baeldung/inputstream/InputStreamToStringTest.kt similarity index 99% rename from core-kotlin-io/src/test/kotlin/com/baeldung/inputstream/InputStreamToStringTest.kt rename to core-kotlin-modules/core-kotlin-io/src/test/kotlin/com/baeldung/inputstream/InputStreamToStringTest.kt index d10d23bef0..a0eb26b762 100644 --- a/core-kotlin-io/src/test/kotlin/com/baeldung/inputstream/InputStreamToStringTest.kt +++ b/core-kotlin-modules/core-kotlin-io/src/test/kotlin/com/baeldung/inputstream/InputStreamToStringTest.kt @@ -7,6 +7,7 @@ import java.io.File import kotlin.test.assertEquals class InputStreamToStringTest { + private val fileName = "src/test/resources/inputstream2string.txt" private val endOfLine = System.lineSeparator() private val fileFullContent = "Computer programming can be a hassle$endOfLine" + @@ -19,6 +20,7 @@ class InputStreamToStringTest { val content = inputStream.bufferedReader().use(BufferedReader::readText) assertEquals(fileFullContent, content) } + @Test fun whenReadFileWithBufferedReaderReadText_thenFullFileContentIsReadAsString() { val file = File(fileName) @@ -32,6 +34,7 @@ class InputStreamToStringTest { } assertEquals(fileFullContent, content) } + @Test fun whenReadFileWithBufferedReaderManually_thenFullFileContentIsReadAsString() { val file = File(fileName) @@ -67,6 +70,5 @@ class InputStreamToStringTest { assertEquals(fileFullContent, content) } - } diff --git a/core-kotlin/src/test/resources/Kotlin.in b/core-kotlin-modules/core-kotlin-io/src/test/resources/Kotlin.in similarity index 100% rename from core-kotlin/src/test/resources/Kotlin.in rename to core-kotlin-modules/core-kotlin-io/src/test/resources/Kotlin.in diff --git a/core-kotlin/src/test/resources/Kotlin.out b/core-kotlin-modules/core-kotlin-io/src/test/resources/Kotlin.out similarity index 100% rename from core-kotlin/src/test/resources/Kotlin.out rename to core-kotlin-modules/core-kotlin-io/src/test/resources/Kotlin.out diff --git a/core-kotlin-io/src/test/resources/inputstream2string.txt b/core-kotlin-modules/core-kotlin-io/src/test/resources/inputstream2string.txt similarity index 100% rename from core-kotlin-io/src/test/resources/inputstream2string.txt rename to core-kotlin-modules/core-kotlin-io/src/test/resources/inputstream2string.txt diff --git a/core-kotlin-io/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/core-kotlin-modules/core-kotlin-io/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker similarity index 100% rename from core-kotlin-io/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker rename to core-kotlin-modules/core-kotlin-io/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker diff --git a/core-kotlin-modules/core-kotlin-strings/README.md b/core-kotlin-modules/core-kotlin-strings/README.md new file mode 100644 index 0000000000..0e3d8ea57f --- /dev/null +++ b/core-kotlin-modules/core-kotlin-strings/README.md @@ -0,0 +1,9 @@ +## Core Kotlin Strings + +This module contains articles about core Kotlin strings. + +### Relevant articles: +- [Generate a Random Alphanumeric String in Kotlin](https://www.baeldung.com/kotlin-random-alphanumeric-string) +- [String Comparison in Kotlin](https://www.baeldung.com/kotlin-string-comparison) +- [Concatenate Strings in Kotlin](https://www.baeldung.com/kotlin-concatenate-strings) +- [Kotlin String Templates](https://www.baeldung.com/kotlin-string-template) diff --git a/core-kotlin-modules/core-kotlin-strings/pom.xml b/core-kotlin-modules/core-kotlin-strings/pom.xml new file mode 100644 index 0000000000..fb2998e9e1 --- /dev/null +++ b/core-kotlin-modules/core-kotlin-strings/pom.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>core-kotlin-strings</artifactId> + <name>core-kotlin-strings</name> + <packaging>jar</packaging> + + <parent> + <groupId>com.baeldung.core-kotlin-modules</groupId> + <artifactId>core-kotlin-modules</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> + + <dependencies> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>${commons-lang3.version}</version> + </dependency> + </dependencies> + +</project> \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/stringtemplates/Templates.kt b/core-kotlin-modules/core-kotlin-strings/src/main/kotlin/com/baeldung/stringtemplates/Templates.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/stringtemplates/Templates.kt rename to core-kotlin-modules/core-kotlin-strings/src/main/kotlin/com/baeldung/stringtemplates/Templates.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/random/RandomStringUnitTest.kt b/core-kotlin-modules/core-kotlin-strings/src/test/kotlin/com/baeldung/randomstring/RandomStringUnitTest.kt similarity index 98% rename from core-kotlin/src/test/kotlin/com/baeldung/random/RandomStringUnitTest.kt rename to core-kotlin-modules/core-kotlin-strings/src/test/kotlin/com/baeldung/randomstring/RandomStringUnitTest.kt index 62e8dfe720..5b84d1f67d 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/random/RandomStringUnitTest.kt +++ b/core-kotlin-modules/core-kotlin-strings/src/test/kotlin/com/baeldung/randomstring/RandomStringUnitTest.kt @@ -1,3 +1,5 @@ +package com.baeldung.randomstring + import org.apache.commons.lang3.RandomStringUtils import org.junit.Before import org.junit.jupiter.api.BeforeAll diff --git a/core-kotlin-2/src/test/kotlin/stringcomparison/StringComparisonTest.kt b/core-kotlin-modules/core-kotlin-strings/src/test/kotlin/com/baeldung/stringcomparison/StringComparisonTest.kt similarity index 97% rename from core-kotlin-2/src/test/kotlin/stringcomparison/StringComparisonTest.kt rename to core-kotlin-modules/core-kotlin-strings/src/test/kotlin/com/baeldung/stringcomparison/StringComparisonTest.kt index 45a8dd7e04..9528f62df5 100644 --- a/core-kotlin-2/src/test/kotlin/stringcomparison/StringComparisonTest.kt +++ b/core-kotlin-modules/core-kotlin-strings/src/test/kotlin/com/baeldung/stringcomparison/StringComparisonTest.kt @@ -1,4 +1,4 @@ -package stringcomparison +package com.baeldung.stringcomparison import org.junit.Test import kotlin.test.assertFalse diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/StringConcatenationTest.kt b/core-kotlin-modules/core-kotlin-strings/src/test/kotlin/com/baeldung/stringconcatenation/StringConcatenationTest.kt similarity index 96% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/StringConcatenationTest.kt rename to core-kotlin-modules/core-kotlin-strings/src/test/kotlin/com/baeldung/stringconcatenation/StringConcatenationTest.kt index 9c371614a4..9ac011f7d2 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/StringConcatenationTest.kt +++ b/core-kotlin-modules/core-kotlin-strings/src/test/kotlin/com/baeldung/stringconcatenation/StringConcatenationTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin +package com.baeldung.stringconcatenation import org.junit.Test import kotlin.test.assertEquals diff --git a/core-kotlin-modules/pom.xml b/core-kotlin-modules/pom.xml new file mode 100644 index 0000000000..747e8b69de --- /dev/null +++ b/core-kotlin-modules/pom.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>com.baeldung.core-kotlin-modules</groupId> + <artifactId>core-kotlin-modules</artifactId> + <name>core-kotlin-modules</name> + <packaging>pom</packaging> + + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-kotlin</artifactId> + <version>1.0.0-SNAPSHOT</version> + <relativePath>../parent-kotlin</relativePath> + </parent> + + <modules> + <module>core-kotlin-annotations</module> + <module>core-kotlin-io</module> + <module>core-kotlin-strings</module> + </modules> + + <build> + <plugins> + <plugin> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-maven-plugin</artifactId> + <version>${kotlin.version}</version> + <executions> + <execution> + <id>compile</id> + <phase>compile</phase> + <goals> + <goal>compile</goal> + </goals> + </execution> + <execution> + <id>test-compile</id> + <phase>test-compile</phase> + <goals> + <goal>test-compile</goal> + </goals> + </execution> + </executions> + <configuration> + <jvmTarget>1.8</jvmTarget> + </configuration> + </plugin> + </plugins> + </build> + + <properties> + <kotlin.version>1.3.30</kotlin.version> + </properties> + +</project> diff --git a/core-kotlin/README.md b/core-kotlin/README.md index bdff95d36d..f75a4e764c 100644 --- a/core-kotlin/README.md +++ b/core-kotlin/README.md @@ -24,12 +24,8 @@ This module contains articles about core Kotlin. - [Try-with-resources in Kotlin](https://www.baeldung.com/kotlin-try-with-resources) - [Regular Expressions in Kotlin](https://www.baeldung.com/kotlin-regular-expressions) - [Objects in Kotlin](https://www.baeldung.com/kotlin-objects) -- [Reading from a File in Kotlin](https://www.baeldung.com/kotlin-read-file) -- [Guide to Kotlin @JvmField](https://www.baeldung.com/kotlin-jvm-field-annotation) - [Filtering Kotlin Collections](https://www.baeldung.com/kotlin-filter-collection) -- [Writing to a File in Kotlin](https://www.baeldung.com/kotlin-write-file) - [Lambda Expressions in Kotlin](https://www.baeldung.com/kotlin-lambda-expressions) -- [Kotlin String Templates](https://www.baeldung.com/kotlin-string-template) - [Working with Enums in Kotlin](https://www.baeldung.com/kotlin-enum) - [Create a Java and Kotlin Project with Maven](https://www.baeldung.com/kotlin-maven-java-project) - [Reflection with Kotlin](https://www.baeldung.com/kotlin-reflection) @@ -41,7 +37,6 @@ This module contains articles about core Kotlin. - [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) - [Kotlin return, break, continue Keywords](https://www.baeldung.com/kotlin-return-break-continue) - [Mapping of Data Objects in Kotlin](https://www.baeldung.com/kotlin-data-objects) - [Initializing Arrays in Kotlin](https://www.baeldung.com/kotlin-initialize-array) @@ -50,7 +45,6 @@ This module contains articles about core Kotlin. - [Guide to Sorting in Kotlin](https://www.baeldung.com/kotlin-sort) - [Dependency Injection for Kotlin with Injekt](https://www.baeldung.com/kotlin-dependency-injection-with-injekt) - [Implementing a Binary Tree in Kotlin](https://www.baeldung.com/kotlin-binary-tree) -- [Generate a Random Alphanumeric String in Kotlin](https://www.baeldung.com/kotlin-random-alphanumeric-string) - [Kotlin Contracts](https://www.baeldung.com/kotlin-contracts) - [Operator Overloading in Kotlin](https://www.baeldung.com/kotlin-operator-overloading) - [Inline Classes in Kotlin](https://www.baeldung.com/kotlin-inline-classes) diff --git a/core-kotlin/pom.xml b/core-kotlin/pom.xml index e4d243360a..63a6d8035e 100644 --- a/core-kotlin/pom.xml +++ b/core-kotlin/pom.xml @@ -80,8 +80,8 @@ <junit.vintage.version>5.2.0</junit.vintage.version> <assertj.version>3.10.0</assertj.version> <fuel.version>1.15.0</fuel.version> - <kovenant.version>3.3.0</kovenant.version> - <injekt-core.version>1.16.1</injekt-core.version> + <kovenant.version>3.3.0</kovenant.version> + <injekt-core.version>1.16.1</injekt-core.version> </properties> </project> diff --git a/core-scala/pom.xml b/core-scala/pom.xml index 343f21484a..d6793cf4c6 100644 --- a/core-scala/pom.xml +++ b/core-scala/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>core-scala</artifactId> <version>1.0-SNAPSHOT</version> diff --git a/core-scala/src/main/scala/com/baeldung/scala/PatternMatching.scala b/core-scala/src/main/scala/com/baeldung/scala/PatternMatching.scala new file mode 100644 index 0000000000..71458237d6 --- /dev/null +++ b/core-scala/src/main/scala/com/baeldung/scala/PatternMatching.scala @@ -0,0 +1,137 @@ +package com.baeldung.scala + +// Case Class +abstract class Animal + +case class Mammal(name: String, fromSea: Boolean) extends Animal + +case class Bird(name: String) extends Animal + +case class Fish(name: String) extends Animal + +// Sealed Class +sealed abstract class CardSuit + +case class Spike() extends CardSuit + +case class Diamond() extends CardSuit + +case class Heart() extends CardSuit + +case class Club() extends CardSuit + +object Person { + def apply(fullName: String) = fullName + + def unapply(fullName: String): Option[String] = { + if (!fullName.isEmpty) + Some(fullName.replaceAll("(?<=\\w)(\\w+)", ".")) + else + None + } +} + +class PatternMatching { + + def caseClassesPatternMatching(animal: Animal): String = { + animal match { + case Mammal(name, fromSea) => s"I'm a $name, a kind of mammal. Am I from the sea? $fromSea" + case Bird(name) => s"I'm a $name, a kind of bird" + case _ => "I'm an unknown animal" + } + } + + def constantsPatternMatching(constant: Any): String = { + constant match { + case 0 => "I'm equal to zero" + case 4.5d => "I'm a double" + case false => "I'm the contrary of true" + case _ => s"I'm unknown and equal to $constant" + } + } + + def sequencesPatternMatching(sequence: Any): String = { + sequence match { + case List(singleElement) => s"I'm a list with one element: $singleElement" + case List(_, _*) => s"I'm a list with one or multiple elements: $sequence" + case Vector(1, 2, _*) => s"I'm a vector: $sequence" + case _ => s"I'm an unrecognized sequence. My value: $sequence" + } + } + + def tuplesPatternMatching(tuple: Any): String = { + tuple match { + case (first, second) => s"I'm a tuple with two elements: $first & $second" + case (first, second, third) => s"I'm a tuple with three elements: $first & $second & $third" + case _ => s"Unrecognized pattern. My value: $tuple" + } + } + + def typedPatternMatching(any: Any): String = { + any match { + case string: String => s"I'm a string. My value: $string" + case integer: Int => s"I'm an integer. My value: $integer" + case _ => s"I'm from an unknown type. My value: $any" + } + } + + def regexPatterns(toMatch: String): String = { + val numeric = """([0-9]+)""".r + val alphabetic = """([a-zA-Z]+)""".r + val alphanumeric = """([a-zA-Z0-9]+)""".r + + toMatch match { + case numeric(value) => s"I'm a numeric with value $value" + case alphabetic(value) => s"I'm an alphabetic with value $value" + case alphanumeric(value) => s"I'm an alphanumeric with value $value" + case _ => s"I contain other characters than alphanumerics. My value $toMatch" + } + } + + def optionsPatternMatching(option: Option[String]): String = { + option match { + case Some(value) => s"I'm not an empty option. Value $value" + case None => "I'm an empty option" + } + } + + def patternGuards(toMatch: Any, maxLength: Int): String = { + toMatch match { + case list: List[Any] if (list.size <= maxLength) => "List is of acceptable size" + case list: List[Any] => "List has not an acceptable size" + case string: String if (string.length <= maxLength) => "String is of acceptable size" + case string: String => "String has not an acceptable size" + case _ => "Input is neither a List or a String" + } + } + + def sealedClass(cardSuit: CardSuit): String = { + cardSuit match { + case Spike() => "Card is spike" + case Club() => "Card is club" + case Heart() => "Card is heart" + case Diamond() => "Card is diamond" + } + } + + def extractors(person: Any): String = { + person match { + case Person(initials) => s"My initials are $initials" + case _ => "Could not extract initials" + } + } + + def closuresPatternMatching(list: List[Any]): List[Any] = { + list.collect { case i: Int if (i < 10) => i } + } + + def catchBlocksPatternMatching(exception: Exception): String = { + try { + throw exception + } catch { + case ex: IllegalArgumentException => "It's an IllegalArgumentException" + case ex: RuntimeException => "It's a RuntimeException" + case _ => "It's an unknown kind of exception" + } + } +} \ No newline at end of file diff --git a/core-scala/src/test/scala/com/baeldung/scala/PatternMatchingUnitTest.scala b/core-scala/src/test/scala/com/baeldung/scala/PatternMatchingUnitTest.scala new file mode 100644 index 0000000000..21a2f0e871 --- /dev/null +++ b/core-scala/src/test/scala/com/baeldung/scala/PatternMatchingUnitTest.scala @@ -0,0 +1,208 @@ +package com.baeldung.scala + +import java.io.FileNotFoundException + +import org.junit.Assert.assertEquals +import org.junit.Test + +class PatternMatchingUnitTest { + @Test + def whenAMammalIsGivenToTheMatchExpression_ThenItsRecognizedAsMammal(): Unit = { + val result = new PatternMatching().caseClassesPatternMatching(Mammal("Lion", fromSea = false)) + assertEquals("I'm a Lion, a kind of mammal. Am I from the sea? false", result) + } + + @Test + def whenABirdIsGivenToTheMatchExpression_ThenItsRecognizedAsBird(): Unit = { + val result = new PatternMatching().caseClassesPatternMatching(Bird("Pigeon")) + assertEquals("I'm a Pigeon, a kind of bird", result) + } + + @Test + def whenAnUnkownAnimalIsGivenToTheMatchExpression_TheDefaultClauseIsUsed(): Unit = { + val result = new PatternMatching().caseClassesPatternMatching(Fish("Tuna")) + assertEquals("I'm an unknown animal", result) + } + + @Test + def whenTheConstantZeroIsPassed_ThenItMatchesTheCorrespondingPattern(): Unit = { + val result = new PatternMatching().constantsPatternMatching(0) + assertEquals("I'm equal to zero", result) + } + + @Test + def whenFourAndAHalfIsPassed_ThenItMatchesTheCorrespondingPattern(): Unit = { + val result = new PatternMatching().constantsPatternMatching(4.5d) + assertEquals("I'm a double", result) + } + + @Test + def whenTheBooleanFalseIsPassed_ThenItMatchesTheCorrespondingPattern(): Unit = { + val result = new PatternMatching().constantsPatternMatching(false) + assertEquals("I'm the contrary of true", result) + } + + @Test + def whenAnUnkownConstantIsPassed_ThenTheDefaultPatternIsUsed(): Unit = { + val result = new PatternMatching().constantsPatternMatching(true) + assertEquals("I'm unknown and equal to true", result) + } + + @Test + def whenASingleElementListIsPassed_ThenItMatchesTheCorrespondingPattern(): Unit = { + val result = new PatternMatching().sequencesPatternMatching(List("String")) + assertEquals("I'm a list with one element: String", result) + } + + @Test + def whenAMultipleElementsListIsPassed_ThenItMatchesTheCorrespondingPattern(): Unit = { + val result = new PatternMatching().sequencesPatternMatching(List("Multiple", "Elements")) + assertEquals("I'm a list with one or multiple elements: List(Multiple, Elements)", result) + } + + @Test + def whenAVectorBeginningWithOneAndTwoIsPassed_ThenItMatchesTheCorrespondingPattern(): Unit = { + val result = new PatternMatching().sequencesPatternMatching(Vector(1, 2, 3)) + assertEquals("I'm a vector: Vector(1, 2, 3)", result) + } + + @Test + def whenANotMatchingVectorIsPassed_ThenItShouldntMatchAndEnterTheDefaultClause(): Unit = { + val result = new PatternMatching().sequencesPatternMatching(Vector(2, 1)) + assertEquals("I'm an unrecognized sequence. My value: Vector(2, 1)", result) + } + + @Test + def whenAnEmptyListIsPassed_ThenItShouldntMatchAndEnterTheDefaultClause(): Unit = { + val result = new PatternMatching().sequencesPatternMatching(List()) + assertEquals("I'm an unrecognized sequence. My value: List()", result) + } + + @Test + def whenATwoElementsTupleIsPassed_ThenItMatchesTheCorrespondingPattern(): Unit = { + val result = new PatternMatching().tuplesPatternMatching(("First", "Second")) + assertEquals("I'm a tuple with two elements: First & Second", result) + } + + @Test + def whenAThreeElementsTupleIsPassed_ThenItMatchesTheCorrespondingPattern(): Unit = { + val result = new PatternMatching().tuplesPatternMatching(("First", "Second", "Third")) + assertEquals("I'm a tuple with three elements: First & Second & Third", result) + } + + @Test + def whenAnoterKindOfTupleIsPassed_ThenItShouldntMatchAndReturnTheDefaultPattern(): Unit = { + val result = new PatternMatching().tuplesPatternMatching(("First")) + assertEquals("Unrecognized pattern. My value: First", result) + } + + @Test + def whenAStringConsistingOfNumericsOnlyIsPassed_ThenItShouldMatchTheNumericRegex(): Unit = { + val result = new PatternMatching().regexPatterns("123") + assertEquals("I'm a numeric with value 123", result) + } + + @Test + def whenAStringConsistignOfAlphabeticsOnlyIsPassed_ThenItShouldMatchTheAlphabeticRegex(): Unit = { + val result = new PatternMatching().regexPatterns("abc") + assertEquals("I'm an alphabetic with value abc", result) + } + + @Test + def whenAStringConsistignOfAlphanumericsOnlyIsPassed_ThenItShouldMatchTheAlphanumericRegex(): Unit = { + val result = new PatternMatching().regexPatterns("abc123") + assertEquals("I'm an alphanumeric with value abc123", result) + } + + @Test + def whenAnotherTypeOfStringIsPassed_ThenItShouldntMatchAndReturnTheDefaultPattern(): Unit = { + val result = new PatternMatching().regexPatterns("abc_123") + assertEquals("I contain other characters than alphanumerics. My value abc_123", result) + } + + @Test + def whenAFilledOptionIsPassed_ThenItShouldMatchTheSomeClause(): Unit = { + val result = new PatternMatching().optionsPatternMatching(Option.apply("something")) + assertEquals("I'm not an empty option. Value something", result) + } + + @Test + def whenAnEmptyOptionIsPassed_ThenItShouldMatchTheNoneClause(): Unit = { + val result = new PatternMatching().optionsPatternMatching(Option.empty) + assertEquals("I'm an empty option", result) + } + + @Test + def whenAListWithAcceptedSizeIsPassed_ThenThePositiveMessageIsSent(): Unit = { + val result = new PatternMatching().patternGuards(List(1, 2), 3) + assertEquals("List is of acceptable size", result) + } + + @Test + def whenAListWithAnUnacceptedSizeIsPassed_ThenTheNegativeMessageIsSent(): Unit = { + val result = new PatternMatching().patternGuards(List(1, 2, 3, 4), 3) + assertEquals("List has not an acceptable size", result) + } + + @Test + def whenAStringWithAcceptedSizeIsPassed_ThenThePositiveMessageIsSent(): Unit = { + val result = new PatternMatching().patternGuards("OK", 3) + assertEquals("String is of acceptable size", result) + } + + @Test + def whenAStringWithAnUnacceptedSizeIsPassed_ThenTheNegativeMessageIsSent(): Unit = { + val result = new PatternMatching().patternGuards("Not OK", 3) + assertEquals("String has not an acceptable size", result) + } + + @Test + def whenAnObjectWhichIsNotAListOrAStringIsPassed_thenTheDefaultClauseIsUsed(): Unit = { + val result = new PatternMatching().patternGuards(1, 1) + assertEquals("Input is neither a List or a String", result) + } + + @Test + def whenACardSuitIsPassed_ThenTheCorrespondingMatchCaseClauseIsUsed(): Unit = { + assertEquals("Card is spike", new PatternMatching().sealedClass(Spike())) + assertEquals("Card is club", new PatternMatching().sealedClass(Club())) + assertEquals("Card is heart", new PatternMatching().sealedClass(Heart())) + assertEquals("Card is diamond", new PatternMatching().sealedClass(Diamond())) + } + + @Test + def whenAnObjectWithExtractorIsPassed_ThenTheExtractedValueIsUsedInTheCaseClause(): Unit = { + val person = Person("John Smith") + val result = new PatternMatching().extractors(person) + assertEquals("My initials are J. S.", result) + } + + @Test + def whenAnObjectWithExtractorIsPassed_AndTheValueIsEmpty_ThenTheDefaultCaseClauseIsUsed(): Unit = { + val person = Person("") + val result = new PatternMatching().extractors(person) + assertEquals("Could not extract initials", result) + } + + @Test + def whenAListOfRandomElementsIsPassed_ThenOnlyTheIntegersBelowTenAreReturned(): Unit = { + val input = List(1, 2, "5", 11, true) + val result = new PatternMatching().closuresPatternMatching(input) + assertEquals(List(1, 2), result) + } + + @Test + def whenAnExceptionIsPassed_ThenTheCorrespondingMessageIsReturned(): Unit = { + val pm = new PatternMatching() + + val iae = new IllegalArgumentException() + val re = new RuntimeException() + val fnfe = new FileNotFoundException() + + assertEquals("It's an IllegalArgumentException", pm.catchBlocksPatternMatching(iae)) + assertEquals("It's a RuntimeException", pm.catchBlocksPatternMatching(re)) + assertEquals("It's an unknown kind of exception", pm.catchBlocksPatternMatching(fnfe)) + } +} + + diff --git a/couchbase/pom.xml b/couchbase/pom.xml index fc40749c61..f4e98b32ba 100644 --- a/couchbase/pom.xml +++ b/couchbase/pom.xml @@ -1,13 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>couchbase</artifactId> <version>0.1-SNAPSHOT</version> <name>couchbase</name> - <description>Couchbase Tutorials</description> <packaging>jar</packaging> + <description>Couchbase Tutorials</description> <parent> <groupId>com.baeldung</groupId> diff --git a/custom-pmd/pom.xml b/custom-pmd/pom.xml index 9964bf2bb4..601eedf08f 100644 --- a/custom-pmd/pom.xml +++ b/custom-pmd/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.baeldung.pmd</groupId> <artifactId>custom-pmd</artifactId> @@ -7,10 +8,10 @@ <name>custom-pmd</name> <packaging>jar</packaging> <url>http://maven.apache.org</url> - + <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> diff --git a/dagger/pom.xml b/dagger/pom.xml index 80a3e961af..528a5383c6 100644 --- a/dagger/pom.xml +++ b/dagger/pom.xml @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>dagger</artifactId> <name>dagger</name> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> diff --git a/data-structures/README.md b/data-structures/README.md index b7f15c2eb8..7eeda7c64f 100644 --- a/data-structures/README.md +++ b/data-structures/README.md @@ -6,4 +6,3 @@ This module contains articles about data structures in Java - [The Trie Data Structure in Java](https://www.baeldung.com/trie-java) - [Implementing a Binary Tree in Java](https://www.baeldung.com/java-binary-tree) -- [Depth First Search in Java](https://www.baeldung.com/java-depth-first-search) diff --git a/data-structures/pom.xml b/data-structures/pom.xml index 4958598234..e8f4628062 100644 --- a/data-structures/pom.xml +++ b/data-structures/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>data-structures</artifactId> <version>0.0.1-SNAPSHOT</version> diff --git a/data-structures/src/main/java/com/baeldung/circularlinkedlist/CircularLinkedList.java b/data-structures/src/main/java/com/baeldung/circularlinkedlist/CircularLinkedList.java new file mode 100644 index 0000000000..47368d7f15 --- /dev/null +++ b/data-structures/src/main/java/com/baeldung/circularlinkedlist/CircularLinkedList.java @@ -0,0 +1,88 @@ +package com.baeldung.circularlinkedlist; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class CircularLinkedList { + + final Logger LOGGER = LoggerFactory.getLogger(CircularLinkedList.class); + + private Node head = null; + private Node tail = null; + + public void addNode(int value) { + + Node newNode = new Node(value); + + if (head == null) { + head = newNode; + } else { + tail.nextNode = newNode; + } + + tail = newNode; + tail.nextNode = head; + } + + public boolean containsNode(int searchValue) { + + Node currentNode = head; + + if (head == null) { + return false; + } else { + do { + if (currentNode.value == searchValue) { + return true; + } + currentNode = currentNode.nextNode; + } while (currentNode != head); + return false; + } + } + + public void deleteNode(int valueToDelete) { + + Node currentNode = head; + + if (head != null) { + if (currentNode.value == valueToDelete) { + head = head.nextNode; + tail.nextNode = head; + } else { + do { + Node nextNode = currentNode.nextNode; + if (nextNode.value == valueToDelete) { + currentNode.nextNode = nextNode.nextNode; + break; + } + currentNode = currentNode.nextNode; + } while (currentNode != head); + } + } + } + + public void traverseList() { + + Node currentNode = head; + + if (head != null) { + do { + LOGGER.info(currentNode.value + " "); + currentNode = currentNode.nextNode; + } while (currentNode != head); + } + } + +} + +class Node { + + int value; + Node nextNode; + + public Node(int value) { + this.value = value; + } + +} diff --git a/data-structures/src/main/java/com/baeldung/printbinarytree/BinaryTreeModel.java b/data-structures/src/main/java/com/baeldung/printbinarytree/BinaryTreeModel.java new file mode 100644 index 0000000000..94796bf997 --- /dev/null +++ b/data-structures/src/main/java/com/baeldung/printbinarytree/BinaryTreeModel.java @@ -0,0 +1,37 @@ +package com.baeldung.printbinarytree; + +public class BinaryTreeModel { + + private Object value; + private BinaryTreeModel left; + private BinaryTreeModel right; + + public BinaryTreeModel(Object value) { + this.value = value; + } + + public Object getValue() { + return value; + } + + public void setValue(Object value) { + this.value = value; + } + + public BinaryTreeModel getLeft() { + return left; + } + + public void setLeft(BinaryTreeModel left) { + this.left = left; + } + + public BinaryTreeModel getRight() { + return right; + } + + public void setRight(BinaryTreeModel right) { + this.right = right; + } + +} \ No newline at end of file diff --git a/data-structures/src/main/java/com/baeldung/printbinarytree/BinaryTreePrinter.java b/data-structures/src/main/java/com/baeldung/printbinarytree/BinaryTreePrinter.java new file mode 100644 index 0000000000..0ec844d7b6 --- /dev/null +++ b/data-structures/src/main/java/com/baeldung/printbinarytree/BinaryTreePrinter.java @@ -0,0 +1,63 @@ +package com.baeldung.printbinarytree; + +import java.io.PrintStream; + +public class BinaryTreePrinter { + + private BinaryTreeModel tree; + + public BinaryTreePrinter(BinaryTreeModel tree) { + this.tree = tree; + } + + private String traversePreOrder(BinaryTreeModel root) { + + if (root == null) { + return ""; + } + + StringBuilder sb = new StringBuilder(); + sb.append(root.getValue()); + + String pointerRight = "└──"; + String pointerLeft = (root.getRight() != null) ? "├──" : "└──"; + + traverseNodes(sb, "", pointerLeft, root.getLeft(), root.getRight() != null); + traverseNodes(sb, "", pointerRight, root.getRight(), false); + + return sb.toString(); + } + + private void traverseNodes(StringBuilder sb, String padding, String pointer, BinaryTreeModel node, + boolean hasRightSibling) { + + if (node != null) { + + sb.append("\n"); + sb.append(padding); + sb.append(pointer); + sb.append(node.getValue()); + + StringBuilder paddingBuilder = new StringBuilder(padding); + if (hasRightSibling) { + paddingBuilder.append("│ "); + } else { + paddingBuilder.append(" "); + } + + String paddingForBoth = paddingBuilder.toString(); + String pointerRight = "└──"; + String pointerLeft = (node.getRight() != null) ? "├──" : "└──"; + + traverseNodes(sb, paddingForBoth, pointerLeft, node.getLeft(), node.getRight() != null); + traverseNodes(sb, paddingForBoth, pointerRight, node.getRight(), false); + + } + + } + + public void print(PrintStream os) { + os.print(traversePreOrder(tree)); + } + +} \ No newline at end of file diff --git a/data-structures/src/test/java/com/baeldung/circularlinkedlist/CircularLinkedListUnitTest.java b/data-structures/src/test/java/com/baeldung/circularlinkedlist/CircularLinkedListUnitTest.java new file mode 100644 index 0000000000..5b0573a1ce --- /dev/null +++ b/data-structures/src/test/java/com/baeldung/circularlinkedlist/CircularLinkedListUnitTest.java @@ -0,0 +1,56 @@ +package com.baeldung.circularlinkedlist; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +public class CircularLinkedListUnitTest { + + @Test + public void givenACircularLinkedList_WhenAddingElements_ThenListContainsThoseElements() { + CircularLinkedList cll = createCircularLinkedList(); + + assertTrue(cll.containsNode(8)); + assertTrue(cll.containsNode(37)); + } + + @Test + public void givenACircularLinkedList_WhenLookingForNonExistingElement_ThenReturnsFalse() { + CircularLinkedList cll = createCircularLinkedList(); + + assertFalse(cll.containsNode(11)); + } + + @Test + public void givenACircularLinkedList_WhenDeletingElements_ThenListDoesNotContainThoseElements() { + CircularLinkedList cll = createCircularLinkedList(); + + assertTrue(cll.containsNode(13)); + cll.deleteNode(13); + assertFalse(cll.containsNode(13)); + + assertTrue(cll.containsNode(1)); + cll.deleteNode(1); + assertFalse(cll.containsNode(1)); + + assertTrue(cll.containsNode(46)); + cll.deleteNode(46); + assertFalse(cll.containsNode(46)); + } + + private CircularLinkedList createCircularLinkedList() { + CircularLinkedList cll = new CircularLinkedList(); + + cll.addNode(13); + cll.addNode(7); + cll.addNode(24); + cll.addNode(1); + cll.addNode(8); + cll.addNode(37); + cll.addNode(46); + + return cll; + } + +} diff --git a/data-structures/src/test/java/com/baeldung/printbinarytree/PrintingBinaryTreeModelUnitTest.java b/data-structures/src/test/java/com/baeldung/printbinarytree/PrintingBinaryTreeModelUnitTest.java new file mode 100644 index 0000000000..5c250730f9 --- /dev/null +++ b/data-structures/src/test/java/com/baeldung/printbinarytree/PrintingBinaryTreeModelUnitTest.java @@ -0,0 +1,178 @@ +package com.baeldung.printbinarytree; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; +import java.io.PrintStream; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.baeldung.printbinarytree.BinaryTreeModel; +import com.baeldung.printbinarytree.BinaryTreePrinter; + +public class PrintingBinaryTreeModelUnitTest { + + private BinaryTreeModel balanced; + private BinaryTreeModel leftSkewed; + private BinaryTreeModel rightSkewed; + + private OutputStream output; + + @Before + public void setup() { + balanced = createBalancedTree(); + leftSkewed = createLeftUnbalancedTree(); + rightSkewed = createRightUnbalancedTree(); + + output = new ByteArrayOutputStream(); + System.setOut(new PrintStream(output)); + } + + @After + public void tearDown() { + System.setOut(System.out); + } + + private BinaryTreeModel createBalancedTree() { + + BinaryTreeModel root = new BinaryTreeModel("root"); + + BinaryTreeModel node1 = new BinaryTreeModel("node1"); + BinaryTreeModel node2 = new BinaryTreeModel("node2"); + root.setLeft(node1); + root.setRight(node2); + + BinaryTreeModel node3 = new BinaryTreeModel("node3"); + BinaryTreeModel node4 = new BinaryTreeModel("node4"); + node1.setLeft(node3); + node1.setRight(node4); + + node2.setLeft(new BinaryTreeModel("node5")); + node2.setRight(new BinaryTreeModel("node6")); + + BinaryTreeModel node7 = new BinaryTreeModel("node7"); + node3.setLeft(node7); + node7.setLeft(new BinaryTreeModel("node8")); + node7.setRight(new BinaryTreeModel("node9")); + + return root; + } + + private BinaryTreeModel createLeftUnbalancedTree() { + + BinaryTreeModel root = new BinaryTreeModel("root"); + + BinaryTreeModel node1 = new BinaryTreeModel("node1"); + root.setLeft(node1); + root.setRight(new BinaryTreeModel("node2")); + + BinaryTreeModel node3 = new BinaryTreeModel("node3"); + node1.setLeft(node3); + + BinaryTreeModel node4 = new BinaryTreeModel("node4"); + node3.setLeft(node4); + + BinaryTreeModel node5 = new BinaryTreeModel("node5"); + node4.setLeft(node5); + + BinaryTreeModel node6 = new BinaryTreeModel("node6"); + node5.setLeft(node6); + + BinaryTreeModel node7 = new BinaryTreeModel("node7"); + node6.setLeft(node7); + + node7.setLeft(new BinaryTreeModel("node8")); + + return root; + } + + private BinaryTreeModel createRightUnbalancedTree() { + + BinaryTreeModel root = new BinaryTreeModel("root"); + + BinaryTreeModel node2 = new BinaryTreeModel("node2"); + root.setLeft(new BinaryTreeModel("node1")); + root.setRight(node2); + + BinaryTreeModel node3 = new BinaryTreeModel("node3"); + node2.setRight(node3); + + BinaryTreeModel node4 = new BinaryTreeModel("node4"); + node3.setRight(node4); + + BinaryTreeModel node5 = new BinaryTreeModel("node5"); + node4.setRight(node5); + + BinaryTreeModel node6 = new BinaryTreeModel("node6"); + node5.setRight(node6); + + BinaryTreeModel node7 = new BinaryTreeModel("node7"); + node6.setRight(node7); + + node7.setRight(new BinaryTreeModel("node8")); + + return root; + } + + @Test + public void givenBinaryTreeModelBalanced_whenPrintWithBinaryTreePrinter_thenProduceCorrectOutput() { + + StringBuilder expected = new StringBuilder(); + expected.append("root").append("\n"); + expected.append("├──node1").append("\n"); + expected.append("│ ├──node3").append("\n"); + expected.append("│ │ └──node7").append("\n"); + expected.append("│ │ ├──node8").append("\n"); + expected.append("│ │ └──node9").append("\n"); + expected.append("│ └──node4").append("\n"); + expected.append("└──node2").append("\n"); + expected.append(" ├──node5").append("\n"); + expected.append(" └──node6"); + + new BinaryTreePrinter(balanced).print(System.out); + + assertEquals(expected.toString(), output.toString()); + } + + @Test + public void givenBinaryTreeModelLeftUnbalanced_whenPrintWithBinaryTreePrinter_thenProduceCorrectOutput() { + + StringBuilder expected = new StringBuilder(); + expected.append("root").append("\n"); + expected.append("├──node1").append("\n"); + expected.append("│ └──node3").append("\n"); + expected.append("│ └──node4").append("\n"); + expected.append("│ └──node5").append("\n"); + expected.append("│ └──node6").append("\n"); + expected.append("│ └──node7").append("\n"); + expected.append("│ └──node8").append("\n"); + expected.append("└──node2"); + + new BinaryTreePrinter(leftSkewed).print(System.out); + + assertEquals(expected.toString(), output.toString()); + } + + @Test + public void givenBinaryTreeModelRightUnbalanced_whenPrintWithBinaryTreePrinter_thenProduceCorrectOutput() { + + StringBuilder expected = new StringBuilder(); + expected.append("root").append("\n"); + expected.append("├──node1").append("\n"); + expected.append("└──node2").append("\n"); + expected.append(" └──node3").append("\n"); + expected.append(" └──node4").append("\n"); + expected.append(" └──node5").append("\n"); + expected.append(" └──node6").append("\n"); + expected.append(" └──node7").append("\n"); + expected.append(" └──node8"); + + new BinaryTreePrinter(rightSkewed).print(System.out); + + assertEquals(expected.toString(), output.toString()); + } + +} diff --git a/ddd/pom.xml b/ddd/pom.xml index c249007ba4..9a0523a4c6 100644 --- a/ddd/pom.xml +++ b/ddd/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.ddd</groupId> <artifactId>ddd</artifactId> @@ -8,8 +9,8 @@ <description>DDD series examples</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -34,6 +35,7 @@ <dependency> <groupId>org.junit.platform</groupId> <artifactId>junit-platform-launcher</artifactId> + <version>${junit-platform.version}</version> <scope>test</scope> </dependency> <dependency> @@ -74,6 +76,11 @@ <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <scope>test</scope> + </dependency> <dependency> <groupId>de.flapdoodle.embed</groupId> <artifactId>de.flapdoodle.embed.mongo</artifactId> @@ -83,6 +90,7 @@ <properties> <joda-money.version>1.0.1</joda-money.version> + <spring-boot.version>2.0.6.RELEASE</spring-boot.version> </properties> - + </project> \ No newline at end of file diff --git a/ddd/src/main/java/com/baeldung/ddd/PersistingDddAggregatesApplication.java b/ddd/src/main/java/com/baeldung/ddd/PersistingDddAggregatesApplication.java index cd9be34278..3a52fd0440 100644 --- a/ddd/src/main/java/com/baeldung/ddd/PersistingDddAggregatesApplication.java +++ b/ddd/src/main/java/com/baeldung/ddd/PersistingDddAggregatesApplication.java @@ -1,12 +1,12 @@ -package com.baeldung.ddd; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class PersistingDddAggregatesApplication { - - public static void main(String[] args) { - SpringApplication.run(PersistingDddAggregatesApplication.class, args); - } -} +package com.baeldung.ddd; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication(scanBasePackages = "com.baeldung.ddd.order") +public class PersistingDddAggregatesApplication { + + public static void main(String[] args) { + SpringApplication.run(PersistingDddAggregatesApplication.class, args); + } +} diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/DomainLayerApplication.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/DomainLayerApplication.java new file mode 100644 index 0000000000..988f96042b --- /dev/null +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/DomainLayerApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.dddhexagonalspring; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.PropertySource; + +@SpringBootApplication +@PropertySource(value = { "classpath:ddd-layers.properties" }) +public class DomainLayerApplication { + public static void main(final String[] args) { + SpringApplication.run(DomainLayerApplication.class, args); + } +} diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/controller/OrderController.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/controller/OrderController.java new file mode 100644 index 0000000000..80ba36d01b --- /dev/null +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/controller/OrderController.java @@ -0,0 +1,45 @@ +package com.baeldung.dddhexagonalspring.application.controller; + +import com.baeldung.dddhexagonalspring.application.request.AddProductRequest; +import com.baeldung.dddhexagonalspring.application.request.CreateOrderRequest; +import com.baeldung.dddhexagonalspring.application.response.CreateOrderResponse; +import com.baeldung.dddhexagonalspring.domain.service.OrderService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.*; + +import java.util.UUID; + +@RestController +@RequestMapping("/orders") +public class OrderController { + + private final OrderService orderService; + + @Autowired + public OrderController(OrderService orderService) { + this.orderService = orderService; + } + + @PostMapping(produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) + CreateOrderResponse createOrder(@RequestBody final CreateOrderRequest createOrderRequest) { + final UUID id = orderService.createOrder(createOrderRequest.getProduct()); + + return new CreateOrderResponse(id); + } + + @PostMapping(value = "/{id}/products", consumes = MediaType.APPLICATION_JSON_VALUE) + void addProduct(@PathVariable final UUID id, @RequestBody final AddProductRequest addProductRequest) { + orderService.addProduct(id, addProductRequest.getProduct()); + } + + @DeleteMapping(value = "/{id}/products", consumes = MediaType.APPLICATION_JSON_VALUE) + void deleteProduct(@PathVariable final UUID id, @RequestParam final UUID productId) { + orderService.deleteProduct(id, productId); + } + + @PostMapping("/{id}/complete") + void completeOrder(@PathVariable final UUID id) { + orderService.completeOrder(id); + } +} diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/request/AddProductRequest.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/request/AddProductRequest.java new file mode 100644 index 0000000000..ec107d635b --- /dev/null +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/request/AddProductRequest.java @@ -0,0 +1,20 @@ +package com.baeldung.dddhexagonalspring.application.request; + +import com.baeldung.dddhexagonalspring.domain.Product; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +import javax.validation.constraints.NotNull; + +public class AddProductRequest { + @NotNull private Product product; + + @JsonCreator + public AddProductRequest(@JsonProperty("product") final Product product) { + this.product = product; + } + + public Product getProduct() { + return product; + } +} diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/request/CreateOrderRequest.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/request/CreateOrderRequest.java new file mode 100644 index 0000000000..8c51fbe479 --- /dev/null +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/request/CreateOrderRequest.java @@ -0,0 +1,20 @@ +package com.baeldung.dddhexagonalspring.application.request; + +import com.baeldung.dddhexagonalspring.domain.Product; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +import javax.validation.constraints.NotNull; + +public class CreateOrderRequest { + @NotNull private Product product; + + @JsonCreator + public CreateOrderRequest(@JsonProperty("product") @NotNull final Product product) { + this.product = product; + } + + public Product getProduct() { + return product; + } +} diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/response/CreateOrderResponse.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/response/CreateOrderResponse.java new file mode 100644 index 0000000000..72ee1134c3 --- /dev/null +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/response/CreateOrderResponse.java @@ -0,0 +1,15 @@ +package com.baeldung.dddhexagonalspring.application.response; + +import java.util.UUID; + +public class CreateOrderResponse { + private final UUID id; + + public CreateOrderResponse(final UUID id) { + this.id = id; + } + + public UUID getId() { + return id; + } +} diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/DomainException.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/DomainException.java new file mode 100644 index 0000000000..7baef7bab6 --- /dev/null +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/DomainException.java @@ -0,0 +1,7 @@ +package com.baeldung.dddhexagonalspring.domain; + +class DomainException extends RuntimeException { + DomainException(final String message) { + super(message); + } +} diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/Order.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/Order.java new file mode 100644 index 0000000000..7d40007411 --- /dev/null +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/Order.java @@ -0,0 +1,82 @@ +package com.baeldung.dddhexagonalspring.domain; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +public class Order { + private UUID id; + private OrderStatus status; + private List<OrderItem> orderItems; + private BigDecimal price; + + public Order(final UUID id, final Product product) { + this.id = id; + this.orderItems = new ArrayList<>(Collections.singletonList(new OrderItem(product))); + this.status = OrderStatus.CREATED; + this.price = product.getPrice(); + } + + public void complete() { + validateState(); + this.status = OrderStatus.COMPLETED; + } + + public void addOrder(final Product product) { + validateState(); + validateProduct(product); + orderItems.add(new OrderItem(product)); + price = price.add(product.getPrice()); + } + + public void removeOrder(final UUID id) { + validateState(); + final OrderItem orderItem = getOrderItem(id); + orderItems.remove(orderItem); + + price = price.subtract(orderItem.getPrice()); + } + + private OrderItem getOrderItem(final UUID id) { + return orderItems + .stream() + .filter(orderItem -> orderItem + .getProductId() + .equals(id)) + .findFirst() + .orElseThrow(() -> new DomainException("Product with " + id + " doesn't exist.")); + } + + private void validateState() { + if (OrderStatus.COMPLETED.equals(status)) { + throw new DomainException("The order is in completed state."); + } + } + + private void validateProduct(final Product product) { + if (product == null) { + throw new DomainException("The product cannot be null."); + } + } + + public UUID getId() { + return id; + } + + public OrderStatus getStatus() { + return status; + } + + public BigDecimal getPrice() { + return price; + } + + public List<OrderItem> getOrderItems() { + return Collections.unmodifiableList(orderItems); + } + + private Order() { + } +} diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/OrderItem.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/OrderItem.java new file mode 100644 index 0000000000..9debb02680 --- /dev/null +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/OrderItem.java @@ -0,0 +1,39 @@ +package com.baeldung.dddhexagonalspring.domain; + +import java.math.BigDecimal; +import java.util.Objects; +import java.util.UUID; + +public class OrderItem { + private UUID productId; + private BigDecimal price; + + public OrderItem(final Product product) { + this.productId = product.getId(); + this.price = product.getPrice(); + } + + public UUID getProductId() { + return productId; + } + + public BigDecimal getPrice() { + return price; + } + + private OrderItem() { + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + OrderItem orderItem = (OrderItem) o; + return Objects.equals(productId, orderItem.productId) && Objects.equals(price, orderItem.price); + } + + @Override + public int hashCode() { + return Objects.hash(productId, price); + } +} diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/OrderStatus.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/OrderStatus.java new file mode 100644 index 0000000000..2ee5df3ab7 --- /dev/null +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/OrderStatus.java @@ -0,0 +1,5 @@ +package com.baeldung.dddhexagonalspring.domain; + +public enum OrderStatus { + CREATED, COMPLETED +} diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/Product.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/Product.java new file mode 100644 index 0000000000..e05b4afe62 --- /dev/null +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/Product.java @@ -0,0 +1,46 @@ +package com.baeldung.dddhexagonalspring.domain; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.math.BigDecimal; +import java.util.Objects; +import java.util.UUID; + +public class Product { + private final UUID id; + private final BigDecimal price; + private final String name; + + @JsonCreator + public Product(@JsonProperty("id") final UUID id, @JsonProperty("price") final BigDecimal price, @JsonProperty("name") final String name) { + this.id = id; + this.price = price; + this.name = name; + } + + public BigDecimal getPrice() { + return price; + } + + public String getName() { + return name; + } + + public UUID getId() { + return id; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Product product = (Product) o; + return Objects.equals(id, product.id) && Objects.equals(price, product.price) && Objects.equals(name, product.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, price, name); + } +} diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/repository/OrderRepository.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/repository/OrderRepository.java new file mode 100644 index 0000000000..14b34e13f3 --- /dev/null +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/repository/OrderRepository.java @@ -0,0 +1,12 @@ +package com.baeldung.dddhexagonalspring.domain.repository; + +import com.baeldung.dddhexagonalspring.domain.Order; + +import java.util.Optional; +import java.util.UUID; + +public interface OrderRepository { + Optional<Order> findById(UUID id); + + void save(Order order); +} diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/service/DomainOrderService.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/service/DomainOrderService.java new file mode 100644 index 0000000000..4fb2377745 --- /dev/null +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/service/DomainOrderService.java @@ -0,0 +1,54 @@ +package com.baeldung.dddhexagonalspring.domain.service; + +import com.baeldung.dddhexagonalspring.domain.Order; +import com.baeldung.dddhexagonalspring.domain.Product; +import com.baeldung.dddhexagonalspring.domain.repository.OrderRepository; + +import java.util.UUID; + +public class DomainOrderService implements OrderService { + + private final OrderRepository orderRepository; + + public DomainOrderService(final OrderRepository orderRepository) { + this.orderRepository = orderRepository; + } + + @Override + public UUID createOrder(final Product product) { + final Order order = new Order(UUID.randomUUID(), product); + orderRepository.save(order); + + return order.getId(); + } + + @Override + public void addProduct(final UUID id, final Product product) { + final Order order = getOrder(id); + order.addOrder(product); + + orderRepository.save(order); + } + + @Override + public void completeOrder(final UUID id) { + final Order order = getOrder(id); + order.complete(); + + orderRepository.save(order); + } + + @Override + public void deleteProduct(final UUID id, final UUID productId) { + final Order order = getOrder(id); + order.removeOrder(productId); + + orderRepository.save(order); + } + + private Order getOrder(UUID id) { + return orderRepository + .findById(id) + .orElseThrow(() -> new RuntimeException("Order with given id doesn't exist")); + } +} diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/service/OrderService.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/service/OrderService.java new file mode 100644 index 0000000000..37297d74c4 --- /dev/null +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/service/OrderService.java @@ -0,0 +1,15 @@ +package com.baeldung.dddhexagonalspring.domain.service; + +import com.baeldung.dddhexagonalspring.domain.Product; + +import java.util.UUID; + +public interface OrderService { + UUID createOrder(Product product); + + void addProduct(UUID id, Product product); + + void completeOrder(UUID id); + + void deleteProduct(UUID id, UUID productId); +} diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/BeanConfiguration.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/BeanConfiguration.java new file mode 100644 index 0000000000..4be5d84ba7 --- /dev/null +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/BeanConfiguration.java @@ -0,0 +1,19 @@ +package com.baeldung.dddhexagonalspring.infrastracture.configuration; + +import com.baeldung.dddhexagonalspring.DomainLayerApplication; +import com.baeldung.dddhexagonalspring.domain.repository.OrderRepository; +import com.baeldung.dddhexagonalspring.domain.service.DomainOrderService; +import com.baeldung.dddhexagonalspring.domain.service.OrderService; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ComponentScan(basePackageClasses = DomainLayerApplication.class) +public class BeanConfiguration { + + @Bean + OrderService orderService(final OrderRepository orderRepository) { + return new DomainOrderService(orderRepository); + } +} diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/MongoDBConfiguration.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/MongoDBConfiguration.java new file mode 100644 index 0000000000..fd76b2eb0e --- /dev/null +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/MongoDBConfiguration.java @@ -0,0 +1,8 @@ +package com.baeldung.dddhexagonalspring.infrastracture.configuration; + +import com.baeldung.dddhexagonalspring.infrastracture.repository.SpringDataOrderRepository; +import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; + +@EnableMongoRepositories(basePackageClasses = SpringDataOrderRepository.class) +public class MongoDBConfiguration { +} diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepository.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepository.java new file mode 100644 index 0000000000..3123ef3e2f --- /dev/null +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepository.java @@ -0,0 +1,30 @@ +package com.baeldung.dddhexagonalspring.infrastracture.repository; + +import com.baeldung.dddhexagonalspring.domain.Order; +import com.baeldung.dddhexagonalspring.domain.repository.OrderRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Optional; +import java.util.UUID; + +@Component +public class MongoDbOrderRepository implements OrderRepository { + + private final SpringDataOrderRepository orderRepository; + + @Autowired + public MongoDbOrderRepository(final SpringDataOrderRepository orderRepository) { + this.orderRepository = orderRepository; + } + + @Override + public Optional<Order> findById(final UUID id) { + return orderRepository.findById(id); + } + + @Override + public void save(final Order order) { + orderRepository.save(order); + } +} diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/SpringDataOrderRepository.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/SpringDataOrderRepository.java new file mode 100644 index 0000000000..0279a5ce4a --- /dev/null +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/SpringDataOrderRepository.java @@ -0,0 +1,11 @@ +package com.baeldung.dddhexagonalspring.infrastracture.repository; + +import com.baeldung.dddhexagonalspring.domain.Order; +import org.springframework.data.mongodb.repository.MongoRepository; +import org.springframework.stereotype.Repository; + +import java.util.UUID; + +@Repository +public interface SpringDataOrderRepository extends MongoRepository<Order, UUID> { +} diff --git a/ddd/src/main/resources/ddd-layers.properties b/ddd/src/main/resources/ddd-layers.properties new file mode 100644 index 0000000000..0479996b17 --- /dev/null +++ b/ddd/src/main/resources/ddd-layers.properties @@ -0,0 +1,5 @@ +spring.data.mongodb.host=localhost +spring.data.mongodb.port=27017 +spring.data.mongodb.database=order-database +spring.data.mongodb.username=order +spring.data.mongodb.password=order \ No newline at end of file diff --git a/ddd/src/test/java/com/baeldung/dddhexagonalspring/domain/OrderProvider.java b/ddd/src/test/java/com/baeldung/dddhexagonalspring/domain/OrderProvider.java new file mode 100644 index 0000000000..c534713ca3 --- /dev/null +++ b/ddd/src/test/java/com/baeldung/dddhexagonalspring/domain/OrderProvider.java @@ -0,0 +1,17 @@ +package com.baeldung.dddhexagonalspring.domain; + +import java.math.BigDecimal; +import java.util.UUID; + +public class OrderProvider { + public static Order getCreatedOrder() { + return new Order(UUID.randomUUID(), new Product(UUID.randomUUID(), BigDecimal.TEN, "productName")); + } + + public static Order getCompletedOrder() { + final Order order = getCreatedOrder(); + order.complete(); + + return order; + } +} diff --git a/ddd/src/test/java/com/baeldung/dddhexagonalspring/domain/OrderUnitTest.java b/ddd/src/test/java/com/baeldung/dddhexagonalspring/domain/OrderUnitTest.java new file mode 100644 index 0000000000..eceed999d8 --- /dev/null +++ b/ddd/src/test/java/com/baeldung/dddhexagonalspring/domain/OrderUnitTest.java @@ -0,0 +1,65 @@ +package com.baeldung.dddhexagonalspring.domain; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.function.Executable; + +import java.math.BigDecimal; +import java.util.UUID; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +class OrderUnitTest { + + @Test + void shouldCompleteOrder_thenChangeStatus() { + final Order order = OrderProvider.getCreatedOrder(); + + order.complete(); + + assertEquals(OrderStatus.COMPLETED, order.getStatus()); + } + + @Test + void shouldAddProduct_thenUpdatePrice() { + final Order order = OrderProvider.getCreatedOrder(); + final int orderOriginalProductSize = order + .getOrderItems() + .size(); + final BigDecimal orderOriginalPrice = order.getPrice(); + final Product productToAdd = new Product(UUID.randomUUID(), new BigDecimal("20"), "secondProduct"); + + order.addOrder(productToAdd); + + assertEquals(orderOriginalProductSize + 1, order + .getOrderItems() + .size()); + assertEquals(orderOriginalPrice.add(productToAdd.getPrice()), order.getPrice()); + } + + @Test + void shouldAddProduct_thenThrowException() { + final Order order = OrderProvider.getCompletedOrder(); + final Product productToAdd = new Product(UUID.randomUUID(), new BigDecimal("20"), "secondProduct"); + + final Executable executable = () -> order.addOrder(productToAdd); + + Assertions.assertThrows(DomainException.class, executable); + } + + @Test + void shouldRemoveProduct_thenUpdatePrice() { + final Order order = OrderProvider.getCreatedOrder(); + final UUID productId = order + .getOrderItems() + .get(0) + .getProductId(); + + order.removeOrder(productId); + + assertEquals(0, order + .getOrderItems() + .size()); + assertEquals(BigDecimal.ZERO, order.getPrice()); + } +} \ No newline at end of file diff --git a/ddd/src/test/java/com/baeldung/dddhexagonalspring/domain/service/DomainOrderServiceUnitTest.java b/ddd/src/test/java/com/baeldung/dddhexagonalspring/domain/service/DomainOrderServiceUnitTest.java new file mode 100644 index 0000000000..797068a30a --- /dev/null +++ b/ddd/src/test/java/com/baeldung/dddhexagonalspring/domain/service/DomainOrderServiceUnitTest.java @@ -0,0 +1,91 @@ +package com.baeldung.dddhexagonalspring.domain.service; + +import com.baeldung.dddhexagonalspring.domain.Order; +import com.baeldung.dddhexagonalspring.domain.OrderProvider; +import com.baeldung.dddhexagonalspring.domain.Product; +import com.baeldung.dddhexagonalspring.domain.repository.OrderRepository; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.function.Executable; + +import java.math.BigDecimal; +import java.util.Optional; +import java.util.UUID; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.*; + +class DomainOrderServiceUnitTest { + + private OrderRepository orderRepository; + private DomainOrderService tested; + + @BeforeEach + void setUp() { + orderRepository = mock(OrderRepository.class); + tested = new DomainOrderService(orderRepository); + } + + @Test + void shouldCreateOrder_thenSaveIt() { + final Product product = new Product(UUID.randomUUID(), BigDecimal.TEN, "productName"); + + final UUID id = tested.createOrder(product); + + verify(orderRepository).save(any(Order.class)); + assertNotNull(id); + } + + @Test + void shouldAddProduct_thenSaveOrder() { + final Order order = spy(OrderProvider.getCreatedOrder()); + final Product product = new Product(UUID.randomUUID(), BigDecimal.TEN, "test"); + when(orderRepository.findById(order.getId())).thenReturn(Optional.of(order)); + + tested.addProduct(order.getId(), product); + + verify(orderRepository).save(order); + verify(order).addOrder(product); + } + + @Test + void shouldAddProduct_thenThrowException() { + final Product product = new Product(UUID.randomUUID(), BigDecimal.TEN, "test"); + final UUID id = UUID.randomUUID(); + when(orderRepository.findById(id)).thenReturn(Optional.empty()); + + final Executable executable = () -> tested.addProduct(id, product); + + verify(orderRepository, times(0)).save(any(Order.class)); + assertThrows(RuntimeException.class, executable); + } + + @Test + void shouldCompleteOrder_thenSaveIt() { + final Order order = spy(OrderProvider.getCreatedOrder()); + when(orderRepository.findById(order.getId())).thenReturn(Optional.of(order)); + + tested.completeOrder(order.getId()); + + verify(orderRepository).save(any(Order.class)); + verify(order).complete(); + } + + @Test + void shouldDeleteProduct_thenSaveOrder() { + final Order order = spy(OrderProvider.getCreatedOrder()); + final UUID productId = order + .getOrderItems() + .get(0) + .getProductId(); + + when(orderRepository.findById(order.getId())).thenReturn(Optional.of(order)); + + tested.deleteProduct(order.getId(), productId); + + verify(orderRepository).save(order); + verify(order).removeOrder(productId); + } +} \ No newline at end of file diff --git a/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryUnitTest.java b/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryUnitTest.java new file mode 100644 index 0000000000..8f7e8260a3 --- /dev/null +++ b/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryUnitTest.java @@ -0,0 +1,51 @@ +package com.baeldung.dddhexagonalspring.infrastracture.repository; + +import com.baeldung.dddhexagonalspring.domain.Order; +import com.baeldung.dddhexagonalspring.domain.Product; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.math.BigDecimal; +import java.util.Optional; +import java.util.UUID; + +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.Mockito.*; + +class MongoDbOrderRepositoryUnitTest { + + private SpringDataOrderRepository springDataOrderRepository; + private MongoDbOrderRepository tested; + + @BeforeEach + void setUp(){ + springDataOrderRepository = mock(SpringDataOrderRepository.class); + + tested = new MongoDbOrderRepository(springDataOrderRepository); + } + + @Test + void shouldFindById_thenReturnOrder() { + final UUID id = UUID.randomUUID(); + final Order order = createOrder(id); + when(springDataOrderRepository.findById(id)).thenReturn(Optional.of(order)); + + final Optional<Order> result = tested.findById(id); + + assertEquals(order, result.get()); + } + + @Test + void shouldSaveOrder_viaSpringDataOrderRepository() { + final UUID id = UUID.randomUUID(); + final Order order = createOrder(id); + + tested.save(order); + + verify(springDataOrderRepository).save(order); + } + + private Order createOrder(UUID id) { + return new Order(id, new Product(UUID.randomUUID(), BigDecimal.TEN, "product")); + } +} \ No newline at end of file diff --git a/ddd/src/test/resources/com/baeldung/dddhexagonalspring/README.md b/ddd/src/test/resources/com/baeldung/dddhexagonalspring/README.md new file mode 100644 index 0000000000..e0337498fc --- /dev/null +++ b/ddd/src/test/resources/com/baeldung/dddhexagonalspring/README.md @@ -0,0 +1,7 @@ +## Setup DDD Hexagonal Spring Application + +To run this project, follow these steps: + +* Run the application database by executing `docker-compose up` in this directory. +* Launch the Spring Boot Application (DomainLayerApplication). +* By default, application will connect to this database (configuration in *ddd-layers.properties*) \ No newline at end of file diff --git a/ddd/src/test/resources/com/baeldung/dddhexagonalspring/docker-compose.yml b/ddd/src/test/resources/com/baeldung/dddhexagonalspring/docker-compose.yml new file mode 100644 index 0000000000..d85ddf4a0e --- /dev/null +++ b/ddd/src/test/resources/com/baeldung/dddhexagonalspring/docker-compose.yml @@ -0,0 +1,14 @@ +version: '3' + +services: + order-mongo-database: + image: mongo:3.4.13 + restart: always + ports: + - 27017:27017 + environment: + MONGO_INITDB_ROOT_USERNAME: admin + MONGO_INITDB_ROOT_PASSWORD: admin + MONGO_INITDB_DATABASE: order-database + volumes: + - ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro \ No newline at end of file diff --git a/ddd/src/test/resources/com/baeldung/dddhexagonalspring/mongo-init.js b/ddd/src/test/resources/com/baeldung/dddhexagonalspring/mongo-init.js new file mode 100644 index 0000000000..b1564df50a --- /dev/null +++ b/ddd/src/test/resources/com/baeldung/dddhexagonalspring/mongo-init.js @@ -0,0 +1,12 @@ +db.createUser( + { + user: "order", + pwd: "order", + roles: [ + { + role: "readWrite", + db: "order-database" + } + ] + } +); \ No newline at end of file diff --git a/deeplearning4j/pom.xml b/deeplearning4j/pom.xml index a8663865e0..0e84fa1516 100644 --- a/deeplearning4j/pom.xml +++ b/deeplearning4j/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.deeplearning4j</groupId> <artifactId>deeplearning4j</artifactId> diff --git a/disruptor/pom.xml b/disruptor/pom.xml index 213331f25c..94be78fad6 100644 --- a/disruptor/pom.xml +++ b/disruptor/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>disruptor</artifactId> <version>0.1.0-SNAPSHOT</version> @@ -115,7 +116,7 @@ <properties> <!-- util --> <disruptor.version>3.3.6</disruptor.version> - <!-- testing --> + <!-- testing --> <maven-shade-plugin.version>2.4.3</maven-shade-plugin.version> <maven-jar-plugin.version>3.0.2</maven-jar-plugin.version> <onejar-maven-plugin.version>1.4.4</onejar-maven-plugin.version> diff --git a/dozer/pom.xml b/dozer/pom.xml index c781962d83..e307354603 100644 --- a/dozer/pom.xml +++ b/dozer/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>dozer</artifactId> <version>1.0</version> diff --git a/drools/pom.xml b/drools/pom.xml index b5cfc7d6dc..b4421ff2e3 100644 --- a/drools/pom.xml +++ b/drools/pom.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>drools</artifactId> <name>drools</name> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-spring-4</artifactId> diff --git a/dubbo/pom.xml b/dubbo/pom.xml index 947175b6a0..9a7aceb9e5 100644 --- a/dubbo/pom.xml +++ b/dubbo/pom.xml @@ -1,12 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>dubbo</artifactId> <name>dubbo</name> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> diff --git a/ethereum/pom.xml b/ethereum/pom.xml index 148909e787..6fc31208d2 100644 --- a/ethereum/pom.xml +++ b/ethereum/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -6,8 +7,8 @@ <name>ethereum</name> <parent> - <artifactId>parent-spring-5</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-spring-5</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-spring-5</relativePath> </parent> diff --git a/feign/pom.xml b/feign/pom.xml index d2fa334270..6dc8e7bafa 100644 --- a/feign/pom.xml +++ b/feign/pom.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.feign</groupId> <artifactId>feign</artifactId> - <name>feign</name> + <name>feign</name> <parent> <groupId>com.baeldung</groupId> diff --git a/flyway-cdi-extension/pom.xml b/flyway-cdi-extension/pom.xml index 49bd6bd9fd..8f7d058db7 100644 --- a/flyway-cdi-extension/pom.xml +++ b/flyway-cdi-extension/pom.xml @@ -50,10 +50,10 @@ </dependencies> <properties> - <cdi-api.version>2.0.SP1</cdi-api.version> - <weld-se-core.version>3.0.5.Final</weld-se-core.version> - <flyway-core.version>5.1.4</flyway-core.version> - <tomcat-jdbc.version>8.5.33</tomcat-jdbc.version> - <javax.annotation-api.version>1.3.2</javax.annotation-api.version> + <cdi-api.version>2.0.SP1</cdi-api.version> + <weld-se-core.version>3.0.5.Final</weld-se-core.version> + <flyway-core.version>5.1.4</flyway-core.version> + <tomcat-jdbc.version>8.5.33</tomcat-jdbc.version> + <javax.annotation-api.version>1.3.2</javax.annotation-api.version> </properties> </project> diff --git a/geotools/pom.xml b/geotools/pom.xml index 17beded326..71489bdf94 100644 --- a/geotools/pom.xml +++ b/geotools/pom.xml @@ -1,49 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <artifactId>geotools</artifactId> - <version>0.0.1-SNAPSHOT</version> - <name>geotools</name> - <packaging>jar</packaging> - <url>http://maven.apache.org</url> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>geotools</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>geotools</name> + <packaging>jar</packaging> + <url>http://maven.apache.org</url> - <parent> - <groupId>com.baeldung</groupId> - <artifactId>parent-modules</artifactId> - <version>1.0.0-SNAPSHOT</version> - </parent> + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> - <dependencies> - <dependency> - <groupId>org.geotools</groupId> - <artifactId>gt-shapefile</artifactId> - <version>${geotools-shapefile.version}</version> - </dependency> - <dependency> - <groupId>org.geotools</groupId> - <artifactId>gt-epsg-hsql</artifactId> - <version>${geotools.version}</version> - </dependency> - <dependency> - <groupId>org.geotools</groupId> - <artifactId>gt-swing</artifactId> - <version>${geotools-swing.version}</version> - </dependency> - </dependencies> + <dependencies> + <dependency> + <groupId>org.geotools</groupId> + <artifactId>gt-shapefile</artifactId> + <version>${geotools-shapefile.version}</version> + </dependency> + <dependency> + <groupId>org.geotools</groupId> + <artifactId>gt-epsg-hsql</artifactId> + <version>${geotools.version}</version> + </dependency> + <dependency> + <groupId>org.geotools</groupId> + <artifactId>gt-swing</artifactId> + <version>${geotools-swing.version}</version> + </dependency> + </dependencies> - <repositories> - <repository> - <id>osgeo</id> - <name>Open Source Geospatial Foundation Repository</name> - <url>http://download.osgeo.org/webdav/geotools/</url> - </repository> - </repositories> + <repositories> + <repository> + <id>osgeo</id> + <name>Open Source Geospatial Foundation Repository</name> + <url>http://download.osgeo.org/webdav/geotools/</url> + </repository> + </repositories> - <properties> - <geotools.version>15.2</geotools.version> - <geotools-swing.version>15.2</geotools-swing.version> - <geotools-shapefile.version>15.2</geotools-shapefile.version> - </properties> + <properties> + <geotools.version>15.2</geotools.version> + <geotools-swing.version>15.2</geotools-swing.version> + <geotools-shapefile.version>15.2</geotools-shapefile.version> + </properties> </project> diff --git a/google-cloud/pom.xml b/google-cloud/pom.xml index ec53b78070..15f7f5c824 100644 --- a/google-cloud/pom.xml +++ b/google-cloud/pom.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>google-cloud</artifactId> <version>0.1-SNAPSHOT</version> <name>google-cloud</name> - <description>Google Cloud Tutorials</description> <packaging>jar</packaging> + <description>Google Cloud Tutorials</description> <parent> <groupId>com.baeldung</groupId> diff --git a/google-web-toolkit/pom.xml b/google-web-toolkit/pom.xml index 8a7cb87701..e79b43c5e5 100644 --- a/google-web-toolkit/pom.xml +++ b/google-web-toolkit/pom.xml @@ -1,125 +1,124 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <!-- POM file generated with GWT webAppCreator --> + <modelVersion>4.0.0</modelVersion> + <artifactId>google-web-toolkit</artifactId> + <version>1.0-SNAPSHOT</version> + <name>google-web-toolkit</name> + <packaging>war</packaging> - <!-- POM file generated with GWT webAppCreator --> - <modelVersion>4.0.0</modelVersion> - <artifactId>google-web-toolkit</artifactId> - <version>1.0-SNAPSHOT</version> - <name>google-web-toolkit</name> - <packaging>war</packaging> - <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> - <dependencyManagement> - <dependencies> - <!-- ensure all GWT deps use the same version (unless overridden) --> - <dependency> - <groupId>com.google.gwt</groupId> - <artifactId>gwt</artifactId> - <version>${gwt.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> + <dependencyManagement> + <dependencies> + <!-- ensure all GWT deps use the same version (unless overridden) --> + <dependency> + <groupId>com.google.gwt</groupId> + <artifactId>gwt</artifactId> + <version>${gwt.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> - <dependencies> - <dependency> - <groupId>com.google.gwt</groupId> - <artifactId>gwt-servlet</artifactId> - <scope>runtime</scope> - </dependency> - <dependency> - <groupId>com.google.gwt</groupId> - <artifactId>gwt-user</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>com.google.gwt</groupId> - <artifactId>gwt-dev</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>${junit.version}</version> - <scope>test</scope> - </dependency> - </dependencies> + <dependencies> + <dependency> + <groupId>com.google.gwt</groupId> + <artifactId>gwt-servlet</artifactId> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>com.google.gwt</groupId> + <artifactId>gwt-user</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>com.google.gwt</groupId> + <artifactId>gwt-dev</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>${junit.version}</version> + <scope>test</scope> + </dependency> + </dependencies> - <build> - <!-- Output classes directly into the webapp, so that IDEs and "mvn process-classes" - update them in DevMode --> - <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory> + <build> + <!-- Output classes directly into the webapp, so that IDEs and "mvn process-classes" + update them in DevMode --> + <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory> - <plugins> + <plugins> - <!-- GWT Maven Plugin --> - <plugin> - <groupId>net.ltgt.gwt.maven</groupId> - <artifactId>gwt-maven-plugin</artifactId> - <version>1.0-rc-8</version> - <executions> - <execution> - <goals> - <goal>compile</goal> - <goal>test</goal> - </goals> - </execution> - </executions> - <configuration> - <moduleName>com.baeldung.Google_web_toolkit</moduleName> - <moduleShortName>Google_web_toolkit</moduleShortName> - <failOnError>true</failOnError> - <!-- GWT compiler 2.8 requires 1.8, hence define sourceLevel here if - you use a different source language for java compilation --> - <sourceLevel>1.8</sourceLevel> - <!-- Compiler configuration --> - <compilerArgs> - <!-- Ask GWT to create the Story of Your Compile (SOYC) (gwt:compile) --> - <arg>-compileReport</arg> - <arg>-XcompilerMetrics</arg> - </compilerArgs> - <!-- DevMode configuration --> - <warDir>${project.build.directory}/${project.build.finalName}</warDir> - <classpathScope>compile+runtime</classpathScope> - <!-- URL(s) that should be opened by DevMode (gwt:devmode). --> - <startupUrls> - <startupUrl>Google_web_toolkit.html</startupUrl> - </startupUrls> - </configuration> - </plugin> + <!-- GWT Maven Plugin --> + <plugin> + <groupId>net.ltgt.gwt.maven</groupId> + <artifactId>gwt-maven-plugin</artifactId> + <version>1.0-rc-8</version> + <executions> + <execution> + <goals> + <goal>compile</goal> + <goal>test</goal> + </goals> + </execution> + </executions> + <configuration> + <moduleName>com.baeldung.Google_web_toolkit</moduleName> + <moduleShortName>Google_web_toolkit</moduleShortName> + <failOnError>true</failOnError> + <!-- GWT compiler 2.8 requires 1.8, hence define sourceLevel here if + you use a different source language for java compilation --> + <sourceLevel>1.8</sourceLevel> + <!-- Compiler configuration --> + <compilerArgs> + <!-- Ask GWT to create the Story of Your Compile (SOYC) (gwt:compile) --> + <arg>-compileReport</arg> + <arg>-XcompilerMetrics</arg> + </compilerArgs> + <!-- DevMode configuration --> + <warDir>${project.build.directory}/${project.build.finalName}</warDir> + <classpathScope>compile+runtime</classpathScope> + <!-- URL(s) that should be opened by DevMode (gwt:devmode). --> + <startupUrls> + <startupUrl>Google_web_toolkit.html</startupUrl> + </startupUrls> + </configuration> + </plugin> - <!-- Skip normal test execution, we use gwt:test instead --> - <plugin> - <artifactId>maven-surefire-plugin</artifactId> - <version>2.17</version> - <configuration> - <skip>true</skip> - </configuration> - </plugin> + <!-- Skip normal test execution, we use gwt:test instead --> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <version>2.17</version> + <configuration> + <skip>true</skip> + </configuration> + </plugin> - </plugins> - </build> - - <properties> + </plugins> + </build> - <!-- Setting maven.compiler.source to something different to 1.8 needs - that you configure the sourceLevel in gwt-maven-plugin since GWT compiler - 2.8 requires 1.8 (see gwt-maven-plugin block below) --> - <maven.compiler.source>1.8</maven.compiler.source> - <maven.compiler.target>1.8</maven.compiler.target> + <properties> + + <!-- Setting maven.compiler.source to something different to 1.8 needs + that you configure the sourceLevel in gwt-maven-plugin since GWT compiler + 2.8 requires 1.8 (see gwt-maven-plugin block below) --> + <maven.compiler.source>1.8</maven.compiler.source> + <maven.compiler.target>1.8</maven.compiler.target> + + <!-- Don't let your Mac use a crazy non-standard encoding --> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <gwt.version>2.8.2</gwt.version> + </properties> - <!-- Don't let your Mac use a crazy non-standard encoding --> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - <gwt.version>2.8.2</gwt.version> - </properties> - </project> diff --git a/graphql/graphql-java/pom.xml b/graphql/graphql-java/pom.xml index fb121d3234..3613d89ae7 100644 --- a/graphql/graphql-java/pom.xml +++ b/graphql/graphql-java/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.graphql</groupId> <artifactId>graphql-java</artifactId> diff --git a/grpc/pom.xml b/grpc/pom.xml index ab550c31d7..c7ae111da3 100644 --- a/grpc/pom.xml +++ b/grpc/pom.xml @@ -1,11 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>grpc</artifactId> <version>0.0.1-SNAPSHOT</version> - <name>grpc</name> + <name>grpc</name> <packaging>jar</packaging> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> diff --git a/gson/pom.xml b/gson/pom.xml index 4aa6c00458..f2ed5509fa 100644 --- a/gson/pom.xml +++ b/gson/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> diff --git a/gson/src/main/java/org/baeldung/gson/entities/ActorGson.java b/gson/src/main/java/com/baeldung/gson/entities/ActorGson.java similarity index 97% rename from gson/src/main/java/org/baeldung/gson/entities/ActorGson.java rename to gson/src/main/java/com/baeldung/gson/entities/ActorGson.java index 92468683bf..a68dba2436 100644 --- a/gson/src/main/java/org/baeldung/gson/entities/ActorGson.java +++ b/gson/src/main/java/com/baeldung/gson/entities/ActorGson.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.entities; +package com.baeldung.gson.entities; import java.text.DateFormat; import java.text.SimpleDateFormat; diff --git a/gson/src/main/java/org/baeldung/gson/entities/Animal.java b/gson/src/main/java/com/baeldung/gson/entities/Animal.java similarity index 65% rename from gson/src/main/java/org/baeldung/gson/entities/Animal.java rename to gson/src/main/java/com/baeldung/gson/entities/Animal.java index 2eec5f8704..6c0f4a6e4e 100644 --- a/gson/src/main/java/org/baeldung/gson/entities/Animal.java +++ b/gson/src/main/java/com/baeldung/gson/entities/Animal.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.entities; +package com.baeldung.gson.entities; public abstract class Animal { public String type = "Animal"; diff --git a/gson/src/main/java/org/baeldung/gson/entities/Cow.java b/gson/src/main/java/com/baeldung/gson/entities/Cow.java similarity index 88% rename from gson/src/main/java/org/baeldung/gson/entities/Cow.java rename to gson/src/main/java/com/baeldung/gson/entities/Cow.java index 020bcd5860..5bd8d23f44 100644 --- a/gson/src/main/java/org/baeldung/gson/entities/Cow.java +++ b/gson/src/main/java/com/baeldung/gson/entities/Cow.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.entities; +package com.baeldung.gson.entities; public class Cow extends Animal { private String breed; diff --git a/gson/src/main/java/org/baeldung/gson/entities/Dog.java b/gson/src/main/java/com/baeldung/gson/entities/Dog.java similarity index 88% rename from gson/src/main/java/org/baeldung/gson/entities/Dog.java rename to gson/src/main/java/com/baeldung/gson/entities/Dog.java index 042d73adcf..ac55573866 100644 --- a/gson/src/main/java/org/baeldung/gson/entities/Dog.java +++ b/gson/src/main/java/com/baeldung/gson/entities/Dog.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.entities; +package com.baeldung.gson.entities; public class Dog extends Animal { private String petName; diff --git a/gson/src/main/java/org/baeldung/gson/entities/Employee.java b/gson/src/main/java/com/baeldung/gson/entities/Employee.java similarity index 94% rename from gson/src/main/java/org/baeldung/gson/entities/Employee.java rename to gson/src/main/java/com/baeldung/gson/entities/Employee.java index cedcd6572e..ecc4571dcc 100644 --- a/gson/src/main/java/org/baeldung/gson/entities/Employee.java +++ b/gson/src/main/java/com/baeldung/gson/entities/Employee.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.entities; +package com.baeldung.gson.entities; public class Employee { private int id; diff --git a/gson/src/main/java/org/baeldung/gson/entities/Movie.java b/gson/src/main/java/com/baeldung/gson/entities/Movie.java similarity index 96% rename from gson/src/main/java/org/baeldung/gson/entities/Movie.java rename to gson/src/main/java/com/baeldung/gson/entities/Movie.java index ee688f228d..ebc4cff137 100644 --- a/gson/src/main/java/org/baeldung/gson/entities/Movie.java +++ b/gson/src/main/java/com/baeldung/gson/entities/Movie.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.entities; +package com.baeldung.gson.entities; import java.util.List; diff --git a/gson/src/main/java/org/baeldung/gson/entities/MovieWithNullValue.java b/gson/src/main/java/com/baeldung/gson/entities/MovieWithNullValue.java similarity index 95% rename from gson/src/main/java/org/baeldung/gson/entities/MovieWithNullValue.java rename to gson/src/main/java/com/baeldung/gson/entities/MovieWithNullValue.java index fe62d51ffb..381d7cb83b 100644 --- a/gson/src/main/java/org/baeldung/gson/entities/MovieWithNullValue.java +++ b/gson/src/main/java/com/baeldung/gson/entities/MovieWithNullValue.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.entities; +package com.baeldung.gson.entities; import com.google.gson.annotations.Expose; diff --git a/gson/src/main/java/org/baeldung/gson/entities/MyClass.java b/gson/src/main/java/com/baeldung/gson/entities/MyClass.java similarity index 96% rename from gson/src/main/java/org/baeldung/gson/entities/MyClass.java rename to gson/src/main/java/com/baeldung/gson/entities/MyClass.java index 4e717e72c3..66a1887414 100644 --- a/gson/src/main/java/org/baeldung/gson/entities/MyClass.java +++ b/gson/src/main/java/com/baeldung/gson/entities/MyClass.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.entities; +package com.baeldung.gson.entities; import java.util.Objects; diff --git a/gson/src/main/java/org/baeldung/gson/entities/User.java b/gson/src/main/java/com/baeldung/gson/entities/User.java similarity index 84% rename from gson/src/main/java/org/baeldung/gson/entities/User.java rename to gson/src/main/java/com/baeldung/gson/entities/User.java index b413f3300e..d821ef5552 100644 --- a/gson/src/main/java/org/baeldung/gson/entities/User.java +++ b/gson/src/main/java/com/baeldung/gson/entities/User.java @@ -1,19 +1,19 @@ -package org.baeldung.gson.entities; - -public class User { - - private int id; - private String name; - private transient String nationality; - - public User(int id, String name, String nationality) { - this.id = id; - this.name = name; - this.nationality = nationality; - } - - public User(int id, String name) { - this(id, name, null); - } - -} +package com.baeldung.gson.entities; + +public class User { + + private int id; + private String name; + private transient String nationality; + + public User(int id, String name, String nationality) { + this.id = id; + this.name = name; + this.nationality = nationality; + } + + public User(int id, String name) { + this(id, name, null); + } + +} diff --git a/gson/src/main/java/org/baeldung/gson/entities/Weather.java b/gson/src/main/java/com/baeldung/gson/entities/Weather.java similarity index 95% rename from gson/src/main/java/org/baeldung/gson/entities/Weather.java rename to gson/src/main/java/com/baeldung/gson/entities/Weather.java index 383e9ef41c..b68ec4c6d4 100644 --- a/gson/src/main/java/org/baeldung/gson/entities/Weather.java +++ b/gson/src/main/java/com/baeldung/gson/entities/Weather.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.entities; +package com.baeldung.gson.entities; import com.google.gson.annotations.SerializedName; diff --git a/gson/src/main/java/org/baeldung/gson/primitives/models/BooleanExample.java b/gson/src/main/java/com/baeldung/gson/primitives/models/BooleanExample.java similarity index 75% rename from gson/src/main/java/org/baeldung/gson/primitives/models/BooleanExample.java rename to gson/src/main/java/com/baeldung/gson/primitives/models/BooleanExample.java index 1fe87650de..1f05fc6119 100644 --- a/gson/src/main/java/org/baeldung/gson/primitives/models/BooleanExample.java +++ b/gson/src/main/java/com/baeldung/gson/primitives/models/BooleanExample.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.primitives.models; +package com.baeldung.gson.primitives.models; public class BooleanExample { public boolean value; diff --git a/gson/src/main/java/org/baeldung/gson/primitives/models/ByteExample.java b/gson/src/main/java/com/baeldung/gson/primitives/models/ByteExample.java similarity index 75% rename from gson/src/main/java/org/baeldung/gson/primitives/models/ByteExample.java rename to gson/src/main/java/com/baeldung/gson/primitives/models/ByteExample.java index 2e1c68ee51..6ec4e42ea3 100644 --- a/gson/src/main/java/org/baeldung/gson/primitives/models/ByteExample.java +++ b/gson/src/main/java/com/baeldung/gson/primitives/models/ByteExample.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.primitives.models; +package com.baeldung.gson.primitives.models; public class ByteExample { public byte value = (byte) 1; diff --git a/gson/src/main/java/org/baeldung/gson/primitives/models/CharExample.java b/gson/src/main/java/com/baeldung/gson/primitives/models/CharExample.java similarity index 74% rename from gson/src/main/java/org/baeldung/gson/primitives/models/CharExample.java rename to gson/src/main/java/com/baeldung/gson/primitives/models/CharExample.java index ccac913f23..69d1a95fcd 100644 --- a/gson/src/main/java/org/baeldung/gson/primitives/models/CharExample.java +++ b/gson/src/main/java/com/baeldung/gson/primitives/models/CharExample.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.primitives.models; +package com.baeldung.gson.primitives.models; public class CharExample { public char value; diff --git a/gson/src/main/java/org/baeldung/gson/primitives/models/DoubleExample.java b/gson/src/main/java/com/baeldung/gson/primitives/models/DoubleExample.java similarity index 75% rename from gson/src/main/java/org/baeldung/gson/primitives/models/DoubleExample.java rename to gson/src/main/java/com/baeldung/gson/primitives/models/DoubleExample.java index 5022b6a11e..7c9db2bd50 100644 --- a/gson/src/main/java/org/baeldung/gson/primitives/models/DoubleExample.java +++ b/gson/src/main/java/com/baeldung/gson/primitives/models/DoubleExample.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.primitives.models; +package com.baeldung.gson.primitives.models; public class DoubleExample { public double value; diff --git a/gson/src/main/java/org/baeldung/gson/primitives/models/FloatExample.java b/gson/src/main/java/com/baeldung/gson/primitives/models/FloatExample.java similarity index 74% rename from gson/src/main/java/org/baeldung/gson/primitives/models/FloatExample.java rename to gson/src/main/java/com/baeldung/gson/primitives/models/FloatExample.java index 00a97f68fc..86c0c4802c 100644 --- a/gson/src/main/java/org/baeldung/gson/primitives/models/FloatExample.java +++ b/gson/src/main/java/com/baeldung/gson/primitives/models/FloatExample.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.primitives.models; +package com.baeldung.gson.primitives.models; public class FloatExample { public float value; diff --git a/gson/src/main/java/org/baeldung/gson/primitives/models/InfinityValuesExample.java b/gson/src/main/java/com/baeldung/gson/primitives/models/InfinityValuesExample.java similarity index 70% rename from gson/src/main/java/org/baeldung/gson/primitives/models/InfinityValuesExample.java rename to gson/src/main/java/com/baeldung/gson/primitives/models/InfinityValuesExample.java index 163b0a3d95..90f10c0751 100644 --- a/gson/src/main/java/org/baeldung/gson/primitives/models/InfinityValuesExample.java +++ b/gson/src/main/java/com/baeldung/gson/primitives/models/InfinityValuesExample.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.primitives.models; +package com.baeldung.gson.primitives.models; public class InfinityValuesExample { public float negativeInfinity; diff --git a/gson/src/main/java/org/baeldung/gson/primitives/models/LongExample.java b/gson/src/main/java/com/baeldung/gson/primitives/models/LongExample.java similarity index 75% rename from gson/src/main/java/org/baeldung/gson/primitives/models/LongExample.java rename to gson/src/main/java/com/baeldung/gson/primitives/models/LongExample.java index e709650789..021de1d06d 100644 --- a/gson/src/main/java/org/baeldung/gson/primitives/models/LongExample.java +++ b/gson/src/main/java/com/baeldung/gson/primitives/models/LongExample.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.primitives.models; +package com.baeldung.gson.primitives.models; public class LongExample { public long value = 1; diff --git a/gson/src/main/java/org/baeldung/gson/primitives/models/PrimitiveBundle.java b/gson/src/main/java/com/baeldung/gson/primitives/models/PrimitiveBundle.java similarity index 93% rename from gson/src/main/java/org/baeldung/gson/primitives/models/PrimitiveBundle.java rename to gson/src/main/java/com/baeldung/gson/primitives/models/PrimitiveBundle.java index ad7309a2f7..10134110f3 100644 --- a/gson/src/main/java/org/baeldung/gson/primitives/models/PrimitiveBundle.java +++ b/gson/src/main/java/com/baeldung/gson/primitives/models/PrimitiveBundle.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.primitives.models; +package com.baeldung.gson.primitives.models; public class PrimitiveBundle { public byte byteValue; diff --git a/gson/src/main/java/org/baeldung/gson/primitives/models/PrimitiveBundleInitialized.java b/gson/src/main/java/com/baeldung/gson/primitives/models/PrimitiveBundleInitialized.java similarity index 92% rename from gson/src/main/java/org/baeldung/gson/primitives/models/PrimitiveBundleInitialized.java rename to gson/src/main/java/com/baeldung/gson/primitives/models/PrimitiveBundleInitialized.java index 2780f7fd18..c6eb6ca267 100644 --- a/gson/src/main/java/org/baeldung/gson/primitives/models/PrimitiveBundleInitialized.java +++ b/gson/src/main/java/com/baeldung/gson/primitives/models/PrimitiveBundleInitialized.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.primitives.models; +package com.baeldung.gson.primitives.models; public class PrimitiveBundleInitialized { // @formatter:off diff --git a/gson/src/main/java/org/baeldung/gson/serialization/ActorGsonDeserializer.java b/gson/src/main/java/com/baeldung/gson/serialization/ActorGsonDeserializer.java similarity index 94% rename from gson/src/main/java/org/baeldung/gson/serialization/ActorGsonDeserializer.java rename to gson/src/main/java/com/baeldung/gson/serialization/ActorGsonDeserializer.java index 016e3ba1e2..34c9f83888 100644 --- a/gson/src/main/java/org/baeldung/gson/serialization/ActorGsonDeserializer.java +++ b/gson/src/main/java/com/baeldung/gson/serialization/ActorGsonDeserializer.java @@ -1,11 +1,11 @@ -package org.baeldung.gson.serialization; +package com.baeldung.gson.serialization; import java.lang.reflect.Type; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; -import org.baeldung.gson.entities.ActorGson; +import com.baeldung.gson.entities.ActorGson; import com.google.gson.JsonArray; import com.google.gson.JsonDeserializationContext; diff --git a/gson/src/main/java/org/baeldung/gson/serialization/ActorGsonSerializer.java b/gson/src/main/java/com/baeldung/gson/serialization/ActorGsonSerializer.java similarity index 93% rename from gson/src/main/java/org/baeldung/gson/serialization/ActorGsonSerializer.java rename to gson/src/main/java/com/baeldung/gson/serialization/ActorGsonSerializer.java index 8f2cd10f5a..4ca653f76b 100644 --- a/gson/src/main/java/org/baeldung/gson/serialization/ActorGsonSerializer.java +++ b/gson/src/main/java/com/baeldung/gson/serialization/ActorGsonSerializer.java @@ -1,10 +1,10 @@ -package org.baeldung.gson.serialization; +package com.baeldung.gson.serialization; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; -import org.baeldung.gson.entities.ActorGson; +import com.baeldung.gson.entities.ActorGson; import java.lang.reflect.Type; import java.text.SimpleDateFormat; diff --git a/gson/src/main/java/org/baeldung/gson/serialization/AnimalDeserializer.java b/gson/src/main/java/com/baeldung/gson/serialization/AnimalDeserializer.java similarity index 93% rename from gson/src/main/java/org/baeldung/gson/serialization/AnimalDeserializer.java rename to gson/src/main/java/com/baeldung/gson/serialization/AnimalDeserializer.java index 9dcef0e10b..6c72ddb0da 100644 --- a/gson/src/main/java/org/baeldung/gson/serialization/AnimalDeserializer.java +++ b/gson/src/main/java/com/baeldung/gson/serialization/AnimalDeserializer.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serialization; +package com.baeldung.gson.serialization; import com.google.gson.Gson; import com.google.gson.JsonDeserializationContext; @@ -8,7 +8,7 @@ import com.google.gson.JsonObject; import java.lang.reflect.Type; import java.util.HashMap; import java.util.Map; -import org.baeldung.gson.entities.Animal; +import com.baeldung.gson.entities.Animal; public class AnimalDeserializer implements JsonDeserializer<Animal> { private String animalTypeElementName; diff --git a/gson/src/main/java/org/baeldung/gson/serialization/MapDeserializer.java b/gson/src/main/java/com/baeldung/gson/serialization/MapDeserializer.java similarity index 94% rename from gson/src/main/java/org/baeldung/gson/serialization/MapDeserializer.java rename to gson/src/main/java/com/baeldung/gson/serialization/MapDeserializer.java index cdeb2e23c8..1954986547 100644 --- a/gson/src/main/java/org/baeldung/gson/serialization/MapDeserializer.java +++ b/gson/src/main/java/com/baeldung/gson/serialization/MapDeserializer.java @@ -1,12 +1,11 @@ -package org.baeldung.gson.serialization; +package com.baeldung.gson.serialization; import java.lang.reflect.Type; import java.math.BigDecimal; -import java.util.HashMap; import java.util.Map; import java.util.stream.Collectors; -import org.baeldung.gson.entities.Employee; +import com.baeldung.gson.entities.Employee; import com.google.gson.*; diff --git a/gson/src/main/java/org/baeldung/gson/serialization/StringDateMapDeserializer.java b/gson/src/main/java/com/baeldung/gson/serialization/StringDateMapDeserializer.java similarity index 97% rename from gson/src/main/java/org/baeldung/gson/serialization/StringDateMapDeserializer.java rename to gson/src/main/java/com/baeldung/gson/serialization/StringDateMapDeserializer.java index f18bdbc84f..fa9d7d2240 100644 --- a/gson/src/main/java/org/baeldung/gson/serialization/StringDateMapDeserializer.java +++ b/gson/src/main/java/com/baeldung/gson/serialization/StringDateMapDeserializer.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serialization; +package com.baeldung.gson.serialization; import java.lang.reflect.Type; import java.text.ParseException; diff --git a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/Exclude.java b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/Exclude.java similarity index 81% rename from gson/src/main/java/org/baeldung/gson/serializationwithexclusions/Exclude.java rename to gson/src/main/java/com/baeldung/gson/serializationwithexclusions/Exclude.java index 429cb9d1b5..d3067e3482 100644 --- a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/Exclude.java +++ b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/Exclude.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serializationwithexclusions; +package com.baeldung.gson.serializationwithexclusions; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MyClass.java b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClass.java similarity index 79% rename from gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MyClass.java rename to gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClass.java index cc6c498458..8919792721 100644 --- a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MyClass.java +++ b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClass.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serializationwithexclusions; +package com.baeldung.gson.serializationwithexclusions; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MyClassWithAnnotatedFields.java b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithAnnotatedFields.java similarity index 85% rename from gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MyClassWithAnnotatedFields.java rename to gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithAnnotatedFields.java index 5d41f8a224..4c38df1eac 100644 --- a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MyClassWithAnnotatedFields.java +++ b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithAnnotatedFields.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serializationwithexclusions; +package com.baeldung.gson.serializationwithexclusions; import com.google.gson.annotations.Expose; diff --git a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MyClassWithCustomAnnotatedFields.java b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithCustomAnnotatedFields.java similarity index 83% rename from gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MyClassWithCustomAnnotatedFields.java rename to gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithCustomAnnotatedFields.java index ace3583013..85871be03d 100644 --- a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MyClassWithCustomAnnotatedFields.java +++ b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithCustomAnnotatedFields.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serializationwithexclusions; +package com.baeldung.gson.serializationwithexclusions; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MyClassWithTransientFields.java b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithTransientFields.java similarity index 82% rename from gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MyClassWithTransientFields.java rename to gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithTransientFields.java index 5e781a6287..dfb9d4bd6e 100644 --- a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MyClassWithTransientFields.java +++ b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithTransientFields.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serializationwithexclusions; +package com.baeldung.gson.serializationwithexclusions; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MySubClass.java b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClass.java similarity index 78% rename from gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MySubClass.java rename to gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClass.java index 5adac0697e..6b8a287020 100644 --- a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MySubClass.java +++ b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClass.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serializationwithexclusions; +package com.baeldung.gson.serializationwithexclusions; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MySubClassWithAnnotatedFields.java b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithAnnotatedFields.java similarity index 83% rename from gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MySubClassWithAnnotatedFields.java rename to gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithAnnotatedFields.java index a0f7b5d277..0c94e8f2cc 100644 --- a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MySubClassWithAnnotatedFields.java +++ b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithAnnotatedFields.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serializationwithexclusions; +package com.baeldung.gson.serializationwithexclusions; import com.google.gson.annotations.Expose; diff --git a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MySubClassWithCustomAnnotatedFields.java b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithCustomAnnotatedFields.java similarity index 81% rename from gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MySubClassWithCustomAnnotatedFields.java rename to gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithCustomAnnotatedFields.java index f6aa4651b3..0bd9a149cb 100644 --- a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MySubClassWithCustomAnnotatedFields.java +++ b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithCustomAnnotatedFields.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serializationwithexclusions; +package com.baeldung.gson.serializationwithexclusions; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MySubClassWithTransientFields.java b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithTransientFields.java similarity index 80% rename from gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MySubClassWithTransientFields.java rename to gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithTransientFields.java index d4e31b0bc8..817d2ee557 100644 --- a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MySubClassWithTransientFields.java +++ b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithTransientFields.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serializationwithexclusions; +package com.baeldung.gson.serializationwithexclusions; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/gson/src/test/java/org/baeldung/gson/advance/GsonAdvanceUnitTest.java b/gson/src/test/java/com/baeldung/gson/advance/GsonAdvanceUnitTest.java similarity index 94% rename from gson/src/test/java/org/baeldung/gson/advance/GsonAdvanceUnitTest.java rename to gson/src/test/java/com/baeldung/gson/advance/GsonAdvanceUnitTest.java index 5b787f1956..d4adb6e406 100644 --- a/gson/src/test/java/org/baeldung/gson/advance/GsonAdvanceUnitTest.java +++ b/gson/src/test/java/com/baeldung/gson/advance/GsonAdvanceUnitTest.java @@ -1,8 +1,9 @@ -package org.baeldung.gson.advance; +package com.baeldung.gson.advance; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import com.baeldung.gson.entities.Dog; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; @@ -10,11 +11,10 @@ import java.lang.reflect.Type; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import org.baeldung.gson.entities.Animal; -import org.baeldung.gson.entities.Cow; -import org.baeldung.gson.entities.Dog; -import org.baeldung.gson.entities.MyClass; -import org.baeldung.gson.serialization.AnimalDeserializer; +import com.baeldung.gson.entities.Animal; +import com.baeldung.gson.entities.Cow; +import com.baeldung.gson.entities.MyClass; +import com.baeldung.gson.serialization.AnimalDeserializer; import org.junit.Test; public class GsonAdvanceUnitTest { diff --git a/gson/src/test/java/org/baeldung/gson/advance/RuntimeTypeAdapterFactory.java b/gson/src/test/java/com/baeldung/gson/advance/RuntimeTypeAdapterFactory.java similarity index 99% rename from gson/src/test/java/org/baeldung/gson/advance/RuntimeTypeAdapterFactory.java rename to gson/src/test/java/com/baeldung/gson/advance/RuntimeTypeAdapterFactory.java index 739dd889c7..aab3f5f3f1 100644 --- a/gson/src/test/java/org/baeldung/gson/advance/RuntimeTypeAdapterFactory.java +++ b/gson/src/test/java/com/baeldung/gson/advance/RuntimeTypeAdapterFactory.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.advance; +package com.baeldung.gson.advance; /* * Copyright (C) 2011 Google Inc. diff --git a/gson/src/test/java/org/baeldung/gson/conversion/JsonObjectConversionsUnitTest.java b/gson/src/test/java/com/baeldung/gson/conversion/JsonObjectConversionsUnitTest.java similarity index 96% rename from gson/src/test/java/org/baeldung/gson/conversion/JsonObjectConversionsUnitTest.java rename to gson/src/test/java/com/baeldung/gson/conversion/JsonObjectConversionsUnitTest.java index 847ec1b85d..9f07617969 100644 --- a/gson/src/test/java/org/baeldung/gson/conversion/JsonObjectConversionsUnitTest.java +++ b/gson/src/test/java/com/baeldung/gson/conversion/JsonObjectConversionsUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.conversion; +package com.baeldung.gson.conversion; import com.google.gson.*; import org.junit.Assert; diff --git a/gson/src/test/java/org/baeldung/gson/deserialization/Foo.java b/gson/src/test/java/com/baeldung/gson/deserialization/Foo.java similarity index 97% rename from gson/src/test/java/org/baeldung/gson/deserialization/Foo.java rename to gson/src/test/java/com/baeldung/gson/deserialization/Foo.java index 84f8aaef13..e556786020 100644 --- a/gson/src/test/java/org/baeldung/gson/deserialization/Foo.java +++ b/gson/src/test/java/com/baeldung/gson/deserialization/Foo.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.deserialization; +package com.baeldung.gson.deserialization; public class Foo { public int intValue; diff --git a/gson/src/test/java/org/baeldung/gson/deserialization/FooDeserializer.java b/gson/src/test/java/com/baeldung/gson/deserialization/FooDeserializer.java similarity index 95% rename from gson/src/test/java/org/baeldung/gson/deserialization/FooDeserializer.java rename to gson/src/test/java/com/baeldung/gson/deserialization/FooDeserializer.java index 17c1dfae19..1ccb3f7de9 100644 --- a/gson/src/test/java/org/baeldung/gson/deserialization/FooDeserializer.java +++ b/gson/src/test/java/com/baeldung/gson/deserialization/FooDeserializer.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.deserialization; +package com.baeldung.gson.deserialization; import java.lang.reflect.Type; diff --git a/gson/src/test/java/org/baeldung/gson/deserialization/FooDeserializerFromJsonWithDifferentFields.java b/gson/src/test/java/com/baeldung/gson/deserialization/FooDeserializerFromJsonWithDifferentFields.java similarity index 94% rename from gson/src/test/java/org/baeldung/gson/deserialization/FooDeserializerFromJsonWithDifferentFields.java rename to gson/src/test/java/com/baeldung/gson/deserialization/FooDeserializerFromJsonWithDifferentFields.java index d4eaa39ac5..289f71820c 100644 --- a/gson/src/test/java/org/baeldung/gson/deserialization/FooDeserializerFromJsonWithDifferentFields.java +++ b/gson/src/test/java/com/baeldung/gson/deserialization/FooDeserializerFromJsonWithDifferentFields.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.deserialization; +package com.baeldung.gson.deserialization; import java.lang.reflect.Type; diff --git a/gson/src/test/java/org/baeldung/gson/deserialization/FooInstanceCreator.java b/gson/src/test/java/com/baeldung/gson/deserialization/FooInstanceCreator.java similarity index 84% rename from gson/src/test/java/org/baeldung/gson/deserialization/FooInstanceCreator.java rename to gson/src/test/java/com/baeldung/gson/deserialization/FooInstanceCreator.java index 4df3986ec3..e3ebc09874 100644 --- a/gson/src/test/java/org/baeldung/gson/deserialization/FooInstanceCreator.java +++ b/gson/src/test/java/com/baeldung/gson/deserialization/FooInstanceCreator.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.deserialization; +package com.baeldung.gson.deserialization; import java.lang.reflect.Type; diff --git a/gson/src/test/java/org/baeldung/gson/deserialization/FooWithInner.java b/gson/src/test/java/com/baeldung/gson/deserialization/FooWithInner.java similarity index 92% rename from gson/src/test/java/org/baeldung/gson/deserialization/FooWithInner.java rename to gson/src/test/java/com/baeldung/gson/deserialization/FooWithInner.java index 705e534e77..ddad97b4ab 100644 --- a/gson/src/test/java/org/baeldung/gson/deserialization/FooWithInner.java +++ b/gson/src/test/java/com/baeldung/gson/deserialization/FooWithInner.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.deserialization; +package com.baeldung.gson.deserialization; public class FooWithInner { public int intValue; diff --git a/gson/src/test/java/org/baeldung/gson/deserialization/GenericFoo.java b/gson/src/test/java/com/baeldung/gson/deserialization/GenericFoo.java similarity index 85% rename from gson/src/test/java/org/baeldung/gson/deserialization/GenericFoo.java rename to gson/src/test/java/com/baeldung/gson/deserialization/GenericFoo.java index 954cf007cf..9a81d5ae7a 100644 --- a/gson/src/test/java/org/baeldung/gson/deserialization/GenericFoo.java +++ b/gson/src/test/java/com/baeldung/gson/deserialization/GenericFoo.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.deserialization; +package com.baeldung.gson.deserialization; public class GenericFoo<T> { diff --git a/gson/src/test/java/org/baeldung/gson/deserialization/GsonAlternateUnitTest.java b/gson/src/test/java/com/baeldung/gson/deserialization/GsonAlternateUnitTest.java similarity index 92% rename from gson/src/test/java/org/baeldung/gson/deserialization/GsonAlternateUnitTest.java rename to gson/src/test/java/com/baeldung/gson/deserialization/GsonAlternateUnitTest.java index f3a5d24e3e..c49a1ea568 100644 --- a/gson/src/test/java/org/baeldung/gson/deserialization/GsonAlternateUnitTest.java +++ b/gson/src/test/java/com/baeldung/gson/deserialization/GsonAlternateUnitTest.java @@ -1,8 +1,8 @@ -package org.baeldung.gson.deserialization; +package com.baeldung.gson.deserialization; import static org.junit.Assert.assertEquals; -import org.baeldung.gson.entities.Weather; +import com.baeldung.gson.entities.Weather; import org.junit.Test; import com.google.gson.Gson; diff --git a/gson/src/test/java/org/baeldung/gson/deserialization/GsonDeserializeUnitTest.java b/gson/src/test/java/com/baeldung/gson/deserialization/GsonDeserializeUnitTest.java similarity index 90% rename from gson/src/test/java/org/baeldung/gson/deserialization/GsonDeserializeUnitTest.java rename to gson/src/test/java/com/baeldung/gson/deserialization/GsonDeserializeUnitTest.java index 40e8524744..73e76967b9 100644 --- a/gson/src/test/java/org/baeldung/gson/deserialization/GsonDeserializeUnitTest.java +++ b/gson/src/test/java/com/baeldung/gson/deserialization/GsonDeserializeUnitTest.java @@ -1,10 +1,10 @@ -package org.baeldung.gson.deserialization; +package com.baeldung.gson.deserialization; import java.text.ParseException; -import org.baeldung.gson.entities.ActorGson; -import org.baeldung.gson.entities.Movie; -import org.baeldung.gson.serialization.ActorGsonDeserializer; +import com.baeldung.gson.entities.Movie; +import com.baeldung.gson.serialization.ActorGsonDeserializer; +import com.baeldung.gson.entities.ActorGson; import org.junit.Assert; import org.junit.Test; diff --git a/gson/src/test/java/org/baeldung/gson/deserialization/MapDeserializationUnitTest.java b/gson/src/test/java/com/baeldung/gson/deserialization/MapDeserializationUnitTest.java similarity index 95% rename from gson/src/test/java/org/baeldung/gson/deserialization/MapDeserializationUnitTest.java rename to gson/src/test/java/com/baeldung/gson/deserialization/MapDeserializationUnitTest.java index a5ae4194e8..77c934283a 100644 --- a/gson/src/test/java/org/baeldung/gson/deserialization/MapDeserializationUnitTest.java +++ b/gson/src/test/java/com/baeldung/gson/deserialization/MapDeserializationUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.deserialization; +package com.baeldung.gson.deserialization; import java.lang.reflect.Type; import java.text.ParseException; @@ -6,9 +6,9 @@ import java.util.Date; import java.util.Map; import org.apache.commons.lang3.time.DateUtils; -import org.baeldung.gson.entities.Employee; -import org.baeldung.gson.serialization.MapDeserializer; -import org.baeldung.gson.serialization.StringDateMapDeserializer; +import com.baeldung.gson.entities.Employee; +import com.baeldung.gson.serialization.MapDeserializer; +import com.baeldung.gson.serialization.StringDateMapDeserializer; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; diff --git a/gson/src/test/java/org/baeldung/gson/deserialization/test/GsonDeserializationUnitTest.java b/gson/src/test/java/com/baeldung/gson/deserialization/test/GsonDeserializationUnitTest.java similarity index 93% rename from gson/src/test/java/org/baeldung/gson/deserialization/test/GsonDeserializationUnitTest.java rename to gson/src/test/java/com/baeldung/gson/deserialization/test/GsonDeserializationUnitTest.java index 784bb45a6a..adc046ed8e 100644 --- a/gson/src/test/java/org/baeldung/gson/deserialization/test/GsonDeserializationUnitTest.java +++ b/gson/src/test/java/com/baeldung/gson/deserialization/test/GsonDeserializationUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.deserialization.test; +package com.baeldung.gson.deserialization.test; import static org.hamcrest.Matchers.hasItem; import static org.hamcrest.Matchers.instanceOf; @@ -10,11 +10,11 @@ import java.lang.reflect.Type; import java.util.ArrayList; import java.util.Collection; -import org.baeldung.gson.deserialization.Foo; -import org.baeldung.gson.deserialization.FooDeserializerFromJsonWithDifferentFields; -import org.baeldung.gson.deserialization.FooInstanceCreator; -import org.baeldung.gson.deserialization.FooWithInner; -import org.baeldung.gson.deserialization.GenericFoo; +import com.baeldung.gson.deserialization.Foo; +import com.baeldung.gson.deserialization.FooDeserializerFromJsonWithDifferentFields; +import com.baeldung.gson.deserialization.FooInstanceCreator; +import com.baeldung.gson.deserialization.FooWithInner; +import com.baeldung.gson.deserialization.GenericFoo; import org.junit.Test; import com.google.common.collect.Lists; diff --git a/gson/src/test/java/org/baeldung/gson/primitives/PrimitiveValuesUnitTest.java b/gson/src/test/java/com/baeldung/gson/primitives/PrimitiveValuesUnitTest.java similarity index 99% rename from gson/src/test/java/org/baeldung/gson/primitives/PrimitiveValuesUnitTest.java rename to gson/src/test/java/com/baeldung/gson/primitives/PrimitiveValuesUnitTest.java index 7d249bc55c..e1241fa92a 100644 --- a/gson/src/test/java/org/baeldung/gson/primitives/PrimitiveValuesUnitTest.java +++ b/gson/src/test/java/com/baeldung/gson/primitives/PrimitiveValuesUnitTest.java @@ -1,7 +1,7 @@ -package org.baeldung.gson.primitives; +package com.baeldung.gson.primitives; +import com.baeldung.gson.primitives.models.*; import com.google.gson.*; -import org.baeldung.gson.primitives.models.*; import org.junit.Test; import java.lang.reflect.Type; diff --git a/gson/src/test/java/org/baeldung/gson/serialization/DifferentNameSerializer.java b/gson/src/test/java/com/baeldung/gson/serialization/DifferentNameSerializer.java similarity index 94% rename from gson/src/test/java/org/baeldung/gson/serialization/DifferentNameSerializer.java rename to gson/src/test/java/com/baeldung/gson/serialization/DifferentNameSerializer.java index 9cef1da37b..b82f90f476 100644 --- a/gson/src/test/java/org/baeldung/gson/serialization/DifferentNameSerializer.java +++ b/gson/src/test/java/com/baeldung/gson/serialization/DifferentNameSerializer.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serialization; +package com.baeldung.gson.serialization; import java.lang.reflect.Type; diff --git a/gson/src/test/java/org/baeldung/gson/serialization/GsonSerializeUnitTest.java b/gson/src/test/java/com/baeldung/gson/serialization/GsonSerializeUnitTest.java similarity index 92% rename from gson/src/test/java/org/baeldung/gson/serialization/GsonSerializeUnitTest.java rename to gson/src/test/java/com/baeldung/gson/serialization/GsonSerializeUnitTest.java index 4392ea1631..d5051060c4 100644 --- a/gson/src/test/java/org/baeldung/gson/serialization/GsonSerializeUnitTest.java +++ b/gson/src/test/java/com/baeldung/gson/serialization/GsonSerializeUnitTest.java @@ -1,11 +1,11 @@ -package org.baeldung.gson.serialization; +package com.baeldung.gson.serialization; +import com.baeldung.gson.entities.Movie; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonParser; -import org.baeldung.gson.entities.ActorGson; -import org.baeldung.gson.entities.Movie; -import org.baeldung.gson.entities.MovieWithNullValue; +import com.baeldung.gson.entities.ActorGson; +import com.baeldung.gson.entities.MovieWithNullValue; import org.junit.Assert; import org.junit.Test; diff --git a/gson/src/test/java/org/baeldung/gson/serialization/IgnoringFieldsNotMatchingCriteriaSerializer.java b/gson/src/test/java/com/baeldung/gson/serialization/IgnoringFieldsNotMatchingCriteriaSerializer.java similarity index 95% rename from gson/src/test/java/org/baeldung/gson/serialization/IgnoringFieldsNotMatchingCriteriaSerializer.java rename to gson/src/test/java/com/baeldung/gson/serialization/IgnoringFieldsNotMatchingCriteriaSerializer.java index 769a4d33a7..554d63b29b 100644 --- a/gson/src/test/java/org/baeldung/gson/serialization/IgnoringFieldsNotMatchingCriteriaSerializer.java +++ b/gson/src/test/java/com/baeldung/gson/serialization/IgnoringFieldsNotMatchingCriteriaSerializer.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serialization; +package com.baeldung.gson.serialization; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/gson/src/test/java/org/baeldung/gson/serialization/IgnoringFieldsSerializer.java b/gson/src/test/java/com/baeldung/gson/serialization/IgnoringFieldsSerializer.java similarity index 93% rename from gson/src/test/java/org/baeldung/gson/serialization/IgnoringFieldsSerializer.java rename to gson/src/test/java/com/baeldung/gson/serialization/IgnoringFieldsSerializer.java index bd1928cb18..7f251894a0 100644 --- a/gson/src/test/java/org/baeldung/gson/serialization/IgnoringFieldsSerializer.java +++ b/gson/src/test/java/com/baeldung/gson/serialization/IgnoringFieldsSerializer.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serialization; +package com.baeldung.gson.serialization; import java.lang.reflect.Type; diff --git a/gson/src/test/java/org/baeldung/gson/serialization/SourceClass.java b/gson/src/test/java/com/baeldung/gson/serialization/SourceClass.java similarity index 96% rename from gson/src/test/java/org/baeldung/gson/serialization/SourceClass.java rename to gson/src/test/java/com/baeldung/gson/serialization/SourceClass.java index 02de2636c2..181f1134b5 100644 --- a/gson/src/test/java/org/baeldung/gson/serialization/SourceClass.java +++ b/gson/src/test/java/com/baeldung/gson/serialization/SourceClass.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serialization; +package com.baeldung.gson.serialization; public class SourceClass { private int intValue; diff --git a/gson/src/test/java/org/baeldung/gson/serialization/test/GsonSerializationUnitTest.java b/gson/src/test/java/com/baeldung/gson/serialization/test/GsonSerializationUnitTest.java similarity index 91% rename from gson/src/test/java/org/baeldung/gson/serialization/test/GsonSerializationUnitTest.java rename to gson/src/test/java/com/baeldung/gson/serialization/test/GsonSerializationUnitTest.java index 6806c470b9..4780b8a6bf 100644 --- a/gson/src/test/java/org/baeldung/gson/serialization/test/GsonSerializationUnitTest.java +++ b/gson/src/test/java/com/baeldung/gson/serialization/test/GsonSerializationUnitTest.java @@ -1,18 +1,16 @@ -package org.baeldung.gson.serialization.test; +package com.baeldung.gson.serialization.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.lang.reflect.Type; -import java.util.Calendar; import java.util.Collection; import java.util.Date; -import java.util.GregorianCalendar; -import org.baeldung.gson.serialization.DifferentNameSerializer; -import org.baeldung.gson.serialization.IgnoringFieldsNotMatchingCriteriaSerializer; -import org.baeldung.gson.serialization.IgnoringFieldsSerializer; -import org.baeldung.gson.serialization.SourceClass; +import com.baeldung.gson.serialization.DifferentNameSerializer; +import com.baeldung.gson.serialization.IgnoringFieldsNotMatchingCriteriaSerializer; +import com.baeldung.gson.serialization.IgnoringFieldsSerializer; +import com.baeldung.gson.serialization.SourceClass; import org.joda.time.DateTime; import org.junit.Test; diff --git a/gson/src/test/java/org/baeldung/gson/serialization/test/JsonFileUnitTest.java b/gson/src/test/java/com/baeldung/gson/serialization/test/JsonFileUnitTest.java similarity index 88% rename from gson/src/test/java/org/baeldung/gson/serialization/test/JsonFileUnitTest.java rename to gson/src/test/java/com/baeldung/gson/serialization/test/JsonFileUnitTest.java index f6a8de080c..8e58435520 100644 --- a/gson/src/test/java/org/baeldung/gson/serialization/test/JsonFileUnitTest.java +++ b/gson/src/test/java/com/baeldung/gson/serialization/test/JsonFileUnitTest.java @@ -1,43 +1,43 @@ -package org.baeldung.gson.serialization.test; - -import java.io.FileWriter; -import java.io.IOException; -import java.io.Writer; -import java.nio.file.Files; -import java.nio.file.Paths; - -import org.baeldung.gson.entities.User; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameter; -import org.junit.runners.Parameterized.Parameters; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -@RunWith(Parameterized.class) -public class JsonFileUnitTest { - - @Parameter - public Object object; - - @Parameters - public static Object[] data() { - return new Object[] { 123.45, new User(1, "Tom", "American") }; - } - - @Test - public void givenProperData_whenStoredInFile_shouldSaveJsonSuccessfully() { - String filePath = "target/output.json"; - try (Writer writer = new FileWriter(filePath)) { - Gson gson = new GsonBuilder().setPrettyPrinting().create(); - gson.toJson(object, writer); - Assert.assertTrue(Files.exists(Paths.get(filePath))); - } catch (IOException e) { - e.printStackTrace(); - } - } - -} +package com.baeldung.gson.serialization.test; + +import java.io.FileWriter; +import java.io.IOException; +import java.io.Writer; +import java.nio.file.Files; +import java.nio.file.Paths; + +import com.baeldung.gson.entities.User; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameter; +import org.junit.runners.Parameterized.Parameters; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +@RunWith(Parameterized.class) +public class JsonFileUnitTest { + + @Parameter + public Object object; + + @Parameters + public static Object[] data() { + return new Object[] { 123.45, new User(1, "Tom", "American") }; + } + + @Test + public void givenProperData_whenStoredInFile_shouldSaveJsonSuccessfully() { + String filePath = "target/output.json"; + try (Writer writer = new FileWriter(filePath)) { + Gson gson = new GsonBuilder().setPrettyPrinting().create(); + gson.toJson(object, writer); + Assert.assertTrue(Files.exists(Paths.get(filePath))); + } catch (IOException e) { + e.printStackTrace(); + } + } + +} diff --git a/gson/src/test/java/org/baeldung/gson/serializationwithexclusions/SerializationWithExclusionsUnitTest.java b/gson/src/test/java/com/baeldung/gson/serializationwithexclusions/SerializationWithExclusionsUnitTest.java similarity index 98% rename from gson/src/test/java/org/baeldung/gson/serializationwithexclusions/SerializationWithExclusionsUnitTest.java rename to gson/src/test/java/com/baeldung/gson/serializationwithexclusions/SerializationWithExclusionsUnitTest.java index 632d06946b..d677f0b271 100644 --- a/gson/src/test/java/org/baeldung/gson/serializationwithexclusions/SerializationWithExclusionsUnitTest.java +++ b/gson/src/test/java/com/baeldung/gson/serializationwithexclusions/SerializationWithExclusionsUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serializationwithexclusions; +package com.baeldung.gson.serializationwithexclusions; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/guava-collections-map/pom.xml b/guava-collections-map/pom.xml index 21597d0e28..ee8ceb10f3 100644 --- a/guava-collections-map/pom.xml +++ b/guava-collections-map/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.guava</groupId> <artifactId>guava-collections-map</artifactId> diff --git a/guava-collections-set/pom.xml b/guava-collections-set/pom.xml index 640a28c4c1..8bb0b924f9 100644 --- a/guava-collections-set/pom.xml +++ b/guava-collections-set/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>guava-collections-set</artifactId> <version>0.1.0-SNAPSHOT</version> diff --git a/guava-collections/pom.xml b/guava-collections/pom.xml index 9dfcceaab8..9002ac2b91 100644 --- a/guava-collections/pom.xml +++ b/guava-collections/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>guava-collections</artifactId> <version>0.1.0-SNAPSHOT</version> diff --git a/guava-io/pom.xml b/guava-io/pom.xml index aaaf7edd4e..7517d442b0 100644 --- a/guava-io/pom.xml +++ b/guava-io/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>guava-io</artifactId> <version>0.1.0-SNAPSHOT</version> diff --git a/guava-modules/guava-18/pom.xml b/guava-modules/guava-18/pom.xml index d55aa9ce82..30d9f953ac 100644 --- a/guava-modules/guava-18/pom.xml +++ b/guava-modules/guava-18/pom.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>guava-18</artifactId> <version>0.1.0-SNAPSHOT</version> <name>guava-18</name> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-java</artifactId> diff --git a/guava-modules/guava-19/pom.xml b/guava-modules/guava-19/pom.xml index 0548bb0c1f..0060afd426 100644 --- a/guava-modules/guava-19/pom.xml +++ b/guava-modules/guava-19/pom.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>guava-19</artifactId> <version>0.1.0-SNAPSHOT</version> <name>guava-19</name> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-java</artifactId> diff --git a/guava-modules/guava-21/pom.xml b/guava-modules/guava-21/pom.xml index bdb1058a48..7932cfa6d8 100644 --- a/guava-modules/guava-21/pom.xml +++ b/guava-modules/guava-21/pom.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>guava-21</artifactId> <version>1.0-SNAPSHOT</version> <name>guava-21</name> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-java</artifactId> diff --git a/guava-modules/pom.xml b/guava-modules/pom.xml index fed9e446f7..2b899df162 100644 --- a/guava-modules/pom.xml +++ b/guava-modules/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>guava-modules</artifactId> <name>guava-modules</name> diff --git a/guava/pom.xml b/guava/pom.xml index 4ca9918455..3f07b77b0b 100644 --- a/guava/pom.xml +++ b/guava/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>guava</artifactId> <version>0.1.0-SNAPSHOT</version> diff --git a/guava/src/main/java/org/baeldung/guava/CustomEvent.java b/guava/src/main/java/com/baeldung/guava/CustomEvent.java similarity index 90% rename from guava/src/main/java/org/baeldung/guava/CustomEvent.java rename to guava/src/main/java/com/baeldung/guava/CustomEvent.java index 8534d7da1c..a154790374 100644 --- a/guava/src/main/java/org/baeldung/guava/CustomEvent.java +++ b/guava/src/main/java/com/baeldung/guava/CustomEvent.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; public class CustomEvent { private String action; diff --git a/guava/src/main/java/org/baeldung/guava/EventListener.java b/guava/src/main/java/com/baeldung/guava/EventListener.java similarity index 97% rename from guava/src/main/java/org/baeldung/guava/EventListener.java rename to guava/src/main/java/com/baeldung/guava/EventListener.java index 60beebeea5..7bcfbcb8e9 100644 --- a/guava/src/main/java/org/baeldung/guava/EventListener.java +++ b/guava/src/main/java/com/baeldung/guava/EventListener.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import com.google.common.eventbus.DeadEvent; import com.google.common.eventbus.Subscribe; diff --git a/guava/src/main/java/org/baeldung/guava/memoizer/CostlySupplier.java b/guava/src/main/java/com/baeldung/guava/memoizer/CostlySupplier.java similarity index 89% rename from guava/src/main/java/org/baeldung/guava/memoizer/CostlySupplier.java rename to guava/src/main/java/com/baeldung/guava/memoizer/CostlySupplier.java index 63b3fbd438..9a929a15bd 100644 --- a/guava/src/main/java/org/baeldung/guava/memoizer/CostlySupplier.java +++ b/guava/src/main/java/com/baeldung/guava/memoizer/CostlySupplier.java @@ -1,4 +1,4 @@ -package org.baeldung.guava.memoizer; +package com.baeldung.guava.memoizer; import java.math.BigInteger; import java.util.Random; diff --git a/guava/src/main/java/org/baeldung/guava/memoizer/Factorial.java b/guava/src/main/java/com/baeldung/guava/memoizer/Factorial.java similarity index 93% rename from guava/src/main/java/org/baeldung/guava/memoizer/Factorial.java rename to guava/src/main/java/com/baeldung/guava/memoizer/Factorial.java index 74fcbdcc14..6497979682 100644 --- a/guava/src/main/java/org/baeldung/guava/memoizer/Factorial.java +++ b/guava/src/main/java/com/baeldung/guava/memoizer/Factorial.java @@ -1,4 +1,4 @@ -package org.baeldung.guava.memoizer; +package com.baeldung.guava.memoizer; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; diff --git a/guava/src/main/java/org/baeldung/guava/memoizer/FibonacciSequence.java b/guava/src/main/java/com/baeldung/guava/memoizer/FibonacciSequence.java similarity index 90% rename from guava/src/main/java/org/baeldung/guava/memoizer/FibonacciSequence.java rename to guava/src/main/java/com/baeldung/guava/memoizer/FibonacciSequence.java index 0c70f08c23..d0462fb001 100644 --- a/guava/src/main/java/org/baeldung/guava/memoizer/FibonacciSequence.java +++ b/guava/src/main/java/com/baeldung/guava/memoizer/FibonacciSequence.java @@ -1,11 +1,10 @@ -package org.baeldung.guava.memoizer; +package com.baeldung.guava.memoizer; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; import java.math.BigInteger; -import java.util.concurrent.TimeUnit; public class FibonacciSequence { diff --git a/guava/src/test/java/org/baeldung/guava/BloomFilterUnitTest.java b/guava/src/test/java/com/baeldung/guava/BloomFilterUnitTest.java similarity index 98% rename from guava/src/test/java/org/baeldung/guava/BloomFilterUnitTest.java rename to guava/src/test/java/com/baeldung/guava/BloomFilterUnitTest.java index ff3031a0cb..c11bf27256 100644 --- a/guava/src/test/java/org/baeldung/guava/BloomFilterUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/BloomFilterUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import com.google.common.hash.BloomFilter; diff --git a/guava/src/test/java/org/baeldung/guava/GuavaBigIntegerMathUnitTest.java b/guava/src/test/java/com/baeldung/guava/GuavaBigIntegerMathUnitTest.java similarity index 99% rename from guava/src/test/java/org/baeldung/guava/GuavaBigIntegerMathUnitTest.java rename to guava/src/test/java/com/baeldung/guava/GuavaBigIntegerMathUnitTest.java index f5afe20fc2..cca42a688f 100644 --- a/guava/src/test/java/org/baeldung/guava/GuavaBigIntegerMathUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/GuavaBigIntegerMathUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; diff --git a/guava/src/test/java/org/baeldung/guava/GuavaCacheLoaderUnitTest.java b/guava/src/test/java/com/baeldung/guava/GuavaCacheLoaderUnitTest.java similarity index 98% rename from guava/src/test/java/org/baeldung/guava/GuavaCacheLoaderUnitTest.java rename to guava/src/test/java/com/baeldung/guava/GuavaCacheLoaderUnitTest.java index e27171bb84..bf9747ec18 100644 --- a/guava/src/test/java/org/baeldung/guava/GuavaCacheLoaderUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/GuavaCacheLoaderUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; diff --git a/guava/src/test/java/org/baeldung/guava/GuavaCacheUnitTest.java b/guava/src/test/java/com/baeldung/guava/GuavaCacheUnitTest.java similarity index 99% rename from guava/src/test/java/org/baeldung/guava/GuavaCacheUnitTest.java rename to guava/src/test/java/com/baeldung/guava/GuavaCacheUnitTest.java index 49ce6b1a09..8aa56c7c52 100644 --- a/guava/src/test/java/org/baeldung/guava/GuavaCacheUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/GuavaCacheUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; diff --git a/guava/src/test/java/org/baeldung/guava/GuavaDoubleMathUnitTest.java b/guava/src/test/java/com/baeldung/guava/GuavaDoubleMathUnitTest.java similarity index 99% rename from guava/src/test/java/org/baeldung/guava/GuavaDoubleMathUnitTest.java rename to guava/src/test/java/com/baeldung/guava/GuavaDoubleMathUnitTest.java index b39770e2e7..9c78fb36fa 100644 --- a/guava/src/test/java/org/baeldung/guava/GuavaDoubleMathUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/GuavaDoubleMathUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import static org.junit.Assert.*; diff --git a/guava/src/test/java/org/baeldung/guava/GuavaEventBusUnitTest.java b/guava/src/test/java/com/baeldung/guava/GuavaEventBusUnitTest.java similarity index 97% rename from guava/src/test/java/org/baeldung/guava/GuavaEventBusUnitTest.java rename to guava/src/test/java/com/baeldung/guava/GuavaEventBusUnitTest.java index 1bc62af300..bb9d26fcce 100644 --- a/guava/src/test/java/org/baeldung/guava/GuavaEventBusUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/GuavaEventBusUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import com.google.common.eventbus.EventBus; import org.junit.After; diff --git a/guava/src/test/java/org/baeldung/guava/GuavaFunctionalExamplesUnitTest.java b/guava/src/test/java/com/baeldung/guava/GuavaFunctionalExamplesUnitTest.java similarity index 99% rename from guava/src/test/java/org/baeldung/guava/GuavaFunctionalExamplesUnitTest.java rename to guava/src/test/java/com/baeldung/guava/GuavaFunctionalExamplesUnitTest.java index c09ae696b3..b54a7c951a 100644 --- a/guava/src/test/java/org/baeldung/guava/GuavaFunctionalExamplesUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/GuavaFunctionalExamplesUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.equalTo; diff --git a/guava/src/test/java/org/baeldung/guava/GuavaIntMathUnitTest.java b/guava/src/test/java/com/baeldung/guava/GuavaIntMathUnitTest.java similarity index 99% rename from guava/src/test/java/org/baeldung/guava/GuavaIntMathUnitTest.java rename to guava/src/test/java/com/baeldung/guava/GuavaIntMathUnitTest.java index 9270212929..547f423396 100644 --- a/guava/src/test/java/org/baeldung/guava/GuavaIntMathUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/GuavaIntMathUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import static org.junit.Assert.*; diff --git a/guava/src/test/java/org/baeldung/guava/GuavaLongMathUnitTest.java b/guava/src/test/java/com/baeldung/guava/GuavaLongMathUnitTest.java similarity index 99% rename from guava/src/test/java/org/baeldung/guava/GuavaLongMathUnitTest.java rename to guava/src/test/java/com/baeldung/guava/GuavaLongMathUnitTest.java index 680f405149..33c28d4594 100644 --- a/guava/src/test/java/org/baeldung/guava/GuavaLongMathUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/GuavaLongMathUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import static org.junit.Assert.*; diff --git a/guava/src/test/java/org/baeldung/guava/GuavaMathUnitTest.java b/guava/src/test/java/com/baeldung/guava/GuavaMathUnitTest.java similarity index 99% rename from guava/src/test/java/org/baeldung/guava/GuavaMathUnitTest.java rename to guava/src/test/java/com/baeldung/guava/GuavaMathUnitTest.java index 1e1f806628..fce0fec13b 100644 --- a/guava/src/test/java/org/baeldung/guava/GuavaMathUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/GuavaMathUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import static org.hamcrest.core.IsEqual.equalTo; import static org.junit.Assert.*; diff --git a/guava/src/test/java/org/baeldung/guava/GuavaMemoizerUnitTest.java b/guava/src/test/java/com/baeldung/guava/GuavaMemoizerUnitTest.java similarity index 94% rename from guava/src/test/java/org/baeldung/guava/GuavaMemoizerUnitTest.java rename to guava/src/test/java/com/baeldung/guava/GuavaMemoizerUnitTest.java index 8c37ecf07c..9bafb7ad3f 100644 --- a/guava/src/test/java/org/baeldung/guava/GuavaMemoizerUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/GuavaMemoizerUnitTest.java @@ -1,9 +1,9 @@ -package org.baeldung.guava; +package com.baeldung.guava; import com.google.common.base.Suppliers; -import org.baeldung.guava.memoizer.CostlySupplier; -import org.baeldung.guava.memoizer.Factorial; -import org.baeldung.guava.memoizer.FibonacciSequence; +import com.baeldung.guava.memoizer.CostlySupplier; +import com.baeldung.guava.memoizer.Factorial; +import com.baeldung.guava.memoizer.FibonacciSequence; import org.junit.Test; import java.math.BigInteger; diff --git a/guava/src/test/java/org/baeldung/guava/GuavaPreConditionsUnitTest.java b/guava/src/test/java/com/baeldung/guava/GuavaPreConditionsUnitTest.java similarity index 99% rename from guava/src/test/java/org/baeldung/guava/GuavaPreConditionsUnitTest.java rename to guava/src/test/java/com/baeldung/guava/GuavaPreConditionsUnitTest.java index 6bf9e5c7a2..fe3be9abf0 100644 --- a/guava/src/test/java/org/baeldung/guava/GuavaPreConditionsUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/GuavaPreConditionsUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import static org.assertj.core.api.Assertions.assertThatThrownBy; import java.util.Arrays; diff --git a/guava/src/test/java/org/baeldung/guava/GuavaReflectionUtilsUnitTest.java b/guava/src/test/java/com/baeldung/guava/GuavaReflectionUtilsUnitTest.java similarity index 99% rename from guava/src/test/java/org/baeldung/guava/GuavaReflectionUtilsUnitTest.java rename to guava/src/test/java/com/baeldung/guava/GuavaReflectionUtilsUnitTest.java index f2d1c08ae9..36df241711 100644 --- a/guava/src/test/java/org/baeldung/guava/GuavaReflectionUtilsUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/GuavaReflectionUtilsUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import com.google.common.collect.Lists; diff --git a/guava/src/test/java/org/baeldung/guava/RateLimiterLongRunningUnitTest.java b/guava/src/test/java/com/baeldung/guava/RateLimiterLongRunningUnitTest.java similarity index 98% rename from guava/src/test/java/org/baeldung/guava/RateLimiterLongRunningUnitTest.java rename to guava/src/test/java/com/baeldung/guava/RateLimiterLongRunningUnitTest.java index 914de01a6d..7372e9f6e9 100644 --- a/guava/src/test/java/org/baeldung/guava/RateLimiterLongRunningUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/RateLimiterLongRunningUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import com.google.common.util.concurrent.RateLimiter; diff --git a/guest/core-java-9/pom.xml b/guest/core-java-9/pom.xml index 3847c19d16..786f85ce86 100644 --- a/guest/core-java-9/pom.xml +++ b/guest/core-java-9/pom.xml @@ -1,11 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.stackify</groupId> <artifactId>core-java-9</artifactId> <version>0.0.1-SNAPSHOT</version> - <name>core-java-9</name> - + <name>core-java-9</name> + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> diff --git a/guest/core-java/pom.xml b/guest/core-java/pom.xml index 5057f7eaed..aaf67fd27e 100644 --- a/guest/core-java/pom.xml +++ b/guest/core-java/pom.xml @@ -1,10 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.stackify</groupId> <artifactId>core-java</artifactId> <version>0.0.1-SNAPSHOT</version> - <name>core-java</name> + <name>core-java</name> <parent> <groupId>com.baeldung</groupId> diff --git a/guest/core-kotlin/pom.xml b/guest/core-kotlin/pom.xml index a57dd28ffd..2d4a0c6144 100644 --- a/guest/core-kotlin/pom.xml +++ b/guest/core-kotlin/pom.xml @@ -2,12 +2,12 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> + <groupId>com.stackify</groupId> <artifactId>core-kotlin</artifactId> <version>1.0-SNAPSHOT</version> - <groupId>com.stackify</groupId> + <name>core-kotlin</name> <packaging>jar</packaging> - <name>core-kotlin</name> - + <repositories> <repository> <id>jcenter</id> diff --git a/guest/deep-jsf/pom.xml b/guest/deep-jsf/pom.xml index 12426a8833..91cf567e73 100644 --- a/guest/deep-jsf/pom.xml +++ b/guest/deep-jsf/pom.xml @@ -1,28 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.stackify</groupId> <artifactId>deep-jsf</artifactId> <version>0.0.1-SNAPSHOT</version> <name>deep-jsf</name> <packaging>war</packaging> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> <relativePath>../../</relativePath> </parent> - - <dependencies> + <dependencies> <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>${javaee-api.version}</version> <scope>provided</scope> </dependency> - </dependencies> <build> diff --git a/guest/junit5-example/pom.xml b/guest/junit5-example/pom.xml index c6370941d1..05e320f96d 100644 --- a/guest/junit5-example/pom.xml +++ b/guest/junit5-example/pom.xml @@ -1,11 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>junit5-example</groupId> <artifactId>junit5-example</artifactId> <version>0.0.1-SNAPSHOT</version> <name>junit5-example</name> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> diff --git a/guest/log4j2-example/pom.xml b/guest/log4j2-example/pom.xml index 31a32a4562..a3284dbfe3 100644 --- a/guest/log4j2-example/pom.xml +++ b/guest/log4j2-example/pom.xml @@ -1,11 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>log4j2-example</groupId> <artifactId>log4j2-example</artifactId> <version>0.0.1-SNAPSHOT</version> <name>log4j2-example</name> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> diff --git a/guest/logback-example/pom.xml b/guest/logback-example/pom.xml index 6e9fe0ddea..e7e83c743f 100644 --- a/guest/logback-example/pom.xml +++ b/guest/logback-example/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -5,14 +6,14 @@ <artifactId>logback-example</artifactId> <version>0.0.1-SNAPSHOT</version> <name>logback-example</name> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> <relativePath>../../</relativePath> </parent> - + <dependencies> <dependency> <groupId>org.codehaus.janino</groupId> @@ -20,7 +21,7 @@ <version>${janino.version}</version> </dependency> </dependencies> - + <properties> <janino.version>3.0.7</janino.version> </properties> diff --git a/guest/memory-leaks/pom.xml b/guest/memory-leaks/pom.xml index f1d411acbc..0712e0627d 100644 --- a/guest/memory-leaks/pom.xml +++ b/guest/memory-leaks/pom.xml @@ -1,10 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>memory-leaks</artifactId> <version>0.0.1-SNAPSHOT</version> <name>memory-leaks</name> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> diff --git a/guest/remote-debugging/pom.xml b/guest/remote-debugging/pom.xml index 07b9cc49d8..4541160e37 100644 --- a/guest/remote-debugging/pom.xml +++ b/guest/remote-debugging/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.stackify</groupId> <artifactId>remote-debugging</artifactId> @@ -12,7 +12,7 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.8.RELEASE</version> - <relativePath /> <!-- lookup parent from repository --> + <relativePath/> <!-- lookup parent from repository --> </parent> <dependencies> diff --git a/guest/slf4j/guide/pom.xml b/guest/slf4j/guide/pom.xml index 657ede73b6..8b479a4ba7 100644 --- a/guest/slf4j/guide/pom.xml +++ b/guest/slf4j/guide/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.stackify.slf4j.guide</groupId> <artifactId>slf4j-parent-module</artifactId> @@ -44,7 +44,6 @@ </dependency> </dependencies> - <build> <plugins> <plugin> diff --git a/guest/slf4j/guide/slf4j-log4j/pom.xml b/guest/slf4j/guide/slf4j-log4j/pom.xml index bca5392f4d..70b93d8ab4 100644 --- a/guest/slf4j/guide/slf4j-log4j/pom.xml +++ b/guest/slf4j/guide/slf4j-log4j/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>slf4j-log4j</artifactId> <version>0.0.1-SNAPSHOT</version> @@ -35,6 +35,7 @@ <scope>test</scope> </dependency> </dependencies> + <properties> <slf4j.log4j.version>1.7.25</slf4j.log4j.version> </properties> diff --git a/guest/slf4j/guide/slf4j-log4j2/pom.xml b/guest/slf4j/guide/slf4j-log4j2/pom.xml index 9473362cb8..93a8d9e974 100644 --- a/guest/slf4j/guide/slf4j-log4j2/pom.xml +++ b/guest/slf4j/guide/slf4j-log4j2/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>slf4j-log4j2</artifactId> <version>0.0.1-SNAPSHOT</version> diff --git a/guest/slf4j/guide/slf4j-logback/pom.xml b/guest/slf4j/guide/slf4j-logback/pom.xml index 0327e79732..74f4470bad 100644 --- a/guest/slf4j/guide/slf4j-logback/pom.xml +++ b/guest/slf4j/guide/slf4j-logback/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>slf4j-logback</artifactId> <version>0.0.1-SNAPSHOT</version> diff --git a/guest/spring-boot-app/pom.xml b/guest/spring-boot-app/pom.xml index 423dadbb99..6f9c8e8aa9 100644 --- a/guest/spring-boot-app/pom.xml +++ b/guest/spring-boot-app/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>spring-boot-app</groupId> <artifactId>spring-boot-app</artifactId> diff --git a/guest/spring-mvc/pom.xml b/guest/spring-mvc/pom.xml index 3bffb1530d..df08fa0595 100644 --- a/guest/spring-mvc/pom.xml +++ b/guest/spring-mvc/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.stackify.guest</groupId> <artifactId>spring-mvc</artifactId> @@ -13,7 +13,7 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.0.RELEASE</version> - <relativePath /> <!-- lookup parent from repository --> + <relativePath/> <!-- lookup parent from repository --> </parent> <dependencies> diff --git a/guest/spring-security/pom.xml b/guest/spring-security/pom.xml index 8be42ba32b..2ac8935c3c 100644 --- a/guest/spring-security/pom.xml +++ b/guest/spring-security/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.stackify.guest</groupId> <artifactId>spring-security</artifactId> @@ -12,7 +12,7 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.0.RELEASE</version> - <relativePath /> + <relativePath/> </parent> <dependencies> diff --git a/guest/thread-pools/pom.xml b/guest/thread-pools/pom.xml index 2591cb2746..26809fccd8 100644 --- a/guest/thread-pools/pom.xml +++ b/guest/thread-pools/pom.xml @@ -1,11 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.stackify</groupId> <artifactId>thread-pools</artifactId> <version>0.0.1-SNAPSHOT</version> <name>thread-pools</name> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> diff --git a/guest/tomcat-app/pom.xml b/guest/tomcat-app/pom.xml index ab18023f70..acdecc445c 100644 --- a/guest/tomcat-app/pom.xml +++ b/guest/tomcat-app/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.stackify</groupId> <artifactId>tomcat-app</artifactId> diff --git a/guest/webservices/rest-client/pom.xml b/guest/webservices/rest-client/pom.xml index 8508186e86..b05e435c4c 100644 --- a/guest/webservices/rest-client/pom.xml +++ b/guest/webservices/rest-client/pom.xml @@ -1,4 +1,6 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.stackify</groupId> <artifactId>rest-client</artifactId> diff --git a/guest/webservices/rest-server/pom.xml b/guest/webservices/rest-server/pom.xml index c576924215..ca81979b1e 100644 --- a/guest/webservices/rest-server/pom.xml +++ b/guest/webservices/rest-server/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.stackify</groupId> <artifactId>rest-server</artifactId> diff --git a/guest/webservices/spring-rest-service/pom.xml b/guest/webservices/spring-rest-service/pom.xml index fcec8a3e12..6243f09727 100644 --- a/guest/webservices/spring-rest-service/pom.xml +++ b/guest/webservices/spring-rest-service/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.stackify</groupId> <artifactId>spring-rest-service</artifactId> diff --git a/guice/pom.xml b/guice/pom.xml index 8ed2b557dc..d119bbf78e 100644 --- a/guice/pom.xml +++ b/guice/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.examples.guice</groupId> <artifactId>guice</artifactId> diff --git a/hazelcast/pom.xml b/hazelcast/pom.xml index 9e0b0671d0..10234bb81f 100644 --- a/hazelcast/pom.xml +++ b/hazelcast/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>hazelcast</artifactId> <version>0.0.1-SNAPSHOT</version> @@ -13,11 +14,11 @@ <dependencies> <!-- Hazelcast Jet --> - <dependency> - <groupId>com.hazelcast.jet</groupId> - <artifactId>hazelcast-jet</artifactId> - <version>${hazelcast.jet.version}</version> - </dependency> + <dependency> + <groupId>com.hazelcast.jet</groupId> + <artifactId>hazelcast-jet</artifactId> + <version>${hazelcast.jet.version}</version> + </dependency> </dependencies> <build> diff --git a/helidon/helidon-mp/pom.xml b/helidon/helidon-mp/pom.xml index 82d52ca2ef..38187a5cb8 100644 --- a/helidon/helidon-mp/pom.xml +++ b/helidon/helidon-mp/pom.xml @@ -4,13 +4,13 @@ <modelVersion>4.0.0</modelVersion> <artifactId>helidon-mp</artifactId> <name>helidon-mp</name> - - <parent> + + <parent> <groupId>com.baeldung.helidon</groupId> <artifactId>helidon</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> - + <dependencies> <dependency> <groupId>io.helidon.microprofile.bundles</groupId> diff --git a/helidon/helidon-se/pom.xml b/helidon/helidon-se/pom.xml index ae16fa16e4..d5592dfb7b 100644 --- a/helidon/helidon-se/pom.xml +++ b/helidon/helidon-se/pom.xml @@ -5,7 +5,7 @@ <modelVersion>4.0.0</modelVersion> <artifactId>helidon-se</artifactId> <name>helidon-se</name> - + <parent> <groupId>com.baeldung.helidon</groupId> <artifactId>helidon</artifactId> @@ -54,7 +54,6 @@ <artifactId>helidon-security-integration-webserver</artifactId> <version>${helidon.version}</version> </dependency> - </dependencies> <properties> diff --git a/httpclient-simple/pom.xml b/httpclient-simple/pom.xml index 183c4438de..4b97070307 100644 --- a/httpclient-simple/pom.xml +++ b/httpclient-simple/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>httpclient-simple</artifactId> <version>0.1-SNAPSHOT</version> diff --git a/httpclient/pom.xml b/httpclient/pom.xml index 6316ee4eed..606e9ed793 100644 --- a/httpclient/pom.xml +++ b/httpclient/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>httpclient</artifactId> <version>0.1-SNAPSHOT</version> diff --git a/httpclient/src/test/java/org/baeldung/httpclient/HttpAsyncClientLiveTest.java b/httpclient/src/test/java/com/baeldung/httpclient/HttpAsyncClientLiveTest.java similarity index 99% rename from httpclient/src/test/java/org/baeldung/httpclient/HttpAsyncClientLiveTest.java rename to httpclient/src/test/java/com/baeldung/httpclient/HttpAsyncClientLiveTest.java index 47a587885e..082c282306 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/HttpAsyncClientLiveTest.java +++ b/httpclient/src/test/java/com/baeldung/httpclient/HttpAsyncClientLiveTest.java @@ -1,4 +1,4 @@ -package org.baeldung.httpclient; +package com.baeldung.httpclient; import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertThat; diff --git a/httpclient/src/test/java/org/baeldung/httpclient/HttpClientMultipartLiveTest.java b/httpclient/src/test/java/com/baeldung/httpclient/HttpClientMultipartLiveTest.java similarity index 94% rename from httpclient/src/test/java/org/baeldung/httpclient/HttpClientMultipartLiveTest.java rename to httpclient/src/test/java/com/baeldung/httpclient/HttpClientMultipartLiveTest.java index 9912e73c2b..7576e49034 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/HttpClientMultipartLiveTest.java +++ b/httpclient/src/test/java/com/baeldung/httpclient/HttpClientMultipartLiveTest.java @@ -1,4 +1,4 @@ -package org.baeldung.httpclient; +package com.baeldung.httpclient; import org.apache.http.HttpEntity; import org.apache.http.HttpStatus; @@ -34,11 +34,11 @@ public class HttpClientMultipartLiveTest { // No longer available // private static final String SERVER = "http://echo.200please.com"; - private static final String SERVER = "http://posttestserver.com/post.php"; + private static final String SERVER = "http://localhost:8080/spring-mvc-java/stub/multipart"; private static final String TEXTFILENAME = "temp.txt"; private static final String IMAGEFILENAME = "image.jpg"; private static final String ZIPFILENAME = "zipFile.zip"; - private static final Logger LOGGER = Logger.getLogger("org.baeldung.httpclient.HttpClientMultipartLiveTest"); + private static final Logger LOGGER = Logger.getLogger("com.baeldung.httpclient.HttpClientMultipartLiveTest"); private CloseableHttpClient client; private HttpPost post; private BufferedReader rd; @@ -84,7 +84,7 @@ public class HttpClientMultipartLiveTest { // final MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); - builder.addPart("upfile", fileBody); + builder.addPart("file", fileBody); builder.addPart("text1", stringBody1); builder.addPart("text2", stringBody2); final HttpEntity entity = builder.build(); @@ -112,7 +112,7 @@ public class HttpClientMultipartLiveTest { final String message = "This is a multipart post"; final MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); - builder.addBinaryBody("upfile", file, ContentType.DEFAULT_BINARY, TEXTFILENAME); + builder.addBinaryBody("file", file, ContentType.DEFAULT_BINARY, TEXTFILENAME); builder.addTextBody("text", message, ContentType.DEFAULT_BINARY); final HttpEntity entity = builder.build(); post.setEntity(entity); @@ -141,7 +141,7 @@ public class HttpClientMultipartLiveTest { final String message = "This is a multipart post"; final MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); - builder.addBinaryBody("upfile", file, ContentType.DEFAULT_BINARY, IMAGEFILENAME); + builder.addBinaryBody("file", file, ContentType.DEFAULT_BINARY, IMAGEFILENAME); builder.addBinaryBody("upstream", inputStream, ContentType.create("application/zip"), ZIPFILENAME); builder.addTextBody("text", message, ContentType.TEXT_PLAIN); final HttpEntity entity = builder.build(); @@ -165,7 +165,7 @@ public class HttpClientMultipartLiveTest { final byte[] bytes = "binary code".getBytes(); final MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); - builder.addBinaryBody("upfile", bytes, ContentType.DEFAULT_BINARY, TEXTFILENAME); + builder.addBinaryBody("file", bytes, ContentType.DEFAULT_BINARY, TEXTFILENAME); builder.addTextBody("text", message, ContentType.TEXT_PLAIN); final HttpEntity entity = builder.build(); post.setEntity(entity); diff --git a/httpclient/src/test/java/org/baeldung/httpclient/HttpClientRedirectLiveTest.java b/httpclient/src/test/java/com/baeldung/httpclient/HttpClientRedirectLiveTest.java similarity index 99% rename from httpclient/src/test/java/org/baeldung/httpclient/HttpClientRedirectLiveTest.java rename to httpclient/src/test/java/com/baeldung/httpclient/HttpClientRedirectLiveTest.java index a501367a6b..9a03ab02a5 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/HttpClientRedirectLiveTest.java +++ b/httpclient/src/test/java/com/baeldung/httpclient/HttpClientRedirectLiveTest.java @@ -1,4 +1,4 @@ -package org.baeldung.httpclient; +package com.baeldung.httpclient; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; diff --git a/httpclient/src/test/java/org/baeldung/httpclient/ResponseUtil.java b/httpclient/src/test/java/com/baeldung/httpclient/ResponseUtil.java similarity index 94% rename from httpclient/src/test/java/org/baeldung/httpclient/ResponseUtil.java rename to httpclient/src/test/java/com/baeldung/httpclient/ResponseUtil.java index fd38b95cbe..e9ea08a723 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/ResponseUtil.java +++ b/httpclient/src/test/java/com/baeldung/httpclient/ResponseUtil.java @@ -1,4 +1,4 @@ -package org.baeldung.httpclient; +package com.baeldung.httpclient; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; diff --git a/httpclient/src/test/java/org/baeldung/httpclient/advancedconfig/HttpClientAdvancedConfigurationIntegrationTest.java b/httpclient/src/test/java/com/baeldung/httpclient/advancedconfig/HttpClientAdvancedConfigurationIntegrationTest.java similarity index 99% rename from httpclient/src/test/java/org/baeldung/httpclient/advancedconfig/HttpClientAdvancedConfigurationIntegrationTest.java rename to httpclient/src/test/java/com/baeldung/httpclient/advancedconfig/HttpClientAdvancedConfigurationIntegrationTest.java index 77d5a298c1..2235d0e9d0 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/advancedconfig/HttpClientAdvancedConfigurationIntegrationTest.java +++ b/httpclient/src/test/java/com/baeldung/httpclient/advancedconfig/HttpClientAdvancedConfigurationIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.httpclient.advancedconfig; +package com.baeldung.httpclient.advancedconfig; import com.github.tomakehurst.wiremock.junit.WireMockRule; diff --git a/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientBasicPostLiveTest.java b/httpclient/src/test/java/com/baeldung/httpclient/base/HttpClientBasicPostLiveTest.java similarity index 95% rename from httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientBasicPostLiveTest.java rename to httpclient/src/test/java/com/baeldung/httpclient/base/HttpClientBasicPostLiveTest.java index fe275be082..9d4573084b 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientBasicPostLiveTest.java +++ b/httpclient/src/test/java/com/baeldung/httpclient/base/HttpClientBasicPostLiveTest.java @@ -1,5 +1,6 @@ -package org.baeldung.httpclient.base; +package com.baeldung.httpclient.base; +import com.baeldung.httpclient.ResponseUtil; import org.apache.http.auth.AuthenticationException; import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.client.methods.CloseableHttpResponse; @@ -8,7 +9,6 @@ import org.apache.http.entity.StringEntity; import org.apache.http.impl.auth.BasicScheme; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; -import org.baeldung.httpclient.ResponseUtil; import org.junit.After; import org.junit.Before; import org.junit.Test; diff --git a/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientLiveTest.java b/httpclient/src/test/java/com/baeldung/httpclient/base/HttpClientLiveTest.java similarity index 97% rename from httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientLiveTest.java rename to httpclient/src/test/java/com/baeldung/httpclient/base/HttpClientLiveTest.java index 78097227e7..ef12c37412 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientLiveTest.java +++ b/httpclient/src/test/java/com/baeldung/httpclient/base/HttpClientLiveTest.java @@ -1,5 +1,6 @@ -package org.baeldung.httpclient.base; +package com.baeldung.httpclient.base; +import com.baeldung.httpclient.ResponseUtil; import org.apache.http.Header; import org.apache.http.HttpEntity; import org.apache.http.HttpHeaders; @@ -11,7 +12,6 @@ import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.BasicHttpClientConnectionManager; -import org.baeldung.httpclient.ResponseUtil; import org.junit.After; import org.junit.Before; import org.junit.Test; diff --git a/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientSandboxLiveTest.java b/httpclient/src/test/java/com/baeldung/httpclient/base/HttpClientSandboxLiveTest.java similarity index 94% rename from httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientSandboxLiveTest.java rename to httpclient/src/test/java/com/baeldung/httpclient/base/HttpClientSandboxLiveTest.java index d945d075f2..c667ae36f6 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientSandboxLiveTest.java +++ b/httpclient/src/test/java/com/baeldung/httpclient/base/HttpClientSandboxLiveTest.java @@ -1,5 +1,6 @@ -package org.baeldung.httpclient.base; +package com.baeldung.httpclient.base; +import com.baeldung.httpclient.ResponseUtil; import org.apache.http.auth.AuthScope; import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.client.CredentialsProvider; @@ -8,7 +9,6 @@ import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; -import org.baeldung.httpclient.ResponseUtil; import org.junit.Test; import java.io.IOException; diff --git a/httpclient/src/test/java/org/baeldung/httpclient/conn/HttpClientConnectionManagementLiveTest.java b/httpclient/src/test/java/com/baeldung/httpclient/conn/HttpClientConnectionManagementLiveTest.java similarity index 99% rename from httpclient/src/test/java/org/baeldung/httpclient/conn/HttpClientConnectionManagementLiveTest.java rename to httpclient/src/test/java/com/baeldung/httpclient/conn/HttpClientConnectionManagementLiveTest.java index cf945098db..823b506113 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/conn/HttpClientConnectionManagementLiveTest.java +++ b/httpclient/src/test/java/com/baeldung/httpclient/conn/HttpClientConnectionManagementLiveTest.java @@ -1,4 +1,4 @@ -package org.baeldung.httpclient.conn; +package com.baeldung.httpclient.conn; import org.apache.http.HeaderElement; import org.apache.http.HeaderElementIterator; diff --git a/httpclient/src/test/java/org/baeldung/httpclient/conn/IdleConnectionMonitorThread.java b/httpclient/src/test/java/com/baeldung/httpclient/conn/IdleConnectionMonitorThread.java similarity index 96% rename from httpclient/src/test/java/org/baeldung/httpclient/conn/IdleConnectionMonitorThread.java rename to httpclient/src/test/java/com/baeldung/httpclient/conn/IdleConnectionMonitorThread.java index ffe4155a78..f1d7cbc427 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/conn/IdleConnectionMonitorThread.java +++ b/httpclient/src/test/java/com/baeldung/httpclient/conn/IdleConnectionMonitorThread.java @@ -1,4 +1,4 @@ -package org.baeldung.httpclient.conn; +package com.baeldung.httpclient.conn; import java.util.concurrent.TimeUnit; diff --git a/httpclient/src/test/java/org/baeldung/httpclient/conn/MultiHttpClientConnThread.java b/httpclient/src/test/java/com/baeldung/httpclient/conn/MultiHttpClientConnThread.java similarity index 98% rename from httpclient/src/test/java/org/baeldung/httpclient/conn/MultiHttpClientConnThread.java rename to httpclient/src/test/java/com/baeldung/httpclient/conn/MultiHttpClientConnThread.java index 3794943f02..acadd1f240 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/conn/MultiHttpClientConnThread.java +++ b/httpclient/src/test/java/com/baeldung/httpclient/conn/MultiHttpClientConnThread.java @@ -1,4 +1,4 @@ -package org.baeldung.httpclient.conn; +package com.baeldung.httpclient.conn; import java.io.IOException; diff --git a/httpclient/src/test/java/org/baeldung/httpclient/conn/TesterVersion_MultiHttpClientConnThread.java b/httpclient/src/test/java/com/baeldung/httpclient/conn/TesterVersion_MultiHttpClientConnThread.java similarity index 97% rename from httpclient/src/test/java/org/baeldung/httpclient/conn/TesterVersion_MultiHttpClientConnThread.java rename to httpclient/src/test/java/com/baeldung/httpclient/conn/TesterVersion_MultiHttpClientConnThread.java index 9cc6480e74..a50858672e 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/conn/TesterVersion_MultiHttpClientConnThread.java +++ b/httpclient/src/test/java/com/baeldung/httpclient/conn/TesterVersion_MultiHttpClientConnThread.java @@ -1,4 +1,4 @@ -package org.baeldung.httpclient.conn; +package com.baeldung.httpclient.conn; import java.io.IOException; diff --git a/httpclient/src/test/java/org/baeldung/httpclient/rare/HttpClientUnshortenLiveTest.java b/httpclient/src/test/java/com/baeldung/httpclient/rare/HttpClientUnshortenLiveTest.java similarity index 99% rename from httpclient/src/test/java/org/baeldung/httpclient/rare/HttpClientUnshortenLiveTest.java rename to httpclient/src/test/java/com/baeldung/httpclient/rare/HttpClientUnshortenLiveTest.java index 8fc79baed9..efa7953ba8 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/rare/HttpClientUnshortenLiveTest.java +++ b/httpclient/src/test/java/com/baeldung/httpclient/rare/HttpClientUnshortenLiveTest.java @@ -1,4 +1,4 @@ -package org.baeldung.httpclient.rare; +package com.baeldung.httpclient.rare; import com.google.common.base.Preconditions; import com.google.common.collect.Lists; diff --git a/hystrix/pom.xml b/hystrix/pom.xml index 4aeb47f095..8c505c9104 100644 --- a/hystrix/pom.xml +++ b/hystrix/pom.xml @@ -1,13 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>hystrix</artifactId> <version>1.0</version> <name>hystrix</name> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-1</relativePath> </parent> diff --git a/image-processing/pom.xml b/image-processing/pom.xml index ce75145dc7..7b130329c7 100644 --- a/image-processing/pom.xml +++ b/image-processing/pom.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>image-processing</artifactId> <version>1.0-SNAPSHOT</version> <name>image-processing</name> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> diff --git a/immutables/pom.xml b/immutables/pom.xml index efb21e584a..af4a62ea6b 100644 --- a/immutables/pom.xml +++ b/immutables/pom.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>immutables</artifactId> <name>immutables</name> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> diff --git a/intelliJ/remote-debugging/.idea/runConfigurations/Remote_Debugger.xml b/intelliJ/remote-debugging/.idea/runConfigurations/Remote_Debugger.xml new file mode 100644 index 0000000000..ca11791a08 --- /dev/null +++ b/intelliJ/remote-debugging/.idea/runConfigurations/Remote_Debugger.xml @@ -0,0 +1,15 @@ +<component name="ProjectRunConfigurationManager"> + <configuration default="false" name="Remote Debugger" type="Remote"> + <option name="USE_SOCKET_TRANSPORT" value="true" /> + <option name="SERVER_MODE" value="false" /> + <option name="SHMEM_ADDRESS" /> + <option name="HOST" value="localhost" /> + <option name="PORT" value="5005" /> + <option name="AUTO_RESTART" value="false" /> + <RunnerSettings RunnerId="Debug"> + <option name="DEBUG_PORT" value="5005" /> + <option name="LOCAL" value="false" /> + </RunnerSettings> + <method v="2" /> + </configuration> +</component> \ No newline at end of file diff --git a/intelliJ/remote-debugging/CONTRIBUTING.adoc b/intelliJ/remote-debugging/CONTRIBUTING.adoc new file mode 100644 index 0000000000..a97e428a48 --- /dev/null +++ b/intelliJ/remote-debugging/CONTRIBUTING.adoc @@ -0,0 +1,2 @@ +If you have not previously done so, please fill out and +submit the https://cla.pivotal.io/sign/spring[Contributor License Agreement]. \ No newline at end of file diff --git a/intelliJ/remote-debugging/LICENSE.code.txt b/intelliJ/remote-debugging/LICENSE.code.txt new file mode 100644 index 0000000000..4b5cde9fd2 --- /dev/null +++ b/intelliJ/remote-debugging/LICENSE.code.txt @@ -0,0 +1,16 @@ + All code in this repository is: + ======================================================================= + Copyright (c) 2013 GoPivotal, Inc. All Rights Reserved + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/intelliJ/remote-debugging/LICENSE.writing.txt b/intelliJ/remote-debugging/LICENSE.writing.txt new file mode 100644 index 0000000000..9d21229f84 --- /dev/null +++ b/intelliJ/remote-debugging/LICENSE.writing.txt @@ -0,0 +1 @@ +Except where otherwise noted, this work is licensed under https://creativecommons.org/licenses/by-nd/3.0/ diff --git a/intelliJ/remote-debugging/README.adoc b/intelliJ/remote-debugging/README.adoc new file mode 100644 index 0000000000..6a4b80959f --- /dev/null +++ b/intelliJ/remote-debugging/README.adoc @@ -0,0 +1,84 @@ +:toc: +:spring_version: current +:icons: font +:source-highlighter: prettify +:project_id: gs-scheduling-tasks +This guide walks you through the steps for scheduling tasks with Spring. + +== What you'll build + +You'll build an application that prints out the current time every five seconds using Spring's `@Scheduled` annotation. + +== What you'll need + +:java_version: 1.8 +include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/master/prereq_editor_jdk_buildtools.adoc[] + + +include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/master/how_to_complete_this_guide.adoc[] + + +include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/master/hide-show-gradle.adoc[] + +include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/master/hide-show-maven.adoc[] + +include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/master/hide-show-sts.adoc[] + + + +[[initial]] +== Create a scheduled task +Now that you've set up your project, you can create a scheduled task. + +`src/main/java/hello/ScheduledTasks.java` +[source,java] +---- +include::complete/src/main/java/hello/ScheduledTasks.java[] +---- + +The `Scheduled` annotation defines when a particular method runs. +NOTE: This example uses `fixedRate`, which specifies the interval between method invocations measured from the start time of each invocation. There are https://docs.spring.io/spring/docs/{spring_version}/spring-framework-reference/html/scheduling.html#scheduling-annotation-support-scheduled[other options], like `fixedDelay`, which specifies the interval between invocations measured from the completion of the task. You can also https://docs.spring.io/spring/docs/{spring_version}/javadoc-api/org/springframework/scheduling/support/CronSequenceGenerator.html[use `@Scheduled(cron=". . .")` expressions for more sophisticated task scheduling]. + +== Enable Scheduling + +Although scheduled tasks can be embedded in web apps and WAR files, the simpler approach demonstrated below creates a standalone application. You package everything in a single, executable JAR file, driven by a good old Java `main()` method. + +`src/main/java/hello/Application.java` +[source,java] +---- +include::complete/src/main/java/hello/Application.java[] +---- + +include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/master/spring-boot-application.adoc[] + +https://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#scheduling-enable-annotation-support[`@EnableScheduling`] ensures that a background task executor is created. Without it, nothing gets scheduled. + + +include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/master/build_an_executable_jar_subhead.adoc[] + +include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/master/build_an_executable_jar_with_both.adoc[] + + + +Logging output is displayed and you can see from the logs that it is on a background thread. You should see your scheduled task fire every 5 seconds: + +.... +[...] +2016-08-25 13:10:00.143 INFO 31565 --- [pool-1-thread-1] hello.ScheduledTasks : The time is now 13:10:00 +2016-08-25 13:10:05.143 INFO 31565 --- [pool-1-thread-1] hello.ScheduledTasks : The time is now 13:10:05 +2016-08-25 13:10:10.143 INFO 31565 --- [pool-1-thread-1] hello.ScheduledTasks : The time is now 13:10:10 +2016-08-25 13:10:15.143 INFO 31565 --- [pool-1-thread-1] hello.ScheduledTasks : The time is now 13:10:15 +.... + +== Summary + +Congratulations! You created an application with a scheduled task. Heck, the actual code was shorter than the build file! This technique works in any type of application. + +== See Also + +The following guides may also be helpful: + +* https://spring.io/guides/gs/spring-boot/[Building an Application with Spring Boot] +* https://spring.io/guides/gs/batch-processing/[Creating a Batch Service] + +include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/master/footer.adoc[] diff --git a/intelliJ/remote-debugging/pom.xml b/intelliJ/remote-debugging/pom.xml new file mode 100644 index 0000000000..d18625e8f6 --- /dev/null +++ b/intelliJ/remote-debugging/pom.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>com.baeldung</groupId> + <artifactId>gs-scheduling-tasks</artifactId> + <version>0.1.0</version> + <name>gs-scheduling-tasks</name> + + <parent> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-parent</artifactId> + <version>2.1.6.RELEASE</version> + </parent> + + <properties> + <java.version>1.8</java.version> + </properties> + + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.awaitility</groupId> + <artifactId>awaitility</artifactId> + <version>3.1.2</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + </plugins> + </build> + +</project> diff --git a/intelliJ/remote-debugging/src/main/java/hello/Application.java b/intelliJ/remote-debugging/src/main/java/hello/Application.java new file mode 100644 index 0000000000..73b55f933b --- /dev/null +++ b/intelliJ/remote-debugging/src/main/java/hello/Application.java @@ -0,0 +1,14 @@ +package hello; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableScheduling; + +@SpringBootApplication +@EnableScheduling +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class); + } +} diff --git a/intelliJ/remote-debugging/src/main/java/hello/ScheduledTasks.java b/intelliJ/remote-debugging/src/main/java/hello/ScheduledTasks.java new file mode 100644 index 0000000000..de1f6eebeb --- /dev/null +++ b/intelliJ/remote-debugging/src/main/java/hello/ScheduledTasks.java @@ -0,0 +1,38 @@ +/* + * Copyright 2012-2015 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package hello; + +import java.text.SimpleDateFormat; +import java.util.Date; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +@Component +public class ScheduledTasks { + + private static final Logger log = LoggerFactory.getLogger(ScheduledTasks.class); + + private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss"); + + @Scheduled(fixedRate = 5000) + public void reportCurrentTime() { + log.info("The time is now {}", dateFormat.format(new Date())); + } +} diff --git a/jackson-2/.gitignore b/jackson-2/.gitignore deleted file mode 100644 index 4b1cfaf098..0000000000 --- a/jackson-2/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -*.class - -#folders# -/target -/neoDb* -/data -/src/main/webapp/WEB-INF/classes -*/META-INF/* - -# Packaged files # -*.jar -*.war -*.ear - -# Files -/src/main/resources/orderOutput.yaml \ No newline at end of file diff --git a/jackson-2/README.md b/jackson-2/README.md deleted file mode 100644 index 5e0cb4ec37..0000000000 --- a/jackson-2/README.md +++ /dev/null @@ -1,15 +0,0 @@ -## Jackson Cookbooks and Examples - -This module contains articles about Jackson. - -### The Course -The "REST With Spring" Classes: http://bit.ly/restwithspring - -### Relevant Articles: -- [Mapping Multiple JSON Fields to a Single Java Field](https://www.baeldung.com/json-multiple-fields-single-java-field) -- [How to Process YAML with Jackson](https://www.baeldung.com/jackson-yaml) -- [Working with Tree Model Nodes in Jackson](https://www.baeldung.com/jackson-json-node-tree-model) -- [Converting JSON to CSV in Java](https://www.baeldung.com/java-converting-json-to-csv) -- [Compare Two JSON Objects with Jackson](https://www.baeldung.com/jackson-compare-two-json-objects) -- [Calling Default Serializer from Custom Serializer in Jackson](https://www.baeldung.com/jackson-call-default-serializer-from-custom-serializer) -- More articles: [[<-- prev]](/../jackson) diff --git a/jackson-annotations/README.md b/jackson-annotations/README.md new file mode 100644 index 0000000000..783a06605b --- /dev/null +++ b/jackson-annotations/README.md @@ -0,0 +1,9 @@ +## Jackson Annotations + +This module contains articles about Jackson annotations. + +### Relevant Articles: +- [Guide to @JsonFormat in Jackson](https://www.baeldung.com/jackson-jsonformat) +- [More Jackson Annotations](https://www.baeldung.com/jackson-advanced-annotations) +- [Jackson – Bidirectional Relationships](https://www.baeldung.com/jackson-bidirectional-relationships-and-infinite-recursion) +- [Jackson JSON Views](https://www.baeldung.com/jackson-json-view-annotation) diff --git a/jackson-annotations/pom.xml b/jackson-annotations/pom.xml new file mode 100644 index 0000000000..a259d895da --- /dev/null +++ b/jackson-annotations/pom.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>jackson-annotations</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>jackson-annotations</name> + + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-java</artifactId> + <version>0.0.1-SNAPSHOT</version> + <relativePath>../parent-java</relativePath> + </parent> + + <dependencies> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>${jackson.version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.dataformat</groupId> + <artifactId>jackson-dataformat-xml</artifactId> + <version>${jackson.version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.module</groupId> + <artifactId>jackson-module-jsonSchema</artifactId> + <version>${jackson.version}</version> + </dependency> + <dependency> + <groupId>io.rest-assured</groupId> + <artifactId>json-path</artifactId> + <version>${rest-assured.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <version>${assertj.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <finalName>jackson-annotations</finalName> + <resources> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + </resource> + </resources> + </build> + + <properties> + <assertj.version>3.11.0</assertj.version> + <rest-assured.version>3.1.1</rest-assured.version> + </properties> + +</project> diff --git a/jackson/src/test/java/com/baeldung/jackson/bidirection/CustomListDeserializer.java b/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/CustomListDeserializer.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/bidirection/CustomListDeserializer.java rename to jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/CustomListDeserializer.java diff --git a/jackson/src/test/java/com/baeldung/jackson/bidirection/CustomListSerializer.java b/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/CustomListSerializer.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/bidirection/CustomListSerializer.java rename to jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/CustomListSerializer.java diff --git a/jackson/src/test/java/com/baeldung/jackson/bidirection/Item.java b/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/Item.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/bidirection/Item.java rename to jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/Item.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/bidirection/ItemWithIdentity.java b/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithIdentity.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/bidirection/ItemWithIdentity.java rename to jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithIdentity.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/bidirection/ItemWithIgnore.java b/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithIgnore.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/bidirection/ItemWithIgnore.java rename to jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithIgnore.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/bidirection/ItemWithRef.java b/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithRef.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/bidirection/ItemWithRef.java rename to jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithRef.java diff --git a/jackson/src/test/java/com/baeldung/jackson/bidirection/ItemWithSerializer.java b/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithSerializer.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/bidirection/ItemWithSerializer.java rename to jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithSerializer.java diff --git a/jackson/src/test/java/com/baeldung/jackson/bidirection/ItemWithView.java b/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithView.java similarity index 90% rename from jackson/src/test/java/com/baeldung/jackson/bidirection/ItemWithView.java rename to jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithView.java index ffa19fbad2..5cf9cd9981 100644 --- a/jackson/src/test/java/com/baeldung/jackson/bidirection/ItemWithView.java +++ b/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithView.java @@ -1,6 +1,6 @@ package com.baeldung.jackson.bidirection; -import com.baeldung.jackson.jsonview.Views; +import com.baeldung.jackson.bidirection.jsonview.Views; import com.fasterxml.jackson.annotation.JsonView; diff --git a/jackson/src/test/java/com/baeldung/jackson/bidirection/User.java b/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/User.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/bidirection/User.java rename to jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/User.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/bidirection/UserWithIdentity.java b/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithIdentity.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/bidirection/UserWithIdentity.java rename to jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithIdentity.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/bidirection/UserWithIgnore.java b/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithIgnore.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/bidirection/UserWithIgnore.java rename to jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithIgnore.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/bidirection/UserWithRef.java b/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithRef.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/bidirection/UserWithRef.java rename to jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithRef.java diff --git a/jackson/src/test/java/com/baeldung/jackson/bidirection/UserWithSerializer.java b/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithSerializer.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/bidirection/UserWithSerializer.java rename to jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithSerializer.java diff --git a/jackson/src/test/java/com/baeldung/jackson/bidirection/UserWithView.java b/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithView.java similarity index 92% rename from jackson/src/test/java/com/baeldung/jackson/bidirection/UserWithView.java rename to jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithView.java index d92d67b3a1..ad73eb8f92 100644 --- a/jackson/src/test/java/com/baeldung/jackson/bidirection/UserWithView.java +++ b/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithView.java @@ -3,7 +3,7 @@ package com.baeldung.jackson.bidirection; import java.util.ArrayList; import java.util.List; -import com.baeldung.jackson.jsonview.Views; +import com.baeldung.jackson.bidirection.jsonview.Views; import com.fasterxml.jackson.annotation.JsonView; diff --git a/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/jsonview/Views.java b/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/jsonview/Views.java new file mode 100644 index 0000000000..0a13d55a5b --- /dev/null +++ b/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/jsonview/Views.java @@ -0,0 +1,9 @@ +package com.baeldung.jackson.bidirection.jsonview; + +public class Views { + public static class Public { + } + + public static class Internal extends Public { + } +} diff --git a/jackson-annotations/src/main/java/com/baeldung/jackson/domain/Person.java b/jackson-annotations/src/main/java/com/baeldung/jackson/domain/Person.java new file mode 100644 index 0000000000..f11ba41113 --- /dev/null +++ b/jackson-annotations/src/main/java/com/baeldung/jackson/domain/Person.java @@ -0,0 +1,30 @@ +package com.baeldung.jackson.domain; + +public class Person { + + private String firstName; + private String lastName; + + public Person(String firstName, String lastName) { + super(); + this.firstName = firstName; + this.lastName = lastName; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } +} + diff --git a/jackson/src/main/java/com/baeldung/jackson/format/User.java b/jackson-annotations/src/main/java/com/baeldung/jackson/format/User.java old mode 100755 new mode 100644 similarity index 100% rename from jackson/src/main/java/com/baeldung/jackson/format/User.java rename to jackson-annotations/src/main/java/com/baeldung/jackson/format/User.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/jsonview/Item.java b/jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/Item.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/jsonview/Item.java rename to jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/Item.java diff --git a/jackson/src/test/java/com/baeldung/jackson/jsonview/MyBeanSerializerModifier.java b/jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/MyBeanSerializerModifier.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/jsonview/MyBeanSerializerModifier.java rename to jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/MyBeanSerializerModifier.java diff --git a/jackson/src/test/java/com/baeldung/jackson/jsonview/UpperCasingWriter.java b/jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/UpperCasingWriter.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/jsonview/UpperCasingWriter.java rename to jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/UpperCasingWriter.java diff --git a/jackson/src/test/java/com/baeldung/jackson/jsonview/User.java b/jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/User.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/jsonview/User.java rename to jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/User.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/jsonview/Views.java b/jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/Views.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/jsonview/Views.java rename to jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/Views.java diff --git a/jackson/src/test/java/com/baeldung/jackson/annotation/extra/ExtraAnnotationUnitTest.java b/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/AdvancedAnnotationsUnitTest.java similarity index 92% rename from jackson/src/test/java/com/baeldung/jackson/annotation/extra/ExtraAnnotationUnitTest.java rename to jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/AdvancedAnnotationsUnitTest.java index 647c451659..c0eb917292 100644 --- a/jackson/src/test/java/com/baeldung/jackson/annotation/extra/ExtraAnnotationUnitTest.java +++ b/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/AdvancedAnnotationsUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.annotation.extra; +package com.baeldung.jackson.advancedannotations; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.instanceOf; @@ -12,10 +12,10 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import com.baeldung.jackson.annotation.extra.AppendBeans.BeanWithAppend; -import com.baeldung.jackson.annotation.extra.AppendBeans.BeanWithoutAppend; -import com.baeldung.jackson.annotation.extra.IdentityReferenceBeans.BeanWithIdentityReference; -import com.baeldung.jackson.annotation.extra.IdentityReferenceBeans.BeanWithoutIdentityReference; +import com.baeldung.jackson.advancedannotations.AppendBeans.BeanWithAppend; +import com.baeldung.jackson.advancedannotations.AppendBeans.BeanWithoutAppend; +import com.baeldung.jackson.advancedannotations.IdentityReferenceBeans.BeanWithIdentityReference; +import com.baeldung.jackson.advancedannotations.IdentityReferenceBeans.BeanWithoutIdentityReference; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping; @@ -23,7 +23,7 @@ import com.fasterxml.jackson.databind.ObjectWriter; import com.fasterxml.jackson.module.jsonSchema.JsonSchema; import com.fasterxml.jackson.module.jsonSchema.factories.SchemaFactoryWrapper; -public class ExtraAnnotationUnitTest { +public class AdvancedAnnotationsUnitTest { @Test public void whenNotUsingJsonIdentityReferenceAnnotation_thenCorrect() throws JsonProcessingException { ObjectMapper mapper = new ObjectMapper(); diff --git a/jackson/src/test/java/com/baeldung/jackson/annotation/extra/AppendBeans.java b/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/AppendBeans.java similarity index 95% rename from jackson/src/test/java/com/baeldung/jackson/annotation/extra/AppendBeans.java rename to jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/AppendBeans.java index 7b75c205c9..ab045dd0c6 100644 --- a/jackson/src/test/java/com/baeldung/jackson/annotation/extra/AppendBeans.java +++ b/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/AppendBeans.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.annotation.extra; +package com.baeldung.jackson.advancedannotations; import com.fasterxml.jackson.databind.annotation.JsonAppend; diff --git a/jackson/src/test/java/com/baeldung/jackson/annotation/extra/IdentityReferenceBeans.java b/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/IdentityReferenceBeans.java similarity index 96% rename from jackson/src/test/java/com/baeldung/jackson/annotation/extra/IdentityReferenceBeans.java rename to jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/IdentityReferenceBeans.java index 0a8736d9a5..6e723c317a 100644 --- a/jackson/src/test/java/com/baeldung/jackson/annotation/extra/IdentityReferenceBeans.java +++ b/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/IdentityReferenceBeans.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.annotation.extra; +package com.baeldung.jackson.advancedannotations; import com.fasterxml.jackson.annotation.JsonIdentityInfo; import com.fasterxml.jackson.annotation.JsonIdentityReference; diff --git a/jackson/src/test/java/com/baeldung/jackson/annotation/extra/NamingBean.java b/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/NamingBean.java similarity index 92% rename from jackson/src/test/java/com/baeldung/jackson/annotation/extra/NamingBean.java rename to jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/NamingBean.java index efd26ab9ae..323df49c14 100644 --- a/jackson/src/test/java/com/baeldung/jackson/annotation/extra/NamingBean.java +++ b/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/NamingBean.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.annotation.extra; +package com.baeldung.jackson.advancedannotations; import com.fasterxml.jackson.databind.PropertyNamingStrategy; import com.fasterxml.jackson.databind.annotation.JsonNaming; diff --git a/jackson/src/test/java/com/baeldung/jackson/annotation/extra/POJOBuilderBean.java b/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/POJOBuilderBean.java similarity index 96% rename from jackson/src/test/java/com/baeldung/jackson/annotation/extra/POJOBuilderBean.java rename to jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/POJOBuilderBean.java index e0a89c6903..97b747fe40 100644 --- a/jackson/src/test/java/com/baeldung/jackson/annotation/extra/POJOBuilderBean.java +++ b/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/POJOBuilderBean.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.annotation.extra; +package com.baeldung.jackson.advancedannotations; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; diff --git a/jackson/src/test/java/com/baeldung/jackson/annotation/extra/PropertyDescriptionBean.java b/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/PropertyDescriptionBean.java similarity index 90% rename from jackson/src/test/java/com/baeldung/jackson/annotation/extra/PropertyDescriptionBean.java rename to jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/PropertyDescriptionBean.java index 1563cddb83..dcc0c67054 100644 --- a/jackson/src/test/java/com/baeldung/jackson/annotation/extra/PropertyDescriptionBean.java +++ b/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/PropertyDescriptionBean.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.annotation.extra; +package com.baeldung.jackson.advancedannotations; import com.fasterxml.jackson.annotation.JsonPropertyDescription; diff --git a/jackson/src/test/java/com/baeldung/jackson/annotation/extra/TypeIdBean.java b/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/TypeIdBean.java similarity index 90% rename from jackson/src/test/java/com/baeldung/jackson/annotation/extra/TypeIdBean.java rename to jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/TypeIdBean.java index 32a6d5a1d5..1b25529743 100644 --- a/jackson/src/test/java/com/baeldung/jackson/annotation/extra/TypeIdBean.java +++ b/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/TypeIdBean.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.annotation.extra; +package com.baeldung.jackson.advancedannotations; import com.fasterxml.jackson.annotation.JsonTypeId; diff --git a/jackson/src/test/java/com/baeldung/jackson/annotation/extra/TypeIdResolverStructure.java b/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/TypeIdResolverStructure.java similarity index 98% rename from jackson/src/test/java/com/baeldung/jackson/annotation/extra/TypeIdResolverStructure.java rename to jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/TypeIdResolverStructure.java index 9056023c69..f9ddd8eea9 100644 --- a/jackson/src/test/java/com/baeldung/jackson/annotation/extra/TypeIdResolverStructure.java +++ b/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/TypeIdResolverStructure.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.annotation.extra; +package com.baeldung.jackson.advancedannotations; import java.util.List; diff --git a/jackson/src/test/java/com/baeldung/jackson/test/JacksonBidirectionRelationUnitTest.java b/jackson-annotations/src/test/java/com/baeldung/jackson/bidirection/JacksonBidirectionRelationUnitTest.java similarity index 87% rename from jackson/src/test/java/com/baeldung/jackson/test/JacksonBidirectionRelationUnitTest.java rename to jackson-annotations/src/test/java/com/baeldung/jackson/bidirection/JacksonBidirectionRelationUnitTest.java index e55ca55ac9..d0c5209891 100644 --- a/jackson/src/test/java/com/baeldung/jackson/test/JacksonBidirectionRelationUnitTest.java +++ b/jackson-annotations/src/test/java/com/baeldung/jackson/bidirection/JacksonBidirectionRelationUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.test; +package com.baeldung.jackson.bidirection; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.not; @@ -9,19 +9,7 @@ import java.io.IOException; import org.junit.Test; -import com.baeldung.jackson.bidirection.Item; -import com.baeldung.jackson.bidirection.ItemWithIdentity; -import com.baeldung.jackson.bidirection.ItemWithIgnore; -import com.baeldung.jackson.bidirection.ItemWithRef; -import com.baeldung.jackson.bidirection.ItemWithSerializer; -import com.baeldung.jackson.bidirection.ItemWithView; -import com.baeldung.jackson.bidirection.User; -import com.baeldung.jackson.bidirection.UserWithIdentity; -import com.baeldung.jackson.bidirection.UserWithIgnore; -import com.baeldung.jackson.bidirection.UserWithRef; -import com.baeldung.jackson.bidirection.UserWithSerializer; -import com.baeldung.jackson.bidirection.UserWithView; -import com.baeldung.jackson.jsonview.Views; +import com.baeldung.jackson.bidirection.jsonview.Views; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/jackson/src/test/java/com/baeldung/jackson/format/JsonFormatUnitTest.java b/jackson-annotations/src/test/java/com/baeldung/jackson/format/JsonFormatUnitTest.java old mode 100755 new mode 100644 similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/format/JsonFormatUnitTest.java rename to jackson-annotations/src/test/java/com/baeldung/jackson/format/JsonFormatUnitTest.java diff --git a/jackson/src/test/java/com/baeldung/jackson/test/JacksonJsonViewUnitTest.java b/jackson-annotations/src/test/java/com/baeldung/jackson/jsonview/JacksonJsonViewUnitTest.java similarity index 98% rename from jackson/src/test/java/com/baeldung/jackson/test/JacksonJsonViewUnitTest.java rename to jackson-annotations/src/test/java/com/baeldung/jackson/jsonview/JacksonJsonViewUnitTest.java index 7930195ab0..4074da1a55 100644 --- a/jackson/src/test/java/com/baeldung/jackson/test/JacksonJsonViewUnitTest.java +++ b/jackson-annotations/src/test/java/com/baeldung/jackson/jsonview/JacksonJsonViewUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.test; +package com.baeldung.jackson.jsonview; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.not; diff --git a/jackson-conversions-2/README.md b/jackson-conversions-2/README.md new file mode 100644 index 0000000000..71c5578525 --- /dev/null +++ b/jackson-conversions-2/README.md @@ -0,0 +1,12 @@ +## Jackson Conversions + +This module contains articles about Jackson conversions. + +### Relevant Articles: +- [Mapping a Dynamic JSON Object with Jackson](https://www.baeldung.com/jackson-mapping-dynamic-object) +- [Mapping Multiple JSON Fields to a Single Java Field](https://www.baeldung.com/json-multiple-fields-single-java-field) +- [Convert XML to JSON Using Jackson](https://www.baeldung.com/jackson-convert-xml-json) +- [Converting JSON to CSV in Java](https://www.baeldung.com/java-converting-json-to-csv) +- [How to Process YAML with Jackson](https://www.baeldung.com/jackson-yaml) +- [Jackson Streaming API](https://www.baeldung.com/jackson-streaming-api) +- More articles: [[<-- prev]](../jackson-conversions) diff --git a/jackson-2/pom.xml b/jackson-conversions-2/pom.xml similarity index 75% rename from jackson-2/pom.xml rename to jackson-conversions-2/pom.xml index 2fff1f8706..732c89c1e5 100644 --- a/jackson-2/pom.xml +++ b/jackson-conversions-2/pom.xml @@ -1,9 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <artifactId>jackson-2</artifactId> - <version>0.1-SNAPSHOT</version> - <name>jackson-2</name> + <artifactId>jackson-conversions-2</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>jackson-conversions-2</name> <parent> <groupId>com.baeldung</groupId> @@ -13,39 +14,35 @@ </parent> <dependencies> - - <!-- marshalling --> - <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>${jackson.version}</version> </dependency> - + <!--jackson for xml --> + <dependency> + <groupId>com.fasterxml.jackson.dataformat</groupId> + <artifactId>jackson-dataformat-xml</artifactId> + <version>${jackson.version}</version> + </dependency> <!-- YAML --> <dependency> <groupId>com.fasterxml.jackson.dataformat</groupId> <artifactId>jackson-dataformat-yaml</artifactId> <version>${jackson.version}</version> </dependency> - + <!-- Allow use of LocalDate --> + <dependency> + <groupId>com.fasterxml.jackson.datatype</groupId> + <artifactId>jackson-datatype-jsr310</artifactId> + <version>2.9.8</version> + </dependency> <!-- CSV --> <dependency> <groupId>com.fasterxml.jackson.dataformat</groupId> <artifactId>jackson-dataformat-csv</artifactId> <version>${jackson.version}</version> - </dependency> - - <!-- Allow use of LocalDate --> - <dependency> - <groupId>com.fasterxml.jackson.datatype</groupId> - <artifactId>jackson-datatype-jsr310</artifactId> - <version>${jackson.version}</version> </dependency> - - - <!-- test scoped --> - <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> @@ -55,7 +52,7 @@ </dependencies> <build> - <finalName>jackson-2</finalName> + <finalName>jackson-conversions-2</finalName> <resources> <resource> <directory>src/main/resources</directory> @@ -65,8 +62,6 @@ </build> <properties> - - <!-- testing --> <assertj.version>3.11.0</assertj.version> </properties> diff --git a/jackson-2/src/main/java/com/baeldung/jackson/csv/JsonCsvConverter.java b/jackson-conversions-2/src/main/java/com/baeldung/jackson/csv/JsonCsvConverter.java similarity index 95% rename from jackson-2/src/main/java/com/baeldung/jackson/csv/JsonCsvConverter.java rename to jackson-conversions-2/src/main/java/com/baeldung/jackson/csv/JsonCsvConverter.java index 71c6de4d7e..9d500bf263 100644 --- a/jackson-2/src/main/java/com/baeldung/jackson/csv/JsonCsvConverter.java +++ b/jackson-conversions-2/src/main/java/com/baeldung/jackson/csv/JsonCsvConverter.java @@ -3,8 +3,6 @@ package com.baeldung.jackson.csv; import java.io.File; import java.io.IOException; -import com.baeldung.jackson.entities.OrderLine; -import com.baeldung.jackson.mixin.OrderLineForCsv; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.MappingIterator; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/jackson-2/src/main/java/com/baeldung/jackson/entities/OrderLine.java b/jackson-conversions-2/src/main/java/com/baeldung/jackson/csv/OrderLine.java similarity index 96% rename from jackson-2/src/main/java/com/baeldung/jackson/entities/OrderLine.java rename to jackson-conversions-2/src/main/java/com/baeldung/jackson/csv/OrderLine.java index 858d094dd1..b6c22b0b1d 100644 --- a/jackson-2/src/main/java/com/baeldung/jackson/entities/OrderLine.java +++ b/jackson-conversions-2/src/main/java/com/baeldung/jackson/csv/OrderLine.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.entities; +package com.baeldung.jackson.csv; import java.math.BigDecimal; diff --git a/jackson-2/src/main/java/com/baeldung/jackson/mixin/OrderLineForCsv.java b/jackson-conversions-2/src/main/java/com/baeldung/jackson/csv/OrderLineForCsv.java similarity index 92% rename from jackson-2/src/main/java/com/baeldung/jackson/mixin/OrderLineForCsv.java rename to jackson-conversions-2/src/main/java/com/baeldung/jackson/csv/OrderLineForCsv.java index 05d70a8053..94a1573a84 100644 --- a/jackson-2/src/main/java/com/baeldung/jackson/mixin/OrderLineForCsv.java +++ b/jackson-conversions-2/src/main/java/com/baeldung/jackson/csv/OrderLineForCsv.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.mixin; +package com.baeldung.jackson.csv; import java.math.BigDecimal; diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/dynamicobject/Product.java b/jackson-conversions-2/src/main/java/com/baeldung/jackson/dynamicobject/Product.java similarity index 92% rename from jackson/src/main/java/com/baeldung/jackson/deserialization/dynamicobject/Product.java rename to jackson-conversions-2/src/main/java/com/baeldung/jackson/dynamicobject/Product.java index 9c997886e5..89a57a124c 100644 --- a/jackson/src/main/java/com/baeldung/jackson/deserialization/dynamicobject/Product.java +++ b/jackson-conversions-2/src/main/java/com/baeldung/jackson/dynamicobject/Product.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.deserialization.dynamicobject; +package com.baeldung.jackson.dynamicobject; import java.util.LinkedHashMap; import java.util.Map; diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/dynamicobject/ProductJsonNode.java b/jackson-conversions-2/src/main/java/com/baeldung/jackson/dynamicobject/ProductJsonNode.java similarity index 90% rename from jackson/src/main/java/com/baeldung/jackson/deserialization/dynamicobject/ProductJsonNode.java rename to jackson-conversions-2/src/main/java/com/baeldung/jackson/dynamicobject/ProductJsonNode.java index 729d542df3..b9142ae6e7 100644 --- a/jackson/src/main/java/com/baeldung/jackson/deserialization/dynamicobject/ProductJsonNode.java +++ b/jackson-conversions-2/src/main/java/com/baeldung/jackson/dynamicobject/ProductJsonNode.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.deserialization.dynamicobject; +package com.baeldung.jackson.dynamicobject; import com.fasterxml.jackson.databind.JsonNode; diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/dynamicobject/ProductMap.java b/jackson-conversions-2/src/main/java/com/baeldung/jackson/dynamicobject/ProductMap.java similarity index 91% rename from jackson/src/main/java/com/baeldung/jackson/deserialization/dynamicobject/ProductMap.java rename to jackson-conversions-2/src/main/java/com/baeldung/jackson/dynamicobject/ProductMap.java index 65d225f49b..62b7a43eae 100644 --- a/jackson/src/main/java/com/baeldung/jackson/deserialization/dynamicobject/ProductMap.java +++ b/jackson-conversions-2/src/main/java/com/baeldung/jackson/dynamicobject/ProductMap.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.deserialization.dynamicobject; +package com.baeldung.jackson.dynamicobject; import java.util.Map; diff --git a/jackson-2/src/main/java/com/baeldung/jackson/entities/Weather.java b/jackson-conversions-2/src/main/java/com/baeldung/jackson/multiplefields/Weather.java similarity index 94% rename from jackson-2/src/main/java/com/baeldung/jackson/entities/Weather.java rename to jackson-conversions-2/src/main/java/com/baeldung/jackson/multiplefields/Weather.java index 4a8cea052f..d1d6905d53 100644 --- a/jackson-2/src/main/java/com/baeldung/jackson/entities/Weather.java +++ b/jackson-conversions-2/src/main/java/com/baeldung/jackson/multiplefields/Weather.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.entities; +package com.baeldung.jackson.multiplefields; import com.fasterxml.jackson.annotation.JsonAlias; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/jackson/src/main/java/com/baeldung/jackson/xmlToJson/Color.java b/jackson-conversions-2/src/main/java/com/baeldung/jackson/xmlToJson/Color.java similarity index 100% rename from jackson/src/main/java/com/baeldung/jackson/xmlToJson/Color.java rename to jackson-conversions-2/src/main/java/com/baeldung/jackson/xmlToJson/Color.java diff --git a/jackson/src/main/java/com/baeldung/jackson/xmlToJson/Flower.java b/jackson-conversions-2/src/main/java/com/baeldung/jackson/xmlToJson/Flower.java similarity index 100% rename from jackson/src/main/java/com/baeldung/jackson/xmlToJson/Flower.java rename to jackson-conversions-2/src/main/java/com/baeldung/jackson/xmlToJson/Flower.java diff --git a/jackson-2/src/main/java/com/baeldung/jackson/entities/Order.java b/jackson-conversions-2/src/main/java/com/baeldung/jackson/yaml/Order.java similarity index 97% rename from jackson-2/src/main/java/com/baeldung/jackson/entities/Order.java rename to jackson-conversions-2/src/main/java/com/baeldung/jackson/yaml/Order.java index 2075b7879b..8c62a0bd3f 100644 --- a/jackson-2/src/main/java/com/baeldung/jackson/entities/Order.java +++ b/jackson-conversions-2/src/main/java/com/baeldung/jackson/yaml/Order.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.entities; +package com.baeldung.jackson.yaml; import java.time.LocalDate; import java.util.ArrayList; diff --git a/jackson-conversions-2/src/main/java/com/baeldung/jackson/yaml/OrderLine.java b/jackson-conversions-2/src/main/java/com/baeldung/jackson/yaml/OrderLine.java new file mode 100644 index 0000000000..c64eaa3832 --- /dev/null +++ b/jackson-conversions-2/src/main/java/com/baeldung/jackson/yaml/OrderLine.java @@ -0,0 +1,49 @@ +package com.baeldung.jackson.yaml; + +import java.math.BigDecimal; + +public class OrderLine { + private String item; + private int quantity; + private BigDecimal unitPrice; + + public OrderLine() { + + } + + public OrderLine(String item, int quantity, BigDecimal unitPrice) { + super(); + this.item = item; + this.quantity = quantity; + this.unitPrice = unitPrice; + } + + public String getItem() { + return item; + } + + public void setItem(String item) { + this.item = item; + } + + public int getQuantity() { + return quantity; + } + + public void setQuantity(int quantity) { + this.quantity = quantity; + } + + public BigDecimal getUnitPrice() { + return unitPrice; + } + + public void setUnitPrice(BigDecimal unitPrice) { + this.unitPrice = unitPrice; + } + + @Override + public String toString() { + return "OrderLine [item=" + item + ", quantity=" + quantity + ", unitPrice=" + unitPrice + "]"; + } +} diff --git a/jackson-2/src/main/resources/orderLines.csv b/jackson-conversions-2/src/main/resources/csv/orderLines.csv similarity index 100% rename from jackson-2/src/main/resources/orderLines.csv rename to jackson-conversions-2/src/main/resources/csv/orderLines.csv diff --git a/jackson-2/src/main/resources/orderLines.json b/jackson-conversions-2/src/main/resources/csv/orderLines.json similarity index 100% rename from jackson-2/src/main/resources/orderLines.json rename to jackson-conversions-2/src/main/resources/csv/orderLines.json diff --git a/jackson-2/src/test/java/com/baeldung/jackson/csv/CsvUnitTest.java b/jackson-conversions-2/src/test/java/com/baeldung/jackson/csv/CsvUnitTest.java similarity index 61% rename from jackson-2/src/test/java/com/baeldung/jackson/csv/CsvUnitTest.java rename to jackson-conversions-2/src/test/java/com/baeldung/jackson/csv/CsvUnitTest.java index 60c8ce79f3..c257cb7dc9 100644 --- a/jackson-2/src/test/java/com/baeldung/jackson/csv/CsvUnitTest.java +++ b/jackson-conversions-2/src/test/java/com/baeldung/jackson/csv/CsvUnitTest.java @@ -18,30 +18,30 @@ public class CsvUnitTest { @Test public void givenJsonInput_thenWriteCsv() throws JsonParseException, JsonMappingException, IOException { - JsonCsvConverter.JsonToCsv(new File("src/main/resources/orderLines.json"), - new File("src/main/resources/csvFromJson.csv")); + JsonCsvConverter.JsonToCsv(new File("src/main/resources/csv/orderLines.json"), + new File("src/main/resources/csv/csvFromJson.csv")); - assertEquals(readFile("src/main/resources/csvFromJson.csv"), - readFile("src/test/resources/expectedCsvFromJson.csv")); + assertEquals(readFile("src/main/resources/csv/csvFromJson.csv"), + readFile("src/test/resources/csv/expectedCsvFromJson.csv")); } @Test public void givenCsvInput_thenWritesJson() throws JsonParseException, JsonMappingException, IOException { - JsonCsvConverter.csvToJson(new File("src/main/resources/orderLines.csv"), - new File("src/main/resources/jsonFromCsv.json")); + JsonCsvConverter.csvToJson(new File("src/main/resources/csv/orderLines.csv"), + new File("src/main/resources/csv/jsonFromCsv.json")); - assertEquals(readFile("src/main/resources/jsonFromCsv.json"), - readFile("src/test/resources/expectedJsonFromCsv.json")); + assertEquals(readFile("src/main/resources/csv/jsonFromCsv.json"), + readFile("src/test/resources/csv/expectedJsonFromCsv.json")); } @Test public void givenJsonInput_thenWriteFormattedCsvOutput() throws JsonParseException, JsonMappingException, IOException { - JsonCsvConverter.JsonToFormattedCsv(new File("src/main/resources/orderLines.json"), - new File("src/main/resources/formattedCsvFromJson.csv")); + JsonCsvConverter.JsonToFormattedCsv(new File("src/main/resources/csv/orderLines.json"), + new File("src/main/resources/csv/formattedCsvFromJson.csv")); - assertEquals(readFile("src/main/resources/formattedCsvFromJson.csv"), - readFile("src/test/resources/expectedFormattedCsvFromJson.csv")); + assertEquals(readFile("src/main/resources/csv/formattedCsvFromJson.csv"), + readFile("src/test/resources/csv/expectedFormattedCsvFromJson.csv")); } diff --git a/jackson/src/test/java/com/baeldung/jackson/deserialization/dynamicobject/DynamicObjectDeserializationUnitTest.java b/jackson-conversions-2/src/test/java/com/baeldung/jackson/dynamicobject/DynamicObjectDeserializationUnitTest.java similarity index 97% rename from jackson/src/test/java/com/baeldung/jackson/deserialization/dynamicobject/DynamicObjectDeserializationUnitTest.java rename to jackson-conversions-2/src/test/java/com/baeldung/jackson/dynamicobject/DynamicObjectDeserializationUnitTest.java index c9536bc35a..0c222bffcc 100644 --- a/jackson/src/test/java/com/baeldung/jackson/deserialization/dynamicobject/DynamicObjectDeserializationUnitTest.java +++ b/jackson-conversions-2/src/test/java/com/baeldung/jackson/dynamicobject/DynamicObjectDeserializationUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.deserialization.dynamicobject; +package com.baeldung.jackson.dynamicobject; import static org.assertj.core.api.Assertions.assertThat; diff --git a/jackson-2/src/test/java/com/baeldung/jackson/deserialization/jsonalias/JsonAliasUnitTest.java b/jackson-conversions-2/src/test/java/com/baeldung/jackson/multiplefields/MapMultipleFieldsToSingleFieldUnitTest.java similarity index 88% rename from jackson-2/src/test/java/com/baeldung/jackson/deserialization/jsonalias/JsonAliasUnitTest.java rename to jackson-conversions-2/src/test/java/com/baeldung/jackson/multiplefields/MapMultipleFieldsToSingleFieldUnitTest.java index b5940a7bd7..1a50f6cfc1 100644 --- a/jackson-2/src/test/java/com/baeldung/jackson/deserialization/jsonalias/JsonAliasUnitTest.java +++ b/jackson-conversions-2/src/test/java/com/baeldung/jackson/multiplefields/MapMultipleFieldsToSingleFieldUnitTest.java @@ -1,13 +1,12 @@ -package com.baeldung.jackson.deserialization.jsonalias; +package com.baeldung.jackson.multiplefields; import static org.junit.Assert.assertEquals; import org.junit.Test; -import com.baeldung.jackson.entities.Weather; import com.fasterxml.jackson.databind.ObjectMapper; -public class JsonAliasUnitTest { +public class MapMultipleFieldsToSingleFieldUnitTest { @Test public void givenTwoJsonFormats_whenDeserialized_thenWeatherObjectsCreated() throws Exception { diff --git a/jackson/src/test/java/com/baeldung/jackson/streaming/JacksonStreamingAPIUnitTest.java b/jackson-conversions-2/src/test/java/com/baeldung/jackson/streaming/StreamingAPIUnitTest.java similarity index 98% rename from jackson/src/test/java/com/baeldung/jackson/streaming/JacksonStreamingAPIUnitTest.java rename to jackson-conversions-2/src/test/java/com/baeldung/jackson/streaming/StreamingAPIUnitTest.java index ff22682f37..5deb279c5c 100644 --- a/jackson/src/test/java/com/baeldung/jackson/streaming/JacksonStreamingAPIUnitTest.java +++ b/jackson-conversions-2/src/test/java/com/baeldung/jackson/streaming/StreamingAPIUnitTest.java @@ -13,7 +13,7 @@ import static junit.framework.Assert.assertNull; import static junit.framework.Assert.assertTrue; import static junit.framework.TestCase.assertEquals; -public class JacksonStreamingAPIUnitTest { +public class StreamingAPIUnitTest { @Test public void givenJsonGenerator_whenAppendJsonToIt_thenGenerateJson() throws IOException { diff --git a/jackson/src/test/java/com/baeldung/jackson/xmlToJson/XmlToJsonUnitTest.java b/jackson-conversions-2/src/test/java/com/baeldung/jackson/xmlToJson/XmlToJsonUnitTest.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/xmlToJson/XmlToJsonUnitTest.java rename to jackson-conversions-2/src/test/java/com/baeldung/jackson/xmlToJson/XmlToJsonUnitTest.java diff --git a/jackson-2/src/test/java/com/baeldung/jackson/yaml/YamlUnitTest.java b/jackson-conversions-2/src/test/java/com/baeldung/jackson/yaml/YamlUnitTest.java similarity index 86% rename from jackson-2/src/test/java/com/baeldung/jackson/yaml/YamlUnitTest.java rename to jackson-conversions-2/src/test/java/com/baeldung/jackson/yaml/YamlUnitTest.java index 3ed84db60e..17c487ff26 100644 --- a/jackson-2/src/test/java/com/baeldung/jackson/yaml/YamlUnitTest.java +++ b/jackson-conversions-2/src/test/java/com/baeldung/jackson/yaml/YamlUnitTest.java @@ -15,8 +15,6 @@ import java.util.List; import org.junit.Before; import org.junit.Test; -import com.baeldung.jackson.entities.Order; -import com.baeldung.jackson.entities.OrderLine; import com.fasterxml.jackson.core.JsonGenerationException; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; @@ -37,7 +35,7 @@ public class YamlUnitTest { @Test public void givenYamlInput_ObjectCreated() throws JsonParseException, JsonMappingException, IOException { - Order order = mapper.readValue(new File("src/main/resources/orderInput.yaml"), Order.class); + Order order = mapper.readValue(new File("src/test/resources/yaml/orderInput.yaml"), Order.class); assertEquals("A001", order.getOrderNo()); assertEquals(LocalDate.parse("2019-04-17", DateTimeFormatter.ISO_DATE), order.getDate()); assertEquals("Customer, Joe", order.getCustomerName()); @@ -55,9 +53,9 @@ public class YamlUnitTest { LocalDate.parse("2019-04-18", DateTimeFormatter.ISO_DATE), "Customer, Jane", lines); - mapper.writeValue(new File("src/main/resources/orderOutput.yaml"), order); + mapper.writeValue(new File("src/test/resources/yaml/orderOutput.yaml"), order); - File outputYaml = new File("src/main/resources/orderOutput.yaml"); + File outputYaml = new File("src/test/resources/yaml/orderOutput.yaml"); assertTrue(outputYaml.exists()); } } diff --git a/jackson-2/src/test/resources/expectedCsvFromJson.csv b/jackson-conversions-2/src/test/resources/csv/expectedCsvFromJson.csv similarity index 100% rename from jackson-2/src/test/resources/expectedCsvFromJson.csv rename to jackson-conversions-2/src/test/resources/csv/expectedCsvFromJson.csv diff --git a/jackson-2/src/test/resources/expectedFormattedCsvFromJson.csv b/jackson-conversions-2/src/test/resources/csv/expectedFormattedCsvFromJson.csv similarity index 100% rename from jackson-2/src/test/resources/expectedFormattedCsvFromJson.csv rename to jackson-conversions-2/src/test/resources/csv/expectedFormattedCsvFromJson.csv diff --git a/jackson-2/src/test/resources/expectedJsonFromCsv.json b/jackson-conversions-2/src/test/resources/csv/expectedJsonFromCsv.json similarity index 100% rename from jackson-2/src/test/resources/expectedJsonFromCsv.json rename to jackson-conversions-2/src/test/resources/csv/expectedJsonFromCsv.json diff --git a/jackson/src/test/resources/deserialize-dynamic-object/embedded.json b/jackson-conversions-2/src/test/resources/deserialize-dynamic-object/embedded.json similarity index 100% rename from jackson/src/test/resources/deserialize-dynamic-object/embedded.json rename to jackson-conversions-2/src/test/resources/deserialize-dynamic-object/embedded.json diff --git a/jackson/src/test/resources/deserialize-dynamic-object/flat.json b/jackson-conversions-2/src/test/resources/deserialize-dynamic-object/flat.json similarity index 100% rename from jackson/src/test/resources/deserialize-dynamic-object/flat.json rename to jackson-conversions-2/src/test/resources/deserialize-dynamic-object/flat.json diff --git a/jackson-2/src/main/resources/orderInput.yaml b/jackson-conversions-2/src/test/resources/yaml/orderInput.yaml similarity index 100% rename from jackson-2/src/main/resources/orderInput.yaml rename to jackson-conversions-2/src/test/resources/yaml/orderInput.yaml diff --git a/jackson-conversions/README.md b/jackson-conversions/README.md new file mode 100644 index 0000000000..8e8e4af73f --- /dev/null +++ b/jackson-conversions/README.md @@ -0,0 +1,16 @@ +## Jackson Conversions + +This module contains articles about Jackson conversions. + +### Relevant Articles: +- [Jackson – Unmarshall to Collection/Array](https://www.baeldung.com/jackson-collection-array) +- [Jackson Date](https://www.baeldung.com/jackson-serialize-dates) +- [Jackson – Working with Maps and Nulls](https://www.baeldung.com/jackson-map-null-values-or-null-key) +- [Jackson – Decide What Fields Get Serialized/Deserialized](https://www.baeldung.com/jackson-field-serializable-deserializable-or-not) +- [XML Serialization and Deserialization with Jackson](https://www.baeldung.com/jackson-xml-serialization-and-deserialization) +- [Map Serialization and Deserialization with Jackson](https://www.baeldung.com/jackson-map) +- [How to Serialize and Deserialize Enums with Jackson](https://www.baeldung.com/jackson-serialize-enums) +- [Jackson – Marshall String to JsonNode](https://www.baeldung.com/jackson-json-to-jsonnode) +- [Mapping Nested Values with Jackson](https://www.baeldung.com/jackson-nested-values) +- [Deserialize Immutable Objects with Jackson](https://www.baeldung.com/jackson-deserialize-immutable-objects) +- More articles: [[next -->]](../jackson-conversions-2) diff --git a/jackson-conversions/pom.xml b/jackson-conversions/pom.xml new file mode 100644 index 0000000000..c45d88bedd --- /dev/null +++ b/jackson-conversions/pom.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>jackson-conversions</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>jackson-conversions</name> + + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-java</artifactId> + <version>0.0.1-SNAPSHOT</version> + <relativePath>../parent-java</relativePath> + </parent> + + <dependencies> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>${jackson.version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.datatype</groupId> + <artifactId>jackson-datatype-joda</artifactId> + <version>${jackson.version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.datatype</groupId> + <artifactId>jackson-datatype-jsr310</artifactId> + <version>${jackson.version}</version> + </dependency> + <!--jackson for xml --> + <dependency> + <groupId>com.fasterxml.jackson.dataformat</groupId> + <artifactId>jackson-dataformat-xml</artifactId> + <version>${jackson.version}</version> + </dependency> + </dependencies> + + <build> + <finalName>jackson-conversions</finalName> + <resources> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + </resource> + </resources> + </build> + +</project> diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/date/CustomDateDeserializer.java b/jackson-conversions/src/main/java/com/baeldung/jackson/date/CustomDateDeserializer.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/date/CustomDateDeserializer.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/date/CustomDateDeserializer.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/date/CustomDateSerializer.java b/jackson-conversions/src/main/java/com/baeldung/jackson/date/CustomDateSerializer.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/date/CustomDateSerializer.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/date/CustomDateSerializer.java diff --git a/jackson/src/test/java/com/baeldung/jackson/date/CustomDateTimeSerializer.java b/jackson-conversions/src/main/java/com/baeldung/jackson/date/CustomDateTimeSerializer.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/date/CustomDateTimeSerializer.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/date/CustomDateTimeSerializer.java diff --git a/jackson/src/test/java/com/baeldung/jackson/date/CustomLocalDateTimeSerializer.java b/jackson-conversions/src/main/java/com/baeldung/jackson/date/CustomLocalDateTimeSerializer.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/date/CustomLocalDateTimeSerializer.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/date/CustomLocalDateTimeSerializer.java diff --git a/jackson/src/test/java/com/baeldung/jackson/date/Event.java b/jackson-conversions/src/main/java/com/baeldung/jackson/date/Event.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/date/Event.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/date/Event.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/date/EventWithFormat.java b/jackson-conversions/src/main/java/com/baeldung/jackson/date/EventWithFormat.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/date/EventWithFormat.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/date/EventWithFormat.java diff --git a/jackson/src/test/java/com/baeldung/jackson/date/EventWithJodaTime.java b/jackson-conversions/src/main/java/com/baeldung/jackson/date/EventWithJodaTime.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/date/EventWithJodaTime.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/date/EventWithJodaTime.java diff --git a/jackson/src/test/java/com/baeldung/jackson/date/EventWithLocalDateTime.java b/jackson-conversions/src/main/java/com/baeldung/jackson/date/EventWithLocalDateTime.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/date/EventWithLocalDateTime.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/date/EventWithLocalDateTime.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/date/EventWithSerializer.java b/jackson-conversions/src/main/java/com/baeldung/jackson/date/EventWithSerializer.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/date/EventWithSerializer.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/date/EventWithSerializer.java diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/enums/City.java b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/City.java similarity index 80% rename from jackson/src/main/java/com/baeldung/jackson/deserialization/enums/City.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/City.java index 2bbef534c3..794c73738a 100644 --- a/jackson/src/main/java/com/baeldung/jackson/deserialization/enums/City.java +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/City.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.deserialization.enums; +package com.baeldung.jackson.enums.deserialization; public class City { diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/enums/Distance.java b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/Distance.java similarity index 92% rename from jackson/src/main/java/com/baeldung/jackson/deserialization/enums/Distance.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/Distance.java index 2c96b6eb80..4e5a62a0a5 100644 --- a/jackson/src/main/java/com/baeldung/jackson/deserialization/enums/Distance.java +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/Distance.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.deserialization.enums; +package com.baeldung.jackson.enums.deserialization; public enum Distance { diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/enums/customdeserializer/City.java b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/customdeserializer/City.java similarity index 77% rename from jackson/src/main/java/com/baeldung/jackson/deserialization/enums/customdeserializer/City.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/customdeserializer/City.java index 36ef7e244a..d998c555d1 100644 --- a/jackson/src/main/java/com/baeldung/jackson/deserialization/enums/customdeserializer/City.java +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/customdeserializer/City.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.deserialization.enums.customdeserializer; +package com.baeldung.jackson.enums.deserialization.customdeserializer; public class City { diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/enums/customdeserializer/CustomEnumDeserializer.java b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/customdeserializer/CustomEnumDeserializer.java similarity index 94% rename from jackson/src/main/java/com/baeldung/jackson/deserialization/enums/customdeserializer/CustomEnumDeserializer.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/customdeserializer/CustomEnumDeserializer.java index bae0c0df34..5068e7e6ad 100644 --- a/jackson/src/main/java/com/baeldung/jackson/deserialization/enums/customdeserializer/CustomEnumDeserializer.java +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/customdeserializer/CustomEnumDeserializer.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.deserialization.enums.customdeserializer; +package com.baeldung.jackson.enums.deserialization.customdeserializer; import java.io.IOException; import com.fasterxml.jackson.core.JsonParser; diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/enums/customdeserializer/Distance.java b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/customdeserializer/Distance.java similarity index 91% rename from jackson/src/main/java/com/baeldung/jackson/deserialization/enums/customdeserializer/Distance.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/customdeserializer/Distance.java index 9cb3a0c391..a9b552a38d 100644 --- a/jackson/src/main/java/com/baeldung/jackson/deserialization/enums/customdeserializer/Distance.java +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/customdeserializer/Distance.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.deserialization.enums.customdeserializer; +package com.baeldung.jackson.enums.deserialization.customdeserializer; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/enums/jsoncreator/City.java b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsoncreator/City.java similarity index 77% rename from jackson/src/main/java/com/baeldung/jackson/deserialization/enums/jsoncreator/City.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsoncreator/City.java index 6a478dd263..a4fe575fa2 100644 --- a/jackson/src/main/java/com/baeldung/jackson/deserialization/enums/jsoncreator/City.java +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsoncreator/City.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.deserialization.enums.jsoncreator; +package com.baeldung.jackson.enums.deserialization.jsoncreator; public class City { diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/enums/jsoncreator/Distance.java b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsoncreator/Distance.java similarity index 94% rename from jackson/src/main/java/com/baeldung/jackson/deserialization/enums/jsoncreator/Distance.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsoncreator/Distance.java index 18235fb5c6..5a49b105d6 100644 --- a/jackson/src/main/java/com/baeldung/jackson/deserialization/enums/jsoncreator/Distance.java +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsoncreator/Distance.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.deserialization.enums.jsoncreator; +package com.baeldung.jackson.enums.deserialization.jsoncreator; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/enums/jsonproperty/City.java b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonproperty/City.java similarity index 77% rename from jackson/src/main/java/com/baeldung/jackson/deserialization/enums/jsonproperty/City.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonproperty/City.java index 7f763f97c4..2de67dbdc8 100644 --- a/jackson/src/main/java/com/baeldung/jackson/deserialization/enums/jsonproperty/City.java +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonproperty/City.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.deserialization.enums.jsonproperty; +package com.baeldung.jackson.enums.deserialization.jsonproperty; public class City { diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/enums/jsonproperty/Distance.java b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonproperty/Distance.java similarity index 93% rename from jackson/src/main/java/com/baeldung/jackson/deserialization/enums/jsonproperty/Distance.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonproperty/Distance.java index e671a9ae5b..991aa38e25 100644 --- a/jackson/src/main/java/com/baeldung/jackson/deserialization/enums/jsonproperty/Distance.java +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonproperty/Distance.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.deserialization.enums.jsonproperty; +package com.baeldung.jackson.enums.deserialization.jsonproperty; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/enums/jsonvalue/City.java b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonvalue/City.java similarity index 78% rename from jackson/src/main/java/com/baeldung/jackson/deserialization/enums/jsonvalue/City.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonvalue/City.java index 014668ea8c..e69fed642e 100644 --- a/jackson/src/main/java/com/baeldung/jackson/deserialization/enums/jsonvalue/City.java +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonvalue/City.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.deserialization.enums.jsonvalue; +package com.baeldung.jackson.enums.deserialization.jsonvalue; public class City { diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/enums/jsonvalue/Distance.java b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonvalue/Distance.java similarity index 91% rename from jackson/src/main/java/com/baeldung/jackson/deserialization/enums/jsonvalue/Distance.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonvalue/Distance.java index 44bb5f20c3..c905868a9a 100644 --- a/jackson/src/main/java/com/baeldung/jackson/deserialization/enums/jsonvalue/Distance.java +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonvalue/Distance.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.deserialization.enums.jsonvalue; +package com.baeldung.jackson.enums.deserialization.jsonvalue; import com.fasterxml.jackson.annotation.JsonValue; diff --git a/jackson/src/main/java/com/baeldung/jackson/enums/Distance.java b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/serialization/Distance.java similarity index 91% rename from jackson/src/main/java/com/baeldung/jackson/enums/Distance.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/enums/serialization/Distance.java index 8026eedc44..18b154aaf1 100644 --- a/jackson/src/main/java/com/baeldung/jackson/enums/Distance.java +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/serialization/Distance.java @@ -1,6 +1,6 @@ -package com.baeldung.jackson.enums; +package com.baeldung.jackson.enums.serialization; -import com.baeldung.jackson.serialization.DistanceSerializer; +import com.baeldung.jackson.enums.serialization.DistanceSerializer; import com.fasterxml.jackson.databind.annotation.JsonSerialize; /** diff --git a/jackson/src/main/java/com/baeldung/jackson/serialization/DistanceSerializer.java b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/serialization/DistanceSerializer.java similarity index 92% rename from jackson/src/main/java/com/baeldung/jackson/serialization/DistanceSerializer.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/enums/serialization/DistanceSerializer.java index f5951dfd8e..5b7e6374b9 100644 --- a/jackson/src/main/java/com/baeldung/jackson/serialization/DistanceSerializer.java +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/serialization/DistanceSerializer.java @@ -1,8 +1,7 @@ -package com.baeldung.jackson.serialization; +package com.baeldung.jackson.enums.serialization; import java.io.IOException; -import com.baeldung.jackson.enums.Distance; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.SerializerProvider; diff --git a/jackson/src/test/java/com/baeldung/jackson/dtos/withEnum/DistanceEnumSimple.java b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/DistanceEnumSimple.java similarity index 92% rename from jackson/src/test/java/com/baeldung/jackson/dtos/withEnum/DistanceEnumSimple.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/DistanceEnumSimple.java index 1118fb349a..e148f1b481 100644 --- a/jackson/src/test/java/com/baeldung/jackson/dtos/withEnum/DistanceEnumSimple.java +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/DistanceEnumSimple.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.dtos.withEnum; +package com.baeldung.jackson.enums.withEnum; public enum DistanceEnumSimple { KILOMETER("km", 1000), MILE("miles", 1609.34), METER("meters", 1), INCH("inches", 0.0254), CENTIMETER("cm", 0.01), MILLIMETER("mm", 0.001); diff --git a/jackson/src/test/java/com/baeldung/jackson/dtos/withEnum/DistanceEnumWithJsonFormat.java b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/DistanceEnumWithJsonFormat.java similarity index 93% rename from jackson/src/test/java/com/baeldung/jackson/dtos/withEnum/DistanceEnumWithJsonFormat.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/DistanceEnumWithJsonFormat.java index 7dc6bb559b..2961320e1e 100644 --- a/jackson/src/test/java/com/baeldung/jackson/dtos/withEnum/DistanceEnumWithJsonFormat.java +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/DistanceEnumWithJsonFormat.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.dtos.withEnum; +package com.baeldung.jackson.enums.withEnum; import com.fasterxml.jackson.annotation.JsonFormat; diff --git a/jackson/src/test/java/com/baeldung/jackson/dtos/withEnum/DistanceEnumWithValue.java b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/DistanceEnumWithValue.java similarity index 93% rename from jackson/src/test/java/com/baeldung/jackson/dtos/withEnum/DistanceEnumWithValue.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/DistanceEnumWithValue.java index 69c476d8a5..6275efc7db 100644 --- a/jackson/src/test/java/com/baeldung/jackson/dtos/withEnum/DistanceEnumWithValue.java +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/DistanceEnumWithValue.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.dtos.withEnum; +package com.baeldung.jackson.enums.withEnum; import com.fasterxml.jackson.annotation.JsonValue; diff --git a/jackson/src/test/java/com/baeldung/jackson/dtos/withEnum/MyDtoWithEnumCustom.java b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/MyDtoWithEnumCustom.java similarity index 91% rename from jackson/src/test/java/com/baeldung/jackson/dtos/withEnum/MyDtoWithEnumCustom.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/MyDtoWithEnumCustom.java index bf9b7db395..1fe09f22cb 100644 --- a/jackson/src/test/java/com/baeldung/jackson/dtos/withEnum/MyDtoWithEnumCustom.java +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/MyDtoWithEnumCustom.java @@ -1,6 +1,6 @@ -package com.baeldung.jackson.dtos.withEnum; +package com.baeldung.jackson.enums.withEnum; -import com.baeldung.jackson.enums.Distance; +import com.baeldung.jackson.enums.serialization.Distance; public class MyDtoWithEnumCustom { diff --git a/jackson/src/test/java/com/baeldung/jackson/dtos/withEnum/MyDtoWithEnumJsonFormat.java b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/MyDtoWithEnumJsonFormat.java similarity index 96% rename from jackson/src/test/java/com/baeldung/jackson/dtos/withEnum/MyDtoWithEnumJsonFormat.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/MyDtoWithEnumJsonFormat.java index 8e2f1b835f..d80f457d4b 100644 --- a/jackson/src/test/java/com/baeldung/jackson/dtos/withEnum/MyDtoWithEnumJsonFormat.java +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/MyDtoWithEnumJsonFormat.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.dtos.withEnum; +package com.baeldung.jackson.enums.withEnum; public class MyDtoWithEnumJsonFormat { diff --git a/jackson/src/test/java/com/baeldung/jackson/field/MyDto.java b/jackson-conversions/src/main/java/com/baeldung/jackson/field/MyDto.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/field/MyDto.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/field/MyDto.java diff --git a/jackson/src/test/java/com/baeldung/jackson/field/MyDtoAccessLevel.java b/jackson-conversions/src/main/java/com/baeldung/jackson/field/MyDtoAccessLevel.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/field/MyDtoAccessLevel.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/field/MyDtoAccessLevel.java diff --git a/jackson/src/test/java/com/baeldung/jackson/field/MyDtoWithGetter.java b/jackson-conversions/src/main/java/com/baeldung/jackson/field/MyDtoWithGetter.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/field/MyDtoWithGetter.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/field/MyDtoWithGetter.java diff --git a/jackson/src/test/java/com/baeldung/jackson/field/MyDtoWithSetter.java b/jackson-conversions/src/main/java/com/baeldung/jackson/field/MyDtoWithSetter.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/field/MyDtoWithSetter.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/field/MyDtoWithSetter.java diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/Employee.java b/jackson-conversions/src/main/java/com/baeldung/jackson/immutable/Employee.java similarity index 89% rename from jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/Employee.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/immutable/Employee.java index 44b10ee39b..3196f5962e 100644 --- a/jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/Employee.java +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/immutable/Employee.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.deserialization.immutable; +package com.baeldung.jackson.immutable; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/Person.java b/jackson-conversions/src/main/java/com/baeldung/jackson/immutable/Person.java similarity index 93% rename from jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/Person.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/immutable/Person.java index d9041720b6..17000734fe 100644 --- a/jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/Person.java +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/immutable/Person.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.deserialization.immutable; +package com.baeldung.jackson.immutable; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; diff --git a/jackson/src/main/java/com/baeldung/jackson/entities/ClassWithAMap.java b/jackson-conversions/src/main/java/com/baeldung/jackson/map/ClassWithAMap.java similarity index 83% rename from jackson/src/main/java/com/baeldung/jackson/entities/ClassWithAMap.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/map/ClassWithAMap.java index 107d75eb0d..d945b34cdb 100644 --- a/jackson/src/main/java/com/baeldung/jackson/entities/ClassWithAMap.java +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/map/ClassWithAMap.java @@ -1,8 +1,7 @@ -package com.baeldung.jackson.entities; +package com.baeldung.jackson.map; import java.util.Map; -import com.baeldung.jackson.serialization.MyPairDeserializer; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; diff --git a/jackson/src/main/java/com/baeldung/jackson/entities/MyPair.java b/jackson-conversions/src/main/java/com/baeldung/jackson/map/MyPair.java similarity index 97% rename from jackson/src/main/java/com/baeldung/jackson/entities/MyPair.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/map/MyPair.java index ca5960e0cf..867eb23bc2 100644 --- a/jackson/src/main/java/com/baeldung/jackson/entities/MyPair.java +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/map/MyPair.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.entities; +package com.baeldung.jackson.map; import com.fasterxml.jackson.annotation.JsonValue; diff --git a/jackson/src/main/java/com/baeldung/jackson/serialization/MyPairDeserializer.java b/jackson-conversions/src/main/java/com/baeldung/jackson/map/MyPairDeserializer.java similarity index 82% rename from jackson/src/main/java/com/baeldung/jackson/serialization/MyPairDeserializer.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/map/MyPairDeserializer.java index 43bdc1c500..c631f47ffc 100644 --- a/jackson/src/main/java/com/baeldung/jackson/serialization/MyPairDeserializer.java +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/map/MyPairDeserializer.java @@ -1,8 +1,7 @@ -package com.baeldung.jackson.serialization; +package com.baeldung.jackson.map; import java.io.IOException; -import com.baeldung.jackson.entities.MyPair; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.KeyDeserializer; diff --git a/jackson/src/main/java/com/baeldung/jackson/serialization/MyPairSerializer.java b/jackson-conversions/src/main/java/com/baeldung/jackson/map/MyPairSerializer.java similarity index 89% rename from jackson/src/main/java/com/baeldung/jackson/serialization/MyPairSerializer.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/map/MyPairSerializer.java index fee1cafe16..c84bab104c 100644 --- a/jackson/src/main/java/com/baeldung/jackson/serialization/MyPairSerializer.java +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/map/MyPairSerializer.java @@ -1,9 +1,8 @@ -package com.baeldung.jackson.serialization; +package com.baeldung.jackson.map; import java.io.IOException; import java.io.StringWriter; -import com.baeldung.jackson.entities.MyPair; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonSerializer; diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/mapnull/MyDto.java b/jackson-conversions/src/main/java/com/baeldung/jackson/mapnull/MyDto.java new file mode 100644 index 0000000000..cb026a50f8 --- /dev/null +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/mapnull/MyDto.java @@ -0,0 +1,54 @@ +package com.baeldung.jackson.mapnull; + +public class MyDto { + + private String stringValue; + private int intValue; + private boolean booleanValue; + + public MyDto() { + super(); + } + + public MyDto(final String stringValue, final int intValue, final boolean booleanValue) { + super(); + + this.stringValue = stringValue; + this.intValue = intValue; + this.booleanValue = booleanValue; + } + + // API + + public String getStringValue() { + return stringValue; + } + + public void setStringValue(final String stringValue) { + this.stringValue = stringValue; + } + + public int getIntValue() { + return intValue; + } + + public void setIntValue(final int intValue) { + this.intValue = intValue; + } + + public boolean isBooleanValue() { + return booleanValue; + } + + public void setBooleanValue(final boolean booleanValue) { + this.booleanValue = booleanValue; + } + + // + + @Override + public String toString() { + return "MyDto [stringValue=" + stringValue + ", intValue=" + intValue + ", booleanValue=" + booleanValue + "]"; + } + +} diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/serialization/MyDtoNullKeySerializer.java b/jackson-conversions/src/main/java/com/baeldung/jackson/mapnull/MyDtoNullKeySerializer.java similarity index 91% rename from jackson-simple/src/test/java/com/baeldung/jackson/serialization/MyDtoNullKeySerializer.java rename to jackson-conversions/src/main/java/com/baeldung/jackson/mapnull/MyDtoNullKeySerializer.java index d0b2d7f5e9..1a5d794fac 100644 --- a/jackson-simple/src/test/java/com/baeldung/jackson/serialization/MyDtoNullKeySerializer.java +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/mapnull/MyDtoNullKeySerializer.java @@ -1,27 +1,27 @@ -package com.baeldung.jackson.serialization; - -import java.io.IOException; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; - -public class MyDtoNullKeySerializer extends StdSerializer<Object> { - - private static final long serialVersionUID = -4478531309177369056L; - - public MyDtoNullKeySerializer() { - this(null); - } - - public MyDtoNullKeySerializer(final Class<Object> t) { - super(t); - } - - @Override - public void serialize(final Object value, final JsonGenerator jgen, final SerializerProvider provider) throws IOException, JsonProcessingException { - jgen.writeFieldName(""); - } - -} +package com.baeldung.jackson.mapnull; + +import java.io.IOException; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; + +public class MyDtoNullKeySerializer extends StdSerializer<Object> { + + private static final long serialVersionUID = -4478531309177369056L; + + public MyDtoNullKeySerializer() { + this(null); + } + + public MyDtoNullKeySerializer(final Class<Object> t) { + super(t); + } + + @Override + public void serialize(final Object value, final JsonGenerator jgen, final SerializerProvider provider) throws IOException, JsonProcessingException { + jgen.writeFieldName(""); + } + +} diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/tocollection/MyDto.java b/jackson-conversions/src/main/java/com/baeldung/jackson/tocollection/MyDto.java new file mode 100644 index 0000000000..368dea5317 --- /dev/null +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/tocollection/MyDto.java @@ -0,0 +1,54 @@ +package com.baeldung.jackson.tocollection; + +public class MyDto { + + private String stringValue; + private int intValue; + private boolean booleanValue; + + public MyDto() { + super(); + } + + public MyDto(final String stringValue, final int intValue, final boolean booleanValue) { + super(); + + this.stringValue = stringValue; + this.intValue = intValue; + this.booleanValue = booleanValue; + } + + // API + + public String getStringValue() { + return stringValue; + } + + public void setStringValue(final String stringValue) { + this.stringValue = stringValue; + } + + public int getIntValue() { + return intValue; + } + + public void setIntValue(final int intValue) { + this.intValue = intValue; + } + + public boolean isBooleanValue() { + return booleanValue; + } + + public void setBooleanValue(final boolean booleanValue) { + this.booleanValue = booleanValue; + } + + // + + @Override + public String toString() { + return "MyDto [stringValue=" + stringValue + ", intValue=" + intValue + ", booleanValue=" + booleanValue + "]"; + } + +} diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/xml/Address.java b/jackson-conversions/src/main/java/com/baeldung/jackson/xml/Address.java new file mode 100644 index 0000000000..1d6b24c9c7 --- /dev/null +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/xml/Address.java @@ -0,0 +1,33 @@ +package com.baeldung.jackson.xml; + +public class Address { + + String streetNumber; + String streetName; + String city; + + public String getStreetNumber() { + return streetNumber; + } + + public void setStreetNumber(String streetNumber) { + this.streetNumber = streetNumber; + } + + public String getStreetName() { + return streetName; + } + + public void setStreetName(String streetName) { + this.streetName = streetName; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + +} diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/xml/Person.java b/jackson-conversions/src/main/java/com/baeldung/jackson/xml/Person.java new file mode 100644 index 0000000000..add53a1cfd --- /dev/null +++ b/jackson-conversions/src/main/java/com/baeldung/jackson/xml/Person.java @@ -0,0 +1,47 @@ +package com.baeldung.jackson.xml; + +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + +import java.util.ArrayList; +import java.util.List; + +@JacksonXmlRootElement(localName = "person") +public final class Person { + private String firstName; + private String lastName; + private List<String> phoneNumbers = new ArrayList<>(); + private List<Address> address = new ArrayList<>(); + + public List<Address> getAddress() { + return address; + } + + public void setAddress(List<Address> address) { + this.address = address; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public List<String> getPhoneNumbers() { + return phoneNumbers; + } + + public void setPhoneNumbers(List<String> phoneNumbers) { + this.phoneNumbers = phoneNumbers; + } + +} \ No newline at end of file diff --git a/jackson/src/test/java/com/baeldung/jackson/test/JacksonDateUnitTest.java b/jackson-conversions/src/test/java/com/baeldung/jackson/date/JacksonDateUnitTest.java similarity index 99% rename from jackson/src/test/java/com/baeldung/jackson/test/JacksonDateUnitTest.java rename to jackson-conversions/src/test/java/com/baeldung/jackson/date/JacksonDateUnitTest.java index 672ff5c6fd..a264dd52f2 100644 --- a/jackson/src/test/java/com/baeldung/jackson/test/JacksonDateUnitTest.java +++ b/jackson-conversions/src/test/java/com/baeldung/jackson/date/JacksonDateUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.test; +package com.baeldung.jackson.date; import static org.hamcrest.Matchers.containsString; import static org.junit.Assert.assertEquals; diff --git a/jackson/src/test/java/com/baeldung/jackson/deserialization/enums/DefaultEnumDeserializationUnitTest.java b/jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/DefaultEnumDeserializationUnitTest.java similarity index 91% rename from jackson/src/test/java/com/baeldung/jackson/deserialization/enums/DefaultEnumDeserializationUnitTest.java rename to jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/DefaultEnumDeserializationUnitTest.java index c7ce96e013..43e21100ea 100644 --- a/jackson/src/test/java/com/baeldung/jackson/deserialization/enums/DefaultEnumDeserializationUnitTest.java +++ b/jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/DefaultEnumDeserializationUnitTest.java @@ -1,7 +1,8 @@ -package com.baeldung.jackson.deserialization.enums; +package com.baeldung.jackson.enums.deserialization; import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.IOException; + import org.junit.Test; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/jackson/src/test/java/com/baeldung/jackson/deserialization/enums/customdeserializer/EnumCustomDeserializationUnitTest.java b/jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/customdeserializer/EnumCustomDeserializationUnitTest.java similarity index 90% rename from jackson/src/test/java/com/baeldung/jackson/deserialization/enums/customdeserializer/EnumCustomDeserializationUnitTest.java rename to jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/customdeserializer/EnumCustomDeserializationUnitTest.java index e8dbfa8df8..b0ceb5a6d8 100644 --- a/jackson/src/test/java/com/baeldung/jackson/deserialization/enums/customdeserializer/EnumCustomDeserializationUnitTest.java +++ b/jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/customdeserializer/EnumCustomDeserializationUnitTest.java @@ -1,7 +1,8 @@ -package com.baeldung.jackson.deserialization.enums.customdeserializer; +package com.baeldung.jackson.enums.deserialization.customdeserializer; import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.IOException; + import org.junit.Test; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/jackson/src/test/java/com/baeldung/jackson/deserialization/enums/jsoncreator/EnumDeserializationUsingJsonCreatorUnitTest.java b/jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/jsoncreator/EnumDeserializationUsingJsonCreatorUnitTest.java similarity index 90% rename from jackson/src/test/java/com/baeldung/jackson/deserialization/enums/jsoncreator/EnumDeserializationUsingJsonCreatorUnitTest.java rename to jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/jsoncreator/EnumDeserializationUsingJsonCreatorUnitTest.java index d778cbe26b..1885040916 100644 --- a/jackson/src/test/java/com/baeldung/jackson/deserialization/enums/jsoncreator/EnumDeserializationUsingJsonCreatorUnitTest.java +++ b/jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/jsoncreator/EnumDeserializationUsingJsonCreatorUnitTest.java @@ -1,7 +1,8 @@ -package com.baeldung.jackson.deserialization.enums.jsoncreator; +package com.baeldung.jackson.enums.deserialization.jsoncreator; import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.IOException; + import org.junit.Test; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/jackson/src/test/java/com/baeldung/jackson/deserialization/enums/jsonproperty/EnumDeserializationUsingJsonPropertyUnitTest.java b/jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/jsonproperty/EnumDeserializationUsingJsonPropertyUnitTest.java similarity index 90% rename from jackson/src/test/java/com/baeldung/jackson/deserialization/enums/jsonproperty/EnumDeserializationUsingJsonPropertyUnitTest.java rename to jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/jsonproperty/EnumDeserializationUsingJsonPropertyUnitTest.java index 134f4a29cc..3697669447 100644 --- a/jackson/src/test/java/com/baeldung/jackson/deserialization/enums/jsonproperty/EnumDeserializationUsingJsonPropertyUnitTest.java +++ b/jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/jsonproperty/EnumDeserializationUsingJsonPropertyUnitTest.java @@ -1,7 +1,8 @@ -package com.baeldung.jackson.deserialization.enums.jsonproperty; +package com.baeldung.jackson.enums.deserialization.jsonproperty; import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.IOException; + import org.junit.Test; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/jackson/src/test/java/com/baeldung/jackson/deserialization/enums/jsonvalue/EnumDeserializationUsingJsonValueUnitTest.java b/jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/jsonvalue/EnumDeserializationUsingJsonValueUnitTest.java similarity index 90% rename from jackson/src/test/java/com/baeldung/jackson/deserialization/enums/jsonvalue/EnumDeserializationUsingJsonValueUnitTest.java rename to jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/jsonvalue/EnumDeserializationUsingJsonValueUnitTest.java index 85afcb9a69..84ba40d018 100644 --- a/jackson/src/test/java/com/baeldung/jackson/deserialization/enums/jsonvalue/EnumDeserializationUsingJsonValueUnitTest.java +++ b/jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/jsonvalue/EnumDeserializationUsingJsonValueUnitTest.java @@ -1,7 +1,8 @@ -package com.baeldung.jackson.deserialization.enums.jsonvalue; +package com.baeldung.jackson.enums.deserialization.jsonvalue; import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.IOException; + import org.junit.Test; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/jackson/src/test/java/com/baeldung/jackson/enums/JacksonEnumSerializationUnitTest.java b/jackson-conversions/src/test/java/com/baeldung/jackson/enums/serialization/JacksonEnumSerializationUnitTest.java similarity index 92% rename from jackson/src/test/java/com/baeldung/jackson/enums/JacksonEnumSerializationUnitTest.java rename to jackson-conversions/src/test/java/com/baeldung/jackson/enums/serialization/JacksonEnumSerializationUnitTest.java index d4fb2401ed..b2cce15cfc 100644 --- a/jackson/src/test/java/com/baeldung/jackson/enums/JacksonEnumSerializationUnitTest.java +++ b/jackson-conversions/src/test/java/com/baeldung/jackson/enums/serialization/JacksonEnumSerializationUnitTest.java @@ -1,8 +1,9 @@ -package com.baeldung.jackson.enums; +package com.baeldung.jackson.enums.serialization; import static org.hamcrest.Matchers.containsString; import static org.junit.Assert.assertThat; import java.io.IOException; + import org.junit.Test; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/jackson/src/test/java/com/baeldung/jackson/test/JacksonSerializationEnumsUnitTest.java b/jackson-conversions/src/test/java/com/baeldung/jackson/enums/serialization/JacksonSerializationEnumsUnitTest.java similarity index 85% rename from jackson/src/test/java/com/baeldung/jackson/test/JacksonSerializationEnumsUnitTest.java rename to jackson-conversions/src/test/java/com/baeldung/jackson/enums/serialization/JacksonSerializationEnumsUnitTest.java index 0f57d26d8b..6b4a1ee3d4 100644 --- a/jackson/src/test/java/com/baeldung/jackson/test/JacksonSerializationEnumsUnitTest.java +++ b/jackson-conversions/src/test/java/com/baeldung/jackson/enums/serialization/JacksonSerializationEnumsUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.test; +package com.baeldung.jackson.enums.serialization; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.is; @@ -8,12 +8,12 @@ import java.io.IOException; import org.junit.Test; -import com.baeldung.jackson.dtos.withEnum.DistanceEnumSimple; -import com.baeldung.jackson.dtos.withEnum.DistanceEnumWithJsonFormat; -import com.baeldung.jackson.dtos.withEnum.DistanceEnumWithValue; -import com.baeldung.jackson.dtos.withEnum.MyDtoWithEnumCustom; -import com.baeldung.jackson.dtos.withEnum.MyDtoWithEnumJsonFormat; -import com.baeldung.jackson.enums.Distance; +import com.baeldung.jackson.enums.withEnum.DistanceEnumSimple; +import com.baeldung.jackson.enums.withEnum.DistanceEnumWithJsonFormat; +import com.baeldung.jackson.enums.withEnum.DistanceEnumWithValue; +import com.baeldung.jackson.enums.withEnum.MyDtoWithEnumCustom; +import com.baeldung.jackson.enums.withEnum.MyDtoWithEnumJsonFormat; +import com.baeldung.jackson.enums.serialization.Distance; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/jackson/src/test/java/com/baeldung/jackson/test/JacksonFieldUnitTest.java b/jackson-conversions/src/test/java/com/baeldung/jackson/field/JacksonFieldUnitTest.java similarity index 95% rename from jackson/src/test/java/com/baeldung/jackson/test/JacksonFieldUnitTest.java rename to jackson-conversions/src/test/java/com/baeldung/jackson/field/JacksonFieldUnitTest.java index ccc5905e88..4eb3cd5e0a 100644 --- a/jackson/src/test/java/com/baeldung/jackson/test/JacksonFieldUnitTest.java +++ b/jackson-conversions/src/test/java/com/baeldung/jackson/field/JacksonFieldUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.test; +package com.baeldung.jackson.field; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; @@ -7,10 +7,6 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertThat; import java.io.IOException; - -import com.baeldung.jackson.field.MyDtoAccessLevel; -import com.baeldung.jackson.field.MyDtoWithSetter; -import com.baeldung.jackson.field.MyDtoWithGetter; import org.junit.Test; import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; diff --git a/jackson/src/test/java/com/baeldung/jackson/deserialization/immutable/ImmutableObjectDeserializationUnitTest.java b/jackson-conversions/src/test/java/com/baeldung/jackson/immutable/ImmutableObjectDeserializationUnitTest.java similarity index 95% rename from jackson/src/test/java/com/baeldung/jackson/deserialization/immutable/ImmutableObjectDeserializationUnitTest.java rename to jackson-conversions/src/test/java/com/baeldung/jackson/immutable/ImmutableObjectDeserializationUnitTest.java index 1252179e3a..ed80b15b4f 100644 --- a/jackson/src/test/java/com/baeldung/jackson/deserialization/immutable/ImmutableObjectDeserializationUnitTest.java +++ b/jackson-conversions/src/test/java/com/baeldung/jackson/immutable/ImmutableObjectDeserializationUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.deserialization.immutable; +package com.baeldung.jackson.immutable; import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.Test; diff --git a/jackson/src/test/java/com/baeldung/jackson/deserialization/JacksonMapDeserializeUnitTest.java b/jackson-conversions/src/test/java/com/baeldung/jackson/map/JacksonMapDeserializeUnitTest.java similarity index 93% rename from jackson/src/test/java/com/baeldung/jackson/deserialization/JacksonMapDeserializeUnitTest.java rename to jackson-conversions/src/test/java/com/baeldung/jackson/map/JacksonMapDeserializeUnitTest.java index 1c3e95241a..0e59eb68bf 100644 --- a/jackson/src/test/java/com/baeldung/jackson/deserialization/JacksonMapDeserializeUnitTest.java +++ b/jackson-conversions/src/test/java/com/baeldung/jackson/map/JacksonMapDeserializeUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.deserialization; +package com.baeldung.jackson.map; import java.io.IOException; import java.util.HashMap; @@ -7,8 +7,6 @@ import java.util.Map; import org.junit.Assert; import org.junit.Test; -import com.baeldung.jackson.entities.ClassWithAMap; -import com.baeldung.jackson.entities.MyPair; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.JsonMappingException; diff --git a/jackson/src/test/java/com/baeldung/jackson/serialization/JacksonMapSerializeUnitTest.java b/jackson-conversions/src/test/java/com/baeldung/jackson/map/JacksonMapSerializeUnitTest.java similarity index 95% rename from jackson/src/test/java/com/baeldung/jackson/serialization/JacksonMapSerializeUnitTest.java rename to jackson-conversions/src/test/java/com/baeldung/jackson/map/JacksonMapSerializeUnitTest.java index e67336f6f3..0545e53201 100644 --- a/jackson/src/test/java/com/baeldung/jackson/serialization/JacksonMapSerializeUnitTest.java +++ b/jackson-conversions/src/test/java/com/baeldung/jackson/map/JacksonMapSerializeUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.serialization; +package com.baeldung.jackson.map; import java.util.HashMap; import java.util.Map; @@ -6,7 +6,6 @@ import java.util.Map; import org.junit.Assert; import org.junit.Test; -import com.baeldung.jackson.entities.MyPair; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.annotation.JsonSerialize; diff --git a/jackson-conversions/src/test/java/com/baeldung/jackson/mapnull/JacksonMapNullUnitTest.java b/jackson-conversions/src/test/java/com/baeldung/jackson/mapnull/JacksonMapNullUnitTest.java new file mode 100644 index 0000000000..274100162a --- /dev/null +++ b/jackson-conversions/src/test/java/com/baeldung/jackson/mapnull/JacksonMapNullUnitTest.java @@ -0,0 +1,109 @@ +package com.baeldung.jackson.mapnull; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.ser.BeanPropertyWriter; +import com.fasterxml.jackson.databind.ser.FilterProvider; +import com.fasterxml.jackson.databind.ser.PropertyFilter; +import com.fasterxml.jackson.databind.ser.PropertyWriter; +import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; +import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; +import org.junit.Test; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.not; +import static org.junit.Assert.assertThat; + +public class JacksonMapNullUnitTest { + + @Test + public final void givenIgnoringMapNullValue_whenWritingMapObjectWithNullValue_thenIgnored() throws JsonProcessingException { + final ObjectMapper mapper = new ObjectMapper(); + // mapper.configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false); + mapper.setSerializationInclusion(Include.NON_NULL); + + final MyDto dtoObject1 = new MyDto(); + + final Map<String, MyDto> dtoMap = new HashMap<String, MyDto>(); + dtoMap.put("dtoObject1", dtoObject1); + dtoMap.put("dtoObject2", null); + + final String dtoMapAsString = mapper.writeValueAsString(dtoMap); + + assertThat(dtoMapAsString, containsString("dtoObject1")); + assertThat(dtoMapAsString, not(containsString("dtoObject2"))); + System.out.println(dtoMapAsString); + } + + @Test + public final void givenIgnoringMapValueObjectWithNullField_whenWritingMapValueObjectWithNullField_thenIgnored() throws JsonProcessingException { + final ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + + final MyDto dtoObject = new MyDto(); + + final Map<String, MyDto> dtoMap = new HashMap<String, MyDto>(); + dtoMap.put("dtoObject", dtoObject); + + final String dtoMapAsString = mapper.writeValueAsString(dtoMap); + + assertThat(dtoMapAsString, containsString("dtoObject")); + assertThat(dtoMapAsString, not(containsString("stringValue"))); + System.out.println(dtoMapAsString); + } + + @Test + public final void givenAllowingMapObjectWithNullKey_whenWriting_thenCorrect() throws JsonProcessingException { + final ObjectMapper mapper = new ObjectMapper(); + mapper.getSerializerProvider() + .setNullKeySerializer(new MyDtoNullKeySerializer()); + + final MyDto dtoObject1 = new MyDto(); + dtoObject1.setStringValue("dtoObjectString1"); + final MyDto dtoObject2 = new MyDto(); + dtoObject2.setStringValue("dtoObjectString2"); + + final Map<String, MyDto> dtoMap = new HashMap<String, MyDto>(); + dtoMap.put(null, dtoObject1); + dtoMap.put("obj2", dtoObject2); + + final String dtoMapAsString = mapper.writeValueAsString(dtoMap); + + System.out.println(dtoMapAsString); + assertThat(dtoMapAsString, containsString("\"\"")); + assertThat(dtoMapAsString, containsString("dtoObjectString1")); + assertThat(dtoMapAsString, containsString("obj2")); + } + + @Test + public final void givenAllowingMapObjectOneNullKey_whenWritingMapObjectWithTwoNullKeys_thenOverride() throws JsonProcessingException { + final ObjectMapper mapper = new ObjectMapper(); + mapper.getSerializerProvider() + .setNullKeySerializer(new MyDtoNullKeySerializer()); + + final MyDto dtoObject1 = new MyDto(); + dtoObject1.setStringValue("dtoObject1String"); + + final MyDto dtoObject2 = new MyDto(); + dtoObject2.setStringValue("dtoObject2String"); + + final Map<String, MyDto> dtoMap = new HashMap<String, MyDto>(); + dtoMap.put(null, dtoObject1); + dtoMap.put(null, dtoObject2); + + final String dtoMapAsString = mapper.writeValueAsString(dtoMap); + + assertThat(dtoMapAsString, not(containsString("dtoObject1String"))); + assertThat(dtoMapAsString, containsString("dtoObject2String")); + System.out.println(dtoMapAsString); + } + +} diff --git a/jackson/src/test/java/com/baeldung/jackson/deserialization/nested/DeserializeWithNestedPropertiesUnitTest.java b/jackson-conversions/src/test/java/com/baeldung/jackson/nested/DeserializeWithNestedPropertiesUnitTest.java similarity index 95% rename from jackson/src/test/java/com/baeldung/jackson/deserialization/nested/DeserializeWithNestedPropertiesUnitTest.java rename to jackson-conversions/src/test/java/com/baeldung/jackson/nested/DeserializeWithNestedPropertiesUnitTest.java index 037bc7e880..18fd2463e9 100644 --- a/jackson/src/test/java/com/baeldung/jackson/deserialization/nested/DeserializeWithNestedPropertiesUnitTest.java +++ b/jackson-conversions/src/test/java/com/baeldung/jackson/nested/DeserializeWithNestedPropertiesUnitTest.java @@ -1,70 +1,70 @@ -package com.baeldung.jackson.deserialization.nested; - -import static org.junit.Assert.*; - -import java.io.IOException; - -import org.junit.Test; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.module.SimpleModule; - -public class DeserializeWithNestedPropertiesUnitTest { - - private String SOURCE_JSON = "{\"id\":\"957c43f2-fa2e-42f9-bf75-6e3d5bb6960a\",\"name\":\"The Best Product\",\"brand\":{\"id\":\"9bcd817d-0141-42e6-8f04-e5aaab0980b6\",\"name\":\"ACME Products\",\"owner\":{\"id\":\"b21a80b1-0c09-4be3-9ebd-ea3653511c13\",\"name\":\"Ultimate Corp, Inc.\"}}}"; - - @Test - public void whenUsingAnnotations_thenOk() throws IOException { - Product product = new ObjectMapper().readerFor(Product.class) - .readValue(SOURCE_JSON); - - assertEquals(product.getName(), "The Best Product"); - assertEquals(product.getBrandName(), "ACME Products"); - assertEquals(product.getOwnerName(), "Ultimate Corp, Inc."); - } - - @Test - public void whenUsingJsonNode_thenOk() throws IOException { - JsonNode productNode = new ObjectMapper().readTree(SOURCE_JSON); - - Product product = new Product(); - product.setId(productNode.get("id") - .textValue()); - product.setName(productNode.get("name") - .textValue()); - product.setBrandName(productNode.get("brand") - .get("name") - .textValue()); - product.setOwnerName(productNode.get("brand") - .get("owner") - .get("name") - .textValue()); - - assertEquals(product.getName(), "The Best Product"); - assertEquals(product.getBrandName(), "ACME Products"); - assertEquals(product.getOwnerName(), "Ultimate Corp, Inc."); - } - - @Test - public void whenUsingDeserializerManuallyRegistered_thenOk() throws IOException { - ObjectMapper mapper = new ObjectMapper(); - SimpleModule module = new SimpleModule(); - module.addDeserializer(Product.class, new ProductDeserializer()); - mapper.registerModule(module); - - Product product = mapper.readValue(SOURCE_JSON, Product.class); - assertEquals(product.getName(), "The Best Product"); - assertEquals(product.getBrandName(), "ACME Products"); - assertEquals(product.getOwnerName(), "Ultimate Corp, Inc."); - } - - @Test - public void whenUsingDeserializerAutoRegistered_thenOk() throws IOException { - ObjectMapper mapper = new ObjectMapper(); - Product product = mapper.readValue(SOURCE_JSON, Product.class); - assertEquals(product.getName(), "The Best Product"); - assertEquals(product.getBrandName(), "ACME Products"); - assertEquals(product.getOwnerName(), "Ultimate Corp, Inc."); - } -} +package com.baeldung.jackson.nested; + +import static org.junit.Assert.*; + +import java.io.IOException; + +import org.junit.Test; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.module.SimpleModule; + +public class DeserializeWithNestedPropertiesUnitTest { + + private String SOURCE_JSON = "{\"id\":\"957c43f2-fa2e-42f9-bf75-6e3d5bb6960a\",\"name\":\"The Best Product\",\"brand\":{\"id\":\"9bcd817d-0141-42e6-8f04-e5aaab0980b6\",\"name\":\"ACME Products\",\"owner\":{\"id\":\"b21a80b1-0c09-4be3-9ebd-ea3653511c13\",\"name\":\"Ultimate Corp, Inc.\"}}}"; + + @Test + public void whenUsingAnnotations_thenOk() throws IOException { + Product product = new ObjectMapper().readerFor(Product.class) + .readValue(SOURCE_JSON); + + assertEquals(product.getName(), "The Best Product"); + assertEquals(product.getBrandName(), "ACME Products"); + assertEquals(product.getOwnerName(), "Ultimate Corp, Inc."); + } + + @Test + public void whenUsingJsonNode_thenOk() throws IOException { + JsonNode productNode = new ObjectMapper().readTree(SOURCE_JSON); + + Product product = new Product(); + product.setId(productNode.get("id") + .textValue()); + product.setName(productNode.get("name") + .textValue()); + product.setBrandName(productNode.get("brand") + .get("name") + .textValue()); + product.setOwnerName(productNode.get("brand") + .get("owner") + .get("name") + .textValue()); + + assertEquals(product.getName(), "The Best Product"); + assertEquals(product.getBrandName(), "ACME Products"); + assertEquals(product.getOwnerName(), "Ultimate Corp, Inc."); + } + + @Test + public void whenUsingDeserializerManuallyRegistered_thenOk() throws IOException { + ObjectMapper mapper = new ObjectMapper(); + SimpleModule module = new SimpleModule(); + module.addDeserializer(Product.class, new ProductDeserializer()); + mapper.registerModule(module); + + Product product = mapper.readValue(SOURCE_JSON, Product.class); + assertEquals(product.getName(), "The Best Product"); + assertEquals(product.getBrandName(), "ACME Products"); + assertEquals(product.getOwnerName(), "Ultimate Corp, Inc."); + } + + @Test + public void whenUsingDeserializerAutoRegistered_thenOk() throws IOException { + ObjectMapper mapper = new ObjectMapper(); + Product product = mapper.readValue(SOURCE_JSON, Product.class); + assertEquals(product.getName(), "The Best Product"); + assertEquals(product.getBrandName(), "ACME Products"); + assertEquals(product.getOwnerName(), "Ultimate Corp, Inc."); + } +} diff --git a/jackson/src/test/java/com/baeldung/jackson/deserialization/nested/Product.java b/jackson-conversions/src/test/java/com/baeldung/jackson/nested/Product.java similarity index 91% rename from jackson/src/test/java/com/baeldung/jackson/deserialization/nested/Product.java rename to jackson-conversions/src/test/java/com/baeldung/jackson/nested/Product.java index 0020afea0f..5aeb53f7e8 100644 --- a/jackson/src/test/java/com/baeldung/jackson/deserialization/nested/Product.java +++ b/jackson-conversions/src/test/java/com/baeldung/jackson/nested/Product.java @@ -1,55 +1,55 @@ -package com.baeldung.jackson.deserialization.nested; - -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -@JsonDeserialize(using = ProductDeserializer.class) -public class Product { - - private String id; - private String name; - private String brandName; - private String ownerName; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getBrandName() { - return brandName; - } - - public void setBrandName(String brandName) { - this.brandName = brandName; - } - - public String getOwnerName() { - return ownerName; - } - - public void setOwnerName(String ownerName) { - this.ownerName = ownerName; - } - - @SuppressWarnings("unchecked") - @JsonProperty("brand") - private void unpackNested(Map<String, Object> brand) { - this.brandName = (String) brand.get("name"); - Map<String, String> owner = (Map<String, String>) brand.get("owner"); - this.ownerName = owner.get("name"); - } +package com.baeldung.jackson.nested; + +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +@JsonDeserialize(using = ProductDeserializer.class) +public class Product { + + private String id; + private String name; + private String brandName; + private String ownerName; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getBrandName() { + return brandName; + } + + public void setBrandName(String brandName) { + this.brandName = brandName; + } + + public String getOwnerName() { + return ownerName; + } + + public void setOwnerName(String ownerName) { + this.ownerName = ownerName; + } + + @SuppressWarnings("unchecked") + @JsonProperty("brand") + private void unpackNested(Map<String, Object> brand) { + this.brandName = (String) brand.get("name"); + Map<String, String> owner = (Map<String, String>) brand.get("owner"); + this.ownerName = owner.get("name"); + } } \ No newline at end of file diff --git a/jackson/src/test/java/com/baeldung/jackson/deserialization/nested/ProductDeserializer.java b/jackson-conversions/src/test/java/com/baeldung/jackson/nested/ProductDeserializer.java similarity index 92% rename from jackson/src/test/java/com/baeldung/jackson/deserialization/nested/ProductDeserializer.java rename to jackson-conversions/src/test/java/com/baeldung/jackson/nested/ProductDeserializer.java index daabae6cda..191bfbf0d8 100644 --- a/jackson/src/test/java/com/baeldung/jackson/deserialization/nested/ProductDeserializer.java +++ b/jackson-conversions/src/test/java/com/baeldung/jackson/nested/ProductDeserializer.java @@ -1,40 +1,40 @@ -package com.baeldung.jackson.deserialization.nested; - -import java.io.IOException; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; - -@SuppressWarnings("serial") -public class ProductDeserializer extends StdDeserializer<Product> { - - public ProductDeserializer() { - this(null); - } - - public ProductDeserializer(Class<?> vc) { - super(vc); - } - - @Override - public Product deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { - JsonNode productNode = jp.getCodec() - .readTree(jp); - Product product = new Product(); - product.setId(productNode.get("id") - .textValue()); - product.setName(productNode.get("name") - .textValue()); - product.setBrandName(productNode.get("brand") - .get("name") - .textValue()); - product.setOwnerName(productNode.get("brand") - .get("owner") - .get("name") - .textValue()); - return product; - } -} +package com.baeldung.jackson.nested; + +import java.io.IOException; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; + +@SuppressWarnings("serial") +public class ProductDeserializer extends StdDeserializer<Product> { + + public ProductDeserializer() { + this(null); + } + + public ProductDeserializer(Class<?> vc) { + super(vc); + } + + @Override + public Product deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode productNode = jp.getCodec() + .readTree(jp); + Product product = new Product(); + product.setId(productNode.get("id") + .textValue()); + product.setName(productNode.get("name") + .textValue()); + product.setBrandName(productNode.get("brand") + .get("name") + .textValue()); + product.setOwnerName(productNode.get("brand") + .get("owner") + .get("name") + .textValue()); + return product; + } +} diff --git a/jackson/src/test/java/com/baeldung/jackson/test/JacksonCollectionDeserializationUnitTest.java b/jackson-conversions/src/test/java/com/baeldung/jackson/tocollection/JacksonCollectionDeserializationUnitTest.java similarity index 97% rename from jackson/src/test/java/com/baeldung/jackson/test/JacksonCollectionDeserializationUnitTest.java rename to jackson-conversions/src/test/java/com/baeldung/jackson/tocollection/JacksonCollectionDeserializationUnitTest.java index 0de3a1de82..b1e8e48a95 100644 --- a/jackson/src/test/java/com/baeldung/jackson/test/JacksonCollectionDeserializationUnitTest.java +++ b/jackson-conversions/src/test/java/com/baeldung/jackson/tocollection/JacksonCollectionDeserializationUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.test; +package com.baeldung.jackson.tocollection; import static org.hamcrest.Matchers.instanceOf; import static org.junit.Assert.assertThat; @@ -6,8 +6,6 @@ import static org.junit.Assert.assertThat; import java.io.IOException; import java.util.LinkedHashMap; import java.util.List; - -import com.baeldung.jackson.dtos.MyDto; import org.junit.Test; import com.fasterxml.jackson.core.JsonParseException; diff --git a/jackson-conversions/src/test/java/com/baeldung/jackson/tojsonnode/StringToJsonNodeUnitTest.java b/jackson-conversions/src/test/java/com/baeldung/jackson/tojsonnode/StringToJsonNodeUnitTest.java new file mode 100644 index 0000000000..3d2423c85c --- /dev/null +++ b/jackson-conversions/src/test/java/com/baeldung/jackson/tojsonnode/StringToJsonNodeUnitTest.java @@ -0,0 +1,51 @@ +package com.baeldung.jackson.tojsonnode; + +import com.fasterxml.jackson.core.JsonFactory; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import org.junit.Test; + +import java.io.IOException; + +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class StringToJsonNodeUnitTest { + + @Test + public final void whenParsingJsonStringIntoJsonNode_thenCorrect() throws JsonParseException, IOException { + final String jsonString = "{\"k1\":\"v1\",\"k2\":\"v2\"}"; + + final ObjectMapper mapper = new ObjectMapper(); + final JsonNode actualObj = mapper.readTree(jsonString); + + assertNotNull(actualObj); + } + + @Test + public final void givenUsingLowLevelDetails_whenParsingJsonStringIntoJsonNode_thenCorrect() throws JsonParseException, IOException { + final String jsonString = "{\"k1\":\"v1\",\"k2\":\"v2\"}"; + + final ObjectMapper mapper = new ObjectMapper(); + final JsonFactory factory = mapper.getFactory(); + final JsonParser parser = factory.createParser(jsonString); + final JsonNode actualObj = mapper.readTree(parser); + + assertNotNull(actualObj); + } + + @Test + public final void givenTheJsonNode_whenRetrievingDataFromId_thenCorrect() throws JsonParseException, IOException { + final String jsonString = "{\"k1\":\"v1\",\"k2\":\"v2\"}"; + final ObjectMapper mapper = new ObjectMapper(); + final JsonNode actualObj = mapper.readTree(jsonString); + + // When + final JsonNode jsonNode1 = actualObj.get("k1"); + assertThat(jsonNode1.textValue(), equalTo("v1")); + } + +} diff --git a/jackson/src/test/java/com/baeldung/jackson/xml/XMLSerializeDeserializeUnitTest.java b/jackson-conversions/src/test/java/com/baeldung/jackson/xml/XMLSerializeDeserializeUnitTest.java similarity index 98% rename from jackson/src/test/java/com/baeldung/jackson/xml/XMLSerializeDeserializeUnitTest.java rename to jackson-conversions/src/test/java/com/baeldung/jackson/xml/XMLSerializeDeserializeUnitTest.java index 1d430e9758..74ba28d996 100644 --- a/jackson/src/test/java/com/baeldung/jackson/xml/XMLSerializeDeserializeUnitTest.java +++ b/jackson-conversions/src/test/java/com/baeldung/jackson/xml/XMLSerializeDeserializeUnitTest.java @@ -16,8 +16,6 @@ import java.util.List; import org.junit.Test; -import com.baeldung.jackson.dtos.Address; -import com.baeldung.jackson.dtos.Person; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.dataformat.xml.XmlMapper; diff --git a/jackson/src/test/resources/simple_bean.xml b/jackson-conversions/src/test/resources/simple_bean.xml similarity index 100% rename from jackson/src/test/resources/simple_bean.xml rename to jackson-conversions/src/test/resources/simple_bean.xml diff --git a/jackson-custom-conversions/README.md b/jackson-custom-conversions/README.md new file mode 100644 index 0000000000..68e9a6d50d --- /dev/null +++ b/jackson-custom-conversions/README.md @@ -0,0 +1,9 @@ +## Jackson Custom Conversions + +This module contains articles about Jackson custom conversions. + +### Relevant Articles: +- [Jackson – Custom Serializer](https://www.baeldung.com/jackson-custom-serialization) +- [Getting Started with Custom Deserialization in Jackson](https://www.baeldung.com/jackson-deserialization) +- [Serialize Only Fields that meet a Custom Criteria with Jackson](https://www.baeldung.com/jackson-serialize-field-custom-criteria) +- [Calling Default Serializer from Custom Serializer in Jackson](https://www.baeldung.com/jackson-call-default-serializer-from-custom-serializer) diff --git a/jackson-custom-conversions/pom.xml b/jackson-custom-conversions/pom.xml new file mode 100644 index 0000000000..68c785e972 --- /dev/null +++ b/jackson-custom-conversions/pom.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>jackson-custom-conversions</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>jackson-custom-conversions</name> + + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-java</artifactId> + <version>0.0.1-SNAPSHOT</version> + <relativePath>../parent-java</relativePath> + </parent> + + <dependencies> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>${jackson.version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.datatype</groupId> + <artifactId>jackson-datatype-jsr310</artifactId> + <version>${jackson.version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.datatype</groupId> + <artifactId>jackson-datatype-joda</artifactId> + <version>${jackson.version}</version> + </dependency> + </dependencies> + + <build> + <finalName>jackson-custom-conversions</finalName> + <resources> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + </resource> + </resources> + </build> + +</project> diff --git a/jackson-2/src/main/java/com/baeldung/jackson/entities/File.java b/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/File.java similarity index 84% rename from jackson-2/src/main/java/com/baeldung/jackson/entities/File.java rename to jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/File.java index 0e8829e927..791ad3a466 100644 --- a/jackson-2/src/main/java/com/baeldung/jackson/entities/File.java +++ b/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/File.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.entities; +package com.baeldung.defaultserializercustomserializer; public class File { diff --git a/jackson-2/src/main/java/com/baeldung/jackson/entities/Folder.java b/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/Folder.java similarity index 95% rename from jackson-2/src/main/java/com/baeldung/jackson/entities/Folder.java rename to jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/Folder.java index c49e46b204..6f423059a2 100644 --- a/jackson-2/src/main/java/com/baeldung/jackson/entities/Folder.java +++ b/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/Folder.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.entities; +package com.baeldung.defaultserializercustomserializer; import java.util.ArrayList; import java.util.Date; diff --git a/jackson-2/src/main/java/com/baeldung/jackson/serialization/custom/serializer/FolderBeanSerializerModifier.java b/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderBeanSerializerModifier.java similarity index 86% rename from jackson-2/src/main/java/com/baeldung/jackson/serialization/custom/serializer/FolderBeanSerializerModifier.java rename to jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderBeanSerializerModifier.java index a3add58dc4..819971939c 100644 --- a/jackson-2/src/main/java/com/baeldung/jackson/serialization/custom/serializer/FolderBeanSerializerModifier.java +++ b/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderBeanSerializerModifier.java @@ -1,6 +1,5 @@ -package com.baeldung.jackson.serialization.custom.serializer; +package com.baeldung.defaultserializercustomserializer; -import com.baeldung.jackson.entities.Folder; import com.fasterxml.jackson.databind.BeanDescription; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializationConfig; diff --git a/jackson-2/src/main/java/com/baeldung/jackson/serialization/custom/serializer/FolderSerializer.java b/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializer.java similarity index 85% rename from jackson-2/src/main/java/com/baeldung/jackson/serialization/custom/serializer/FolderSerializer.java rename to jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializer.java index f385e63e09..3869ab15d8 100644 --- a/jackson-2/src/main/java/com/baeldung/jackson/serialization/custom/serializer/FolderSerializer.java +++ b/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializer.java @@ -1,9 +1,7 @@ -package com.baeldung.jackson.serialization.custom.serializer; +package com.baeldung.defaultserializercustomserializer; import java.io.IOException; -import com.baeldung.jackson.entities.File; -import com.baeldung.jackson.entities.Folder; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.ser.std.StdSerializer; diff --git a/jackson-2/src/main/java/com/baeldung/jackson/serialization/custom/serializer/FolderSerializerWithCallingOwnSerializer.java b/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithCallingOwnSerializer.java similarity index 87% rename from jackson-2/src/main/java/com/baeldung/jackson/serialization/custom/serializer/FolderSerializerWithCallingOwnSerializer.java rename to jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithCallingOwnSerializer.java index ed5d9fffb8..544a4c6d1a 100644 --- a/jackson-2/src/main/java/com/baeldung/jackson/serialization/custom/serializer/FolderSerializerWithCallingOwnSerializer.java +++ b/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithCallingOwnSerializer.java @@ -1,8 +1,7 @@ -package com.baeldung.jackson.serialization.custom.serializer; +package com.baeldung.defaultserializercustomserializer; import java.io.IOException; -import com.baeldung.jackson.entities.Folder; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.ser.std.StdSerializer; diff --git a/jackson-2/src/main/java/com/baeldung/jackson/serialization/custom/serializer/FolderSerializerWithDefaultSerializerStored.java b/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithDefaultSerializerStored.java similarity index 90% rename from jackson-2/src/main/java/com/baeldung/jackson/serialization/custom/serializer/FolderSerializerWithDefaultSerializerStored.java rename to jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithDefaultSerializerStored.java index d4a95cd939..558b303301 100644 --- a/jackson-2/src/main/java/com/baeldung/jackson/serialization/custom/serializer/FolderSerializerWithDefaultSerializerStored.java +++ b/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithDefaultSerializerStored.java @@ -1,8 +1,7 @@ -package com.baeldung.jackson.serialization.custom.serializer; +package com.baeldung.defaultserializercustomserializer; import java.io.IOException; -import com.baeldung.jackson.entities.Folder; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; diff --git a/jackson-2/src/main/java/com/baeldung/jackson/serialization/custom/serializer/FolderSerializerWithInternalObjectMapper.java b/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithInternalObjectMapper.java similarity index 90% rename from jackson-2/src/main/java/com/baeldung/jackson/serialization/custom/serializer/FolderSerializerWithInternalObjectMapper.java rename to jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithInternalObjectMapper.java index b23dc32205..1ad51c63c0 100644 --- a/jackson-2/src/main/java/com/baeldung/jackson/serialization/custom/serializer/FolderSerializerWithInternalObjectMapper.java +++ b/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithInternalObjectMapper.java @@ -1,8 +1,7 @@ -package com.baeldung.jackson.serialization.custom.serializer; +package com.baeldung.defaultserializercustomserializer; import java.io.IOException; -import com.baeldung.jackson.entities.Folder; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializerProvider; diff --git a/jackson-2/src/main/java/com/baeldung/jackson/serialization/custom/serializer/FolderSerializerWithSerializerProvider.java b/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithSerializerProvider.java similarity index 87% rename from jackson-2/src/main/java/com/baeldung/jackson/serialization/custom/serializer/FolderSerializerWithSerializerProvider.java rename to jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithSerializerProvider.java index 81990a084d..8aeb28b3d0 100644 --- a/jackson-2/src/main/java/com/baeldung/jackson/serialization/custom/serializer/FolderSerializerWithSerializerProvider.java +++ b/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithSerializerProvider.java @@ -1,8 +1,7 @@ -package com.baeldung.jackson.serialization.custom.serializer; +package com.baeldung.defaultserializercustomserializer; import java.io.IOException; -import com.baeldung.jackson.entities.Folder; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.ser.std.StdSerializer; diff --git a/jackson/src/main/java/com/baeldung/jackson/entities/ActorJackson.java b/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ActorJackson.java similarity index 97% rename from jackson/src/main/java/com/baeldung/jackson/entities/ActorJackson.java rename to jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ActorJackson.java index 76f87d80b3..4bf3bc57f6 100644 --- a/jackson/src/main/java/com/baeldung/jackson/entities/ActorJackson.java +++ b/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ActorJackson.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.entities; +package com.baeldung.deserialization; import java.text.DateFormat; import java.text.SimpleDateFormat; diff --git a/jackson/src/test/java/com/baeldung/jackson/dtos/Item.java b/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/Item.java similarity index 92% rename from jackson/src/test/java/com/baeldung/jackson/dtos/Item.java rename to jackson-custom-conversions/src/main/java/com/baeldung/deserialization/Item.java index 6fce2bc88e..e6234bb6e9 100644 --- a/jackson/src/test/java/com/baeldung/jackson/dtos/Item.java +++ b/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/Item.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.dtos; +package com.baeldung.deserialization; public class Item { public int id; diff --git a/jackson/src/test/java/com/baeldung/jackson/deserialization/ItemDeserializer.java b/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ItemDeserializer.java similarity index 90% rename from jackson/src/test/java/com/baeldung/jackson/deserialization/ItemDeserializer.java rename to jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ItemDeserializer.java index bbc3f31a6c..7ae2faa04d 100644 --- a/jackson/src/test/java/com/baeldung/jackson/deserialization/ItemDeserializer.java +++ b/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ItemDeserializer.java @@ -1,9 +1,7 @@ -package com.baeldung.jackson.deserialization; +package com.baeldung.deserialization; import java.io.IOException; -import com.baeldung.jackson.dtos.Item; -import com.baeldung.jackson.dtos.User; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationContext; diff --git a/jackson/src/test/java/com/baeldung/jackson/deserialization/ItemDeserializerOnClass.java b/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ItemDeserializerOnClass.java similarity index 73% rename from jackson/src/test/java/com/baeldung/jackson/deserialization/ItemDeserializerOnClass.java rename to jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ItemDeserializerOnClass.java index eaba9a7173..b9db114c4a 100644 --- a/jackson/src/test/java/com/baeldung/jackson/deserialization/ItemDeserializerOnClass.java +++ b/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ItemDeserializerOnClass.java @@ -1,9 +1,7 @@ -package com.baeldung.jackson.deserialization; +package com.baeldung.deserialization; import java.io.IOException; -import com.baeldung.jackson.dtos.ItemWithSerializer; -import com.baeldung.jackson.dtos.User; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationContext; @@ -11,7 +9,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.deser.std.StdDeserializer; import com.fasterxml.jackson.databind.node.IntNode; -public class ItemDeserializerOnClass extends StdDeserializer<ItemWithSerializer> { +public class ItemDeserializerOnClass extends StdDeserializer<ItemWithDeserializer> { private static final long serialVersionUID = 5579141241817332594L; @@ -27,7 +25,7 @@ public class ItemDeserializerOnClass extends StdDeserializer<ItemWithSerializer> * {"id":1,"itemNr":"theItem","owner":2} */ @Override - public ItemWithSerializer deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException, JsonProcessingException { + public ItemWithDeserializer deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException, JsonProcessingException { final JsonNode node = jp.getCodec() .readTree(jp); final int id = (Integer) ((IntNode) node.get("id")).numberValue(); @@ -35,7 +33,7 @@ public class ItemDeserializerOnClass extends StdDeserializer<ItemWithSerializer> .asText(); final int userId = (Integer) ((IntNode) node.get("owner")).numberValue(); - return new ItemWithSerializer(id, itemName, new User(userId, null)); + return new ItemWithDeserializer(id, itemName, new User(userId, null)); } } \ No newline at end of file diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ItemWithDeserializer.java b/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ItemWithDeserializer.java new file mode 100644 index 0000000000..1ab36e4acd --- /dev/null +++ b/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ItemWithDeserializer.java @@ -0,0 +1,31 @@ +package com.baeldung.deserialization; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +@JsonDeserialize(using = ItemDeserializerOnClass.class) +public class ItemWithDeserializer { + public final int id; + public final String itemName; + public final User owner; + + public ItemWithDeserializer(final int id, final String itemName, final User owner) { + this.id = id; + this.itemName = itemName; + this.owner = owner; + } + + // API + + public int getId() { + return id; + } + + public String getItemName() { + return itemName; + } + + public User getOwner() { + return owner; + } + +} \ No newline at end of file diff --git a/jackson/src/main/java/com/baeldung/jackson/entities/Movie.java b/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/Movie.java similarity index 96% rename from jackson/src/main/java/com/baeldung/jackson/entities/Movie.java rename to jackson-custom-conversions/src/main/java/com/baeldung/deserialization/Movie.java index bdbb6c004f..fdb107dca2 100644 --- a/jackson/src/main/java/com/baeldung/jackson/entities/Movie.java +++ b/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/Movie.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.entities; +package com.baeldung.deserialization; import java.util.List; diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/User.java b/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/User.java new file mode 100644 index 0000000000..d22a85aafd --- /dev/null +++ b/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/User.java @@ -0,0 +1,26 @@ +package com.baeldung.deserialization; + +public class User { + public int id; + public String name; + + public User() { + super(); + } + + public User(final int id, final String name) { + this.id = id; + this.name = name; + } + + // API + + public int getId() { + return id; + } + + public String getName() { + return name; + } + +} \ No newline at end of file diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/dtos/Item.java b/jackson-custom-conversions/src/main/java/com/baeldung/serialization/Item.java similarity index 92% rename from jackson-simple/src/test/java/com/baeldung/jackson/dtos/Item.java rename to jackson-custom-conversions/src/main/java/com/baeldung/serialization/Item.java index 6fce2bc88e..52a73b048c 100644 --- a/jackson-simple/src/test/java/com/baeldung/jackson/dtos/Item.java +++ b/jackson-custom-conversions/src/main/java/com/baeldung/serialization/Item.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.dtos; +package com.baeldung.serialization; public class Item { public int id; diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/serialization/ItemSerializer.java b/jackson-custom-conversions/src/main/java/com/baeldung/serialization/ItemSerializer.java similarity index 91% rename from jackson-simple/src/test/java/com/baeldung/jackson/serialization/ItemSerializer.java rename to jackson-custom-conversions/src/main/java/com/baeldung/serialization/ItemSerializer.java index b5624c566a..dc0b5e1c88 100644 --- a/jackson-simple/src/test/java/com/baeldung/jackson/serialization/ItemSerializer.java +++ b/jackson-custom-conversions/src/main/java/com/baeldung/serialization/ItemSerializer.java @@ -1,8 +1,7 @@ -package com.baeldung.jackson.serialization; +package com.baeldung.serialization; import java.io.IOException; -import com.baeldung.jackson.dtos.Item; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.SerializerProvider; diff --git a/jackson/src/test/java/com/baeldung/jackson/serialization/ItemSerializerOnClass.java b/jackson-custom-conversions/src/main/java/com/baeldung/serialization/ItemSerializerOnClass.java similarity index 90% rename from jackson/src/test/java/com/baeldung/jackson/serialization/ItemSerializerOnClass.java rename to jackson-custom-conversions/src/main/java/com/baeldung/serialization/ItemSerializerOnClass.java index 1fdf44e17c..8f56c349f2 100644 --- a/jackson/src/test/java/com/baeldung/jackson/serialization/ItemSerializerOnClass.java +++ b/jackson-custom-conversions/src/main/java/com/baeldung/serialization/ItemSerializerOnClass.java @@ -1,8 +1,7 @@ -package com.baeldung.jackson.serialization; +package com.baeldung.serialization; import java.io.IOException; -import com.baeldung.jackson.dtos.ItemWithSerializer; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.SerializerProvider; diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/dtos/ItemWithSerializer.java b/jackson-custom-conversions/src/main/java/com/baeldung/serialization/ItemWithSerializer.java similarity index 74% rename from jackson-simple/src/test/java/com/baeldung/jackson/dtos/ItemWithSerializer.java rename to jackson-custom-conversions/src/main/java/com/baeldung/serialization/ItemWithSerializer.java index aea9aa770d..5b38ad1af6 100644 --- a/jackson-simple/src/test/java/com/baeldung/jackson/dtos/ItemWithSerializer.java +++ b/jackson-custom-conversions/src/main/java/com/baeldung/serialization/ItemWithSerializer.java @@ -1,13 +1,9 @@ -package com.baeldung.jackson.dtos; - -import com.baeldung.jackson.deserialization.ItemDeserializerOnClass; -import com.baeldung.jackson.serialization.ItemSerializerOnClass; +package com.baeldung.serialization; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; @JsonSerialize(using = ItemSerializerOnClass.class) -@JsonDeserialize(using = ItemDeserializerOnClass.class) public class ItemWithSerializer { public final int id; public final String itemName; diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/serialization/User.java b/jackson-custom-conversions/src/main/java/com/baeldung/serialization/User.java new file mode 100644 index 0000000000..b01ccc9ffb --- /dev/null +++ b/jackson-custom-conversions/src/main/java/com/baeldung/serialization/User.java @@ -0,0 +1,26 @@ +package com.baeldung.serialization; + +public class User { + public int id; + public String name; + + public User() { + super(); + } + + public User(final int id, final String name) { + this.id = id; + this.name = name; + } + + // API + + public int getId() { + return id; + } + + public String getName() { + return name; + } + +} \ No newline at end of file diff --git a/jackson/src/test/java/com/baeldung/jackson/dynamicIgnore/Address.java b/jackson-custom-conversions/src/main/java/com/baeldung/skipfields/Address.java similarity index 94% rename from jackson/src/test/java/com/baeldung/jackson/dynamicIgnore/Address.java rename to jackson-custom-conversions/src/main/java/com/baeldung/skipfields/Address.java index daca85f66a..a394bbc180 100644 --- a/jackson/src/test/java/com/baeldung/jackson/dynamicIgnore/Address.java +++ b/jackson-custom-conversions/src/main/java/com/baeldung/skipfields/Address.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.dynamicIgnore; +package com.baeldung.skipfields; public class Address implements Hidable { private String city; diff --git a/jackson/src/test/java/com/baeldung/jackson/dynamicIgnore/Hidable.java b/jackson-custom-conversions/src/main/java/com/baeldung/skipfields/Hidable.java similarity index 77% rename from jackson/src/test/java/com/baeldung/jackson/dynamicIgnore/Hidable.java rename to jackson-custom-conversions/src/main/java/com/baeldung/skipfields/Hidable.java index a32e6844a6..fff7f81d1e 100644 --- a/jackson/src/test/java/com/baeldung/jackson/dynamicIgnore/Hidable.java +++ b/jackson-custom-conversions/src/main/java/com/baeldung/skipfields/Hidable.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.dynamicIgnore; +package com.baeldung.skipfields; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; diff --git a/jackson/src/test/java/com/baeldung/jackson/dynamicIgnore/HidableSerializer.java b/jackson-custom-conversions/src/main/java/com/baeldung/skipfields/HidableSerializer.java similarity index 95% rename from jackson/src/test/java/com/baeldung/jackson/dynamicIgnore/HidableSerializer.java rename to jackson-custom-conversions/src/main/java/com/baeldung/skipfields/HidableSerializer.java index 46396dae2a..8b300444c0 100644 --- a/jackson/src/test/java/com/baeldung/jackson/dynamicIgnore/HidableSerializer.java +++ b/jackson-custom-conversions/src/main/java/com/baeldung/skipfields/HidableSerializer.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.dynamicIgnore; +package com.baeldung.skipfields; import java.io.IOException; diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/dtos/MyDtoWithFilter.java b/jackson-custom-conversions/src/main/java/com/baeldung/skipfields/MyDtoWithFilter.java similarity index 96% rename from jackson-simple/src/test/java/com/baeldung/jackson/dtos/MyDtoWithFilter.java rename to jackson-custom-conversions/src/main/java/com/baeldung/skipfields/MyDtoWithFilter.java index 91f5e148b2..50492c337a 100644 --- a/jackson-simple/src/test/java/com/baeldung/jackson/dtos/MyDtoWithFilter.java +++ b/jackson-custom-conversions/src/main/java/com/baeldung/skipfields/MyDtoWithFilter.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.dtos; +package com.baeldung.skipfields; import com.fasterxml.jackson.annotation.JsonFilter; diff --git a/jackson/src/test/java/com/baeldung/jackson/dynamicIgnore/Person.java b/jackson-custom-conversions/src/main/java/com/baeldung/skipfields/Person.java similarity index 94% rename from jackson/src/test/java/com/baeldung/jackson/dynamicIgnore/Person.java rename to jackson-custom-conversions/src/main/java/com/baeldung/skipfields/Person.java index daa62b4be6..e1501947d3 100644 --- a/jackson/src/test/java/com/baeldung/jackson/dynamicIgnore/Person.java +++ b/jackson-custom-conversions/src/main/java/com/baeldung/skipfields/Person.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.dynamicIgnore; +package com.baeldung.skipfields; public class Person implements Hidable { private String name; diff --git a/jackson-2/src/test/java/com/baeldung/jackson/serialization/custom/serializer/CallingDefaultSerializerUnitTest.java b/jackson-custom-conversions/src/test/java/com/baeldung/defaultserializercustomserializer/CallingDefaultSerializerUnitTest.java similarity index 97% rename from jackson-2/src/test/java/com/baeldung/jackson/serialization/custom/serializer/CallingDefaultSerializerUnitTest.java rename to jackson-custom-conversions/src/test/java/com/baeldung/defaultserializercustomserializer/CallingDefaultSerializerUnitTest.java index b067e7b501..c8b4ec7e1a 100644 --- a/jackson-2/src/test/java/com/baeldung/jackson/serialization/custom/serializer/CallingDefaultSerializerUnitTest.java +++ b/jackson-custom-conversions/src/test/java/com/baeldung/defaultserializercustomserializer/CallingDefaultSerializerUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.serialization.custom.serializer; +package com.baeldung.defaultserializercustomserializer; import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -14,8 +14,6 @@ import java.util.Map; import org.junit.Before; import org.junit.Test; -import com.baeldung.jackson.entities.File; -import com.baeldung.jackson.entities.Folder; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.module.SimpleModule; diff --git a/jackson-custom-conversions/src/test/java/com/baeldung/deserialization/CustomDeserializationUnitTest.java b/jackson-custom-conversions/src/test/java/com/baeldung/deserialization/CustomDeserializationUnitTest.java new file mode 100644 index 0000000000..f2a2502c3e --- /dev/null +++ b/jackson-custom-conversions/src/test/java/com/baeldung/deserialization/CustomDeserializationUnitTest.java @@ -0,0 +1,84 @@ +package com.baeldung.deserialization; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind.module.SimpleModule; +import org.junit.Test; + +import java.io.IOException; +import java.time.ZoneId; +import java.time.ZonedDateTime; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.not; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.notNullValue; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; + +public class CustomDeserializationUnitTest { + + @Test + public final void whenDeserializingTheStandardRepresentation_thenCorrect() throws JsonParseException, JsonMappingException, IOException { + final String json = "{\"id\":1,\"itemName\":\"theItem\",\"owner\":{\"id\":2,\"name\":\"theUser\"}}"; + + final Item readValue = new ObjectMapper().readValue(json, Item.class); + assertThat(readValue, notNullValue()); + } + + @Test + public final void whenDeserializingANonStandardRepresentation_thenCorrect() throws JsonParseException, JsonMappingException, IOException { + final String json = "{\"id\":1,\"itemName\":\"theItem\",\"createdBy\":2}"; + final ObjectMapper mapper = new ObjectMapper(); + + final SimpleModule module = new SimpleModule(); + module.addDeserializer(Item.class, new ItemDeserializer()); + mapper.registerModule(module); + + final Item readValue = mapper.readValue(json, Item.class); + assertThat(readValue, notNullValue()); + } + + @Test + public final void givenDeserializerIsOnClass_whenDeserializingCustomRepresentation_thenCorrect() throws JsonParseException, JsonMappingException, IOException { + final String json = "{\"id\":1,\"itemName\":\"theItem\",\"owner\":2}"; + + final ItemWithDeserializer readValue = new ObjectMapper().readValue(json, ItemWithDeserializer.class); + assertThat(readValue, notNullValue()); + } + + @Test + public void whenDeserialisingZonedDateTimeWithDefaults_thenTimeZoneIsNotPreserved() throws IOException { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.findAndRegisterModules(); + objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + // construct a new instance of ZonedDateTime + ZonedDateTime now = ZonedDateTime.now(ZoneId.of("Europe/Berlin")); + String converted = objectMapper.writeValueAsString(now); + // restore an instance of ZonedDateTime from String + ZonedDateTime restored = objectMapper.readValue(converted, ZonedDateTime.class); + System.out.println("serialized: " + now); + System.out.println("restored: " + restored); + assertThat(now, is(not(restored))); + } + + @Test + public void whenDeserialisingZonedDateTimeWithFeaturesDisabled_thenTimeZoneIsPreserved() throws IOException { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.findAndRegisterModules(); + objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + objectMapper.disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE); + // construct a new instance of ZonedDateTime + ZonedDateTime now = ZonedDateTime.now(ZoneId.of("Europe/Berlin")); + String converted = objectMapper.writeValueAsString(now); + // restore an instance of ZonedDateTime from String + ZonedDateTime restored = objectMapper.readValue(converted, ZonedDateTime.class); + System.out.println("serialized: " + now); + System.out.println("restored: " + restored); + assertThat(now, is(restored)); + } + +} diff --git a/jackson-custom-conversions/src/test/java/com/baeldung/serialization/CustomSerializationUnitTest.java b/jackson-custom-conversions/src/test/java/com/baeldung/serialization/CustomSerializationUnitTest.java new file mode 100644 index 0000000000..6cb4019fa2 --- /dev/null +++ b/jackson-custom-conversions/src/test/java/com/baeldung/serialization/CustomSerializationUnitTest.java @@ -0,0 +1,52 @@ +package com.baeldung.serialization; + +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.not; +import static org.hamcrest.Matchers.notNullValue; +import static org.junit.Assert.assertThat; + +import java.io.IOException; +import java.util.List; +import org.junit.Test; + +import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; +import com.fasterxml.jackson.annotation.PropertyAccessor; +import com.fasterxml.jackson.core.JsonGenerationException; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.google.common.collect.Lists; + +public class CustomSerializationUnitTest { + + @Test + public final void whenSerializing_thenNoExceptions() throws JsonGenerationException, JsonMappingException, IOException { + final Item myItem = new Item(1, "theItem", new User(2, "theUser")); + final String serialized = new ObjectMapper().writeValueAsString(myItem); + System.out.println(serialized); + } + + @Test + public final void whenSerializingWithCustomSerializer_thenNoExceptions() throws JsonGenerationException, JsonMappingException, IOException { + final Item myItem = new Item(1, "theItem", new User(2, "theUser")); + + final ObjectMapper mapper = new ObjectMapper(); + + final SimpleModule simpleModule = new SimpleModule(); + simpleModule.addSerializer(Item.class, new ItemSerializer()); + mapper.registerModule(simpleModule); + + final String serialized = mapper.writeValueAsString(myItem); + System.out.println(serialized); + } + + @Test + public final void givenSerializerRegisteredOnClass_whenSerializingWithCustomSerializer_thenNoExceptions() throws JsonGenerationException, JsonMappingException, IOException { + final ItemWithSerializer myItem = new ItemWithSerializer(1, "theItem", new User(2, "theUser")); + + final String serialized = new ObjectMapper().writeValueAsString(myItem); + System.out.println(serialized); + } + +} diff --git a/jackson-custom-conversions/src/test/java/com/baeldung/skipfields/IgnoreFieldsWithFilterUnitTest.java b/jackson-custom-conversions/src/test/java/com/baeldung/skipfields/IgnoreFieldsWithFilterUnitTest.java new file mode 100644 index 0000000000..e71f31bc6a --- /dev/null +++ b/jackson-custom-conversions/src/test/java/com/baeldung/skipfields/IgnoreFieldsWithFilterUnitTest.java @@ -0,0 +1,89 @@ +package com.baeldung.skipfields; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.ser.BeanPropertyWriter; +import com.fasterxml.jackson.databind.ser.FilterProvider; +import com.fasterxml.jackson.databind.ser.PropertyFilter; +import com.fasterxml.jackson.databind.ser.PropertyWriter; +import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; +import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; +import org.junit.Test; + +import java.io.IOException; + +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.not; +import static org.junit.Assert.assertThat; + +public class IgnoreFieldsWithFilterUnitTest { + + @Test + public final void givenTypeHasFilterThatIgnoresFieldByName_whenDtoIsSerialized_thenCorrect() throws JsonParseException, IOException { + final ObjectMapper mapper = new ObjectMapper(); + final SimpleBeanPropertyFilter theFilter = SimpleBeanPropertyFilter.serializeAllExcept("intValue"); + final FilterProvider filters = new SimpleFilterProvider().addFilter("myFilter", theFilter); + + final MyDtoWithFilter dtoObject = new MyDtoWithFilter(); + dtoObject.setIntValue(12); + + final String dtoAsString = mapper.writer(filters) + .writeValueAsString(dtoObject); + + assertThat(dtoAsString, not(containsString("intValue"))); + assertThat(dtoAsString, containsString("booleanValue")); + assertThat(dtoAsString, containsString("stringValue")); + System.out.println(dtoAsString); + } + + @Test + public final void givenTypeHasFilterThatIgnoresNegativeInt_whenDtoIsSerialized_thenCorrect() throws JsonParseException, IOException { + final PropertyFilter theFilter = new SimpleBeanPropertyFilter() { + @Override + public final void serializeAsField(final Object pojo, final JsonGenerator jgen, final SerializerProvider provider, final PropertyWriter writer) throws Exception { + if (include(writer)) { + if (!writer.getName() + .equals("intValue")) { + writer.serializeAsField(pojo, jgen, provider); + return; + } + + final int intValue = ((MyDtoWithFilter) pojo).getIntValue(); + if (intValue >= 0) { + writer.serializeAsField(pojo, jgen, provider); + } + } else if (!jgen.canOmitFields()) { // since 2.3 + writer.serializeAsOmittedField(pojo, jgen, provider); + } + } + + @Override + protected final boolean include(final BeanPropertyWriter writer) { + return true; + } + + @Override + protected final boolean include(final PropertyWriter writer) { + return true; + } + }; + final FilterProvider filters = new SimpleFilterProvider().addFilter("myFilter", theFilter); + + final MyDtoWithFilter dtoObject = new MyDtoWithFilter(); + dtoObject.setIntValue(-1); + + final ObjectMapper mapper = new ObjectMapper(); + final String dtoAsString = mapper.writer(filters) + .writeValueAsString(dtoObject); + + assertThat(dtoAsString, not(containsString("intValue"))); + assertThat(dtoAsString, containsString("booleanValue")); + assertThat(dtoAsString, containsString("stringValue")); + System.out.println(dtoAsString); + } + +} diff --git a/jackson/src/test/java/com/baeldung/jackson/test/JacksonDynamicIgnoreUnitTest.java b/jackson-custom-conversions/src/test/java/com/baeldung/skipfields/JacksonDynamicIgnoreUnitTest.java similarity index 93% rename from jackson/src/test/java/com/baeldung/jackson/test/JacksonDynamicIgnoreUnitTest.java rename to jackson-custom-conversions/src/test/java/com/baeldung/skipfields/JacksonDynamicIgnoreUnitTest.java index 2f0f45828b..6ba14f7476 100644 --- a/jackson/src/test/java/com/baeldung/jackson/test/JacksonDynamicIgnoreUnitTest.java +++ b/jackson-custom-conversions/src/test/java/com/baeldung/skipfields/JacksonDynamicIgnoreUnitTest.java @@ -1,14 +1,10 @@ -package com.baeldung.jackson.test; +package com.baeldung.skipfields; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.util.Arrays; -import com.baeldung.jackson.dynamicIgnore.Address; -import com.baeldung.jackson.dynamicIgnore.HidableSerializer; -import com.baeldung.jackson.dynamicIgnore.Person; -import com.baeldung.jackson.dynamicIgnore.Hidable; import org.junit.Before; import org.junit.Test; diff --git a/jackson-exceptions/README.md b/jackson-exceptions/README.md new file mode 100644 index 0000000000..6f082aaaa5 --- /dev/null +++ b/jackson-exceptions/README.md @@ -0,0 +1,7 @@ +## Jackson Exceptions + +This module contains articles about Jackson exceptions. + +### Relevant Articles: +- [Jackson Exceptions – Problems and Solutions](https://www.baeldung.com/jackson-exception) +- [Jackson – JsonMappingException (No serializer found for class)](https://www.baeldung.com/jackson-jsonmappingexception) diff --git a/jackson-exceptions/pom.xml b/jackson-exceptions/pom.xml new file mode 100644 index 0000000000..3cf4796fa7 --- /dev/null +++ b/jackson-exceptions/pom.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>jackson-exceptions</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>jackson-exceptions</name> + + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-java</artifactId> + <version>0.0.1-SNAPSHOT</version> + <relativePath>../parent-java</relativePath> + </parent> + + <dependencies> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>${jackson.version}</version> + </dependency> + </dependencies> + + <build> + <finalName>jackson-exceptions</finalName> + <resources> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + </resource> + </resources> + </build> + +</project> diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/dtos/User.java b/jackson-exceptions/src/main/java/com/baeldung/exceptions/User.java similarity index 90% rename from jackson-simple/src/test/java/com/baeldung/jackson/dtos/User.java rename to jackson-exceptions/src/main/java/com/baeldung/exceptions/User.java index 2418e8070d..e0e77c658e 100644 --- a/jackson-simple/src/test/java/com/baeldung/jackson/dtos/User.java +++ b/jackson-exceptions/src/main/java/com/baeldung/exceptions/User.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.dtos; +package com.baeldung.exceptions; public class User { public int id; diff --git a/jackson/src/test/java/com/baeldung/jackson/exception/UserWithConflict.java b/jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithConflict.java similarity index 91% rename from jackson/src/test/java/com/baeldung/jackson/exception/UserWithConflict.java rename to jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithConflict.java index 01ff695475..5adbb7b01e 100644 --- a/jackson/src/test/java/com/baeldung/jackson/exception/UserWithConflict.java +++ b/jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithConflict.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.exception; +package com.baeldung.exceptions; public class UserWithConflict { public int id; diff --git a/jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithNoDefaultConstructor.java b/jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithNoDefaultConstructor.java new file mode 100644 index 0000000000..c75b06ed6a --- /dev/null +++ b/jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithNoDefaultConstructor.java @@ -0,0 +1,21 @@ +package com.baeldung.exceptions; + +public class UserWithNoDefaultConstructor { + + private int id; + private String name; + + public UserWithNoDefaultConstructor(final int id, final String name) { + this.id = id; + this.name = name; + } + + public int getId() { + return id; + } + + public String getName() { + return name; + } + +} \ No newline at end of file diff --git a/jackson/src/test/java/com/baeldung/jackson/exception/UserWithPrivateFields.java b/jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithPrivateFields.java similarity index 86% rename from jackson/src/test/java/com/baeldung/jackson/exception/UserWithPrivateFields.java rename to jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithPrivateFields.java index f627975184..c10020bd85 100644 --- a/jackson/src/test/java/com/baeldung/jackson/exception/UserWithPrivateFields.java +++ b/jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithPrivateFields.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.exception; +package com.baeldung.exceptions; public class UserWithPrivateFields { int id; diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/exception/UserWithRoot.java b/jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithRoot.java similarity index 89% rename from jackson-simple/src/test/java/com/baeldung/jackson/exception/UserWithRoot.java rename to jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithRoot.java index d879c16e6a..cadcd43a72 100644 --- a/jackson-simple/src/test/java/com/baeldung/jackson/exception/UserWithRoot.java +++ b/jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithRoot.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.exception; +package com.baeldung.exceptions; import com.fasterxml.jackson.annotation.JsonRootName; diff --git a/jackson/src/test/java/com/baeldung/jackson/exception/Zoo.java b/jackson-exceptions/src/main/java/com/baeldung/exceptions/Zoo.java similarity index 84% rename from jackson/src/test/java/com/baeldung/jackson/exception/Zoo.java rename to jackson-exceptions/src/main/java/com/baeldung/exceptions/Zoo.java index 647b5955c0..3e729a1d2f 100644 --- a/jackson/src/test/java/com/baeldung/jackson/exception/Zoo.java +++ b/jackson-exceptions/src/main/java/com/baeldung/exceptions/Zoo.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.exception; +package com.baeldung.exceptions; public class Zoo { public Animal animal; diff --git a/jackson/src/test/java/com/baeldung/jackson/exception/ZooConfigured.java b/jackson-exceptions/src/main/java/com/baeldung/exceptions/ZooConfigured.java similarity index 91% rename from jackson/src/test/java/com/baeldung/jackson/exception/ZooConfigured.java rename to jackson-exceptions/src/main/java/com/baeldung/exceptions/ZooConfigured.java index f51b1e150a..31c2ce4d4c 100644 --- a/jackson/src/test/java/com/baeldung/jackson/exception/ZooConfigured.java +++ b/jackson-exceptions/src/main/java/com/baeldung/exceptions/ZooConfigured.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.exception; +package com.baeldung.exceptions; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/dtos/MyDtoNoAccessors.java b/jackson-exceptions/src/main/java/com/baeldung/mappingexception/MyDtoNoAccessors.java similarity index 91% rename from jackson-simple/src/test/java/com/baeldung/jackson/dtos/MyDtoNoAccessors.java rename to jackson-exceptions/src/main/java/com/baeldung/mappingexception/MyDtoNoAccessors.java index 6e9abc90ae..17bc5257fb 100644 --- a/jackson-simple/src/test/java/com/baeldung/jackson/dtos/MyDtoNoAccessors.java +++ b/jackson-exceptions/src/main/java/com/baeldung/mappingexception/MyDtoNoAccessors.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.dtos; +package com.baeldung.mappingexception; public class MyDtoNoAccessors { diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/dtos/MyDtoNoAccessorsAndFieldVisibility.java b/jackson-exceptions/src/main/java/com/baeldung/mappingexception/MyDtoNoAccessorsAndFieldVisibility.java similarity index 94% rename from jackson-simple/src/test/java/com/baeldung/jackson/dtos/MyDtoNoAccessorsAndFieldVisibility.java rename to jackson-exceptions/src/main/java/com/baeldung/mappingexception/MyDtoNoAccessorsAndFieldVisibility.java index 149969f769..cf5d5ca500 100644 --- a/jackson-simple/src/test/java/com/baeldung/jackson/dtos/MyDtoNoAccessorsAndFieldVisibility.java +++ b/jackson-exceptions/src/main/java/com/baeldung/mappingexception/MyDtoNoAccessorsAndFieldVisibility.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.dtos; +package com.baeldung.mappingexception; import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; diff --git a/jackson/src/test/java/com/baeldung/jackson/exception/test/JacksonExceptionsUnitTest.java b/jackson-exceptions/src/test/java/com/baeldung/exceptions/JacksonExceptionsUnitTest.java similarity index 86% rename from jackson/src/test/java/com/baeldung/jackson/exception/test/JacksonExceptionsUnitTest.java rename to jackson-exceptions/src/test/java/com/baeldung/exceptions/JacksonExceptionsUnitTest.java index dd0fe8dc56..38ef3f9390 100644 --- a/jackson/src/test/java/com/baeldung/jackson/exception/test/JacksonExceptionsUnitTest.java +++ b/jackson-exceptions/src/test/java/com/baeldung/exceptions/JacksonExceptionsUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.exception.test; +package com.baeldung.exceptions; import static org.hamcrest.Matchers.containsString; import static org.junit.Assert.assertEquals; @@ -9,11 +9,11 @@ import java.util.List; import org.junit.Test; -import com.baeldung.jackson.exception.User; -import com.baeldung.jackson.exception.UserWithPrivateFields; -import com.baeldung.jackson.exception.UserWithRoot; -import com.baeldung.jackson.exception.Zoo; -import com.baeldung.jackson.exception.ZooConfigured; +import com.baeldung.exceptions.User; +import com.baeldung.exceptions.UserWithPrivateFields; +import com.baeldung.exceptions.UserWithRoot; +import com.baeldung.exceptions.Zoo; +import com.baeldung.exceptions.ZooConfigured; import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; import com.fasterxml.jackson.annotation.PropertyAccessor; import com.fasterxml.jackson.core.JsonFactory; @@ -78,7 +78,7 @@ public class JacksonExceptionsUnitTest { final ObjectMapper mapper = new ObjectMapper(); mapper.reader() - .forType(User.class) + .forType(UserWithNoDefaultConstructor.class) .readValue(json); } @@ -87,8 +87,8 @@ public class JacksonExceptionsUnitTest { final String json = "{\"id\":1,\"name\":\"John\"}"; final ObjectMapper mapper = new ObjectMapper(); - final com.baeldung.jackson.dtos.User user = mapper.reader() - .forType(com.baeldung.jackson.dtos.User.class) + final User user = mapper.reader() + .forType(User.class) .readValue(json); assertEquals("John", user.name); } @@ -102,7 +102,7 @@ public class JacksonExceptionsUnitTest { mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); mapper.reader() - .forType(com.baeldung.jackson.dtos.User.class) + .forType(User.class) .readValue(json); } @@ -126,7 +126,7 @@ public class JacksonExceptionsUnitTest { final ObjectMapper mapper = new ObjectMapper(); mapper.reader() - .forType(com.baeldung.jackson.dtos.User.class) + .forType(User.class) .readValue(json); } @@ -135,8 +135,8 @@ public class JacksonExceptionsUnitTest { final String json = "[{\"id\":1,\"name\":\"John\"},{\"id\":2,\"name\":\"Adam\"}]"; final ObjectMapper mapper = new ObjectMapper(); - final List<com.baeldung.jackson.dtos.User> users = mapper.reader() - .forType(new TypeReference<List<com.baeldung.jackson.dtos.User>>() { + final List<User> users = mapper.reader() + .forType(new TypeReference<List<User>>() { }) .readValue(json); @@ -150,7 +150,7 @@ public class JacksonExceptionsUnitTest { final ObjectMapper mapper = new ObjectMapper(); mapper.reader() - .forType(com.baeldung.jackson.dtos.User.class) + .forType(User.class) .readValue(json); } @@ -161,8 +161,8 @@ public class JacksonExceptionsUnitTest { final ObjectMapper mapper = new ObjectMapper(); mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); - final com.baeldung.jackson.dtos.User user = mapper.reader() - .forType(com.baeldung.jackson.dtos.User.class) + final User user = mapper.reader() + .forType(User.class) .readValue(json); assertEquals("John", user.name); } @@ -174,7 +174,7 @@ public class JacksonExceptionsUnitTest { final ObjectMapper mapper = new ObjectMapper(); mapper.reader() - .forType(com.baeldung.jackson.dtos.User.class) + .forType(User.class) .readValue(json); } @@ -186,8 +186,8 @@ public class JacksonExceptionsUnitTest { factory.enable(JsonParser.Feature.ALLOW_SINGLE_QUOTES); final ObjectMapper mapper = new ObjectMapper(factory); - final com.baeldung.jackson.dtos.User user = mapper.reader() - .forType(com.baeldung.jackson.dtos.User.class) + final User user = mapper.reader() + .forType(User.class) .readValue(json); assertEquals("John", user.name); } diff --git a/jackson-exceptions/src/test/java/com/baeldung/mappingexception/JacksonMappingExceptionUnitTest.java b/jackson-exceptions/src/test/java/com/baeldung/mappingexception/JacksonMappingExceptionUnitTest.java new file mode 100644 index 0000000000..df35626828 --- /dev/null +++ b/jackson-exceptions/src/test/java/com/baeldung/mappingexception/JacksonMappingExceptionUnitTest.java @@ -0,0 +1,51 @@ +package com.baeldung.mappingexception; + +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.not; +import static org.hamcrest.Matchers.notNullValue; +import static org.junit.Assert.assertThat; + +import java.io.IOException; +import java.util.List; +import org.junit.Test; + +import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; +import com.fasterxml.jackson.annotation.PropertyAccessor; +import com.fasterxml.jackson.core.JsonGenerationException; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.google.common.collect.Lists; + +public class JacksonMappingExceptionUnitTest { + + @Test(expected = JsonMappingException.class) + public final void givenObjectHasNoAccessors_whenSerializing_thenException() throws JsonParseException, IOException { + final String dtoAsString = new ObjectMapper().writeValueAsString(new MyDtoNoAccessors()); + + assertThat(dtoAsString, notNullValue()); + } + + @Test + public final void givenObjectHasNoAccessors_whenSerializingWithPrivateFieldsVisibility_thenNoException() throws JsonParseException, IOException { + final ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY); + final String dtoAsString = objectMapper.writeValueAsString(new MyDtoNoAccessors()); + + assertThat(dtoAsString, containsString("intValue")); + assertThat(dtoAsString, containsString("stringValue")); + assertThat(dtoAsString, containsString("booleanValue")); + } + + @Test + public final void givenObjectHasNoAccessorsButHasVisibleFields_whenSerializing_thenNoException() throws JsonParseException, IOException { + final ObjectMapper objectMapper = new ObjectMapper(); + final String dtoAsString = objectMapper.writeValueAsString(new MyDtoNoAccessorsAndFieldVisibility()); + + assertThat(dtoAsString, containsString("intValue")); + assertThat(dtoAsString, containsString("stringValue")); + assertThat(dtoAsString, containsString("booleanValue")); + } + +} diff --git a/jackson-simple/README.md b/jackson-simple/README.md index 9d24a20e4a..ffc76ead22 100644 --- a/jackson-simple/README.md +++ b/jackson-simple/README.md @@ -6,10 +6,14 @@ This module contains articles about Jackson that are also part of the Jackson Eb The "REST With Spring" Classes: http://bit.ly/restwithspring -### Relevant Articles: -- [Jackson Ignore Properties on Marshalling](https://www.baeldung.com/jackson-ignore-properties-on-serialization) -- [Jackson Unmarshalling json with Unknown Properties](https://www.baeldung.com/jackson-deserialize-json-unknown-properties) +### Relevant Articles: - [Jackson Annotation Examples](https://www.baeldung.com/jackson-annotations) - [Intro to the Jackson ObjectMapper](https://www.baeldung.com/jackson-object-mapper-tutorial) +- [Jackson Ignore Properties on Marshalling](https://www.baeldung.com/jackson-ignore-properties-on-serialization) - [Ignore Null Fields with Jackson](https://www.baeldung.com/jackson-ignore-null-fields) - [Jackson – Change Name of Field](https://www.baeldung.com/jackson-name-of-property) +- [Jackson Unmarshalling JSON with Unknown Properties](https://www.baeldung.com/jackson-deserialize-json-unknown-properties) + +### NOTE: + +Since this is a module tied to an e-book, it should **not** be used to store the code for any further article. diff --git a/jackson-simple/pom.xml b/jackson-simple/pom.xml index 05c1ef4595..cdda031e0f 100644 --- a/jackson-simple/pom.xml +++ b/jackson-simple/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>jackson-simple</artifactId> <version>0.1-SNAPSHOT</version> @@ -13,12 +14,6 @@ </parent> <dependencies> - <!-- utils --> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>${commons-io.version}</version> - </dependency> <!--jackson for xml --> <dependency> <groupId>com.fasterxml.jackson.dataformat</groupId> @@ -26,78 +21,7 @@ <version>${jackson.version}</version> </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-collections4</artifactId> - <version>${commons-collections4.version}</version> - </dependency> - - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-lang3</artifactId> - <version>${commons-lang3.version}</version> - </dependency> - - <!-- marshalling --> - - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - <version>${jackson.version}</version> - </dependency> - - <dependency> - <groupId>com.fasterxml.jackson.datatype</groupId> - <artifactId>jackson-datatype-jsr310</artifactId> - <version>${jackson.version}</version> - </dependency> - - <dependency> - <groupId>com.fasterxml.jackson.datatype</groupId> - <artifactId>jackson-datatype-joda</artifactId> - <version>${jackson.version}</version> - </dependency> - - <dependency> - <groupId>com.fasterxml.jackson.module</groupId> - <artifactId>jackson-module-jsonSchema</artifactId> - <version>${jackson.version}</version> - </dependency> - - <dependency> - <groupId>com.fasterxml.jackson.datatype</groupId> - <artifactId>jackson-datatype-jdk8</artifactId> - <version>${jackson.version}</version> - </dependency> - - <dependency> - <groupId>joda-time</groupId> - <artifactId>joda-time</artifactId> - <version>${joda-time.version}</version> - </dependency> - - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - <version>${gson.version}</version> - </dependency> - <!-- test scoped --> - - <dependency> - <groupId>io.rest-assured</groupId> - <artifactId>json-schema-validator</artifactId> - <version>${rest-assured.version}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>io.rest-assured</groupId> - <artifactId>json-path</artifactId> - <version>${rest-assured.version}</version> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> @@ -117,13 +41,7 @@ </build> <properties> - <!-- util --> - <joda-time.version>2.10</joda-time.version> - <gson.version>2.8.5</gson.version> - <commons-collections4.version>4.2</commons-collections4.version> - <!-- testing --> - <rest-assured.version>3.1.1</rest-assured.version> <assertj.version>3.11.0</assertj.version> </properties> diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/annotation/AliasBean.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/AliasBean.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/annotation/AliasBean.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/AliasBean.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/annotation/BeanWithCreator.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithCreator.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/annotation/BeanWithCreator.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithCreator.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/annotation/BeanWithCustomAnnotation.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithCustomAnnotation.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/annotation/BeanWithCustomAnnotation.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithCustomAnnotation.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/annotation/BeanWithFilter.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithFilter.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/annotation/BeanWithFilter.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithFilter.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/annotation/BeanWithGetter.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithGetter.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/annotation/BeanWithGetter.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithGetter.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/annotation/BeanWithIgnore.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithIgnore.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/annotation/BeanWithIgnore.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithIgnore.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/annotation/BeanWithInject.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithInject.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/annotation/BeanWithInject.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithInject.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/annotation/ExtendableBean.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/ExtendableBean.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/annotation/ExtendableBean.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/ExtendableBean.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/annotation/MyBean.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/MyBean.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/annotation/MyBean.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/MyBean.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/annotation/PrivateBean.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/PrivateBean.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/annotation/PrivateBean.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/PrivateBean.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/annotation/RawBean.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/RawBean.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/annotation/RawBean.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/RawBean.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/annotation/UnwrappedUser.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/UnwrappedUser.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/annotation/UnwrappedUser.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/UnwrappedUser.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/annotation/UserWithIgnoreType.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/UserWithIgnoreType.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/annotation/UserWithIgnoreType.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/UserWithIgnoreType.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/annotation/Zoo.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/Zoo.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/annotation/Zoo.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/Zoo.java diff --git a/jackson/src/test/java/com/baeldung/jackson/bidirection/ItemWithIdentity.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/ItemWithIdentity.java similarity index 91% rename from jackson/src/test/java/com/baeldung/jackson/bidirection/ItemWithIdentity.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/ItemWithIdentity.java index 25de4a8f7a..acd68e9e4a 100644 --- a/jackson/src/test/java/com/baeldung/jackson/bidirection/ItemWithIdentity.java +++ b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/ItemWithIdentity.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.bidirection; +package com.baeldung.jackson.annotation.bidirection; import com.fasterxml.jackson.annotation.JsonIdentityInfo; import com.fasterxml.jackson.annotation.ObjectIdGenerators; diff --git a/jackson/src/test/java/com/baeldung/jackson/bidirection/ItemWithIgnore.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/ItemWithIgnore.java similarity index 86% rename from jackson/src/test/java/com/baeldung/jackson/bidirection/ItemWithIgnore.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/ItemWithIgnore.java index 910ccec174..a71bdd57f8 100644 --- a/jackson/src/test/java/com/baeldung/jackson/bidirection/ItemWithIgnore.java +++ b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/ItemWithIgnore.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.bidirection; +package com.baeldung.jackson.annotation.bidirection; public class ItemWithIgnore { public int id; diff --git a/jackson/src/test/java/com/baeldung/jackson/bidirection/ItemWithRef.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/ItemWithRef.java similarity index 88% rename from jackson/src/test/java/com/baeldung/jackson/bidirection/ItemWithRef.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/ItemWithRef.java index 0ca8d721e8..3b9bb44c37 100644 --- a/jackson/src/test/java/com/baeldung/jackson/bidirection/ItemWithRef.java +++ b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/ItemWithRef.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.bidirection; +package com.baeldung.jackson.annotation.bidirection; import com.fasterxml.jackson.annotation.JsonManagedReference; diff --git a/jackson/src/test/java/com/baeldung/jackson/bidirection/UserWithIdentity.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/UserWithIdentity.java similarity index 93% rename from jackson/src/test/java/com/baeldung/jackson/bidirection/UserWithIdentity.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/UserWithIdentity.java index db83a09389..9703b27f3e 100644 --- a/jackson/src/test/java/com/baeldung/jackson/bidirection/UserWithIdentity.java +++ b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/UserWithIdentity.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.bidirection; +package com.baeldung.jackson.annotation.bidirection; import java.util.ArrayList; import java.util.List; diff --git a/jackson/src/test/java/com/baeldung/jackson/bidirection/UserWithIgnore.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/UserWithIgnore.java similarity index 91% rename from jackson/src/test/java/com/baeldung/jackson/bidirection/UserWithIgnore.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/UserWithIgnore.java index 857a373cc5..19598a4c17 100644 --- a/jackson/src/test/java/com/baeldung/jackson/bidirection/UserWithIgnore.java +++ b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/UserWithIgnore.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.bidirection; +package com.baeldung.jackson.annotation.bidirection; import java.util.ArrayList; import java.util.List; diff --git a/jackson/src/test/java/com/baeldung/jackson/bidirection/UserWithRef.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/UserWithRef.java similarity index 91% rename from jackson/src/test/java/com/baeldung/jackson/bidirection/UserWithRef.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/UserWithRef.java index 3de03fc651..3d844ea6c0 100644 --- a/jackson/src/test/java/com/baeldung/jackson/bidirection/UserWithRef.java +++ b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/UserWithRef.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.bidirection; +package com.baeldung.jackson.annotation.bidirection; import java.util.ArrayList; import java.util.List; diff --git a/jackson/src/test/java/com/baeldung/jackson/date/CustomDateDeserializer.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/CustomDateDeserializer.java similarity index 95% rename from jackson/src/test/java/com/baeldung/jackson/date/CustomDateDeserializer.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/CustomDateDeserializer.java index 90c7d9fbac..f17c4dc0dd 100644 --- a/jackson/src/test/java/com/baeldung/jackson/date/CustomDateDeserializer.java +++ b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/CustomDateDeserializer.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.date; +package com.baeldung.jackson.annotation.date; import java.io.IOException; import java.text.ParseException; diff --git a/jackson/src/test/java/com/baeldung/jackson/date/CustomDateSerializer.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/CustomDateSerializer.java similarity index 95% rename from jackson/src/test/java/com/baeldung/jackson/date/CustomDateSerializer.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/CustomDateSerializer.java index d840e1940f..1e869d876a 100644 --- a/jackson/src/test/java/com/baeldung/jackson/date/CustomDateSerializer.java +++ b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/CustomDateSerializer.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.date; +package com.baeldung.jackson.annotation.date; import java.io.IOException; import java.text.SimpleDateFormat; diff --git a/jackson/src/test/java/com/baeldung/jackson/date/EventWithFormat.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/EventWithFormat.java similarity index 92% rename from jackson/src/test/java/com/baeldung/jackson/date/EventWithFormat.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/EventWithFormat.java index 607e694cef..423b927976 100644 --- a/jackson/src/test/java/com/baeldung/jackson/date/EventWithFormat.java +++ b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/EventWithFormat.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.date; +package com.baeldung.jackson.annotation.date; import java.util.Date; diff --git a/jackson/src/test/java/com/baeldung/jackson/date/EventWithSerializer.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/EventWithSerializer.java similarity index 93% rename from jackson/src/test/java/com/baeldung/jackson/date/EventWithSerializer.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/EventWithSerializer.java index c359b5c846..292cb9129d 100644 --- a/jackson/src/test/java/com/baeldung/jackson/date/EventWithSerializer.java +++ b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/EventWithSerializer.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.date; +package com.baeldung.jackson.annotation.date; import java.util.Date; diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/deserialization/ItemDeserializerOnClass.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/deserialization/ItemDeserializerOnClass.java similarity index 88% rename from jackson-simple/src/test/java/com/baeldung/jackson/deserialization/ItemDeserializerOnClass.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/deserialization/ItemDeserializerOnClass.java index eaba9a7173..fe86d48f6a 100644 --- a/jackson-simple/src/test/java/com/baeldung/jackson/deserialization/ItemDeserializerOnClass.java +++ b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/deserialization/ItemDeserializerOnClass.java @@ -1,9 +1,9 @@ -package com.baeldung.jackson.deserialization; +package com.baeldung.jackson.annotation.deserialization; import java.io.IOException; -import com.baeldung.jackson.dtos.ItemWithSerializer; -import com.baeldung.jackson.dtos.User; +import com.baeldung.jackson.annotation.dtos.ItemWithSerializer; +import com.baeldung.jackson.annotation.dtos.User; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationContext; diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/Item.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/Item.java new file mode 100644 index 0000000000..009789bbf6 --- /dev/null +++ b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/Item.java @@ -0,0 +1,32 @@ +package com.baeldung.jackson.annotation.dtos; + +public class Item { + public int id; + public String itemName; + public User owner; + + public Item() { + super(); + } + + public Item(final int id, final String itemName, final User owner) { + this.id = id; + this.itemName = itemName; + this.owner = owner; + } + + // API + + public int getId() { + return id; + } + + public String getItemName() { + return itemName; + } + + public User getOwner() { + return owner; + } + +} \ No newline at end of file diff --git a/jackson/src/test/java/com/baeldung/jackson/dtos/ItemWithSerializer.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/ItemWithSerializer.java similarity index 78% rename from jackson/src/test/java/com/baeldung/jackson/dtos/ItemWithSerializer.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/ItemWithSerializer.java index aea9aa770d..a4cd7d78ad 100644 --- a/jackson/src/test/java/com/baeldung/jackson/dtos/ItemWithSerializer.java +++ b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/ItemWithSerializer.java @@ -1,7 +1,7 @@ -package com.baeldung.jackson.dtos; +package com.baeldung.jackson.annotation.dtos; -import com.baeldung.jackson.deserialization.ItemDeserializerOnClass; -import com.baeldung.jackson.serialization.ItemSerializerOnClass; +import com.baeldung.jackson.annotation.deserialization.ItemDeserializerOnClass; +import com.baeldung.jackson.annotation.serialization.ItemSerializerOnClass; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/User.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/User.java new file mode 100644 index 0000000000..9a4ec08ec3 --- /dev/null +++ b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/User.java @@ -0,0 +1,26 @@ +package com.baeldung.jackson.annotation.dtos; + +public class User { + public int id; + public String name; + + public User() { + super(); + } + + public User(final int id, final String name) { + this.id = id; + this.name = name; + } + + // API + + public int getId() { + return id; + } + + public String getName() { + return name; + } + +} \ No newline at end of file diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/dtos/withEnum/DistanceEnumWithValue.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/withEnum/DistanceEnumWithValue.java similarity index 91% rename from jackson-simple/src/test/java/com/baeldung/jackson/dtos/withEnum/DistanceEnumWithValue.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/withEnum/DistanceEnumWithValue.java index 69c476d8a5..574908523a 100644 --- a/jackson-simple/src/test/java/com/baeldung/jackson/dtos/withEnum/DistanceEnumWithValue.java +++ b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/withEnum/DistanceEnumWithValue.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.dtos.withEnum; +package com.baeldung.jackson.annotation.dtos.withEnum; import com.fasterxml.jackson.annotation.JsonValue; diff --git a/jackson/src/test/java/com/baeldung/jackson/exception/UserWithRoot.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/exception/UserWithRoot.java similarity index 86% rename from jackson/src/test/java/com/baeldung/jackson/exception/UserWithRoot.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/exception/UserWithRoot.java index d879c16e6a..629f444356 100644 --- a/jackson/src/test/java/com/baeldung/jackson/exception/UserWithRoot.java +++ b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/exception/UserWithRoot.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.exception; +package com.baeldung.jackson.annotation.exception; import com.fasterxml.jackson.annotation.JsonRootName; diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/exception/UserWithRootNamespace.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/exception/UserWithRootNamespace.java similarity index 87% rename from jackson-simple/src/test/java/com/baeldung/jackson/exception/UserWithRootNamespace.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/exception/UserWithRootNamespace.java index bf8c85efba..8f863168af 100644 --- a/jackson-simple/src/test/java/com/baeldung/jackson/exception/UserWithRootNamespace.java +++ b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/exception/UserWithRootNamespace.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.exception; +package com.baeldung.jackson.annotation.exception; import com.fasterxml.jackson.annotation.JsonRootName; diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/ignore/MyMixInForIgnoreType.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/ignore/MyMixInForIgnoreType.java new file mode 100644 index 0000000000..c016e44530 --- /dev/null +++ b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/ignore/MyMixInForIgnoreType.java @@ -0,0 +1,8 @@ +package com.baeldung.jackson.annotation.ignore; + +import com.fasterxml.jackson.annotation.JsonIgnoreType; + +@JsonIgnoreType +public class MyMixInForIgnoreType { + // +} diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/jsonview/Item.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/jsonview/Item.java new file mode 100644 index 0000000000..3a2681e0f0 --- /dev/null +++ b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/jsonview/Item.java @@ -0,0 +1,36 @@ +package com.baeldung.jackson.annotation.jsonview; + +import com.fasterxml.jackson.annotation.JsonView; + +public class Item { + @JsonView(Views.Public.class) + public int id; + + @JsonView(Views.Public.class) + public String itemName; + + @JsonView(Views.Internal.class) + public String ownerName; + + public Item() { + super(); + } + + public Item(final int id, final String itemName, final String ownerName) { + this.id = id; + this.itemName = itemName; + this.ownerName = ownerName; + } + + public int getId() { + return id; + } + + public String getItemName() { + return itemName; + } + + public String getOwnerName() { + return ownerName; + } +} diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/jsonview/Views.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/jsonview/Views.java new file mode 100644 index 0000000000..567592608a --- /dev/null +++ b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/jsonview/Views.java @@ -0,0 +1,9 @@ +package com.baeldung.jackson.annotation.jsonview; + +public class Views { + public static class Public { + } + + public static class Internal extends Public { + } +} diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/serialization/ItemSerializer.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/serialization/ItemSerializer.java new file mode 100644 index 0000000000..cc17228de2 --- /dev/null +++ b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/serialization/ItemSerializer.java @@ -0,0 +1,32 @@ +package com.baeldung.jackson.annotation.serialization; + +import java.io.IOException; + +import com.baeldung.jackson.annotation.dtos.Item; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; + +public class ItemSerializer extends StdSerializer<Item> { + + private static final long serialVersionUID = 6739170890621978901L; + + public ItemSerializer() { + this(null); + } + + public ItemSerializer(final Class<Item> t) { + super(t); + } + + @Override + public final void serialize(final Item value, final JsonGenerator jgen, final SerializerProvider provider) throws IOException, JsonProcessingException { + jgen.writeStartObject(); + jgen.writeNumberField("id", value.id); + jgen.writeStringField("itemName", value.itemName); + jgen.writeNumberField("owner", value.owner.id); + jgen.writeEndObject(); + } + +} \ No newline at end of file diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/serialization/ItemSerializerOnClass.java b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/serialization/ItemSerializerOnClass.java similarity index 89% rename from jackson-simple/src/test/java/com/baeldung/jackson/serialization/ItemSerializerOnClass.java rename to jackson-simple/src/main/java/com/baeldung/jackson/annotation/serialization/ItemSerializerOnClass.java index 1fdf44e17c..bad44c01e7 100644 --- a/jackson-simple/src/test/java/com/baeldung/jackson/serialization/ItemSerializerOnClass.java +++ b/jackson-simple/src/main/java/com/baeldung/jackson/annotation/serialization/ItemSerializerOnClass.java @@ -1,8 +1,8 @@ -package com.baeldung.jackson.serialization; +package com.baeldung.jackson.annotation.serialization; import java.io.IOException; -import com.baeldung.jackson.dtos.ItemWithSerializer; +import com.baeldung.jackson.annotation.dtos.ItemWithSerializer; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.SerializerProvider; diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/dtos/MyDto.java b/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDto.java similarity index 96% rename from jackson-simple/src/test/java/com/baeldung/jackson/dtos/MyDto.java rename to jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDto.java index 49cf07baea..b8fedc9c98 100644 --- a/jackson-simple/src/test/java/com/baeldung/jackson/dtos/MyDto.java +++ b/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDto.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.dtos; +package com.baeldung.jackson.ignore; public class MyDto { diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/ignore/dtos/MyDtoIgnoreField.java b/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIgnoreField.java similarity index 94% rename from jackson-simple/src/test/java/com/baeldung/jackson/ignore/dtos/MyDtoIgnoreField.java rename to jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIgnoreField.java index 8cbcb773cc..6880cf68fc 100644 --- a/jackson-simple/src/test/java/com/baeldung/jackson/ignore/dtos/MyDtoIgnoreField.java +++ b/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIgnoreField.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.ignore.dtos; +package com.baeldung.jackson.ignore; import com.fasterxml.jackson.annotation.JsonIgnore; diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/ignore/dtos/MyDtoIgnoreFieldByName.java b/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIgnoreFieldByName.java similarity index 95% rename from jackson-simple/src/test/java/com/baeldung/jackson/ignore/dtos/MyDtoIgnoreFieldByName.java rename to jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIgnoreFieldByName.java index 1aee31a1b3..f446096258 100644 --- a/jackson-simple/src/test/java/com/baeldung/jackson/ignore/dtos/MyDtoIgnoreFieldByName.java +++ b/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIgnoreFieldByName.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.ignore.dtos; +package com.baeldung.jackson.ignore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/ignore/dtos/MyDtoIgnoreNull.java b/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIgnoreNull.java similarity index 96% rename from jackson-simple/src/test/java/com/baeldung/jackson/ignore/dtos/MyDtoIgnoreNull.java rename to jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIgnoreNull.java index 75532f18c2..2fd388109c 100644 --- a/jackson-simple/src/test/java/com/baeldung/jackson/ignore/dtos/MyDtoIgnoreNull.java +++ b/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIgnoreNull.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.ignore.dtos; +package com.baeldung.jackson.ignore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/dtos/MyDtoIncludeNonDefault.java b/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIncludeNonDefault.java similarity index 95% rename from jackson-simple/src/test/java/com/baeldung/jackson/dtos/MyDtoIncludeNonDefault.java rename to jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIncludeNonDefault.java index ca03a8be62..53b9316413 100644 --- a/jackson-simple/src/test/java/com/baeldung/jackson/dtos/MyDtoIncludeNonDefault.java +++ b/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIncludeNonDefault.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.dtos; +package com.baeldung.jackson.ignore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoWithFilter.java b/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoWithFilter.java new file mode 100644 index 0000000000..f8e4043357 --- /dev/null +++ b/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoWithFilter.java @@ -0,0 +1,50 @@ +package com.baeldung.jackson.ignore; + +import com.fasterxml.jackson.annotation.JsonFilter; + +@JsonFilter("myFilter") +public class MyDtoWithFilter { + + private String stringValue; + private int intValue; + private boolean booleanValue; + + public MyDtoWithFilter() { + super(); + } + + public MyDtoWithFilter(final String stringValue, final int intValue, final boolean booleanValue) { + super(); + + this.stringValue = stringValue; + this.intValue = intValue; + this.booleanValue = booleanValue; + } + + // API + + public String getStringValue() { + return stringValue; + } + + public void setStringValue(final String stringValue) { + this.stringValue = stringValue; + } + + public int getIntValue() { + return intValue; + } + + public void setIntValue(final int intValue) { + this.intValue = intValue; + } + + public boolean isBooleanValue() { + return booleanValue; + } + + public void setBooleanValue(final boolean booleanValue) { + this.booleanValue = booleanValue; + } + +} diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/dtos/MyDtoWithSpecialField.java b/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoWithSpecialField.java similarity index 96% rename from jackson-simple/src/test/java/com/baeldung/jackson/dtos/MyDtoWithSpecialField.java rename to jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoWithSpecialField.java index 58293c0562..f85823fb30 100644 --- a/jackson-simple/src/test/java/com/baeldung/jackson/dtos/MyDtoWithSpecialField.java +++ b/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoWithSpecialField.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.dtos; +package com.baeldung.jackson.ignore; public class MyDtoWithSpecialField { diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/dtos/MyMixInForIgnoreType.java b/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyMixInForIgnoreType.java similarity index 76% rename from jackson-simple/src/test/java/com/baeldung/jackson/dtos/MyMixInForIgnoreType.java rename to jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyMixInForIgnoreType.java index ca29c98b9a..3c5dfdfad3 100644 --- a/jackson-simple/src/test/java/com/baeldung/jackson/dtos/MyMixInForIgnoreType.java +++ b/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyMixInForIgnoreType.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.dtos; +package com.baeldung.jackson.ignore; import com.fasterxml.jackson.annotation.JsonIgnoreType; diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/ignorenullfields/MyDto.java b/jackson-simple/src/main/java/com/baeldung/jackson/ignorenullfields/MyDto.java new file mode 100644 index 0000000000..3737dd35f6 --- /dev/null +++ b/jackson-simple/src/main/java/com/baeldung/jackson/ignorenullfields/MyDto.java @@ -0,0 +1,54 @@ +package com.baeldung.jackson.ignorenullfields; + +public class MyDto { + + private String stringValue; + private int intValue; + private boolean booleanValue; + + public MyDto() { + super(); + } + + public MyDto(final String stringValue, final int intValue, final boolean booleanValue) { + super(); + + this.stringValue = stringValue; + this.intValue = intValue; + this.booleanValue = booleanValue; + } + + // API + + public String getStringValue() { + return stringValue; + } + + public void setStringValue(final String stringValue) { + this.stringValue = stringValue; + } + + public int getIntValue() { + return intValue; + } + + public void setIntValue(final int intValue) { + this.intValue = intValue; + } + + public boolean isBooleanValue() { + return booleanValue; + } + + public void setBooleanValue(final boolean booleanValue) { + this.booleanValue = booleanValue; + } + + // + + @Override + public String toString() { + return "MyDto [stringValue=" + stringValue + ", intValue=" + intValue + ", booleanValue=" + booleanValue + "]"; + } + +} diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/ignorenullfields/MyDtoIgnoreNull.java b/jackson-simple/src/main/java/com/baeldung/jackson/ignorenullfields/MyDtoIgnoreNull.java new file mode 100644 index 0000000000..6aad3a3413 --- /dev/null +++ b/jackson-simple/src/main/java/com/baeldung/jackson/ignorenullfields/MyDtoIgnoreNull.java @@ -0,0 +1,51 @@ +package com.baeldung.jackson.ignorenullfields; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +@JsonInclude(Include.NON_NULL) +public class MyDtoIgnoreNull { + + private String stringValue; + private int intValue; + private boolean booleanValue; + + public MyDtoIgnoreNull() { + super(); + } + + public MyDtoIgnoreNull(final String stringValue, final int intValue, final boolean booleanValue) { + super(); + + this.stringValue = stringValue; + this.intValue = intValue; + this.booleanValue = booleanValue; + } + + // API + + public String getStringValue() { + return stringValue; + } + + public void setStringValue(final String stringValue) { + this.stringValue = stringValue; + } + + public int getIntValue() { + return intValue; + } + + public void setIntValue(final int intValue) { + this.intValue = intValue; + } + + public boolean isBooleanValue() { + return booleanValue; + } + + public void setBooleanValue(final boolean booleanValue) { + this.booleanValue = booleanValue; + } + +} diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/jsonproperty/MyDto.java b/jackson-simple/src/main/java/com/baeldung/jackson/jsonproperty/MyDto.java new file mode 100644 index 0000000000..30ea8b4a56 --- /dev/null +++ b/jackson-simple/src/main/java/com/baeldung/jackson/jsonproperty/MyDto.java @@ -0,0 +1,54 @@ +package com.baeldung.jackson.jsonproperty; + +public class MyDto { + + private String stringValue; + private int intValue; + private boolean booleanValue; + + public MyDto() { + super(); + } + + public MyDto(final String stringValue, final int intValue, final boolean booleanValue) { + super(); + + this.stringValue = stringValue; + this.intValue = intValue; + this.booleanValue = booleanValue; + } + + // API + + public String getStringValue() { + return stringValue; + } + + public void setStringValue(final String stringValue) { + this.stringValue = stringValue; + } + + public int getIntValue() { + return intValue; + } + + public void setIntValue(final int intValue) { + this.intValue = intValue; + } + + public boolean isBooleanValue() { + return booleanValue; + } + + public void setBooleanValue(final boolean booleanValue) { + this.booleanValue = booleanValue; + } + + // + + @Override + public String toString() { + return "MyDto [stringValue=" + stringValue + ", intValue=" + intValue + ", booleanValue=" + booleanValue + "]"; + } + +} diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/dtos/MyDtoFieldNameChanged.java b/jackson-simple/src/main/java/com/baeldung/jackson/jsonproperty/MyDtoFieldNameChanged.java similarity index 96% rename from jackson-simple/src/test/java/com/baeldung/jackson/dtos/MyDtoFieldNameChanged.java rename to jackson-simple/src/main/java/com/baeldung/jackson/jsonproperty/MyDtoFieldNameChanged.java index ce7086f1fe..be0a25a240 100644 --- a/jackson-simple/src/test/java/com/baeldung/jackson/dtos/MyDtoFieldNameChanged.java +++ b/jackson-simple/src/main/java/com/baeldung/jackson/jsonproperty/MyDtoFieldNameChanged.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.dtos; +package com.baeldung.jackson.jsonproperty; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/objectmapper/CustomCarDeserializer.java b/jackson-simple/src/main/java/com/baeldung/jackson/objectmapper/CustomCarDeserializer.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/objectmapper/CustomCarDeserializer.java rename to jackson-simple/src/main/java/com/baeldung/jackson/objectmapper/CustomCarDeserializer.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/objectmapper/CustomCarSerializer.java b/jackson-simple/src/main/java/com/baeldung/jackson/objectmapper/CustomCarSerializer.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/objectmapper/CustomCarSerializer.java rename to jackson-simple/src/main/java/com/baeldung/jackson/objectmapper/CustomCarSerializer.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/objectmapper/dto/Car.java b/jackson-simple/src/main/java/com/baeldung/jackson/objectmapper/dto/Car.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/objectmapper/dto/Car.java rename to jackson-simple/src/main/java/com/baeldung/jackson/objectmapper/dto/Car.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/objectmapper/dto/Request.java b/jackson-simple/src/main/java/com/baeldung/jackson/objectmapper/dto/Request.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/objectmapper/dto/Request.java rename to jackson-simple/src/main/java/com/baeldung/jackson/objectmapper/dto/Request.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/unknownproperties/MyDto.java b/jackson-simple/src/main/java/com/baeldung/jackson/unknownproperties/MyDto.java new file mode 100644 index 0000000000..7c8046f6be --- /dev/null +++ b/jackson-simple/src/main/java/com/baeldung/jackson/unknownproperties/MyDto.java @@ -0,0 +1,54 @@ +package com.baeldung.jackson.unknownproperties; + +public class MyDto { + + private String stringValue; + private int intValue; + private boolean booleanValue; + + public MyDto() { + super(); + } + + public MyDto(final String stringValue, final int intValue, final boolean booleanValue) { + super(); + + this.stringValue = stringValue; + this.intValue = intValue; + this.booleanValue = booleanValue; + } + + // API + + public String getStringValue() { + return stringValue; + } + + public void setStringValue(final String stringValue) { + this.stringValue = stringValue; + } + + public int getIntValue() { + return intValue; + } + + public void setIntValue(final int intValue) { + this.intValue = intValue; + } + + public boolean isBooleanValue() { + return booleanValue; + } + + public void setBooleanValue(final boolean booleanValue) { + this.booleanValue = booleanValue; + } + + // + + @Override + public String toString() { + return "MyDto [stringValue=" + stringValue + ", intValue=" + intValue + ", booleanValue=" + booleanValue + "]"; + } + +} diff --git a/jackson/src/test/java/com/baeldung/jackson/dtos/ignore/MyDtoIgnoreType.java b/jackson-simple/src/main/java/com/baeldung/jackson/unknownproperties/MyDtoIgnoreType.java similarity index 95% rename from jackson/src/test/java/com/baeldung/jackson/dtos/ignore/MyDtoIgnoreType.java rename to jackson-simple/src/main/java/com/baeldung/jackson/unknownproperties/MyDtoIgnoreType.java index 3c813145f6..89456020b2 100644 --- a/jackson/src/test/java/com/baeldung/jackson/dtos/ignore/MyDtoIgnoreType.java +++ b/jackson-simple/src/main/java/com/baeldung/jackson/unknownproperties/MyDtoIgnoreType.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.dtos.ignore; +package com.baeldung.jackson.unknownproperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; diff --git a/jackson/src/test/java/com/baeldung/jackson/dtos/ignore/MyDtoIgnoreUnknown.java b/jackson-simple/src/main/java/com/baeldung/jackson/unknownproperties/MyDtoIgnoreUnknown.java similarity index 95% rename from jackson/src/test/java/com/baeldung/jackson/dtos/ignore/MyDtoIgnoreUnknown.java rename to jackson-simple/src/main/java/com/baeldung/jackson/unknownproperties/MyDtoIgnoreUnknown.java index c1174a12f5..ebbe528c83 100644 --- a/jackson/src/test/java/com/baeldung/jackson/dtos/ignore/MyDtoIgnoreUnknown.java +++ b/jackson-simple/src/main/java/com/baeldung/jackson/unknownproperties/MyDtoIgnoreUnknown.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.dtos.ignore; +package com.baeldung.jackson.unknownproperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/test/JacksonAnnotationUnitTest.java b/jackson-simple/src/test/java/com/baeldung/jackson/annotation/JacksonAnnotationUnitTest.java similarity index 90% rename from jackson-simple/src/test/java/com/baeldung/jackson/test/JacksonAnnotationUnitTest.java rename to jackson-simple/src/test/java/com/baeldung/jackson/annotation/JacksonAnnotationUnitTest.java index ee11f8f20e..bbbb79b0a8 100644 --- a/jackson-simple/src/test/java/com/baeldung/jackson/test/JacksonAnnotationUnitTest.java +++ b/jackson-simple/src/test/java/com/baeldung/jackson/annotation/JacksonAnnotationUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.test; +package com.baeldung.jackson.annotation; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.is; @@ -14,32 +14,18 @@ import java.util.TimeZone; import org.junit.Test; -import com.baeldung.jackson.annotation.AliasBean; -import com.baeldung.jackson.annotation.BeanWithCreator; -import com.baeldung.jackson.annotation.BeanWithCustomAnnotation; -import com.baeldung.jackson.annotation.BeanWithFilter; -import com.baeldung.jackson.annotation.BeanWithGetter; -import com.baeldung.jackson.annotation.BeanWithIgnore; -import com.baeldung.jackson.annotation.BeanWithInject; -import com.baeldung.jackson.annotation.ExtendableBean; -import com.baeldung.jackson.annotation.MyBean; -import com.baeldung.jackson.annotation.PrivateBean; -import com.baeldung.jackson.annotation.RawBean; -import com.baeldung.jackson.annotation.UnwrappedUser; -import com.baeldung.jackson.annotation.UserWithIgnoreType; -import com.baeldung.jackson.annotation.Zoo; -import com.baeldung.jackson.bidirection.ItemWithIdentity; -import com.baeldung.jackson.bidirection.ItemWithRef; -import com.baeldung.jackson.bidirection.UserWithIdentity; -import com.baeldung.jackson.bidirection.UserWithRef; -import com.baeldung.jackson.date.EventWithFormat; -import com.baeldung.jackson.date.EventWithSerializer; -import com.baeldung.jackson.dtos.MyMixInForIgnoreType; -import com.baeldung.jackson.dtos.withEnum.DistanceEnumWithValue; -import com.baeldung.jackson.exception.UserWithRoot; -import com.baeldung.jackson.exception.UserWithRootNamespace; -import com.baeldung.jackson.jsonview.Item; -import com.baeldung.jackson.jsonview.Views; +import com.baeldung.jackson.annotation.bidirection.ItemWithIdentity; +import com.baeldung.jackson.annotation.bidirection.ItemWithRef; +import com.baeldung.jackson.annotation.bidirection.UserWithIdentity; +import com.baeldung.jackson.annotation.bidirection.UserWithRef; +import com.baeldung.jackson.annotation.date.EventWithFormat; +import com.baeldung.jackson.annotation.date.EventWithSerializer; +import com.baeldung.jackson.annotation.ignore.MyMixInForIgnoreType; +import com.baeldung.jackson.annotation.dtos.withEnum.DistanceEnumWithValue; +import com.baeldung.jackson.annotation.exception.UserWithRoot; +import com.baeldung.jackson.annotation.exception.UserWithRootNamespace; +import com.baeldung.jackson.annotation.jsonview.Item; +import com.baeldung.jackson.annotation.jsonview.Views; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.InjectableValues; import com.fasterxml.jackson.databind.MapperFeature; @@ -352,13 +338,13 @@ public class JacksonAnnotationUnitTest { // @Ignore("Jackson 2.7.1-1 seems to have changed the API regarding mixins") @Test public void whenSerializingUsingMixInAnnotation_thenCorrect() throws JsonProcessingException { - final com.baeldung.jackson.dtos.Item item = new com.baeldung.jackson.dtos.Item(1, "book", null); + final com.baeldung.jackson.annotation.dtos.Item item = new com.baeldung.jackson.annotation.dtos.Item(1, "book", null); String result = new ObjectMapper().writeValueAsString(item); assertThat(result, containsString("owner")); final ObjectMapper mapper = new ObjectMapper(); - mapper.addMixIn(com.baeldung.jackson.dtos.User.class, MyMixInForIgnoreType.class); + mapper.addMixIn(com.baeldung.jackson.annotation.dtos.User.class, MyMixInForIgnoreType.class); result = mapper.writeValueAsString(item); assertThat(result, not(containsString("owner"))); diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/ignore/IgnoreFieldsWithFilterUnitTest.java b/jackson-simple/src/test/java/com/baeldung/jackson/ignore/IgnoreFieldsWithFilterUnitTest.java new file mode 100644 index 0000000000..9f1da451f8 --- /dev/null +++ b/jackson-simple/src/test/java/com/baeldung/jackson/ignore/IgnoreFieldsWithFilterUnitTest.java @@ -0,0 +1,87 @@ +package com.baeldung.jackson.ignore; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.ser.BeanPropertyWriter; +import com.fasterxml.jackson.databind.ser.FilterProvider; +import com.fasterxml.jackson.databind.ser.PropertyFilter; +import com.fasterxml.jackson.databind.ser.PropertyWriter; +import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; +import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; +import org.junit.Test; + +import java.io.IOException; + +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.not; +import static org.junit.Assert.assertThat; + +public class IgnoreFieldsWithFilterUnitTest { + + @Test + public final void givenTypeHasFilterThatIgnoresFieldByName_whenDtoIsSerialized_thenCorrect() throws JsonParseException, IOException { + final ObjectMapper mapper = new ObjectMapper(); + final SimpleBeanPropertyFilter theFilter = SimpleBeanPropertyFilter.serializeAllExcept("intValue"); + final FilterProvider filters = new SimpleFilterProvider().addFilter("myFilter", theFilter); + + final MyDtoWithFilter dtoObject = new MyDtoWithFilter(); + dtoObject.setIntValue(12); + + final String dtoAsString = mapper.writer(filters) + .writeValueAsString(dtoObject); + + assertThat(dtoAsString, not(containsString("intValue"))); + assertThat(dtoAsString, containsString("booleanValue")); + assertThat(dtoAsString, containsString("stringValue")); + System.out.println(dtoAsString); + } + + @Test + public final void givenTypeHasFilterThatIgnoresNegativeInt_whenDtoIsSerialized_thenCorrect() throws JsonParseException, IOException { + final PropertyFilter theFilter = new SimpleBeanPropertyFilter() { + @Override + public final void serializeAsField(final Object pojo, final JsonGenerator jgen, final SerializerProvider provider, final PropertyWriter writer) throws Exception { + if (include(writer)) { + if (!writer.getName() + .equals("intValue")) { + writer.serializeAsField(pojo, jgen, provider); + return; + } + + final int intValue = ((MyDtoWithFilter) pojo).getIntValue(); + if (intValue >= 0) { + writer.serializeAsField(pojo, jgen, provider); + } + } else if (!jgen.canOmitFields()) { // since 2.3 + writer.serializeAsOmittedField(pojo, jgen, provider); + } + } + + @Override + protected final boolean include(final BeanPropertyWriter writer) { + return true; + } + + @Override + protected final boolean include(final PropertyWriter writer) { + return true; + } + }; + final FilterProvider filters = new SimpleFilterProvider().addFilter("myFilter", theFilter); + + final MyDtoWithFilter dtoObject = new MyDtoWithFilter(); + dtoObject.setIntValue(-1); + + final ObjectMapper mapper = new ObjectMapper(); + final String dtoAsString = mapper.writer(filters) + .writeValueAsString(dtoObject); + + assertThat(dtoAsString, not(containsString("intValue"))); + assertThat(dtoAsString, containsString("booleanValue")); + assertThat(dtoAsString, containsString("stringValue")); + System.out.println(dtoAsString); + } + +} diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/ignore/JacksonSerializationIgnoreUnitTest.java b/jackson-simple/src/test/java/com/baeldung/jackson/ignore/JacksonSerializationIgnoreUnitTest.java index da8b464d03..da7c45859e 100644 --- a/jackson-simple/src/test/java/com/baeldung/jackson/ignore/JacksonSerializationIgnoreUnitTest.java +++ b/jackson-simple/src/test/java/com/baeldung/jackson/ignore/JacksonSerializationIgnoreUnitTest.java @@ -5,20 +5,9 @@ import static org.hamcrest.Matchers.not; import static org.junit.Assert.assertThat; import java.io.IOException; -import java.util.HashMap; -import java.util.Map; import org.junit.Test; -import com.baeldung.jackson.dtos.MyDto; -import com.baeldung.jackson.dtos.MyDtoIncludeNonDefault; -import com.baeldung.jackson.dtos.MyDtoWithFilter; -import com.baeldung.jackson.dtos.MyDtoWithSpecialField; -import com.baeldung.jackson.dtos.MyMixInForIgnoreType; -import com.baeldung.jackson.ignore.dtos.MyDtoIgnoreField; -import com.baeldung.jackson.ignore.dtos.MyDtoIgnoreFieldByName; -import com.baeldung.jackson.ignore.dtos.MyDtoIgnoreNull; -import com.baeldung.jackson.serialization.MyDtoNullKeySerializer; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParseException; @@ -100,70 +89,6 @@ public class JacksonSerializationIgnoreUnitTest { System.out.println(dtoAsString); } - @Test - public final void givenTypeHasFilterThatIgnoresFieldByName_whenDtoIsSerialized_thenCorrect() throws JsonParseException, IOException { - final ObjectMapper mapper = new ObjectMapper(); - final SimpleBeanPropertyFilter theFilter = SimpleBeanPropertyFilter.serializeAllExcept("intValue"); - final FilterProvider filters = new SimpleFilterProvider().addFilter("myFilter", theFilter); - - final MyDtoWithFilter dtoObject = new MyDtoWithFilter(); - dtoObject.setIntValue(12); - - final String dtoAsString = mapper.writer(filters) - .writeValueAsString(dtoObject); - - assertThat(dtoAsString, not(containsString("intValue"))); - assertThat(dtoAsString, containsString("booleanValue")); - assertThat(dtoAsString, containsString("stringValue")); - System.out.println(dtoAsString); - } - - @Test - public final void givenTypeHasFilterThatIgnoresNegativeInt_whenDtoIsSerialized_thenCorrect() throws JsonParseException, IOException { - final PropertyFilter theFilter = new SimpleBeanPropertyFilter() { - @Override - public final void serializeAsField(final Object pojo, final JsonGenerator jgen, final SerializerProvider provider, final PropertyWriter writer) throws Exception { - if (include(writer)) { - if (!writer.getName() - .equals("intValue")) { - writer.serializeAsField(pojo, jgen, provider); - return; - } - - final int intValue = ((MyDtoWithFilter) pojo).getIntValue(); - if (intValue >= 0) { - writer.serializeAsField(pojo, jgen, provider); - } - } else if (!jgen.canOmitFields()) { // since 2.3 - writer.serializeAsOmittedField(pojo, jgen, provider); - } - } - - @Override - protected final boolean include(final BeanPropertyWriter writer) { - return true; - } - - @Override - protected final boolean include(final PropertyWriter writer) { - return true; - } - }; - final FilterProvider filters = new SimpleFilterProvider().addFilter("myFilter", theFilter); - - final MyDtoWithFilter dtoObject = new MyDtoWithFilter(); - dtoObject.setIntValue(-1); - - final ObjectMapper mapper = new ObjectMapper(); - final String dtoAsString = mapper.writer(filters) - .writeValueAsString(dtoObject); - - assertThat(dtoAsString, not(containsString("intValue"))); - assertThat(dtoAsString, containsString("booleanValue")); - assertThat(dtoAsString, containsString("stringValue")); - System.out.println(dtoAsString); - } - @Test public final void givenNullsIgnoredOnClass_whenWritingObjectWithNullField_thenIgnored() throws JsonProcessingException { final ObjectMapper mapper = new ObjectMapper(); @@ -191,88 +116,4 @@ public class JacksonSerializationIgnoreUnitTest { System.out.println(dtoAsString); } - // map - - @Test - public final void givenIgnoringMapNullValue_whenWritingMapObjectWithNullValue_thenIgnored() throws JsonProcessingException { - final ObjectMapper mapper = new ObjectMapper(); - // mapper.configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false); - mapper.setSerializationInclusion(Include.NON_NULL); - - final MyDto dtoObject1 = new MyDto(); - - final Map<String, MyDto> dtoMap = new HashMap<String, MyDto>(); - dtoMap.put("dtoObject1", dtoObject1); - dtoMap.put("dtoObject2", null); - - final String dtoMapAsString = mapper.writeValueAsString(dtoMap); - - assertThat(dtoMapAsString, containsString("dtoObject1")); - assertThat(dtoMapAsString, not(containsString("dtoObject2"))); - System.out.println(dtoMapAsString); - } - - @Test - public final void givenIgnoringMapValueObjectWithNullField_whenWritingMapValueObjectWithNullField_thenIgnored() throws JsonProcessingException { - final ObjectMapper mapper = new ObjectMapper(); - mapper.setSerializationInclusion(Include.NON_NULL); - - final MyDto dtoObject = new MyDto(); - - final Map<String, MyDto> dtoMap = new HashMap<String, MyDto>(); - dtoMap.put("dtoObject", dtoObject); - - final String dtoMapAsString = mapper.writeValueAsString(dtoMap); - - assertThat(dtoMapAsString, containsString("dtoObject")); - assertThat(dtoMapAsString, not(containsString("stringValue"))); - System.out.println(dtoMapAsString); - } - - @Test - public final void givenAllowingMapObjectWithNullKey_whenWriting_thenCorrect() throws JsonProcessingException { - final ObjectMapper mapper = new ObjectMapper(); - mapper.getSerializerProvider() - .setNullKeySerializer(new MyDtoNullKeySerializer()); - - final MyDto dtoObject1 = new MyDto(); - dtoObject1.setStringValue("dtoObjectString1"); - final MyDto dtoObject2 = new MyDto(); - dtoObject2.setStringValue("dtoObjectString2"); - - final Map<String, MyDto> dtoMap = new HashMap<String, MyDto>(); - dtoMap.put(null, dtoObject1); - dtoMap.put("obj2", dtoObject2); - - final String dtoMapAsString = mapper.writeValueAsString(dtoMap); - - System.out.println(dtoMapAsString); - assertThat(dtoMapAsString, containsString("\"\"")); - assertThat(dtoMapAsString, containsString("dtoObjectString1")); - assertThat(dtoMapAsString, containsString("obj2")); - } - - @Test - public final void givenAllowingMapObjectOneNullKey_whenWritingMapObjectWithTwoNullKeys_thenOverride() throws JsonProcessingException { - final ObjectMapper mapper = new ObjectMapper(); - mapper.getSerializerProvider() - .setNullKeySerializer(new MyDtoNullKeySerializer()); - - final MyDto dtoObject1 = new MyDto(); - dtoObject1.setStringValue("dtoObject1String"); - - final MyDto dtoObject2 = new MyDto(); - dtoObject2.setStringValue("dtoObject2String"); - - final Map<String, MyDto> dtoMap = new HashMap<String, MyDto>(); - dtoMap.put(null, dtoObject1); - dtoMap.put(null, dtoObject2); - - final String dtoMapAsString = mapper.writeValueAsString(dtoMap); - - assertThat(dtoMapAsString, not(containsString("dtoObject1String"))); - assertThat(dtoMapAsString, containsString("dtoObject2String")); - System.out.println(dtoMapAsString); - } - } diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/ignorenullfields/IgnoreNullFieldsUnitTest.java b/jackson-simple/src/test/java/com/baeldung/jackson/ignorenullfields/IgnoreNullFieldsUnitTest.java new file mode 100644 index 0000000000..ab1d9523e7 --- /dev/null +++ b/jackson-simple/src/test/java/com/baeldung/jackson/ignorenullfields/IgnoreNullFieldsUnitTest.java @@ -0,0 +1,50 @@ +package com.baeldung.jackson.ignorenullfields; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.ser.BeanPropertyWriter; +import com.fasterxml.jackson.databind.ser.FilterProvider; +import com.fasterxml.jackson.databind.ser.PropertyFilter; +import com.fasterxml.jackson.databind.ser.PropertyWriter; +import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; +import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; +import org.junit.Test; + +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.not; +import static org.junit.Assert.assertThat; + +public class IgnoreNullFieldsUnitTest { + + @Test + public final void givenNullsIgnoredOnClass_whenWritingObjectWithNullField_thenIgnored() throws JsonProcessingException { + final ObjectMapper mapper = new ObjectMapper(); + final MyDtoIgnoreNull dtoObject = new MyDtoIgnoreNull(); + + final String dtoAsString = mapper.writeValueAsString(dtoObject); + + assertThat(dtoAsString, containsString("intValue")); + assertThat(dtoAsString, containsString("booleanValue")); + assertThat(dtoAsString, not(containsString("stringValue"))); + System.out.println(dtoAsString); + } + + @Test + public final void givenNullsIgnoredGlobally_whenWritingObjectWithNullField_thenIgnored() throws JsonProcessingException { + final ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + final MyDto dtoObject = new MyDto(); + + final String dtoAsString = mapper.writeValueAsString(dtoObject); + + assertThat(dtoAsString, containsString("intValue")); + assertThat(dtoAsString, containsString("booleanValue")); + assertThat(dtoAsString, not(containsString("stringValue"))); + System.out.println(dtoAsString); + } + +} diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/jsonproperty/JsonPropertyUnitTest.java b/jackson-simple/src/test/java/com/baeldung/jackson/jsonproperty/JsonPropertyUnitTest.java new file mode 100644 index 0000000000..e0571465fb --- /dev/null +++ b/jackson-simple/src/test/java/com/baeldung/jackson/jsonproperty/JsonPropertyUnitTest.java @@ -0,0 +1,44 @@ +package com.baeldung.jackson.jsonproperty; + +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.not; +import static org.junit.Assert.assertThat; + +import java.io.IOException; + +import org.junit.Test; + +import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; +import com.fasterxml.jackson.annotation.PropertyAccessor; +import com.fasterxml.jackson.core.JsonGenerationException; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.module.SimpleModule; + +public class JsonPropertyUnitTest { + + @Test + public final void whenSerializing_thenCorrect() throws JsonParseException, IOException { + final ObjectMapper mapper = new ObjectMapper(); + final String dtoAsString = mapper.writeValueAsString(new MyDto()); + + assertThat(dtoAsString, containsString("intValue")); + assertThat(dtoAsString, containsString("stringValue")); + assertThat(dtoAsString, containsString("booleanValue")); + } + + @Test + public final void givenNameOfFieldIsChangedViaAnnotationOnGetter_whenSerializing_thenCorrect() throws JsonParseException, IOException { + final ObjectMapper mapper = new ObjectMapper(); + final MyDtoFieldNameChanged dtoObject = new MyDtoFieldNameChanged(); + dtoObject.setStringValue("a"); + + final String dtoAsString = mapper.writeValueAsString(dtoObject); + + assertThat(dtoAsString, not(containsString("stringValue"))); + assertThat(dtoAsString, containsString("strVal")); + System.out.println(dtoAsString); + } + +} diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/objectmapper/JavaReadWriteJsonExampleUnitTest.java b/jackson-simple/src/test/java/com/baeldung/jackson/objectmapper/JavaReadWriteJsonExampleUnitTest.java index a339ddf2c5..77940df60b 100644 --- a/jackson-simple/src/test/java/com/baeldung/jackson/objectmapper/JavaReadWriteJsonExampleUnitTest.java +++ b/jackson-simple/src/test/java/com/baeldung/jackson/objectmapper/JavaReadWriteJsonExampleUnitTest.java @@ -21,6 +21,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; public class JavaReadWriteJsonExampleUnitTest { + @Rule public TemporaryFolder folder = new TemporaryFolder(); diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/objectmapper/SerializationDeserializationFeatureUnitTest.java b/jackson-simple/src/test/java/com/baeldung/jackson/objectmapper/SerializationDeserializationFeatureUnitTest.java index fcfee98123..52ebd05bfe 100644 --- a/jackson-simple/src/test/java/com/baeldung/jackson/objectmapper/SerializationDeserializationFeatureUnitTest.java +++ b/jackson-simple/src/test/java/com/baeldung/jackson/objectmapper/SerializationDeserializationFeatureUnitTest.java @@ -19,6 +19,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertThat; public class SerializationDeserializationFeatureUnitTest { + final String EXAMPLE_JSON = "{ \"color\" : \"Black\", \"type\" : \"BMW\" }"; final String JSON_CAR = "{ \"color\" : \"Black\", \"type\" : \"Fiat\", \"year\" : \"1970\" }"; final String JSON_ARRAY = "[{ \"color\" : \"Black\", \"type\" : \"BMW\" }, { \"color\" : \"Red\", \"type\" : \"BMW\" }]"; diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/test/JacksonSerializationUnitTest.java b/jackson-simple/src/test/java/com/baeldung/jackson/test/JacksonSerializationUnitTest.java deleted file mode 100644 index 563dda9eb6..0000000000 --- a/jackson-simple/src/test/java/com/baeldung/jackson/test/JacksonSerializationUnitTest.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.baeldung.jackson.test; - -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.not; -import static org.hamcrest.Matchers.notNullValue; -import static org.junit.Assert.assertThat; - -import java.io.IOException; -import java.util.List; - -import com.baeldung.jackson.dtos.MyDtoFieldNameChanged; -import com.baeldung.jackson.dtos.User; -import com.baeldung.jackson.dtos.Item; -import com.baeldung.jackson.dtos.ItemWithSerializer; -import com.baeldung.jackson.dtos.MyDto; -import com.baeldung.jackson.dtos.MyDtoNoAccessors; -import com.baeldung.jackson.dtos.MyDtoNoAccessorsAndFieldVisibility; -import com.baeldung.jackson.serialization.ItemSerializer; -import org.junit.Test; - -import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; -import com.fasterxml.jackson.annotation.PropertyAccessor; -import com.fasterxml.jackson.core.JsonGenerationException; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.module.SimpleModule; -import com.google.common.collect.Lists; - -public class JacksonSerializationUnitTest { - - // tests - single entity to json - - @Test - public final void whenSerializing_thenCorrect() throws JsonParseException, IOException { - final ObjectMapper mapper = new ObjectMapper(); - final String dtoAsString = mapper.writeValueAsString(new MyDto()); - - assertThat(dtoAsString, containsString("intValue")); - assertThat(dtoAsString, containsString("stringValue")); - assertThat(dtoAsString, containsString("booleanValue")); - } - - @Test - public final void givenNameOfFieldIsChangedViaAnnotationOnGetter_whenSerializing_thenCorrect() throws JsonParseException, IOException { - final ObjectMapper mapper = new ObjectMapper(); - final MyDtoFieldNameChanged dtoObject = new MyDtoFieldNameChanged(); - dtoObject.setStringValue("a"); - - final String dtoAsString = mapper.writeValueAsString(dtoObject); - - assertThat(dtoAsString, not(containsString("stringValue"))); - assertThat(dtoAsString, containsString("strVal")); - System.out.println(dtoAsString); - } - - // tests - serialize via accessors/fields - - @Test(expected = JsonMappingException.class) - public final void givenObjectHasNoAccessors_whenSerializing_thenException() throws JsonParseException, IOException { - final String dtoAsString = new ObjectMapper().writeValueAsString(new MyDtoNoAccessors()); - - assertThat(dtoAsString, notNullValue()); - } - - @Test - public final void givenObjectHasNoAccessors_whenSerializingWithPrivateFieldsVisibility_thenNoException() throws JsonParseException, IOException { - final ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY); - final String dtoAsString = objectMapper.writeValueAsString(new MyDtoNoAccessors()); - - assertThat(dtoAsString, containsString("intValue")); - assertThat(dtoAsString, containsString("stringValue")); - assertThat(dtoAsString, containsString("booleanValue")); - } - - @Test - public final void givenObjectHasNoAccessorsButHasVisibleFields_whenSerializing_thenNoException() throws JsonParseException, IOException { - final ObjectMapper objectMapper = new ObjectMapper(); - final String dtoAsString = objectMapper.writeValueAsString(new MyDtoNoAccessorsAndFieldVisibility()); - - assertThat(dtoAsString, containsString("intValue")); - assertThat(dtoAsString, containsString("stringValue")); - assertThat(dtoAsString, containsString("booleanValue")); - } - - // tests - multiple entities to json - - @Test - public final void whenDtoIsSerialized_thenCorrect() throws JsonParseException, IOException { - final List<MyDto> listOfDtos = Lists.newArrayList(new MyDto("a", 1, true), new MyDto("bc", 3, false)); - - final ObjectMapper mapper = new ObjectMapper(); - final String dtosAsString = mapper.writeValueAsString(listOfDtos); - - System.out.println(dtosAsString); - } - - // tests - custom serializer - - @Test - public final void whenSerializing_thenNoExceptions() throws JsonGenerationException, JsonMappingException, IOException { - final Item myItem = new Item(1, "theItem", new User(2, "theUser")); - final String serialized = new ObjectMapper().writeValueAsString(myItem); - System.out.println(serialized); - } - - @Test - public final void whenSerializingWithCustomSerializer_thenNoExceptions() throws JsonGenerationException, JsonMappingException, IOException { - final Item myItem = new Item(1, "theItem", new User(2, "theUser")); - - final ObjectMapper mapper = new ObjectMapper(); - - final SimpleModule simpleModule = new SimpleModule(); - simpleModule.addSerializer(Item.class, new ItemSerializer()); - mapper.registerModule(simpleModule); - - final String serialized = mapper.writeValueAsString(myItem); - System.out.println(serialized); - } - - @Test - public final void givenSerializerRegisteredOnClass_whenSerializingWithCustomSerializer_thenNoExceptions() throws JsonGenerationException, JsonMappingException, IOException { - final ItemWithSerializer myItem = new ItemWithSerializer(1, "theItem", new User(2, "theUser")); - - final String serialized = new ObjectMapper().writeValueAsString(myItem); - System.out.println(serialized); - } - -} diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/unknownproperties/UnknownPropertiesUnitTest.java b/jackson-simple/src/test/java/com/baeldung/jackson/unknownproperties/UnknownPropertiesUnitTest.java new file mode 100644 index 0000000000..ecdde4736d --- /dev/null +++ b/jackson-simple/src/test/java/com/baeldung/jackson/unknownproperties/UnknownPropertiesUnitTest.java @@ -0,0 +1,80 @@ +package com.baeldung.jackson.unknownproperties; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException; +import org.junit.Test; + +import java.io.IOException; + +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; + +public class UnknownPropertiesUnitTest { + + @Test + public final void givenNotAllFieldsHaveValuesInJson_whenDeserializingAJsonToAClass_thenCorrect() throws JsonParseException, JsonMappingException, IOException { + final String jsonAsString = "{\"stringValue\":\"a\",\"booleanValue\":true}"; + final ObjectMapper mapper = new ObjectMapper(); + + final MyDto readValue = mapper.readValue(jsonAsString, MyDto.class); + + assertNotNull(readValue); + assertThat(readValue.getStringValue(), equalTo("a")); + assertThat(readValue.isBooleanValue(), equalTo(true)); + } + + // tests - json with unknown fields + + @Test(expected = UnrecognizedPropertyException.class) + public final void givenJsonHasUnknownValues_whenDeserializingAJsonToAClass_thenExceptionIsThrown() throws JsonParseException, JsonMappingException, IOException { + final String jsonAsString = "{\"stringValue\":\"a\",\"intValue\":1,\"booleanValue\":true,\"stringValue2\":\"something\"}"; + final ObjectMapper mapper = new ObjectMapper(); + + final MyDto readValue = mapper.readValue(jsonAsString, MyDto.class); + + assertNotNull(readValue); + assertThat(readValue.getStringValue(), equalTo("a")); + assertThat(readValue.isBooleanValue(), equalTo(true)); + assertThat(readValue.getIntValue(), equalTo(1)); + } + + @Test + public final void givenJsonHasUnknownValuesButJacksonIsIgnoringUnknownFields_whenDeserializing_thenCorrect() throws JsonParseException, JsonMappingException, IOException { + final String jsonAsString = // @formatter:off + "{\"stringValue\":\"a\"," + + "\"intValue\":1," + + "\"booleanValue\":true," + + "\"stringValue2\":\"something\"}"; // @formatter:on + final ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + final MyDto readValue = mapper.readValue(jsonAsString, MyDto.class); + + assertNotNull(readValue); + assertThat(readValue.getStringValue(), equalTo("a")); + assertThat(readValue.isBooleanValue(), equalTo(true)); + assertThat(readValue.getIntValue(), equalTo(1)); + } + + @Test + public final void givenJsonHasUnknownValuesButUnknownFieldsAreIgnoredOnClass_whenDeserializing_thenCorrect() throws JsonParseException, JsonMappingException, IOException { + final String jsonAsString = // @formatter:off + "{\"stringValue\":\"a\"," + + "\"intValue\":1," + + "\"booleanValue\":true," + + "\"stringValue2\":\"something\"}"; // @formatter:on + final ObjectMapper mapper = new ObjectMapper(); + + final MyDtoIgnoreUnknown readValue = mapper.readValue(jsonAsString, MyDtoIgnoreUnknown.class); + + assertNotNull(readValue); + assertThat(readValue.getStringValue(), equalTo("a")); + assertThat(readValue.isBooleanValue(), equalTo(true)); + assertThat(readValue.getIntValue(), equalTo(1)); + } + +} diff --git a/jackson/README.md b/jackson/README.md index a62a788c41..bcf8c3036f 100644 --- a/jackson/README.md +++ b/jackson/README.md @@ -7,32 +7,9 @@ This module contains articles about Jackson. The "REST With Spring" Classes: http://bit.ly/restwithspring ### Relevant Articles: - -- [Jackson – Unmarshall to Collection/Array](https://www.baeldung.com/jackson-collection-array) -- [Jackson – Custom Serializer](https://www.baeldung.com/jackson-custom-serialization) -- [Getting Started with Custom Deserialization in Jackson](https://www.baeldung.com/jackson-deserialization) -- [Jackson Exceptions – Problems and Solutions](https://www.baeldung.com/jackson-exception) -- [Jackson Date](https://www.baeldung.com/jackson-serialize-dates) -- [Jackson – Bidirectional Relationships](https://www.baeldung.com/jackson-bidirectional-relationships-and-infinite-recursion) -- [Jackson JSON Tutorial](https://www.baeldung.com/jackson) -- [Jackson – Working with Maps and nulls](https://www.baeldung.com/jackson-map-null-values-or-null-key) -- [Jackson – Decide What Fields Get Serialized/Deserialized](https://www.baeldung.com/jackson-field-serializable-deserializable-or-not) -- [Jackson vs Gson](https://www.baeldung.com/jackson-vs-gson) -- [XML Serialization and Deserialization with Jackson](https://www.baeldung.com/jackson-xml-serialization-and-deserialization) -- [More Jackson Annotations](https://www.baeldung.com/jackson-advanced-annotations) -- [Inheritance with Jackson](https://www.baeldung.com/jackson-inheritance) -- [Guide to @JsonFormat in Jackson](https://www.baeldung.com/jackson-jsonformat) - [Using Optional with Jackson](https://www.baeldung.com/jackson-optional) -- [Map Serialization and Deserialization with Jackson](https://www.baeldung.com/jackson-map) -- [Jackson Streaming API](https://www.baeldung.com/jackson-streaming-api) -- [Jackson – JsonMappingException (No serializer found for class)](https://www.baeldung.com/jackson-jsonmappingexception) -- [How To Serialize and Deserialize Enums with Jackson](https://www.baeldung.com/jackson-serialize-enums) -- [Jackson – Marshall String to JsonNode](https://www.baeldung.com/jackson-json-to-jsonnode) -- [Jackson – Unmarshall to Collection/Array](https://www.baeldung.com/jackson-collection-array) -- [Serialize Only Fields that meet a Custom Criteria with Jackson](https://www.baeldung.com/jackson-serialize-field-custom-criteria) -- [Mapping Nested Values with Jackson](https://www.baeldung.com/jackson-nested-values) -- [Convert XML to JSON Using Jackson](https://www.baeldung.com/jackson-convert-xml-json) -- [Deserialize Immutable Objects with Jackson](https://www.baeldung.com/jackson-deserialize-immutable-objects) -- [Mapping a Dynamic JSON Object with Jackson](https://www.baeldung.com/jackson-mapping-dynamic-object) -- More articles: [[next -->]](/../jackson-2) - +- [Compare Two JSON Objects with Jackson](https://www.baeldung.com/jackson-compare-two-json-objects) +- [Jackson vs Gson](https://www.baeldung.com/jackson-vs-gson) +- [Jackson JSON Tutorial](https://www.baeldung.com/jackson) +- [Inheritance with Jackson](https://www.baeldung.com/jackson-inheritance) +- [Working with Tree Model Nodes in Jackson](https://www.baeldung.com/jackson-json-node-tree-model) diff --git a/jackson/pom.xml b/jackson/pom.xml index 8a083525a2..d7fc3aac9a 100644 --- a/jackson/pom.xml +++ b/jackson/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>jackson</artifactId> <version>0.1-SNAPSHOT</version> @@ -13,12 +14,6 @@ </parent> <dependencies> - <!-- utils --> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>${commons-io.version}</version> - </dependency> <!--jackson for xml --> <dependency> <groupId>com.fasterxml.jackson.dataformat</groupId> @@ -26,26 +21,8 @@ <version>${jackson.version}</version> </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-collections4</artifactId> - <version>${commons-collections4.version}</version> - </dependency> - - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-lang3</artifactId> - <version>${commons-lang3.version}</version> - </dependency> - <!-- marshalling --> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - <version>${jackson.version}</version> - </dependency> - <dependency> <groupId>com.fasterxml.jackson.datatype</groupId> <artifactId>jackson-datatype-jsr310</artifactId> @@ -70,18 +47,6 @@ <version>${jackson.version}</version> </dependency> - <dependency> - <groupId>joda-time</groupId> - <artifactId>joda-time</artifactId> - <version>${joda-time.version}</version> - </dependency> - - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - <version>${gson.version}</version> - </dependency> - <!-- test scoped --> <dependency> @@ -117,11 +82,6 @@ </build> <properties> - <!-- util --> - <joda-time.version>2.10</joda-time.version> - <gson.version>2.8.5</gson.version> - <commons-collections4.version>4.2</commons-collections4.version> - <!-- testing --> <rest-assured.version>3.1.1</rest-assured.version> <assertj.version>3.11.0</assertj.version> diff --git a/jackson/src/test/java/com/baeldung/jackson/inheritance/IgnoranceAnnotationStructure.java b/jackson/src/main/java/com/baeldung/jackson/inheritance/IgnoranceAnnotationStructure.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/inheritance/IgnoranceAnnotationStructure.java rename to jackson/src/main/java/com/baeldung/jackson/inheritance/IgnoranceAnnotationStructure.java diff --git a/jackson/src/test/java/com/baeldung/jackson/inheritance/IgnoranceMixinOrIntrospection.java b/jackson/src/main/java/com/baeldung/jackson/inheritance/IgnoranceMixinOrIntrospection.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/inheritance/IgnoranceMixinOrIntrospection.java rename to jackson/src/main/java/com/baeldung/jackson/inheritance/IgnoranceMixinOrIntrospection.java diff --git a/jackson/src/test/java/com/baeldung/jackson/inheritance/SubTypeConstructorStructure.java b/jackson/src/main/java/com/baeldung/jackson/inheritance/SubTypeConstructorStructure.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/inheritance/SubTypeConstructorStructure.java rename to jackson/src/main/java/com/baeldung/jackson/inheritance/SubTypeConstructorStructure.java diff --git a/jackson/src/test/java/com/baeldung/jackson/inheritance/SubTypeConversionStructure.java b/jackson/src/main/java/com/baeldung/jackson/inheritance/SubTypeConversionStructure.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/inheritance/SubTypeConversionStructure.java rename to jackson/src/main/java/com/baeldung/jackson/inheritance/SubTypeConversionStructure.java diff --git a/jackson/src/test/java/com/baeldung/jackson/inheritance/TypeInfoAnnotatedStructure.java b/jackson/src/main/java/com/baeldung/jackson/inheritance/TypeInfoAnnotatedStructure.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/inheritance/TypeInfoAnnotatedStructure.java rename to jackson/src/main/java/com/baeldung/jackson/inheritance/TypeInfoAnnotatedStructure.java diff --git a/jackson/src/test/java/com/baeldung/jackson/inheritance/TypeInfoStructure.java b/jackson/src/main/java/com/baeldung/jackson/inheritance/TypeInfoStructure.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/inheritance/TypeInfoStructure.java rename to jackson/src/main/java/com/baeldung/jackson/inheritance/TypeInfoStructure.java diff --git a/jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/ActorJackson.java b/jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/ActorJackson.java new file mode 100644 index 0000000000..b4b6d99447 --- /dev/null +++ b/jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/ActorJackson.java @@ -0,0 +1,61 @@ +package com.baeldung.jackson.jacksonvsgson; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.Locale; +import java.util.TimeZone; + +public class ActorJackson { + + private String imdbId; + private Date dateOfBirth; + private List<String> filmography; + + public ActorJackson() { + super(); + } + + public ActorJackson(String imdbId, Date dateOfBirth, List<String> filmography) { + super(); + this.imdbId = imdbId; + this.dateOfBirth = dateOfBirth; + this.filmography = filmography; + } + + @Override + public String toString() { + return "ActorJackson [imdbId=" + imdbId + ", dateOfBirth=" + formatDateOfBirth() + ", filmography=" + filmography + "]"; + } + + public String getImdbId() { + return imdbId; + } + + public void setImdbId(String imdbId) { + this.imdbId = imdbId; + } + + public Date getDateOfBirth() { + return dateOfBirth; + } + + public void setDateOfBirth(Date dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + public List<String> getFilmography() { + return filmography; + } + + public void setFilmography(List<String> filmography) { + this.filmography = filmography; + } + + private String formatDateOfBirth() { + final DateFormat formatter = new SimpleDateFormat("EEE MMM dd hh:mm:ss zzz yyyy", Locale.US); + formatter.setTimeZone(TimeZone.getTimeZone("GMT")); + return formatter.format(dateOfBirth); + } +} diff --git a/jackson/src/main/java/com/baeldung/jackson/serialization/ActorJacksonSerializer.java b/jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/ActorJacksonSerializer.java similarity index 92% rename from jackson/src/main/java/com/baeldung/jackson/serialization/ActorJacksonSerializer.java rename to jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/ActorJacksonSerializer.java index 2340de5957..837c837cf5 100644 --- a/jackson/src/main/java/com/baeldung/jackson/serialization/ActorJacksonSerializer.java +++ b/jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/ActorJacksonSerializer.java @@ -1,11 +1,9 @@ -package com.baeldung.jackson.serialization; +package com.baeldung.jackson.jacksonvsgson; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.stream.Collectors; -import com.baeldung.jackson.entities.ActorJackson; - import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.ser.std.StdSerializer; diff --git a/jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/Movie.java b/jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/Movie.java new file mode 100644 index 0000000000..070d1bc2d4 --- /dev/null +++ b/jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/Movie.java @@ -0,0 +1,50 @@ +package com.baeldung.jackson.jacksonvsgson; + +import java.util.List; + +public class Movie { + + private String imdbId; + private String director; + private List<ActorJackson> actors; + + public Movie(String imdbId, String director, List<ActorJackson> actors) { + super(); + this.imdbId = imdbId; + this.director = director; + this.actors = actors; + } + + public Movie() { + super(); + } + + @Override + public String toString() { + return "Movie [imdbId=" + imdbId + ", director=" + director + ", actors=" + actors + "]"; + } + + public String getImdbId() { + return imdbId; + } + + public void setImdbId(String imdbId) { + this.imdbId = imdbId; + } + + public String getDirector() { + return director; + } + + public void setDirector(String director) { + this.director = director; + } + + public List<ActorJackson> getActors() { + return actors; + } + + public void setActors(List<ActorJackson> actors) { + this.actors = actors; + } +} \ No newline at end of file diff --git a/jackson/src/main/java/com/baeldung/jackson/entities/MovieWithNullValue.java b/jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/MovieWithNullValue.java similarity index 95% rename from jackson/src/main/java/com/baeldung/jackson/entities/MovieWithNullValue.java rename to jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/MovieWithNullValue.java index 4b31196ff9..a0b013cfc3 100644 --- a/jackson/src/main/java/com/baeldung/jackson/entities/MovieWithNullValue.java +++ b/jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/MovieWithNullValue.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.entities; +package com.baeldung.jackson.jacksonvsgson; import com.fasterxml.jackson.annotation.JsonIgnore; diff --git a/jackson-2/src/main/java/com/baeldung/jackson/node/JsonNodeIterator.java b/jackson/src/main/java/com/baeldung/jackson/node/JsonNodeIterator.java similarity index 75% rename from jackson-2/src/main/java/com/baeldung/jackson/node/JsonNodeIterator.java rename to jackson/src/main/java/com/baeldung/jackson/node/JsonNodeIterator.java index f582772587..dc1aa35aec 100644 --- a/jackson-2/src/main/java/com/baeldung/jackson/node/JsonNodeIterator.java +++ b/jackson/src/main/java/com/baeldung/jackson/node/JsonNodeIterator.java @@ -44,19 +44,19 @@ public class JsonNodeIterator { } -private void addFieldNameToYaml(StringBuilder yaml, String fieldName, int depth, boolean isFirstInArray) { - if (yaml.length()>0) { - yaml.append(NEW_LINE); - int requiredDepth = (isFirstInArray) ? depth-1 : depth; - for(int i = 0; i < requiredDepth; i++) { - yaml.append(YAML_PREFIX); - } - if (isFirstInArray) { - yaml.append(ARRAY_PREFIX); + private void addFieldNameToYaml(StringBuilder yaml, String fieldName, int depth, boolean isFirstInArray) { + if (yaml.length()>0) { + yaml.append(NEW_LINE); + int requiredDepth = (isFirstInArray) ? depth-1 : depth; + for(int i = 0; i < requiredDepth; i++) { + yaml.append(YAML_PREFIX); + } + if (isFirstInArray) { + yaml.append(ARRAY_PREFIX); + } } + yaml.append(fieldName); + yaml.append(FIELD_DELIMITER); } - yaml.append(fieldName); - yaml.append(FIELD_DELIMITER); -} } diff --git a/jackson/src/main/java/com/baeldung/jackson/miscellaneous/mixin/Book.java b/jackson/src/main/java/com/baeldung/jackson/optionalwithjackson/Book.java similarity index 89% rename from jackson/src/main/java/com/baeldung/jackson/miscellaneous/mixin/Book.java rename to jackson/src/main/java/com/baeldung/jackson/optionalwithjackson/Book.java index fb961efe85..5b83b7efc3 100644 --- a/jackson/src/main/java/com/baeldung/jackson/miscellaneous/mixin/Book.java +++ b/jackson/src/main/java/com/baeldung/jackson/optionalwithjackson/Book.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.miscellaneous.mixin; +package com.baeldung.jackson.optionalwithjackson; import java.util.Optional; diff --git a/jackson/src/test/java/com/baeldung/jackson/exception/User.java b/jackson/src/test/java/com/baeldung/jackson/exception/User.java deleted file mode 100644 index 1d78e82bec..0000000000 --- a/jackson/src/test/java/com/baeldung/jackson/exception/User.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.baeldung.jackson.exception; - -public class User { - public int id; - public String name; - - public User(final int id, final String name) { - this.id = id; - this.name = name; - } -} diff --git a/jackson/src/test/java/com/baeldung/jackson/deserialization/JacksonDeserializeUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/jacksonvsgson/JacksonDeserializeUnitTest.java similarity index 95% rename from jackson/src/test/java/com/baeldung/jackson/deserialization/JacksonDeserializeUnitTest.java rename to jackson/src/test/java/com/baeldung/jackson/jacksonvsgson/JacksonDeserializeUnitTest.java index dc055a8f9a..b6b2f44c42 100644 --- a/jackson/src/test/java/com/baeldung/jackson/deserialization/JacksonDeserializeUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/jacksonvsgson/JacksonDeserializeUnitTest.java @@ -1,9 +1,8 @@ -package com.baeldung.jackson.deserialization; +package com.baeldung.jackson.jacksonvsgson; import java.io.IOException; import java.text.DateFormat; import java.text.SimpleDateFormat; -import com.baeldung.jackson.entities.Movie; import org.junit.Test; import com.fasterxml.jackson.databind.ObjectMapper; import static org.junit.Assert.assertEquals; diff --git a/jackson/src/test/java/com/baeldung/jackson/serialization/JacksonSerializeUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/jacksonvsgson/JacksonSerializeUnitTest.java similarity index 93% rename from jackson/src/test/java/com/baeldung/jackson/serialization/JacksonSerializeUnitTest.java rename to jackson/src/test/java/com/baeldung/jackson/jacksonvsgson/JacksonSerializeUnitTest.java index a003c5b526..aff01cb52a 100644 --- a/jackson/src/test/java/com/baeldung/jackson/serialization/JacksonSerializeUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/jacksonvsgson/JacksonSerializeUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.serialization; +package com.baeldung.jackson.jacksonvsgson; import java.io.IOException; import java.text.ParseException; @@ -6,9 +6,6 @@ import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.TimeZone; -import com.baeldung.jackson.entities.ActorJackson; -import com.baeldung.jackson.entities.Movie; -import com.baeldung.jackson.entities.MovieWithNullValue; import org.junit.Assert; import org.junit.Test; diff --git a/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/jsoncompare/JsonCompareUnitTest.java similarity index 99% rename from jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java rename to jackson/src/test/java/com/baeldung/jackson/jsoncompare/JsonCompareUnitTest.java index 03d7c63e36..8c6b6031c3 100644 --- a/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/jsoncompare/JsonCompareUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.json.compare; +package com.baeldung.jackson.jsoncompare; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; diff --git a/jackson-2/src/test/java/com/baeldung/jackson/node/ExampleStructure.java b/jackson/src/test/java/com/baeldung/jackson/node/ExampleStructure.java similarity index 100% rename from jackson-2/src/test/java/com/baeldung/jackson/node/ExampleStructure.java rename to jackson/src/test/java/com/baeldung/jackson/node/ExampleStructure.java diff --git a/jackson-2/src/test/java/com/baeldung/jackson/node/JsonNodeIteratorUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/node/JsonNodeIteratorUnitTest.java similarity index 100% rename from jackson-2/src/test/java/com/baeldung/jackson/node/JsonNodeIteratorUnitTest.java rename to jackson/src/test/java/com/baeldung/jackson/node/JsonNodeIteratorUnitTest.java diff --git a/jackson-2/src/test/java/com/baeldung/jackson/node/NodeBean.java b/jackson/src/test/java/com/baeldung/jackson/node/NodeBean.java similarity index 100% rename from jackson-2/src/test/java/com/baeldung/jackson/node/NodeBean.java rename to jackson/src/test/java/com/baeldung/jackson/node/NodeBean.java diff --git a/jackson-2/src/test/java/com/baeldung/jackson/node/NodeOperationUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/node/NodeOperationUnitTest.java similarity index 100% rename from jackson-2/src/test/java/com/baeldung/jackson/node/NodeOperationUnitTest.java rename to jackson/src/test/java/com/baeldung/jackson/node/NodeOperationUnitTest.java diff --git a/jackson/src/test/java/com/baeldung/jackson/miscellaneous/mixin/OptionalTypeUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/optionalwithjackson/OptionalTypeUnitTest.java similarity index 97% rename from jackson/src/test/java/com/baeldung/jackson/miscellaneous/mixin/OptionalTypeUnitTest.java rename to jackson/src/test/java/com/baeldung/jackson/optionalwithjackson/OptionalTypeUnitTest.java index dc807a84b8..ed9d53b003 100644 --- a/jackson/src/test/java/com/baeldung/jackson/miscellaneous/mixin/OptionalTypeUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/optionalwithjackson/OptionalTypeUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.miscellaneous.mixin; +package com.baeldung.jackson.optionalwithjackson; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/jackson/src/test/java/com/baeldung/jackson/sandbox/SandboxUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/sandbox/SandboxUnitTest.java index 6f22e2fa01..fca8a2461e 100644 --- a/jackson/src/test/java/com/baeldung/jackson/sandbox/SandboxUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/sandbox/SandboxUnitTest.java @@ -26,6 +26,4 @@ public class SandboxUnitTest { System.err.println(serialized); } - // - } diff --git a/jackson/src/test/java/com/baeldung/jackson/test/JacksonDeserializationUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/test/JacksonDeserializationUnitTest.java deleted file mode 100644 index 035ff8ca9c..0000000000 --- a/jackson/src/test/java/com/baeldung/jackson/test/JacksonDeserializationUnitTest.java +++ /dev/null @@ -1,204 +0,0 @@ -package com.baeldung.jackson.test; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.not; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.notNullValue; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; - -import java.io.IOException; -import java.time.ZoneId; -import java.time.ZonedDateTime; - -import org.junit.Test; - -import com.baeldung.jackson.deserialization.ItemDeserializer; -import com.baeldung.jackson.dtos.Item; -import com.baeldung.jackson.dtos.ItemWithSerializer; -import com.baeldung.jackson.dtos.MyDto; -import com.baeldung.jackson.dtos.ignore.MyDtoIgnoreUnknown; -import com.fasterxml.jackson.core.JsonFactory; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException; -import com.fasterxml.jackson.databind.module.SimpleModule; - -public class JacksonDeserializationUnitTest { - - @Test - public final void whenDeserializingAJsonToAClass_thenCorrect() throws JsonParseException, JsonMappingException, IOException { - final String jsonAsString = "{\"stringValue\":\"a\",\"intValue\":1,\"booleanValue\":true}"; - final ObjectMapper mapper = new ObjectMapper(); - - final MyDto readValue = mapper.readValue(jsonAsString, MyDto.class); - - assertNotNull(readValue); - assertThat(readValue.getStringValue(), equalTo("a")); - } - - @Test - public final void givenNotAllFieldsHaveValuesInJson_whenDeserializingAJsonToAClass_thenCorrect() throws JsonParseException, JsonMappingException, IOException { - final String jsonAsString = "{\"stringValue\":\"a\",\"booleanValue\":true}"; - final ObjectMapper mapper = new ObjectMapper(); - - final MyDto readValue = mapper.readValue(jsonAsString, MyDto.class); - - assertNotNull(readValue); - assertThat(readValue.getStringValue(), equalTo("a")); - assertThat(readValue.isBooleanValue(), equalTo(true)); - } - - // tests - json with unknown fields - - @Test(expected = UnrecognizedPropertyException.class) - public final void givenJsonHasUnknownValues_whenDeserializingAJsonToAClass_thenExceptionIsThrown() throws JsonParseException, JsonMappingException, IOException { - final String jsonAsString = "{\"stringValue\":\"a\",\"intValue\":1,\"booleanValue\":true,\"stringValue2\":\"something\"}"; - final ObjectMapper mapper = new ObjectMapper(); - - final MyDto readValue = mapper.readValue(jsonAsString, MyDto.class); - - assertNotNull(readValue); - assertThat(readValue.getStringValue(), equalTo("a")); - assertThat(readValue.isBooleanValue(), equalTo(true)); - assertThat(readValue.getIntValue(), equalTo(1)); - } - - @Test - public final void givenJsonHasUnknownValuesButJacksonIsIgnoringUnknownFields_whenDeserializing_thenCorrect() throws JsonParseException, JsonMappingException, IOException { - final String jsonAsString = // @formatter:off - "{\"stringValue\":\"a\"," + - "\"intValue\":1," + - "\"booleanValue\":true," + - "\"stringValue2\":\"something\"}"; // @formatter:on - final ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - final MyDto readValue = mapper.readValue(jsonAsString, MyDto.class); - - assertNotNull(readValue); - assertThat(readValue.getStringValue(), equalTo("a")); - assertThat(readValue.isBooleanValue(), equalTo(true)); - assertThat(readValue.getIntValue(), equalTo(1)); - } - - @Test - public final void givenJsonHasUnknownValuesButUnknownFieldsAreIgnoredOnClass_whenDeserializing_thenCorrect() throws JsonParseException, JsonMappingException, IOException { - final String jsonAsString = // @formatter:off - "{\"stringValue\":\"a\"," + - "\"intValue\":1," + - "\"booleanValue\":true," + - "\"stringValue2\":\"something\"}"; // @formatter:on - final ObjectMapper mapper = new ObjectMapper(); - - final MyDtoIgnoreUnknown readValue = mapper.readValue(jsonAsString, MyDtoIgnoreUnknown.class); - - assertNotNull(readValue); - assertThat(readValue.getStringValue(), equalTo("a")); - assertThat(readValue.isBooleanValue(), equalTo(true)); - assertThat(readValue.getIntValue(), equalTo(1)); - } - - // to JsonNode - - @Test - public final void whenParsingJsonStringIntoJsonNode_thenCorrect() throws JsonParseException, IOException { - final String jsonString = "{\"k1\":\"v1\",\"k2\":\"v2\"}"; - - final ObjectMapper mapper = new ObjectMapper(); - final JsonNode actualObj = mapper.readTree(jsonString); - - assertNotNull(actualObj); - } - - @Test - public final void givenUsingLowLevelDetails_whenParsingJsonStringIntoJsonNode_thenCorrect() throws JsonParseException, IOException { - final String jsonString = "{\"k1\":\"v1\",\"k2\":\"v2\"}"; - - final ObjectMapper mapper = new ObjectMapper(); - final JsonFactory factory = mapper.getFactory(); - final JsonParser parser = factory.createParser(jsonString); - final JsonNode actualObj = mapper.readTree(parser); - - assertNotNull(actualObj); - } - - @Test - public final void givenTheJsonNode_whenRetrievingDataFromId_thenCorrect() throws JsonParseException, IOException { - final String jsonString = "{\"k1\":\"v1\",\"k2\":\"v2\"}"; - final ObjectMapper mapper = new ObjectMapper(); - final JsonNode actualObj = mapper.readTree(jsonString); - - // When - final JsonNode jsonNode1 = actualObj.get("k1"); - assertThat(jsonNode1.textValue(), equalTo("v1")); - } - - // custom deserialization - - @Test - public final void whenDeserializingTheStandardRepresentation_thenCorrect() throws JsonParseException, JsonMappingException, IOException { - final String json = "{\"id\":1,\"itemName\":\"theItem\",\"owner\":{\"id\":2,\"name\":\"theUser\"}}"; - - final Item readValue = new ObjectMapper().readValue(json, Item.class); - assertThat(readValue, notNullValue()); - } - - @Test - public final void whenDeserializingANonStandardRepresentation_thenCorrect() throws JsonParseException, JsonMappingException, IOException { - final String json = "{\"id\":1,\"itemName\":\"theItem\",\"createdBy\":2}"; - final ObjectMapper mapper = new ObjectMapper(); - - final SimpleModule module = new SimpleModule(); - module.addDeserializer(Item.class, new ItemDeserializer()); - mapper.registerModule(module); - - final Item readValue = mapper.readValue(json, Item.class); - assertThat(readValue, notNullValue()); - } - - @Test - public final void givenDeserializerIsOnClass_whenDeserializingCustomRepresentation_thenCorrect() throws JsonParseException, JsonMappingException, IOException { - final String json = "{\"id\":1,\"itemName\":\"theItem\",\"owner\":2}"; - - final ItemWithSerializer readValue = new ObjectMapper().readValue(json, ItemWithSerializer.class); - assertThat(readValue, notNullValue()); - } - - @Test - public void whenDeserialisingZonedDateTimeWithDefaults_thenTimeZoneIsNotPreserved() throws IOException { - ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.findAndRegisterModules(); - objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); - // construct a new instance of ZonedDateTime - ZonedDateTime now = ZonedDateTime.now(ZoneId.of("Europe/Berlin")); - String converted = objectMapper.writeValueAsString(now); - // restore an instance of ZonedDateTime from String - ZonedDateTime restored = objectMapper.readValue(converted, ZonedDateTime.class); - System.out.println("serialized: " + now); - System.out.println("restored: " + restored); - assertThat(now, is(not(restored))); - } - - @Test - public void whenDeserialisingZonedDateTimeWithFeaturesDisabled_thenTimeZoneIsPreserved() throws IOException { - ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.findAndRegisterModules(); - objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); - objectMapper.disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE); - // construct a new instance of ZonedDateTime - ZonedDateTime now = ZonedDateTime.now(ZoneId.of("Europe/Berlin")); - String converted = objectMapper.writeValueAsString(now); - // restore an instance of ZonedDateTime from String - ZonedDateTime restored = objectMapper.readValue(converted, ZonedDateTime.class); - System.out.println("serialized: " + now); - System.out.println("restored: " + restored); - assertThat(now, is(restored)); - } - -} diff --git a/jackson/src/test/java/com/baeldung/jackson/test/UnitTestSuite.java b/jackson/src/test/java/com/baeldung/jackson/test/UnitTestSuite.java index e783c67f5b..6096bc9961 100644 --- a/jackson/src/test/java/com/baeldung/jackson/test/UnitTestSuite.java +++ b/jackson/src/test/java/com/baeldung/jackson/test/UnitTestSuite.java @@ -7,13 +7,8 @@ import org.junit.runners.Suite; @RunWith(Suite.class) @Suite.SuiteClasses({ // @formatter:off - JacksonCollectionDeserializationUnitTest.class - ,JacksonSerializationEnumsUnitTest.class - ,JacksonDeserializationUnitTest.class - ,JacksonDeserializationUnitTest.class - ,JacksonPrettyPrintUnitTest.class + JacksonPrettyPrintUnitTest.class ,SandboxUnitTest.class - ,JacksonFieldUnitTest.class }) // @formatter:on public class UnitTestSuite { } \ No newline at end of file diff --git a/jackson/src/test/java/com/baeldung/jackson/try1/JacksonDeserializationUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/try1/JacksonDeserializationUnitTest.java deleted file mode 100644 index 9fc195a8aa..0000000000 --- a/jackson/src/test/java/com/baeldung/jackson/try1/JacksonDeserializationUnitTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.baeldung.jackson.try1; - -import static org.hamcrest.Matchers.notNullValue; -import static org.junit.Assert.assertThat; - -import java.io.IOException; - -import com.baeldung.jackson.dtos.ItemWithSerializer; -import org.junit.Test; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -public class JacksonDeserializationUnitTest { - - @Test - public final void givenDeserializerIsOnClass_whenDeserializingCustomRepresentation_thenCorrect() throws JsonParseException, JsonMappingException, IOException { - final String json = "{\"id\":1,\"itemName\":\"theItem\",\"owner\":2}"; - - final ItemWithSerializer readValue = new ObjectMapper().readValue(json, ItemWithSerializer.class); - assertThat(readValue, notNullValue()); - } - -} diff --git a/jackson-2/src/test/resources/node_example.json b/jackson/src/test/resources/node_example.json similarity index 100% rename from jackson-2/src/test/resources/node_example.json rename to jackson/src/test/resources/node_example.json diff --git a/java-blockchain/pom.xml b/java-blockchain/pom.xml index 4c5d0f31d5..3100fed7b9 100644 --- a/java-blockchain/pom.xml +++ b/java-blockchain/pom.xml @@ -1,6 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.blockchain</groupId> <artifactId>java-blockchain</artifactId> diff --git a/java-collections-conversions-2/pom.xml b/java-collections-conversions-2/pom.xml index 72673527ac..b04d764719 100644 --- a/java-collections-conversions-2/pom.xml +++ b/java-collections-conversions-2/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>java-collections-conversions-2</artifactId> <version>0.1.0-SNAPSHOT</version> @@ -31,6 +32,4 @@ </resources> </build> - <properties> - </properties> </project> diff --git a/java-collections-conversions/pom.xml b/java-collections-conversions/pom.xml index b5ab4f841a..2073640372 100644 --- a/java-collections-conversions/pom.xml +++ b/java-collections-conversions/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>java-collections-conversions</artifactId> <version>0.1.0-SNAPSHOT</version> @@ -24,16 +25,10 @@ <artifactId>commons-lang3</artifactId> <version>${commons-lang3.version}</version> </dependency> - <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <version>${assertj.version}</version> - <scope>test</scope> - </dependency> </dependencies> <build> - <finalName>java-collections-conversions-2</finalName> + <finalName>java-collections-conversions</finalName> <resources> <resource> <directory>src/main/resources</directory> @@ -44,6 +39,5 @@ <properties> <commons-collections4.version>4.1</commons-collections4.version> - <assertj.version>3.6.1</assertj.version> </properties> </project> diff --git a/java-collections-conversions/src/main/java/com/baeldung/convertToMap/ConvertToMap.java b/java-collections-conversions/src/main/java/com/baeldung/convertToMap/ConvertToMap.java index e33d9ee212..317cdca529 100644 --- a/java-collections-conversions/src/main/java/com/baeldung/convertToMap/ConvertToMap.java +++ b/java-collections-conversions/src/main/java/com/baeldung/convertToMap/ConvertToMap.java @@ -24,10 +24,7 @@ public class ConvertToMap { public TreeMap<String, Book> listToSortedMap(List<Book> books) { return books.stream() - .sorted(Comparator.comparing(Book::getName)) .collect(Collectors.toMap(Book::getName, Function.identity(), (o1, o2) -> o1, TreeMap::new)); } - - } diff --git a/java-collections-maps/pom.xml b/java-collections-maps/pom.xml index b755582580..38cf1c38ad 100644 --- a/java-collections-maps/pom.xml +++ b/java-collections-maps/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>java-collections-maps</artifactId> <version>0.1.0-SNAPSHOT</version> @@ -19,17 +20,6 @@ <artifactId>commons-collections4</artifactId> <version>${commons-collections4.version}</version> </dependency> - <dependency> - <groupId>com.jayway.awaitility</groupId> - <artifactId>awaitility</artifactId> - <version>${avaitility.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-lang3</artifactId> - <version>${commons-lang3.version}</version> - </dependency> <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> @@ -40,9 +30,6 @@ <properties> <commons-collections4.version>4.1</commons-collections4.version> - <collections-generic.version>4.01</collections-generic.version> - <avaitility.version>1.7.0</avaitility.version> <assertj.version>3.6.1</assertj.version> - <eclipse.collections.version>7.1.0</eclipse.collections.version> </properties> </project> diff --git a/java-ee-8-security-api/app-auth-basic-store-db/pom.xml b/java-ee-8-security-api/app-auth-basic-store-db/pom.xml index 582e82d8bb..02e3b04a40 100644 --- a/java-ee-8-security-api/app-auth-basic-store-db/pom.xml +++ b/java-ee-8-security-api/app-auth-basic-store-db/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>app-auth-basic-store-db</artifactId> <name>app-auth-basic-store-db</name> @@ -64,4 +64,5 @@ </plugin> </plugins> </build> + </project> diff --git a/java-ee-8-security-api/app-auth-custom-form-store-custom/pom.xml b/java-ee-8-security-api/app-auth-custom-form-store-custom/pom.xml index 43809f1cd5..9354782999 100644 --- a/java-ee-8-security-api/app-auth-custom-form-store-custom/pom.xml +++ b/java-ee-8-security-api/app-auth-custom-form-store-custom/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>app-auth-custom-form-store-custom</artifactId> <name>app-auth-custom-form-store-custom</name> @@ -38,4 +38,5 @@ </plugin> </plugins> </build> + </project> diff --git a/java-ee-8-security-api/app-auth-custom-no-store/pom.xml b/java-ee-8-security-api/app-auth-custom-no-store/pom.xml index 51ee64097a..fee665e22d 100644 --- a/java-ee-8-security-api/app-auth-custom-no-store/pom.xml +++ b/java-ee-8-security-api/app-auth-custom-no-store/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>app-auth-custom-no-store</artifactId> <name>app-auth-custom-no-store</name> @@ -64,4 +64,5 @@ </plugin> </plugins> </build> + </project> diff --git a/java-ee-8-security-api/app-auth-form-store-ldap/pom.xml b/java-ee-8-security-api/app-auth-form-store-ldap/pom.xml index 6a7b97b2d7..912a2cabac 100644 --- a/java-ee-8-security-api/app-auth-form-store-ldap/pom.xml +++ b/java-ee-8-security-api/app-auth-form-store-ldap/pom.xml @@ -47,4 +47,5 @@ </plugin> </plugins> </build> + </project> diff --git a/java-ee-8-security-api/pom.xml b/java-ee-8-security-api/pom.xml index f43f3d7c5f..5eeebcb6f0 100644 --- a/java-ee-8-security-api/pom.xml +++ b/java-ee-8-security-api/pom.xml @@ -8,11 +8,11 @@ <name>java-ee-8-security-api</name> <packaging>pom</packaging> - <parent> - <groupId>com.baeldung</groupId> - <artifactId>parent-modules</artifactId> - <version>1.0.0-SNAPSHOT</version> - </parent> + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> <modules> <module>app-auth-basic-store-db</module> @@ -22,14 +22,12 @@ </modules> <dependencies> - <dependency> <groupId>javax</groupId> <artifactId>javaee-web-api</artifactId> <version>${javaee-version}</version> <scope>provided</scope> </dependency> - </dependencies> <build> diff --git a/java-jdi/pom.xml b/java-jdi/pom.xml index 3d70461dce..978ede604b 100644 --- a/java-jdi/pom.xml +++ b/java-jdi/pom.xml @@ -1,6 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>java-jdi</artifactId> <version>0.1.0-SNAPSHOT</version> @@ -15,48 +16,12 @@ </parent> <dependencies> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <version>${log4j.version}</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <version>${org.slf4j.version}</version> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>${logback.version}</version> - </dependency> - <dependency> - <groupId>org.openjdk.jmh</groupId> - <artifactId>jmh-core</artifactId> - <version>${jmh-core.version}</version> - </dependency> - <dependency> - <groupId>org.openjdk.jmh</groupId> - <artifactId>jmh-generator-annprocess</artifactId> - <version>${jmh-generator.version}</version> - </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-lang3</artifactId> - <version>${commons-lang3.version}</version> - </dependency> - <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <version>${assertj.version}</version> - <scope>test</scope> - </dependency> <dependency> <groupId>com.sun</groupId> <artifactId>tools</artifactId> <version>${tools.version}</version> <scope>system</scope> - <systemPath>${java.home}/../lib/tools.jar</systemPath> + <systemPath>${java.home}/../lib/tools.jar</systemPath> </dependency> </dependencies> @@ -68,63 +33,10 @@ <filtering>true</filtering> </resource> </resources> - - <plugins> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <version>${maven-javadoc-plugin.version}</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - </plugins> </build> - <profiles> - <profile> - <id>integration</id> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <executions> - <execution> - <phase>integration-test</phase> - <goals> - <goal>test</goal> - </goals> - <configuration> - <includes> - <include>**/*IntegrationTest.java</include> - </includes> - </configuration> - </execution> - </executions> - <configuration> - <systemPropertyVariables> - <test.mime>json</test.mime> - </systemPropertyVariables> - </configuration> - </plugin> - </plugins> - </build> - </profile> - </profiles> - <properties> - <commons-lang3.version>3.5</commons-lang3.version> - - <assertj.version>3.6.1</assertj.version> - <tool.version>1.8</tool.version> - <org.slf4j.version>1.7.21</org.slf4j.version> - <logback.version>1.1.7</logback.version> - <tools.version>1.8</tools.version> - <maven-surefire-plugin.version>2.21.0</maven-surefire-plugin.version> - <maven-javadoc-plugin.version>3.0.0-M1</maven-javadoc-plugin.version> - <maven-jar-plugin.version>3.0.2</maven-jar-plugin.version> + <tools.version>1.8</tools.version> </properties> + </project> diff --git a/java-lite/pom.xml b/java-lite/pom.xml index ce6e838d92..7ff50a8fd3 100644 --- a/java-lite/pom.xml +++ b/java-lite/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.baeldung</groupId> <artifactId>java-lite</artifactId> diff --git a/java-math-2/README.md b/java-math-2/README.md new file mode 100644 index 0000000000..ca809e8623 --- /dev/null +++ b/java-math-2/README.md @@ -0,0 +1,8 @@ +## Java Math + +This module contains articles about math in Java. + +### Relevant articles: + +- [Basic Calculator in Java](https://www.baeldung.com/basic-calculator-in-java) +- More articles: [[<-- prev]](/../java-math) diff --git a/java-math-2/pom.xml b/java-math-2/pom.xml new file mode 100644 index 0000000000..e22dcc2b31 --- /dev/null +++ b/java-math-2/pom.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>java-math-2</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>java-math-2</name> + + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> + +</project> \ No newline at end of file diff --git a/spring-cloud/spring-cloud-kubernetes/client-service/src/main/resources/logback.xml b/java-math-2/src/main/resources/logback.xml similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/client-service/src/main/resources/logback.xml rename to java-math-2/src/main/resources/logback.xml diff --git a/java-math/pom.xml b/java-math/pom.xml index b5c31c4487..9b4af4c13d 100644 --- a/java-math/pom.xml +++ b/java-math/pom.xml @@ -1,10 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>java-math</artifactId> <version>0.0.1-SNAPSHOT</version> <name>java-math</name> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> @@ -42,17 +43,6 @@ <artifactId>guava</artifactId> <version>${guava.version}</version> </dependency> - <dependency> - <groupId>commons-codec</groupId> - <artifactId>commons-codec</artifactId> - <version>${commons-codec.version}</version> - </dependency> - <dependency> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - <version>${lombok.version}</version> - <scope>provided</scope> - </dependency> <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> @@ -63,13 +53,8 @@ <groupId>com.github.dpaukov</groupId> <artifactId>combinatoricslib3</artifactId> <version>${combinatoricslib3.version}</version> - </dependency> - <!-- Benchmarking --> - <dependency> - <groupId>org.openjdk.jmh</groupId> - <artifactId>jmh-core</artifactId> - <version>${jmh.version}</version> </dependency> + <!-- Benchmarking --> <dependency> <groupId>org.openjdk.jmh</groupId> <artifactId>jmh-generator-annprocess</artifactId> @@ -92,7 +77,6 @@ <properties> <commons-math3.version>3.6.1</commons-math3.version> <org.assertj.core.version>3.9.0</org.assertj.core.version> - <commons-codec.version>1.11</commons-codec.version> <guava.version>27.0.1-jre</guava.version> <combinatoricslib3.version>3.3.0</combinatoricslib3.version> <ejml.version>0.38</ejml.version> diff --git a/java-math/src/main/java/com/baeldung/matrices/benchmark/BigMatrixMultiplicationBenchmarking.java b/java-math/src/main/java/com/baeldung/matrices/benchmark/BigMatrixMultiplicationBenchmarking.java new file mode 100644 index 0000000000..2ed983f733 --- /dev/null +++ b/java-math/src/main/java/com/baeldung/matrices/benchmark/BigMatrixMultiplicationBenchmarking.java @@ -0,0 +1,121 @@ +package com.baeldung.matrices.benchmark; + +import cern.colt.matrix.DoubleFactory2D; +import cern.colt.matrix.DoubleMatrix2D; +import cern.colt.matrix.linalg.Algebra; +import com.baeldung.matrices.HomemadeMatrix; +import org.apache.commons.math3.linear.Array2DRowRealMatrix; +import org.apache.commons.math3.linear.RealMatrix; +import org.ejml.simple.SimpleMatrix; +import org.la4j.Matrix; +import org.la4j.matrix.dense.Basic2DMatrix; +import org.nd4j.linalg.api.ndarray.INDArray; +import org.nd4j.linalg.factory.Nd4j; +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.runner.Runner; +import org.openjdk.jmh.runner.options.ChainedOptionsBuilder; +import org.openjdk.jmh.runner.options.OptionsBuilder; + +import java.util.Arrays; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +public class BigMatrixMultiplicationBenchmarking { + private static final int DEFAULT_FORKS = 2; + private static final int DEFAULT_WARMUP_ITERATIONS = 5; + private static final int DEFAULT_MEASUREMENT_ITERATIONS = 10; + + public static void main(String[] args) throws Exception { + Map<String, String> parameters = parseParameters(args); + + ChainedOptionsBuilder builder = new OptionsBuilder() + .include(BigMatrixMultiplicationBenchmarking.class.getSimpleName()) + .mode(Mode.AverageTime) + .forks(forks(parameters)) + .warmupIterations(warmupIterations(parameters)) + .measurementIterations(measurementIterations(parameters)) + .timeUnit(TimeUnit.SECONDS); + + parameters.forEach(builder::param); + + new Runner(builder.build()).run(); + } + + private static Map<String, String> parseParameters(String[] args) { + return Arrays.stream(args) + .map(arg -> arg.split("=")) + .collect(Collectors.toMap( + arg -> arg[0], + arg -> arg[1] + )); + } + + private static int forks(Map<String, String> parameters) { + String forks = parameters.remove("forks"); + return parseOrDefault(forks, DEFAULT_FORKS); + } + + private static int warmupIterations(Map<String, String> parameters) { + String warmups = parameters.remove("warmupIterations"); + return parseOrDefault(warmups, DEFAULT_WARMUP_ITERATIONS); + } + + private static int measurementIterations(Map<String, String> parameters) { + String measurements = parameters.remove("measurementIterations"); + return parseOrDefault(measurements, DEFAULT_MEASUREMENT_ITERATIONS); + } + + private static int parseOrDefault(String parameter, int defaultValue) { + return parameter != null ? Integer.parseInt(parameter) : defaultValue; + } + + @Benchmark + public Object homemadeMatrixMultiplication(BigMatrixProvider matrixProvider) { + return HomemadeMatrix.multiplyMatrices(matrixProvider.getFirstMatrix(), matrixProvider.getSecondMatrix()); + } + + @Benchmark + public Object ejmlMatrixMultiplication(BigMatrixProvider matrixProvider) { + SimpleMatrix firstMatrix = new SimpleMatrix(matrixProvider.getFirstMatrix()); + SimpleMatrix secondMatrix = new SimpleMatrix(matrixProvider.getSecondMatrix()); + + return firstMatrix.mult(secondMatrix); + } + + @Benchmark + public Object apacheCommonsMatrixMultiplication(BigMatrixProvider matrixProvider) { + RealMatrix firstMatrix = new Array2DRowRealMatrix(matrixProvider.getFirstMatrix()); + RealMatrix secondMatrix = new Array2DRowRealMatrix(matrixProvider.getSecondMatrix()); + + return firstMatrix.multiply(secondMatrix); + } + + @Benchmark + public Object la4jMatrixMultiplication(BigMatrixProvider matrixProvider) { + Matrix firstMatrix = new Basic2DMatrix(matrixProvider.getFirstMatrix()); + Matrix secondMatrix = new Basic2DMatrix(matrixProvider.getSecondMatrix()); + + return firstMatrix.multiply(secondMatrix); + } + + @Benchmark + public Object nd4jMatrixMultiplication(BigMatrixProvider matrixProvider) { + INDArray firstMatrix = Nd4j.create(matrixProvider.getFirstMatrix()); + INDArray secondMatrix = Nd4j.create(matrixProvider.getSecondMatrix()); + + return firstMatrix.mmul(secondMatrix); + } + + @Benchmark + public Object coltMatrixMultiplication(BigMatrixProvider matrixProvider) { + DoubleFactory2D doubleFactory2D = DoubleFactory2D.dense; + + DoubleMatrix2D firstMatrix = doubleFactory2D.make(matrixProvider.getFirstMatrix()); + DoubleMatrix2D secondMatrix = doubleFactory2D.make(matrixProvider.getSecondMatrix()); + + Algebra algebra = new Algebra(); + return algebra.mult(firstMatrix, secondMatrix); + } +} \ No newline at end of file diff --git a/java-math/src/main/java/com/baeldung/matrices/benchmark/BigMatrixProvider.java b/java-math/src/main/java/com/baeldung/matrices/benchmark/BigMatrixProvider.java new file mode 100644 index 0000000000..d0f8a03fe3 --- /dev/null +++ b/java-math/src/main/java/com/baeldung/matrices/benchmark/BigMatrixProvider.java @@ -0,0 +1,46 @@ +package com.baeldung.matrices.benchmark; + +import org.openjdk.jmh.annotations.Param; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.infra.BenchmarkParams; + +import java.util.Random; +import java.util.stream.DoubleStream; + +@State(Scope.Benchmark) +public class BigMatrixProvider { + @Param({}) + private int matrixSize; + private double[][] firstMatrix; + private double[][] secondMatrix; + + public BigMatrixProvider() {} + + @Setup + public void setup(BenchmarkParams parameters) { + firstMatrix = createMatrix(matrixSize); + secondMatrix = createMatrix(matrixSize); + } + + private double[][] createMatrix(int matrixSize) { + Random random = new Random(); + + double[][] result = new double[matrixSize][matrixSize]; + for (int row = 0; row < result.length; row++) { + for (int col = 0; col < result[row].length; col++) { + result[row][col] = random.nextDouble(); + } + } + return result; + } + + public double[][] getFirstMatrix() { + return firstMatrix; + } + + public double[][] getSecondMatrix() { + return secondMatrix; + } +} \ No newline at end of file diff --git a/java-math/src/test/java/com/baeldung/matrices/MatrixMultiplicationBenchmarking.java b/java-math/src/main/java/com/baeldung/matrices/benchmark/MatrixMultiplicationBenchmarking.java similarity index 93% rename from java-math/src/test/java/com/baeldung/matrices/MatrixMultiplicationBenchmarking.java rename to java-math/src/main/java/com/baeldung/matrices/benchmark/MatrixMultiplicationBenchmarking.java index 171a1d28a4..fdb423e8da 100644 --- a/java-math/src/test/java/com/baeldung/matrices/MatrixMultiplicationBenchmarking.java +++ b/java-math/src/main/java/com/baeldung/matrices/benchmark/MatrixMultiplicationBenchmarking.java @@ -1,8 +1,9 @@ -package com.baeldung.matrices; +package com.baeldung.matrices.benchmark; import cern.colt.matrix.DoubleFactory2D; import cern.colt.matrix.DoubleMatrix2D; import cern.colt.matrix.linalg.Algebra; +import com.baeldung.matrices.HomemadeMatrix; import org.apache.commons.math3.linear.Array2DRowRealMatrix; import org.apache.commons.math3.linear.RealMatrix; import org.ejml.simple.SimpleMatrix; @@ -23,9 +24,10 @@ public class MatrixMultiplicationBenchmarking { public static void main(String[] args) throws Exception { Options opt = new OptionsBuilder() .include(MatrixMultiplicationBenchmarking.class.getSimpleName()) + .exclude(BigMatrixMultiplicationBenchmarking.class.getSimpleName()) .mode(Mode.AverageTime) .forks(2) - .warmupIterations(5) + .warmupIterations(10) .measurementIterations(10) .timeUnit(TimeUnit.MICROSECONDS) .build(); diff --git a/java-math/src/test/java/com/baeldung/matrices/MatrixProvider.java b/java-math/src/main/java/com/baeldung/matrices/benchmark/MatrixProvider.java similarity index 94% rename from java-math/src/test/java/com/baeldung/matrices/MatrixProvider.java rename to java-math/src/main/java/com/baeldung/matrices/benchmark/MatrixProvider.java index 33bd074b6e..d401ba2ab6 100644 --- a/java-math/src/test/java/com/baeldung/matrices/MatrixProvider.java +++ b/java-math/src/main/java/com/baeldung/matrices/benchmark/MatrixProvider.java @@ -1,4 +1,4 @@ -package com.baeldung.matrices; +package com.baeldung.matrices.benchmark; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; diff --git a/java-numbers-2/pom.xml b/java-numbers-2/pom.xml index 57f1154f53..ba40ef0a38 100644 --- a/java-numbers-2/pom.xml +++ b/java-numbers-2/pom.xml @@ -1,6 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>java-numbers-2</artifactId> <version>0.1.0-SNAPSHOT</version> @@ -15,52 +16,11 @@ </parent> <dependencies> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <version>${log4j.version}</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <version>${org.slf4j.version}</version> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>${logback.version}</version> - </dependency> - <dependency> - <groupId>org.openjdk.jmh</groupId> - <artifactId>jmh-core</artifactId> - <version>${jmh-core.version}</version> - </dependency> <dependency> <groupId>org.openjdk.jmh</groupId> <artifactId>jmh-generator-annprocess</artifactId> <version>${jmh-generator.version}</version> </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-math3</artifactId> - <version>${commons-math3.version}</version> - </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-lang3</artifactId> - <version>${commons-lang3.version}</version> - </dependency> - <dependency> - <groupId>org.decimal4j</groupId> - <artifactId>decimal4j</artifactId> - <version>${decimal4j.version}</version> - </dependency> - <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <version>${assertj.version}</version> - <scope>test</scope> - </dependency> </dependencies> <build> @@ -71,65 +31,6 @@ <filtering>true</filtering> </resource> </resources> - - <plugins> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <version>${maven-javadoc-plugin.version}</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - </plugins> </build> - <profiles> - <profile> - <id>integration</id> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <executions> - <execution> - <phase>integration-test</phase> - <goals> - <goal>test</goal> - </goals> - <configuration> - <includes> - <include>**/*IntegrationTest.java</include> - </includes> - </configuration> - </execution> - </executions> - <configuration> - <systemPropertyVariables> - <test.mime>json</test.mime> - </systemPropertyVariables> - </configuration> - </plugin> - </plugins> - </build> - </profile> - </profiles> - - <properties> - <commons-math3.version>3.6.1</commons-math3.version> - <decimal4j.version>1.0.3</decimal4j.version> - <commons-lang3.version>3.5</commons-lang3.version> - - <assertj.version>3.6.1</assertj.version> - - <org.slf4j.version>1.7.21</org.slf4j.version> - <logback.version>1.1.7</logback.version> - - <maven-surefire-plugin.version>2.21.0</maven-surefire-plugin.version> - <maven-javadoc-plugin.version>3.0.0-M1</maven-javadoc-plugin.version> - <maven-jar-plugin.version>3.0.2</maven-jar-plugin.version> - </properties> </project> diff --git a/java-numbers-2/src/main/java/com/baeldung/fibonacci/FibonacciSeriesUtils.java b/java-numbers-2/src/main/java/com/baeldung/fibonacci/FibonacciSeriesUtils.java new file mode 100644 index 0000000000..943fcffa56 --- /dev/null +++ b/java-numbers-2/src/main/java/com/baeldung/fibonacci/FibonacciSeriesUtils.java @@ -0,0 +1,34 @@ +package com.baeldung.fibonacci; + +import static java.lang.Math.pow; + +public class FibonacciSeriesUtils { + + public static int nthFibonacciTermRecursiveMethod(int n) { + if (n == 0 || n == 1) { + return n; + } + return nthFibonacciTermRecursiveMethod(n - 1) + nthFibonacciTermRecursiveMethod(n - 2); + } + + public static int nthFibonacciTermIterativeMethod(int n) { + if (n == 0 || n == 1) { + return n; + } + int n0 = 0, n1 = 1; + int tempNthTerm; + for (int i = 2; i <= n; i++) { + tempNthTerm = n0 + n1; + n0 = n1; + n1 = tempNthTerm; + } + return n1; + } + + public static int nthFibonacciTermUsingBinetsFormula(int n) { + final double squareRootOf5 = Math.sqrt(5); + final double phi = (1 + squareRootOf5)/2; + int nthTerm = (int) ((Math.pow(phi, n) - Math.pow(-phi, -n))/squareRootOf5); + return nthTerm; + } +} diff --git a/java-numbers-2/src/test/java/com/baeldung/fibonacci/FibonacciSeriesUtilsUnitTest.java b/java-numbers-2/src/test/java/com/baeldung/fibonacci/FibonacciSeriesUtilsUnitTest.java new file mode 100644 index 0000000000..60f79d0c78 --- /dev/null +++ b/java-numbers-2/src/test/java/com/baeldung/fibonacci/FibonacciSeriesUtilsUnitTest.java @@ -0,0 +1,29 @@ +package com.baeldung.fibonacci; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class FibonacciSeriesUtilsUnitTest { + + @Test + public void givenTermToCalculate_thenReturnThatTermUsingRecursion() { + int term = 10; + int expectedValue = 55; + assertEquals(FibonacciSeriesUtils.nthFibonacciTermRecursiveMethod(term), expectedValue); + } + + @Test + public void givenTermToCalculate_thenReturnThatTermUsingIteration() { + int term = 10; + int expectedValue = 55; + assertEquals(FibonacciSeriesUtils.nthFibonacciTermIterativeMethod(term), expectedValue); + } + + @Test + public void givenTermToCalculate_thenReturnThatTermUsingBinetsFormula() { + int term = 10; + int expectedValue = 55; + assertEquals(FibonacciSeriesUtils.nthFibonacciTermUsingBinetsFormula(term), expectedValue); + } +} diff --git a/java-numbers/pom.xml b/java-numbers/pom.xml index ac3ca2680f..fc904c5747 100644 --- a/java-numbers/pom.xml +++ b/java-numbers/pom.xml @@ -1,6 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>java-numbers</artifactId> <version>0.1.0-SNAPSHOT</version> @@ -20,36 +21,11 @@ <artifactId>log4j</artifactId> <version>${log4j.version}</version> </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <version>${org.slf4j.version}</version> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>${logback.version}</version> - </dependency> - <dependency> - <groupId>org.openjdk.jmh</groupId> - <artifactId>jmh-core</artifactId> - <version>${jmh-core.version}</version> - </dependency> <dependency> <groupId>org.openjdk.jmh</groupId> <artifactId>jmh-generator-annprocess</artifactId> <version>${jmh-generator.version}</version> </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-math3</artifactId> - <version>${commons-math3.version}</version> - </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-lang3</artifactId> - <version>${commons-lang3.version}</version> - </dependency> <dependency> <groupId>org.decimal4j</groupId> <artifactId>decimal4j</artifactId> @@ -71,64 +47,11 @@ <filtering>true</filtering> </resource> </resources> - - <plugins> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <version>${maven-javadoc-plugin.version}</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - </plugins> </build> - <profiles> - <profile> - <id>integration</id> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <executions> - <execution> - <phase>integration-test</phase> - <goals> - <goal>test</goal> - </goals> - <configuration> - <includes> - <include>**/*IntegrationTest.java</include> - </includes> - </configuration> - </execution> - </executions> - <configuration> - <systemPropertyVariables> - <test.mime>json</test.mime> - </systemPropertyVariables> - </configuration> - </plugin> - </plugins> - </build> - </profile> - </profiles> - <properties> - <commons-math3.version>3.6.1</commons-math3.version> <decimal4j.version>1.0.3</decimal4j.version> - <assertj.version>3.6.1</assertj.version> - - <org.slf4j.version>1.7.21</org.slf4j.version> - <logback.version>1.1.7</logback.version> - - <maven-surefire-plugin.version>2.21.0</maven-surefire-plugin.version> - <maven-javadoc-plugin.version>3.0.0-M1</maven-javadoc-plugin.version> - <maven-jar-plugin.version>3.0.2</maven-jar-plugin.version> </properties> + </project> diff --git a/java-rmi/README.md b/java-rmi/README.md index 244f986639..6d2d144cdf 100644 --- a/java-rmi/README.md +++ b/java-rmi/README.md @@ -1,6 +1,6 @@ ## Java RMI -This module contains articles about RMI (Remote Method Invocation) in Java. +This module contains articles about Remote Method Invocation (RMI) in Java. ### Relevant articles diff --git a/java-rmi/pom.xml b/java-rmi/pom.xml index ad413b66ab..5fa3ac8845 100644 --- a/java-rmi/pom.xml +++ b/java-rmi/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> diff --git a/java-spi/README.md b/java-spi/README.md index 2ccef98a10..35567ab4dc 100644 --- a/java-spi/README.md +++ b/java-spi/README.md @@ -1,6 +1,6 @@ ## Java SPI -This module contains articles about the SPI (Service Provider Interface) in Java. +This module contains articles about the Service Provider Interface (SPI) in Java. ### Relevant Articles: diff --git a/java-spi/exchange-rate-api/pom.xml b/java-spi/exchange-rate-api/pom.xml index fd3a7ae0a7..1630dbf699 100644 --- a/java-spi/exchange-rate-api/pom.xml +++ b/java-spi/exchange-rate-api/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>exchange-rate-api</artifactId> <name>exchange-rate-api</name> diff --git a/java-spi/exchange-rate-app/pom.xml b/java-spi/exchange-rate-app/pom.xml index 7a076d560c..fea9ebe8d9 100644 --- a/java-spi/exchange-rate-app/pom.xml +++ b/java-spi/exchange-rate-app/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>exchange-rate-app</artifactId> <name>exchange-rate-app</name> diff --git a/java-spi/exchange-rate-impl/pom.xml b/java-spi/exchange-rate-impl/pom.xml index 8a77b51793..553a9e3377 100644 --- a/java-spi/exchange-rate-impl/pom.xml +++ b/java-spi/exchange-rate-impl/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>exchange-rate-impl</artifactId> <name>exchange-rate-impl</name> diff --git a/java-spi/pom.xml b/java-spi/pom.xml index 97a22024bd..6d4874083d 100644 --- a/java-spi/pom.xml +++ b/java-spi/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>java-spi</artifactId> <name>java-spi</name> diff --git a/java-vavr-stream/pom.xml b/java-vavr-stream/pom.xml index c92f3c8742..94520f299d 100644 --- a/java-vavr-stream/pom.xml +++ b/java-vavr-stream/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.samples</groupId> <artifactId>java-vavr-stream</artifactId> diff --git a/java-websocket/pom.xml b/java-websocket/pom.xml index 7ba3ca61d0..ddf10c4457 100644 --- a/java-websocket/pom.xml +++ b/java-websocket/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>java-websocket</artifactId> <version>0.0.1-SNAPSHOT</version> diff --git a/javafx/pom.xml b/javafx/pom.xml index 44e6f7e8da..50b9e7135c 100644 --- a/javafx/pom.xml +++ b/javafx/pom.xml @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>javafx</artifactId> <name>javafx</name> - + <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> diff --git a/javax-servlets/pom.xml b/javax-servlets/pom.xml index 096b1bb229..5fc9fef24a 100644 --- a/javax-servlets/pom.xml +++ b/javax-servlets/pom.xml @@ -1,19 +1,19 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.javax-servlets</groupId> <artifactId>javax-servlets</artifactId> <version>1.0-SNAPSHOT</version> <name>javax-servlets</name> <packaging>war</packaging> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> - + <dependencies> <dependency> <groupId>org.assertj</groupId> @@ -28,11 +28,6 @@ <artifactId>commons-fileupload</artifactId> <version>${commons-fileupload.version}</version> </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>${commons-io.version}</version> - </dependency> <!-- Servlet --> <dependency> @@ -40,21 +35,6 @@ <artifactId>javax.servlet-api</artifactId> <version>${javax.servlet-api.version}</version> </dependency> - <dependency> - <groupId>javax.servlet.jsp.jstl</groupId> - <artifactId>jstl-api</artifactId> - <version>${jstl.version}</version> - </dependency> - <dependency> - <groupId>javax.servlet.jsp</groupId> - <artifactId>javax.servlet.jsp-api</artifactId> - <version>${javax.servlet.jsp-api.version}</version> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>jstl</artifactId> - <version>${jstl.version}</version> - </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> @@ -73,21 +53,14 @@ <artifactId>gson</artifactId> <version>${gson.version}</version> </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-test</artifactId> - <version>${spring-test.version}</version> - <scope>test</scope> - </dependency> </dependencies> - + <properties> <org.apache.httpcomponents.version>4.5.3</org.apache.httpcomponents.version> - <spring-test.version>5.0.5.RELEASE</spring-test.version> <gson.version>2.8.2</gson.version> <assertj.version>3.9.1</assertj.version> - <mockito.version>2.21.0</mockito.version> <commons-fileupload.version>1.3.3</commons-fileupload.version> <javax.servlet-api.version>4.0.1</javax.servlet-api.version> </properties> + </project> diff --git a/javax-servlets/src/test/java/com/baeldung/test/FormServletLiveTest.java b/javax-servlets/src/test/java/com/baeldung/test/FormServletLiveTest.java index 120a555c5b..d2a98037a1 100644 --- a/javax-servlets/src/test/java/com/baeldung/test/FormServletLiveTest.java +++ b/javax-servlets/src/test/java/com/baeldung/test/FormServletLiveTest.java @@ -1,4 +1,4 @@ -package com.baeldung.servlets; +package com.baeldung.test; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; diff --git a/javax-servlets/src/test/java/com/baeldung/test/UserServletUnitTest.java b/javax-servlets/src/test/java/com/baeldung/test/UserServletUnitTest.java index d4c93791d2..6222e35f4b 100644 --- a/javax-servlets/src/test/java/com/baeldung/test/UserServletUnitTest.java +++ b/javax-servlets/src/test/java/com/baeldung/test/UserServletUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.servlets; +package com.baeldung.test; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; diff --git a/javaxval/README.md b/javaxval/README.md index 33ce4eae5b..cc237e1e59 100644 --- a/javaxval/README.md +++ b/javaxval/README.md @@ -10,3 +10,4 @@ This module contains articles about Bean Validation. - [Javax BigDecimal Validation](https://www.baeldung.com/javax-bigdecimal-validation) - [Grouping Javax Validation Constraints](https://www.baeldung.com/javax-validation-groups) - [Validations for Enum Types](https://www.baeldung.com/javax-validations-enums) +- [Guide to ParameterMessageInterpolator](https://www.baeldung.com/hibernate-parametermessageinterpolator) diff --git a/javaxval/pom.xml b/javaxval/pom.xml index 7ecddc0ca8..2655d1fe3e 100644 --- a/javaxval/pom.xml +++ b/javaxval/pom.xml @@ -1,10 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>javaxval</artifactId> <version>0.1-SNAPSHOT</version> <name>javaxval</name> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> @@ -12,11 +13,6 @@ </parent> <dependencies> - <dependency> - <groupId>javax.validation</groupId> - <artifactId>validation-api</artifactId> - <version>${validation-api.version}</version> - </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> @@ -37,12 +33,6 @@ <artifactId>spring-test</artifactId> <version>${org.springframework.version}</version> </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>${junit.version}</version> - <scope>test</scope> - </dependency> <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> @@ -50,12 +40,11 @@ <scope>test</scope> </dependency> </dependencies> - + <properties> - <validation-api.version>2.0.1.Final</validation-api.version> <hibernate-validator.version>6.0.13.Final</hibernate-validator.version> - <javax.el.version>3.0.0</javax.el.version> + <javax.el.version>3.0.0</javax.el.version> <org.springframework.version>5.0.2.RELEASE</org.springframework.version> <assertj.version>3.11.1</assertj.version> - </properties> + </properties> </project> diff --git a/jaxb/pom.xml b/jaxb/pom.xml index d575f12c7b..dc13cf75bc 100644 --- a/jaxb/pom.xml +++ b/jaxb/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>jaxb</artifactId> <version>0.0.1-SNAPSHOT</version> <name>jaxb</name> @@ -13,22 +13,7 @@ </parent> <dependencies> - <dependency> - <groupId>org.glassfish.jaxb</groupId> - <artifactId>jaxb-runtime</artifactId> - <version>${jaxb.version}</version> - </dependency> - <dependency> - <groupId>org.glassfish.jaxb</groupId> - <artifactId>jaxb-core</artifactId> - <version>${jaxb.version}</version> - </dependency> <!-- utils --> - <dependency> - <groupId>com.sun.istack</groupId> - <artifactId>istack-commons-runtime</artifactId> - <version>${istack-commons-runtime.version}</version> - </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> @@ -39,11 +24,6 @@ <artifactId>commons-lang3</artifactId> <version>${commons-lang3.version}</version> </dependency> - <dependency> - <groupId>javax.activation</groupId> - <artifactId>activation</artifactId> - <version>${javax.activation.version}</version> - </dependency> </dependencies> <build> @@ -75,7 +55,7 @@ </goals> </pluginExecutionFilter> <action> - <execute /> + <execute/> </action> </pluginExecution> </pluginExecutions> @@ -114,25 +94,13 @@ <generateEpisode>false</generateEpisode> </configuration> </plugin> - - <!-- schemagen --> - <!-- <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jaxb2-maven-plugin</artifactId> <version>${jaxb2-maven-plugin.version}</version> <executions> <execution> - <id>schemagen</id> <goals> <goal>schemagen</goal> </goals> </execution> </executions> <configuration> <sources> <source>src/main/java/com/baeldung/jaxb/gen</source> </sources> <outputDirectory>src/main/resources</outputDirectory> - <clearOutputDir>false</clearOutputDir> <transformSchemas> <transformSchema> <uri>http://www.baeldung.com/jaxb/gen</uri> <toPrefix>user</toPrefix> <toFile>gen-schema.xsd</toFile> </transformSchema> - </transformSchemas> </configuration> </plugin> --> </plugins> </build> <properties> - <!-- jaxb --> - <jaxb.version>2.2.11</jaxb.version> - <!-- maven plugins --> <jaxb2-maven-plugin.version>2.3</jaxb2-maven-plugin.version> - <istack-commons-runtime.version>3.0.2</istack-commons-runtime.version> <lifecycle-mapping-plugin.version>1.0.0</lifecycle-mapping-plugin.version> - - <javax.activation.version>1.1</javax.activation.version> </properties> </project> \ No newline at end of file diff --git a/jee-7-security/pom.xml b/jee-7-security/pom.xml index 5b7bb07239..e47df7aae9 100644 --- a/jee-7-security/pom.xml +++ b/jee-7-security/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>jee-7-security</artifactId> <version>1.0-SNAPSHOT</version> @@ -21,50 +21,11 @@ <version>${javaee_api.version}</version> <scope>provided</scope> </dependency> - <dependency> - <groupId>com.sun.faces</groupId> - <artifactId>jsf-api</artifactId> - <version>${com.sun.faces.jsf.version}</version> - </dependency> - <dependency> - <groupId>com.sun.faces</groupId> - <artifactId>jsf-impl</artifactId> - <version>${com.sun.faces.jsf.version}</version> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>jstl</artifactId> - <version>${jstl.version}</version> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - <version>${javax.servlet-api.version}</version> - </dependency> - <dependency> - <groupId>javax.servlet.jsp</groupId> - <artifactId>jsp-api</artifactId> - <version>${jsp-api.version}</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>taglibs</groupId> - <artifactId>standard</artifactId> - <version>${taglibs.standard.version}</version> - </dependency> - <dependency> <groupId>javax.mvc</groupId> <artifactId>javax.mvc-api</artifactId> <version>${javax.mvc-api.version}</version> </dependency> - - <dependency> - <groupId>org.springframework.security</groupId> - <artifactId>spring-security-web</artifactId> - <version>${org.springframework.security.version}</version> - </dependency> - <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-config</artifactId> @@ -93,11 +54,8 @@ <properties> <javaee_api.version>7.0</javaee_api.version> - <com.sun.faces.jsf.version>2.2.14</com.sun.faces.jsf.version> - <jsp-api.version>2.2</jsp-api.version> - <taglibs.standard.version>1.1.2</taglibs.standard.version> <org.springframework.security.version>4.2.3.RELEASE</org.springframework.security.version> - <javax.mvc-api.version>1.0-pr</javax.mvc-api.version> + <javax.mvc-api.version>1.0-pr</javax.mvc-api.version> </properties> </project> diff --git a/jee-7/pom.xml b/jee-7/pom.xml index 9432801fd9..635d820c2b 100644 --- a/jee-7/pom.xml +++ b/jee-7/pom.xml @@ -1,540 +1,540 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <artifactId>jee-7</artifactId> - <version>1.0-SNAPSHOT</version> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>jee-7</artifactId> + <version>1.0-SNAPSHOT</version> <name>jee-7</name> - <packaging>war</packaging> - <description>JavaEE 7 Arquillian Archetype Sample</description> + <packaging>war</packaging> + <description>JavaEE 7 Arquillian Archetype Sample</description> - <parent> - <groupId>com.baeldung</groupId> - <artifactId>parent-modules</artifactId> - <version>1.0.0-SNAPSHOT</version> - </parent> + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> - <dependencies> - <dependency> - <groupId>javax</groupId> - <artifactId>javaee-api</artifactId> - <version>${javaee_api.version}</version> - <scope>provided</scope> - </dependency> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.jboss.arquillian</groupId> + <artifactId>arquillian-bom</artifactId> + <version>${arquillian_core.version}</version> + <scope>import</scope> + <type>pom</type> + </dependency> + <dependency> + <groupId>org.jboss.arquillian.extension</groupId> + <artifactId>arquillian-drone-bom</artifactId> + <version>${arquillian-drone-bom.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> - <dependency> - <groupId>org.jboss.arquillian.junit</groupId> - <artifactId>arquillian-junit-container</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.jboss.arquillian.graphene</groupId> - <artifactId>graphene-webdriver</artifactId> - <version>${graphene-webdriver.version}</version> - <type>pom</type> - <scope>test</scope> - </dependency> - <dependency> - <groupId>com.jayway.awaitility</groupId> - <artifactId>awaitility</artifactId> - <version>${awaitility.version}</version> - <scope>test</scope> - </dependency> + <dependencies> + <dependency> + <groupId>javax</groupId> + <artifactId>javaee-api</artifactId> + <version>${javaee_api.version}</version> + <scope>provided</scope> + </dependency> - <dependency> - <groupId>org.jboss.shrinkwrap.resolver</groupId> - <artifactId>shrinkwrap-resolver-impl-maven</artifactId> - <scope>test</scope> - <type>jar</type> - </dependency> + <dependency> + <groupId>org.jboss.arquillian.junit</groupId> + <artifactId>arquillian-junit-container</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.jboss.arquillian.graphene</groupId> + <artifactId>graphene-webdriver</artifactId> + <version>${graphene-webdriver.version}</version> + <type>pom</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.jayway.awaitility</groupId> + <artifactId>awaitility</artifactId> + <version>${awaitility.version}</version> + <scope>test</scope> + </dependency> - <dependency> - <groupId>org.jboss.shrinkwrap.resolver</groupId> - <artifactId>shrinkwrap-resolver-impl-maven-archive</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - <version>${httpclient.version}</version> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>${commons-io.version}</version> - </dependency> - <dependency> - <groupId>com.sun.faces</groupId> - <artifactId>jsf-api</artifactId> - <version>${com.sun.faces.jsf.version}</version> - </dependency> - <dependency> - <groupId>com.sun.faces</groupId> - <artifactId>jsf-impl</artifactId> - <version>${com.sun.faces.jsf.version}</version> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>jstl</artifactId> - <version>${jstl.version}</version> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - <version>${javax.servlet-api.version}</version> - </dependency> - <dependency> - <groupId>javax.servlet.jsp</groupId> - <artifactId>jsp-api</artifactId> - <version>${jsp-api.version}</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>taglibs</groupId> - <artifactId>standard</artifactId> - <version>${taglibs.standard.version}</version> - </dependency> + <dependency> + <groupId>org.jboss.shrinkwrap.resolver</groupId> + <artifactId>shrinkwrap-resolver-impl-maven</artifactId> + <scope>test</scope> + <type>jar</type> + </dependency> - <dependency> - <groupId>javax.mvc</groupId> - <artifactId>javax.mvc-api</artifactId> - <version>20160715</version> - </dependency> - <dependency> - <groupId>org.glassfish.ozark</groupId> - <artifactId>ozark</artifactId> - <version>${ozark.version}</version> - </dependency> + <dependency> + <groupId>org.jboss.shrinkwrap.resolver</groupId> + <artifactId>shrinkwrap-resolver-impl-maven-archive</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + <version>${httpclient.version}</version> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>${commons-io.version}</version> + </dependency> + <dependency> + <groupId>com.sun.faces</groupId> + <artifactId>jsf-api</artifactId> + <version>${com.sun.faces.jsf.version}</version> + </dependency> + <dependency> + <groupId>com.sun.faces</groupId> + <artifactId>jsf-impl</artifactId> + <version>${com.sun.faces.jsf.version}</version> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>jstl</artifactId> + <version>${jstl.version}</version> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet-api</artifactId> + <version>${javax.servlet-api.version}</version> + </dependency> + <dependency> + <groupId>javax.servlet.jsp</groupId> + <artifactId>jsp-api</artifactId> + <version>${jsp-api.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>taglibs</groupId> + <artifactId>standard</artifactId> + <version>${taglibs.standard.version}</version> + </dependency> - <dependency> - <groupId>org.springframework.security</groupId> - <artifactId>spring-security-web</artifactId> - <version>${org.springframework.security.version}</version> - </dependency> + <dependency> + <groupId>javax.mvc</groupId> + <artifactId>javax.mvc-api</artifactId> + <version>20160715</version> + </dependency> + <dependency> + <groupId>org.glassfish.ozark</groupId> + <artifactId>ozark</artifactId> + <version>${ozark.version}</version> + </dependency> - <dependency> - <groupId>org.springframework.security</groupId> - <artifactId>spring-security-config</artifactId> - <version>${org.springframework.security.version}</version> - </dependency> - <dependency> - <groupId>org.springframework.security</groupId> - <artifactId>spring-security-taglibs</artifactId> - <version>${org.springframework.security.version}</version> - </dependency> - <!-- Batch dependencies --> + <dependency> + <groupId>org.springframework.security</groupId> + <artifactId>spring-security-web</artifactId> + <version>${org.springframework.security.version}</version> + </dependency> - <dependency> - <groupId>org.jboss.spec.javax.batch</groupId> - <artifactId>jboss-batch-api_1.0_spec</artifactId> - <version>${jboss-batch-api.version}</version> - </dependency> - <dependency> - <groupId>org.jberet</groupId> - <artifactId>jberet-core</artifactId> - <version>${jberet.version}</version> - </dependency> - <dependency> - <groupId>org.jberet</groupId> - <artifactId>jberet-support</artifactId> - <version>${jberet.version}</version> - </dependency> - <dependency> - <groupId>org.jboss.spec.javax.transaction</groupId> - <artifactId>jboss-transaction-api_1.2_spec</artifactId> - <version>${jboss-transaction-api.version}</version> - </dependency> - <dependency> - <groupId>org.jboss.marshalling</groupId> - <artifactId>jboss-marshalling</artifactId> - <version>${jboss-marshalling.version}</version> - </dependency> - <dependency> - <groupId>org.jboss.weld</groupId> - <artifactId>weld-core</artifactId> - <version>${weld.version}</version> - </dependency> - <dependency> - <groupId>org.jboss.weld.se</groupId> - <artifactId>weld-se</artifactId> - <version>${weld.version}</version> - </dependency> - <dependency> - <groupId>org.jberet</groupId> - <artifactId>jberet-se</artifactId> - <version>${jberet.version}</version> - </dependency> - <dependency> - <groupId>com.h2database</groupId> - <artifactId>h2</artifactId> - <version>${h2.version}</version> - </dependency> - <dependency> - <groupId>org.glassfish.jersey.containers</groupId> - <artifactId>jersey-container-jetty-servlet</artifactId> - <version>${jersey-container-jetty-servlet.version}</version> - </dependency> - </dependencies> + <dependency> + <groupId>org.springframework.security</groupId> + <artifactId>spring-security-config</artifactId> + <version>${org.springframework.security.version}</version> + </dependency> + <dependency> + <groupId>org.springframework.security</groupId> + <artifactId>spring-security-taglibs</artifactId> + <version>${org.springframework.security.version}</version> + </dependency> + <!-- Batch dependencies --> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-war-plugin</artifactId> - <version>${maven-war-plugin.version}</version> - <configuration> - <warSourceDirectory>src/main/webapp</warSourceDirectory> - <failOnMissingWebXml>false</failOnMissingWebXml> - </configuration> - </plugin> - </plugins> - <pluginManagement> - <plugins> - <!--This plugin's configuration is used to store Eclipse m2e settings - only. It has no influence on the Maven build itself. --> - <plugin> - <groupId>org.eclipse.m2e</groupId> - <artifactId>lifecycle-mapping</artifactId> - <version>1.0.0</version> - <configuration> - <lifecycleMappingMetadata> - <pluginExecutions> - <pluginExecution> - <pluginExecutionFilter> - <groupId> - org.apache.maven.plugins - </groupId> - <artifactId> - maven-pmd-plugin - </artifactId> - <versionRange> - [3.8,) - </versionRange> - <goals> - <goal>check</goal> - </goals> - </pluginExecutionFilter> - <action> - <ignore></ignore> - </action> - </pluginExecution> - </pluginExecutions> - </lifecycleMappingMetadata> - </configuration> - </plugin> - </plugins> - </pluginManagement> - </build> + <dependency> + <groupId>org.jboss.spec.javax.batch</groupId> + <artifactId>jboss-batch-api_1.0_spec</artifactId> + <version>${jboss-batch-api.version}</version> + </dependency> + <dependency> + <groupId>org.jberet</groupId> + <artifactId>jberet-core</artifactId> + <version>${jberet.version}</version> + </dependency> + <dependency> + <groupId>org.jberet</groupId> + <artifactId>jberet-support</artifactId> + <version>${jberet.version}</version> + </dependency> + <dependency> + <groupId>org.jboss.spec.javax.transaction</groupId> + <artifactId>jboss-transaction-api_1.2_spec</artifactId> + <version>${jboss-transaction-api.version}</version> + </dependency> + <dependency> + <groupId>org.jboss.marshalling</groupId> + <artifactId>jboss-marshalling</artifactId> + <version>${jboss-marshalling.version}</version> + </dependency> + <dependency> + <groupId>org.jboss.weld</groupId> + <artifactId>weld-core</artifactId> + <version>${weld.version}</version> + </dependency> + <dependency> + <groupId>org.jboss.weld.se</groupId> + <artifactId>weld-se</artifactId> + <version>${weld.version}</version> + </dependency> + <dependency> + <groupId>org.jberet</groupId> + <artifactId>jberet-se</artifactId> + <version>${jberet.version}</version> + </dependency> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <version>${h2.version}</version> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.containers</groupId> + <artifactId>jersey-container-jetty-servlet</artifactId> + <version>${jersey-container-jetty-servlet.version}</version> + </dependency> + </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.jboss.arquillian</groupId> - <artifactId>arquillian-bom</artifactId> - <version>${arquillian_core.version}</version> - <scope>import</scope> - <type>pom</type> - </dependency> - <dependency> - <groupId>org.jboss.arquillian.extension</groupId> - <artifactId>arquillian-drone-bom</artifactId> - <version>${arquillian-drone-bom.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <version>${maven-war-plugin.version}</version> + <configuration> + <warSourceDirectory>src/main/webapp</warSourceDirectory> + <failOnMissingWebXml>false</failOnMissingWebXml> + </configuration> + </plugin> + </plugins> + <pluginManagement> + <plugins> + <!--This plugin's configuration is used to store Eclipse m2e settings + only. It has no influence on the Maven build itself. --> + <plugin> + <groupId>org.eclipse.m2e</groupId> + <artifactId>lifecycle-mapping</artifactId> + <version>1.0.0</version> + <configuration> + <lifecycleMappingMetadata> + <pluginExecutions> + <pluginExecution> + <pluginExecutionFilter> + <groupId> + org.apache.maven.plugins + </groupId> + <artifactId> + maven-pmd-plugin + </artifactId> + <versionRange> + [3.8,) + </versionRange> + <goals> + <goal>check</goal> + </goals> + </pluginExecutionFilter> + <action> + <ignore></ignore> + </action> + </pluginExecution> + </pluginExecutions> + </lifecycleMappingMetadata> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> - <profiles> - <profile> - <id>wildfly-managed-arquillian</id> - <activation> - <activeByDefault>true</activeByDefault> - </activation> - <properties> - <serverProfile>standalone-full.xml</serverProfile> - <serverRoot>${project.build.directory}/wildfly-${version.wildfly}</serverRoot> - </properties> - <dependencies> - <dependency> - <groupId>io.undertow</groupId> - <artifactId>undertow-websockets-jsr</artifactId> - <version>${undertow-websockets-jsr.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.jboss.resteasy</groupId> - <artifactId>resteasy-client</artifactId> - <version>${resteasy.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.jboss.resteasy</groupId> - <artifactId>resteasy-jaxb-provider</artifactId> - <version>${resteasy.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.jboss.resteasy</groupId> - <artifactId>resteasy-json-p-provider</artifactId> - <version>${resteasy.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.wildfly</groupId> - <artifactId>wildfly-arquillian-container-managed</artifactId> - <version>${wildfly.version}</version> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>sun.jdk</groupId> - <artifactId>jconsole</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> + <profiles> + <profile> + <id>wildfly-managed-arquillian</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + <properties> + <serverProfile>standalone-full.xml</serverProfile> + <serverRoot>${project.build.directory}/wildfly-${version.wildfly}</serverRoot> + </properties> + <dependencies> + <dependency> + <groupId>io.undertow</groupId> + <artifactId>undertow-websockets-jsr</artifactId> + <version>${undertow-websockets-jsr.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.jboss.resteasy</groupId> + <artifactId>resteasy-client</artifactId> + <version>${resteasy.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.jboss.resteasy</groupId> + <artifactId>resteasy-jaxb-provider</artifactId> + <version>${resteasy.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.jboss.resteasy</groupId> + <artifactId>resteasy-json-p-provider</artifactId> + <version>${resteasy.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.wildfly</groupId> + <artifactId>wildfly-arquillian-container-managed</artifactId> + <version>${wildfly.version}</version> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>sun.jdk</groupId> + <artifactId>jconsole</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> - <build> - <pluginManagement> - <plugins> - <plugin> - <artifactId>maven-dependency-plugin</artifactId> - <version>${maven-dependency-plugin.version}</version> - <configuration> - <skip>${maven.test.skip}</skip> - </configuration> - <executions> - <execution> - <id>unpack</id> - <phase>process-test-classes</phase> - <goals> - <goal>unpack</goal> - </goals> - <configuration> - <artifactItems> - <artifactItem> - <groupId>org.wildfly</groupId> - <artifactId>wildfly-dist</artifactId> - <version>${wildfly.version}</version> - <type>zip</type> - <overWrite>false</overWrite> - <outputDirectory>${project.build.directory}</outputDirectory> - <exclusions> - <exclusion> - <groupId>sun.jdk</groupId> - <artifactId>jconsole</artifactId> - </exclusion> - </exclusions> - </artifactItem> - </artifactItems> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <artifactId>maven-surefire-plugin</artifactId> - <version>${maven-surefire-plugin.version}</version> - <configuration> - <environmentVariables> - <JBOSS_HOME>${project.build.directory}/wildfly-${wildfly.version}</JBOSS_HOME> - </environmentVariables> - </configuration> - </plugin> - </plugins> - </pluginManagement> - </build> - </profile> - <profile> - <id>wildfly-remote-arquillian</id> - <dependencies> - <dependency> - <groupId>io.undertow</groupId> - <artifactId>undertow-websockets-jsr</artifactId> - <version>${undertow-websockets-jsr.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.jboss.resteasy</groupId> - <artifactId>resteasy-client</artifactId> - <version>${resteasy.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.jboss.resteasy</groupId> - <artifactId>resteasy-jaxb-provider</artifactId> - <version>${resteasy.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.jboss.resteasy</groupId> - <artifactId>resteasy-json-p-provider</artifactId> - <version>${resteasy.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.wildfly</groupId> - <artifactId>wildfly-arquillian-container-remote</artifactId> - <version>${wildfly.version}</version> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>sun.jdk</groupId> - <artifactId>jconsole</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> - </profile> - <profile> - <id>glassfish-embedded-arquillian</id> - <dependencies> - <dependency> - <groupId>org.glassfish.main.extras</groupId> - <artifactId>glassfish-embedded-all</artifactId> - <version>${glassfish-embedded-all.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.glassfish</groupId> - <artifactId>javax.json</artifactId> - <version>${javax.json.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.glassfish.tyrus</groupId> - <artifactId>tyrus-client</artifactId> - <version>${tyrus.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.glassfish.tyrus</groupId> - <artifactId>tyrus-container-grizzly-client</artifactId> - <version>${tyrus.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.glassfish.jersey.core</groupId> - <artifactId>jersey-client</artifactId> - <version>${jersey.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.jboss.arquillian.container</groupId> - <artifactId>arquillian-glassfish-embedded-3.1</artifactId> - <version>${arquillian-glassfish.version}</version> - <scope>test</scope> - </dependency> - </dependencies> - </profile> - <profile> - <id>glassfish-remote-arquillian</id> - <dependencies> - <dependency> - <groupId>org.glassfish</groupId> - <artifactId>javax.json</artifactId> - <version>${javax.json.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.glassfish.tyrus</groupId> - <artifactId>tyrus-client</artifactId> - <version>${tyrus.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.glassfish.tyrus</groupId> - <artifactId>tyrus-container-grizzly-client</artifactId> - <version>${tyrus.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.glassfish.jersey.core</groupId> - <artifactId>jersey-client</artifactId> - <version>${jersey.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.glassfish.jersey.media</groupId> - <artifactId>jersey-media-json-jackson</artifactId> - <version>${jersey.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.glassfish.jersey.media</groupId> - <artifactId>jersey-media-json-processing</artifactId> - <version>${jersey.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.jboss.arquillian.container</groupId> - <artifactId>arquillian-glassfish-remote-3.1</artifactId> - <version>${arquillian-glassfish.version}</version> - <scope>test</scope> - </dependency> - </dependencies> - </profile> - <profile> - <id>webdriver-chrome</id> - <activation> - <activeByDefault>true</activeByDefault> - </activation> - <properties> - <browser>chrome</browser> - </properties> - </profile> - <profile> - <id>webdriver-firefox</id> - <properties> - <browser>firefox</browser> - </properties> - </profile> - </profiles> + <build> + <pluginManagement> + <plugins> + <plugin> + <artifactId>maven-dependency-plugin</artifactId> + <version>${maven-dependency-plugin.version}</version> + <configuration> + <skip>${maven.test.skip}</skip> + </configuration> + <executions> + <execution> + <id>unpack</id> + <phase>process-test-classes</phase> + <goals> + <goal>unpack</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>org.wildfly</groupId> + <artifactId>wildfly-dist</artifactId> + <version>${wildfly.version}</version> + <type>zip</type> + <overWrite>false</overWrite> + <outputDirectory>${project.build.directory}</outputDirectory> + <exclusions> + <exclusion> + <groupId>sun.jdk</groupId> + <artifactId>jconsole</artifactId> + </exclusion> + </exclusions> + </artifactItem> + </artifactItems> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <version>${maven-surefire-plugin.version}</version> + <configuration> + <environmentVariables> + <JBOSS_HOME>${project.build.directory}/wildfly-${wildfly.version}</JBOSS_HOME> + </environmentVariables> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + </profile> + <profile> + <id>wildfly-remote-arquillian</id> + <dependencies> + <dependency> + <groupId>io.undertow</groupId> + <artifactId>undertow-websockets-jsr</artifactId> + <version>${undertow-websockets-jsr.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.jboss.resteasy</groupId> + <artifactId>resteasy-client</artifactId> + <version>${resteasy.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.jboss.resteasy</groupId> + <artifactId>resteasy-jaxb-provider</artifactId> + <version>${resteasy.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.jboss.resteasy</groupId> + <artifactId>resteasy-json-p-provider</artifactId> + <version>${resteasy.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.wildfly</groupId> + <artifactId>wildfly-arquillian-container-remote</artifactId> + <version>${wildfly.version}</version> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>sun.jdk</groupId> + <artifactId>jconsole</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> + </profile> + <profile> + <id>glassfish-embedded-arquillian</id> + <dependencies> + <dependency> + <groupId>org.glassfish.main.extras</groupId> + <artifactId>glassfish-embedded-all</artifactId> + <version>${glassfish-embedded-all.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.glassfish</groupId> + <artifactId>javax.json</artifactId> + <version>${javax.json.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.glassfish.tyrus</groupId> + <artifactId>tyrus-client</artifactId> + <version>${tyrus.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.glassfish.tyrus</groupId> + <artifactId>tyrus-container-grizzly-client</artifactId> + <version>${tyrus.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.core</groupId> + <artifactId>jersey-client</artifactId> + <version>${jersey.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.jboss.arquillian.container</groupId> + <artifactId>arquillian-glassfish-embedded-3.1</artifactId> + <version>${arquillian-glassfish.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + </profile> + <profile> + <id>glassfish-remote-arquillian</id> + <dependencies> + <dependency> + <groupId>org.glassfish</groupId> + <artifactId>javax.json</artifactId> + <version>${javax.json.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.glassfish.tyrus</groupId> + <artifactId>tyrus-client</artifactId> + <version>${tyrus.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.glassfish.tyrus</groupId> + <artifactId>tyrus-container-grizzly-client</artifactId> + <version>${tyrus.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.core</groupId> + <artifactId>jersey-client</artifactId> + <version>${jersey.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.media</groupId> + <artifactId>jersey-media-json-jackson</artifactId> + <version>${jersey.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.media</groupId> + <artifactId>jersey-media-json-processing</artifactId> + <version>${jersey.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.jboss.arquillian.container</groupId> + <artifactId>arquillian-glassfish-remote-3.1</artifactId> + <version>${arquillian-glassfish.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + </profile> + <profile> + <id>webdriver-chrome</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + <properties> + <browser>chrome</browser> + </properties> + </profile> + <profile> + <id>webdriver-firefox</id> + <properties> + <browser>firefox</browser> + </properties> + </profile> + </profiles> - <repositories> - <repository> - <id>bintray-mvc-spec-maven</id> - <name>bintray</name> - <url>http://dl.bintray.com/mvc-spec/maven</url> - <releases> - <enabled>true</enabled> - </releases> - <snapshots> - <enabled>false</enabled> - </snapshots> - </repository> - </repositories> + <repositories> + <repository> + <id>bintray-mvc-spec-maven</id> + <name>bintray</name> + <url>http://dl.bintray.com/mvc-spec/maven</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </repository> + </repositories> - <properties> - <java.min.version>1.8</java.min.version> - <maven.min.version>3.0.0</maven.min.version> - <javaee_api.version>7.0</javaee_api.version> - <arquillian_core.version>1.1.11.Final</arquillian_core.version> - <wildfly.version>8.2.1.Final</wildfly.version> - <awaitility.version>1.7.0</awaitility.version> - <undertow-websockets-jsr.version>1.4.6.Final</undertow-websockets-jsr.version> - <resteasy.version>3.0.19.Final</resteasy.version> - <glassfish-embedded-all.version>4.1.1</glassfish-embedded-all.version> - <javax.json.version>1.0.4</javax.json.version> - <tyrus.version>1.13</tyrus.version> - <jersey.version>2.25</jersey.version> - <arquillian-glassfish.version>1.0.0.Final</arquillian-glassfish.version> - <org.springframework.security.version>4.2.3.RELEASE</org.springframework.security.version> - <maven-surefire-plugin.version>2.21.0</maven-surefire-plugin.version> - <taglibs.standard.version>1.1.2</taglibs.standard.version> - <com.sun.faces.jsf.version>2.2.14</com.sun.faces.jsf.version> - <httpclient.version>4.5</httpclient.version> - <arquillian-drone-bom.version>2.0.1.Final</arquillian-drone-bom.version> - <graphene-webdriver.version>2.1.0.Final</graphene-webdriver.version> - <maven-dependency-plugin.version>2.8</maven-dependency-plugin.version> - <jsp-api.version>2.2</jsp-api.version> - <ozark.version>20160715</ozark.version> - <jboss-batch-api.version>1.0.0.Final</jboss-batch-api.version> - <jberet.version>1.0.2.Final</jberet.version> - <jboss-transaction-api.version>1.0.0.Final</jboss-transaction-api.version> - <jboss-marshalling.version>1.4.2.Final</jboss-marshalling.version> - <weld.version>2.1.1.Final</weld.version> - <jersey-container-jetty-servlet.version>2.22.1</jersey-container-jetty-servlet.version> - </properties> + <properties> + <java.min.version>1.8</java.min.version> + <maven.min.version>3.0.0</maven.min.version> + <javaee_api.version>7.0</javaee_api.version> + <arquillian_core.version>1.1.11.Final</arquillian_core.version> + <wildfly.version>8.2.1.Final</wildfly.version> + <awaitility.version>1.7.0</awaitility.version> + <undertow-websockets-jsr.version>1.4.6.Final</undertow-websockets-jsr.version> + <resteasy.version>3.0.19.Final</resteasy.version> + <glassfish-embedded-all.version>4.1.1</glassfish-embedded-all.version> + <javax.json.version>1.0.4</javax.json.version> + <tyrus.version>1.13</tyrus.version> + <jersey.version>2.25</jersey.version> + <arquillian-glassfish.version>1.0.0.Final</arquillian-glassfish.version> + <org.springframework.security.version>4.2.3.RELEASE</org.springframework.security.version> + <maven-surefire-plugin.version>2.21.0</maven-surefire-plugin.version> + <taglibs.standard.version>1.1.2</taglibs.standard.version> + <com.sun.faces.jsf.version>2.2.14</com.sun.faces.jsf.version> + <httpclient.version>4.5</httpclient.version> + <arquillian-drone-bom.version>2.0.1.Final</arquillian-drone-bom.version> + <graphene-webdriver.version>2.1.0.Final</graphene-webdriver.version> + <maven-dependency-plugin.version>2.8</maven-dependency-plugin.version> + <jsp-api.version>2.2</jsp-api.version> + <ozark.version>20160715</ozark.version> + <jboss-batch-api.version>1.0.0.Final</jboss-batch-api.version> + <jberet.version>1.0.2.Final</jberet.version> + <jboss-transaction-api.version>1.0.0.Final</jboss-transaction-api.version> + <jboss-marshalling.version>1.4.2.Final</jboss-marshalling.version> + <weld.version>2.1.1.Final</weld.version> + <jersey-container-jetty-servlet.version>2.22.1</jersey-container-jetty-servlet.version> + </properties> </project> diff --git a/jee-kotlin/pom.xml b/jee-kotlin/pom.xml index 60765f6bc2..80c5ea4e22 100644 --- a/jee-kotlin/pom.xml +++ b/jee-kotlin/pom.xml @@ -1,17 +1,36 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>jee-kotlin</artifactId> <name>jee-kotlin</name> <packaging>war</packaging> - + <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.jboss.arquillian</groupId> + <artifactId>arquillian-bom</artifactId> + <version>${arquillian_core.version}</version> + <scope>import</scope> + <type>pom</type> + </dependency> + <dependency> + <groupId>org.jboss.arquillian.extension</groupId> + <artifactId>arquillian-drone-bom</artifactId> + <version>${arquillian-drone-bom.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>org.jetbrains.kotlin</groupId> @@ -144,25 +163,6 @@ </plugins> </build> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.jboss.arquillian</groupId> - <artifactId>arquillian-bom</artifactId> - <version>${arquillian_core.version}</version> - <scope>import</scope> - <type>pom</type> - </dependency> - <dependency> - <groupId>org.jboss.arquillian.extension</groupId> - <artifactId>arquillian-drone-bom</artifactId> - <version>${arquillian-drone-bom.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <profiles> <profile> <id>wildfly-managed-arquillian</id> @@ -265,12 +265,10 @@ <failOnMissingWebXml>false</failOnMissingWebXml> <javaee-api.version>8.0</javaee-api.version> - <kotlin.version>1.3.41</kotlin.version> <kotlin.code.style>official</kotlin.code.style> <kotlin.compiler.incremental>true</kotlin.compiler.incremental> - <wildfly.version>8.2.1.Final</wildfly.version> <maven-surefire-plugin.version>2.21.0</maven-surefire-plugin.version> <maven-dependency-plugin.version>3.1.1</maven-dependency-plugin.version> @@ -283,4 +281,5 @@ <shrinkwrap.version>3.1.3</shrinkwrap.version> </properties> + </project> diff --git a/jenkins/plugins/pom.xml b/jenkins/plugins/pom.xml index 1db7cec394..c4caf5567f 100644 --- a/jenkins/plugins/pom.xml +++ b/jenkins/plugins/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>plugins</artifactId> <version>1.0-SNAPSHOT</version> @@ -12,7 +12,7 @@ <groupId>org.jenkins-ci.plugins</groupId> <artifactId>plugin</artifactId> <version>2.33</version> - <relativePath /> + <relativePath/> </parent> <dependencies> @@ -91,6 +91,6 @@ <workflow-durable-task-step.version>2.13</workflow-durable-task-step.version> <workflow-api.version>2.20</workflow-api.version> <workflow-support.version>2.14</workflow-support.version> - </properties> + </project> diff --git a/jersey/pom.xml b/jersey/pom.xml index 0b4d469e3a..065e2230a2 100644 --- a/jersey/pom.xml +++ b/jersey/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <artifactId>jersey</artifactId> <version>0.0.1-SNAPSHOT</version> diff --git a/jgit/pom.xml b/jgit/pom.xml index deae1e45e3..eef3c9b8e8 100644 --- a/jgit/pom.xml +++ b/jgit/pom.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>JGit</artifactId> <version>1.0-SNAPSHOT</version> - <name>JGit</name> + <name>JGit</name> <packaging>jar</packaging> <url>http://maven.apache.org</url> @@ -29,21 +28,11 @@ <artifactId>org.eclipse.jgit</artifactId> <version>${org.eclipse.jgit.version}</version> </dependency> - <dependency> - <groupId>org.eclipse.jgit</groupId> - <artifactId>org.eclipse.jgit.archive</artifactId> - <version>${org.eclipse.jgit.version}</version> - </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>${commons-io.version}</version> </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-simple</artifactId> - <version>${org.slf4j.version}</version> - </dependency> </dependencies> <properties> diff --git a/jgroups/pom.xml b/jgroups/pom.xml index e95fe2be3c..494de2fb4f 100644 --- a/jgroups/pom.xml +++ b/jgroups/pom.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>jgroups</artifactId> <version>0.1-SNAPSHOT</version> <name>jgroups</name> - <description>Reliable Messaging with JGroups Tutorial</description> <packaging>jar</packaging> + <description>Reliable Messaging with JGroups Tutorial</description> <parent> <groupId>com.baeldung</groupId> diff --git a/jhipster/jhipster-microservice/gateway-app/README.md b/jhipster/jhipster-microservice/gateway-app/README.md index 31f9a3e249..179fb3fcd4 100644 --- a/jhipster/jhipster-microservice/gateway-app/README.md +++ b/jhipster/jhipster-microservice/gateway-app/README.md @@ -25,7 +25,7 @@ We use [Gulp][] as our build system. Install the Gulp command-line tool globally Besides that we should download our bower dependencies: - bower instal + bower install Run the following commands in two separate terminals to create a blissful development experience where your browser auto-refreshes when files change on your hard drive. diff --git a/jib/pom.xml b/jib/pom.xml index 2341fcca0c..1d7413cc18 100644 --- a/jib/pom.xml +++ b/jib/pom.xml @@ -1,13 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>jib</artifactId> <version>0.1-SNAPSHOT</version> <name>jib</name> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -18,7 +19,7 @@ <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies> - + <build> <plugins> <plugin> @@ -39,6 +40,6 @@ </build> <properties> - <jib-maven-plugin.version>0.9.10</jib-maven-plugin.version> + <jib-maven-plugin.version>0.9.10</jib-maven-plugin.version> </properties> </project> diff --git a/jjwt/pom.xml b/jjwt/pom.xml index 2d03543293..073f12a922 100644 --- a/jjwt/pom.xml +++ b/jjwt/pom.xml @@ -1,17 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>io.jsonwebtoken</groupId> <artifactId>jjwt</artifactId> - <version>0.0.1-SNAPSHOT</version> <name>jjwt</name> <packaging>jar</packaging> <description>Exercising the JJWT</description> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-1</relativePath> </parent> diff --git a/jmeter/pom.xml b/jmeter/pom.xml index 514546987d..64642695ff 100644 --- a/jmeter/pom.xml +++ b/jmeter/pom.xml @@ -1,16 +1,15 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>jmeter</artifactId> - <version>0.0.1-SNAPSHOT</version> <name>jmeter</name> - <description>Intro to Performance testing using JMeter</description> <packaging>jar</packaging> + <description>Intro to Performance testing using JMeter</description> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-1</relativePath> </parent> diff --git a/jmh/pom.xml b/jmh/pom.xml index 70a0a398d4..735198036e 100644 --- a/jmh/pom.xml +++ b/jmh/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>jmh</artifactId> <version>1.0-SNAPSHOT</version> <name>jmh</name> diff --git a/jni/pom.xml b/jni/pom.xml index 4850e07ed7..d64fa12c5a 100644 --- a/jni/pom.xml +++ b/jni/pom.xml @@ -1,13 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>jni</artifactId> <name>jni</name> - - <parent> - <groupId>com.baeldung</groupId> - <artifactId>parent-modules</artifactId> - <version>1.0.0-SNAPSHOT</version> - </parent> + + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> </project> \ No newline at end of file diff --git a/jooby/pom.xml b/jooby/pom.xml index 83dd650701..fe26f9a4c6 100644 --- a/jooby/pom.xml +++ b/jooby/pom.xml @@ -1,63 +1,63 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <artifactId>jooby</artifactId> - <groupId>com.baeldung.jooby</groupId> - <version>1.0</version> - <name>jooby</name> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>com.baeldung.jooby</groupId> + <artifactId>jooby</artifactId> + <version>1.0</version> + <name>jooby</name> - <parent> - <groupId>com.baeldung</groupId> - <artifactId>parent-modules</artifactId> - <version>1.0.0-SNAPSHOT</version> - </parent> + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.jooby</groupId> - <artifactId>modules</artifactId> - <version>${jooby.version}</version> - <type>pom</type> - </dependency> - </dependencies> - </dependencyManagement> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.jooby</groupId> + <artifactId>modules</artifactId> + <version>${jooby.version}</version> + <type>pom</type> + </dependency> + </dependencies> + </dependencyManagement> - <dependencies> - <dependency> - <groupId>org.jooby</groupId> - <artifactId>jooby-netty</artifactId> - <version>${jooby.version}</version> - </dependency> - <dependency> - <groupId>org.jooby</groupId> - <artifactId>jooby-jedis</artifactId> - <version>${jooby.version}</version> - </dependency> - <dependency> - <groupId>io.rest-assured</groupId> - <artifactId>rest-assured</artifactId> - <scope>test</scope> - <version>${rest-assured.version}</version> - </dependency> - </dependencies> + <dependencies> + <dependency> + <groupId>org.jooby</groupId> + <artifactId>jooby-netty</artifactId> + <version>${jooby.version}</version> + </dependency> + <dependency> + <groupId>org.jooby</groupId> + <artifactId>jooby-jedis</artifactId> + <version>${jooby.version}</version> + </dependency> + <dependency> + <groupId>io.rest-assured</groupId> + <artifactId>rest-assured</artifactId> + <scope>test</scope> + <version>${rest-assured.version}</version> + </dependency> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-shade-plugin</artifactId> - <version>${maven-shade-plugin.version}</version> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <version>${maven-shade-plugin.version}</version> + </plugin> + </plugins> + </build> - <properties> - <jooby.version>1.1.3</jooby.version> - <rest-assured.version>3.1.1</rest-assured.version> - <application.class>com.baeldung.jooby.App</application.class> - <maven-shade-plugin.version>2.4.3</maven-shade-plugin.version> - </properties> + <properties> + <jooby.version>1.1.3</jooby.version> + <rest-assured.version>3.1.1</rest-assured.version> + <application.class>com.baeldung.jooby.App</application.class> + <maven-shade-plugin.version>2.4.3</maven-shade-plugin.version> + </properties> </project> diff --git a/jsf/pom.xml b/jsf/pom.xml index 31362a8809..dc110b9fd5 100644 --- a/jsf/pom.xml +++ b/jsf/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>jsf</artifactId> <version>0.1-SNAPSHOT</version> @@ -8,8 +8,8 @@ <packaging>war</packaging> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> @@ -30,28 +30,7 @@ <artifactId>javax.el-api</artifactId> <version>${javax.el.version}</version> </dependency> - <!-- JSTL --> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>jstl</artifactId> - <version>${jstl.version}</version> - </dependency> <!-- Spring --> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-webmvc</artifactId> - <version>${org.springframework.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-websocket</artifactId> - <version>${org.springframework.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-messaging</artifactId> - <version>${org.springframework.version}</version> - </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> @@ -69,13 +48,6 @@ <scope>provided</scope> <version>${javax.servlet-api.version}</version> </dependency> - - <!-- Primefaces --> - <dependency> - <groupId>org.primefaces</groupId> - <artifactId>primefaces</artifactId> - <version>${primefaces.version}</version> - </dependency> </dependencies> <build> @@ -98,8 +70,6 @@ <!-- JSF --> <com.sun.faces.version>2.2.14</com.sun.faces.version> <javax.el.version>3.0.0</javax.el.version> - - <primefaces.version>6.2</primefaces.version> </properties> </project> \ No newline at end of file diff --git a/json-path/pom.xml b/json-path/pom.xml index 0f8ff3bd31..8756ffee7b 100644 --- a/json-path/pom.xml +++ b/json-path/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>json-path</artifactId> <version>0.0.1-SNAPSHOT</version> diff --git a/json/pom.xml b/json/pom.xml index c76625a6fa..bd901b526e 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -1,11 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.baeldung</groupId> <artifactId>json</artifactId> <version>0.0.1-SNAPSHOT</version> <name>json</name> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> @@ -44,29 +45,22 @@ <artifactId>jackson-databind</artifactId> <version>${jackson.version}</version> </dependency> - <dependency> + <dependency> <groupId>javax.json.bind</groupId> <artifactId>javax.json.bind-api</artifactId> <version>${jsonb-api.version}</version> </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>${junit.version}</version> - <scope>test</scope> - </dependency> - <!-- https://search.maven.org/search?q=g:org.glassfish%20AND%20a:javax.json&core=gav --> <dependency> <groupId>org.glassfish</groupId> <artifactId>javax.json</artifactId> <version>${javax.version}</version> </dependency> - <dependency> - <groupId>org.eclipse</groupId> - <artifactId>yasson</artifactId> - <version>${yasson.version}</version> + <dependency> + <groupId>org.eclipse</groupId> + <artifactId>yasson</artifactId> + <version>${yasson.version}</version> </dependency> - <!-- utils --> + <!-- utils --> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-collections4</artifactId> @@ -87,10 +81,10 @@ <jsonb-api.version>1.0</jsonb-api.version> <commons-collections4.version>4.1</commons-collections4.version> <yasson.version>1.0.1</yasson.version> - <json.version>20171018</json.version> - <gson.version>2.8.5</gson.version> - <javax.version>1.1.2</javax.version> - <assertj-core.version>3.11.1</assertj-core.version> + <json.version>20171018</json.version> + <gson.version>2.8.5</gson.version> + <javax.version>1.1.2</javax.version> + <assertj-core.version>3.11.1</assertj-core.version> </properties> </project> diff --git a/jsoup/pom.xml b/jsoup/pom.xml index f6e25e7a23..d2b59476f3 100644 --- a/jsoup/pom.xml +++ b/jsoup/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>jsoup</artifactId> <name>jsoup</name> diff --git a/jta/pom.xml b/jta/pom.xml index 1e86a0144c..8f90f74d43 100644 --- a/jta/pom.xml +++ b/jta/pom.xml @@ -2,7 +2,6 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>jta</artifactId> <version>1.0-SNAPSHOT</version> <name>jta</name> @@ -10,8 +9,8 @@ <description>JEE JTA demo</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -33,51 +32,7 @@ <dependency> <groupId>org.hsqldb</groupId> <artifactId>hsqldb</artifactId> - <version>${hsqldb.version}</version> </dependency> </dependencies> - <profiles> - <profile> - <id>autoconfiguration</id> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <executions> - <execution> - <phase>integration-test</phase> - <goals> - <goal>test</goal> - </goals> - <configuration> - <excludes> - <exclude>**/*LiveTest.java</exclude> - <exclude>**/*IntegrationTest.java</exclude> - <exclude>**/*IntTest.java</exclude> - </excludes> - <includes> - <include>**/AutoconfigurationTest.java</include> - </includes> - </configuration> - </execution> - </executions> - <configuration> - <systemPropertyVariables> - <test.mime>json</test.mime> - </systemPropertyVariables> - </configuration> - </plugin> - </plugins> - </build> - </profile> - </profiles> - - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - <hsqldb.version>2.4.1</hsqldb.version> - <spring-boot.version>2.0.4.RELEASE</spring-boot.version> - </properties> </project> diff --git a/jws/pom.xml b/jws/pom.xml index 5c19c887d3..e6ab7e05ec 100644 --- a/jws/pom.xml +++ b/jws/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>jws</artifactId> @@ -13,12 +14,12 @@ <version>1.0.0-SNAPSHOT</version> </parent> - <repositories> - <repository> - <id>OpenNMS Repository</id> - <url>http://repo.opennms.org/maven2/</url> - </repository> - </repositories> + <repositories> + <repository> + <id>OpenNMS Repository</id> + <url>http://repo.opennms.org/maven2/</url> + </repository> + </repositories> <dependencies> <dependency> diff --git a/kotlin-libraries/pom.xml b/kotlin-libraries/pom.xml index 7099166674..dfd1dc363f 100644 --- a/kotlin-libraries/pom.xml +++ b/kotlin-libraries/pom.xml @@ -56,7 +56,6 @@ <dependency> <groupId>org.junit.platform</groupId> <artifactId>junit-platform-runner</artifactId> - <version>${junit.platform.version}</version> <scope>test</scope> </dependency> <dependency> @@ -78,7 +77,6 @@ <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> - <version>${assertj.version}</version> <scope>test</scope> </dependency> <dependency> @@ -94,7 +92,6 @@ <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> - <version>${h2.version}</version> </dependency> <!-- https://mvnrepository.com/artifact/io.arrow-kt/arrow-core --> <dependency> @@ -125,7 +122,6 @@ <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>${junit.version}</version> <scope>test</scope> </dependency> @@ -133,13 +129,11 @@ <dependency> <groupId>net.bytebuddy</groupId> <artifactId>byte-buddy</artifactId> - <version>${byte-buddy.version}</version> <scope>compile</scope> </dependency> <dependency> <groupId>net.bytebuddy</groupId> <artifactId>byte-buddy-agent</artifactId> - <version>${byte-buddy.version}</version> <scope>compile</scope> </dependency> <dependency> diff --git a/kotlin-quasar/pom.xml b/kotlin-quasar/pom.xml index 231b02b0c7..a12d27c565 100644 --- a/kotlin-quasar/pom.xml +++ b/kotlin-quasar/pom.xml @@ -2,15 +2,14 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>kotlin-quasar</artifactId> <version>1.0.0-SNAPSHOT</version> <name>kotlin-quasar</name> <packaging>jar</packaging> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> @@ -51,27 +50,27 @@ <artifactId>junit</artifactId> <version>4.12</version> </dependency> - <!-- logging --> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <version>${org.slf4j.version}</version> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>${logback.version}</version> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-core</artifactId> - <version>${logback.version}</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jcl-over-slf4j</artifactId> - <version>${org.slf4j.version}</version> - </dependency> + <!-- logging --> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>${org.slf4j.version}</version> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <version>${logback.version}</version> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-core</artifactId> + <version>${logback.version}</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jcl-over-slf4j</artifactId> + <version>${org.slf4j.version}</version> + </dependency> </dependencies> <build> @@ -132,7 +131,8 @@ <executable>echo</executable> <arguments> <argument>-javaagent:${co.paralleluniverse:quasar-core:jar}</argument> - <argument>-classpath</argument> <classpath/> + <argument>-classpath</argument> + <classpath/> <argument>com.baeldung.quasar.QuasarHelloWorldKt</argument> </arguments> </configuration> @@ -143,7 +143,8 @@ <properties> <quasar.version>0.8.0</quasar.version> <kotlin.version>1.3.31</kotlin.version> - <org.slf4j.version>1.7.21</org.slf4j.version> - <logback.version>1.1.7</logback.version> + <org.slf4j.version>1.7.21</org.slf4j.version> + <logback.version>1.1.7</logback.version> </properties> + </project> diff --git a/libraries-2/pom.xml b/libraries-2/pom.xml index 1ffaf0bbd7..474ff563c2 100644 --- a/libraries-2/pom.xml +++ b/libraries-2/pom.xml @@ -159,4 +159,5 @@ <spring.version>5.1.9.RELEASE</spring.version> <hsqldb.version>2.5.0</hsqldb.version> </properties> + </project> diff --git a/libraries-3/README.md b/libraries-3/README.md index a6c6b190ab..a9d48bb389 100644 --- a/libraries-3/README.md +++ b/libraries-3/README.md @@ -7,3 +7,5 @@ The code examples related to different libraries are each in their own module. Remember, for advanced libraries like [Jackson](/jackson) and [JUnit](/testing-modules) we already have separate modules. Please make sure to have a look at the existing modules in such cases. +### Relevant Articles: +- [Parsing Command-Line Parameters with JCommander](https://www.baeldung.com/jcommander-parsing-command-line-parameters) diff --git a/libraries-3/pom.xml b/libraries-3/pom.xml index 214e87287d..c8980fd309 100644 --- a/libraries-3/pom.xml +++ b/libraries-3/pom.xml @@ -12,22 +12,6 @@ <version>1.0.0-SNAPSHOT</version> </parent> - <repositories> - <repository> - <id>jboss-public-repository-group</id> - <name>JBoss Public Repository Group</name> - <url>http://repository.jboss.org/nexus/content/groups/public/</url> - <releases> - <enabled>true</enabled> - <updatePolicy>never</updatePolicy> - </releases> - <snapshots> - <enabled>true</enabled> - <updatePolicy>daily</updatePolicy> - </snapshots> - </repository> - </repositories> - <dependencies> <dependency> <groupId>com.beust</groupId> @@ -44,8 +28,5 @@ <properties> <jcommander.version>1.78</jcommander.version> <lombok.version>1.18.6</lombok.version> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <maven.compiler.target>1.8</maven.compiler.target> - <maven.compiler.source>1.8</maven.compiler.source> </properties> </project> diff --git a/libraries-apache-commons-collections/pom.xml b/libraries-apache-commons-collections/pom.xml index eba0ad331e..2209874c66 100644 --- a/libraries-apache-commons-collections/pom.xml +++ b/libraries-apache-commons-collections/pom.xml @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>libraries-apache-commons-collections</artifactId> <name>libraries-apache-commons-collections</name> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> diff --git a/libraries-apache-commons-io/pom.xml b/libraries-apache-commons-io/pom.xml index 7ec71d8264..21f3f16cd3 100644 --- a/libraries-apache-commons-io/pom.xml +++ b/libraries-apache-commons-io/pom.xml @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>libraries-apache-commons-io</artifactId> <name>libraries-apache-commons-io</name> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> diff --git a/libraries-apache-commons/pom.xml b/libraries-apache-commons/pom.xml index f83a8c7304..688a500c4a 100644 --- a/libraries-apache-commons/pom.xml +++ b/libraries-apache-commons/pom.xml @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>libraries-apache-commons</artifactId> <name>libraries-apache-commons</name> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> @@ -48,11 +48,6 @@ <version>${common-math3.version}</version> </dependency> <dependency> - <groupId>commons-net</groupId> - <artifactId>commons-net</artifactId> - <version>${commons-net.version}</version> - </dependency> - <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <version>${h2.version}</version> @@ -71,9 +66,7 @@ <commons-chain.version>1.2</commons-chain.version> <assertj.version>3.6.2</assertj.version> <commons.dbutils.version>1.6</commons.dbutils.version> - <commons-codec-version>1.10.L001</commons-codec-version> <xchart-version>3.5.2</xchart-version> - <commons-net.version>3.6</commons-net.version> <common-math3.version>3.6.1</common-math3.version> </properties> diff --git a/libraries-data-2/pom.xml b/libraries-data-2/pom.xml index e79a2d98e0..e6106c0fe3 100644 --- a/libraries-data-2/pom.xml +++ b/libraries-data-2/pom.xml @@ -2,7 +2,6 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> <artifactId>libraries-data-2</artifactId> <name>libraries-data-2</name> @@ -87,11 +86,6 @@ <artifactId>spring-web</artifactId> <version>${spring.version}</version> </dependency> - <dependency> - <groupId>com.google.api-client</groupId> - <artifactId>google-api-client</artifactId> - <version>${google-api.version}</version> - </dependency> <dependency> <groupId>com.googlecode.jmapper-framework</groupId> <artifactId>jmapper-core</artifactId> @@ -153,7 +147,6 @@ <infinispan.version>9.1.5.Final</infinispan.version> <jackson.version>2.9.8</jackson.version> <spring.version>4.3.8.RELEASE</spring.version> - <google-api.version>1.23.0</google-api.version> <jmapper.version>1.6.0.1</jmapper.version> <suanshu.version>4.0.0</suanshu.version> <derive4j.version>1.1.0</derive4j.version> @@ -161,4 +154,5 @@ <slf4j.version>1.7.25</slf4j.version> <awaitility.version>3.0.0</awaitility.version> </properties> + </project> \ No newline at end of file diff --git a/libraries-data-db/pom.xml b/libraries-data-db/pom.xml index 185f23124d..682a6ed185 100644 --- a/libraries-data-db/pom.xml +++ b/libraries-data-db/pom.xml @@ -54,21 +54,11 @@ <artifactId>datanucleus-maven-plugin</artifactId> <version>${datanucleus-maven-plugin.version}</version> </dependency> - <dependency> - <groupId>org.datanucleus</groupId> - <artifactId>datanucleus-xml</artifactId> - <version>${datanucleus-xml.version}</version> - </dependency> <dependency> <groupId>org.datanucleus</groupId> <artifactId>datanucleus-jdo-query</artifactId> <version>${datanucleus-jdo-query.version}</version> </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>${slf4j.version}</version> - </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> @@ -105,16 +95,16 @@ </goals> <configuration> <tasks> - <property name="plugin_classpath" refid="maven.plugin.classpath" /> - <taskdef name="gen-reladomo" classpath="plugin_classpath" classname="com.gs.fw.common.mithra.generator.MithraGenerator" /> + <property name="plugin_classpath" refid="maven.plugin.classpath"/> + <taskdef name="gen-reladomo" classpath="plugin_classpath" classname="com.gs.fw.common.mithra.generator.MithraGenerator"/> <gen-reladomo xml="${project.basedir}/src/main/resources/reladomo/ReladomoClassList.xml" generateGscListMethod="true" - generatedDir="${project.build.directory}/generated-sources/reladomo" nonGeneratedDir="${project.basedir}/src/main/java" /> + generatedDir="${project.build.directory}/generated-sources/reladomo" nonGeneratedDir="${project.basedir}/src/main/java"/> <taskdef name="gen-ddl" classname="com.gs.fw.common.mithra.generator.dbgenerator.MithraDbDefinitionGenerator" loaderRef="reladomoGenerator"> - <classpath refid="maven.plugin.classpath" /> + <classpath refid="maven.plugin.classpath"/> </taskdef> <gen-ddl xml="${project.basedir}/src/main/resources/reladomo/ReladomoClassList.xml" - generatedDir="${project.build.directory}/generated-db/sql" databaseType="postgres" /> + generatedDir="${project.build.directory}/generated-db/sql" databaseType="postgres"/> </tasks> </configuration> </execution> @@ -218,11 +208,10 @@ <ormlite.version>5.0</ormlite.version> <datanucleus.version>5.1.1</datanucleus.version> <datanucleus-maven-plugin.version>5.0.2</datanucleus-maven-plugin.version> - <datanucleus-xml.version>5.0.0-release</datanucleus-xml.version> <datanucleus-jdo-query.version>5.0.4</datanucleus-jdo-query.version> <javax.jdo.version>3.2.0-m7</javax.jdo.version> - <slf4j.version>1.7.25</slf4j.version> <HikariCP.version>2.7.2</HikariCP.version> <ebean.version>11.22.4</ebean.version> </properties> + </project> \ No newline at end of file diff --git a/libraries-data-io/pom.xml b/libraries-data-io/pom.xml index 0e3029f565..e15e188d10 100644 --- a/libraries-data-io/pom.xml +++ b/libraries-data-io/pom.xml @@ -35,11 +35,6 @@ <version>${opencsv.version}</version> </dependency> <!-- google api --> - <dependency> - <groupId>com.google.api-client</groupId> - <artifactId>google-api-client</artifactId> - <version>${google-api.version}</version> - </dependency> <dependency> <groupId>com.google.oauth-client</groupId> <artifactId>google-oauth-client-jetty</artifactId> @@ -79,4 +74,5 @@ <docx4j.version>3.3.5</docx4j.version> <jaxb-api.version>2.1</jaxb-api.version> </properties> + </project> \ No newline at end of file diff --git a/libraries-data/pom.xml b/libraries-data/pom.xml index 8e5360dea3..2086ecb614 100644 --- a/libraries-data/pom.xml +++ b/libraries-data/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>libraries-data</artifactId> <name>libraries-data</name> @@ -13,11 +13,6 @@ </parent> <dependencies> - <dependency> - <groupId>com.h2database</groupId> - <artifactId>h2</artifactId> - <version>${h2.version}</version> - </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> @@ -29,17 +24,6 @@ <artifactId>kafka-streams</artifactId> <version>${kafka.version}</version> </dependency> - <dependency> - <groupId>org.apache.kafka</groupId> - <artifactId>kafka-clients</artifactId> - <version>${kafka.version}</version> - <exclusions> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - </exclusion> - </exclusions> - </dependency> <dependency> <groupId>org.apache.kafka</groupId> <artifactId>kafka-clients</artifactId> @@ -57,11 +41,6 @@ <artifactId>ignite-spring-data</artifactId> <version>${ignite.version}</version> </dependency> - <dependency> - <groupId>org.apache.ignite</groupId> - <artifactId>ignite-indexing</artifactId> - <version>${ignite.version}</version> - </dependency> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> @@ -116,59 +95,17 @@ </exclusion> </exclusions> </dependency> - <dependency> - <groupId>org.apache.flink</groupId> - <artifactId>flink-connector-kafka-0.11_2.11</artifactId> - <version>${flink.version}</version> - </dependency> - <dependency> - <groupId>org.apache.flink</groupId> - <artifactId>flink-streaming-java_2.11</artifactId> - <version>${flink.version}</version> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.datatype</groupId> - <artifactId>jackson-datatype-jsr310</artifactId> - <version>${jackson.version}</version> - </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>${jackson.version}</version> </dependency> - <dependency> - <groupId>org.apache.flink</groupId> - <artifactId>flink-core</artifactId> - <version>${flink.version}</version> - <exclusions> - <exclusion> - <artifactId>commons-logging</artifactId> - <groupId>commons-logging</groupId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.flink</groupId> - <artifactId>flink-java</artifactId> - <version>${flink.version}</version> - <exclusions> - <exclusion> - <artifactId>commons-logging</artifactId> - <groupId>commons-logging</groupId> - </exclusion> - </exclusions> - </dependency> <dependency> <groupId>org.apache.flink</groupId> <artifactId>flink-test-utils_2.11</artifactId> <version>${flink.version}</version> <scope>test</scope> </dependency> - <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <version>${assertj.version}</version> - </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> @@ -189,22 +126,6 @@ </exclusion> </exclusions> </dependency> - - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>${logback.version}</version> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-core</artifactId> - <version>${logback.version}</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>${slf4j.version}</version> - </dependency> </dependencies> <build> @@ -243,14 +164,10 @@ <gson.version>2.8.2</gson.version> <cache.version>1.1.0</cache.version> <flink.version>1.5.0</flink.version> - <assertj.version>3.6.2</assertj.version> <hazelcast.version>3.8.4</hazelcast.version> - <maven-antrun-plugin.version>1.8</maven-antrun-plugin.version> - <build-helper-maven-plugin.version>3.0.0</build-helper-maven-plugin.version> <org.apache.crunch.crunch-core.version>0.15.0</org.apache.crunch.crunch-core.version> - <org.apache.hadoop.hadoop-client>2.2.0</org.apache.hadoop.hadoop-client> + <org.apache.hadoop.hadoop-client>2.2.0</org.apache.hadoop.hadoop-client> <slf4j.version>1.7.25</slf4j.version> - <logback.version>1.0.1</logback.version> </properties> </project> diff --git a/libraries-http/pom.xml b/libraries-http/pom.xml index 44280d848c..6261456486 100644 --- a/libraries-http/pom.xml +++ b/libraries-http/pom.xml @@ -1,31 +1,30 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>libraries-http</artifactId> + <name>libraries-http</name> - <modelVersion>4.0.0</modelVersion> - <artifactId>libraries-http</artifactId> - <name>libraries-http</name> + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> - <parent> - <groupId>com.baeldung</groupId> - <artifactId>parent-modules</artifactId> - <version>1.0.0-SNAPSHOT</version> - </parent> + <dependencies> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <version>${assertj.version}</version> + </dependency> - <dependencies> - <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <version>${assertj.version}</version> - </dependency> - - <!-- Dependencies for response decoder with okhttp --> - <dependency> - <groupId>com.squareup.okhttp3</groupId> - <artifactId>okhttp</artifactId> + <!-- Dependencies for response decoder with okhttp --> + <dependency> + <groupId>com.squareup.okhttp3</groupId> + <artifactId>okhttp</artifactId> <version>${com.squareup.okhttp3.version}</version> - </dependency> + </dependency> <!-- Dependencies for google http client --> <dependency> @@ -38,28 +37,23 @@ <artifactId>google-http-client-jackson2</artifactId> <version>${googleclient.version}</version> </dependency> - <dependency> - <groupId>com.google.http-client</groupId> - <artifactId>google-http-client-gson</artifactId> - <version>${googleclient.version}</version> - </dependency> - <!-- Retrofit --> - <dependency> - <groupId>com.squareup.retrofit2</groupId> - <artifactId>retrofit</artifactId> - <version>${retrofit.version}</version> - </dependency> - <dependency> - <groupId>com.squareup.retrofit2</groupId> - <artifactId>converter-gson</artifactId> - <version>${retrofit.version}</version> - </dependency> - <dependency> - <groupId>com.squareup.retrofit2</groupId> - <artifactId>adapter-rxjava</artifactId> - <version>${retrofit.version}</version> - </dependency> + <!-- Retrofit --> + <dependency> + <groupId>com.squareup.retrofit2</groupId> + <artifactId>retrofit</artifactId> + <version>${retrofit.version}</version> + </dependency> + <dependency> + <groupId>com.squareup.retrofit2</groupId> + <artifactId>converter-gson</artifactId> + <version>${retrofit.version}</version> + </dependency> + <dependency> + <groupId>com.squareup.retrofit2</groupId> + <artifactId>adapter-rxjava</artifactId> + <version>${retrofit.version}</version> + </dependency> <!-- https://mvnrepository.com/artifact/org.asynchttpclient/async-http-client --> <dependency> @@ -68,70 +62,70 @@ <version>${async.http.client.version}</version> </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - <version>${jackson.version}</version> - </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>${jackson.version}</version> + </dependency> - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - <version>2.8.5</version> - </dependency> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <version>2.8.5</version> + </dependency> - <dependency> - <groupId>com.squareup.okhttp3</groupId> - <artifactId>mockwebserver</artifactId> + <dependency> + <groupId>com.squareup.okhttp3</groupId> + <artifactId>mockwebserver</artifactId> <version>${com.squareup.okhttp3.version}</version> - <scope>test</scope> - </dependency> + <scope>test</scope> + </dependency> - <dependency> - <groupId>com.mashape.unirest</groupId> - <artifactId>unirest-java</artifactId> - <version>${unirest.version}</version> - </dependency> - <!-- javalin --> - <dependency> - <groupId>io.javalin</groupId> - <artifactId>javalin</artifactId> - <version>${javalin.version}</version> - </dependency> - <dependency> - <groupId>com.squareup.okhttp3</groupId> - <artifactId>logging-interceptor</artifactId> - <version>${logging-interceptor.version}</version> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - <version>${jackson.version}</version> - </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - <version>${httpclient.version}</version> - <exclusions> - <exclusion> - <artifactId>commons-logging</artifactId> - <groupId>commons-logging</groupId> - </exclusion> - </exclusions> - </dependency> - - </dependencies> + <dependency> + <groupId>com.mashape.unirest</groupId> + <artifactId>unirest-java</artifactId> + <version>${unirest.version}</version> + </dependency> + <!-- javalin --> + <dependency> + <groupId>io.javalin</groupId> + <artifactId>javalin</artifactId> + <version>${javalin.version}</version> + </dependency> + <dependency> + <groupId>com.squareup.okhttp3</groupId> + <artifactId>logging-interceptor</artifactId> + <version>${logging-interceptor.version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>${jackson.version}</version> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + <version>${httpclient.version}</version> + <exclusions> + <exclusion> + <artifactId>commons-logging</artifactId> + <groupId>commons-logging</groupId> + </exclusion> + </exclusions> + </dependency> + </dependencies> - <properties> - <httpclient.version>4.5.3</httpclient.version> - <jackson.version>2.9.8</jackson.version> - <assertj.version>3.6.2</assertj.version> + <properties> + <httpclient.version>4.5.3</httpclient.version> + <jackson.version>2.9.8</jackson.version> + <assertj.version>3.6.2</assertj.version> <com.squareup.okhttp3.version>3.14.2</com.squareup.okhttp3.version> <googleclient.version>1.23.0</googleclient.version> <async.http.client.version>2.2.0</async.http.client.version> - <retrofit.version>2.3.0</retrofit.version> - <unirest.version>1.4.9</unirest.version> - <javalin.version>1.6.0</javalin.version> - <logging-interceptor.version>3.9.0</logging-interceptor.version> - </properties> + <retrofit.version>2.3.0</retrofit.version> + <unirest.version>1.4.9</unirest.version> + <javalin.version>1.6.0</javalin.version> + <logging-interceptor.version>3.9.0</logging-interceptor.version> + </properties> + </project> diff --git a/libraries-http/src/test/java/com/baeldung/okhttp/OkHttpPostingLiveTest.java b/libraries-http/src/test/java/com/baeldung/okhttp/post/OkHttpPostingLiveTest.java similarity index 63% rename from libraries-http/src/test/java/com/baeldung/okhttp/OkHttpPostingLiveTest.java rename to libraries-http/src/test/java/com/baeldung/okhttp/post/OkHttpPostingLiveTest.java index 19e689c093..94ab344060 100644 --- a/libraries-http/src/test/java/com/baeldung/okhttp/OkHttpPostingLiveTest.java +++ b/libraries-http/src/test/java/com/baeldung/okhttp/post/OkHttpPostingLiveTest.java @@ -1,88 +1,122 @@ -package com.baeldung.okhttp; - -import static com.baeldung.client.Consts.APPLICATION_PORT; -import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertThat; - -import java.io.File; -import java.io.IOException; - -import okhttp3.Call; -import okhttp3.Credentials; -import okhttp3.FormBody; -import okhttp3.MediaType; -import okhttp3.MultipartBody; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -import org.junit.Before; -import org.junit.Test; - -/** - * Execute <code>spring-rest</code> module before running this live test - */ -public class OkHttpPostingLiveTest { - - private static final String BASE_URL = "http://localhost:" + APPLICATION_PORT + "/spring-rest"; - private static final String URL_SECURED_BY_BASIC_AUTHENTICATION = "http://browserspy.dk/password-ok.php"; - - OkHttpClient client; - - @Before - public void init() { - - client = new OkHttpClient(); - } - - @Test - public void whenSendPostRequest_thenCorrect() throws IOException { - final RequestBody formBody = new FormBody.Builder().add("username", "test").add("password", "test").build(); - - final Request request = new Request.Builder().url(BASE_URL + "/users").post(formBody).build(); - - final Call call = client.newCall(request); - final Response response = call.execute(); - - assertThat(response.code(), equalTo(200)); - } - - @Test - public void whenSendPostRequestWithAuthorization_thenCorrect() throws IOException { - final String postBody = "test post"; - - final Request request = new Request.Builder().url(URL_SECURED_BY_BASIC_AUTHENTICATION).addHeader("Authorization", Credentials.basic("test", "test")).post(RequestBody.create(MediaType.parse("text/x-markdown; charset=utf-8"), "test post")).build(); - - final Call call = client.newCall(request); - final Response response = call.execute(); - - assertThat(response.code(), equalTo(200)); - } - - @Test - public void whenPostJson_thenCorrect() throws IOException { - final String json = "{\"id\":1,\"name\":\"John\"}"; - - final RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), "{\"id\":1,\"name\":\"John\"}"); - final Request request = new Request.Builder().url(BASE_URL + "/users/detail").post(body).build(); - - final Call call = client.newCall(request); - final Response response = call.execute(); - - assertThat(response.code(), equalTo(200)); - } - - @Test - public void whenSendMultipartRequest_thenCorrect() throws IOException { - final RequestBody requestBody = new MultipartBody.Builder().setType(MultipartBody.FORM).addFormDataPart("username", "test").addFormDataPart("password", "test") - .addFormDataPart("file", "file.txt", RequestBody.create(MediaType.parse("application/octet-stream"), new File("src/test/resources/test.txt"))).build(); - - final Request request = new Request.Builder().url(BASE_URL + "/users/multipart").post(requestBody).build(); - - final Call call = client.newCall(request); - final Response response = call.execute(); - - assertThat(response.code(), equalTo(200)); - } -} +package com.baeldung.okhttp.post; + +import static com.baeldung.client.Consts.APPLICATION_PORT; +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertThat; + +import java.io.File; +import java.io.IOException; + +import okhttp3.Call; +import okhttp3.Credentials; +import okhttp3.FormBody; +import okhttp3.MediaType; +import okhttp3.MultipartBody; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + +import org.junit.Before; +import org.junit.Test; + +/** + * Execute <code>spring-rest</code> module before running this live test + */ +public class OkHttpPostingLiveTest { + + private static final String BASE_URL = "http://localhost:" + APPLICATION_PORT + "/spring-rest"; + private static final String URL_SECURED_BY_BASIC_AUTHENTICATION = "http://browserspy.dk/password-ok.php"; + + OkHttpClient client; + + @Before + public void init() { + + client = new OkHttpClient(); + } + + @Test + public void whenSendPostRequest_thenCorrect() throws IOException { + final RequestBody formBody = new FormBody.Builder() + .add("username", "test") + .add("password", "test") + .build(); + + final Request request = new Request.Builder() + .url(BASE_URL + "/users") + .post(formBody) + .build(); + + final Call call = client.newCall(request); + final Response response = call.execute(); + + assertThat(response.code(), equalTo(200)); + } + + @Test + public void whenSendPostRequestWithAuthorization_thenCorrect() throws IOException { + final String postBody = "test post"; + + final Request request = new Request.Builder() + .url(URL_SECURED_BY_BASIC_AUTHENTICATION) + .addHeader("Authorization", Credentials.basic("test", "test")) + .post(RequestBody.create(MediaType.parse("text/x-markdown"), "test post")) + .build(); + + final Call call = client.newCall(request); + final Response response = call.execute(); + + assertThat(response.code(), equalTo(200)); + } + + @Test + public void whenPostJson_thenCorrect() throws IOException { + final String json = "{\"id\":1,\"name\":\"John\"}"; + + final RequestBody body = RequestBody.create(MediaType.parse("application/json"), "{\"id\":1,\"name\":\"John\"}"); + final Request request = new Request.Builder().url(BASE_URL + "/users/detail").post(body).build(); + + final Call call = client.newCall(request); + final Response response = call.execute(); + + assertThat(response.code(), equalTo(200)); + } + + @Test + public void whenPostJsonWithoutCharset_thenCharsetIsUtf8() throws IOException { + final String json = "{\"id\":1,\"name\":\"John\"}"; + + final RequestBody body = RequestBody.create( + MediaType.parse("application/json"), json); + + String charset = body.contentType().charset().displayName(); + + assertThat(charset, equalTo("UTF-8")); + } + + @Test + public void whenPostJsonWithUtf16Charset_thenCharsetIsUtf16() throws IOException { + final String json = "{\"id\":1,\"name\":\"John\"}"; + + final RequestBody body = RequestBody.create( + MediaType.parse("application/json; charset=utf-16"), json); + + String charset = body.contentType().charset().displayName(); + + assertThat(charset, equalTo("UTF-16")); + } + + @Test + public void whenSendMultipartRequest_thenCorrect() throws IOException { + final RequestBody requestBody = new MultipartBody.Builder().setType(MultipartBody.FORM).addFormDataPart("username", "test").addFormDataPart("password", "test") + .addFormDataPart("file", "file.txt", RequestBody.create(MediaType.parse("application/octet-stream"), new File("src/test/resources/test.txt"))).build(); + + final Request request = new Request.Builder().url(BASE_URL + "/users/multipart").post(requestBody).build(); + + final Call call = client.newCall(request); + final Response response = call.execute(); + + assertThat(response.code(), equalTo(200)); + } +} diff --git a/libraries-http/src/test/java/com/baeldung/okhttp/timeout/OkHttpTimeoutLiveTest.java b/libraries-http/src/test/java/com/baeldung/okhttp/timeout/OkHttpTimeoutLiveTest.java new file mode 100644 index 0000000000..42032aef93 --- /dev/null +++ b/libraries-http/src/test/java/com/baeldung/okhttp/timeout/OkHttpTimeoutLiveTest.java @@ -0,0 +1,136 @@ +package com.baeldung.okhttp.timeout; + +import okhttp3.*; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.io.InterruptedIOException; +import java.net.SocketTimeoutException; +import java.util.concurrent.TimeUnit; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +public class OkHttpTimeoutLiveTest { + + private static Logger logger = LoggerFactory.getLogger(OkHttpTimeoutLiveTest.class); + + private static final String HTTP_NON_ROUTABLE_ADDRESS = "http://203.0.113.1"; + private static final String HTTPS_ADDRESS_DELAY_2 = "https://httpbin.org/delay/2"; + + @Test + public void whenConnectTimeoutExceeded_thenSocketTimeoutException() { + // Given + OkHttpClient client = new OkHttpClient.Builder() + .connectTimeout(10, TimeUnit.MILLISECONDS) + .build(); + + Request request = new Request.Builder() + .url(HTTP_NON_ROUTABLE_ADDRESS) + .build(); + + // When + Throwable thrown = catchThrowable(() -> client.newCall(request).execute()); + + // Then + assertThat(thrown).isInstanceOf(SocketTimeoutException.class); + + logThrown(thrown); + } + + @Test + public void whenReadTimeoutExceeded_thenSocketTimeoutException() { + // Given + OkHttpClient client = new OkHttpClient.Builder() + .readTimeout(10, TimeUnit.MILLISECONDS) + .build(); + + Request request = new Request.Builder() + .url(HTTPS_ADDRESS_DELAY_2) + .build(); + + // When + Throwable thrown = catchThrowable(() -> client.newCall(request).execute()); + + // Then + assertThat(thrown).isInstanceOf(SocketTimeoutException.class); + + logThrown(thrown); + } + + @Test + public void whenWriteTimeoutExceeded_thenSocketTimeoutException() { + // Given + OkHttpClient client = new OkHttpClient.Builder() + .writeTimeout(10, TimeUnit.MILLISECONDS) + .build(); + + Request request = new Request.Builder() + .url(HTTPS_ADDRESS_DELAY_2) + .post(RequestBody.create(MediaType.parse("text/plain"), create1MBString())) + .build(); + + // When + Throwable thrown = catchThrowable(() -> client.newCall(request).execute()); + + // Then + assertThat(thrown).isInstanceOf(SocketTimeoutException.class); + + logThrown(thrown); + } + + @Test + public void whenCallTimeoutExceeded_thenInterruptedIOException() { + // Given + OkHttpClient client = new OkHttpClient.Builder() + .callTimeout(1, TimeUnit.SECONDS) + .build(); + + Request request = new Request.Builder() + .url(HTTPS_ADDRESS_DELAY_2) + .build(); + + // When + Throwable thrown = catchThrowable(() -> client.newCall(request).execute()); + + // Then + assertThat(thrown).isInstanceOf(InterruptedIOException.class); + + logThrown(thrown); + } + + @Test + public void whenPerRequestTimeoutExtended_thenResponseSuccess() throws IOException { + // Given + OkHttpClient defaultClient = new OkHttpClient.Builder() + .readTimeout(1, TimeUnit.SECONDS) + .build(); + + Request request = new Request.Builder() + .url(HTTPS_ADDRESS_DELAY_2) + .build(); + + Throwable thrown = catchThrowable(() -> defaultClient.newCall(request).execute()); + + assertThat(thrown).isInstanceOf(InterruptedIOException.class); + + // When + OkHttpClient extendedTimeoutClient = defaultClient.newBuilder() + .readTimeout(5, TimeUnit.SECONDS) + .build(); + + // Then + Response response = extendedTimeoutClient.newCall(request).execute(); + assertThat(response.code()).isEqualTo(200); + } + + private void logThrown(Throwable thrown) { + logger.info("Thrown: ", thrown); + } + + private String create1MBString() { + return new String(new char[512 * 1024]); + } +} diff --git a/libraries-io/pom.xml b/libraries-io/pom.xml index 5b78ae9442..8c2e841630 100644 --- a/libraries-io/pom.xml +++ b/libraries-io/pom.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>libraries-io</artifactId> <name>libraries-io</name> @@ -37,4 +37,5 @@ <sshj.version>0.27.0</sshj.version> <vfs.version>2.4</vfs.version> </properties> + </project> diff --git a/libraries-primitive/pom.xml b/libraries-primitive/pom.xml index 30f683a544..1370468e76 100644 --- a/libraries-primitive/pom.xml +++ b/libraries-primitive/pom.xml @@ -13,43 +13,43 @@ <dependency> <groupId>it.unimi.dsi</groupId> <artifactId>fastutil</artifactId> - <version>8.2.2</version> + <version>${fastutil.version}</version> </dependency> <!-- https://mvnrepository.com/artifact/junit/junit --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>4.12</version> + <version>${junit.version}</version> <scope>test</scope> </dependency> <!-- https://mvnrepository.com/artifact/org.openjdk.jmh/jmh-core --> <dependency> <groupId>org.openjdk.jmh</groupId> <artifactId>jmh-core</artifactId> - <version>1.19</version> + <version>${jmh.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.openjdk.jmh</groupId> <artifactId>jmh-generator-annprocess</artifactId> - <version>1.19</version> + <version>${jmh.version}</version> <scope>test</scope> </dependency> <!-- Eclipse Collections --> - <dependency> - <groupId>org.eclipse.collections</groupId> - <artifactId>eclipse-collections-api</artifactId> - <version>10.0.0</version> - </dependency> <dependency> <groupId>org.eclipse.collections</groupId> <artifactId>eclipse-collections</artifactId> - <version>10.0.0</version> + <version>${eclipse-collections.version}</version> </dependency> </dependencies> <properties> + <fastutil.version>8.2.2</fastutil.version> + <junit.version>4.12</junit.version> + <jmh.version>1.19</jmh.version> + <eclipse-collections.version>10.0.0</eclipse-collections.version> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> </properties> + </project> \ No newline at end of file diff --git a/libraries-security/pom.xml b/libraries-security/pom.xml index eb16575be8..e287de4527 100644 --- a/libraries-security/pom.xml +++ b/libraries-security/pom.xml @@ -23,12 +23,10 @@ <dependency> <groupId>org.springframework.security.oauth</groupId> <artifactId>spring-security-oauth2</artifactId> - <version>${spring-security-oauth2.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> - <version>${spring.version}</version> </dependency> <dependency> @@ -55,7 +53,6 @@ <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>${junit.version}</version> <scope>test</scope> </dependency> <dependency> @@ -76,14 +73,12 @@ </dependencies> <properties> - <spring-boot-maven-plugin.version>2.0.4.RELEASE</spring-boot-maven-plugin.version> <scribejava.version>5.6.0</scribejava.version> - <spring-security-oauth2.version>2.3.3.RELEASE</spring-security-oauth2.version> - <passay.version>1.3.1</passay.version> + <passay.version>1.3.1</passay.version> <tink.version>1.2.2</tink.version> - <cryptacular.version>1.2.2</cryptacular.version> + <cryptacular.version>1.2.2</cryptacular.version> <jasypt.version>1.9.2</jasypt.version> <bouncycastle.version>1.58</bouncycastle.version> - <spring.version>4.3.8.RELEASE</spring.version> </properties> + </project> diff --git a/libraries-server/pom.xml b/libraries-server/pom.xml index 9bed5e211b..a849708cd8 100644 --- a/libraries-server/pom.xml +++ b/libraries-server/pom.xml @@ -1,16 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>libraries-server</artifactId> <version>0.0.1-SNAPSHOT</version> <name>libraries-server</name> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> - + <dependencies> <dependency> <groupId>org.eclipse.paho</groupId> @@ -73,29 +74,23 @@ <version>${tomcat.version}</version> </dependency> - <dependency> - <groupId>org.igniterealtime.smack</groupId> - <artifactId>smack-tcp</artifactId> - <version>${smack.version}</version> - </dependency> + <dependency> + <groupId>org.igniterealtime.smack</groupId> + <artifactId>smack-tcp</artifactId> + <version>${smack.version}</version> + </dependency> - <dependency> - <groupId>org.igniterealtime.smack</groupId> - <artifactId>smack-im</artifactId> - <version>${smack.version}</version> - </dependency> + <dependency> + <groupId>org.igniterealtime.smack</groupId> + <artifactId>smack-extensions</artifactId> + <version>${smack.version}</version> + </dependency> - <dependency> - <groupId>org.igniterealtime.smack</groupId> - <artifactId>smack-extensions</artifactId> - <version>${smack.version}</version> - </dependency> - - <dependency> - <groupId>org.igniterealtime.smack</groupId> - <artifactId>smack-java7</artifactId> - <version>${smack.version}</version> - </dependency> + <dependency> + <groupId>org.igniterealtime.smack</groupId> + <artifactId>smack-java7</artifactId> + <version>${smack.version}</version> + </dependency> <!-- NanoHTTPD --> <dependency> @@ -116,7 +111,6 @@ <httpclient.version>4.5.3</httpclient.version> <jetty.version>9.4.8.v20171121</jetty.version> <netty.version>4.1.20.Final</netty.version> - <commons.collections.version>4.1</commons.collections.version> <tomcat.version>8.5.24</tomcat.version> <smack.version>4.3.1</smack.version> <eclipse.paho.client.mqttv3.version>1.2.0</eclipse.paho.client.mqttv3.version> diff --git a/libraries-server/src/main/java/com/baeldung/tomcat/ProgrammaticTomcat.java b/libraries-server/src/main/java/com/baeldung/tomcat/ProgrammaticTomcat.java index 6c4fed6d07..f42db2d3de 100644 --- a/libraries-server/src/main/java/com/baeldung/tomcat/ProgrammaticTomcat.java +++ b/libraries-server/src/main/java/com/baeldung/tomcat/ProgrammaticTomcat.java @@ -7,22 +7,50 @@ import org.apache.tomcat.util.descriptor.web.FilterDef; import org.apache.tomcat.util.descriptor.web.FilterMap; import java.io.File; +import java.io.IOException; +import java.net.ServerSocket; +import java.util.Random; /** * Created by adi on 1/10/18. */ public class ProgrammaticTomcat { + private static boolean isFree(int port) { + try { + new ServerSocket(port).close(); + return true; + } catch (IOException e) { + return false; + } + } + private Tomcat tomcat = null; + private int randomPort; + + public ProgrammaticTomcat() { + // Get a random port number in range 6000 (inclusive) - 9000 (exclusive) + this.randomPort = new Random() + .ints(6000, 9000) + .filter(ProgrammaticTomcat::isFree) + .findFirst() + .orElse(8080); + } + // uncomment for live test // public static void main(String[] args) throws LifecycleException, ServletException, URISyntaxException, IOException { // startTomcat(); // } + + public int getPort() { + return randomPort; + } + public void startTomcat() throws LifecycleException { tomcat = new Tomcat(); - tomcat.setPort(8080); + tomcat.setPort(randomPort); tomcat.setHostname("localhost"); String appBase = "."; tomcat.getHost().setAppBase(appBase); diff --git a/libraries-server/src/test/java/com/baeldung/tomcat/ProgrammaticTomcatIntegrationTest.java b/libraries-server/src/test/java/com/baeldung/tomcat/ProgrammaticTomcatIntegrationTest.java index 9224561341..888fb8e366 100644 --- a/libraries-server/src/test/java/com/baeldung/tomcat/ProgrammaticTomcatIntegrationTest.java +++ b/libraries-server/src/test/java/com/baeldung/tomcat/ProgrammaticTomcatIntegrationTest.java @@ -37,7 +37,8 @@ public class ProgrammaticTomcatIntegrationTest { @Test public void givenTomcatStarted_whenAccessServlet_responseIsTestAndResponseHeaderIsSet() throws Exception { CloseableHttpClient httpClient = HttpClientBuilder.create().build(); - HttpGet getServlet = new HttpGet("http://localhost:8080/my-servlet"); + String uri = "http://localhost:" + tomcat.getPort() + "/my-servlet"; + HttpGet getServlet = new HttpGet(uri); HttpResponse response = httpClient.execute(getServlet); assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode()); diff --git a/libraries-testing/pom.xml b/libraries-testing/pom.xml index 86c9bd52e1..c84f8dda76 100644 --- a/libraries-testing/pom.xml +++ b/libraries-testing/pom.xml @@ -1,171 +1,170 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>libraries-testing</artifactId> + <name>libraries-testing</name> - <modelVersion>4.0.0</modelVersion> - <artifactId>libraries-testing</artifactId> - <name>libraries-testing</name> + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> - <parent> - <groupId>com.baeldung</groupId> - <artifactId>parent-modules</artifactId> - <version>1.0.0-SNAPSHOT</version> - </parent> + <dependencies> + <dependency> + <groupId>net.serenity-bdd</groupId> + <artifactId>serenity-core</artifactId> + <version>${serenity.version}</version> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>org.asciidoctor</groupId> + <artifactId>asciidoctorj</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>net.serenity-bdd</groupId> + <artifactId>serenity-junit</artifactId> + <version>${serenity.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>net.serenity-bdd</groupId> + <artifactId>serenity-jbehave</artifactId> + <version>${serenity.jbehave.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>net.serenity-bdd</groupId> + <artifactId>serenity-rest-assured</artifactId> + <version>${serenity.version}</version> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>io.rest-assured</groupId> + <artifactId>rest-assured</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>net.serenity-bdd</groupId> + <artifactId>serenity-jira-requirements-provider</artifactId> + <version>${serenity.jira.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>net.serenity-bdd</groupId> + <artifactId>serenity-spring</artifactId> + <version>${serenity.version}</version> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>spring-test</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>net.serenity-bdd</groupId> + <artifactId>serenity-screenplay</artifactId> + <version>${serenity.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>net.serenity-bdd</groupId> + <artifactId>serenity-screenplay-webdriver</artifactId> + <version>${serenity.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.skyscreamer</groupId> + <artifactId>jsonassert</artifactId> + <version>${jsonassert.version}</version> + </dependency> + <dependency> + <groupId>org.awaitility</groupId> + <artifactId>awaitility</artifactId> + <version>${awaitility.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.awaitility</groupId> + <artifactId>awaitility-proxy</artifactId> + <version>${awaitility.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>io.specto</groupId> + <artifactId>hoverfly-java</artifactId> + <version>${hoverfly-java.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>io.rest-assured</groupId> + <artifactId>spring-mock-mvc</artifactId> + <version>${spring-mock-mvc.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <version>${assertj.version}</version> + </dependency> + <!-- https://mvnrepository.com/artifact/org.hamcrest/java-hamcrest --> + <dependency> + <groupId>org.hamcrest</groupId> + <artifactId>java-hamcrest</artifactId> + <version>${java-hamcrest.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.asciidoctor</groupId> + <artifactId>asciidoctor-maven-plugin</artifactId> + <version>1.5.7.1</version> + </dependency> - <dependencies> - <dependency> - <groupId>net.serenity-bdd</groupId> - <artifactId>serenity-core</artifactId> - <version>${serenity.version}</version> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>org.asciidoctor</groupId> - <artifactId>asciidoctorj</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>net.serenity-bdd</groupId> - <artifactId>serenity-junit</artifactId> - <version>${serenity.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>net.serenity-bdd</groupId> - <artifactId>serenity-jbehave</artifactId> - <version>${serenity.jbehave.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>net.serenity-bdd</groupId> - <artifactId>serenity-rest-assured</artifactId> - <version>${serenity.version}</version> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>io.rest-assured</groupId> - <artifactId>rest-assured</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>net.serenity-bdd</groupId> - <artifactId>serenity-jira-requirements-provider</artifactId> - <version>${serenity.jira.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>net.serenity-bdd</groupId> - <artifactId>serenity-spring</artifactId> - <version>${serenity.version}</version> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>org.springframework</groupId> - <artifactId>spring-test</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>net.serenity-bdd</groupId> - <artifactId>serenity-screenplay</artifactId> - <version>${serenity.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>net.serenity-bdd</groupId> - <artifactId>serenity-screenplay-webdriver</artifactId> - <version>${serenity.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.skyscreamer</groupId> - <artifactId>jsonassert</artifactId> - <version>${jsonassert.version}</version> - </dependency> - <dependency> - <groupId>org.awaitility</groupId> - <artifactId>awaitility</artifactId> - <version>${awaitility.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.awaitility</groupId> - <artifactId>awaitility-proxy</artifactId> - <version>${awaitility.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>io.specto</groupId> - <artifactId>hoverfly-java</artifactId> - <version>${hoverfly-java.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-web</artifactId> - <version>${spring.version}</version> - </dependency> - <dependency> - <groupId>io.rest-assured</groupId> - <artifactId>spring-mock-mvc</artifactId> - <version>${spring-mock-mvc.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <version>${assertj.version}</version> - </dependency> - <!-- https://mvnrepository.com/artifact/org.hamcrest/java-hamcrest --> - <dependency> - <groupId>org.hamcrest</groupId> - <artifactId>java-hamcrest</artifactId> - <version>${java-hamcrest.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.asciidoctor</groupId> - <artifactId>asciidoctor-maven-plugin</artifactId> - <version>1.5.7.1</version> - </dependency> + </dependencies> - </dependencies> + <build> + <plugins> - <build> - <plugins> + <plugin> + <groupId>net.serenity-bdd.maven.plugins</groupId> + <artifactId>serenity-maven-plugin</artifactId> + <version>${serenity.plugin.version}</version> + <executions> + <execution> + <id>serenity-reports</id> + <phase>post-integration-test</phase> + <goals> + <goal>aggregate</goal> + </goals> + </execution> + </executions> + </plugin> - <plugin> - <groupId>net.serenity-bdd.maven.plugins</groupId> - <artifactId>serenity-maven-plugin</artifactId> - <version>${serenity.plugin.version}</version> - <executions> - <execution> - <id>serenity-reports</id> - <phase>post-integration-test</phase> - <goals> - <goal>aggregate</goal> - </goals> - </execution> - </executions> - </plugin> + </plugins> + </build> - </plugins> - </build> + <properties> + <serenity.version>1.9.9</serenity.version> + <serenity.jbehave.version>1.9.0</serenity.jbehave.version> + <serenity.jira.version>1.9.0</serenity.jira.version> + <serenity.plugin.version>1.9.27</serenity.plugin.version> + <jsonassert.version>1.5.0</jsonassert.version> + <awaitility.version>3.0.0</awaitility.version> + <hoverfly-java.version>0.8.1</hoverfly-java.version> + <spring.version>4.3.8.RELEASE</spring.version> + <spring-mock-mvc.version>4.1.1</spring-mock-mvc.version> + <assertj.version>3.6.2</assertj.version> + <java-hamcrest.version>2.0.0.0</java-hamcrest.version> + </properties> - <properties> - <serenity.version>1.9.9</serenity.version> - <serenity.jbehave.version>1.9.0</serenity.jbehave.version> - <serenity.jira.version>1.9.0</serenity.jira.version> - <serenity.plugin.version>1.9.27</serenity.plugin.version> - <jsonassert.version>1.5.0</jsonassert.version> - <awaitility.version>3.0.0</awaitility.version> - <hoverfly-java.version>0.8.1</hoverfly-java.version> - <spring.version>4.3.8.RELEASE</spring.version> - <spring-mock-mvc.version>4.1.1</spring-mock-mvc.version> - <assertj.version>3.6.2</assertj.version> - <java-hamcrest.version>2.0.0.0</java-hamcrest.version> - - </properties> </project> diff --git a/libraries/pom.xml b/libraries/pom.xml index 9511563817..13f91711fd 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>libraries</artifactId> <name>libraries</name> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> @@ -52,22 +52,12 @@ <artifactId>javatuples</artifactId> <version>${javatuples.version}</version> </dependency> - <dependency> - <groupId>org.javassist</groupId> - <artifactId>javassist</artifactId> - <version>${javaassist.version}</version> - </dependency> <!-- https://mvnrepository.com/artifact/org.assertj/assertj-core --> <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> <version>${assertj.version}</version> </dependency> - <dependency> - <groupId>org.skyscreamer</groupId> - <artifactId>jsonassert</artifactId> - <version>${jsonassert.version}</version> - </dependency> <dependency> <groupId>org.javers</groupId> <artifactId>javers-core</artifactId> @@ -86,33 +76,17 @@ <version>${rome.version}</version> </dependency> <dependency> - <groupId>io.specto</groupId> - <artifactId>hoverfly-java</artifactId> - <version>${hoverfly-java.version}</version> - </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - <version>${httpclient.version}</version> + <groupId>net.serenity-bdd</groupId> + <artifactId>serenity-core</artifactId> + <version>${serenity.version}</version> + <scope>test</scope> <exclusions> <exclusion> - <artifactId>commons-logging</artifactId> - <groupId>commons-logging</groupId> + <groupId>org.asciidoctor</groupId> + <artifactId>asciidoctorj</artifactId> </exclusion> </exclusions> </dependency> - <dependency> - <groupId>net.serenity-bdd</groupId> - <artifactId>serenity-core</artifactId> - <version>${serenity.version}</version> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>org.asciidoctor</groupId> - <artifactId>asciidoctorj</artifactId> - </exclusion> - </exclusions> - </dependency> <dependency> <groupId>net.serenity-bdd</groupId> <artifactId>serenity-junit</artifactId> @@ -137,11 +111,6 @@ <version>${serenity.jira.version}</version> <scope>test</scope> </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - <version>${jackson.version}</version> - </dependency> <!-- JDO --> <dependency> @@ -226,11 +195,6 @@ <artifactId>jets3t</artifactId> <version>${jets3t-version}</version> </dependency> - <dependency> - <groupId>org.lucee</groupId> - <artifactId>commons-codec</artifactId> - <version>${commons-codec-version}</version> - </dependency> <dependency> <groupId>io.rest-assured</groupId> @@ -243,17 +207,6 @@ <artifactId>multiverse-core</artifactId> <version>${multiverse.version}</version> </dependency> - <dependency> - <groupId>com.zaxxer</groupId> - <artifactId>HikariCP</artifactId> - <version>${HikariCP.version}</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>com.h2database</groupId> - <artifactId>h2</artifactId> - <version>${h2.version}</version> - </dependency> <dependency> <groupId>pl.pragmatists</groupId> <artifactId>JUnitParams</artifactId> @@ -280,11 +233,6 @@ <artifactId>jmh-core</artifactId> <version>${jmh.version}</version> </dependency> - <dependency> - <groupId>org.openjdk.jmh</groupId> - <artifactId>jmh-generator-annprocess</artifactId> - <version>${jmh.version}</version> - </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> @@ -308,12 +256,6 @@ </exclusion> </exclusions> </dependency> - <dependency> - <groupId>org.codehaus.groovy</groupId> - <artifactId>groovy-all</artifactId> - <type>pom</type> - <version>${groovy.version}</version> - </dependency> <dependency> <groupId>org.awaitility</groupId> <artifactId>awaitility</artifactId> @@ -363,17 +305,6 @@ <version>${vavr.version}</version> </dependency> - - <dependency> - <groupId>com.squareup.okhttp3</groupId> - <artifactId>logging-interceptor</artifactId> - <version>${logging-interceptor.version}</version> - </dependency> - <dependency> - <groupId>com.darwinsys</groupId> - <artifactId>hirondelle-date4j</artifactId> - <version>${hirondelle-date4j.version}</version> - </dependency> <dependency> <groupId>com.haulmont.yarg</groupId> <artifactId>yarg</artifactId> @@ -394,61 +325,16 @@ <artifactId>protonpack</artifactId> <version>${protonpack.version}</version> </dependency> - <dependency> - <groupId>org.functionaljava</groupId> - <artifactId>functionaljava</artifactId> - <version>${functionaljava.version}</version> - </dependency> <dependency> <groupId>org.functionaljava</groupId> <artifactId>functionaljava-java8</artifactId> <version>${functionaljava.version}</version> </dependency> - <dependency> - <groupId>org.functionaljava</groupId> - <artifactId>functionaljava-quickcheck</artifactId> - <version>${functionaljava.version}</version> - </dependency> - <dependency> - <groupId>org.functionaljava</groupId> - <artifactId>functionaljava-java-core</artifactId> - <version>${functionaljava.version}</version> - </dependency> - <dependency> - <groupId>javax.cache</groupId> - <artifactId>cache-api</artifactId> - <version>${cache.version}</version> - </dependency> - <dependency> - <groupId>com.hazelcast</groupId> - <artifactId>hazelcast</artifactId> - <version>${hazelcast.version}</version> - </dependency> - <dependency> - <groupId>org.jgrapht</groupId> - <artifactId>jgrapht-core</artifactId> - <version>${jgrapht.version}</version> - </dependency> <dependency> <groupId>com.github.ben-manes.caffeine</groupId> <artifactId>caffeine</artifactId> <version>${caffeine.version}</version> </dependency> - <dependency> - <groupId>com.google.http-client</groupId> - <artifactId>google-http-client</artifactId> - <version>${googleclient.version}</version> - </dependency> - <dependency> - <groupId>com.google.http-client</groupId> - <artifactId>google-http-client-jackson2</artifactId> - <version>${googleclient.version}</version> - </dependency> - <dependency> - <groupId>com.google.http-client</groupId> - <artifactId>google-http-client-gson</artifactId> - <version>${googleclient.version}</version> - </dependency> <!--Java Docker API Client --> <dependency> @@ -470,19 +356,9 @@ </exclusion> </exclusions> </dependency> - <dependency> - <groupId>com.sun.jersey</groupId> - <artifactId>jersey-client</artifactId> - <version>${jersey.version}</version> - </dependency> <!--Java Docker API Client --> <!-- google api --> - <dependency> - <groupId>com.google.api-client</groupId> - <artifactId>google-api-client</artifactId> - <version>${google-api.version}</version> - </dependency> <dependency> <groupId>com.google.oauth-client</groupId> <artifactId>google-oauth-client-jetty</artifactId> @@ -493,17 +369,6 @@ <artifactId>kafka-streams</artifactId> <version>${kafka.version}</version> </dependency> - <dependency> - <groupId>org.apache.kafka</groupId> - <artifactId>kafka-clients</artifactId> - <version>${kafka.version}</version> - <exclusions> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - </exclusion> - </exclusions> - </dependency> <dependency> <groupId>org.apache.kafka</groupId> <artifactId>kafka-clients</artifactId> @@ -512,8 +377,6 @@ <scope>test</scope> </dependency> - - <!-- Atlassian Fugue --> <dependency> <groupId>io.atlassian.fugue</groupId> @@ -533,11 +396,6 @@ <artifactId>resilience4j-circuitbreaker</artifactId> <version>${resilience4j.version}</version> </dependency> - <dependency> - <groupId>io.github.resilience4j</groupId> - <artifactId>resilience4j-ratelimiter</artifactId> - <version>${resilience4j.version}</version> - </dependency> <dependency> <groupId>io.github.resilience4j</groupId> <artifactId>resilience4j-bulkhead</artifactId> @@ -548,11 +406,6 @@ <artifactId>resilience4j-retry</artifactId> <version>${resilience4j.version}</version> </dependency> - <dependency> - <groupId>io.github.resilience4j</groupId> - <artifactId>resilience4j-cache</artifactId> - <version>${resilience4j.version}</version> - </dependency> <dependency> <groupId>io.github.resilience4j</groupId> <artifactId>resilience4j-timelimiter</artifactId> @@ -576,17 +429,12 @@ <version>${mockftpserver.version}</version> <scope>test</scope> </dependency> + <!-- Reflections --> <dependency> - <groupId>org.asciidoctor</groupId> - <artifactId>asciidoctor-maven-plugin</artifactId> - <version>${asciidoctor-maven-plugin.version}</version> + <groupId>org.reflections</groupId> + <artifactId>reflections</artifactId> + <version>${reflections.version}</version> </dependency> - <!-- Reflections --> - <dependency> - <groupId>org.reflections</groupId> - <artifactId>reflections</artifactId> - <version>${reflections.version}</version> - </dependency> </dependencies> @@ -607,7 +455,6 @@ </repository> </repositories> - <build> <plugins> <plugin> @@ -709,20 +556,13 @@ </build> <properties> - - <googleclient.version>1.23.0</googleclient.version> <multiverse.version>0.7.0</multiverse.version> <cglib.version>3.2.7</cglib.version> <javatuples.version>1.2</javatuples.version> - <javaassist.version>3.21.0-GA</javaassist.version> <assertj.version>3.6.2</assertj.version> - <jsonassert.version>1.5.0</jsonassert.version> <javers.version>3.1.0</javers.version> - <httpclient.version>4.5.3</httpclient.version> <jnats.version>1.0</jnats.version> - - <httpclient.version>4.5.3</httpclient.version> <neuroph.version>2.92</neuroph.version> <serenity.version>1.9.26</serenity.version> <serenity.jbehave.version>1.41.0</serenity.jbehave.version> @@ -739,29 +579,19 @@ <eclipse-collections.version>8.2.0</eclipse-collections.version> <streamex.version>0.6.5</streamex.version> <vavr.version>0.9.0</vavr.version> - <geotools.version>15.2</geotools.version> - <hirondelle-date4j.version>1.5.1</hirondelle-date4j.version> - <joda-time.version>2.10</joda-time.version> - <hirondelle-date4j.version>1.5.1</hirondelle-date4j.version> <protonpack.version>1.15</protonpack.version> - <cache.version>1.0.0</cache.version> - <hazelcast.version>3.10.2</hazelcast.version> <caffeine.version>2.5.5</caffeine.version> <google-api.version>1.23.0</google-api.version> - <google-sheets.version>v4-rev493-1.21.0</google-sheets.version> <kafka.version>2.0.0</kafka.version> <docker.version>3.0.14</docker.version> - <jctools.version>2.1.2</jctools.version> - <commons-codec-version>1.10.L001</commons-codec-version> <jets3t-version>0.9.4.0006L</jets3t-version> <jctools.version>2.1.2</jctools.version> <typesafe-akka.version>2.5.11</typesafe-akka.version> <resilience4j.version>0.12.1</resilience4j.version> <javapoet.version>1.10.0</javapoet.version> <hamcrest-all.version>1.3</hamcrest-all.version> - <hoverfly-java.version>0.8.1</hoverfly-java.version> <javax.jdo.version>3.2.0-m7</javax.jdo.version> <datanucleus.version>5.1.1</datanucleus.version> <datanucleus-maven-plugin.version>5.0.2</datanucleus-maven-plugin.version> @@ -770,27 +600,19 @@ <chronicle.version>3.6.4</chronicle.version> <spring.version>4.3.8.RELEASE</spring.version> <spring-mock-mvc.version>3.0.3</spring-mock-mvc.version> - <HikariCP.version>2.6.3</HikariCP.version> <quartz.version>2.3.0</quartz.version> <jool.version>0.9.12</jool.version> <jmh.version>1.19</jmh.version> - <groovy.version>2.5.2</groovy.version> <noexception.version>1.1.0</noexception.version> - <logging-interceptor.version>3.9.0</logging-interceptor.version> <yarg.version>2.0.4</yarg.version> <mbassador.version>1.3.1</mbassador.version> <jdeferred.version>1.2.6</jdeferred.version> <functionaljava.version>4.8.1</functionaljava.version> - <jgrapht.version>1.0.1</jgrapht.version> - <jersey.version>1.19.4</jersey.version> <fugue.version>4.5.1</fugue.version> - <maven-bundle-plugin.version>3.3.0</maven-bundle-plugin.version> <maven-jar-plugin.version>3.0.2</maven-jar-plugin.version> <mockftpserver.version>2.7.1</mockftpserver.version> <commons-net.version>3.6</commons-net.version> <reflections.version>0.9.11</reflections.version> - <asciidoctor-maven-plugin.version>1.5.7.1</asciidoctor-maven-plugin.version> - </properties> </project> diff --git a/linkrest/pom.xml b/linkrest/pom.xml index b3d3bd374e..89af27d50c 100644 --- a/linkrest/pom.xml +++ b/linkrest/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>linkrest</artifactId> <version>0.0.1-SNAPSHOT</version> @@ -23,16 +24,6 @@ <artifactId>jersey-container-servlet</artifactId> <version>${jersey.version}</version> </dependency> - <dependency> - <groupId>org.glassfish.jersey.media</groupId> - <artifactId>jersey-media-moxy</artifactId> - <version>${jersey.version}</version> - </dependency> - <dependency> - <groupId>com.h2database</groupId> - <artifactId>h2</artifactId> - <version>${h2.version}</version> - </dependency> </dependencies> <build> diff --git a/linux-bash/json/README.md b/linux-bash/json/README.md new file mode 100644 index 0000000000..c0ed9d14d7 --- /dev/null +++ b/linux-bash/json/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Guide to Linux jq Command for JSON processing](https://www.baeldung.com/linux/jq-command-json) diff --git a/linux-bash/text/src/main/bash/append_multiple_lines.sh b/linux-bash/text/src/main/bash/append_multiple_lines.sh new file mode 100755 index 0000000000..580a689716 --- /dev/null +++ b/linux-bash/text/src/main/bash/append_multiple_lines.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# echo per line +echo Lorem ipsum dolor sit amet, consectetur adipiscing elit, >> echo-per-line.txt +echo sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. >> echo-per-line.txt + +# echo with escaped newline +echo -e Lorem ipsum dolor sit amet, consectetur adipiscing elit,\\nsed do eiusmod tempor incididunt ut labore et dolore magna aliqua. >> echo-escaped-newline.txt + +# echo with double quoted string +echo -e "Lorem ipsum dolor sit amet, consectetur adipiscing elit,\nsed do eiusmod tempor incididunt ut labore et dolore magna aliqua." >> echo-double-quoted.txt + +# printf instead of echo +printf "Lorem ipsum dolor sit amet, consectetur adipiscing elit,\nsed do eiusmod tempor incididunt ut labore et dolore magna aliqua." >> printf.txt + +# printf using format string +printf "%s\n%s" "Lorem ipsum dolor sit amet, consectetur adipiscing elit," "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." >> printf-format.txt + +# cat +cat << EOF >> cat.txt +Lorem ipsum dolor sit amet, consectetur adipiscing elit, +sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. +EOF + +# tee +tee -a tee.txt << EOF +Lorem ipsum dolor sit amet, consectetur adipiscing elit, +sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. +EOF + diff --git a/logging-modules/flogger/pom.xml b/logging-modules/flogger/pom.xml index 20201af179..c27e2c8d7a 100644 --- a/logging-modules/flogger/pom.xml +++ b/logging-modules/flogger/pom.xml @@ -6,8 +6,8 @@ <artifactId>flogger</artifactId> <parent> - <artifactId>logging-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>logging-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> @@ -61,6 +61,6 @@ <artifactId>apache-log4j-extras</artifactId> <version>1.2.17</version> </dependency> - </dependencies> + </project> \ No newline at end of file diff --git a/logging-modules/log-mdc/pom.xml b/logging-modules/log-mdc/pom.xml index ce58f43e4e..e367a63de6 100644 --- a/logging-modules/log-mdc/pom.xml +++ b/logging-modules/log-mdc/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>log-mdc</artifactId> <version>0.0.1-SNAPSHOT</version> <name>log-mdc</name> @@ -76,7 +76,6 @@ <version>${spring.version}</version> <scope>test</scope> </dependency> - </dependencies> <build> diff --git a/logging-modules/log4j/pom.xml b/logging-modules/log4j/pom.xml index af97d812de..cc0996a45a 100644 --- a/logging-modules/log4j/pom.xml +++ b/logging-modules/log4j/pom.xml @@ -1,12 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>log4j</artifactId> <version>1.0-SNAPSHOT</version> - <name>log4j</name> + <name>log4j</name> <parent> <groupId>com.baeldung</groupId> diff --git a/logging-modules/log4j2/pom.xml b/logging-modules/log4j2/pom.xml index db0c6eb659..03a4fd8ab0 100644 --- a/logging-modules/log4j2/pom.xml +++ b/logging-modules/log4j2/pom.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>log4j2</artifactId> - <name>log4j2</name> - + <name>log4j2</name> + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> @@ -19,12 +19,12 @@ <artifactId>log4j-core</artifactId> <version>${log4j-core.version}</version> </dependency> - + <!-- This is the needed API component. --> <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-api</artifactId> - <version>${log4j-core.version}</version> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-api</artifactId> + <version>${log4j-core.version}</version> </dependency> <!-- This is used by JSONLayout. --> diff --git a/logging-modules/logback/pom.xml b/logging-modules/logback/pom.xml index 22a89124b5..6ffc9e1235 100644 --- a/logging-modules/logback/pom.xml +++ b/logging-modules/logback/pom.xml @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> <artifactId>logback</artifactId> <version>0.1-SNAPSHOT</version> @@ -16,7 +15,6 @@ </parent> <dependencies> - <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> @@ -52,7 +50,6 @@ </exclusion> </exclusions> </dependency> - </dependencies> <properties> diff --git a/logging-modules/pom.xml b/logging-modules/pom.xml index 927afb6ca9..b9a1fe77c6 100644 --- a/logging-modules/pom.xml +++ b/logging-modules/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>logging-modules</artifactId> <name>logging-modules</name> diff --git a/lombok-custom/pom.xml b/lombok-custom/pom.xml index cfbe629945..1455a4f6c6 100644 --- a/lombok-custom/pom.xml +++ b/lombok-custom/pom.xml @@ -2,18 +2,17 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> <artifactId>lombok-custom</artifactId> - <name>lombok-custom</name> + <name>lombok-custom</name> <version>0.1-SNAPSHOT</version> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> - + <dependencies> <dependency> <groupId>org.projectlombok</groupId> @@ -59,9 +58,8 @@ <properties> <!-- lombok: https://projectlombok.org/changelog.html --> <lombok.version>1.14.8</lombok.version> - <metainf-services.version>1.8</metainf-services.version> - <eclipse.jdt.core.version>3.3.0-v_771</eclipse.jdt.core.version> + <metainf-services.version>1.8</metainf-services.version> + <eclipse.jdt.core.version>3.3.0-v_771</eclipse.jdt.core.version> </properties> - </project> diff --git a/lombok/README.md b/lombok/README.md index 39d3cd6b05..bda960a28a 100644 --- a/lombok/README.md +++ b/lombok/README.md @@ -11,4 +11,4 @@ This module contains articles about Project Lombok. - [Lombok Builder with Custom Setter](https://www.baeldung.com/lombok-builder-custom-setter) - [Setting up Lombok with Eclipse and Intellij](https://www.baeldung.com/lombok-ide) - [Using the @Singular Annotation with Lombok Builders](https://www.baeldung.com/lombok-builder-singular) - +- [Using Lombok’s @Accessors Annotation](https://www.baeldung.com/lombok-accessors) diff --git a/lombok/pom.xml b/lombok/pom.xml index 5e2ad33f66..e347515b40 100644 --- a/lombok/pom.xml +++ b/lombok/pom.xml @@ -1,12 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <name>lombok</name> <artifactId>lombok</artifactId> <version>0.1-SNAPSHOT</version> + <name>lombok</name> <parent> <groupId>com.baeldung</groupId> diff --git a/lucene/pom.xml b/lucene/pom.xml index 3d1ce61782..0a0e09f724 100644 --- a/lucene/pom.xml +++ b/lucene/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>lucene</artifactId> <version>0.0.1-SNAPSHOT</version> @@ -28,14 +29,9 @@ <artifactId>lucene-analyzers-common</artifactId> <version>${lucene.version}</version> </dependency> - </dependencies> <properties> - <!-- various --> - <hibernate-jpa-2.1-api.version>1.0.0.Final</hibernate-jpa-2.1-api.version> - <!-- delombok maven plugin --> - <delombok-maven-plugin.version>1.16.10.0</delombok-maven-plugin.version> <lucene.version>7.4.0</lucene.version> </properties> diff --git a/machine-learning/README.md b/machine-learning/README.md new file mode 100644 index 0000000000..80f2d2c6cd --- /dev/null +++ b/machine-learning/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Introduction to Supervised Learning in Kotlin](https://www.baeldung.com/kotlin-supervised-learning) diff --git a/machine-learning/pom.xml b/machine-learning/pom.xml index bb64470c74..7bc0332012 100644 --- a/machine-learning/pom.xml +++ b/machine-learning/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <artifactId>machine-learning</artifactId> <version>1.0-SNAPSHOT</version> <name>Supervised Learning</name> @@ -54,6 +54,7 @@ <version>${kotlin.version}</version> </dependency> </dependencies> + <build> <sourceDirectory>src/main/kotlin</sourceDirectory> <testSourceDirectory>src/test</testSourceDirectory> @@ -147,4 +148,5 @@ </plugin> </plugins> </build> + </project> diff --git a/mapstruct/pom.xml b/mapstruct/pom.xml index e98c4a318b..11c8d9b41e 100644 --- a/mapstruct/pom.xml +++ b/mapstruct/pom.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <artifactId>mapstruct</artifactId> - <name>mapstruct</name> <version>1.0</version> + <name>mapstruct</name> <packaging>jar</packaging> <parent> diff --git a/maven-all/compiler-plugin-java-9/pom.xml b/maven-all/compiler-plugin-java-9/pom.xml index 5303cee82e..1975e1f7cd 100644 --- a/maven-all/compiler-plugin-java-9/pom.xml +++ b/maven-all/compiler-plugin-java-9/pom.xml @@ -1,22 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> - <artifactId>compiler-plugin-java-9</artifactId> - <version>0.0.1-SNAPSHOT</version> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.8.0</version> - <configuration> - <source>9</source> - <target>9</target> - </configuration> - </plugin> - </plugins> - </build> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>com.baeldung</groupId> + <artifactId>compiler-plugin-java-9</artifactId> + <version>0.0.1-SNAPSHOT</version> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.0</version> + <configuration> + <source>9</source> + <target>9</target> + </configuration> + </plugin> + </plugins> + </build> + </project> \ No newline at end of file diff --git a/maven-all/maven-custom-plugin/counter-maven-plugin/pom.xml b/maven-all/maven-custom-plugin/counter-maven-plugin/pom.xml new file mode 100644 index 0000000000..7ddf5b739c --- /dev/null +++ b/maven-all/maven-custom-plugin/counter-maven-plugin/pom.xml @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>com.baeldung</groupId> + <artifactId>counter-maven-plugin</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>counter-maven-plugin Maven Mojo</name> + <packaging>maven-plugin</packaging> + <url>http://maven.apache.org</url> + + <organization> + <name>Baeldung</name> + <url>https://www.baeldung.com/</url> + </organization> + + <dependencies> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-api</artifactId> + <version>${maven-plugin-api.version}</version> + </dependency> + <dependency> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-annotations</artifactId> + <version>${maven-plugin-annotations.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-project</artifactId> + <version>${maven-project.version}</version> + </dependency> + </dependencies> + + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-plugin-plugin</artifactId> + <version>${maven-plugin-plugin.version}</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-site-plugin</artifactId> + <version>${maven-site-plugin.version}</version> + </plugin> + </plugins> + </pluginManagement> + </build> + + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-plugin-plugin</artifactId> + <reportSets> + <reportSet> + <reports> + <report>report</report> + </reports> + </reportSet> + </reportSets> + </plugin> + </plugins> + </reporting> + + <properties> + <maven.compiler.target>1.8</maven.compiler.target> + <maven.compiler.source>1.8</maven.compiler.source> + <maven-plugin-api.version>3.6.2</maven-plugin-api.version> + <maven-plugin-annotations.version>3.6.0</maven-plugin-annotations.version> + <maven-project.version>2.2.1</maven-project.version> + <maven-plugin-plugin.version>3.6.0</maven-plugin-plugin.version> + <maven-site-plugin.version>3.8.2</maven-site-plugin.version> + </properties> + +</project> \ No newline at end of file diff --git a/maven-all/maven-custom-plugin/counter-maven-plugin/src/main/java/com/baeldung/maven/plugin/validator/DependencyCounterMojo.java b/maven-all/maven-custom-plugin/counter-maven-plugin/src/main/java/com/baeldung/maven/plugin/validator/DependencyCounterMojo.java new file mode 100644 index 0000000000..4bb53b20cf --- /dev/null +++ b/maven-all/maven-custom-plugin/counter-maven-plugin/src/main/java/com/baeldung/maven/plugin/validator/DependencyCounterMojo.java @@ -0,0 +1,45 @@ +package com.baeldung.maven.plugin.validator; + +import java.util.List; + +import org.apache.maven.model.Dependency; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.MavenProject; + +/** + * Counts the number of maven dependencies of a project. + * + * It can be filtered by scope. + * + */ +@Mojo(name = "dependency-counter", defaultPhase = LifecyclePhase.COMPILE) +public class DependencyCounterMojo extends AbstractMojo { + + /** + * Scope to filter the dependencies. + */ + @Parameter(property = "scope") + String scope; + + /** + * Gives access to the Maven project information. + */ + @Parameter(defaultValue = "${project}", required = true, readonly = true) + MavenProject project; + + public void execute() throws MojoExecutionException, MojoFailureException { + List<Dependency> dependencies = project.getDependencies(); + + long numDependencies = dependencies.stream() + .filter(d -> (scope == null || scope.isEmpty()) || scope.equals(d.getScope())) + .count(); + + getLog().info("Number of dependencies: " + numDependencies); + } + +} diff --git a/maven-all/maven-custom-plugin/usage-example/pom.xml b/maven-all/maven-custom-plugin/usage-example/pom.xml new file mode 100644 index 0000000000..542a02b3eb --- /dev/null +++ b/maven-all/maven-custom-plugin/usage-example/pom.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>com.baeldung</groupId> + <artifactId>example</artifactId> + <version>0.0.1-SNAPSHOT</version> + <packaging>pom</packaging> + + <dependencies> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>3.9</version> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>com.baeldung</groupId> + <artifactId>counter-maven-plugin</artifactId> + <version>0.0.1-SNAPSHOT</version> + <executions> + <execution> + <goals> + <goal>dependency-counter</goal> + </goals> + </execution> + </executions> + <configuration> + <scope>test</scope> + </configuration> + </plugin> + </plugins> + </build> + +</project> diff --git a/maven-all/maven-war-plugin/pom.xml b/maven-all/maven-war-plugin/pom.xml index 25c2e1ba1b..233a9f3571 100644 --- a/maven-all/maven-war-plugin/pom.xml +++ b/maven-all/maven-war-plugin/pom.xml @@ -1,12 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung</groupId> <artifactId>maven-war-plugin</artifactId> <version>0.0.1-SNAPSHOT</version> - <packaging>war</packaging> <name>maven-war-plugin</name> + <packaging>war</packaging> <build> <plugins> @@ -21,9 +22,10 @@ </plugin> </plugins> </build> - + <!-- Set failOnMissingWebXml as false in properties section --> <properties> <failOnMissingWebXml>false</failOnMissingWebXml> </properties> + </project> \ No newline at end of file diff --git a/maven-all/maven/custom-rule/README.md b/maven-all/maven/custom-rule/README.md new file mode 100644 index 0000000000..44d43050e7 --- /dev/null +++ b/maven-all/maven/custom-rule/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Maven Enforcer Plugin](https://www.baeldung.com/maven-enforcer-plugin) diff --git a/maven-all/maven/custom-rule/pom.xml b/maven-all/maven/custom-rule/pom.xml index 2fbeb18922..6ff984cb85 100644 --- a/maven-all/maven/custom-rule/pom.xml +++ b/maven-all/maven/custom-rule/pom.xml @@ -4,11 +4,11 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>custom-rule</artifactId> - <name>custom-rule</name> - + <name>custom-rule</name> + <parent> - <artifactId>maven</artifactId> <groupId>com.baeldung</groupId> + <artifactId>maven</artifactId> <version>0.0.1-SNAPSHOT</version> </parent> @@ -64,4 +64,5 @@ <maven.version>2.0.9</maven.version> <plexus-container-default.version>1.0-alpha-9</plexus-container-default.version> </properties> + </project> diff --git a/maven-all/maven/maven-enforcer/pom.xml b/maven-all/maven/maven-enforcer/pom.xml index b18be4f43d..cde37eabd1 100644 --- a/maven-all/maven/maven-enforcer/pom.xml +++ b/maven-all/maven/maven-enforcer/pom.xml @@ -4,11 +4,11 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>maven-enforcer</artifactId> - <name>maven-enforcer</name> - + <name>maven-enforcer</name> + <parent> - <artifactId>maven</artifactId> <groupId>com.baeldung</groupId> + <artifactId>maven</artifactId> <version>0.0.1-SNAPSHOT</version> </parent> @@ -19,11 +19,11 @@ <artifactId>maven-enforcer-plugin</artifactId> <version>3.0.0-M2</version> <!--<dependencies>--> - <!--<dependency>--> - <!--<groupId>com.baeldung</groupId>--> - <!--<artifactId>custom-rule</artifactId>--> - <!--<version>1.0</version>--> - <!--</dependency>--> + <!--<dependency>--> + <!--<groupId>com.baeldung</groupId>--> + <!--<artifactId>custom-rule</artifactId>--> + <!--<version>1.0</version>--> + <!--</dependency>--> <!--</dependencies>--> <executions> <execution> @@ -72,5 +72,4 @@ </plugins> </build> - </project> \ No newline at end of file diff --git a/maven-all/maven/pom.xml b/maven-all/maven/pom.xml index d34be04fcf..0220cf8dfc 100644 --- a/maven-all/maven/pom.xml +++ b/maven-all/maven/pom.xml @@ -1,15 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>maven</artifactId> <version>0.0.1-SNAPSHOT</version> <name>maven</name> <packaging>pom</packaging> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> @@ -307,8 +307,8 @@ <maven.verifier.version>1.1</maven.verifier.version> <maven.clean.version>3.0.0</maven.clean.version> <maven.build.helper.version>3.0.0</maven.build.helper.version> - <resources.name>Baeldung</resources.name> <jetty.version>9.4.11.v20180605</jetty.version> <jersey.version>2.27</jersey.version> </properties> + </project> \ No newline at end of file diff --git a/maven-all/maven/proxy/settings.xml b/maven-all/maven/proxy/settings.xml new file mode 100644 index 0000000000..55a850a6bc --- /dev/null +++ b/maven-all/maven/proxy/settings.xml @@ -0,0 +1,43 @@ +<!-- start of settings.xml here --> + +<!-- + Proxies section (extract of settings.xml) containing example proxy definitions: + * BaeldungProxy_Encrypted - an example http proxy with an encrypted password - encrypted using 'mvn --encrypt-password' + * BaeldungProxy_Authenticated - an example http proxy with a plain text password. + * BaeldungProxy - an example minimalist unauthenticated http proxy + All of these are 'active' - so maven will use the first one in the list. +--> +<proxies> + + <proxy> + <id>BaeldungProxy_Encrypted</id> + <active>true</active> + <protocol>http</protocol> + <host>proxy.baeldung.com</host> + <port>80</port> + <username>baeldung</username> + <password>{U2iMf+7aJXQHRquuQq6MX+n7GOeh97zB9/4e7kkEQYs=}</password> + <nonProxyHosts>internal.baeldung.com|localhost|127.*|[::1]</nonProxyHosts> + </proxy> + + <proxy> + <id>BaeldungProxy_Authenticated</id> + <active>true</active> + <protocol>http</protocol> + <host>proxy.baeldung.com</host> + <port>80</port> + <username>baeldung</username> + <password>changeme</password> + <nonProxyHosts>internal.baeldung.com|localhost|127.*|[::1]</nonProxyHosts> + </proxy> + + <proxy> + <id>BaeldungProxy</id> + <host>proxy.baeldung.com</host> + <port>80</port> + <nonProxyHosts>internal.baeldung.com|localhost|127.*|[::1]</nonProxyHosts> + </proxy> + +</proxies> + +<!-- rest of settings.xml here --> \ No newline at end of file diff --git a/maven-all/maven/security/redirect/settings-security.xml b/maven-all/maven/security/redirect/settings-security.xml new file mode 100644 index 0000000000..37e91bd1a4 --- /dev/null +++ b/maven-all/maven/security/redirect/settings-security.xml @@ -0,0 +1,6 @@ +<!-- + Redirect maven to settings-security.xml stored elsewhere: +--> +<settingsSecurity> + <relocation>R:\config\settings-security.xml</relocation> +</settingsSecurity> diff --git a/maven-all/maven/security/settings-security.xml b/maven-all/maven/security/settings-security.xml new file mode 100644 index 0000000000..3ac258e8a5 --- /dev/null +++ b/maven-all/maven/security/settings-security.xml @@ -0,0 +1,7 @@ +<!-- + Encrypt master password with: + mvn --encrypt-master-password +--> +<settingsSecurity> + <master>{QFMlh/6WjF8H9po9UD\}0Nv18e527jqWb6mUgIB798n4=}</master> +</settingsSecurity> diff --git a/maven-all/profiles/pom.xml b/maven-all/profiles/pom.xml index 110016f3a2..01b191c7d6 100644 --- a/maven-all/profiles/pom.xml +++ b/maven-all/profiles/pom.xml @@ -1,11 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung</groupId> <artifactId>profiles</artifactId> <version>0.0.1-SNAPSHOT</version> - <name>profiles</name> + <name>profiles</name> <profiles> <profile> @@ -85,4 +86,5 @@ </plugin> </plugins> </build> + </project> \ No newline at end of file diff --git a/maven-all/versions-maven-plugin/original/README.md b/maven-all/versions-maven-plugin/original/README.md new file mode 100644 index 0000000000..5652a9b7e4 --- /dev/null +++ b/maven-all/versions-maven-plugin/original/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Use the Latest Version of a Dependency in Maven](https://www.baeldung.com/maven-dependency-latest-version) diff --git a/maven-all/versions-maven-plugin/original/pom.xml b/maven-all/versions-maven-plugin/original/pom.xml index df8ee9a20e..c6c1657b25 100644 --- a/maven-all/versions-maven-plugin/original/pom.xml +++ b/maven-all/versions-maven-plugin/original/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> diff --git a/maven-all/versions-maven-plugin/pom.xml b/maven-all/versions-maven-plugin/pom.xml index c9f63a46f1..3ce25d16f9 100644 --- a/maven-all/versions-maven-plugin/pom.xml +++ b/maven-all/versions-maven-plugin/pom.xml @@ -1,14 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung</groupId> <artifactId>versions-maven-plugin</artifactId> <version>0.0.1-SNAPSHOT</version> - <name>versions-maven-plugin</name> + <name>versions-maven-plugin</name> <dependencies> - <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> @@ -38,7 +38,6 @@ <artifactId>commons-beanutils</artifactId> <version>1.9.1</version> </dependency> - </dependencies> <build> @@ -69,8 +68,8 @@ </snapshots> </repository> </repositories> - - <properties> + + <properties> <commons-compress-version>1.15</commons-compress-version> </properties> diff --git a/maven-archetype/pom.xml b/maven-archetype/pom.xml index 73ddc78fc7..be616ac299 100644 --- a/maven-archetype/pom.xml +++ b/maven-archetype/pom.xml @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.archetypes</groupId> <artifactId>maven-archetype</artifactId> <version>1.0-SNAPSHOT</version> - <name>maven-archetype</name> + <name>maven-archetype</name> <packaging>maven-archetype</packaging> <description>Archetype used to generate rest application based on jaxrs 2.1</description> - + <build> <extensions> <extension> diff --git a/maven-java-11/multimodule-maven-project/daomodule/pom.xml b/maven-java-11/multimodule-maven-project/daomodule/pom.xml index 5520c5a90a..cbe0b4cb95 100644 --- a/maven-java-11/multimodule-maven-project/daomodule/pom.xml +++ b/maven-java-11/multimodule-maven-project/daomodule/pom.xml @@ -1,15 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.daomodule</groupId> <artifactId>daomodule</artifactId> - <packaging>jar</packaging> <version>1.0</version> <name>daomodule</name> - + <packaging>jar</packaging> + <parent> <groupId>com.baeldung.multimodule-maven-project</groupId> <artifactId>multimodule-maven-project</artifactId> <version>1.0</version> </parent> + </project> diff --git a/maven-java-11/multimodule-maven-project/entitiymodule/pom.xml b/maven-java-11/multimodule-maven-project/entitiymodule/pom.xml index 747722e912..228619ed74 100644 --- a/maven-java-11/multimodule-maven-project/entitiymodule/pom.xml +++ b/maven-java-11/multimodule-maven-project/entitiymodule/pom.xml @@ -1,11 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.entitymodule</groupId> <artifactId>entitymodule</artifactId> - <packaging>jar</packaging> <version>1.0</version> <name>entitymodule</name> + <packaging>jar</packaging> <parent> <groupId>com.baeldung.multimodule-maven-project</groupId> @@ -17,4 +18,5 @@ <maven.compiler.source>11</maven.compiler.source> <maven.compiler.target>11</maven.compiler.target> </properties> + </project> diff --git a/maven-java-11/multimodule-maven-project/mainppmodule/pom.xml b/maven-java-11/multimodule-maven-project/mainppmodule/pom.xml index 3e5ec122ff..42b06bbebd 100644 --- a/maven-java-11/multimodule-maven-project/mainppmodule/pom.xml +++ b/maven-java-11/multimodule-maven-project/mainppmodule/pom.xml @@ -1,18 +1,19 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.mainappmodule</groupId> <artifactId>mainappmodule</artifactId> <version>1.0</version> - <packaging>jar</packaging> <name>mainappmodule</name> + <packaging>jar</packaging> <parent> <groupId>com.baeldung.multimodule-maven-project</groupId> <artifactId>multimodule-maven-project</artifactId> <version>1.0</version> </parent> - + <dependencies> <dependency> <groupId>com.baeldung.entitymodule</groupId> @@ -30,4 +31,5 @@ <version>1.0</version> </dependency> </dependencies> + </project> diff --git a/maven-java-11/multimodule-maven-project/pom.xml b/maven-java-11/multimodule-maven-project/pom.xml index 7e2eb0dd7b..a79dff93d3 100644 --- a/maven-java-11/multimodule-maven-project/pom.xml +++ b/maven-java-11/multimodule-maven-project/pom.xml @@ -1,25 +1,26 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.multimodule-maven-project</groupId> <artifactId>multimodule-maven-project</artifactId> <version>1.0</version> - <packaging>pom</packaging> <name>multimodule-maven-project</name> + <packaging>pom</packaging> <parent> <groupId>com.baeldung.maven-java-11</groupId> <artifactId>maven-java-11</artifactId> <version>1.0</version> </parent> - + <modules> <module>entitymodule</module> <module>daomodule</module> <module>userdaomodule</module> <module>mainappmodule</module> </modules> - + <dependencyManagement> <dependencies> <dependency> @@ -36,7 +37,7 @@ </dependency> </dependencies> </dependencyManagement> - + <build> <pluginManagement> <plugins> @@ -52,8 +53,9 @@ </plugins> </pluginManagement> </build> - + <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> + </project> diff --git a/maven-java-11/multimodule-maven-project/userdaomodule/pom.xml b/maven-java-11/multimodule-maven-project/userdaomodule/pom.xml index 68e7ae9b82..3eb5897f8b 100644 --- a/maven-java-11/multimodule-maven-project/userdaomodule/pom.xml +++ b/maven-java-11/multimodule-maven-project/userdaomodule/pom.xml @@ -1,18 +1,19 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.userdaomodule</groupId> <artifactId>userdaomodule</artifactId> <version>1.0</version> - <packaging>jar</packaging> <name>userdaomodule</name> - + <packaging>jar</packaging> + <parent> <groupId>com.baeldung.multimodule-maven-project</groupId> <artifactId>multimodule-maven-project</artifactId> <version>1.0</version> </parent> - + <dependencies> <dependency> <groupId>com.baeldung.entitymodule</groupId> @@ -30,4 +31,5 @@ <scope>test</scope> </dependency> </dependencies> + </project> diff --git a/maven-java-11/pom.xml b/maven-java-11/pom.xml index 5ae4c00892..10e80365c8 100644 --- a/maven-java-11/pom.xml +++ b/maven-java-11/pom.xml @@ -1,15 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.maven-java-11</groupId> <artifactId>maven-java-11</artifactId> <version>1.0</version> - <packaging>pom</packaging> <name>maven-java-11</name> + <packaging>pom</packaging> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> @@ -22,4 +23,5 @@ <maven.compiler.source>11</maven.compiler.source> <maven.compiler.target>11</maven.compiler.target> </properties> + </project> diff --git a/maven-polyglot/maven-polyglot-json-extension/pom.xml b/maven-polyglot/maven-polyglot-json-extension/pom.xml index 1170fe7aa6..0043bae151 100644 --- a/maven-polyglot/maven-polyglot-json-extension/pom.xml +++ b/maven-polyglot/maven-polyglot-json-extension/pom.xml @@ -6,7 +6,7 @@ <groupId>com.baeldung.maven.polyglot</groupId> <artifactId>maven-polyglot-json-extension</artifactId> <version>1.0-SNAPSHOT</version> - <name>maven-polyglot-json-extension</name> + <name>maven-polyglot-json-extension</name> <parent> <groupId>com.baeldung</groupId> @@ -45,10 +45,8 @@ </plugin> </plugins> </build> - + <properties> - <maven.compiler.source>1.8</maven.compiler.source> - <maven.compiler.target>1.8</maven.compiler.target> <maven-core.version>3.5.4</maven-core.version> </properties> diff --git a/mesos-marathon/pom.xml b/mesos-marathon/pom.xml index dee8eca10d..4fb819c434 100644 --- a/mesos-marathon/pom.xml +++ b/mesos-marathon/pom.xml @@ -1,15 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>mesos-marathon</artifactId> - <version>0.0.1-SNAPSHOT</version> - <name>mesos-marathon</name> - + <name>mesos-marathon</name> + <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-1</relativePath> </parent> diff --git a/metrics/pom.xml b/metrics/pom.xml index 4cd9f3de79..92699c3fb8 100644 --- a/metrics/pom.xml +++ b/metrics/pom.xml @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>metrics</artifactId> <name>metrics</name> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> @@ -57,12 +57,6 @@ <version>${micrometer.ver}</version> </dependency> - <dependency> - <groupId>io.micrometer</groupId> - <artifactId>micrometer-spring-legacy</artifactId> - <version>${micrometer.ver}</version> - </dependency> - <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> @@ -80,24 +74,6 @@ <version>${fasterxml.jackson.version}</version> </dependency> - <dependency> - <groupId>com.netflix.spectator</groupId> - <artifactId>spectator-api</artifactId> - <version>${spectator-api.version}</version> - </dependency> - - <dependency> - <groupId>io.astefanutti.metrics.aspectj</groupId> - <artifactId>metrics-aspectj</artifactId> - <version>${metrics-aspectj.version}</version> - <exclusions> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> <groupId>io.astefanutti.metrics.aspectj</groupId> <artifactId>metrics-aspectj-deps</artifactId> @@ -110,7 +86,6 @@ <version>${assertj-core.version}</version> <scope>test</scope> </dependency> - </dependencies> <properties> @@ -119,9 +94,8 @@ <netflix.servo.ver>0.12.17</netflix.servo.ver> <micrometer.ver>0.12.0.RELEASE</micrometer.ver> <fasterxml.jackson.version>2.9.1</fasterxml.jackson.version> - <spectator-api.version>0.57.1</spectator-api.version> - <spring-boot-starter-web.version>2.0.7.RELEASE</spring-boot-starter-web.version> - <assertj-core.version>3.11.1</assertj-core.version> + <spring-boot-starter-web.version>2.0.7.RELEASE</spring-boot-starter-web.version> + <assertj-core.version>3.11.1</assertj-core.version> <metrics-aspectj.version>1.1.0</metrics-aspectj.version> </properties> diff --git a/micronaut/pom.xml b/micronaut/pom.xml index 02ac36218d..13639c11ff 100644 --- a/micronaut/pom.xml +++ b/micronaut/pom.xml @@ -1,4 +1,6 @@ -<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.micronaut</groupId> <artifactId>micronaut</artifactId> @@ -22,6 +24,7 @@ </dependency> </dependencies> </dependencyManagement> + <dependencies> <dependency> <groupId>io.micronaut</groupId> @@ -72,6 +75,7 @@ <version>3.1.6.RELEASE</version> </dependency> </dependencies> + <build> <plugins> <plugin> @@ -133,10 +137,11 @@ </plugins> </pluginManagement> </build> - + <properties> <exec.mainClass>com.baeldung.micronaut.helloworld.server.ServerApplication</exec.mainClass> <micronaut.version>1.0.0.RC2</micronaut.version> <jdk.version>1.8</jdk.version> </properties> + </project> diff --git a/microprofile/pom.xml b/microprofile/pom.xml index 52df348ace..5a32ad8dba 100644 --- a/microprofile/pom.xml +++ b/microprofile/pom.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>microprofile</artifactId> <version>1.0-SNAPSHOT</version> - <name>microprofile</name> + <name>microprofile</name> <packaging>war</packaging> <parent> diff --git a/msf4j/pom.xml b/msf4j/pom.xml index 2a862ac289..a220ce0229 100644 --- a/msf4j/pom.xml +++ b/msf4j/pom.xml @@ -1,45 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung.msf4j</groupId> - <artifactId>msf4j</artifactId> - <version>0.0.1-SNAPSHOT</version> - <name>msf4j</name> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>com.baeldung.msf4j</groupId> + <artifactId>msf4j</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>msf4j</name> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.wso2.msf4j</groupId> - <artifactId>msf4j-service</artifactId> - <version>${msf4j.version}</version> - <type>pom</type> - </dependency> - </dependencies> - </dependencyManagement> - - <dependencies> - <dependency> - <groupId>org.wso2.msf4j</groupId> - <artifactId>msf4j-spring</artifactId> - <version>${msf4j.version}</version> - </dependency> - <dependency> - <groupId>org.wso2.msf4j</groupId> - <artifactId>msf4j-mustache-template</artifactId> - <version>${msf4j.version}</version> - </dependency> - </dependencies> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.wso2.msf4j</groupId> + <artifactId>msf4j-service</artifactId> + <version>${msf4j.version}</version> + <type>pom</type> + </dependency> + </dependencies> + </dependencyManagement> - <properties> - <microservice.mainClass>com.baeldung.msf4j.msf4jintro.Application</microservice.mainClass> - <msf4j.version>2.6.3</msf4j.version> - </properties> + <dependencies> + <dependency> + <groupId>org.wso2.msf4j</groupId> + <artifactId>msf4j-spring</artifactId> + <version>${msf4j.version}</version> + </dependency> + <dependency> + <groupId>org.wso2.msf4j</groupId> + <artifactId>msf4j-mustache-template</artifactId> + <version>${msf4j.version}</version> + </dependency> + </dependencies> + + <properties> + <microservice.mainClass>com.baeldung.msf4j.msf4jintro.Application</microservice.mainClass> + <msf4j.version>2.6.3</msf4j.version> + </properties> </project> \ No newline at end of file diff --git a/muleesb/pom.xml b/muleesb/pom.xml index 4b74b6d4f4..c8468c1e00 100644 --- a/muleesb/pom.xml +++ b/muleesb/pom.xml @@ -1,14 +1,13 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.mycompany</groupId> <artifactId>muleesb</artifactId> <version>1.0.0-SNAPSHOT</version> <name>muleesb</name> - <packaging>mule</packaging> - + <packaging>mule</packaging> + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> diff --git a/mustache/pom.xml b/mustache/pom.xml index 027d62ebc4..9f2402f353 100644 --- a/mustache/pom.xml +++ b/mustache/pom.xml @@ -1,14 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>mustache</artifactId> <name>mustache</name> <packaging>jar</packaging> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -25,12 +25,6 @@ <artifactId>assertj-core</artifactId> </dependency> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <version>${log4j.version}</version> - </dependency> - <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> @@ -56,7 +50,6 @@ <artifactId>datafactory</artifactId> <version>${datafactory.version}</version> </dependency> - </dependencies> <build> @@ -70,9 +63,6 @@ <properties> <mustache.compiler.api.version>0.9.2</mustache.compiler.api.version> - <log4j.version>1.2.16</log4j.version> - - <!-- maven plugins --> <datafactory.version>0.8</datafactory.version> <webjars.bootstrap.version>3.3.7</webjars.bootstrap.version> </properties> diff --git a/mybatis/pom.xml b/mybatis/pom.xml index 4e63d14ded..3b4695fb58 100644 --- a/mybatis/pom.xml +++ b/mybatis/pom.xml @@ -1,12 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>mybatis</artifactId> - <version>1.0.0-SNAPSHOT</version> - <name>mybatis</name> - + <name>mybatis</name> + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> @@ -14,11 +12,6 @@ </parent> <dependencies> - <dependency> - <groupId>org.apache.derby</groupId> - <artifactId>derby</artifactId> - <version>${derby.version}</version> - </dependency> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> @@ -27,7 +20,6 @@ </dependencies> <properties> - <derby.version>10.13.1.1</derby.version> <mybatis.version>3.2.2</mybatis.version> </properties> diff --git a/netflix/README.md b/netflix/README.md new file mode 100644 index 0000000000..0af07d37a8 --- /dev/null +++ b/netflix/README.md @@ -0,0 +1,7 @@ +## Netflix + +This module contains articles about Netflix. + +### Relevant articles + +- [Introduction to Netflix Genie](https://github.com/eugenp/tutorials/tree/master/netflix/genie) diff --git a/netflix/genie/pom.xml b/netflix/genie/pom.xml new file mode 100644 index 0000000000..2288c5338a --- /dev/null +++ b/netflix/genie/pom.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>genie</artifactId> + <version>1.0.0-SNAPSHOT</version> + <name>Genie</name> + <packaging>jar</packaging> + <description>Sample project for Netflix Genie</description> + + <parent> + <groupId>com.baeldung</groupId> + <artifactId>netflix</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> + +</project> \ No newline at end of file diff --git a/netflix/genie/src/main/resources/com/baeldung/netflix/genie/docker/docker-compose.yml b/netflix/genie/src/main/resources/com/baeldung/netflix/genie/docker/docker-compose.yml new file mode 100644 index 0000000000..db7a76a014 --- /dev/null +++ b/netflix/genie/src/main/resources/com/baeldung/netflix/genie/docker/docker-compose.yml @@ -0,0 +1,42 @@ +version: "2" +services: + genie: + image: netflixoss/genie-app:3.3.9 + ports: + - "8080:8080" + depends_on: + - genie-hadoop-prod + - genie-hadoop-test + - genie-apache + tty: true + container_name: genie_demo_app_3.3.9 + genie-apache: + image: netflixoss/genie-demo-apache:3.3.9 + tty: true + container_name: genie_demo_apache_3.3.9 + genie-client: + image: netflixoss/genie-demo-client:3.3.9 + depends_on: + - genie + tty: true + container_name: genie_demo_client_3.3.9 + genie-hadoop-prod: + image: sequenceiq/hadoop-docker:2.7.1 + command: /bin/bash -c "/usr/local/hadoop/sbin/mr-jobhistory-daemon.sh start historyserver && /etc/bootstrap.sh -bash" + ports: + - "19888:19888" + - "19070:50070" + - "19075:50075" + - "8088:8088" + tty: true + container_name: genie_demo_hadoop_prod_3.3.9 + genie-hadoop-test: + image: sequenceiq/hadoop-docker:2.7.1 + command: /bin/bash -c "/usr/local/hadoop/sbin/mr-jobhistory-daemon.sh start historyserver && /etc/bootstrap.sh -bash" + ports: + - "19889:19888" + - "19071:50070" + - "19076:50075" + - "8089:8088" + tty: true + container_name: genie_demo_hadoop_test_3.3.9 diff --git a/netflix/genie/src/main/resources/com/baeldung/netflix/genie/docker/init_demo.py b/netflix/genie/src/main/resources/com/baeldung/netflix/genie/docker/init_demo.py new file mode 100644 index 0000000000..548b056fd8 --- /dev/null +++ b/netflix/genie/src/main/resources/com/baeldung/netflix/genie/docker/init_demo.py @@ -0,0 +1,122 @@ +#!/usr/bin/python2.7 + +# Copyright 2016 Netflix, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import logging + +import yaml +from pygenie.client import Genie +from pygenie.conf import GenieConf + +logging.basicConfig(level=logging.WARNING) + +LOGGER = logging.getLogger(__name__) + + +def load_yaml(yaml_file): + with open(yaml_file) as _file: + return yaml.load(_file) + + +genie_conf = GenieConf() +genie_conf.genie.url = "http://genie:8080" + +genie = Genie(genie_conf) + +hadoop_application = load_yaml("applications/hadoop271.yml") +hadoop_application_id = genie.create_application(hadoop_application) +LOGGER.warn("Created Hadoop 2.7.1 application with id = [%s]" % hadoop_application_id) + +spark_163_application = load_yaml("applications/spark163.yml") +spark_163_application_id = genie.create_application(spark_163_application) +LOGGER.warn("Created Spark 1.6.3 application with id = [%s]" % spark_163_application_id) + +spark_201_application = load_yaml("applications/spark201.yml") +spark_201_application_id = genie.create_application(spark_201_application) +LOGGER.warn("Created Spark 2.0.1 application with id = [%s]" % spark_201_application_id) + +hadoop_command = load_yaml("commands/hadoop271.yml") +hadoop_command_id = genie.create_command(hadoop_command) +LOGGER.warn("Created Hadoop command with id = [%s]" % hadoop_command_id) + +hdfs_command = load_yaml("commands/hdfs271.yml") +hdfs_command_id = genie.create_command(hdfs_command) +LOGGER.warn("Created HDFS command with id = [%s]" % hdfs_command_id) + +yarn_command = load_yaml("commands/yarn271.yml") +yarn_command_id = genie.create_command(yarn_command) +LOGGER.warn("Created Yarn command with id = [%s]" % yarn_command_id) + +spark_163_shell_command = load_yaml("commands/sparkShell163.yml") +spark_163_shell_command_id = genie.create_command(spark_163_shell_command) +LOGGER.warn("Created Spark 1.6.3 Shell command with id = [%s]" % spark_163_shell_command_id) + +spark_163_submit_command = load_yaml("commands/sparkSubmit163.yml") +spark_163_submit_command_id = genie.create_command(spark_163_submit_command) +LOGGER.warn("Created Spark 1.6.3 Submit command with id = [%s]" % spark_163_submit_command_id) + +spark_201_shell_command = load_yaml("commands/sparkShell201.yml") +spark_201_shell_command_id = genie.create_command(spark_201_shell_command) +LOGGER.warn("Created Spark 2.0.1 Shell command with id = [%s]" % spark_201_shell_command_id) + +spark_201_submit_command = load_yaml("commands/sparkSubmit201.yml") +spark_201_submit_command_id = genie.create_command(spark_201_submit_command) +LOGGER.warn("Created Spark 2.0.1 Submit command with id = [%s]" % spark_201_submit_command_id) + +genie.set_application_for_command(hadoop_command_id, [hadoop_application_id]) +LOGGER.warn("Set applications for Hadoop command to = [%s]" % hadoop_application_id) + +genie.set_application_for_command(hdfs_command_id, [hadoop_application_id]) +LOGGER.warn("Set applications for HDFS command to = [[%s]]" % hadoop_application_id) + +genie.set_application_for_command(yarn_command_id, [hadoop_application_id]) +LOGGER.warn("Set applications for Yarn command to = [[%s]]" % hadoop_application_id) + +genie.set_application_for_command(spark_163_shell_command_id, [hadoop_application_id, spark_163_application_id]) +LOGGER.warn("Set applications for Spark 1.6.3 Shell command to = [%s]" % + [hadoop_application_id, spark_163_application_id]) + +genie.set_application_for_command(spark_163_submit_command_id, [hadoop_application_id, spark_163_application_id]) +LOGGER.warn("Set applications for Spark 1.6.3 Submit command to = [%s]" % + [hadoop_application_id, spark_163_application_id]) + +genie.set_application_for_command(spark_201_shell_command_id, [hadoop_application_id, spark_201_application_id]) +LOGGER.warn("Set applications for Spark 2.0.1 Shell command to = [%s]" % + [hadoop_application_id, spark_201_application_id]) + +genie.set_application_for_command(spark_201_submit_command_id, [hadoop_application_id, spark_201_application_id]) +LOGGER.warn("Set applications for Spark 2.0.1 Submit command to = [%s]" % + [hadoop_application_id, spark_201_application_id]) + +prod_cluster = load_yaml("clusters/prod.yml") +prod_cluster_id = genie.create_cluster(prod_cluster) +LOGGER.warn("Created prod cluster with id = [%s]" % prod_cluster_id) + +test_cluster = load_yaml("clusters/test.yml") +test_cluster_id = genie.create_cluster(test_cluster) +LOGGER.warn("Created test cluster with id = [%s]" % test_cluster_id) + +genie.set_commands_for_cluster( + prod_cluster_id, + [hadoop_command_id, hdfs_command_id, yarn_command_id, spark_163_shell_command_id, spark_201_shell_command_id, + spark_163_submit_command_id, spark_201_submit_command_id] +) +LOGGER.warn("Added all commands to the prod cluster with id = [%s]" % prod_cluster_id) +genie.set_commands_for_cluster( + test_cluster_id, + [hadoop_command_id, hdfs_command_id, yarn_command_id, spark_163_shell_command_id, spark_201_shell_command_id, + spark_163_submit_command_id, spark_201_submit_command_id] +) +LOGGER.warn("Added all commands to the test cluster with id = [%s]" % test_cluster_id) \ No newline at end of file diff --git a/netflix/genie/src/main/resources/com/baeldung/netflix/genie/docker/run_spark_submit_job.py b/netflix/genie/src/main/resources/com/baeldung/netflix/genie/docker/run_spark_submit_job.py new file mode 100644 index 0000000000..67539a0908 --- /dev/null +++ b/netflix/genie/src/main/resources/com/baeldung/netflix/genie/docker/run_spark_submit_job.py @@ -0,0 +1,80 @@ +# Copyright 2016 Netflix, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +################################################################################## +# This script assumes setup.py has already been run to configure Genie and that +# this script is executed on the host where Genie is running. If it's executed on +# another host change the localhost line below. +################################################################################## + +from __future__ import absolute_import, division, print_function, unicode_literals + +import logging +import sys + +import pygenie + +logging.basicConfig(level=logging.ERROR) + +LOGGER = logging.getLogger(__name__) + +pygenie.conf.DEFAULT_GENIE_URL = "http://genie:8080" + +# Create a job instance and fill in the required parameters +job = pygenie.jobs.GenieJob() \ + .genie_username('root') \ + .job_version('3.0.0') + +# Set cluster criteria which determine the cluster to run the job on +job.cluster_tags(['sched:' + str(sys.argv[1]), 'type:yarn']) + +# Set command criteria which will determine what command Genie executes for the job +if len(sys.argv) == 2: + # Use the default spark + job.command_tags(['type:spark-submit']) + job.job_name('Genie Demo Spark Submit Job') +else: + # Use the spark version passed in + job.command_tags(['type:spark-submit', 'ver:' + str(sys.argv[2])]) + job.job_name('Genie Demo Spark ' + str(sys.argv[2]) + ' Submit Job') + +# Any command line arguments to run along with the command. In this case it holds +# the actual query but this could also be done via an attachment or file dependency. +# This jar location is where it is installed on the Genie node but could also pass +# the jar as attachment and use it locally +if len(sys.argv) == 2: + # Default is spark 1.6.3 + job.command_arguments( + "--class org.apache.spark.examples.SparkPi " + "${SPARK_HOME}/lib/spark-examples*.jar " + "10" + ) +else: + # Override with Spark 2.x location + job.command_arguments( + "--class org.apache.spark.examples.SparkPi " + "${SPARK_HOME}/examples/jars/spark-examples*.jar " + "10" + ) + +# Submit the job to Genie +running_job = job.execute() + +print('Job {} is {}'.format(running_job.job_id, running_job.status)) +print(running_job.job_link) + +# Block and wait until job is done +running_job.wait() + +print('Job {} finished with status {}'.format(running_job.job_id, running_job.status)) \ No newline at end of file diff --git a/netflix/pom.xml b/netflix/pom.xml new file mode 100644 index 0000000000..6cf81cd7ab --- /dev/null +++ b/netflix/pom.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>netflix</artifactId> + <version>1.0.0-SNAPSHOT</version> + <name>Netflix</name> + <packaging>pom</packaging> + <description>Module for Netflix projects</description> + + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> + + <modules> + <module>genie</module> + </modules> + +</project> \ No newline at end of file diff --git a/oauth2-framework-impl/oauth2-authorization-server/README.md b/oauth2-framework-impl/oauth2-authorization-server/README.md new file mode 100644 index 0000000000..4bcb9790b1 --- /dev/null +++ b/oauth2-framework-impl/oauth2-authorization-server/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Implementing The OAuth 2.0 Authorization Framework Using Jakarta EE](https://www.baeldung.com/java-ee-oauth2-implementation) diff --git a/oauth2-framework-impl/oauth2-authorization-server/pom.xml b/oauth2-framework-impl/oauth2-authorization-server/pom.xml index 8793eefe78..e608c09188 100644 --- a/oauth2-framework-impl/oauth2-authorization-server/pom.xml +++ b/oauth2-framework-impl/oauth2-authorization-server/pom.xml @@ -4,8 +4,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <artifactId>oauth2-authorization-server</artifactId> - <packaging>war</packaging> <name>oauth2-authorization-server</name> + <packaging>war</packaging> <parent> <groupId>com.baeldung.oauth2</groupId> @@ -30,6 +30,7 @@ <version>${bcpkix-jdk15on.version}</version> </dependency> </dependencies> + <build> <plugins> <plugin> @@ -72,4 +73,5 @@ <bcprov-jdk15on.version>1.62</bcprov-jdk15on.version> <bcpkix-jdk15on.version>1.62</bcpkix-jdk15on.version> </properties> + </project> diff --git a/oauth2-framework-impl/oauth2-client/README.md b/oauth2-framework-impl/oauth2-client/README.md new file mode 100644 index 0000000000..4bcb9790b1 --- /dev/null +++ b/oauth2-framework-impl/oauth2-client/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Implementing The OAuth 2.0 Authorization Framework Using Jakarta EE](https://www.baeldung.com/java-ee-oauth2-implementation) diff --git a/oauth2-framework-impl/oauth2-client/pom.xml b/oauth2-framework-impl/oauth2-client/pom.xml index 4f12095d30..febfe8dd27 100644 --- a/oauth2-framework-impl/oauth2-client/pom.xml +++ b/oauth2-framework-impl/oauth2-client/pom.xml @@ -4,8 +4,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <artifactId>oauth2-client</artifactId> - <packaging>war</packaging> <name>oauth2-client</name> + <packaging>war</packaging> <parent> <groupId>com.baeldung.oauth2</groupId> @@ -26,4 +26,5 @@ <httpPort>9180</httpPort> <httpsPort>9543</httpsPort> </properties> + </project> diff --git a/oauth2-framework-impl/oauth2-resource-server/README.md b/oauth2-framework-impl/oauth2-resource-server/README.md new file mode 100644 index 0000000000..4bcb9790b1 --- /dev/null +++ b/oauth2-framework-impl/oauth2-resource-server/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Implementing The OAuth 2.0 Authorization Framework Using Jakarta EE](https://www.baeldung.com/java-ee-oauth2-implementation) diff --git a/oauth2-framework-impl/oauth2-resource-server/pom.xml b/oauth2-framework-impl/oauth2-resource-server/pom.xml index 4c82668547..62f5889290 100644 --- a/oauth2-framework-impl/oauth2-resource-server/pom.xml +++ b/oauth2-framework-impl/oauth2-resource-server/pom.xml @@ -4,8 +4,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <artifactId>oauth2-resource-server</artifactId> - <packaging>war</packaging> <name>oauth2-resource-server</name> + <packaging>war</packaging> <parent> <groupId>com.baeldung.oauth2</groupId> diff --git a/oauth2-framework-impl/pom.xml b/oauth2-framework-impl/pom.xml index 3c98b45112..24559d3c4d 100644 --- a/oauth2-framework-impl/pom.xml +++ b/oauth2-framework-impl/pom.xml @@ -6,8 +6,8 @@ <groupId>com.baeldung.oauth2</groupId> <artifactId>oauth2-framework-impl</artifactId> <version>1.0-SNAPSHOT</version> - <packaging>pom</packaging> <name>oauth2-framework-impl</name> + <packaging>pom</packaging> <modules> <module>oauth2-authorization-server</module> @@ -94,4 +94,5 @@ <javaee-web-api.version>8.0</javaee-web-api.version> <microprofile-config-api.version>1.3</microprofile-config-api.version> </properties> + </project> diff --git a/optaplanner/pom.xml b/optaplanner/pom.xml index bcf7080a1e..d907cfc830 100644 --- a/optaplanner/pom.xml +++ b/optaplanner/pom.xml @@ -4,11 +4,11 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>optaplanner</artifactId> - <name>optaplanner</name> + <name>optaplanner</name> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> @@ -20,8 +20,8 @@ </dependency> </dependencies> - <properties> - <optaplanner-core.version>7.9.0.Final</optaplanner-core.version> - </properties> + <properties> + <optaplanner-core.version>7.9.0.Final</optaplanner-core.version> + </properties> </project> \ No newline at end of file diff --git a/orika/pom.xml b/orika/pom.xml index e4da5955bf..6974bd296e 100644 --- a/orika/pom.xml +++ b/orika/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>orika</artifactId> <version>1.0</version> <name>orika</name> diff --git a/osgi/osgi-intro-sample-activator/pom.xml b/osgi/osgi-intro-sample-activator/pom.xml index 2bc1c20eed..e6611dcf7d 100644 --- a/osgi/osgi-intro-sample-activator/pom.xml +++ b/osgi/osgi-intro-sample-activator/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>osgi-intro-sample-activator</artifactId> <name>osgi-intro-sample-activator</name> @@ -9,8 +9,8 @@ <!-- com.baeldung/osgi-intro-sample-activator/1.0-SNAPSHOT --> <parent> - <artifactId>osgi</artifactId> <groupId>com.baeldung</groupId> + <artifactId>osgi</artifactId> <version>1.0-SNAPSHOT</version> </parent> diff --git a/osgi/osgi-intro-sample-client/pom.xml b/osgi/osgi-intro-sample-client/pom.xml index a630625ed2..e91b831db1 100644 --- a/osgi/osgi-intro-sample-client/pom.xml +++ b/osgi/osgi-intro-sample-client/pom.xml @@ -9,8 +9,8 @@ <packaging>bundle</packaging> <parent> - <artifactId>osgi</artifactId> <groupId>com.baeldung</groupId> + <artifactId>osgi</artifactId> <version>1.0-SNAPSHOT</version> </parent> @@ -49,4 +49,5 @@ <properties> <osgi-intro-sample-service.version>1.0-SNAPSHOT</osgi-intro-sample-service.version> </properties> + </project> \ No newline at end of file diff --git a/osgi/osgi-intro-sample-service/pom.xml b/osgi/osgi-intro-sample-service/pom.xml index 4f0b108837..b44e1f9be3 100644 --- a/osgi/osgi-intro-sample-service/pom.xml +++ b/osgi/osgi-intro-sample-service/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>osgi-intro-sample-service</artifactId> <name>osgi-intro-sample-service</name> @@ -9,8 +9,8 @@ <!-- mvn:com.baeldung/osgi-intro-sample-service/1.0-SNAPSHOT --> <parent> - <artifactId>osgi</artifactId> <groupId>com.baeldung</groupId> + <artifactId>osgi</artifactId> <version>1.0-SNAPSHOT</version> </parent> diff --git a/osgi/pom.xml b/osgi/pom.xml index 9ebcb09091..ed708e8004 100644 --- a/osgi/pom.xml +++ b/osgi/pom.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>osgi</artifactId> - <packaging>pom</packaging> <version>1.0-SNAPSHOT</version> - <name>osgi</name> + <name>osgi</name> + <packaging>pom</packaging> <parent> <groupId>com.baeldung</groupId> diff --git a/parent-boot-1/pom.xml b/parent-boot-1/pom.xml index 8f1af24466..df2a7f8400 100644 --- a/parent-boot-1/pom.xml +++ b/parent-boot-1/pom.xml @@ -1,61 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <artifactId>parent-boot-1</artifactId> - <version>0.0.1-SNAPSHOT</version> - <name>parent-boot-1</name> - <packaging>pom</packaging> - <description>Parent for all Spring Boot 1.x modules</description> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>parent-boot-1</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>parent-boot-1</name> + <packaging>pom</packaging> + <description>Parent for all Spring Boot 1.x modules</description> - <parent> - <groupId>com.baeldung</groupId> - <artifactId>parent-modules</artifactId> - <version>1.0.0-SNAPSHOT</version> - </parent> + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-dependencies</artifactId> - <version>${spring-boot.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <dependencies> - <dependency> - <groupId>io.rest-assured</groupId> - <artifactId>rest-assured</artifactId> - <version>${rest-assured.version}</version> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> - </dependencies> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-dependencies</artifactId> + <version>${spring-boot.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> + <dependency> + <groupId>io.rest-assured</groupId> + <artifactId>rest-assured</artifactId> + <version>${rest-assured.version}</version> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + </dependencies> - <build> - <pluginManagement> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - <version>${spring-boot.version}</version> - <configuration> - <mainClass>${start-class}</mainClass> - <!-- this is necessary as we're not using the Boot parent --> - </configuration> - </plugin> - </plugins> - </pluginManagement> - </build> + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <version>${spring-boot.version}</version> + <configuration> + <mainClass>${start-class}</mainClass> + <!-- this is necessary as we're not using the Boot parent --> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + + <properties> + <rest-assured.version>3.1.0</rest-assured.version> + <spring-boot.version>1.5.22.RELEASE</spring-boot.version> + </properties> - <properties> - <rest-assured.version>3.1.0</rest-assured.version> - <spring-boot.version>1.5.22.RELEASE</spring-boot.version> - </properties> - </project> diff --git a/parent-boot-2/pom.xml b/parent-boot-2/pom.xml index fe272b56a3..881a0f1d67 100644 --- a/parent-boot-2/pom.xml +++ b/parent-boot-2/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -80,4 +81,5 @@ <thin.version>1.0.22.RELEASE</thin.version> <spring-boot.version>2.1.9.RELEASE</spring-boot.version> </properties> + </project> diff --git a/parent-java/pom.xml b/parent-java/pom.xml index fd3028680d..47965fc36d 100644 --- a/parent-java/pom.xml +++ b/parent-java/pom.xml @@ -1,16 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>parent-java</artifactId> <version>0.0.1-SNAPSHOT</version> <name>parent-java</name> - <description>Parent for all java modules</description> <packaging>pom</packaging> + <description>Parent for all java modules</description> <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> + <relativePath>../</relativePath> </parent> <dependencies> @@ -20,7 +22,7 @@ <artifactId>guava</artifactId> <version>${guava.version}</version> </dependency> - <dependency> + <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>${commons.io.version}</version> diff --git a/parent-kotlin/pom.xml b/parent-kotlin/pom.xml index 84844dbb8b..a180343378 100644 --- a/parent-kotlin/pom.xml +++ b/parent-kotlin/pom.xml @@ -1,219 +1,220 @@ <?xml version="1.0"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <modelVersion>4.0.0</modelVersion> - <artifactId>parent-kotlin</artifactId> - <name>parent-kotlin</name> - <packaging>pom</packaging> - <description>Parent for all kotlin modules</description> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + <artifactId>parent-kotlin</artifactId> + <name>parent-kotlin</name> + <packaging>pom</packaging> + <description>Parent for all kotlin modules</description> - <parent> - <groupId>com.baeldung</groupId> - <artifactId>parent-modules</artifactId> - <version>1.0.0-SNAPSHOT</version> - </parent> + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> - <repositories> - <repository> - <id>jcenter</id> - <url>http://jcenter.bintray.com</url> - </repository> - <repository> - <id>kotlin-ktor</id> - <url>https://dl.bintray.com/kotlin/ktor/</url> - </repository> - <repository> - <id>kotlin-eap</id> - <url>http://dl.bintray.com/kotlin/kotlin-eap</url> - </repository> - <repository> - <id>spring-milestone</id> - <name>Spring Milestone Repository</name> - <url>http://repo.spring.io/milestone</url> - </repository> - </repositories> + <repositories> + <repository> + <id>jcenter</id> + <url>http://jcenter.bintray.com</url> + </repository> + <repository> + <id>kotlin-ktor</id> + <url>https://dl.bintray.com/kotlin/ktor/</url> + </repository> + <repository> + <id>kotlin-eap</id> + <url>http://dl.bintray.com/kotlin/kotlin-eap</url> + </repository> + <repository> + <id>spring-milestone</id> + <name>Spring Milestone Repository</name> + <url>http://repo.spring.io/milestone</url> + </repository> + </repositories> - <pluginRepositories> - <pluginRepository> - <id>kotlin-eap</id> - <url>http://dl.bintray.com/kotlin/kotlin-eap</url> - </pluginRepository> - </pluginRepositories> + <pluginRepositories> + <pluginRepository> + <id>kotlin-eap</id> + <url>http://dl.bintray.com/kotlin/kotlin-eap</url> + </pluginRepository> + </pluginRepositories> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-dependencies</artifactId> - <version>2.2.0.M4</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-dependencies</artifactId> + <version>2.2.0.M4</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> - <dependencies> - <dependency> - <groupId>org.jetbrains.kotlin</groupId> - <artifactId>kotlin-stdlib-jdk8</artifactId> - </dependency> - <dependency> - <groupId>org.jetbrains.kotlin</groupId> - <artifactId>kotlin-stdlib</artifactId> - </dependency> - <dependency> - <groupId>org.jetbrains.kotlin</groupId> - <artifactId>kotlin-reflect</artifactId> - </dependency> + <dependencies> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-stdlib-jdk8</artifactId> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-stdlib</artifactId> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-reflect</artifactId> + </dependency> - <dependency> - <groupId>org.jetbrains.kotlinx</groupId> - <artifactId>kotlinx-coroutines-core</artifactId> - <version>${kotlinx.version}</version> - </dependency> + <dependency> + <groupId>org.jetbrains.kotlinx</groupId> + <artifactId>kotlinx-coroutines-core</artifactId> + <version>${kotlinx.version}</version> + </dependency> - <dependency> - <groupId>io.ktor</groupId> - <artifactId>ktor-server-netty</artifactId> - <version>${ktor.io.version}</version> - </dependency> - <dependency> - <groupId>io.ktor</groupId> - <artifactId>ktor-gson</artifactId> - <version>${ktor.io.version}</version> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.module</groupId> - <artifactId>jackson-module-kotlin</artifactId> - </dependency> + <dependency> + <groupId>io.ktor</groupId> + <artifactId>ktor-server-netty</artifactId> + <version>${ktor.io.version}</version> + </dependency> + <dependency> + <groupId>io.ktor</groupId> + <artifactId>ktor-gson</artifactId> + <version>${ktor.io.version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.module</groupId> + <artifactId>jackson-module-kotlin</artifactId> + </dependency> - <dependency> - <groupId>org.jetbrains.kotlin</groupId> - <artifactId>kotlin-test-junit</artifactId> - <scope>test</scope> - </dependency> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-test-junit</artifactId> + <scope>test</scope> + </dependency> - </dependencies> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.jetbrains.kotlin</groupId> - <artifactId>kotlin-maven-plugin</artifactId> - <version>${kotlin.version}</version> - <executions> - <execution> - <id>compile</id> - <goals> - <goal>compile</goal> - </goals> - <configuration> - <sourceDirs> - <sourceDir>${project.basedir}/src/main/kotlin</sourceDir> - <sourceDir>${project.basedir}/src/main/java</sourceDir> - </sourceDirs> - <jvmTarget>${java.version}</jvmTarget> - <args> - <arg>-Xjvm-default=enable</arg> - </args> - </configuration> - </execution> - <execution> - <id>test-compile</id> - <goals> - <goal>test-compile</goal> - </goals> - <configuration> - <sourceDirs> - <sourceDir>${project.basedir}/src/test/kotlin</sourceDir> - <sourceDir>${project.basedir}/src/test/java</sourceDir> - </sourceDirs> - <jvmTarget>${java.version}</jvmTarget> - </configuration> - </execution> - </executions> - <configuration> - <compilerPlugins> - <plugin>spring</plugin> - </compilerPlugins> - </configuration> - <dependencies> - <dependency> - <groupId>org.jetbrains.kotlin</groupId> - <artifactId>kotlin-maven-allopen</artifactId> - <version>${kotlin.version}</version> - </dependency> - </dependencies> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>${maven-compiler-plugin.version}</version> - <configuration> - <source>${java.version}</source> - <target>${java.version}</target> - </configuration> - <executions> - <!-- Replacing default-compile as it is treated specially by maven --> - <execution> - <id>default-compile</id> - <phase>none</phase> - </execution> - <!-- Replacing default-testCompile as it is treated specially by maven --> - <execution> - <id>default-testCompile</id> - <phase>none</phase> - </execution> - <execution> - <id>java-compile</id> - <phase>compile</phase> - <goals> - <goal>compile</goal> - </goals> - </execution> - <execution> - <id>java-test-compile</id> - <phase>test-compile</phase> - <goals> - <goal>testCompile</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-failsafe-plugin</artifactId> - <version>${maven-failsafe-plugin.version}</version> - <dependencies> - <dependency> - <groupId>org.junit.platform</groupId> - <artifactId>junit-platform-surefire-provider</artifactId> - <version>${junit.platform.version}</version> - </dependency> - </dependencies> - <executions> - <execution> - <id>junit5</id> - <goals> - <goal>integration-test</goal> - <goal>verify</goal> - </goals> - <configuration> - <includes> - <include>**/*Test5.java</include> - </includes> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-maven-plugin</artifactId> + <version>${kotlin.version}</version> + <executions> + <execution> + <id>compile</id> + <goals> + <goal>compile</goal> + </goals> + <configuration> + <sourceDirs> + <sourceDir>${project.basedir}/src/main/kotlin</sourceDir> + <sourceDir>${project.basedir}/src/main/java</sourceDir> + </sourceDirs> + <jvmTarget>${java.version}</jvmTarget> + <args> + <arg>-Xjvm-default=enable</arg> + </args> + </configuration> + </execution> + <execution> + <id>test-compile</id> + <goals> + <goal>test-compile</goal> + </goals> + <configuration> + <sourceDirs> + <sourceDir>${project.basedir}/src/test/kotlin</sourceDir> + <sourceDir>${project.basedir}/src/test/java</sourceDir> + </sourceDirs> + <jvmTarget>${java.version}</jvmTarget> + </configuration> + </execution> + </executions> + <configuration> + <compilerPlugins> + <plugin>spring</plugin> + </compilerPlugins> + </configuration> + <dependencies> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-maven-allopen</artifactId> + <version>${kotlin.version}</version> + </dependency> + </dependencies> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>${maven-compiler-plugin.version}</version> + <configuration> + <source>${java.version}</source> + <target>${java.version}</target> + </configuration> + <executions> + <!-- Replacing default-compile as it is treated specially by maven --> + <execution> + <id>default-compile</id> + <phase>none</phase> + </execution> + <!-- Replacing default-testCompile as it is treated specially by maven --> + <execution> + <id>default-testCompile</id> + <phase>none</phase> + </execution> + <execution> + <id>java-compile</id> + <phase>compile</phase> + <goals> + <goal>compile</goal> + </goals> + </execution> + <execution> + <id>java-test-compile</id> + <phase>test-compile</phase> + <goals> + <goal>testCompile</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-failsafe-plugin</artifactId> + <version>${maven-failsafe-plugin.version}</version> + <dependencies> + <dependency> + <groupId>org.junit.platform</groupId> + <artifactId>junit-platform-surefire-provider</artifactId> + <version>${junit.platform.version}</version> + </dependency> + </dependencies> + <executions> + <execution> + <id>junit5</id> + <goals> + <goal>integration-test</goal> + <goal>verify</goal> + </goals> + <configuration> + <includes> + <include>**/*Test5.java</include> + </includes> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <properties> + <kotlin.version>1.3.30</kotlin.version> + <kotlinx.version>1.0.0</kotlinx.version> + <ktor.io.version>0.9.5</ktor.io.version> + <assertj.version>3.12.0</assertj.version> + <junit.platform.version>1.3.2</junit.platform.version> + </properties> - <properties> - <kotlin.version>1.3.30</kotlin.version> - <kotlinx.version>1.0.0</kotlinx.version> - <ktor.io.version>0.9.5</ktor.io.version> - <assertj.version>3.12.0</assertj.version> - <junit.platform.version>1.3.2</junit.platform.version> - </properties> </project> diff --git a/parent-spring-4/pom.xml b/parent-spring-4/pom.xml index b98d962580..671ca7db6b 100644 --- a/parent-spring-4/pom.xml +++ b/parent-spring-4/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>parent-spring-4</artifactId> <version>0.0.1-SNAPSHOT</version> diff --git a/parent-spring-5/pom.xml b/parent-spring-5/pom.xml index f126006bcb..9260f88de5 100644 --- a/parent-spring-5/pom.xml +++ b/parent-spring-5/pom.xml @@ -1,12 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>parent-spring-5</artifactId> <version>0.0.1-SNAPSHOT</version> <name>parent-spring-5</name> - <description>Parent for all spring 5 core modules</description> <packaging>pom</packaging> + <description>Parent for all spring 5 core modules</description> <parent> <groupId>com.baeldung</groupId> diff --git a/patterns/design-patterns-architectural/pom.xml b/patterns/design-patterns-architectural/pom.xml index cf99919e7c..81cc55aa21 100644 --- a/patterns/design-patterns-architectural/pom.xml +++ b/patterns/design-patterns-architectural/pom.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>design-patterns-architectural</artifactId> <version>1.0</version> <name>design-patterns-architectural</name> - <packaging>jar</packaging> - + <packaging>jar</packaging> + <parent> <groupId>com.baeldung</groupId> <artifactId>patterns</artifactId> @@ -21,8 +21,8 @@ <version>${assertj-core.version}</version> <scope>test</scope> </dependency> - - <dependency> + + <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>${javaee.version}</version> @@ -39,16 +39,15 @@ <type>jar</type> </dependency> </dependencies> - + <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> - <assertj-core.version>3.9.1</assertj-core.version> - <javaee.version>8.0</javaee.version> <hibernate-core.version>5.2.16.Final</hibernate-core.version> <mysql-connector.version>6.0.6</mysql-connector.version> </properties> + </project> diff --git a/patterns/design-patterns-behavioral-2/pom.xml b/patterns/design-patterns-behavioral-2/pom.xml index 7e73c0ad19..4cbe6e32b9 100644 --- a/patterns/design-patterns-behavioral-2/pom.xml +++ b/patterns/design-patterns-behavioral-2/pom.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>design-patterns-behavioral-2</artifactId> <version>1.0</version> <name>design-patterns-behavioral-2</name> - <packaging>jar</packaging> - + <packaging>jar</packaging> + <parent> <groupId>com.baeldung</groupId> <artifactId>patterns</artifactId> @@ -22,12 +22,12 @@ <scope>test</scope> </dependency> </dependencies> - + <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> - <assertj.version>3.12.2</assertj.version> </properties> + </project> diff --git a/patterns/design-patterns-behavioral/pom.xml b/patterns/design-patterns-behavioral/pom.xml index d6603f94ec..c4ae00435e 100644 --- a/patterns/design-patterns-behavioral/pom.xml +++ b/patterns/design-patterns-behavioral/pom.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>design-patterns-behavioral</artifactId> <version>1.0</version> <name>design-patterns-behavioral</name> - <packaging>jar</packaging> - + <packaging>jar</packaging> + <parent> <groupId>com.baeldung</groupId> <artifactId>patterns</artifactId> @@ -31,7 +31,7 @@ <artifactId>commons-lang3</artifactId> <version>${commons-lang3.version}</version> </dependency> - + <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> @@ -39,13 +39,13 @@ <scope>test</scope> </dependency> </dependencies> - + <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> - <intellij.annotations.version>16.0.2</intellij.annotations.version> <assertj-core.version>3.9.1</assertj-core.version> </properties> + </project> diff --git a/patterns/design-patterns-cloud/pom.xml b/patterns/design-patterns-cloud/pom.xml index b5265a1f94..51f6a42f76 100644 --- a/patterns/design-patterns-cloud/pom.xml +++ b/patterns/design-patterns-cloud/pom.xml @@ -6,8 +6,8 @@ <groupId>com.baeldung</groupId> <artifactId>design-patterns-cloud</artifactId> <version>1.0.0-SNAPSHOT</version> - <packaging>pom</packaging> <name>design-patterns-cloud</name> + <packaging>pom</packaging> <dependencies> <dependency> diff --git a/patterns/design-patterns-creational/pom.xml b/patterns/design-patterns-creational/pom.xml index 351f69f749..aa20c1c085 100644 --- a/patterns/design-patterns-creational/pom.xml +++ b/patterns/design-patterns-creational/pom.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>design-patterns-creational</artifactId> <version>1.0</version> <name>design-patterns-creational</name> - <packaging>jar</packaging> - + <packaging>jar</packaging> + <parent> <groupId>com.baeldung</groupId> <artifactId>patterns</artifactId> @@ -26,7 +26,7 @@ <artifactId>jsr305</artifactId> <version>${javax.annotations.version}</version> </dependency> - + <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> @@ -34,14 +34,15 @@ <scope>test</scope> </dependency> </dependencies> - + <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> - + <freebuilder.version>2.4.1</freebuilder.version> <javax.annotations.version>3.0.2</javax.annotations.version> <assertj-core.version>3.9.1</assertj-core.version> </properties> + </project> diff --git a/patterns/design-patterns-creational/src/main/java/com/baeldung/prototype/PineTree.java b/patterns/design-patterns-creational/src/main/java/com/baeldung/prototype/PineTree.java new file mode 100644 index 0000000000..03f0ebfe7f --- /dev/null +++ b/patterns/design-patterns-creational/src/main/java/com/baeldung/prototype/PineTree.java @@ -0,0 +1,23 @@ +package com.baeldung.prototype; + +public class PineTree extends Tree { + + private String type; + + public PineTree(double mass, double height) { + super(mass, height); + this.type = "Pine"; + } + + public String getType() { + return type; + } + + @Override + public Tree copy() { + PineTree pineTreeClone = new PineTree(this.getMass(), this.getHeight()); + pineTreeClone.setPosition(this.getPosition()); + return pineTreeClone; + } + +} diff --git a/patterns/design-patterns-creational/src/main/java/com/baeldung/prototype/PlasticTree.java b/patterns/design-patterns-creational/src/main/java/com/baeldung/prototype/PlasticTree.java new file mode 100644 index 0000000000..aea805dd47 --- /dev/null +++ b/patterns/design-patterns-creational/src/main/java/com/baeldung/prototype/PlasticTree.java @@ -0,0 +1,23 @@ +package com.baeldung.prototype; + +public class PlasticTree extends Tree { + + private String name; + + public PlasticTree(double mass, double height) { + super(mass, height); + this.name = "PlasticTree"; + } + + public String getName() { + return name; + } + + @Override + public Tree copy() { + PlasticTree plasticTreeClone = new PlasticTree(this.getMass(), this.getHeight()); + plasticTreeClone.setPosition(this.getPosition()); + return plasticTreeClone; + } + +} diff --git a/patterns/design-patterns-creational/src/main/java/com/baeldung/prototype/Tree.java b/patterns/design-patterns-creational/src/main/java/com/baeldung/prototype/Tree.java index f95d568647..dffb573057 100644 --- a/patterns/design-patterns-creational/src/main/java/com/baeldung/prototype/Tree.java +++ b/patterns/design-patterns-creational/src/main/java/com/baeldung/prototype/Tree.java @@ -1,6 +1,6 @@ package com.baeldung.prototype; -public class Tree implements Cloneable { +public abstract class Tree { private double mass; private double height; @@ -35,20 +35,10 @@ public class Tree implements Cloneable { return position; } - @Override - public Tree clone() { - Tree tree = null; - try { - tree = (Tree) super.clone(); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - } - return tree; - } - @Override public String toString() { return "Tree [mass=" + mass + ", height=" + height + ", position=" + position + "]"; } + public abstract Tree copy(); } diff --git a/patterns/design-patterns-creational/src/test/java/com/baeldung/prototype/TreePrototypeUnitTest.java b/patterns/design-patterns-creational/src/test/java/com/baeldung/prototype/TreePrototypeUnitTest.java index 0d06da53d6..1fb1fbfea6 100644 --- a/patterns/design-patterns-creational/src/test/java/com/baeldung/prototype/TreePrototypeUnitTest.java +++ b/patterns/design-patterns-creational/src/test/java/com/baeldung/prototype/TreePrototypeUnitTest.java @@ -2,23 +2,67 @@ package com.baeldung.prototype; import static org.junit.jupiter.api.Assertions.assertEquals; +import java.util.Arrays; +import java.util.List; +import static java.util.stream.Collectors.toList; + import org.junit.jupiter.api.Test; public class TreePrototypeUnitTest { @Test - public void givenATreePrototypeWhenClonedThenCreateA_Clone() { + public void givenAPlasticTreePrototypeWhenClonedThenCreateA_Clone() { double mass = 10.0; double height = 3.7; Position position = new Position(3, 7); Position otherPosition = new Position(4, 8); - Tree tree = new Tree(mass, height); - tree.setPosition(position); - Tree anotherTree = tree.clone(); - anotherTree.setPosition(otherPosition); + PlasticTree plasticTree = new PlasticTree(mass, height); + plasticTree.setPosition(position); + PlasticTree anotherPlasticTree = (PlasticTree) plasticTree.copy(); + anotherPlasticTree.setPosition(otherPosition); - assertEquals(position, tree.getPosition()); - assertEquals(otherPosition, anotherTree.getPosition()); + assertEquals(position, plasticTree.getPosition()); + assertEquals(otherPosition, anotherPlasticTree.getPosition()); + + } + + @Test + public void givenAPineTreePrototypeWhenClonedThenCreateA_Clone() { + double mass = 10.0; + double height = 3.7; + Position position = new Position(3, 7); + Position otherPosition = new Position(4, 8); + + PineTree pineTree = new PineTree(mass, height); + pineTree.setPosition(position); + PineTree anotherPineTree = (PineTree) pineTree.copy(); + anotherPineTree.setPosition(otherPosition); + + assertEquals(position, pineTree.getPosition()); + assertEquals(otherPosition, anotherPineTree.getPosition()); + } + + @Test + public void givenA_ListOfTreesWhenClonedThenCreateListOfClones() { + double mass = 10.0; + double height = 3.7; + Position position = new Position(3, 7); + Position otherPosition = new Position(4, 8); + + PlasticTree plasticTree = new PlasticTree(mass, height); + plasticTree.setPosition(position); + PineTree pineTree = new PineTree(mass, height); + pineTree.setPosition(otherPosition); + + List<Tree> trees = Arrays.asList(plasticTree, pineTree); + + List<Tree> treeClones = trees.stream().map(Tree::copy).collect(toList()); + + Tree plasticTreeClone = treeClones.get(0); + + assertEquals(mass, plasticTreeClone.getMass()); + assertEquals(height, plasticTreeClone.getHeight()); + assertEquals(position, plasticTreeClone.getPosition()); } } diff --git a/patterns/design-patterns-functional/pom.xml b/patterns/design-patterns-functional/pom.xml index 5df7cc0cb9..ec37ad1e8d 100644 --- a/patterns/design-patterns-functional/pom.xml +++ b/patterns/design-patterns-functional/pom.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>design-patterns-functional</artifactId> <version>1.0</version> <name>design-patterns-functional</name> - <packaging>jar</packaging> - + <packaging>jar</packaging> + <parent> <groupId>com.baeldung</groupId> <artifactId>patterns</artifactId> @@ -14,12 +14,10 @@ <relativePath>..</relativePath> </parent> - <dependencies> - </dependencies> - <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> </properties> + </project> diff --git a/patterns/design-patterns-structural/README.md b/patterns/design-patterns-structural/README.md index 91620a522e..3478b89c42 100644 --- a/patterns/design-patterns-structural/README.md +++ b/patterns/design-patterns-structural/README.md @@ -5,3 +5,4 @@ - [The Decorator Pattern in Java](https://www.baeldung.com/java-decorator-pattern) - [The Adapter Pattern in Java](https://www.baeldung.com/java-adapter-pattern) - [The Proxy Pattern in Java](https://www.baeldung.com/java-proxy-pattern) +- [The Bridge Pattern in Java](https://www.baeldung.com/java-bridge-pattern) diff --git a/patterns/design-patterns-structural/pom.xml b/patterns/design-patterns-structural/pom.xml index 63806058c9..97e0b9b38b 100644 --- a/patterns/design-patterns-structural/pom.xml +++ b/patterns/design-patterns-structural/pom.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>design-patterns-structural</artifactId> <version>1.0</version> <name>design-patterns-structural</name> - <packaging>jar</packaging> - + <packaging>jar</packaging> + <parent> <groupId>com.baeldung</groupId> <artifactId>patterns</artifactId> @@ -21,10 +21,11 @@ <version>${log4j.version}</version> </dependency> </dependencies> - + <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> </properties> + </project> diff --git a/patterns/dip/pom.xml b/patterns/dip/pom.xml index bc793c0090..37c980f2e3 100644 --- a/patterns/dip/pom.xml +++ b/patterns/dip/pom.xml @@ -5,8 +5,8 @@ <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.dip</groupId> <artifactId>dip</artifactId> - <name>dip</name> <version>1.0-SNAPSHOT</version> + <name>dip</name> <parent> <groupId>com.baeldung</groupId> @@ -29,7 +29,7 @@ <scope>test</scope> </dependency> </dependencies> - + <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>11</maven.compiler.source> diff --git a/patterns/front-controller/pom.xml b/patterns/front-controller/pom.xml index bb003dd00a..1de3b82fcd 100644 --- a/patterns/front-controller/pom.xml +++ b/patterns/front-controller/pom.xml @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>front-controller</artifactId> - <name>front-controller</name> + <name>front-controller</name> <packaging>war</packaging> <parent> - <artifactId>patterns</artifactId> <groupId>com.baeldung</groupId> + <artifactId>patterns</artifactId> <version>1.0.0-SNAPSHOT</version> <relativePath>..</relativePath> </parent> @@ -37,4 +37,5 @@ </plugin> </plugins> </build> + </project> diff --git a/patterns/intercepting-filter/pom.xml b/patterns/intercepting-filter/pom.xml index 33589dc242..435c1e13cf 100644 --- a/patterns/intercepting-filter/pom.xml +++ b/patterns/intercepting-filter/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>intercepting-filter</artifactId> - <name>intercepting-filter</name> + <name>intercepting-filter</name> <packaging>war</packaging> <parent> diff --git a/patterns/pom.xml b/patterns/pom.xml index 331415bf5b..8a510769a9 100644 --- a/patterns/pom.xml +++ b/patterns/pom.xml @@ -3,8 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>patterns</artifactId> - <packaging>pom</packaging> <name>patterns</name> + <packaging>pom</packaging> <parent> <groupId>com.baeldung</groupId> diff --git a/patterns/solid/pom.xml b/patterns/solid/pom.xml index faf8bdc8d9..1b0e35339d 100644 --- a/patterns/solid/pom.xml +++ b/patterns/solid/pom.xml @@ -3,10 +3,9 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>solid</artifactId> - <name>solid</name> <version>1.0-SNAPSHOT</version> + <name>solid</name> <parent> <groupId>com.baeldung</groupId> diff --git a/pdf/pom.xml b/pdf/pom.xml index bf5d475163..d148aa1670 100644 --- a/pdf/pom.xml +++ b/pdf/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <artifactId>pdf</artifactId> <name>pdf</name> diff --git a/performance-tests/pom.xml b/performance-tests/pom.xml index 4dc480ef86..94588c99d4 100644 --- a/performance-tests/pom.xml +++ b/performance-tests/pom.xml @@ -1,15 +1,14 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>performance-tests</artifactId> <version>1.0</version> - <packaging>jar</packaging> <name>performance-tests</name> + <packaging>jar</packaging> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> diff --git a/persistence-modules/activejdbc/pom.xml b/persistence-modules/activejdbc/pom.xml index 45a618b840..47643cd639 100644 --- a/persistence-modules/activejdbc/pom.xml +++ b/persistence-modules/activejdbc/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>activejdbc</artifactId> <version>1.0-SNAPSHOT</version> @@ -8,8 +9,8 @@ <url>http://maven.apache.org</url> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> <relativePath>../../</relativePath> </parent> diff --git a/persistence-modules/apache-cayenne/pom.xml b/persistence-modules/apache-cayenne/pom.xml index 776b2b5233..7c94c5ba39 100644 --- a/persistence-modules/apache-cayenne/pom.xml +++ b/persistence-modules/apache-cayenne/pom.xml @@ -27,7 +27,6 @@ <version>${mysql.connector.version}</version> <scope>runtime</scope> </dependency> - </dependencies> <build> diff --git a/persistence-modules/core-java-persistence/pom.xml b/persistence-modules/core-java-persistence/pom.xml index 2760489ce1..80c4053743 100644 --- a/persistence-modules/core-java-persistence/pom.xml +++ b/persistence-modules/core-java-persistence/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> diff --git a/persistence-modules/deltaspike/pom.xml b/persistence-modules/deltaspike/pom.xml index 46e774edff..141412654f 100644 --- a/persistence-modules/deltaspike/pom.xml +++ b/persistence-modules/deltaspike/pom.xml @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>deltaspike</artifactId> <version>1.0</version> <name>deltaspike</name> diff --git a/persistence-modules/elasticsearch/pom.xml b/persistence-modules/elasticsearch/pom.xml index 943cfa6a23..878dd5847b 100644 --- a/persistence-modules/elasticsearch/pom.xml +++ b/persistence-modules/elasticsearch/pom.xml @@ -2,7 +2,6 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>elasticsearch</artifactId> <version>0.0.1-SNAPSHOT</version> <name>elasticsearch</name> @@ -31,4 +30,5 @@ <properties> <jest.version>6.3.1</jest.version> </properties> + </project> diff --git a/persistence-modules/flyway/pom.xml b/persistence-modules/flyway/pom.xml index 99549ee3fc..01b3dab6ee 100644 --- a/persistence-modules/flyway/pom.xml +++ b/persistence-modules/flyway/pom.xml @@ -8,8 +8,8 @@ <description>Flyway Callbacks Demo</description> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-1</relativePath> </parent> diff --git a/persistence-modules/flyway/src/main/java/com/baeldung/flywaycallbacks/EmptyMigrationStrategyConfig.java b/persistence-modules/flyway/src/main/java/com/baeldung/flywaycallbacks/EmptyMigrationStrategyConfig.java new file mode 100644 index 0000000000..8f733364b7 --- /dev/null +++ b/persistence-modules/flyway/src/main/java/com/baeldung/flywaycallbacks/EmptyMigrationStrategyConfig.java @@ -0,0 +1,20 @@ +package com.baeldung.flywaycallbacks; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.boot.autoconfigure.flyway.FlywayMigrationStrategy; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class EmptyMigrationStrategyConfig { + + private Log log = LogFactory.getLog("EmptyMigrationStrategy"); + + @Bean + public FlywayMigrationStrategy flywayMigrationStrategy() { + return flyway -> { + log.info("Skipping Flyway migration!"); + }; + } +} diff --git a/persistence-modules/flyway/src/main/resources/application.properties b/persistence-modules/flyway/src/main/resources/application.properties index e69de29bb2..4d339eca5c 100644 --- a/persistence-modules/flyway/src/main/resources/application.properties +++ b/persistence-modules/flyway/src/main/resources/application.properties @@ -0,0 +1 @@ +#flyway.enabled=false \ No newline at end of file diff --git a/persistence-modules/flyway/src/test/java/com/baeldung/flywaycallbacks/ManualFlywayMigrationIntegrationTest.java b/persistence-modules/flyway/src/test/java/com/baeldung/flywaycallbacks/ManualFlywayMigrationIntegrationTest.java new file mode 100644 index 0000000000..12edec39e7 --- /dev/null +++ b/persistence-modules/flyway/src/test/java/com/baeldung/flywaycallbacks/ManualFlywayMigrationIntegrationTest.java @@ -0,0 +1,36 @@ +package com.baeldung.flywaycallbacks; + +import org.flywaydb.core.Flyway; +import org.flywaydb.core.api.MigrationInfo; +import org.flywaydb.core.api.MigrationState; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import static org.assertj.core.api.Assertions.assertThat; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class ManualFlywayMigrationIntegrationTest { + + @Autowired + private Flyway flyway; + + @Test + public void skipAutomaticAndTriggerManualFlywayMigration() { + + assertAllMigrationsAre(MigrationState.PENDING); + + flyway.migrate(); + + assertAllMigrationsAre(MigrationState.SUCCESS); + } + + private void assertAllMigrationsAre(MigrationState expectedState) { + for (MigrationInfo migrationInfo : flyway.info().all()) { + assertThat(migrationInfo.getState()).isEqualTo(expectedState); + } + } +} diff --git a/persistence-modules/hbase/pom.xml b/persistence-modules/hbase/pom.xml index daf0db5291..9403239fb2 100644 --- a/persistence-modules/hbase/pom.xml +++ b/persistence-modules/hbase/pom.xml @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>hbase</artifactId> - <name>hbase</name> + <name>hbase</name> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> <relativePath>../../</relativePath> </parent> diff --git a/persistence-modules/hibernate-mapping/pom.xml b/persistence-modules/hibernate-mapping/pom.xml index 98c946a6e9..a0a2a047e3 100644 --- a/persistence-modules/hibernate-mapping/pom.xml +++ b/persistence-modules/hibernate-mapping/pom.xml @@ -2,9 +2,9 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> <artifactId>hibernate-mapping</artifactId> <version>1.0.0-SNAPSHOT</version> - <modelVersion>4.0.0</modelVersion> <name>hibernate-mapping</name> <parent> diff --git a/persistence-modules/hibernate5-2/src/main/java/com/baeldung/fetchMode/Customer.java b/persistence-modules/hibernate-mapping/src/main/java/com/baeldung/hibernate/fetchMode/Customer.java similarity index 100% rename from persistence-modules/hibernate5-2/src/main/java/com/baeldung/fetchMode/Customer.java rename to persistence-modules/hibernate-mapping/src/main/java/com/baeldung/hibernate/fetchMode/Customer.java diff --git a/persistence-modules/hibernate5-2/src/main/java/com/baeldung/fetchMode/Order.java b/persistence-modules/hibernate-mapping/src/main/java/com/baeldung/hibernate/fetchMode/Order.java similarity index 100% rename from persistence-modules/hibernate5-2/src/main/java/com/baeldung/fetchMode/Order.java rename to persistence-modules/hibernate-mapping/src/main/java/com/baeldung/hibernate/fetchMode/Order.java diff --git a/persistence-modules/hibernate-ogm/pom.xml b/persistence-modules/hibernate-ogm/pom.xml index 7ac29b1720..bb15881788 100644 --- a/persistence-modules/hibernate-ogm/pom.xml +++ b/persistence-modules/hibernate-ogm/pom.xml @@ -1,11 +1,10 @@ <?xml version="1.0"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>hibernate-ogm</artifactId> <version>0.0.1-SNAPSHOT</version> - <name>hibernate-ogm</name> + <name>hibernate-ogm</name> <parent> <groupId>com.baeldung</groupId> @@ -15,37 +14,37 @@ </parent> <dependencies> - <!-- MongoDB --> - <dependency> - <groupId>org.hibernate.ogm</groupId> - <artifactId>hibernate-ogm-mongodb</artifactId> - <version>${hibernate.version}</version> - </dependency> - <!-- Neo4j --> - <dependency> - <groupId>org.hibernate.ogm</groupId> - <artifactId>hibernate-ogm-neo4j</artifactId> - <version>${hibernate.version}</version> - </dependency> - <!-- Narayana JTA --> - <dependency> - <groupId>org.jboss.narayana.jta</groupId> - <artifactId>narayana-jta</artifactId> - <version>${narayana-jta.version}</version> - </dependency> - <!-- Testing --> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>${junit.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.easytesting</groupId> - <artifactId>fest-assert</artifactId> - <version>${fest-assert.version}</version> - <scope>test</scope> - </dependency> + <!-- MongoDB --> + <dependency> + <groupId>org.hibernate.ogm</groupId> + <artifactId>hibernate-ogm-mongodb</artifactId> + <version>${hibernate.version}</version> + </dependency> + <!-- Neo4j --> + <dependency> + <groupId>org.hibernate.ogm</groupId> + <artifactId>hibernate-ogm-neo4j</artifactId> + <version>${hibernate.version}</version> + </dependency> + <!-- Narayana JTA --> + <dependency> + <groupId>org.jboss.narayana.jta</groupId> + <artifactId>narayana-jta</artifactId> + <version>${narayana-jta.version}</version> + </dependency> + <!-- Testing --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>${junit.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.easytesting</groupId> + <artifactId>fest-assert</artifactId> + <version>${fest-assert.version}</version> + <scope>test</scope> + </dependency> </dependencies> <build> @@ -63,4 +62,5 @@ <fest-assert.version>1.4</fest-assert.version> <narayana-jta.version>5.5.23.Final</narayana-jta.version> </properties> + </project> \ No newline at end of file diff --git a/persistence-modules/hibernate5-2/README.md b/persistence-modules/hibernate5-2/README.md index c61552f305..0b6be27410 100644 --- a/persistence-modules/hibernate5-2/README.md +++ b/persistence-modules/hibernate5-2/README.md @@ -1,3 +1,8 @@ +## Hibernate 5 + +This module contains articles about Hibernate 5. + ### Relevant Articles: - [Hibernate Error “Not all named parameters have been set”](https://www.baeldung.com/hibernate-error-named-parameters-not-set) - +- [FetchMode in Spring Data JPA](https://www.baeldung.com/spring-data-jpa-fetchmode) +- [[<-- Prev]](/hibernate5) \ No newline at end of file diff --git a/persistence-modules/hibernate5-2/pom.xml b/persistence-modules/hibernate5-2/pom.xml index ef091c331e..dfee4bb81e 100644 --- a/persistence-modules/hibernate5-2/pom.xml +++ b/persistence-modules/hibernate5-2/pom.xml @@ -2,7 +2,6 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>hibernate5-2</artifactId> <version>0.1-SNAPSHOT</version> <name>hibernate5-2</name> @@ -22,16 +21,49 @@ <artifactId>hibernate-core</artifactId> <version>5.4.7.Final</version> </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + <version>${spring-boot.version}</version> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-thymeleaf</artifactId> + <version>${spring-boot.version}</version> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-jpa</artifactId> + <version>${spring-boot.version}</version> + <exclusions> + <exclusion> + <groupId>com.zaxxer</groupId> + <artifactId>HikariCP</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <version>${spring-boot.version}</version> + </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <version>1.4.200</version> </dependency> + + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>3.8.1</version> + </dependency> </dependencies> <properties> <maven.deploy.skip>true</maven.deploy.skip> + <spring-boot.version>2.1.7.RELEASE</spring-boot.version> </properties> </project> diff --git a/persistence-modules/hibernate5-2/src/main/java/com/baeldung/hibernate/logging/Employee.java b/persistence-modules/hibernate5-2/src/main/java/com/baeldung/hibernate/logging/Employee.java new file mode 100644 index 0000000000..9dcf4058a7 --- /dev/null +++ b/persistence-modules/hibernate5-2/src/main/java/com/baeldung/hibernate/logging/Employee.java @@ -0,0 +1,59 @@ +package com.baeldung.hibernate.logging; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +@Entity +public class Employee { + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE) + private long id; + + private String employeeNumber; + + private String title; + + private String name; + + public Employee() { + } + + public Employee(String name, String employeeNumber) { + this.name = name; + this.employeeNumber = employeeNumber; + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getEmployeeNumber() { + return employeeNumber; + } + + public void setEmployeeNumber(String employeeNumber) { + this.employeeNumber = employeeNumber; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } +} diff --git a/persistence-modules/hibernate5-2/src/main/java/com/baeldung/persistencecontext/PersistenceContextDemoApplication.java b/persistence-modules/hibernate5-2/src/main/java/com/baeldung/persistencecontext/PersistenceContextDemoApplication.java new file mode 100644 index 0000000000..17fa582e10 --- /dev/null +++ b/persistence-modules/hibernate5-2/src/main/java/com/baeldung/persistencecontext/PersistenceContextDemoApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.persistencecontext; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; + +@SpringBootApplication +@ComponentScan(basePackages="com.baeldung.persistencecontext") +public class PersistenceContextDemoApplication { + public static void main(String[] args) { + SpringApplication.run(PersistenceContextDemoApplication.class, args); + } +} diff --git a/persistence-modules/hibernate5-2/src/main/java/com/baeldung/persistencecontext/entity/User.java b/persistence-modules/hibernate5-2/src/main/java/com/baeldung/persistencecontext/entity/User.java new file mode 100644 index 0000000000..7252ac46f5 --- /dev/null +++ b/persistence-modules/hibernate5-2/src/main/java/com/baeldung/persistencecontext/entity/User.java @@ -0,0 +1,36 @@ +package com.baeldung.persistencecontext.entity; + +import javax.persistence.Entity; +import javax.persistence.Id; + +@Entity +public class User { + + @Id + private Long id; + private String name; + private String role; + + public User() { + + } + + public User(Long id, String name, String role) { + this.id = id; + this.name = name; + this.role = role; + } + + public Long getId() { + return id; + } + + public String getName() { + return name; + } + + public String getRole() { + return role; + } + +} diff --git a/persistence-modules/hibernate5-2/src/main/java/com/baeldung/persistencecontext/service/ExtendedPersistenceContextUserService.java b/persistence-modules/hibernate5-2/src/main/java/com/baeldung/persistencecontext/service/ExtendedPersistenceContextUserService.java new file mode 100644 index 0000000000..ef25aac69f --- /dev/null +++ b/persistence-modules/hibernate5-2/src/main/java/com/baeldung/persistencecontext/service/ExtendedPersistenceContextUserService.java @@ -0,0 +1,33 @@ +package com.baeldung.persistencecontext.service; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.PersistenceContextType; +import javax.transaction.Transactional; + +import org.springframework.stereotype.Component; + +import com.baeldung.persistencecontext.entity.User; + +@Component +public class ExtendedPersistenceContextUserService { + + @PersistenceContext(type = PersistenceContextType.EXTENDED) + private EntityManager entityManager; + + @Transactional + public User insertWithTransaction(User user) { + entityManager.persist(user); + return user; + } + + public User insertWithoutTransaction(User user) { + entityManager.persist(user); + return user; + } + + public User find(long id) { + User user = entityManager.find(User.class, id); + return user; + } +} diff --git a/persistence-modules/hibernate5-2/src/main/java/com/baeldung/persistencecontext/service/TransctionPersistenceContextUserService.java b/persistence-modules/hibernate5-2/src/main/java/com/baeldung/persistencecontext/service/TransctionPersistenceContextUserService.java new file mode 100644 index 0000000000..481defcf08 --- /dev/null +++ b/persistence-modules/hibernate5-2/src/main/java/com/baeldung/persistencecontext/service/TransctionPersistenceContextUserService.java @@ -0,0 +1,32 @@ +package com.baeldung.persistencecontext.service; + + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.transaction.Transactional; + +import org.springframework.stereotype.Component; + +import com.baeldung.persistencecontext.entity.User; + +@Component +public class TransctionPersistenceContextUserService { + + @PersistenceContext + private EntityManager entityManager; + + @Transactional + public User insertWithTransaction(User user) { + entityManager.persist(user); + return user; + } + + public User insertWithoutTransaction(User user) { + entityManager.persist(user); + return user; + } + + public User find(long id) { + return entityManager.find(User.class, id); + } +} diff --git a/persistence-modules/hibernate5-2/src/main/resources/hibernate-logging.cfg.xml b/persistence-modules/hibernate5-2/src/main/resources/hibernate-logging.cfg.xml new file mode 100644 index 0000000000..52ef1ee685 --- /dev/null +++ b/persistence-modules/hibernate5-2/src/main/resources/hibernate-logging.cfg.xml @@ -0,0 +1,27 @@ +<?xml version='1.0' encoding='utf-8'?> +<!DOCTYPE hibernate-configuration PUBLIC + "-//Hibernate/Hibernate Configuration DTD 3.0//EN" + "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> + +<hibernate-configuration> + + <session-factory> + <property name="connection.driver_class">org.h2.Driver</property> + <property name="connection.url">jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1</property> + <property name="connection.username">sa</property> + <property name="connection.password"/> + + <property name="connection.pool_size">1</property> + + <property name="dialect">org.hibernate.dialect.H2Dialect</property> + + <property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property> + + <property name="hibernate.generate_statistics">true</property> + + <property name="hbm2ddl.auto">create</property> + + <mapping class="com.baeldung.hibernate.logging.Employee"/> + </session-factory> + +</hibernate-configuration> \ No newline at end of file diff --git a/persistence-modules/hibernate5-2/src/test/java/com/baeldung/hibernatelogging/HibernateLoggingIntegrationTest.java b/persistence-modules/hibernate5-2/src/test/java/com/baeldung/hibernatelogging/HibernateLoggingIntegrationTest.java new file mode 100644 index 0000000000..8ec722671d --- /dev/null +++ b/persistence-modules/hibernate5-2/src/test/java/com/baeldung/hibernatelogging/HibernateLoggingIntegrationTest.java @@ -0,0 +1,50 @@ +package com.baeldung.hibernatelogging; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; + +import java.io.IOException; +import java.util.List; + +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.boot.MetadataSources; +import org.hibernate.boot.registry.StandardServiceRegistry; +import org.hibernate.boot.registry.StandardServiceRegistryBuilder; +import org.hibernate.query.Query; +import org.junit.Before; +import org.junit.Test; + +import com.baeldung.hibernate.logging.Employee; + +public class HibernateLoggingIntegrationTest { + + private SessionFactory sessionFactory; + + @Before + public void setUp() throws IOException { + final StandardServiceRegistry registry = new StandardServiceRegistryBuilder().configure("hibernate-logging.cfg.xml") + .build(); + try { + sessionFactory = new MetadataSources(registry).buildMetadata() + .buildSessionFactory(); + Session session = sessionFactory.openSession(); + session.beginTransaction(); + session.save(new Employee("John Smith", "001")); + session.getTransaction() + .commit(); + session.close(); + } catch (Exception e) { + fail(e); + StandardServiceRegistryBuilder.destroy(registry); + } + } + + @Test + public void whenAllEmployeesAreSelected_ThenSuccess() { + Query<Employee> query = sessionFactory.openSession().createQuery("from com.baeldung.hibernate.logging.Employee", Employee.class); + List<Employee> deptEmployees = query.list(); + Employee deptEmployee = deptEmployees.get(0); + assertEquals("John Smith", deptEmployee.getName()); + } +} diff --git a/persistence-modules/hibernate5-2/src/test/java/com/baeldung/persistencecontext/PersistenceContextIntegrationTest.java b/persistence-modules/hibernate5-2/src/test/java/com/baeldung/persistencecontext/PersistenceContextIntegrationTest.java new file mode 100644 index 0000000000..b299dd5834 --- /dev/null +++ b/persistence-modules/hibernate5-2/src/test/java/com/baeldung/persistencecontext/PersistenceContextIntegrationTest.java @@ -0,0 +1,90 @@ +package com.baeldung.persistencecontext; + +import com.baeldung.persistencecontext.entity.User; +import com.baeldung.persistencecontext.service.ExtendedPersistenceContextUserService; +import com.baeldung.persistencecontext.service.TransctionPersistenceContextUserService; + +import javax.persistence.EntityExistsException; +import javax.persistence.TransactionRequiredException; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = com.baeldung.persistencecontext.PersistenceContextDemoApplication.class) +public class PersistenceContextIntegrationTest { + + @Autowired + private TransctionPersistenceContextUserService transctionPersistenceContext; + @Autowired + private ExtendedPersistenceContextUserService extendedPersistenceContext; + + @Test + public void testThatWhenUserSavedWithTransctionPersistenceContextThenUserShouldGetSavedInDB() { + User user = new User(121L, "Devender", "admin"); + transctionPersistenceContext.insertWithTransaction(user); + + User userFromTransctionPersistenceContext = transctionPersistenceContext.find(user.getId()); + assertNotNull(userFromTransctionPersistenceContext); + + User userFromExtendedPersistenceContext = extendedPersistenceContext.find(user.getId()); + assertNotNull(userFromExtendedPersistenceContext); + } + + @Test(expected = TransactionRequiredException.class) + public void testThatUserSaveWithoutTransactionThrowException() { + User user = new User(122L, "Devender", "admin"); + transctionPersistenceContext.insertWithoutTransaction(user); + } + + @Test + public void testThatWhenUserSavedWithExtendedPersistenceContextWithoutTransactionThenUserShouldGetCached() { + User user = new User(123L, "Devender", "admin"); + extendedPersistenceContext.insertWithoutTransaction(user); + + User userFromExtendedPersistenceContext = extendedPersistenceContext.find(user.getId()); + assertNotNull(userFromExtendedPersistenceContext); + + User userFromTransctionPersistenceContext = transctionPersistenceContext.find(user.getId()); + assertNull(userFromTransctionPersistenceContext); + } + + @Test(expected = EntityExistsException.class) + public void testThatPersistUserWithSameIdentifierThrowException() { + User user1 = new User(126L, "Devender", "admin"); + User user2 = new User(126L, "Devender", "admin"); + extendedPersistenceContext.insertWithoutTransaction(user1); + extendedPersistenceContext.insertWithoutTransaction(user2); + } + + @Test + public void testThatWhenUserSavedWithExtendedPersistenceContextWithTransactionThenUserShouldSaveEntityIntoDB() { + User user = new User(127L, "Devender", "admin"); + extendedPersistenceContext.insertWithTransaction(user); + + User userFromDB = transctionPersistenceContext.find(user.getId()); + assertNotNull(userFromDB); + } + + @Test + public void testThatWhenUserSavedWithExtendedPersistenceContextWithTransactionThenUserShouldFlushCachedEntityIntoDB() { + User user1 = new User(124L, "Devender", "admin"); + extendedPersistenceContext.insertWithoutTransaction(user1); + + User user2 = new User(125L, "Devender", "admin"); + extendedPersistenceContext.insertWithTransaction(user2); + + User user1FromTransctionPersistenceContext = transctionPersistenceContext.find(user1.getId()); + assertNotNull(user1FromTransctionPersistenceContext); + + User user2FromTransctionPersistenceContext = transctionPersistenceContext.find(user2.getId()); + assertNotNull(user2FromTransctionPersistenceContext); + } + +} diff --git a/persistence-modules/hibernate5-2/src/test/resources/log4j.xml b/persistence-modules/hibernate5-2/src/test/resources/log4j.xml new file mode 100644 index 0000000000..2d153af124 --- /dev/null +++ b/persistence-modules/hibernate5-2/src/test/resources/log4j.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd"> +<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'> + <appender name="STDOUT" class="org.apache.log4j.ConsoleAppender"> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/> + </layout> + </appender> + <logger name="org.hibernate"> + <level value="info" /> + </logger> + <logger name="org.hibernate.SQL"> + <level value="debug" /> + </logger> + <logger name="org.hibernate.type.descriptor.sql"> + <level value="trace" /> + </logger> + <logger name="org.hibernate.stat"> + <level value="debug" /> + </logger> + <root> + <priority value ="info" /> + <appender-ref ref="STDOUT" /> + </root> +</log4j:configuration> \ No newline at end of file diff --git a/persistence-modules/hibernate5-2/src/test/resources/log4j2.xml b/persistence-modules/hibernate5-2/src/test/resources/log4j2.xml new file mode 100644 index 0000000000..c5d0f12462 --- /dev/null +++ b/persistence-modules/hibernate5-2/src/test/resources/log4j2.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Configuration status="INFO"> + <Appenders> + <Console name="console" target="SYSTEM_OUT"> + <PatternLayout + pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n" /> + </Console> + </Appenders> + <Loggers> + <Logger name="org.hibernate" level="info"/> + <Logger name="org.hibernate.SQL" level="debug"/> + <Logger name="org.hibernate.type.descriptor.sql" level="trace"/> + <Logger name="org.hibernate.stat" level="debug" /> + <Root level="info" additivity="false"> + <AppenderRef ref="console" /> + </Root> + </Loggers> +</Configuration> \ No newline at end of file diff --git a/persistence-modules/hibernate5-2/src/test/resources/logback.xml b/persistence-modules/hibernate5-2/src/test/resources/logback.xml new file mode 100644 index 0000000000..9e591977d7 --- /dev/null +++ b/persistence-modules/hibernate5-2/src/test/resources/logback.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<configuration> + + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>%d{yyyy-MM-dd HH:mm:ss} | %-5p | [%thread] %logger{5}:%L - %msg%n</pattern> + </encoder> + </appender> + + <logger name="org.hibernate" level="INFO" /> + <logger name="org.hibernate.SQL" level="DEBUG" /> + <logger name="org.hibernate.type.descriptor.sql" level="TRACE" /> + <logger name="org.hibernate.stat" level="DEBUG" /> + + <root level="INFO"> + <appender-ref ref="STDOUT" /> + </root> +</configuration> \ No newline at end of file diff --git a/persistence-modules/hibernate5/README.md b/persistence-modules/hibernate5/README.md index a8e2eae38b..d1bfe897f6 100644 --- a/persistence-modules/hibernate5/README.md +++ b/persistence-modules/hibernate5/README.md @@ -38,3 +38,4 @@ This module contains articles about Hibernate 5. - [Hibernate Query Plan Cache](https://www.baeldung.com/hibernate-query-plan-cache) - [TransactionRequiredException Error](https://www.baeldung.com/jpa-transaction-required-exception) - [Enabling Transaction Locks in Spring Data JPA](https://www.baeldung.com/java-jpa-transaction-locks) +- [[Next -->]](/hibernate5-2) \ No newline at end of file diff --git a/persistence-modules/hibernate5/pom.xml b/persistence-modules/hibernate5/pom.xml index bf4b2d27ec..ec06136f9c 100644 --- a/persistence-modules/hibernate5/pom.xml +++ b/persistence-modules/hibernate5/pom.xml @@ -3,7 +3,6 @@ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>hibernate5</artifactId> <version>0.0.1-SNAPSHOT</version> <name>hibernate5</name> @@ -104,7 +103,7 @@ </resource> </resources> </build> - + <repositories> <repository> <id>geodb-repo</id> diff --git a/persistence-modules/influxdb/pom.xml b/persistence-modules/influxdb/pom.xml index a8ecaadd62..7531ad8217 100644 --- a/persistence-modules/influxdb/pom.xml +++ b/persistence-modules/influxdb/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>influxdb</artifactId> <version>0.1-SNAPSHOT</version> diff --git a/persistence-modules/java-cassandra/pom.xml b/persistence-modules/java-cassandra/pom.xml index 3f8367d130..6628a393fa 100644 --- a/persistence-modules/java-cassandra/pom.xml +++ b/persistence-modules/java-cassandra/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>java-cassandra</artifactId> <version>1.0.0-SNAPSHOT</version> <name>java-cassandra</name> diff --git a/persistence-modules/java-cockroachdb/pom.xml b/persistence-modules/java-cockroachdb/pom.xml index 2738ef85ff..750cbfce4c 100644 --- a/persistence-modules/java-cockroachdb/pom.xml +++ b/persistence-modules/java-cockroachdb/pom.xml @@ -1,15 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>java-cockroachdb</artifactId> <version>1.0-SNAPSHOT</version> <name>java-cockroachdb</name> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> <relativePath>../../</relativePath> </parent> diff --git a/persistence-modules/java-jdbi/pom.xml b/persistence-modules/java-jdbi/pom.xml index dfb31b26e8..0d978dc164 100644 --- a/persistence-modules/java-jdbi/pom.xml +++ b/persistence-modules/java-jdbi/pom.xml @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>java-jdbi</artifactId> <version>1.0-SNAPSHOT</version> - <name>java-jdbi</name> + <name>java-jdbi</name> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> <relativePath>../../</relativePath> </parent> diff --git a/persistence-modules/java-jpa-2/README.md b/persistence-modules/java-jpa-2/README.md index 14433f8fc8..1c34ef2999 100644 --- a/persistence-modules/java-jpa-2/README.md +++ b/persistence-modules/java-jpa-2/README.md @@ -4,7 +4,7 @@ This module contains articles about the Java Persistence API (JPA) in Java. ### Relevant Articles -- [JPA Query Parameters Usage](https://www.baeldung.com/jpa-query-parameters-usage) +- [JPA Query Parameters Usage](https://www.baeldung.com/jpa-query-parameters) - [Mapping Entitiy Class Names to SQL Table Names with JPA](https://www.baeldung.com/jpa-entity-table-names) - [Default Column Values in JPA](https://www.baeldung.com/jpa-default-column-values) - [Types of JPA Queries](https://www.baeldung.com/jpa-queries) diff --git a/persistence-modules/java-jpa-2/pom.xml b/persistence-modules/java-jpa-2/pom.xml index 2488c5ccdf..cc9e69fcaa 100644 --- a/persistence-modules/java-jpa-2/pom.xml +++ b/persistence-modules/java-jpa-2/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>java-jpa-2</artifactId> <name>java-jpa-2</name> diff --git a/persistence-modules/java-jpa/pom.xml b/persistence-modules/java-jpa/pom.xml index 7ce8262ba5..a979cf7e65 100644 --- a/persistence-modules/java-jpa/pom.xml +++ b/persistence-modules/java-jpa/pom.xml @@ -7,8 +7,8 @@ <name>java-jpa</name> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> @@ -19,11 +19,11 @@ <artifactId>hibernate-core</artifactId> <version>${hibernate.version}</version> </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-jpamodelgen</artifactId> - <version>${hibernate.version}</version> - </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-jpamodelgen</artifactId> + <version>${hibernate.version}</version> + </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> @@ -52,8 +52,8 @@ </dependency> </dependencies> - <build> - <plugins> + <build> + <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> @@ -62,48 +62,48 @@ <compilerArgument>-proc:none</compilerArgument> </configuration> </plugin> - <plugin> - <groupId>org.bsc.maven</groupId> - <artifactId>maven-processor-plugin</artifactId> - <version>${maven-processor-plugin.version}</version> - <executions> - <execution> - <id>process</id> - <goals> - <goal>process</goal> - </goals> - <phase>generate-sources</phase> - <configuration> - <outputDirectory>target/metamodel</outputDirectory> - <processors> - <processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor> - </processors> - </configuration> - </execution> - </executions> - </plugin> + <plugin> + <groupId>org.bsc.maven</groupId> + <artifactId>maven-processor-plugin</artifactId> + <version>${maven-processor-plugin.version}</version> + <executions> + <execution> + <id>process</id> + <goals> + <goal>process</goal> + </goals> + <phase>generate-sources</phase> + <configuration> + <outputDirectory>target/metamodel</outputDirectory> + <processors> + <processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor> + </processors> + </configuration> + </execution> + </executions> + </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <version>${build-helper-maven-plugin.version}</version> - <executions> - <execution> - <id>add-source</id> - <phase>generate-sources</phase> - <goals> - <goal>add-source</goal> - </goals> - <configuration> - <sources> - <source>target/metamodel</source> - </sources> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>${build-helper-maven-plugin.version}</version> + <executions> + <execution> + <id>add-source</id> + <phase>generate-sources</phase> + <goals> + <goal>add-source</goal> + </goals> + <configuration> + <sources> + <source>target/metamodel</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> <properties> <hibernate.version>5.4.0.Final</hibernate.version> diff --git a/persistence-modules/java-mongodb/pom.xml b/persistence-modules/java-mongodb/pom.xml index 35e59e60c6..1e59bd9064 100644 --- a/persistence-modules/java-mongodb/pom.xml +++ b/persistence-modules/java-mongodb/pom.xml @@ -1,49 +1,45 @@ -<?xml version="1.0"?> -<project - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" - xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> - <artifactId>java-mongodb</artifactId> - <version>1.0-SNAPSHOT</version> - <name>java-mongodb</name> +<?xml version="1.0" encoding="UTF-8"?> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + <artifactId>java-mongodb</artifactId> + <version>1.0-SNAPSHOT</version> + <name>java-mongodb</name> - <parent> - <groupId>com.baeldung</groupId> - <artifactId>parent-modules</artifactId> - <version>1.0.0-SNAPSHOT</version> - <relativePath>../../</relativePath> - </parent> + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> + <version>1.0.0-SNAPSHOT</version> + <relativePath>../../</relativePath> + </parent> - <dependencies> + <dependencies> + <dependency> + <groupId>de.flapdoodle.embedmongo</groupId> + <artifactId>de.flapdoodle.embedmongo</artifactId> + <version>${flapdoodle.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mongodb</groupId> + <artifactId>mongo-java-driver</artifactId> + <version>${mongo.version}</version> + </dependency> - <dependency> - <groupId>de.flapdoodle.embedmongo</groupId> - <artifactId>de.flapdoodle.embedmongo</artifactId> - <version>${flapdoodle.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mongodb</groupId> - <artifactId>mongo-java-driver</artifactId> - <version>${mongo.version}</version> - </dependency> + <dependency> + <groupId>dev.morphia.morphia</groupId> + <artifactId>core</artifactId> + <version>${morphia.version}</version> + </dependency> + </dependencies> - <dependency> - <groupId>dev.morphia.morphia</groupId> - <artifactId>core</artifactId> - <version>${morphia.version}</version> - </dependency> - - </dependencies> - - <properties> - <maven.compiler.source>1.8</maven.compiler.source> - <maven.compiler.target>1.8</maven.compiler.target> - <mongo.version>3.10.1</mongo.version> - <flapdoodle.version>1.11</flapdoodle.version> - <morphia.version>1.5.3</morphia.version> - </properties> + <properties> + <maven.compiler.source>1.8</maven.compiler.source> + <maven.compiler.target>1.8</maven.compiler.target> + <mongo.version>3.10.1</mongo.version> + <flapdoodle.version>1.11</flapdoodle.version> + <morphia.version>1.5.3</morphia.version> + </properties> </project> diff --git a/persistence-modules/jnosql/jnosql-artemis/pom.xml b/persistence-modules/jnosql/jnosql-artemis/pom.xml index 09d6af13df..8570d1072f 100644 --- a/persistence-modules/jnosql/jnosql-artemis/pom.xml +++ b/persistence-modules/jnosql/jnosql-artemis/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>jnosql-artemis</artifactId> - <name>jnosql-artemis</name> + <name>jnosql-artemis</name> <packaging>war</packaging> <parent> @@ -12,7 +12,7 @@ <artifactId>jnosql</artifactId> <version>1.0-SNAPSHOT</version> </parent> - + <dependencies> <dependency> <groupId>javax</groupId> diff --git a/persistence-modules/jnosql/jnosql-diana/pom.xml b/persistence-modules/jnosql/jnosql-diana/pom.xml index a4951761d8..22e066d36d 100644 --- a/persistence-modules/jnosql/jnosql-diana/pom.xml +++ b/persistence-modules/jnosql/jnosql-diana/pom.xml @@ -4,8 +4,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>jnosql-diana</artifactId> - <name>jnosql-diana</name> - + <name>jnosql-diana</name> + <parent> <groupId>com.baeldung.jnosql</groupId> <artifactId>jnosql</artifactId> @@ -13,7 +13,6 @@ </parent> <dependencies> - <!--NoSQL Document oriented--> <dependency> <groupId>org.jnosql.diana</groupId> diff --git a/persistence-modules/jnosql/pom.xml b/persistence-modules/jnosql/pom.xml index 8773456285..b96722de18 100644 --- a/persistence-modules/jnosql/pom.xml +++ b/persistence-modules/jnosql/pom.xml @@ -6,7 +6,7 @@ <groupId>com.baeldung.jnosql</groupId> <artifactId>jnosql</artifactId> <version>1.0-SNAPSHOT</version> - <name>jnosql</name> + <name>jnosql</name> <packaging>pom</packaging> <parent> @@ -19,11 +19,12 @@ <modules> <module>jnosql-artemis</module> <module>jnosql-diana</module> - </modules> + </modules> <properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <jnosql.version>0.0.5</jnosql.version> </properties> + </project> diff --git a/persistence-modules/jpa-hibernate-cascade-type/pom.xml b/persistence-modules/jpa-hibernate-cascade-type/pom.xml index bc6307efb0..a545723746 100644 --- a/persistence-modules/jpa-hibernate-cascade-type/pom.xml +++ b/persistence-modules/jpa-hibernate-cascade-type/pom.xml @@ -2,8 +2,8 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <artifactId>jpa-hibernate-cascade-type</artifactId> <modelVersion>4.0.0</modelVersion> + <artifactId>jpa-hibernate-cascade-type</artifactId> <version>1.0.0-SNAPSHOT</version> <parent> diff --git a/persistence-modules/liquibase/pom.xml b/persistence-modules/liquibase/pom.xml index b06d38e6a0..39e86b5186 100644 --- a/persistence-modules/liquibase/pom.xml +++ b/persistence-modules/liquibase/pom.xml @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>liquibase</artifactId> - <name>liquibase</name> + <name>liquibase</name> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> <relativePath>../../</relativePath> </parent> diff --git a/persistence-modules/orientdb/pom.xml b/persistence-modules/orientdb/pom.xml index a8ac3fb789..7b0bef7fc5 100644 --- a/persistence-modules/orientdb/pom.xml +++ b/persistence-modules/orientdb/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>orientdb</artifactId> <version>0.0.1-SNAPSHOT</version> @@ -36,8 +36,7 @@ <artifactId>blueprints-core</artifactId> <version>${blueprints.version}</version> </dependency> - - </dependencies> + </dependencies> <properties> <orientdb.version>2.2.31</orientdb.version> diff --git a/persistence-modules/persistence-libraries/pom.xml b/persistence-modules/persistence-libraries/pom.xml index 273db34ec4..74ff262637 100644 --- a/persistence-modules/persistence-libraries/pom.xml +++ b/persistence-modules/persistence-libraries/pom.xml @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>persistence-libraries</artifactId> <version>1.0-SNAPSHOT</version> <name>java-sql2o</name> <parent> - <artifactId>persistence-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>persistence-modules</artifactId> <version>1.0.0-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/persistence-modules/pom.xml b/persistence-modules/pom.xml index ce1f0d2163..c0f7c07b70 100644 --- a/persistence-modules/pom.xml +++ b/persistence-modules/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>persistence-modules</artifactId> <name>persistence-modules</name> @@ -38,9 +38,9 @@ <module>orientdb</module> <module>persistence-libraries</module> <module>querydsl</module> - <module>r2dbc</module> + <module>r2dbc</module> <module>redis</module> - <!-- <module>sirix</module> --> <!-- We haven't upgraded to java 11. Fixing in BAEL-10841 --> + <!-- <module>sirix</module> --> <!-- We haven't upgraded to java 11. Fixing in BAEL-10841 --> <module>solr</module> <module>spring-boot-jdbi</module> <module>spring-boot-mysql</module> @@ -68,8 +68,8 @@ <module>spring-hibernate-5</module> <!-- long running --> <module>spring-hibernate4</module> <module>spring-jpa</module> - <!-- <module>spring-mybatis</module> --> <!-- needs fixing in BAEL-9021 --> + <!-- <module>spring-mybatis</module> --> <!-- needs fixing in BAEL-9021 --> <module>spring-persistence-simple</module> </modules> - + </project> diff --git a/persistence-modules/querydsl/pom.xml b/persistence-modules/querydsl/pom.xml index 4d4347e909..690e65d737 100644 --- a/persistence-modules/querydsl/pom.xml +++ b/persistence-modules/querydsl/pom.xml @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>querydsl</artifactId> <version>0.1-SNAPSHOT</version> <name>querydsl</name> @@ -18,7 +17,6 @@ <dependencies> <!-- QueryDSL --> - <dependency> <groupId>com.querydsl</groupId> <artifactId>querydsl-jpa</artifactId> diff --git a/persistence-modules/r2dbc/pom.xml b/persistence-modules/r2dbc/pom.xml index 4256da659e..3b2a57401c 100644 --- a/persistence-modules/r2dbc/pom.xml +++ b/persistence-modules/r2dbc/pom.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.baeldung.examples.r2dbc</groupId> <artifactId>r2dbc-example</artifactId> @@ -13,7 +13,7 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.6.RELEASE</version> - <relativePath /> <!-- lookup parent from repository --> + <relativePath/> <!-- lookup parent from repository --> </parent> <dependencies> diff --git a/persistence-modules/redis/pom.xml b/persistence-modules/redis/pom.xml index e5a39d6eac..c4a928bb4a 100644 --- a/persistence-modules/redis/pom.xml +++ b/persistence-modules/redis/pom.xml @@ -1,8 +1,7 @@ <?xml version="1.0"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>redis</artifactId> <version>0.1-SNAPSHOT</version> <name>redis</name> @@ -44,4 +43,5 @@ <redisson.version>3.3.0</redisson.version> <lettuce-core.version>5.0.1.RELEASE</lettuce-core.version> </properties> + </project> diff --git a/persistence-modules/sirix/pom.xml b/persistence-modules/sirix/pom.xml index 8de961120f..ccaec79775 100644 --- a/persistence-modules/sirix/pom.xml +++ b/persistence-modules/sirix/pom.xml @@ -1,53 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>io.sirix</groupId> - <artifactId>core-api-tutorial</artifactId> - <packaging>jar</packaging> - <version>1.0-SNAPSHOT</version> - <name>core-api-tutorial</name> - <url>http://maven.apache.org</url> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>io.sirix</groupId> + <artifactId>core-api-tutorial</artifactId> + <version>1.0-SNAPSHOT</version> + <name>core-api-tutorial</name> + <packaging>jar</packaging> + <url>http://maven.apache.org</url> - <parent> - <groupId>com.baeldung</groupId> - <artifactId>parent-java</artifactId> - <version>0.0.1-SNAPSHOT</version> - <relativePath>../../parent-java</relativePath> - </parent> + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-java</artifactId> + <version>0.0.1-SNAPSHOT</version> + <relativePath>../../parent-java</relativePath> + </parent> - <dependencies> - <dependency> - <groupId>io.sirix</groupId> - <artifactId>sirix-core</artifactId> - <version>${sirix-core.version}</version> - </dependency> - </dependencies> + <dependencies> + <dependency> + <groupId>io.sirix</groupId> + <artifactId>sirix-core</artifactId> + <version>${sirix-core.version}</version> + </dependency> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.8.0</version> - <configuration> - <release>${maven.release.version}</release> - <encoding>${project.build.sourceEncoding}</encoding> - </configuration> - <dependencies> - <dependency> - <groupId>org.ow2.asm</groupId> - <artifactId>asm</artifactId> - <version>6.1</version> <!-- Use newer version of ASM --> - </dependency> - </dependencies> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.0</version> + <configuration> + <release>${maven.release.version}</release> + <encoding>${project.build.sourceEncoding}</encoding> + </configuration> + <dependencies> + <dependency> + <groupId>org.ow2.asm</groupId> + <artifactId>asm</artifactId> + <version>6.1</version> <!-- Use newer version of ASM --> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <maven.release.version>11</maven.release.version> + <sirix-core.version>0.9.3</sirix-core.version> + </properties> - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <maven.release.version>11</maven.release.version> - <sirix-core.version>0.9.3</sirix-core.version> - </properties> </project> diff --git a/persistence-modules/solr/pom.xml b/persistence-modules/solr/pom.xml index 1c14c06315..5902d42a82 100644 --- a/persistence-modules/solr/pom.xml +++ b/persistence-modules/solr/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>solr</artifactId> <version>0.0.1-SNAPSHOT</version> <name>solr</name> diff --git a/persistence-modules/spring-boot-jdbi/pom.xml b/persistence-modules/spring-boot-jdbi/pom.xml index e8904492ac..db36185acd 100644 --- a/persistence-modules/spring-boot-jdbi/pom.xml +++ b/persistence-modules/spring-boot-jdbi/pom.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.boot.jdbi</groupId> <artifactId>spring-boot-jdbi</artifactId> @@ -10,8 +10,8 @@ <description>Sample SpringBoot JDBI Project</description> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> @@ -41,12 +41,12 @@ </dependencies> </dependencyManagement> - <dependencies> + <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> - + <dependency> <groupId>org.jdbi</groupId> <artifactId>jdbi3-spring4</artifactId> diff --git a/persistence-modules/spring-boot-mysql/pom.xml b/persistence-modules/spring-boot-mysql/pom.xml index 29374ec116..e4456b2eaf 100644 --- a/persistence-modules/spring-boot-mysql/pom.xml +++ b/persistence-modules/spring-boot-mysql/pom.xml @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-boot-mysql</artifactId> <version>0.1.0</version> <name>spring-boot-mysql</name> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-2</relativePath> </parent> @@ -38,16 +38,13 @@ </dependencies> <build> - <finalName>spring-boot-mysql-timezone</finalName> + <finalName>spring-boot-mysql</finalName> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resource> </resources> - <plugins> - - </plugins> </build> <properties> diff --git a/persistence-modules/spring-boot-persistence-h2/README.md b/persistence-modules/spring-boot-persistence-h2/README.md index 377b7c8939..a0f9c67a33 100644 --- a/persistence-modules/spring-boot-persistence-h2/README.md +++ b/persistence-modules/spring-boot-persistence-h2/README.md @@ -1,3 +1,4 @@ ### Relevant Articles: - [Access the Same In-Memory H2 Database in Multiple Spring Boot Applications](https://www.baeldung.com/spring-boot-access-h2-database-multiple-apps) -- [Spring Boot With H2 Database](https://www.baeldung.com/spring-boot-h2-database) \ No newline at end of file +- [Spring Boot With H2 Database](https://www.baeldung.com/spring-boot-h2-database) +- [Hibernate @NotNull vs @Column(nullable = false)](https://www.baeldung.com/hibernate-notnull-vs-nullable) \ No newline at end of file diff --git a/persistence-modules/spring-boot-persistence-h2/pom.xml b/persistence-modules/spring-boot-persistence-h2/pom.xml index 30c727bfc8..9a0a72ba23 100644 --- a/persistence-modules/spring-boot-persistence-h2/pom.xml +++ b/persistence-modules/spring-boot-persistence-h2/pom.xml @@ -6,13 +6,13 @@ <groupId>com.baeldung.h2db</groupId> <artifactId>spring-boot-persistence-h2</artifactId> <version>0.0.1-SNAPSHOT</version> - <name>spring-boot-persistence-h2</name> + <name>spring-boot-persistence-h2</name> <packaging>jar</packaging> <description>Demo Spring Boot applications that starts H2 in memory database</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-2</relativePath> </parent> @@ -22,6 +22,10 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-validation</artifactId> + </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> @@ -45,5 +49,5 @@ <start-class>com.baeldung.h2db.demo.server.SpringBootApp</start-class> <spring-boot.version>2.0.4.RELEASE</spring-boot.version> </properties> - + </project> diff --git a/persistence-modules/spring-boot-persistence-h2/src/main/java/com/baeldung/h2db/notnull/NotNullVsNullableApplication.java b/persistence-modules/spring-boot-persistence-h2/src/main/java/com/baeldung/h2db/notnull/NotNullVsNullableApplication.java new file mode 100644 index 0000000000..5e8d69e3a1 --- /dev/null +++ b/persistence-modules/spring-boot-persistence-h2/src/main/java/com/baeldung/h2db/notnull/NotNullVsNullableApplication.java @@ -0,0 +1,12 @@ +package com.baeldung.h2db.notnull; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class NotNullVsNullableApplication { + + public static void main(String... args) { + SpringApplication.run(NotNullVsNullableApplication.class, args); + } +} diff --git a/persistence-modules/spring-boot-persistence-h2/src/main/java/com/baeldung/h2db/notnull/daos/ItemRepository.java b/persistence-modules/spring-boot-persistence-h2/src/main/java/com/baeldung/h2db/notnull/daos/ItemRepository.java new file mode 100644 index 0000000000..c1efc96d71 --- /dev/null +++ b/persistence-modules/spring-boot-persistence-h2/src/main/java/com/baeldung/h2db/notnull/daos/ItemRepository.java @@ -0,0 +1,9 @@ +package com.baeldung.h2db.notnull.daos; + +import com.baeldung.h2db.notnull.models.Item; +import org.springframework.data.repository.CrudRepository; + +import java.math.BigDecimal; + +public interface ItemRepository extends CrudRepository<Item, BigDecimal> { +} diff --git a/persistence-modules/spring-boot-persistence-h2/src/main/java/com/baeldung/h2db/notnull/models/Item.java b/persistence-modules/spring-boot-persistence-h2/src/main/java/com/baeldung/h2db/notnull/models/Item.java new file mode 100644 index 0000000000..d2c4015b86 --- /dev/null +++ b/persistence-modules/spring-boot-persistence-h2/src/main/java/com/baeldung/h2db/notnull/models/Item.java @@ -0,0 +1,18 @@ +package com.baeldung.h2db.notnull.models; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; + +@Entity +public class Item { + + @Id + @GeneratedValue + private Long id; + + @NotNull + private BigDecimal price; +} diff --git a/persistence-modules/spring-boot-persistence-h2/src/main/resources/application.properties b/persistence-modules/spring-boot-persistence-h2/src/main/resources/application.properties index 109b389b58..ed1ffc63c3 100644 --- a/persistence-modules/spring-boot-persistence-h2/src/main/resources/application.properties +++ b/persistence-modules/spring-boot-persistence-h2/src/main/resources/application.properties @@ -3,6 +3,10 @@ spring.datasource.driverClassName=org.h2.Driver spring.datasource.username=sa spring.datasource.password= spring.jpa.hibernate.ddl-auto=create-drop +spring.jpa.show-sql=true +spring.jpa.properties.hibernate.format_sql=true +spring.jpa.properties.hibernate.validator.apply_to_ddl=false +#spring.jpa.properties.hibernate.check_nullability=true spring.h2.console.enabled=true spring.h2.console.path=/h2-console debug=true \ No newline at end of file diff --git a/persistence-modules/spring-boot-persistence-h2/src/test/java/com/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-boot-persistence-h2/src/test/java/com/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index cf964b5011..0000000000 --- a/persistence-modules/spring-boot-persistence-h2/src/test/java/com/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; -import org.springframework.test.context.web.WebAppConfiguration; - - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(loader = AnnotationConfigContextLoader.class) -@WebAppConfiguration -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/persistence-modules/spring-boot-persistence-h2/src/test/java/com/baeldung/h2db/notnull/ItemIntegrationTest.java b/persistence-modules/spring-boot-persistence-h2/src/test/java/com/baeldung/h2db/notnull/ItemIntegrationTest.java new file mode 100644 index 0000000000..0e2e5e3319 --- /dev/null +++ b/persistence-modules/spring-boot-persistence-h2/src/test/java/com/baeldung/h2db/notnull/ItemIntegrationTest.java @@ -0,0 +1,28 @@ +package com.baeldung.h2db.notnull; + +import com.baeldung.h2db.notnull.daos.ItemRepository; +import com.baeldung.h2db.notnull.models.Item; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import javax.validation.ConstraintViolationException; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = NotNullVsNullableApplication.class) +public class ItemIntegrationTest { + + @Autowired + private ItemRepository itemRepository; + + @Test + public void shouldNotAllowToPersistNullItemsPrice() { + assertThatThrownBy(() -> itemRepository.save(new Item())) + .hasRootCauseInstanceOf(ConstraintViolationException.class) + .hasStackTraceContaining("must not be null"); + } +} diff --git a/persistence-modules/spring-boot-persistence-mongodb/pom.xml b/persistence-modules/spring-boot-persistence-mongodb/pom.xml index dae5efa6d0..da48f066f9 100644 --- a/persistence-modules/spring-boot-persistence-mongodb/pom.xml +++ b/persistence-modules/spring-boot-persistence-mongodb/pom.xml @@ -9,8 +9,8 @@ <description>This is simple boot application for Spring boot persistence mongodb test</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-2</relativePath> </parent> @@ -23,7 +23,7 @@ <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> - </dependency> + </dependency> <!-- MongoDB --> <dependency> <groupId>org.springframework.boot</groupId> @@ -61,7 +61,7 @@ </dependencies> <build> - <finalName>spring-boot-persistence</finalName> + <finalName>spring-boot-persistence-mongodb</finalName> <resources> <resource> <directory>src/main/resources</directory> @@ -110,5 +110,4 @@ </profile> </profiles> - </project> diff --git a/persistence-modules/spring-boot-persistence/pom.xml b/persistence-modules/spring-boot-persistence/pom.xml index 3ad925f16b..049e7225ac 100644 --- a/persistence-modules/spring-boot-persistence/pom.xml +++ b/persistence-modules/spring-boot-persistence/pom.xml @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-boot-persistence</artifactId> <version>0.1.0</version> <name>spring-boot-persistence</name> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-2</relativePath> </parent> diff --git a/persistence-modules/spring-data-cassandra-reactive/pom.xml b/persistence-modules/spring-data-cassandra-reactive/pom.xml index 288f842201..a57ebbe703 100644 --- a/persistence-modules/spring-data-cassandra-reactive/pom.xml +++ b/persistence-modules/spring-data-cassandra-reactive/pom.xml @@ -3,7 +3,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-data-cassandra-reactive</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-data-cassandra-reactive</name> @@ -52,7 +51,6 @@ <version>${cassandra-unit-spring.version}</version> <scope>test</scope> </dependency> - </dependencies> <properties> diff --git a/persistence-modules/spring-data-cassandra/pom.xml b/persistence-modules/spring-data-cassandra/pom.xml index 4f323a72d8..9ea39f3f55 100644 --- a/persistence-modules/spring-data-cassandra/pom.xml +++ b/persistence-modules/spring-data-cassandra/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-data-cassandra</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-data-cassandra</name> diff --git a/persistence-modules/spring-data-cassandra/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-cassandra/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 46ee3cd368..0000000000 --- a/persistence-modules/spring-data-cassandra/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.baeldung; - -import java.io.IOException; -import java.util.HashMap; - -import org.apache.cassandra.exceptions.ConfigurationException; -import org.apache.thrift.transport.TTransportException; -import org.baeldung.spring.data.cassandra.config.CassandraConfig; -import org.baeldung.spring.data.cassandra.model.Book; -import org.cassandraunit.utils.EmbeddedCassandraServerHelper; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.cassandra.core.cql.CqlIdentifier; -import org.springframework.data.cassandra.core.CassandraAdminOperations; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import com.datastax.driver.core.Cluster; -import com.datastax.driver.core.Session; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = CassandraConfig.class) -public class SpringContextIntegrationTest { - - public static final String KEYSPACE_CREATION_QUERY = "CREATE KEYSPACE IF NOT EXISTS testKeySpace " + "WITH replication = { 'class': 'SimpleStrategy', 'replication_factor': '3' };"; - - public static final String KEYSPACE_ACTIVATE_QUERY = "USE testKeySpace;"; - - public static final String DATA_TABLE_NAME = "book"; - - @Autowired - private CassandraAdminOperations adminTemplate; - - @BeforeClass - public static void startCassandraEmbedded() throws InterruptedException, TTransportException, ConfigurationException, IOException { - EmbeddedCassandraServerHelper.startEmbeddedCassandra(); - final Cluster cluster = Cluster.builder().addContactPoints("127.0.0.1").withPort(9142).build(); - final Session session = cluster.connect(); - session.execute(KEYSPACE_CREATION_QUERY); - session.execute(KEYSPACE_ACTIVATE_QUERY); - Thread.sleep(5000); - } - - @Before - public void createTable() throws InterruptedException, TTransportException, ConfigurationException, IOException { - adminTemplate.createTable(true, CqlIdentifier.cqlId(DATA_TABLE_NAME), Book.class, new HashMap<String, Object>()); - } - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } - - @After - public void dropTable() { - adminTemplate.dropTable(CqlIdentifier.cqlId(DATA_TABLE_NAME)); - } - - @AfterClass - public static void stopCassandraEmbedded() { - EmbeddedCassandraServerHelper.cleanEmbeddedCassandra(); - } -} diff --git a/persistence-modules/spring-data-couchbase-2/pom.xml b/persistence-modules/spring-data-couchbase-2/pom.xml index f57d9aaa62..56456fc04b 100644 --- a/persistence-modules/spring-data-couchbase-2/pom.xml +++ b/persistence-modules/spring-data-couchbase-2/pom.xml @@ -1,6 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.baeldung</groupId> <artifactId>spring-data-couchbase-2</artifactId> @@ -16,7 +17,6 @@ </parent> <dependencies> - <!-- Spring Context and Couchbase Peristence --> <dependency> <groupId>org.springframework</groupId> diff --git a/persistence-modules/spring-data-dynamodb/pom.xml b/persistence-modules/spring-data-dynamodb/pom.xml index e8bf9b8c1e..7b936817d1 100644 --- a/persistence-modules/spring-data-dynamodb/pom.xml +++ b/persistence-modules/spring-data-dynamodb/pom.xml @@ -1,14 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-data-dynamodb</artifactId> - <packaging>jar</packaging> <name>spring-data-dynamodb</name> + <packaging>jar</packaging> <description>This is simple boot application for Spring boot dynamodb test</description> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-1</relativePath> </parent> @@ -134,11 +135,10 @@ <type>so</type> <scope>test</scope> </dependency> - </dependencies> <build> - <finalName>spring-boot</finalName> + <finalName>spring-data-dynamodb</finalName> <resources> <resource> <directory>src/main/resources</directory> diff --git a/persistence-modules/spring-data-dynamodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-dynamodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 7f906bdbcd..0000000000 --- a/persistence-modules/spring-data-dynamodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.Application; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/persistence-modules/spring-data-eclipselink/pom.xml b/persistence-modules/spring-data-eclipselink/pom.xml index 5ca827db7b..bb596d4a8a 100644 --- a/persistence-modules/spring-data-eclipselink/pom.xml +++ b/persistence-modules/spring-data-eclipselink/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-data-eclipselink</artifactId> <name>spring-data-eclipselink</name> diff --git a/persistence-modules/spring-data-eclipselink/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-eclipselink/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 4be5891e3e..0000000000 --- a/persistence-modules/spring-data-eclipselink/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.eclipselink.springdata.EclipselinkSpringDataApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = EclipselinkSpringDataApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/persistence-modules/spring-data-elasticsearch/pom.xml b/persistence-modules/spring-data-elasticsearch/pom.xml index 9495d56798..ccd2f94e59 100644 --- a/persistence-modules/spring-data-elasticsearch/pom.xml +++ b/persistence-modules/spring-data-elasticsearch/pom.xml @@ -1,7 +1,6 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-data-elasticsearch</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-data-elasticsearch</name> @@ -20,13 +19,13 @@ <artifactId>spring-core</artifactId> <version>${spring.version}</version> </dependency> - + <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${spring.version}</version> </dependency> - + <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-elasticsearch</artifactId> @@ -43,12 +42,12 @@ <artifactId>fastjson</artifactId> <version>${fastjson.version}</version> </dependency> - + <dependency> - <groupId>org.locationtech.spatial4j</groupId> - <artifactId>spatial4j</artifactId> - <version>${spatial4j.version}</version> - </dependency> + <groupId>org.locationtech.spatial4j</groupId> + <artifactId>spatial4j</artifactId> + <version>${spatial4j.version}</version> + </dependency> <dependency> <groupId>com.vividsolutions</groupId> @@ -61,26 +60,26 @@ </exclusion> </exclusions> </dependency> - + <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-core</artifactId> <version>${log4j.version}</version> </dependency> - + <dependency> <groupId>org.elasticsearch.client</groupId> <artifactId>transport</artifactId> <version>${elasticsearch.version}</version> </dependency> - + <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>${spring.version}</version> <scope>test</scope> </dependency> - + <dependency> <groupId>net.java.dev.jna</groupId> <artifactId>jna</artifactId> diff --git a/persistence-modules/spring-data-gemfire/pom.xml b/persistence-modules/spring-data-gemfire/pom.xml index dbb869acf0..6bd689192c 100644 --- a/persistence-modules/spring-data-gemfire/pom.xml +++ b/persistence-modules/spring-data-gemfire/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-data-gemfire</artifactId> <name>spring-data-gemfire</name> diff --git a/persistence-modules/spring-data-gemfire/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-gemfire/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 2f0557ccc1..0000000000 --- a/persistence-modules/spring-data-gemfire/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import com.baeldung.spring.data.gemfire.function.GemfireConfiguration; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes=GemfireConfiguration.class, loader=AnnotationConfigContextLoader.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/persistence-modules/spring-data-geode/README.md b/persistence-modules/spring-data-geode/README.md new file mode 100644 index 0000000000..98bde6ea5a --- /dev/null +++ b/persistence-modules/spring-data-geode/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Intro to Spring Data Geode](https://www.baeldung.com/spring-data-geode) diff --git a/persistence-modules/spring-data-geode/pom.xml b/persistence-modules/spring-data-geode/pom.xml index abd3049755..2a9cbe35e9 100644 --- a/persistence-modules/spring-data-geode/pom.xml +++ b/persistence-modules/spring-data-geode/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-data-geode</artifactId> <name>spring-data-geode</name> @@ -42,7 +42,7 @@ <artifactId>spring-geode-starter</artifactId> <version>${spring-geode-starter-version}</version> </dependency> - + <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-autoconfigure</artifactId> @@ -85,7 +85,7 @@ </build> <properties> - <spring-boot-version>2.1.9.RELEASE</spring-boot-version> + <spring-boot-version>2.1.9.RELEASE</spring-boot-version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <start-class>com.baeldung.springdatageode.app.ClientCacheApp</start-class> <spring-geode-starter-version>1.1.1.RELEASE</spring-geode-starter-version> diff --git a/persistence-modules/spring-data-jpa-2/README.md b/persistence-modules/spring-data-jpa-2/README.md index d1875d91d4..e59aca7c69 100644 --- a/persistence-modules/spring-data-jpa-2/README.md +++ b/persistence-modules/spring-data-jpa-2/README.md @@ -9,3 +9,4 @@ - [JPA @Embedded And @Embeddable](https://www.baeldung.com/jpa-embedded-embeddable) - [Spring Data JPA Delete and Relationships](https://www.baeldung.com/spring-data-jpa-delete) - [Spring Data JPA and Named Entity Graphs](https://www.baeldung.com/spring-data-jpa-named-entity-graphs) +- [Customizing the Result of JPA Queries with Aggregation Functions](https://www.baeldung.com/jpa-queries-custom-result-with-aggregation-functions) diff --git a/persistence-modules/spring-data-jpa-2/pom.xml b/persistence-modules/spring-data-jpa-2/pom.xml index 3616b5ce18..838327de89 100644 --- a/persistence-modules/spring-data-jpa-2/pom.xml +++ b/persistence-modules/spring-data-jpa-2/pom.xml @@ -1,16 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - - <groupId>com.baeldung</groupId> <artifactId>spring-data-jpa-2</artifactId> <name>spring-data-jpa-2</name> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-2</relativePath> </parent> @@ -42,8 +40,9 @@ <artifactId>spring-oxm</artifactId> </dependency> </dependencies> - + <properties> <datasource-proxy.version>1.4.1</datasource-proxy.version> </properties> + </project> \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-3/README.md b/persistence-modules/spring-data-jpa-3/README.md index a86c1e5ec2..bac52bf114 100644 --- a/persistence-modules/spring-data-jpa-3/README.md +++ b/persistence-modules/spring-data-jpa-3/README.md @@ -9,7 +9,6 @@ - [Spring Data JPA Batch Inserts](https://www.baeldung.com/spring-data-jpa-batch-inserts) - [Batch Insert/Update with Hibernate/JPA](https://www.baeldung.com/jpa-hibernate-batch-insert-update) - [Difference Between save() and saveAndFlush() in Spring Data JPA](https://www.baeldung.com/spring-data-jpa-save-saveandflush) -- [Programmatic Transaction Management in Spring](https://www.baeldung.com/spring-programmatic-transaction-management) ### Eclipse Config After importing the project into Eclipse, you may see the following error: diff --git a/persistence-modules/spring-data-jpa-3/pom.xml b/persistence-modules/spring-data-jpa-3/pom.xml index 99df250a9a..8a949b3008 100644 --- a/persistence-modules/spring-data-jpa-3/pom.xml +++ b/persistence-modules/spring-data-jpa-3/pom.xml @@ -3,20 +3,18 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> <artifactId>spring-data-jpa-3</artifactId> <name>spring-data-jpa-3</name> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-2</relativePath> </parent> <dependencies> - <!-- Prod Dependencies --> <dependency> <groupId>org.springframework.boot</groupId> @@ -47,13 +45,11 @@ <dependency> <groupId>org.postgresql</groupId> <artifactId>postgresql</artifactId> - <version>${postgresql.version}</version> </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <scope>runtime</scope> - <version>${h2.version}</version> </dependency> <!-- Test Dependencies --> @@ -81,10 +77,9 @@ <dependency> <groupId>org.junit.platform</groupId> <artifactId>junit-platform-launcher</artifactId> - <version>${junit-platform.version}</version> <scope>test</scope> </dependency> - + <!-- Test containers only dependencies --> <dependency> <groupId>org.testcontainers</groupId> @@ -103,4 +98,5 @@ <testcontainers.version>1.12.2</testcontainers.version> <h2.version>1.4.200</h2.version> </properties> + </project> diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/Application.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/Application.java index c0490d50c6..ce10072031 100644 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/Application.java +++ b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/Application.java @@ -2,8 +2,10 @@ package com.baeldung; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; @SpringBootApplication +@EnableJpaRepositories public class Application { public static void main(String[] args) { diff --git a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/boot/daos/CustomerRepository.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/daos/CustomerRepository.java similarity index 66% rename from persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/boot/daos/CustomerRepository.java rename to persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/daos/CustomerRepository.java index 2f1af6ac55..7cb7e45b27 100644 --- a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/boot/daos/CustomerRepository.java +++ b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/daos/CustomerRepository.java @@ -1,6 +1,8 @@ package com.baeldung.boot.daos; import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; import com.baeldung.boot.domain.Customer; @@ -10,6 +12,8 @@ import com.baeldung.boot.domain.Customer; * @author ysharma2512 * */ +@Repository +@Transactional public interface CustomerRepository extends CrudRepository<Customer, Long>{ } diff --git a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/boot/web/controllers/CustomerController.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/web/controllers/CustomerController.java similarity index 94% rename from persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/boot/web/controllers/CustomerController.java rename to persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/web/controllers/CustomerController.java index 69a1e5507e..e13afd9b45 100644 --- a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/boot/web/controllers/CustomerController.java +++ b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/web/controllers/CustomerController.java @@ -4,7 +4,6 @@ import java.net.URISyntaxException; import java.util.Arrays; import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RestController; @@ -22,7 +21,6 @@ import com.baeldung.boot.domain.Customer; @RestController public class CustomerController { - @Autowired CustomerRepository customerRepository; public CustomerController(CustomerRepository customerRepository2) { diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/repository/UserRepository.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/repository/UserRepository.java index c656055751..f683be402f 100644 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/repository/UserRepository.java +++ b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/repository/UserRepository.java @@ -1,15 +1,12 @@ package com.baeldung.repository; -import com.baeldung.model.BasicUser; -import org.springframework.data.jpa.repository.EntityGraph; -import org.springframework.data.jpa.repository.JpaRepository; - import java.util.Optional; -public interface UserRepository extends JpaRepository<BasicUser, Long> { +import org.springframework.data.jpa.repository.JpaRepository; - @EntityGraph(attributePaths = "permissions") - Optional<BasicUser> findDetailedByUsername(String username); +import com.baeldung.model.BasicUser; + +public interface UserRepository extends JpaRepository<BasicUser, Long> { Optional<BasicUser> findSummaryByUsername(String username); diff --git a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index a986cc7e21..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.boot.Application; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/persistence-modules/spring-data-jpa-4/README.md b/persistence-modules/spring-data-jpa-4/README.md index 931455224f..63aec5c46b 100644 --- a/persistence-modules/spring-data-jpa-4/README.md +++ b/persistence-modules/spring-data-jpa-4/README.md @@ -1,6 +1,8 @@ ### Relevant Articles: - [Derived Query Methods in Spring Data JPA Repositories](https://www.baeldung.com/spring-data-derived-queries) - [LIKE Queries in Spring JPA Repositories](https://www.baeldung.com/spring-jpa-like-queries) +- [A Guide to Spring’s Open Session In View](https://www.baeldung.com/spring-open-session-in-view) +- [Programmatic Transaction Management in Spring](https://www.baeldung.com/spring-programmatic-transaction-management) ### Eclipse Config After importing the project into Eclipse, you may see the following error: diff --git a/persistence-modules/spring-data-jpa-4/pom.xml b/persistence-modules/spring-data-jpa-4/pom.xml index 2d06b52134..44b7c3c268 100644 --- a/persistence-modules/spring-data-jpa-4/pom.xml +++ b/persistence-modules/spring-data-jpa-4/pom.xml @@ -1,20 +1,23 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - - <groupId>com.baeldung</groupId> <artifactId>spring-data-jpa-4</artifactId> <name>spring-data-jpa-4</name> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-2</relativePath> </parent> <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> @@ -32,6 +35,4 @@ </dependency> </dependencies> - <properties> - </properties> </project> \ No newline at end of file diff --git a/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/spring/cloud/GatewayApplication.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/derivedquery/QueryApplication.java similarity index 59% rename from spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/spring/cloud/GatewayApplication.java rename to persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/derivedquery/QueryApplication.java index ba384749df..d7a1950305 100644 --- a/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/spring/cloud/GatewayApplication.java +++ b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/derivedquery/QueryApplication.java @@ -1,13 +1,13 @@ -package com.baeldung.spring.cloud; +package com.baeldung.derivedquery; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication -public class GatewayApplication { +public class QueryApplication { public static void main(String[] args) { - SpringApplication.run(GatewayApplication.class, args); + SpringApplication.run(QueryApplication.class, args); } -} \ No newline at end of file +} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/like/LikeApplication.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/like/LikeApplication.java new file mode 100644 index 0000000000..311aea3001 --- /dev/null +++ b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/like/LikeApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.like; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class LikeApplication { + + public static void main(String[] args) { + SpringApplication.run(LikeApplication.class, args); + } + +} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/OsivApplication.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/OsivApplication.java new file mode 100644 index 0000000000..4cfcf83e56 --- /dev/null +++ b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/OsivApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.osiv; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class OsivApplication { + + public static void main(String[] args) { + SpringApplication.run(OsivApplication.class, args); + } + +} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/model/BasicUser.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/model/BasicUser.java new file mode 100644 index 0000000000..98f4e379d4 --- /dev/null +++ b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/model/BasicUser.java @@ -0,0 +1,42 @@ +package com.baeldung.osiv.model; + +import javax.persistence.*; +import java.util.Set; + +@Entity +@Table(name = "users") +public class BasicUser { + + @Id + @GeneratedValue + private Long id; + + private String username; + + @ElementCollection + private Set<String> permissions; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public Set<String> getPermissions() { + return permissions; + } + + public void setPermissions(Set<String> permissions) { + this.permissions = permissions; + } +} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/repository/BasicUserRepository.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/repository/BasicUserRepository.java new file mode 100644 index 0000000000..e8d5955d91 --- /dev/null +++ b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/repository/BasicUserRepository.java @@ -0,0 +1,19 @@ +package com.baeldung.osiv.repository; + +import java.util.Optional; + +import org.springframework.data.jpa.repository.EntityGraph; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.baeldung.osiv.model.BasicUser; + +@Repository +@Transactional +public interface BasicUserRepository extends JpaRepository<BasicUser, Long> { + + @EntityGraph(attributePaths = "permissions") + Optional<BasicUser> findDetailedByUsername(String username); + +} diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/service/SimpleUserService.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/service/SimpleUserService.java similarity index 63% rename from persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/service/SimpleUserService.java rename to persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/service/SimpleUserService.java index 4bd1dc5e41..1de51678d5 100644 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/service/SimpleUserService.java +++ b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/service/SimpleUserService.java @@ -1,18 +1,19 @@ -package com.baeldung.service; +package com.baeldung.osiv.service; + +import java.util.Optional; -import com.baeldung.model.BasicUser; -import com.baeldung.repository.UserRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.Optional; +import com.baeldung.osiv.model.BasicUser; +import com.baeldung.osiv.repository.BasicUserRepository; @Service public class SimpleUserService implements UserService { - private final UserRepository userRepository; + private final BasicUserRepository userRepository; - public SimpleUserService(UserRepository userRepository) { + public SimpleUserService(BasicUserRepository userRepository) { this.userRepository = userRepository; } diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/service/UserService.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/service/UserService.java similarity index 59% rename from persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/service/UserService.java rename to persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/service/UserService.java index 34a07199b2..3d089fa41b 100644 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/service/UserService.java +++ b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/service/UserService.java @@ -1,6 +1,6 @@ -package com.baeldung.service; +package com.baeldung.osiv.service; -import com.baeldung.model.BasicUser; +import com.baeldung.osiv.model.BasicUser; import java.util.Optional; diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/web/DetailedUserDto.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/web/DetailedUserDto.java similarity index 92% rename from persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/web/DetailedUserDto.java rename to persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/web/DetailedUserDto.java index 95a4f6eb07..fd2882c2d5 100644 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/web/DetailedUserDto.java +++ b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/web/DetailedUserDto.java @@ -1,6 +1,6 @@ -package com.baeldung.web; +package com.baeldung.osiv.web; -import com.baeldung.model.BasicUser; +import com.baeldung.osiv.model.BasicUser; import java.util.Set; diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/web/UserController.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/web/UserController.java similarity index 91% rename from persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/web/UserController.java rename to persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/web/UserController.java index 867d60cc2f..5466b95166 100644 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/web/UserController.java +++ b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/web/UserController.java @@ -1,6 +1,6 @@ -package com.baeldung.web; +package com.baeldung.osiv.web; -import com.baeldung.service.UserService; +import com.baeldung.osiv.service.UserService; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/Application.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/tx/TxApplication.java similarity index 64% rename from persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/Application.java rename to persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/tx/TxApplication.java index 37dbe7dab8..4c982c91e9 100644 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/Application.java +++ b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/tx/TxApplication.java @@ -1,13 +1,13 @@ -package com.baeldung; +package com.baeldung.tx; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication -public class Application { +public class TxApplication { public static void main(String[] args) { - SpringApplication.run(Application.class, args); + SpringApplication.run(TxApplication.class, args); } } diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/model/Payment.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/tx/model/Payment.java similarity index 96% rename from persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/model/Payment.java rename to persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/tx/model/Payment.java index 2c24e5777e..921a1e9275 100644 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/model/Payment.java +++ b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/tx/model/Payment.java @@ -1,4 +1,4 @@ -package com.baeldung.model; +package com.baeldung.tx.model; import javax.persistence.*; diff --git a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/derivedquery/repository/UserRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/derivedquery/repository/UserRepositoryIntegrationTest.java index 22d2b7c00d..2a6e166b88 100644 --- a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/derivedquery/repository/UserRepositoryIntegrationTest.java +++ b/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/derivedquery/repository/UserRepositoryIntegrationTest.java @@ -1,11 +1,7 @@ package com.baeldung.derivedquery.repository; -import com.baeldung.Application; +import com.baeldung.derivedquery.QueryApplication; import com.baeldung.derivedquery.entity.User; -import com.baeldung.derivedquery.repository.UserRepository; -import java.time.ZonedDateTime; -import java.util.Arrays; -import java.util.List; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -14,10 +10,14 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; +import java.time.ZonedDateTime; +import java.util.Arrays; +import java.util.List; + import static org.junit.Assert.assertEquals; @RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) +@SpringBootTest(classes = QueryApplication.class) public class UserRepositoryIntegrationTest { private static final String USER_NAME_ADAM = "Adam"; diff --git a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/like/MovieRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/like/MovieRepositoryIntegrationTest.java index 99d7080792..cc96b638ab 100644 --- a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/like/MovieRepositoryIntegrationTest.java +++ b/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/like/MovieRepositoryIntegrationTest.java @@ -1,10 +1,7 @@ package com.baeldung.like; -import static org.junit.Assert.assertEquals; -import static org.springframework.test.context.jdbc.Sql.ExecutionPhase.AFTER_TEST_METHOD; - -import java.util.List; - +import com.baeldung.like.model.Movie; +import com.baeldung.like.repository.MovieRepository; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -12,12 +9,14 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.jdbc.Sql; import org.springframework.test.context.junit4.SpringRunner; -import com.baeldung.like.model.Movie; -import com.baeldung.like.repository.MovieRepository; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.springframework.test.context.jdbc.Sql.ExecutionPhase.AFTER_TEST_METHOD; @RunWith(SpringRunner.class) -@SpringBootTest @Sql(scripts = { "/test-movie-data.sql" }) +@SpringBootTest(classes = LikeApplication.class) @Sql(scripts = "/test-movie-cleanup.sql", executionPhase = AFTER_TEST_METHOD) public class MovieRepositoryIntegrationTest { @Autowired diff --git a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/osiv/UserControllerIntegrationTest.java b/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/osiv/UserControllerIntegrationTest.java similarity index 86% rename from persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/osiv/UserControllerIntegrationTest.java rename to persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/osiv/UserControllerIntegrationTest.java index 19fdf118ae..350b67e1c9 100644 --- a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/osiv/UserControllerIntegrationTest.java +++ b/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/osiv/UserControllerIntegrationTest.java @@ -1,7 +1,7 @@ package com.baeldung.osiv; -import com.baeldung.model.BasicUser; -import com.baeldung.repository.UserRepository; +import com.baeldung.osiv.model.BasicUser; +import com.baeldung.osiv.repository.BasicUserRepository; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.ContextConfiguration; import org.springframework.test.web.servlet.MockMvc; import java.util.Arrays; @@ -22,10 +23,11 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @SpringBootTest @AutoConfigureMockMvc @ActiveProfiles("test") +@ContextConfiguration(classes = OsivApplication.class) class UserControllerIntegrationTest { @Autowired - private UserRepository userRepository; + private BasicUserRepository userRepository; @Autowired private MockMvc mockMvc; diff --git a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/tx/ManualTransactionIntegrationTest.java b/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/tx/ManualTransactionIntegrationTest.java similarity index 93% rename from persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/tx/ManualTransactionIntegrationTest.java rename to persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/tx/ManualTransactionIntegrationTest.java index 1ce8e91ec5..01551348c9 100644 --- a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/tx/ManualTransactionIntegrationTest.java +++ b/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/tx/ManualTransactionIntegrationTest.java @@ -1,6 +1,6 @@ package com.baeldung.tx; -import com.baeldung.model.Payment; +import com.baeldung.tx.model.Payment; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -77,7 +77,7 @@ class ManualTransactionIntegrationTest { }); assertThat(entityManager - .createQuery("select p from Payment p") + .createQuery("select p from Payment p", Payment.class) .getResultList()).isEmpty(); } @@ -104,7 +104,7 @@ class ManualTransactionIntegrationTest { } assertThat(entityManager - .createQuery("select p from Payment p") + .createQuery("select p from Payment p", Payment.class) .getResultList()).isEmpty(); } @@ -122,7 +122,7 @@ class ManualTransactionIntegrationTest { }); assertThat(entityManager - .createQuery("select p from Payment p") + .createQuery("select p from Payment p", Payment.class) .getResultList()).hasSize(1); } @@ -145,7 +145,7 @@ class ManualTransactionIntegrationTest { } assertThat(entityManager - .createQuery("select p from Payment p") + .createQuery("select p from Payment p", Payment.class) .getResultList()).hasSize(1); } diff --git a/persistence-modules/spring-data-jpa-4/src/test/resources/application-test.properties b/persistence-modules/spring-data-jpa-4/src/test/resources/application-test.properties new file mode 100644 index 0000000000..f9497c8f37 --- /dev/null +++ b/persistence-modules/spring-data-jpa-4/src/test/resources/application-test.properties @@ -0,0 +1,2 @@ +spring.jpa.hibernate.ddl-auto=update +spring.datasource.url=jdbc:h2:mem:jpa3 \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa/pom.xml b/persistence-modules/spring-data-jpa/pom.xml index af92f331d1..27b8ce5eaf 100644 --- a/persistence-modules/spring-data-jpa/pom.xml +++ b/persistence-modules/spring-data-jpa/pom.xml @@ -3,13 +3,12 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-data-jpa</artifactId> - <name>spring-data-jpa</name> - + <name>spring-data-jpa</name> + <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-2</relativePath> </parent> @@ -58,9 +57,9 @@ <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> </dependency> <dependency> @@ -68,7 +67,7 @@ <artifactId>guava</artifactId> <version>${guava.version}</version> </dependency> - + <!-- JUnit Jupiter dependencies --> <dependency> <groupId>org.junit.jupiter</groupId> @@ -89,12 +88,12 @@ <scope>test</scope> </dependency> </dependencies> - + <properties> - <start-class>com.baeldung.boot.Application</start-class> - <testcontainers.postgresql.version>1.10.6</testcontainers.postgresql.version> - <postgresql.version>42.2.5</postgresql.version> - <guava.version>21.0</guava.version> + <start-class>com.baeldung.boot.Application</start-class> + <testcontainers.postgresql.version>1.10.6</testcontainers.postgresql.version> + <postgresql.version>42.2.5</postgresql.version> + <guava.version>21.0</guava.version> </properties> </project> \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index e885d0fe51..0000000000 --- a/persistence-modules/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.boot.Application; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/persistence-modules/spring-data-keyvalue/pom.xml b/persistence-modules/spring-data-keyvalue/pom.xml index 1fee0a88d4..b28773c414 100644 --- a/persistence-modules/spring-data-keyvalue/pom.xml +++ b/persistence-modules/spring-data-keyvalue/pom.xml @@ -1,12 +1,12 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-data-keyvalue</artifactId> - <name>spring-data-keyvalue</name> + <name>spring-data-keyvalue</name> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-2</relativePath> </parent> diff --git a/persistence-modules/spring-data-keyvalue/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-keyvalue/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index d28bdcbc89..0000000000 --- a/persistence-modules/spring-data-keyvalue/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.spring.data.keyvalue.SpringDataKeyValueApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringDataKeyValueApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/persistence-modules/spring-data-mongodb/pom.xml b/persistence-modules/spring-data-mongodb/pom.xml index 33ad3a5267..3f7c1cbcb9 100644 --- a/persistence-modules/spring-data-mongodb/pom.xml +++ b/persistence-modules/spring-data-mongodb/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -100,7 +101,6 @@ <mysema.maven.version>1.1.3</mysema.maven.version> <mongodb-reactivestreams.version>1.9.2</mongodb-reactivestreams.version> <projectreactor.version>3.2.0.RELEASE</projectreactor.version> - </properties> </project> diff --git a/persistence-modules/spring-data-neo4j/pom.xml b/persistence-modules/spring-data-neo4j/pom.xml index 1e5d51ddf2..625e2c5fc1 100644 --- a/persistence-modules/spring-data-neo4j/pom.xml +++ b/persistence-modules/spring-data-neo4j/pom.xml @@ -1,10 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-data-neo4j</artifactId> <version>1.0</version> - <name>spring-data-neo4j</name> - + <name>spring-data-neo4j</name> + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> diff --git a/persistence-modules/spring-data-neo4j/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-neo4j/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index ea32ed324b..0000000000 --- a/persistence-modules/spring-data-neo4j/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import com.baeldung.spring.data.neo4j.config.MovieDatabaseNeo4jTestConfiguration; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = MovieDatabaseNeo4jTestConfiguration.class) -@ActiveProfiles(profiles = "test") -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/persistence-modules/spring-data-redis/pom.xml b/persistence-modules/spring-data-redis/pom.xml index cd8c729844..a304108fee 100644 --- a/persistence-modules/spring-data-redis/pom.xml +++ b/persistence-modules/spring-data-redis/pom.xml @@ -1,15 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-data-redis</artifactId> <version>1.0</version> <name>spring-data-redis</name> <packaging>jar</packaging> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-2</relativePath> </parent> diff --git a/persistence-modules/spring-data-redis/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-redis/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index f5c8177cbe..0000000000 --- a/persistence-modules/spring-data-redis/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.baeldung; - -import com.baeldung.spring.data.redis.config.RedisConfig; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import redis.embedded.RedisServerBuilder; - -import static org.springframework.test.annotation.DirtiesContext.ClassMode.BEFORE_CLASS; - -@RunWith(SpringJUnit4ClassRunner.class) -@DirtiesContext(classMode = BEFORE_CLASS) -@ContextConfiguration(classes = RedisConfig.class) -public class SpringContextIntegrationTest { - - private static redis.embedded.RedisServer redisServer; - - @BeforeClass - public static void startRedisServer() { - redisServer = new RedisServerBuilder().port(6379).setting("maxmemory 256M").build(); - redisServer.start(); - } - - @AfterClass - public static void stopRedisServer() { - redisServer.stop(); - } - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/persistence-modules/spring-data-solr/pom.xml b/persistence-modules/spring-data-solr/pom.xml index 82539b0ca8..1a17a2e321 100644 --- a/persistence-modules/spring-data-solr/pom.xml +++ b/persistence-modules/spring-data-solr/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-data-solr</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-data-solr</name> diff --git a/persistence-modules/spring-data-solr/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-solr/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index e76967ae8a..0000000000 --- a/persistence-modules/spring-data-solr/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import com.baeldung.spring.data.solr.config.SolrConfig; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = SolrConfig.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/persistence-modules/spring-hibernate-3/pom.xml b/persistence-modules/spring-hibernate-3/pom.xml index 4349492370..e677776a95 100644 --- a/persistence-modules/spring-hibernate-3/pom.xml +++ b/persistence-modules/spring-hibernate-3/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-hibernate-3</artifactId> <version>0.1-SNAPSHOT</version> <name>spring-hibernate-3</name> diff --git a/persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index a81a4eedb1..0000000000 --- a/persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.baeldung.spring.PersistenceConfig; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/persistence-modules/spring-hibernate-5/pom.xml b/persistence-modules/spring-hibernate-5/pom.xml index 694ab570a5..546dcb1ce0 100644 --- a/persistence-modules/spring-hibernate-5/pom.xml +++ b/persistence-modules/spring-hibernate-5/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-hibernate-5</artifactId> <version>0.1-SNAPSHOT</version> <name>spring-hibernate-5</name> @@ -151,7 +151,6 @@ <!-- util --> <guava.version>21.0</guava.version> - </properties> </project> diff --git a/persistence-modules/spring-hibernate-5/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-hibernate-5/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index af4618d0f3..0000000000 --- a/persistence-modules/spring-hibernate-5/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import com.baeldung.spring.PersistenceConfig; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/persistence-modules/spring-hibernate4/pom.xml b/persistence-modules/spring-hibernate4/pom.xml index c22342a34a..41c7fdb098 100644 --- a/persistence-modules/spring-hibernate4/pom.xml +++ b/persistence-modules/spring-hibernate4/pom.xml @@ -1,20 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-hibernate4</artifactId> <version>0.1-SNAPSHOT</version> <name>spring-hibernate4</name> <parent> - <artifactId>parent-spring-4</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-spring-4</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-spring-4</relativePath> </parent> <dependencies> - <!-- Spring --> <dependency> diff --git a/persistence-modules/spring-hibernate4/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index af4618d0f3..0000000000 --- a/persistence-modules/spring-hibernate4/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import com.baeldung.spring.PersistenceConfig; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/persistence-modules/spring-jpa/pom.xml b/persistence-modules/spring-jpa/pom.xml index 792f3918b6..4972a20cf6 100644 --- a/persistence-modules/spring-jpa/pom.xml +++ b/persistence-modules/spring-jpa/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-jpa</artifactId> <version>0.1-SNAPSHOT</version> diff --git a/persistence-modules/spring-jpa/src/test/java/com/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-jpa/src/test/java/com/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 9b0cdf180f..0000000000 --- a/persistence-modules/spring-jpa/src/test/java/com/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung; - -import org.baeldung.config.PersistenceJPAConfig; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; -import org.springframework.test.context.web.WebAppConfiguration; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceJPAConfig.class }, loader = AnnotationConfigContextLoader.class) -@WebAppConfiguration -@DirtiesContext -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/persistence-modules/spring-mybatis/pom.xml b/persistence-modules/spring-mybatis/pom.xml index 9946c937c8..40d4d915ab 100644 --- a/persistence-modules/spring-mybatis/pom.xml +++ b/persistence-modules/spring-mybatis/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-mybatis</artifactId> <version>0.1-SNAPSHOT</version> <name>spring-mybatis</name> @@ -108,7 +108,6 @@ <!-- testing --> <assertj-core.version>3.8.0</assertj-core.version> - </properties> </project> diff --git a/persistence-modules/spring-persistence-simple/pom.xml b/persistence-modules/spring-persistence-simple/pom.xml index f0cf8e49d5..3ecb9c3d7d 100644 --- a/persistence-modules/spring-persistence-simple/pom.xml +++ b/persistence-modules/spring-persistence-simple/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-persistence-simple</artifactId> <version>0.1-SNAPSHOT</version> @@ -130,7 +131,7 @@ </execution> </executions> </plugin> - </plugins> + </plugins> </build> <properties> diff --git a/play-framework/websockets/app/actors/Messenger.java b/play-framework/websockets/app/actors/Messenger.java new file mode 100644 index 0000000000..1c9335b82e --- /dev/null +++ b/play-framework/websockets/app/actors/Messenger.java @@ -0,0 +1,111 @@ +package actors; + +import akka.actor.AbstractActor; +import akka.actor.ActorRef; +import akka.actor.PoisonPill; +import akka.actor.Props; +import akka.event.Logging; +import akka.event.LoggingAdapter; +import akka.http.javadsl.Http; +import akka.http.javadsl.marshallers.jackson.Jackson; +import akka.http.javadsl.model.HttpMessage; +import akka.http.javadsl.model.HttpRequest; +import akka.http.javadsl.model.HttpResponse; +import akka.stream.Materializer; +import com.fasterxml.jackson.databind.JsonNode; +import dto.MessageDTO; +import dto.RequestDTO; +import utils.MessageConverter; + +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.UUID; +import java.util.concurrent.CompletionStage; +import java.util.concurrent.ThreadLocalRandom; + +public class Messenger extends AbstractActor { + private LoggingAdapter log = Logging.getLogger(getContext().getSystem(), this); + + private ActorRef out; + + public Messenger(ActorRef out) { + this.out = out; + } + + public static Props props(ActorRef out) { + return Props.create(Messenger.class, () -> new Messenger(out)); + } + + @Override + public void preStart() throws Exception { + log.info("Messenger actor started at {}", + OffsetDateTime.now().format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)); + } + + @Override + public void postStop() throws Exception { + log.info("Messenger actor stopped at {}", + OffsetDateTime.now().format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)); + } + + private void onSendMessage(JsonNode jsonNode) { + RequestDTO requestDTO = MessageConverter.jsonNodeToRequest(jsonNode); + String message = requestDTO.getMessage().toLowerCase(); + if("stop".equals(message)) { + MessageDTO messageDTO = createMessageDTO("1", "1", "Stop", "Stopping actor"); + out.tell(MessageConverter.messageToJsonNode(messageDTO), getSelf()); + self().tell(PoisonPill.getInstance(), getSelf()); + } else { + log.info("Actor received. {}", requestDTO); + processMessage(requestDTO); + } + } + + private MessageDTO createMessageDTO(String userId, String id, String title, String message) { + MessageDTO messageDTO = new MessageDTO(); + messageDTO.setUserId(UUID.randomUUID().toString()); + messageDTO.setId(UUID.randomUUID().toString()); + messageDTO.setTitle("Self Kill"); + messageDTO.setBody("Stopping actor"); + return messageDTO; + } + + private void processMessage(RequestDTO requestDTO) { + CompletionStage<HttpResponse> responseFuture = getRandomMessage(); + responseFuture.thenCompose(this::consumeHttpResponse) + .thenAccept(messageDTO -> + out.tell(MessageConverter.messageToJsonNode(messageDTO), getSelf())); + } + + private CompletionStage<HttpResponse> getRandomMessage() { + int postId = ThreadLocalRandom.current().nextInt(0, 100); + return Http.get(getContext().getSystem()).singleRequest( + HttpRequest.create("https://jsonplaceholder.typicode.com/posts/" + postId) + ); + } + + private void discardEntity(HttpResponse httpResponse, Materializer materializer) { + httpResponse.discardEntityBytes(materializer) + .completionStage() + .whenComplete((done, ex) -> log.info("Entity discarded completely!")); + } + + private CompletionStage<MessageDTO> consumeHttpResponse(HttpResponse httpResponse) { + Materializer materializer = Materializer.matFromSystem(getContext().getSystem()); + return Jackson.unmarshaller(MessageDTO.class) + .unmarshal(httpResponse.entity(), materializer) + .thenApply(messageDTO -> { + log.info("Received message: {}", messageDTO); + discardEntity(httpResponse, materializer); + return messageDTO; + }); + } + + @Override + public Receive createReceive() { + return receiveBuilder() + .match(JsonNode.class, this::onSendMessage) + .matchAny(o -> log.error("Received unknown message: {}", o.getClass())) + .build(); + } +} diff --git a/play-framework/websockets/app/controllers/HomeController.java b/play-framework/websockets/app/controllers/HomeController.java new file mode 100644 index 0000000000..39c670fe59 --- /dev/null +++ b/play-framework/websockets/app/controllers/HomeController.java @@ -0,0 +1,79 @@ +package controllers; + +import actors.Messenger; +import akka.actor.ActorSystem; +import akka.stream.Materializer; +import akka.stream.javadsl.Flow; +import akka.stream.javadsl.Sink; +import akka.stream.javadsl.Source; +import com.fasterxml.jackson.databind.JsonNode; +import dto.MessageDTO; +import lombok.extern.slf4j.Slf4j; +import play.libs.F; +import play.libs.streams.ActorFlow; +import play.mvc.*; +import utils.MessageConverter; + +import javax.inject.Inject; + +import java.time.Duration; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionStage; + +@Slf4j +public class HomeController extends Controller { + private ActorSystem actorSystem; + private Materializer materializer; + + @Inject + public HomeController(ActorSystem actorSystem, Materializer materializer) { + this.actorSystem = actorSystem; + this.materializer = materializer; + } + + public Result index(Http.Request request) { + String url = routes.HomeController.socket().webSocketURL(request); + //To test WebSockets with akka streams, uncomment the next line and comment out the previous + //String url = routes.HomeController.akkaStreamsSocket().webSocketURL(request); + return ok(views.html.index.render(url)); + } + + + public WebSocket socket() { + return WebSocket.Json.acceptOrResult(this::createActorFlow); + } + + private CompletionStage<F.Either<Result, Flow<JsonNode, JsonNode, ?>>> createActorFlow( + Http.RequestHeader request) { + return CompletableFuture.completedFuture(F.Either.Right(createFlowForActor())); + } + + private CompletionStage<F.Either<Result, Flow<JsonNode, JsonNode, ?>>> + createActorFlow2(Http.RequestHeader request) { + return CompletableFuture.completedFuture( + request.session() + .getOptional("username") + .map(username -> + F.Either.<Result, Flow<JsonNode, JsonNode, ?>>Right( + createFlowForActor())) + .orElseGet(() -> F.Either.Left(forbidden()))); + } + + private Flow<JsonNode, JsonNode, ?> createFlowForActor() { + return ActorFlow.actorRef(out -> Messenger.props(out), actorSystem, materializer); + } + + public WebSocket akkaStreamsSocket() { + return WebSocket.Json.accept( + request -> { + Sink<JsonNode, ?> in = Sink.foreach(System.out::println); + MessageDTO messageDTO = new MessageDTO("1", "1", "Title", "Test Body"); + Source<JsonNode, ?> out = Source.tick( + Duration.ofSeconds(2), + Duration.ofSeconds(2), + MessageConverter.messageToJsonNode(messageDTO) + ); + return Flow.fromSinkAndSource(in, out); + }); + } +} diff --git a/play-framework/websockets/app/dto/MessageDTO.java b/play-framework/websockets/app/dto/MessageDTO.java new file mode 100644 index 0000000000..e6b2bac1af --- /dev/null +++ b/play-framework/websockets/app/dto/MessageDTO.java @@ -0,0 +1,60 @@ +package dto; + +public class MessageDTO { + private String userId; + private String id; + private String title; + private String body; + + public MessageDTO() { + } + + public MessageDTO(String userId, String id, String title, String body) { + this.userId = userId; + this.id = id; + this.title = title; + this.body = body; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getBody() { + return body; + } + + public void setBody(String body) { + this.body = body; + } + + @Override + public String toString() { + return "MessageDTO{" + + "userId='" + userId + '\'' + + ", id='" + id + '\'' + + ", title='" + title + '\'' + + ", body='" + body + '\'' + + '}'; + } +} diff --git a/play-framework/websockets/app/dto/RequestDTO.java b/play-framework/websockets/app/dto/RequestDTO.java new file mode 100644 index 0000000000..a85d3770a4 --- /dev/null +++ b/play-framework/websockets/app/dto/RequestDTO.java @@ -0,0 +1,27 @@ +package dto; + +public class RequestDTO { + private String message; + + public RequestDTO() { + } + + public RequestDTO(String message) { + this.message = message; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + @Override + public String toString() { + return "RequestDTO{" + + "message='" + message + '\'' + + '}'; + } +} diff --git a/play-framework/websockets/app/utils/MessageConverter.java b/play-framework/websockets/app/utils/MessageConverter.java new file mode 100644 index 0000000000..85729cd1da --- /dev/null +++ b/play-framework/websockets/app/utils/MessageConverter.java @@ -0,0 +1,24 @@ +package utils; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import dto.MessageDTO; +import dto.RequestDTO; + +public class MessageConverter { + private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); + public static MessageDTO jsonNodeToMessage(JsonNode jsonNode) { + return OBJECT_MAPPER.convertValue(jsonNode, MessageDTO.class); + } + + public static JsonNode messageToJsonNode(MessageDTO messageDTO) { + return OBJECT_MAPPER.convertValue(messageDTO, JsonNode.class); + } + public static RequestDTO jsonNodeToRequest(JsonNode jsonNode) { + return OBJECT_MAPPER.convertValue(jsonNode, RequestDTO.class); + } + + public static JsonNode requestToJsonNode(RequestDTO requestDTO) { + return OBJECT_MAPPER.convertValue(requestDTO, JsonNode.class); + } +} diff --git a/play-framework/websockets/app/views/index.scala.html b/play-framework/websockets/app/views/index.scala.html new file mode 100644 index 0000000000..b837fc6f74 --- /dev/null +++ b/play-framework/websockets/app/views/index.scala.html @@ -0,0 +1,97 @@ +@(url: String) +@main("Welcome to Play") { + <h1>Welcome to Play WebSockets!</h1> + <div id="messageContent"></div> + <form> + <textarea id="messageInput"></textarea> + <button id="sendButton">Send</button> + </form> + + <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script> + + <script> + var webSocket; + var messageInput; + + function init() { + initWebSocket(); + } + + function initWebSocket() { + webSocket = new WebSocket("@url"); + webSocket.onopen = onOpen; + webSocket.onclose = onClose; + webSocket.onmessage = onMessage; + webSocket.onerror = onError; + } + + function onOpen(evt) { + writeToScreen("CONNECTED"); + } + + function onClose(evt) { + writeToScreen("DISCONNECTED"); + appendMessageToView(":", "DISCONNECTED"); + } + + function onError(evt) { + writeToScreen("ERROR: " + evt.data); + writeToScreen("ERROR: " + JSON.stringify(evt)); + } + + function onMessage(evt) { + var receivedData = JSON.parse(evt.data); + console.log("New Data: ", receivedData); + appendMessageToView("Server", receivedData.body); + } + + function appendMessageToView(title, message) { + $("#messageContent").append("<p>" + title + ": " + message + "</p>"); + } + + function writeToScreen(message) { + console.log("New message: ", message); + } + + function doSend(protocolMessage) { + if(webSocket.readyState == WebSocket.OPEN) { + writeToScreen("SENT: " + protocolMessage.message); + webSocket.send(JSON.stringify(protocolMessage)); + } else { + writeToScreen("Could not send data. Websocket is not open."); + } + } + + window.addEventListener("load", init, false); + + + $(".sendButton").click(function () { + console.log("Submitting."); + newMessage(); + }); + + $(window).on("keydown", function (e) { + if (e.which == 13) { + console.log("Enter pressed."); + newMessage(); + return false; + } + }); + + function newMessage() { + messageInput = $("#messageInput").val(); + $("#messageInput").val(""); + if ($.trim(messageInput) == "") { + return false; + } + + appendMessageToView("Me", messageInput); + + var message = { + message: messageInput + }; + + doSend(message); + } + </script> +} diff --git a/play-framework/websockets/app/views/main.scala.html b/play-framework/websockets/app/views/main.scala.html new file mode 100644 index 0000000000..be5dd8f09d --- /dev/null +++ b/play-framework/websockets/app/views/main.scala.html @@ -0,0 +1,14 @@ +@(title: String)(content: Html) + +<!DOCTYPE html> +<html lang="en"> + <head> + <title>@title</title> + <link rel="stylesheet" media="screen" href="@routes.Assets.versioned("stylesheets/main.css")"> + <link rel="shortcut icon" type="image/png" href="@routes.Assets.versioned("images/favicon.png")"> + </head> + <body> + @content + <script src="@routes.Assets.versioned("javascripts/main.js")" type="text/javascript"></script> + </body> +</html> diff --git a/play-framework/websockets/build.sbt b/play-framework/websockets/build.sbt new file mode 100644 index 0000000000..a076daa4f0 --- /dev/null +++ b/play-framework/websockets/build.sbt @@ -0,0 +1,22 @@ +name := """websockets""" +organization := "com.baeldung" + +version := "1.0-SNAPSHOT" + +lazy val root = (project in file(".")).enablePlugins(PlayJava) + +scalaVersion := "2.13.0" + +lazy val akkaVersion = "2.6.0-M8" +lazy val akkaHttpVersion = "10.1.10" + +libraryDependencies += guice +libraryDependencies += "com.typesafe.akka" %% "akka-actor" % akkaVersion +libraryDependencies += "com.typesafe.akka" %% "akka-testkit" % akkaVersion +libraryDependencies += "com.typesafe.akka" %% "akka-stream" % akkaVersion +libraryDependencies += "com.typesafe.akka" %% "akka-http-jackson" % akkaHttpVersion +libraryDependencies += "com.typesafe.akka" %% "akka-http" % akkaHttpVersion +libraryDependencies += "org.projectlombok" % "lombok" % "1.18.8" % "provided" +libraryDependencies += "junit" % "junit" % "4.12" + +PlayKeys.devSettings += "play.server.http.idleTimeout" -> "infinite" diff --git a/play-framework/websockets/conf/application.conf b/play-framework/websockets/conf/application.conf new file mode 100644 index 0000000000..87cb978051 --- /dev/null +++ b/play-framework/websockets/conf/application.conf @@ -0,0 +1,7 @@ +# This is the main configuration file for the application. +# https://www.playframework.com/documentation/latest/ConfigFile +######################################## +# akka-http-core Reference Config File # +######################################## + +play.server.http.idleTimeout = "infinite" \ No newline at end of file diff --git a/play-framework/websockets/conf/logback.xml b/play-framework/websockets/conf/logback.xml new file mode 100644 index 0000000000..8efb66cda3 --- /dev/null +++ b/play-framework/websockets/conf/logback.xml @@ -0,0 +1,37 @@ +<!-- https://www.playframework.com/documentation/latest/SettingsLogger --> +<configuration> + + <conversionRule conversionWord="coloredLevel" converterClass="play.api.libs.logback.ColoredLevel" /> + + <appender name="FILE" class="ch.qos.logback.core.FileAppender"> + <file>${application.home:-.}/logs/application.log</file> + <encoder> + <pattern>%date [%level] from %logger in %thread - %message%n%xException</pattern> + </encoder> + </appender> + + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>%coloredLevel %logger{15} - %message%n%xException{10}</pattern> + </encoder> + </appender> + + <appender name="ASYNCFILE" class="ch.qos.logback.classic.AsyncAppender"> + <appender-ref ref="FILE" /> + </appender> + + <appender name="ASYNCSTDOUT" class="ch.qos.logback.classic.AsyncAppender"> + <appender-ref ref="STDOUT" /> + </appender> + + <logger name="akka" level="INFO" /> + <logger name="actors" level="INFO"/> + <logger name="play" level="INFO" /> + <logger name="application" level="DEBUG" /> + + <root level="WARN"> + <appender-ref ref="ASYNCFILE" /> + <appender-ref ref="ASYNCSTDOUT" /> + </root> + +</configuration> diff --git a/play-framework/websockets/conf/routes b/play-framework/websockets/conf/routes new file mode 100644 index 0000000000..674aba00bd --- /dev/null +++ b/play-framework/websockets/conf/routes @@ -0,0 +1,11 @@ +# Routes +# This file defines all application routes (Higher priority routes first) +# ~~~~ + +# An example controller showing a sample home page +GET / controllers.HomeController.index(request: Request) +GET /chat controllers.HomeController.socket +GET /chat/with/streams controllers.HomeController.akkaStreamsSocket + +# Map static resources from the /public folder to the /assets URL path +GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset) diff --git a/play-framework/websockets/project/build.properties b/play-framework/websockets/project/build.properties new file mode 100644 index 0000000000..c0bab04941 --- /dev/null +++ b/play-framework/websockets/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.2.8 diff --git a/play-framework/websockets/project/plugins.sbt b/play-framework/websockets/project/plugins.sbt new file mode 100644 index 0000000000..1c8c62a0d5 --- /dev/null +++ b/play-framework/websockets/project/plugins.sbt @@ -0,0 +1,7 @@ +// The Play plugin +addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.3") + +// Defines scaffolding (found under .g8 folder) +// http://www.foundweekends.org/giter8/scaffolding.html +// sbt "g8Scaffold form" +addSbtPlugin("org.foundweekends.giter8" % "sbt-giter8-scaffold" % "0.11.0") diff --git a/play-framework/websockets/public/images/favicon.png b/play-framework/websockets/public/images/favicon.png new file mode 100644 index 0000000000..c7d92d2ae4 Binary files /dev/null and b/play-framework/websockets/public/images/favicon.png differ diff --git a/spring-security-thymeleaf/src/main/resources/application.properties b/play-framework/websockets/public/javascripts/main.js similarity index 100% rename from spring-security-thymeleaf/src/main/resources/application.properties rename to play-framework/websockets/public/javascripts/main.js diff --git a/play-framework/websockets/public/stylesheets/main.css b/play-framework/websockets/public/stylesheets/main.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/play-framework/websockets/test/controllers/HomeControllerTest.java b/play-framework/websockets/test/controllers/HomeControllerTest.java new file mode 100644 index 0000000000..b006feab8c --- /dev/null +++ b/play-framework/websockets/test/controllers/HomeControllerTest.java @@ -0,0 +1,32 @@ +package controllers; + +import org.junit.Test; +import play.Application; +import play.inject.guice.GuiceApplicationBuilder; +import play.mvc.Http; +import play.mvc.Result; +import play.test.WithApplication; + +import static org.junit.Assert.assertEquals; +import static play.mvc.Http.Status.OK; +import static play.test.Helpers.GET; +import static play.test.Helpers.route; + +public class HomeControllerTest extends WithApplication { + + @Override + protected Application provideApplication() { + return new GuiceApplicationBuilder().build(); + } + + @Test + public void giveRequest_whenRootPath_ThenStatusOkay() { + Http.RequestBuilder request = new Http.RequestBuilder() + .method(GET) + .uri("/"); + + Result result = route(app, request); + assertEquals(OK, result.status()); + } + +} diff --git a/podman/Dockerfile b/podman/Dockerfile new file mode 100644 index 0000000000..8eee766e42 --- /dev/null +++ b/podman/Dockerfile @@ -0,0 +1,4 @@ +FROM centos:latest +RUN yum -y install httpd +CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"] +EXPOSE 80 diff --git a/pom.xml b/pom.xml index c279862ce2..cfb3fe1889 100644 --- a/pom.xml +++ b/pom.xml @@ -1,8 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> @@ -341,6 +341,7 @@ <module>algorithms-miscellaneous-4</module> <module>algorithms-miscellaneous-5</module> <module>algorithms-sorting</module> + <module>algorithms-searching</module> <module>animal-sniffer-mvn-plugin</module> <module>annotations</module> <module>antlr</module> @@ -358,6 +359,7 @@ <module>apache-shiro</module> <module>apache-solrj</module> <module>apache-spark</module> + <module>apache-tapestry</module> <module>apache-thrift</module> <module>apache-tika</module> <module>apache-velocity</module> @@ -452,6 +454,7 @@ <module>core-java-modules/core-java</module> <module>core-java-modules/core-java-jar</module> <module>core-java-modules/core-java-jvm</module> + <module>core-kotlin-modules</module> <module>core-scala</module> <module>couchbase</module> <module>custom-pmd</module> @@ -482,7 +485,7 @@ <module>guava-io</module> <module>guava-collections</module> <module>guava-collections-map</module> - <module>guava-collections-set</module> + <module>guava-collections-set</module> <module>guava-modules</module> <!-- <module>guest</module> --> <!-- not to be built as its for guest articles --> <module>guice</module> @@ -497,17 +500,21 @@ <module>immutables</module> <module>jackson</module> - <module>jackson-2</module> <module>jackson-simple</module> + <module>jackson-annotations</module> + <module>jackson-exceptions</module> + <module>jackson-conversions</module> + <module>jackson-conversions-2</module> + <module>jackson-custom-conversions</module> <module>java-collections-conversions</module> <module>java-collections-conversions-2</module> <module>java-collections-maps</module> <module>java-collections-maps-2</module> <module>java-jdi</module> - <!--<module>java-dates</module>--> <!-- <module>java-ee-8-security-api</module> --> <!-- long running --> <module>java-lite</module> <module>java-math</module> + <module>java-math-2</module> <!-- Added for BAEL-3506 --> <module>java-numbers</module> <module>java-numbers-2</module> <module>java-rmi</module> @@ -549,8 +556,8 @@ <module>libraries-data</module> <module>libraries-data-2</module> <module>libraries-data-db</module> - <module>libraries-data-io</module> - <module>libraries-apache-commons</module> + <module>libraries-data-io</module> + <module>libraries-apache-commons</module> <module>libraries-apache-commons-collections</module> <module>libraries-apache-commons-io</module> <module>libraries-primitive</module> @@ -567,6 +574,7 @@ <module>mapstruct</module> <!-- <module>maven-all/compiler-plugin-java-9</module> --> <!-- We haven't upgraded to java 9. --> <module>maven-all/maven</module> + <module>maven-all/maven-custom-plugin/counter-maven-plugin</module> <module>maven-all/maven-war-plugin</module> <module>maven-all/profiles</module> <module>maven-all/versions-maven-plugin</module> @@ -583,6 +591,7 @@ <module>mustache</module> <module>mybatis</module> + <module>netflix</module> <module>optaplanner</module> <module>orika</module> @@ -615,18 +624,20 @@ <module>tensorflow-java</module> <module>spf4j</module> <module>spring-boot-config-jpa-error</module> - <module>spring-boot-flowable</module> + <module>spring-boot-flowable</module> <module>spring-boot-mvc-2</module> <module>spring-boot-performance</module> <module>spring-boot-properties</module> <!-- <module>spring-mvc-basics</module> --> <!-- Compilation failure --> - <module>spring-security-kerberos</module> + <module>spring-security-modules/spring-security-kerberos</module> <module>oauth2-framework-impl</module> <module>spring-boot-nashorn</module> <module>java-blockchain</module> <module>machine-learning</module> + <module>webrtc</module> <module>wildfly</module> + <module>quarkus-extension</module> </modules> </profile> @@ -662,6 +673,8 @@ </build> <modules> + <module>netflix</module> + <module>parent-boot-1</module> <module>parent-boot-2</module> <module>parent-spring-4</module> @@ -703,7 +716,7 @@ <module>spring-boot-camel</module> <!-- <module>spring-boot-cli</module> --> <!-- Not a maven project --> <module>spring-boot-config-jpa-error</module> - <module>spring-boot-client</module> + <module>spring-boot-client</module> <module>spring-boot-crud</module> <module>spring-boot-ctx-fluent</module> @@ -716,10 +729,10 @@ <module>spring-boot-mvc</module> <module>spring-boot-mvc-birt</module> <module>spring-boot-environment</module> - <module>spring-boot-deployment</module> - <module>spring-boot-runtime</module> - <module>spring-boot-runtime/disabling-console-jul</module> - <module>spring-boot-runtime/disabling-console-log4j2</module> + <module>spring-boot-deployment</module> + <module>spring-boot-runtime</module> + <module>spring-boot-runtime/disabling-console-jul</module> + <module>spring-boot-runtime/disabling-console-log4j2</module> <module>spring-boot-runtime/disabling-console-logback</module> <module>spring-boot-artifacts</module> <module>spring-boot-rest</module> @@ -742,7 +755,7 @@ <module>spring-core</module> <module>spring-core-2</module> <module>spring-core-3</module> - <module>spring-cucumber</module> + <module>spring-cucumber</module> <module>spring-data-rest</module> <module>spring-data-rest-querydsl</module> @@ -774,12 +787,13 @@ <module>spring-mobile</module> <module>spring-mockito</module> <module>spring-mvc-basics-2</module> - <module>spring-mvc-forms-jsp</module> + <module>spring-mvc-forms-jsp</module> <module>spring-mvc-forms-thymeleaf</module> <module>spring-mvc-java</module> <module>spring-mvc-kotlin</module> <module>spring-mvc-simple</module> <module>spring-mvc-simple-2</module> + <module>spring-mvc-views</module> <module>spring-mvc-velocity</module> <module>spring-mvc-webflow</module> <module>spring-mvc-xml</module> @@ -792,42 +806,42 @@ <module>spring-reactive-kotlin</module> <module>spring-reactor</module> <module>spring-remoting</module> - <module>spring-rest</module> + <module>spring-rest-http</module> <module>spring-rest-angular</module> <module>spring-rest-compress</module> - <module>spring-rest-full</module> + <module>spring-rest-testing</module> <module>spring-rest-hal-browser</module> <module>spring-rest-query-language</module> <module>spring-rest-shell</module> <module>spring-rest-simple</module> <module>spring-resttemplate</module> <module>spring-roo</module> - <module>spring-scheduling</module><module>spring-security-acl</module> - <module>spring-security-angular/server</module> - <module>spring-security-cache-control</module> - - <module>spring-security-core</module> - <module>spring-security-mvc-boot</module> - <module>spring-security-mvc-custom</module> - <module>spring-security-mvc-digest-auth</module> - <module>spring-security-mvc-jsonview</module> - <module>spring-security-mvc-ldap</module> - <module>spring-security-mvc-login</module> - <module>spring-security-mvc-persisted-remember-me</module> - <module>spring-security-mvc</module> - <module>spring-security-mvc-socket</module> - <module>spring-security-openid</module> + <module>spring-scheduling</module> + <module>spring-security-modules/spring-security-acl</module> + <module>spring-security-modules/spring-security-angular/server</module> + <module>spring-security-modules/spring-security-cache-control</module> + <module>spring-security-modules/spring-security-core</module> + <module>spring-security-modules/spring-security-mvc</module> + <module>spring-security-modules/spring-security-mvc-boot</module> + <module>spring-security-modules/spring-security-mvc-custom</module> + <module>spring-security-modules/spring-security-mvc-digest-auth</module> + <module>spring-security-modules/spring-security-mvc-jsonview</module> + <module>spring-security-modules/spring-security-mvc-ldap</module> + <module>spring-security-modules/spring-security-mvc-login</module> + <module>spring-security-modules/spring-security-mvc-persisted-remember-me</module> + <module>spring-security-modules/spring-security-mvc-socket</module> + <module>spring-security-modules/spring-security-openid</module> <!--<module>spring-security-react</module> --> <!-- fails on Travis, fails intermittently on the new Jenkins (01.12.2018) BAEL-10834 --> - <module>spring-security-rest</module> - <module>spring-security-rest-basic-auth</module> - <module>spring-security-rest-custom</module> - <module>spring-security-sso</module> - <module>spring-security-stormpath</module> - <module>spring-security-thymeleaf</module> - <module>spring-security-x509</module> + <module>spring-security-modules/spring-security-rest</module> + <module>spring-security-modules/spring-security-rest-basic-auth</module> + <module>spring-security-modules/spring-security-rest-custom</module> + <module>spring-security-modules/spring-security-sso</module> + <module>spring-security-modules/spring-security-stormpath</module> + <module>spring-security-modules/spring-security-thymeleaf</module> + <module>spring-security-modules/spring-security-x509</module> <module>spring-session</module> <module>spring-shell</module> - <module>spring-sleuth</module> + <module>spring-sleuth</module> <module>spring-soap</module> <module>spring-social-login</module> <module>spring-spel</module> @@ -842,8 +856,6 @@ <module>spring-webflux-amqp</module> <!-- long --> - <module>spring-zuul</module> - <module>static-analysis</module> <module>stripe</module> <module>structurizr</module> @@ -868,151 +880,10 @@ <module>tensorflow-java</module> <module>spring-boot-flowable</module> - <module>spring-security-kerberos</module> + <module>spring-security-modules/spring-security-kerberos</module> <module>spring-boot-nashorn</module> <module>java-blockchain</module> - - </modules> - - </profile> - - <profile> - <id>spring-context</id> - <build> - <plugins> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>${maven-surefire-plugin.version}</version> - <configuration> - <forkCount>3</forkCount> - <reuseForks>true</reuseForks> - <includes> - <include>**/*SpringContextIntegrationTest.java</include> - </includes> - </configuration> - </plugin> - - </plugins> - </build> - - <modules> - <module>spring-5</module> - <module>spring-5-data-reactive</module> - <module>spring-5-reactive</module> - <module>spring-5-reactive-2</module> - <module>spring-5-reactive-client</module> - <module>spring-5-reactive-security</module> - <module>spring-5-security</module> - <module>spring-5-security-oauth</module> - <module>spring-5-security-cognito</module> - <module>spring-activiti</module> - <module>spring-akka</module> - <module>spring-aop</module> - <module>spring-apache-camel</module> - <module>spring-batch</module> - <module>spring-bom</module> - <module>spring-boot-admin</module> - <module>spring-boot-bootstrap</module> - <module>spring-boot-bootstrap</module> - <module>spring-boot-camel</module> - <module>spring-boot-client</module> - <module>spring-boot-custom-starter</module> - <module>spring-boot-di</module> - <module>greeter-spring-boot-autoconfigure</module> - <module>greeter-spring-boot-sample-app</module> - <module>spring-boot-jasypt</module> - <module>spring-boot-keycloak</module> - <module>spring-boot-mvc</module> - <module>spring-boot-property-exp</module> - <module>spring-boot-springdoc</module> - <module>spring-boot-vue</module> - <module>spring-cloud</module> - <module>spring-cloud/spring-cloud-archaius/basic-config</module> - <module>spring-cloud/spring-cloud-archaius/extra-configs</module> - <module>spring-cloud/spring-cloud-bootstrap/config</module> - <module>spring-cloud/spring-cloud-contract</module> - <module>spring-cloud/spring-cloud-gateway</module> - <module>spring-cloud/spring-cloud-kubernetes/demo-backend</module> - <module>spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server</module> - <module>spring-cloud/spring-cloud-ribbon-client </module> - <module>spring-cloud/spring-cloud-security</module> - <module>spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit</module> - <module>spring-cloud/spring-cloud-task/springcloudtasksink</module> - <module>spring-cloud/spring-cloud-zookeeper </module> - <module>spring-cloud/spring-cloud-bus/spring-cloud-config-server</module> - <module>spring-cloud/spring-cloud-data-flow/log-sink</module> - <module>spring-cloud/spring-cloud-data-flow/time-processor</module> - <module>spring-cloud/spring-cloud-data-flow/time-source</module> - <module>spring-cucumber</module> - <module>spring-data-rest</module> - <module>spring-dispatcher-servlet</module> - <module>spring-drools</module> - <module>spring-di</module> - <module>spring-ehcache</module> - <module>spring-freemarker</module> - <module>spring-integration</module> - <module>spring-jenkins-pipeline</module> - <module>spring-jersey</module> - <module>spring-jinq</module> - <module>spring-jms</module> - <module>spring-kafka</module> - <module>spring-katharsis</module> - <module>spring-ldap</module> - <module>spring-mobile</module> - <module>spring-mockito</module> - <module>spring-mvc-forms-thymeleaf</module> - <module>spring-mvc-java</module> - <module>spring-mvc-velocity</module> - <module>spring-mvc-webflow</module> - <module>spring-protobuf</module> - <module>spring-quartz</module> - <module>remoting-hessian-burlap/spring-remoting-hessian-burlap-client</module> - <module>remoting-hessian-burlap/remoting-hessian-burlap-server</module> - <module>spring-reactor</module> - <module>spring-remoting/</module> - <module>spring-remoting/remoting-http/remoting-http-server</module> - <module>spring-remoting/remoting-jms/remoting-jms-client</module> - <module>spring-remoting/remoting-rmi/remoting-rmi-server</module> - <module>spring-rest</module> - <module>spring-rest-angular</module> - <module>spring-rest-compress</module> - <module>spring-rest-full</module> - <module>spring-rest-simple</module> - <module>spring-resttemplate</module> - <module>spring-security-acl</module> - <module>spring-security-angular</module> - <module>spring-security-cache-control</module> - <module>spring-security-core</module> - <module>spring-security-mvc-boot</module> - <module>spring-security-mvc-custom</module> - <module>spring-security-mvc-digest-auth</module> - <module>spring-security-mvc-ldap</module> - <module>spring-security-mvc-persisted-remember-me</module> - <module>spring-security-mvc</module> - <module>spring-security-mvc-socket</module> - <module>spring-security-rest</module> - <module>spring-security-sso</module> - <module>spring-security-thymeleaf/spring-security-thymeleaf-authentication</module> - <module>spring-security-thymeleaf/spring-security-thymeleaf-authorize</module> - <module>spring-security-thymeleaf/spring-security-thymeleaf-config</module> - <module>spring-security-x509</module> - <module>spring-session/spring-session-jdbc</module> - <module>spring-sleuth</module> - <module>spring-social-login</module> - <module>spring-spel</module> - <module>spring-state-machine</module> - <module>spring-swagger-codegen/spring-swagger-codegen-app</module> - <module>spring-thymeleaf</module> - <module>spring-vault</module> - <module>spring-vertx</module> - <module>spring-zuul/spring-zuul-foos-resource</module> - - <module>spring-boot-flowable</module> - <module>spring-security-kerberos</module> - <module>spring-boot-nashorn</module> </modules> </profile> @@ -1058,9 +929,8 @@ <module>core-java-modules/core-java-concurrency-advanced</module> <!-- very long running? --> <module>core-java-modules/core-java-concurrency-advanced-2</module> <module>core-java-modules/core-java-concurrency-advanced-3</module> - <module>core-kotlin</module> <!-- long running? --> + <module>core-kotlin</module> <!-- long running? --> <module>core-kotlin-2</module> - <module>core-kotlin-io</module> <module>jenkins/plugins</module> <module>jhipster</module> @@ -1117,6 +987,7 @@ <module>algorithms-miscellaneous-4</module> <module>algorithms-miscellaneous-5</module> <module>algorithms-sorting</module> + <module>algorithms-searching</module> <module>animal-sniffer-mvn-plugin</module> <module>annotations</module> <module>antlr</module> @@ -1134,6 +1005,7 @@ <module>apache-shiro</module> <module>apache-solrj</module> <module>apache-spark</module> + <module>apache-tapestry</module> <module>apache-thrift</module> <module>apache-tika</module> <module>apache-velocity</module> @@ -1199,7 +1071,7 @@ <module>core-java-modules/core-java-nio</module> <module>core-java-modules/core-java-nio-2</module> <module>core-java-modules/core-java-security</module> - <module>core-java-modules/core-java-exceptions</module> + <module>core-java-modules/core-java-exceptions</module> <module>core-java-modules/core-java-lang-syntax</module> <module>core-java-modules/core-java-lang-syntax-2</module> <module>core-java-modules/core-java-lang</module> @@ -1220,6 +1092,7 @@ <module>core-java-modules/core-java-string-algorithms-2</module> <module>core-java-modules/core-java-string-apis</module> <module>core-java-modules/core-java-strings</module> + <module>core-kotlin-modules</module> <module>core-scala</module> <module>couchbase</module> <module>custom-pmd</module> @@ -1250,7 +1123,7 @@ <module>guava-io</module> <module>guava-collections</module> <module>guava-collections-map</module> - <module>guava-collections-set</module> + <module>guava-collections-set</module> <module>guava-modules</module> <!-- <module>guest</module> --> <!-- not to be built as its for guest articles --> <module>guice</module> @@ -1265,17 +1138,21 @@ <module>immutables</module> <module>jackson</module> - <module>jackson-2</module> <module>jackson-simple</module> + <module>jackson-annotations</module> + <module>jackson-exceptions</module> + <module>jackson-conversions</module> + <module>jackson-conversions-2</module> + <module>jackson-custom-conversions</module> <module>java-collections-conversions</module> <module>java-collections-conversions-2</module> <module>java-collections-maps</module> <module>java-collections-maps-2</module> <module>java-jdi</module> - <!-- <module>java-dates</module> --> <!-- We haven't upgraded to java 9. Fixing in BAEL-10841 --> <module>java-ee-8-security-api</module> <module>java-lite</module> <module>java-math</module> + <module>java-math-2</module> <!-- Added for BAEL-3506 --> <module>java-numbers</module> <module>java-numbers-2</module> <module>java-rmi</module> @@ -1315,8 +1192,8 @@ <module>libraries-data</module> <module>libraries-data-2</module> <module>libraries-data-db</module> - <module>libraries-data-io</module> - <module>libraries-apache-commons</module> + <module>libraries-data-io</module> + <module>libraries-apache-commons</module> <module>libraries-apache-commons-collections</module> <module>libraries-apache-commons-io</module> <module>libraries-testing</module> @@ -1331,6 +1208,7 @@ <module>mapstruct</module> <!-- <module>maven-all/compiler-plugin-java-9</module> --> <!-- We haven't upgraded to java 9. --> <module>maven-all/maven</module> + <module>maven-all/maven-custom-plugin/counter-maven-plugin</module> <module>maven-all/maven-war-plugin</module> <module>maven-all/profiles</module> <module>maven-all/versions-maven-plugin</module> @@ -1348,6 +1226,7 @@ <module>mustache</module> <module>mybatis</module> + <module>netflix</module> <module>optaplanner</module> <module>orika</module> @@ -1457,10 +1336,10 @@ <module>spring-boot-mvc</module> <module>spring-boot-mvc-birt</module> <module>spring-boot-environment</module> - <module>spring-boot-deployment</module> - <module>spring-boot-runtime</module> - <module>spring-boot-runtime/disabling-console-jul</module> - <module>spring-boot-runtime/disabling-console-log4j2</module> + <module>spring-boot-deployment</module> + <module>spring-boot-runtime</module> + <module>spring-boot-runtime/disabling-console-jul</module> + <module>spring-boot-runtime/disabling-console-log4j2</module> <module>spring-boot-runtime/disabling-console-logback</module> <module>spring-boot-artifacts</module> <module>spring-boot-rest</module> @@ -1479,7 +1358,7 @@ <module>spring-core</module> <module>spring-core-2</module> <module>spring-core-3</module> - <module>spring-cucumber</module> + <module>spring-cucumber</module> <module>spring-data-rest</module> <module>spring-data-rest-querydsl</module> @@ -1511,12 +1390,13 @@ <module>spring-mobile</module> <module>spring-mockito</module> <module>spring-mvc-basics-2</module> - <module>spring-mvc-forms-jsp</module> + <module>spring-mvc-forms-jsp</module> <module>spring-mvc-forms-thymeleaf</module> <module>spring-mvc-java</module> <module>spring-mvc-kotlin</module> <module>spring-mvc-simple</module> <module>spring-mvc-simple-2</module> + <module>spring-mvc-views</module> <module>spring-mvc-velocity</module> <module>spring-mvc-webflow</module> <module>spring-mvc-xml</module> @@ -1529,10 +1409,10 @@ <module>spring-reactive-kotlin</module> <module>spring-reactor</module> <module>spring-remoting</module> - <module>spring-rest</module> + <module>spring-rest-http</module> <module>spring-rest-angular</module> <module>spring-rest-compress</module> - <module>spring-rest-full</module> + <module>spring-rest-testing</module> <module>spring-rest-hal-browser</module> <module>spring-rest-query-language</module> <module>spring-rest-shell</module> @@ -1541,29 +1421,29 @@ <module>spring-roo</module> <module>spring-scheduling</module> - <module>spring-security-acl</module> - <module>spring-security-angular/server</module> - <module>spring-security-cache-control</module> - <module>spring-security-core</module> - <module>spring-security-mvc-boot</module> - <module>spring-security-mvc-custom</module> - <module>spring-security-mvc-digest-auth</module> - <module>spring-security-mvc-ldap</module> - <module>spring-security-mvc-login</module> - <module>spring-security-mvc-persisted-remember-me</module> - <module>spring-security-mvc</module> - <module>spring-security-mvc-socket</module> - <module>spring-security-openid</module> + <module>spring-security-modules/spring-security-acl</module> + <module>spring-security-modules/spring-security-angular/server</module> + <module>spring-security-modules/spring-security-cache-control</module> + <module>spring-security-modules/spring-security-core</module> + <module>spring-security-modules/spring-security-mvc</module> + <module>spring-security-modules/spring-security-mvc-boot</module> + <module>spring-security-modules/spring-security-mvc-custom</module> + <module>spring-security-modules/spring-security-mvc-digest-auth</module> + <module>spring-security-modules/spring-security-mvc-ldap</module> + <module>spring-security-modules/spring-security-mvc-login</module> + <module>spring-security-modules/spring-security-mvc-persisted-remember-me</module> + <module>spring-security-modules/spring-security-mvc-socket</module> + <module>spring-security-modules/spring-security-openid</module> <!--<module>spring-security-react</module> --> <!-- fails on Travis, fails intermittently on the new Jenkins (01.12.2018) BAEL-10834 --> - <module>spring-security-rest</module> - <module>spring-security-rest-basic-auth</module> - <module>spring-security-rest-custom</module> - <module>spring-security-sso</module> - <module>spring-security-stormpath</module> - <module>spring-security-thymeleaf</module> - <module>spring-security-x509</module> + <module>spring-security-modules/spring-security-rest</module> + <module>spring-security-modules/spring-security-rest-basic-auth</module> + <module>spring-security-modules/spring-security-rest-custom</module> + <module>spring-security-modules/spring-security-sso</module> + <module>spring-security-modules/spring-security-stormpath</module> + <module>spring-security-modules/spring-security-thymeleaf</module> + <module>spring-security-modules/spring-security-x509</module> <module>spring-session</module> - <module>spring-shell</module> + <module>spring-shell</module> <module>spring-sleuth</module> <module>spring-soap</module> <module>spring-social-login</module> @@ -1579,8 +1459,6 @@ <module>spring-webflux-amqp</module> <!-- long --> - <module>spring-zuul</module> - <module>static-analysis</module> <module>stripe</module> <module>structurizr</module> @@ -1591,7 +1469,7 @@ <module>twilio</module> <module>twitter4j</module> - <module>undertow</module> + <!-- <module>undertow</module> --> <!-- 19.11.2019 - disabling temporarily as it's causing a major issue with the build (TODO: create a jira to fix it) --> <module>vertx</module> <module>vertx-and-rxjava</module> @@ -1651,7 +1529,7 @@ <module>libraries</module> <!-- very long running --> <module>persistence-modules/hibernate5</module> - <module>persistence-modules/hibernate-mapping</module> + <module>persistence-modules/hibernate-mapping</module> <module>persistence-modules/java-jpa</module> <module>persistence-modules/java-jpa-2</module> <module>persistence-modules/java-mongodb</module> @@ -1663,7 +1541,6 @@ </profile> - </profiles> <reporting> @@ -1734,4 +1611,3 @@ </properties> </project> - diff --git a/protobuffer/pom.xml b/protobuffer/pom.xml index d9e6cb26e4..e57495e93c 100644 --- a/protobuffer/pom.xml +++ b/protobuffer/pom.xml @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>protobuffer</artifactId> - <name>protobuffer</name> - + <name>protobuffer</name> + <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> diff --git a/quarkus-extension/pom.xml b/quarkus-extension/pom.xml new file mode 100644 index 0000000000..38d7c3d548 --- /dev/null +++ b/quarkus-extension/pom.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>com.baeldung.quarkus.extension</groupId> + <artifactId>quarkus-extension</artifactId> + <version>1.0-SNAPSHOT</version> + <name>quarkus-extension</name> + <packaging>pom</packaging> + + <modules> + <module>quarkus-liquibase</module> + <module>quarkus-app</module> + </modules> + +</project> diff --git a/quarkus-extension/quarkus-app/pom.xml b/quarkus-extension/quarkus-app/pom.xml new file mode 100644 index 0000000000..6e4cce3ae7 --- /dev/null +++ b/quarkus-extension/quarkus-app/pom.xml @@ -0,0 +1,76 @@ +<?xml version="1.0"?> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + <groupId>com.baeldung.quarkus.app</groupId> + <artifactId>quarkus-app</artifactId> + <version>1.0-SNAPSHOT</version> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-universe-bom</artifactId> + <version>${quarkus.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <dependency> + <groupId>com.baeldung.quarkus.liquibase</groupId> + <artifactId>quarkus-liquibase</artifactId> + <version>1.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-jdbc-h2</artifactId> + <version>${quarkus.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-maven-plugin</artifactId> + <version>${quarkus.version}</version> + <executions> + <execution> + <goals> + <goal>build</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <version>${compiler-plugin.version}</version> + </plugin> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <version>${surefire-plugin.version}</version> + <configuration> + <systemProperties> + <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> + </systemProperties> + </configuration> + </plugin> + </plugins> + </build> + + <properties> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <surefire-plugin.version>2.22.0</surefire-plugin.version> + <maven.compiler.parameters>true</maven.compiler.parameters> + <quarkus.version>1.0.0.Final</quarkus.version> + <compiler-plugin.version>3.8.1</compiler-plugin.version> + <maven.compiler.source>1.8</maven.compiler.source> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <maven.compiler.target>1.8</maven.compiler.target> + </properties> + +</project> diff --git a/quarkus-extension/quarkus-app/src/main/resources/application.properties b/quarkus-extension/quarkus-app/src/main/resources/application.properties new file mode 100644 index 0000000000..cd18d5a6d2 --- /dev/null +++ b/quarkus-extension/quarkus-app/src/main/resources/application.properties @@ -0,0 +1,10 @@ +# configure datasource +#quarkus.datasource.url=jdbc:h2:tcp://localhost/~/test +quarkus.datasource.url=jdbc:h2:mem:testdb +quarkus.datasource.driver=org.h2.Driver +quarkus.datasource.username=sa +quarkus.datasource.password= + +#quarkus +quarkus.liquibase.change-log=db/liquibase-changelog-master.xml + diff --git a/quarkus-extension/quarkus-app/src/main/resources/db/liquibase-changelog-master.xml b/quarkus-extension/quarkus-app/src/main/resources/db/liquibase-changelog-master.xml new file mode 100644 index 0000000000..befef39140 --- /dev/null +++ b/quarkus-extension/quarkus-app/src/main/resources/db/liquibase-changelog-master.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<databaseChangeLog + xmlns="http://www.liquibase.org/xml/ns/dbchangelog" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd"> + + <changeSet id="1" author="baeldung"> + <createTable tableName="person"> + <column name="id" type="int" autoIncrement="true"> + <constraints primaryKey="true" nullable="false"/> + </column> + <column name="firstname" type="varchar(50)"/> + <column name="lastname" type="varchar(50)"> + <constraints nullable="false"/> + </column> + <column name="state" type="char(2)"/> + </createTable> + </changeSet> + +</databaseChangeLog> \ No newline at end of file diff --git a/quarkus-extension/quarkus-liquibase/deployment/pom.xml b/quarkus-extension/quarkus-liquibase/deployment/pom.xml new file mode 100644 index 0000000000..f005ac4e8c --- /dev/null +++ b/quarkus-extension/quarkus-liquibase/deployment/pom.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>quarkus-liquibase-deployment</artifactId> + <name>quarkus-liquibase-deployment</name> + + <parent> + <groupId>com.baeldung.quarkus.liquibase</groupId> + <artifactId>quarkus-liquibase-parent</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + + <dependencies> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-core-deployment</artifactId> + <version>${quarkus.version}</version> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-arc-deployment</artifactId> + <version>${quarkus.version}</version> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-agroal-deployment</artifactId> + <version>${quarkus.version}</version> + </dependency> + <dependency> + <groupId>com.baeldung.quarkus.liquibase</groupId> + <artifactId>quarkus-liquibase</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.1</version> + <configuration> + <annotationProcessorPaths> + <path> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-extension-processor</artifactId> + <version>${quarkus.version}</version> + </path> + </annotationProcessorPaths> + </configuration> + </plugin> + </plugins> + </build> + +</project> \ No newline at end of file diff --git a/quarkus-extension/quarkus-liquibase/deployment/src/main/java/com/baeldung/quarkus/liquibase/LiquibaseProcessor.java b/quarkus-extension/quarkus-liquibase/deployment/src/main/java/com/baeldung/quarkus/liquibase/LiquibaseProcessor.java new file mode 100644 index 0000000000..3aff2eb105 --- /dev/null +++ b/quarkus-extension/quarkus-liquibase/deployment/src/main/java/com/baeldung/quarkus/liquibase/LiquibaseProcessor.java @@ -0,0 +1,40 @@ +package com.baeldung.quarkus.liquibase; + +import io.quarkus.agroal.deployment.DataSourceInitializedBuildItem; +import io.quarkus.arc.deployment.AdditionalBeanBuildItem; +import io.quarkus.arc.deployment.BeanContainerBuildItem; +import io.quarkus.arc.deployment.BeanContainerListenerBuildItem; +import io.quarkus.deployment.annotations.BuildProducer; +import io.quarkus.deployment.annotations.BuildStep; +import io.quarkus.deployment.annotations.ExecutionTime; +import io.quarkus.deployment.annotations.Record; +import io.quarkus.deployment.builditem.FeatureBuildItem; +import liquibase.exception.LiquibaseException; + +public class LiquibaseProcessor { + + private LiquibaseConfig liquibaseConfig; + + @Record(ExecutionTime.STATIC_INIT) + @BuildStep + void build(BuildProducer<AdditionalBeanBuildItem> additionalBeanProducer, + BuildProducer<FeatureBuildItem> featureProducer, + LiquibaseRecorder recorder, + BuildProducer<BeanContainerListenerBuildItem> containerListenerProducer, + DataSourceInitializedBuildItem dataSourceInitializedBuildItem) { + + featureProducer.produce(new FeatureBuildItem("liquibase")); + + AdditionalBeanBuildItem unremovableProducer = AdditionalBeanBuildItem.unremovableOf(LiquibaseProducer.class); + additionalBeanProducer.produce(unremovableProducer); + + containerListenerProducer.produce( + new BeanContainerListenerBuildItem(recorder.setLiquibaseConfig(liquibaseConfig))); + } + + @Record(ExecutionTime.RUNTIME_INIT) + @BuildStep + void processMigration(LiquibaseRecorder recorder, BeanContainerBuildItem beanContainer) throws LiquibaseException { + recorder.migrate(beanContainer.getValue()); + } +} diff --git a/quarkus-extension/quarkus-liquibase/pom.xml b/quarkus-extension/quarkus-liquibase/pom.xml new file mode 100644 index 0000000000..e1f3e243ab --- /dev/null +++ b/quarkus-extension/quarkus-liquibase/pom.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>com.baeldung.quarkus.liquibase</groupId> + <artifactId>quarkus-liquibase-parent</artifactId> + <version>1.0-SNAPSHOT</version> + <name>quarkus-liquibase-parent</name> + <packaging>pom</packaging> + + <modules> + <module>runtime</module> + <module>deployment</module> + </modules> + + <properties> + <maven.compiler.source>1.8</maven.compiler.source> + <maven.compiler.target>1.8</maven.compiler.target> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <quarkus.version>1.0.0.Final</quarkus.version> + </properties> + +</project> \ No newline at end of file diff --git a/quarkus-extension/quarkus-liquibase/runtime/pom.xml b/quarkus-extension/quarkus-liquibase/runtime/pom.xml new file mode 100644 index 0000000000..a1d705c691 --- /dev/null +++ b/quarkus-extension/quarkus-liquibase/runtime/pom.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>quarkus-liquibase-runtime</artifactId> + <name>quarkus-liquibase-runtime</name> + + <parent> + <groupId>com.baeldung.quarkus.liquibase</groupId> + <artifactId>quarkus-liquibase-parent</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + + <dependencies> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-core</artifactId> + <version>${quarkus.version}</version> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-agroal</artifactId> + <version>${quarkus.version}</version> + </dependency> + <dependency> + <groupId>org.liquibase</groupId> + <artifactId>liquibase-core</artifactId> + <version>3.8.1</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-bootstrap-maven-plugin</artifactId> + <version>${quarkus.version}</version> + <executions> + <execution> + <goals> + <goal>extension-descriptor</goal> + </goals> + <configuration> + <deployment>${project.groupId}:${project.artifactId}-deployment:${project.version} + </deployment> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.1</version> + <configuration> + <annotationProcessorPaths> + <path> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-extension-processor</artifactId> + <version>${quarkus.version}</version> + </path> + </annotationProcessorPaths> + </configuration> + </plugin> + </plugins> + </build> + +</project> \ No newline at end of file diff --git a/quarkus-extension/quarkus-liquibase/runtime/src/main/java/com/baeldung/quarkus/liquibase/LiquibaseConfig.java b/quarkus-extension/quarkus-liquibase/runtime/src/main/java/com/baeldung/quarkus/liquibase/LiquibaseConfig.java new file mode 100644 index 0000000000..ebf42030f6 --- /dev/null +++ b/quarkus-extension/quarkus-liquibase/runtime/src/main/java/com/baeldung/quarkus/liquibase/LiquibaseConfig.java @@ -0,0 +1,14 @@ +package com.baeldung.quarkus.liquibase; + +import io.quarkus.runtime.annotations.ConfigItem; +import io.quarkus.runtime.annotations.ConfigPhase; +import io.quarkus.runtime.annotations.ConfigRoot; + +@ConfigRoot(name = "liquibase", phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED) +public final class LiquibaseConfig { + /** + * master change log file + */ + @ConfigItem + public String changeLog; +} \ No newline at end of file diff --git a/quarkus-extension/quarkus-liquibase/runtime/src/main/java/com/baeldung/quarkus/liquibase/LiquibaseProducer.java b/quarkus-extension/quarkus-liquibase/runtime/src/main/java/com/baeldung/quarkus/liquibase/LiquibaseProducer.java new file mode 100644 index 0000000000..4fa6608ef7 --- /dev/null +++ b/quarkus-extension/quarkus-liquibase/runtime/src/main/java/com/baeldung/quarkus/liquibase/LiquibaseProducer.java @@ -0,0 +1,32 @@ +package com.baeldung.quarkus.liquibase; + +import io.agroal.api.AgroalDataSource; +import liquibase.Liquibase; +import liquibase.database.jvm.JdbcConnection; +import liquibase.resource.ClassLoaderResourceAccessor; +import liquibase.resource.ResourceAccessor; + +import javax.enterprise.context.ApplicationScoped; +import javax.enterprise.inject.Produces; +import javax.inject.Inject; + +@ApplicationScoped +public class LiquibaseProducer { + + @Inject + AgroalDataSource dataSource; + + private LiquibaseConfig liquibaseConfig; + + @Produces + public Liquibase produceLiquibase() throws Exception { + ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); + ResourceAccessor classLoaderResourceAccessor = new ClassLoaderResourceAccessor(classLoader); + Liquibase liquibase = new Liquibase(liquibaseConfig.changeLog, classLoaderResourceAccessor, new JdbcConnection(dataSource.getConnection())); + return liquibase; + } + + public void setLiquibaseConfig(LiquibaseConfig liquibaseConfig) { + this.liquibaseConfig = liquibaseConfig; + } +} \ No newline at end of file diff --git a/quarkus-extension/quarkus-liquibase/runtime/src/main/java/com/baeldung/quarkus/liquibase/LiquibaseRecorder.java b/quarkus-extension/quarkus-liquibase/runtime/src/main/java/com/baeldung/quarkus/liquibase/LiquibaseRecorder.java new file mode 100644 index 0000000000..dc237df7ea --- /dev/null +++ b/quarkus-extension/quarkus-liquibase/runtime/src/main/java/com/baeldung/quarkus/liquibase/LiquibaseRecorder.java @@ -0,0 +1,25 @@ +package com.baeldung.quarkus.liquibase; + +import io.quarkus.arc.runtime.BeanContainer; +import io.quarkus.arc.runtime.BeanContainerListener; +import io.quarkus.runtime.annotations.Recorder; +import liquibase.Contexts; +import liquibase.Liquibase; +import liquibase.exception.LiquibaseException; + +@Recorder +public class LiquibaseRecorder { + + public BeanContainerListener setLiquibaseConfig(LiquibaseConfig liquibaseConfig) { + return beanContainer -> { + LiquibaseProducer producer = beanContainer.instance(LiquibaseProducer.class); + producer.setLiquibaseConfig(liquibaseConfig); + }; + } + + public void migrate(BeanContainer container) throws LiquibaseException { + Liquibase liquibase = container.instance(Liquibase.class); + liquibase.update(new Contexts()); + } + +} diff --git a/quarkus/pom.xml b/quarkus/pom.xml index 31e3c8f8a0..de4c2ca9a3 100644 --- a/quarkus/pom.xml +++ b/quarkus/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.quarkus</groupId> <artifactId>quarkus</artifactId> @@ -12,14 +12,7 @@ <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> - - <properties> - <surefire-plugin.version>2.22.0</surefire-plugin.version> - <quarkus.version>0.15.0</quarkus.version> - <maven.compiler.source>1.8</maven.compiler.source> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <maven.compiler.target>1.8</maven.compiler.target> - </properties> + <dependencyManagement> <dependencies> <dependency> @@ -31,6 +24,7 @@ </dependency> </dependencies> </dependencyManagement> + <dependencies> <dependency> <groupId>io.quarkus</groupId> @@ -47,6 +41,7 @@ <scope>test</scope> </dependency> </dependencies> + <build> <plugins> <plugin> @@ -72,6 +67,7 @@ </plugin> </plugins> </build> + <profiles> <profile> <id>native</id> @@ -118,4 +114,13 @@ </build> </profile> </profiles> + + <properties> + <surefire-plugin.version>2.22.0</surefire-plugin.version> + <quarkus.version>0.15.0</quarkus.version> + <maven.compiler.source>1.8</maven.compiler.source> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <maven.compiler.target>1.8</maven.compiler.target> + </properties> + </project> diff --git a/rabbitmq/pom.xml b/rabbitmq/pom.xml index b620248cfc..b544da4c44 100644 --- a/rabbitmq/pom.xml +++ b/rabbitmq/pom.xml @@ -1,9 +1,7 @@ -<?xml version="1.0"?> +<?xml version="1.0" encoding="UTF-8"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>rabbitmq</artifactId> <version>0.1-SNAPSHOT</version> <name>rabbitmq</name> diff --git a/ratpack/pom.xml b/ratpack/pom.xml index 0df313c05e..a00be905ee 100644 --- a/ratpack/pom.xml +++ b/ratpack/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>ratpack</artifactId> <version>1.0-SNAPSHOT</version> <name>ratpack</name> @@ -27,17 +27,17 @@ <version>${ratpack.version}</version> </dependency> <dependency> - <groupId>org.codehaus.groovy</groupId> - <artifactId>groovy-sql</artifactId> - <version>${groovy.sql.version}</version> - </dependency> + <groupId>org.codehaus.groovy</groupId> + <artifactId>groovy-sql</artifactId> + <version>${groovy.sql.version}</version> + </dependency> <dependency> <groupId>io.ratpack</groupId> <artifactId>ratpack-hikari</artifactId> <version>${ratpack.version}</version> </dependency> <dependency> - <groupId>io.ratpack</groupId> + <groupId>io.ratpack</groupId> <artifactId>ratpack-groovy-test</artifactId> <version>${ratpack.test.latest.version}</version> </dependency> @@ -104,4 +104,5 @@ <groovy.sql.version>2.4.15</groovy.sql.version> <ratpack.test.latest.version>1.6.1</ratpack.test.latest.version> </properties> + </project> diff --git a/reactor-core/pom.xml b/reactor-core/pom.xml index 66c634e113..c9917d14df 100644 --- a/reactor-core/pom.xml +++ b/reactor-core/pom.xml @@ -1,11 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.baeldung</groupId> <artifactId>reactor-core</artifactId> <version>0.0.1-SNAPSHOT</version> - <name>reactor-core</name> - + <name>reactor-core</name> + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> diff --git a/resteasy/pom.xml b/resteasy/pom.xml index 8aea8077f9..ffb6adb3df 100644 --- a/resteasy/pom.xml +++ b/resteasy/pom.xml @@ -2,10 +2,9 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>resteasy</artifactId> <version>1.0</version> - <name>resteasy</name> + <name>resteasy</name> <packaging>war</packaging> <parent> @@ -28,7 +27,6 @@ </exclusions> </dependency> - <dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-client</artifactId> @@ -49,17 +47,15 @@ <version>${resteasy.version}</version> </dependency> - <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>${commons-io.version}</version> </dependency> - </dependencies> <build> - <finalName>RestEasyTutorial</finalName> + <finalName>resteasy</finalName> <plugins> <plugin> <groupId>org.codehaus.cargo</groupId> @@ -98,7 +94,7 @@ <configuration> <excludes> <exclude>**/*IntegrationTest.java</exclude> - <exclude>**/*IntTest.java</exclude> + <exclude>**/*IntTest.java</exclude> </excludes> <includes> <include>**/*LiveTest.java</include> diff --git a/restx/pom.xml b/restx/pom.xml index 10c843a208..17c25fcdc0 100644 --- a/restx/pom.xml +++ b/restx/pom.xml @@ -7,8 +7,8 @@ <version>0.1-SNAPSHOT</version> <name>restx</name> <packaging>war</packaging> - - <parent> + + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> @@ -114,7 +114,7 @@ <scope>test</scope> </dependency> </dependencies> - + <build> <plugins> <plugin> @@ -153,4 +153,5 @@ <restx.version>0.35-rc4</restx.version> <logback-classic.version>1.2.3</logback-classic.version> </properties> + </project> diff --git a/rsocket/pom.xml b/rsocket/pom.xml index d2182719c2..70f21064b6 100644 --- a/rsocket/pom.xml +++ b/rsocket/pom.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>rsocket</artifactId> <version>0.0.1-SNAPSHOT</version> @@ -56,9 +57,10 @@ <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <archetype-packaging.version>3.0.1</archetype-packaging.version> - <rsocket.version>0.11.13</rsocket.version> - <hamcrest.version>1.3</hamcrest.version> - <logback.version>1.2.3</logback.version> - <slf4j-api.version>1.7.25</slf4j-api.version> + <rsocket.version>0.11.13</rsocket.version> + <hamcrest.version>1.3</hamcrest.version> + <logback.version>1.2.3</logback.version> + <slf4j-api.version>1.7.25</slf4j-api.version> </properties> + </project> diff --git a/rule-engines/easy-rules/pom.xml b/rule-engines/easy-rules/pom.xml index 369451c56c..c1ba829045 100644 --- a/rule-engines/easy-rules/pom.xml +++ b/rule-engines/easy-rules/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.easyrules</groupId> <artifactId>easy-rules</artifactId> @@ -24,4 +25,5 @@ <properties> <easy-rules.version>3.0.0</easy-rules.version> </properties> + </project> diff --git a/rule-engines/openl-tablets/pom.xml b/rule-engines/openl-tablets/pom.xml index b19ec8d3f1..d1c7baabcc 100644 --- a/rule-engines/openl-tablets/pom.xml +++ b/rule-engines/openl-tablets/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.openltablets</groupId> <artifactId>openl-tablets</artifactId> diff --git a/rule-engines/pom.xml b/rule-engines/pom.xml index 2ce82ed22b..cc015c600b 100644 --- a/rule-engines/pom.xml +++ b/rule-engines/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>rule-engines</artifactId> <name>rule-engines</name> diff --git a/rule-engines/rulebook/pom.xml b/rule-engines/rulebook/pom.xml index 5e0b900bd9..b021adea10 100644 --- a/rule-engines/rulebook/pom.xml +++ b/rule-engines/rulebook/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.rulebook</groupId> <artifactId>rulebook</artifactId> diff --git a/rxjava-core/pom.xml b/rxjava-core/pom.xml index 401ad83808..daec1f783f 100644 --- a/rxjava-core/pom.xml +++ b/rxjava-core/pom.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>rxjava-core</artifactId> <version>1.0-SNAPSHOT</version> - <name>rxjava-core</name> - + <name>rxjava-core</name> + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-java</artifactId> diff --git a/rxjava-libraries/pom.xml b/rxjava-libraries/pom.xml index 541d9116c8..45c1907a58 100644 --- a/rxjava-libraries/pom.xml +++ b/rxjava-libraries/pom.xml @@ -45,7 +45,6 @@ <artifactId>assertj-core</artifactId> <version>${assertj.version}</version> </dependency> - </dependencies> <properties> diff --git a/rxjava-observables/pom.xml b/rxjava-observables/pom.xml index c2bf0bcd88..3cedfc4afc 100644 --- a/rxjava-observables/pom.xml +++ b/rxjava-observables/pom.xml @@ -29,7 +29,6 @@ <artifactId>assertj-core</artifactId> <version>${assertj.version}</version> </dependency> - </dependencies> <properties> diff --git a/saas/pom.xml b/saas/pom.xml index 35de34ea72..be5d18f020 100644 --- a/saas/pom.xml +++ b/saas/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>saas</artifactId> <version>0.1.0-SNAPSHOT</version> <name>saas</name> @@ -10,8 +10,8 @@ <parent> <groupId>com.baeldung</groupId> <artifactId>parent-java</artifactId> - <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-java</relativePath> + <version>0.0.1-SNAPSHOT</version> + <relativePath>../parent-java</relativePath> </parent> <dependencies> diff --git a/software-security/sql-injection-samples/pom.xml b/software-security/sql-injection-samples/pom.xml index 5c3256319e..6cacaa4ad0 100644 --- a/software-security/sql-injection-samples/pom.xml +++ b/software-security/sql-injection-samples/pom.xml @@ -1,66 +1,65 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> - <artifactId>sql-injection-samples</artifactId> - <version>0.0.1-SNAPSHOT</version> - <name>sql-injection-samples</name> - <description>Sample SQL Injection tests</description> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>sql-injection-samples</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>sql-injection-samples</name> + <description>Sample SQL Injection tests</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-2</relativePath> - </parent> + </parent> - <dependencies> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-jdbc</artifactId> - </dependency> - <dependency> - <groupId>org.apache.derby</groupId> - <artifactId>derby</artifactId> - <scope>runtime</scope> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-configuration-processor</artifactId> - <optional>true</optional> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-data-jpa</artifactId> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-jpamodelgen</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-devtools</artifactId> - </dependency> - </dependencies> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-jdbc</artifactId> + </dependency> + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derby</artifactId> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-configuration-processor</artifactId> + <optional>true</optional> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-jpa</artifactId> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-jpamodelgen</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-devtools</artifactId> + </dependency> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + </plugins> + </build> </project> \ No newline at end of file diff --git a/spark-java/pom.xml b/spark-java/pom.xml index ef33f4cbe0..686cf75058 100644 --- a/spark-java/pom.xml +++ b/spark-java/pom.xml @@ -1,8 +1,7 @@ <?xml version="1.0"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spark-java</artifactId> <version>0.1.0-SNAPSHOT</version> <name>spark-java</name> diff --git a/spf4j/pom.xml b/spf4j/pom.xml index 43a8028dc4..b0568e9f7a 100644 --- a/spf4j/pom.xml +++ b/spf4j/pom.xml @@ -1,15 +1,15 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.spf4j</groupId> <artifactId>spf4j</artifactId> <name>spf4j</name> <packaging>pom</packaging> - + <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> @@ -17,5 +17,5 @@ <module>spf4j-core-app</module> <module>spf4j-aspects-app</module> </modules> - + </project> diff --git a/spf4j/spf4j-aspects-app/pom.xml b/spf4j/spf4j-aspects-app/pom.xml index 1c707f4d87..2458e2d8ad 100644 --- a/spf4j/spf4j-aspects-app/pom.xml +++ b/spf4j/spf4j-aspects-app/pom.xml @@ -1,15 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spf4j-aspects-app</artifactId> <version>0.0.1-SNAPSHOT</version> - <packaging>jar</packaging> <name>spf4j-aspects-app</name> + <packaging>jar</packaging> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> <relativePath>../../</relativePath> </parent> @@ -78,10 +79,11 @@ </plugin> </plugins> </build> - + <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <spf4j.version>8.6.10</spf4j.version> <org.slf4j.version>1.7.21</org.slf4j.version> </properties> + </project> diff --git a/spf4j/spf4j-core-app/pom.xml b/spf4j/spf4j-core-app/pom.xml index 9f490d9f06..45300fd4a4 100644 --- a/spf4j/spf4j-core-app/pom.xml +++ b/spf4j/spf4j-core-app/pom.xml @@ -1,15 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spf4j-core-app</artifactId> <version>0.0.1-SNAPSHOT</version> - <packaging>jar</packaging> <name>spf4j-core-app</name> + <packaging>jar</packaging> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> <relativePath>../../</relativePath> </parent> @@ -84,4 +85,5 @@ <spf4j.version>8.6.10</spf4j.version> <org.slf4j.version>1.7.21</org.slf4j.version> </properties> + </project> diff --git a/spring-4/pom.xml b/spring-4/pom.xml index 6c282b76a0..b6b8deb273 100644 --- a/spring-4/pom.xml +++ b/spring-4/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>spring-4</groupId> <artifactId>spring-4</artifactId> @@ -7,8 +8,8 @@ <packaging>jar</packaging> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-1</relativePath> </parent> @@ -36,7 +37,7 @@ <dependency> <groupId>com.zaxxer</groupId> <artifactId>HikariCP</artifactId> - </dependency> + </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> diff --git a/spring-4/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-4/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index d646e22511..0000000000 --- a/spring-4/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; - -import com.baeldung.flips.ApplicationConfig; - - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = ApplicationConfig.class) -@WebAppConfiguration -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-5-data-reactive/pom.xml b/spring-5-data-reactive/pom.xml index 296da87529..230f25768e 100644 --- a/spring-5-data-reactive/pom.xml +++ b/spring-5-data-reactive/pom.xml @@ -7,8 +7,8 @@ <packaging>jar</packaging> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -119,7 +119,6 @@ <version>${couchbaseMock.version}</version> <scope>test</scope> </dependency> - </dependencies> <build> diff --git a/spring-5-data-reactive/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-5-data-reactive/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index ce4c172960..0000000000 --- a/spring-5-data-reactive/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.reactive.Spring5ReactiveApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Spring5ReactiveApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-5-mvc/pom.xml b/spring-5-mvc/pom.xml index 7417f39c21..2f8ef05bff 100644 --- a/spring-5-mvc/pom.xml +++ b/spring-5-mvc/pom.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-5-mvc</artifactId> <name>spring-5-mvc</name> - <description>spring 5 MVC sample project about new features</description> <packaging>jar</packaging> + <description>spring 5 MVC sample project about new features</description> <parent> <groupId>com.baeldung</groupId> @@ -178,4 +178,5 @@ <start-class>com.baeldung.Spring5Application</start-class> <httpclient.version>4.5.8</httpclient.version> </properties> + </project> diff --git a/spring-5-reactive-2/pom.xml b/spring-5-reactive-2/pom.xml index 37c9ad3579..fdeebd1dfd 100644 --- a/spring-5-reactive-2/pom.xml +++ b/spring-5-reactive-2/pom.xml @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-5-reactive-2</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-5-reactive-2</name> @@ -30,24 +29,24 @@ <artifactId>reactor-spring</artifactId> <version>${reactor-spring.version}</version> </dependency> - + <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <scope>provided</scope> </dependency> - + <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> - - <dependency> - <groupId>com.github.tomakehurst</groupId> - <artifactId>wiremock-jre8</artifactId> - <version>${wiremock.version}</version> - <scope>test</scope> + + <dependency> + <groupId>com.github.tomakehurst</groupId> + <artifactId>wiremock-jre8</artifactId> + <version>${wiremock.version}</version> + <scope>test</scope> </dependency> <dependency> <groupId>io.projectreactor</groupId> @@ -68,10 +67,10 @@ </plugin> </plugins> </build> - + <properties> <reactor-spring.version>1.0.1.RELEASE</reactor-spring.version> - <wiremock.version>2.24.0</wiremock.version> + <wiremock.version>2.24.0</wiremock.version> </properties> </project> diff --git a/spring-5-reactive-client/pom.xml b/spring-5-reactive-client/pom.xml index 994239fa9b..2981fc4f77 100644 --- a/spring-5-reactive-client/pom.xml +++ b/spring-5-reactive-client/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-5-reactive-client</artifactId> <name>spring-5-reactive-client</name> @@ -124,7 +124,6 @@ <version>${jetty-reactive-httpclient.version}</version> <scope>test</scope> </dependency> - </dependencies> <build> diff --git a/spring-5-reactive-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-5-reactive-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 7843a8968d..0000000000 --- a/spring-5-reactive-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.reactive.Spring5ReactiveTestApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Spring5ReactiveTestApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-5-reactive-oauth/pom.xml b/spring-5-reactive-oauth/pom.xml index 06ce817a02..e286e821b2 100644 --- a/spring-5-reactive-oauth/pom.xml +++ b/spring-5-reactive-oauth/pom.xml @@ -1,75 +1,73 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung.reactive.oauth</groupId> - <artifactId>spring-5-reactive-oauth</artifactId> - <version>1.0.0-SNAPSHOT</version> - <name>spring-5-reactive-oauth</name> - <packaging>jar</packaging> - <description>WebFluc and Spring Security OAuth </description> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>com.baeldung.reactive.oauth</groupId> + <artifactId>spring-5-reactive-oauth</artifactId> + <version>1.0.0-SNAPSHOT</version> + <name>spring-5-reactive-oauth</name> + <packaging>jar</packaging> + <description>WebFluc and Spring Security OAuth</description> - <parent> - <artifactId>parent-boot-2</artifactId> + <parent> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> - <dependencies> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-security</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-webflux</artifactId> - </dependency> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-security</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-webflux</artifactId> + </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-oauth2-client</artifactId> </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>io.projectreactor</groupId> - <artifactId>reactor-test</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.springframework.security</groupId> - <artifactId>spring-security-test</artifactId> - <scope>test</scope> - </dependency> - </dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>io.projectreactor</groupId> + <artifactId>reactor-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework.security</groupId> + <artifactId>spring-security-test</artifactId> + <scope>test</scope> + </dependency> + </dependencies> - <build> - <plugins> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <testFailureIgnore>true</testFailureIgnore> + <excludes> + <exclude>**/*IntegrationTest.java</exclude> + <exclude>**/*LiveTest.java</exclude> + </excludes> + </configuration> + </plugin> + </plugins> + </build> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <testFailureIgnore>true</testFailureIgnore> - <excludes> - <exclude>**/*IntegrationTest.java</exclude> - <exclude>**/*LiveTest.java</exclude> - </excludes> - </configuration> - </plugin> - - </plugins> - </build> - - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <spring-boot.version>2.1.0.RELEASE</spring-boot.version> - </properties> + </properties> </project> diff --git a/spring-5-reactive-security/pom.xml b/spring-5-reactive-security/pom.xml index 72a73a86ce..2f4a31241b 100644 --- a/spring-5-reactive-security/pom.xml +++ b/spring-5-reactive-security/pom.xml @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-5-reactive-security</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-5-reactive-security</name> @@ -97,15 +96,15 @@ <version>${project-reactor-test}</version> <scope>test</scope> </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-security</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.security</groupId> - <artifactId>spring-security-test</artifactId> - <scope>test</scope> - </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-security</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.security</groupId> + <artifactId>spring-security-test</artifactId> + <scope>test</scope> + </dependency> </dependencies> <build> @@ -129,6 +128,7 @@ <geronimo-json_1.1_spec.version>1.0</geronimo-json_1.1_spec.version> <commons-collections4.version>4.1</commons-collections4.version> <project-reactor-test>3.1.6.RELEASE</project-reactor-test> + <spring-boot.version>2.2.1.RELEASE</spring-boot.version> </properties> </project> diff --git a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/authresolver/AuthResolverApplication.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/authresolver/AuthResolverApplication.java new file mode 100644 index 0000000000..bad5768c20 --- /dev/null +++ b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/authresolver/AuthResolverApplication.java @@ -0,0 +1,15 @@ +package com.baeldung.reactive.authresolver; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.web.reactive.config.EnableWebFlux; + +@EnableWebFlux +@SpringBootApplication +public class AuthResolverApplication { + + public static void main(String[] args) { + SpringApplication.run(AuthResolverApplication.class, args); + } + +} diff --git a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/authresolver/AuthResolverController.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/authresolver/AuthResolverController.java new file mode 100644 index 0000000000..1d70ded5e4 --- /dev/null +++ b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/authresolver/AuthResolverController.java @@ -0,0 +1,25 @@ +package com.baeldung.reactive.authresolver; + +import java.security.Principal; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import reactor.core.publisher.Mono; + +@RestController +public class AuthResolverController { + + @GetMapping("/customer/welcome") + public Mono<String> sayWelcomeToCustomer(Mono<Principal> principal) { + return principal + .map(Principal::getName) + .map(name -> String.format("Welcome to our site, %s!", name)); + } + + @GetMapping("/employee/welcome") + public Mono<String> sayWelcomeToEmployee(Mono<Principal> principal) { + return principal + .map(Principal::getName) + .map(name -> String.format("Welcome to our company, %s!", name)); + } + +} diff --git a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/authresolver/CustomWebSecurityConfig.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/authresolver/CustomWebSecurityConfig.java new file mode 100644 index 0000000000..d07a991089 --- /dev/null +++ b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/authresolver/CustomWebSecurityConfig.java @@ -0,0 +1,96 @@ +package com.baeldung.reactive.authresolver; + +import java.util.Collections; +import org.springframework.context.annotation.Bean; +import org.springframework.http.server.reactive.ServerHttpRequest; +import org.springframework.security.authentication.ReactiveAuthenticationManager; +import org.springframework.security.authentication.ReactiveAuthenticationManagerResolver; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.config.annotation.method.configuration.EnableReactiveMethodSecurity; +import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity; +import org.springframework.security.config.web.server.SecurityWebFiltersOrder; +import org.springframework.security.config.web.server.ServerHttpSecurity; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.security.web.server.SecurityWebFilterChain; +import org.springframework.security.web.server.authentication.AuthenticationWebFilter; +import reactor.core.publisher.Mono; + +@EnableWebFluxSecurity +@EnableReactiveMethodSecurity +public class CustomWebSecurityConfig { + + @Bean + public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) { + return http + .authorizeExchange() + .pathMatchers("/**") + .authenticated() + .and() + .httpBasic() + .disable() + .addFilterAfter(authenticationWebFilter(), SecurityWebFiltersOrder.REACTOR_CONTEXT) + .build(); + } + + public AuthenticationWebFilter authenticationWebFilter() { + return new AuthenticationWebFilter(resolver()); + } + + public ReactiveAuthenticationManagerResolver<ServerHttpRequest> resolver() { + return request -> { + if (request + .getPath() + .subPath(0) + .value() + .startsWith("/employee")) { + return Mono.just(employeesAuthenticationManager()); + } + return Mono.just(customersAuthenticationManager()); + }; + } + + public ReactiveAuthenticationManager customersAuthenticationManager() { + return authentication -> customer(authentication) + .switchIfEmpty(Mono.error(new UsernameNotFoundException(authentication + .getPrincipal() + .toString()))) + .map(b -> new UsernamePasswordAuthenticationToken(authentication.getPrincipal(), + authentication.getCredentials(), + Collections.singletonList(new SimpleGrantedAuthority("ROLE_USER")) + ) + ); + } + + public ReactiveAuthenticationManager employeesAuthenticationManager() { + return authentication -> employee(authentication) + .switchIfEmpty(Mono.error(new UsernameNotFoundException(authentication + .getPrincipal() + .toString()))) + .map( + b -> new UsernamePasswordAuthenticationToken(authentication.getPrincipal(), + authentication.getCredentials(), + Collections.singletonList(new SimpleGrantedAuthority("ROLE_USER")) + ) + ); + } + + public Mono<String> customer(Authentication authentication) { + return Mono.justOrEmpty(authentication + .getPrincipal() + .toString() + .startsWith("customer") ? authentication + .getPrincipal() + .toString() : null); + } + + public Mono<String> employee(Authentication authentication) { + return Mono.justOrEmpty(authentication + .getPrincipal() + .toString() + .startsWith("employee") ? authentication + .getPrincipal() + .toString() : null); + } +} diff --git a/spring-5-reactive-security/src/test/java/com/baeldung/reactive/authresolver/AuthResolverIntegrationTest.java b/spring-5-reactive-security/src/test/java/com/baeldung/reactive/authresolver/AuthResolverIntegrationTest.java new file mode 100644 index 0000000000..691243b3ea --- /dev/null +++ b/spring-5-reactive-security/src/test/java/com/baeldung/reactive/authresolver/AuthResolverIntegrationTest.java @@ -0,0 +1,63 @@ +package com.baeldung.reactive.authresolver; + +import org.junit.FixMethodOrder; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.MethodSorters; +import org.springframework.beans.factory.annotation.Autowired; +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.util.Base64Utils; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = AuthResolverApplication.class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class AuthResolverIntegrationTest { + @Autowired + private WebTestClient testClient; + + @Test + public void givenCustomerCredential_whenWelcomeCustomer_thenExpectOk() { + testClient + .get() + .uri("/customer/welcome") + .header("Authorization", "Basic " + Base64Utils.encodeToString("customer1:pass1".getBytes())) + .exchange() + .expectStatus() + .isOk(); + } + + @Test + public void givenEmployeeCredential_whenWelcomeCustomer_thenExpect401Status() { + testClient + .get() + .uri("/customer/welcome") + .header("Authorization", "Basic " + Base64Utils.encodeToString("employee1:pass1".getBytes())) + .exchange() + .expectStatus() + .isUnauthorized(); + } + + @Test + public void givenEmployeeCredential_whenWelcomeEmployee_thenExpectOk() { + testClient + .get() + .uri("/employee/welcome") + .header("Authorization", "Basic " + Base64Utils.encodeToString("employee1:pass1".getBytes())) + .exchange() + .expectStatus() + .isOk(); + } + + @Test + public void givenCustomerCredential_whenWelcomeEmployee_thenExpect401Status() { + testClient + .get() + .uri("/employee/welcome") + .header("Authorization", "Basic " + Base64Utils.encodeToString("customer1:pass1".getBytes())) + .exchange() + .expectStatus() + .isUnauthorized(); + } +} diff --git a/spring-5-reactive-security/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-5-reactive-security/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 2bcd974510..0000000000 --- a/spring-5-reactive-security/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.reactive.security.SpringSecurity5Application; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringSecurity5Application.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-5-reactive/pom.xml b/spring-5-reactive/pom.xml index e6690baf54..3b7383f726 100644 --- a/spring-5-reactive/pom.xml +++ b/spring-5-reactive/pom.xml @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-5-reactive</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-5-reactive</name> @@ -75,7 +74,7 @@ <scope>test</scope> </dependency> - <!-- Spring WebFlux WebSession --> + <!-- Spring WebFlux WebSession --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-webflux</artifactId> @@ -112,7 +111,6 @@ <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> </dependency> - </dependencies> <build> diff --git a/spring-5-reactive/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-5-reactive/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index ce4c172960..0000000000 --- a/spring-5-reactive/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.reactive.Spring5ReactiveApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Spring5ReactiveApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-5-security-cognito/pom.xml b/spring-5-security-cognito/pom.xml index cc6a4a56fb..8d03b91ce0 100644 --- a/spring-5-security-cognito/pom.xml +++ b/spring-5-security-cognito/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-5-security-cognito</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-5-security-cognito</name> diff --git a/spring-5-security-oauth/pom.xml b/spring-5-security-oauth/pom.xml index d9a1e3094e..40d54bf668 100644 --- a/spring-5-security-oauth/pom.xml +++ b/spring-5-security-oauth/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-5-security-oauth</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-5-security-oauth</name> @@ -16,7 +16,6 @@ </parent> <dependencies> - <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> diff --git a/spring-5-security/pom.xml b/spring-5-security/pom.xml index 413337633f..3fd31c8bc5 100644 --- a/spring-5-security/pom.xml +++ b/spring-5-security/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-5-security</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-5-security</name> @@ -60,5 +60,8 @@ </plugin> </plugins> </build> + <properties> + <spring-boot.version>2.2.1.RELEASE</spring-boot.version> + </properties> </project> diff --git a/spring-5-security/src/main/java/com/baeldung/authresolver/AuthResolverApplication.java b/spring-5-security/src/main/java/com/baeldung/authresolver/AuthResolverApplication.java new file mode 100644 index 0000000000..96ee674b15 --- /dev/null +++ b/spring-5-security/src/main/java/com/baeldung/authresolver/AuthResolverApplication.java @@ -0,0 +1,11 @@ +package com.baeldung.authresolver; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class AuthResolverApplication { + public static void main(String[] args) { + SpringApplication.run(AuthResolverApplication.class, args); + } +} diff --git a/spring-5-security/src/main/java/com/baeldung/authresolver/AuthResolverController.java b/spring-5-security/src/main/java/com/baeldung/authresolver/AuthResolverController.java new file mode 100644 index 0000000000..7dc6900b5a --- /dev/null +++ b/spring-5-security/src/main/java/com/baeldung/authresolver/AuthResolverController.java @@ -0,0 +1,18 @@ +package com.baeldung.authresolver; + +import org.springframework.security.core.Authentication; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class AuthResolverController { + @GetMapping("/customer/welcome") + public String sayWelcomeToCustomer(Authentication authentication) { + return String.format("Welcome to our site, %s!", authentication.getPrincipal()); + } + + @GetMapping("/employee/welcome") + public String sayWelcomeToEmployee(Authentication authentication) { + return String.format("Welcome to our company, %s!", authentication.getPrincipal()); + } +} diff --git a/spring-5-security/src/main/java/com/baeldung/authresolver/CustomWebSecurityConfigurer.java b/spring-5-security/src/main/java/com/baeldung/authresolver/CustomWebSecurityConfigurer.java new file mode 100644 index 0000000000..33ef692173 --- /dev/null +++ b/spring-5-security/src/main/java/com/baeldung/authresolver/CustomWebSecurityConfigurer.java @@ -0,0 +1,96 @@ +package com.baeldung.authresolver; + +import java.util.Collections; +import javax.servlet.http.HttpServletRequest; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.authentication.AuthenticationManagerResolver; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.security.web.authentication.AuthenticationConverter; +import org.springframework.security.web.authentication.AuthenticationFilter; +import org.springframework.security.web.authentication.www.BasicAuthenticationConverter; +import org.springframework.security.web.authentication.www.BasicAuthenticationFilter; + +@Configuration +public class CustomWebSecurityConfigurer extends WebSecurityConfigurerAdapter { + + public AuthenticationConverter authenticationConverter() { + return new BasicAuthenticationConverter(); + } + + public AuthenticationManagerResolver<HttpServletRequest> resolver() { + return request -> { + if (request + .getPathInfo() + .startsWith("/employee")) { + return employeesAuthenticationManager(); + } + return customersAuthenticationManager(); + }; + } + + public AuthenticationManager customersAuthenticationManager() { + return authentication -> { + if (isCustomer(authentication)) { + return new UsernamePasswordAuthenticationToken( + authentication.getPrincipal(), + authentication.getCredentials(), + Collections.singletonList(new SimpleGrantedAuthority("ROLE_USER")) + ); + } + throw new UsernameNotFoundException(authentication + .getPrincipal() + .toString()); + }; + } + + private boolean isCustomer(Authentication authentication) { + return (authentication + .getPrincipal() + .toString() + .startsWith("customer")); + } + + private boolean isEmployee(Authentication authentication) { + return (authentication + .getPrincipal() + .toString() + .startsWith("employee")); + } + + private AuthenticationFilter authenticationFilter() { + AuthenticationFilter filter = new AuthenticationFilter( + resolver(), authenticationConverter()); + filter.setSuccessHandler((request, response, auth) -> {}); + return filter; + } + + private AuthenticationManager employeesAuthenticationManager() { + return authentication -> { + if (isEmployee(authentication)) { + return new UsernamePasswordAuthenticationToken( + authentication.getPrincipal(), + authentication.getCredentials(), + Collections.singletonList(new SimpleGrantedAuthority("ROLE_USER")) + ); + } + throw new UsernameNotFoundException(authentication + .getPrincipal() + .toString()); + }; + } + + @Override + protected void configure(HttpSecurity http) { + http.addFilterBefore( + authenticationFilter(), + BasicAuthenticationFilter.class + ); + } + +} diff --git a/spring-5-security/src/test/java/com/baeldung/authresolver/AuthResolverIntegrationTest.java b/spring-5-security/src/test/java/com/baeldung/authresolver/AuthResolverIntegrationTest.java new file mode 100644 index 0000000000..c87f8c1a3a --- /dev/null +++ b/spring-5-security/src/test/java/com/baeldung/authresolver/AuthResolverIntegrationTest.java @@ -0,0 +1,82 @@ +package com.baeldung.authresolver; + +import org.junit.Before; +import org.junit.FixMethodOrder; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.MethodSorters; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.security.web.FilterChainProxy; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.util.Base64Utils; +import org.springframework.web.context.WebApplicationContext; + +import static org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.springSecurity; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = AuthResolverApplication.class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class AuthResolverIntegrationTest { + + @Autowired + private FilterChainProxy springSecurityFilterChain; + + @Autowired + private WebApplicationContext wac; + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders + .webAppContextSetup(wac) + .apply(springSecurity(springSecurityFilterChain)) + .build(); + } + + @Test + public void givenCustomerCredential_whenWelcomeCustomer_thenExpectOk() throws Exception { + this.mockMvc + .perform(get("/customer/welcome") + .header( + "Authorization", String.format("Basic %s", Base64Utils.encodeToString("customer1:pass1".getBytes())) + ) + ) + .andExpect(status().is2xxSuccessful()); + } + + @Test + public void givenEmployeeCredential_whenWelcomeCustomer_thenExpect401Status() throws Exception { + this.mockMvc + .perform(get("/customer/welcome") + .header( + "Authorization", "Basic " + Base64Utils.encodeToString("employee1:pass1".getBytes())) + ) + .andExpect(status().isUnauthorized()); + } + + @Test + public void givenEmployeeCredential_whenWelcomeEmployee_thenExpectOk() throws Exception { + this.mockMvc + .perform(get("/employee/welcome") + .header( + "Authorization", "Basic " + Base64Utils.encodeToString("employee1:pass1".getBytes())) + ) + .andExpect(status().is2xxSuccessful()); + } + + @Test + public void givenCustomerCredential_whenWelcomeEmployee_thenExpect401Status() throws Exception { + this.mockMvc + .perform(get("/employee/welcome") + .header( + "Authorization", "Basic " + Base64Utils.encodeToString("customer1:pass1".getBytes())) + ) + .andExpect(status().isUnauthorized()); + } +} diff --git a/spring-5-security/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-5-security/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 967f67e760..0000000000 --- a/spring-5-security/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.dsl.CustomConfigurerApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = CustomConfigurerApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-5-webflux/pom.xml b/spring-5-webflux/pom.xml index 91272593d3..84ee3e332c 100644 --- a/spring-5-webflux/pom.xml +++ b/spring-5-webflux/pom.xml @@ -1,9 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> - <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-5-webflux</artifactId> <version>1.0-SNAPSHOT</version> <name>spring-5-webflux</name> diff --git a/spring-5/pom.xml b/spring-5/pom.xml index 6e4162fbcc..eadfb5e512 100644 --- a/spring-5/pom.xml +++ b/spring-5/pom.xml @@ -1,9 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-5</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-5</name> @@ -147,7 +146,6 @@ </configuration> </plugin> </plugins> - </build> <properties> diff --git a/spring-5/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-5/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 75b3df4978..0000000000 --- a/spring-5/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.Spring5Application; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Spring5Application.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-activiti/pom.xml b/spring-activiti/pom.xml index e0196e807d..eef4d37ff8 100644 --- a/spring-activiti/pom.xml +++ b/spring-activiti/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-activiti</artifactId> <name>spring-activiti</name> @@ -8,8 +8,8 @@ <description>Demo project for Spring Boot</description> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-1</relativePath> </parent> @@ -41,7 +41,7 @@ <scope>test</scope> </dependency> </dependencies> - + <build> <plugins> <plugin> diff --git a/spring-activiti/src/test/java/com/baeldung/SpringContextIntegrationTest.java b/spring-activiti/src/test/java/com/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 89411df976..0000000000 --- a/spring-activiti/src/test/java/com/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.activitiwithspring.ActivitiWithSpringApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = ActivitiWithSpringApplication.class) -@AutoConfigureTestDatabase -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-akka/pom.xml b/spring-akka/pom.xml index d8b943b5ae..23535a8ccc 100644 --- a/spring-akka/pom.xml +++ b/spring-akka/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-akka</artifactId> <version>0.1-SNAPSHOT</version> <name>spring-akka</name> diff --git a/spring-all/README.md b/spring-all/README.md index 2b9f61c76d..d71b8569cf 100644 --- a/spring-all/README.md +++ b/spring-all/README.md @@ -1,3 +1,7 @@ +## Spring All + +This module contains articles about Spring + ### Relevant Articles: - [The @Scheduled Annotation in Spring](https://www.baeldung.com/spring-scheduled-tasks) diff --git a/spring-amqp/pom.xml b/spring-amqp/pom.xml index 3e6789dcb6..f32db5b8b4 100755 --- a/spring-amqp/pom.xml +++ b/spring-amqp/pom.xml @@ -1,15 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-amqp</artifactId> <version>1.0.0-SNAPSHOT</version> <name>spring-amqp</name> <description>Introduction to Spring-AMQP</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> diff --git a/spring-aop/pom.xml b/spring-aop/pom.xml index a1e2ffd534..69de2d66fd 100644 --- a/spring-aop/pom.xml +++ b/spring-aop/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -6,8 +7,8 @@ <packaging>war</packaging> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> diff --git a/spring-aop/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-aop/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index cf1ac7de89..0000000000 --- a/spring-aop/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-apache-camel/pom.xml b/spring-apache-camel/pom.xml index 3e76c0c7f1..2d0d632546 100644 --- a/spring-apache-camel/pom.xml +++ b/spring-apache-camel/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.apache.camel</groupId> <artifactId>spring-apache-camel</artifactId> @@ -48,7 +49,6 @@ </dependency> </dependencies> - <properties> <env.camel.version>2.18.1</env.camel.version> <env.spring.version>4.3.4.RELEASE</env.spring.version> diff --git a/spring-apache-camel/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-apache-camel/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index efd0603c76..0000000000 --- a/spring-apache-camel/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.baeldung; - -import org.junit.Test; - -import com.baeldung.camel.main.App; - -public class SpringContextIntegrationTest { - - @Test - public final void testMain() throws Exception { - App.main(null); - } -} diff --git a/spring-batch/README.md b/spring-batch/README.md index 9e09612490..99ac9826bc 100644 --- a/spring-batch/README.md +++ b/spring-batch/README.md @@ -8,3 +8,4 @@ This module contains articles about Spring Batch - [Spring Batch – Tasklets vs Chunks](https://www.baeldung.com/spring-batch-tasklet-chunk) - [How to Trigger and Stop a Scheduled Spring Batch Job](https://www.baeldung.com/spring-batch-start-stop-job) - [Configuring Skip Logic in Spring Batch](https://www.baeldung.com/spring-batch-skip-logic) +- [Testing a Spring Batch Job](https://www.baeldung.com/spring-batch-testing-job) diff --git a/spring-batch/pom.xml b/spring-batch/pom.xml index e6d7cee6f2..9edf8ad3be 100644 --- a/spring-batch/pom.xml +++ b/spring-batch/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-batch</artifactId> <version>0.1-SNAPSHOT</version> <name>spring-batch</name> @@ -16,7 +16,6 @@ </parent> <dependencies> - <!-- JAXB APIs & runtime no longer provided in JDK 11 --> <!-- see http://openjdk.java.net/jeps/320 --> <dependency> diff --git a/spring-batch/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-batch/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 0898603083..0000000000 --- a/spring-batch/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.baeldung; - -import org.baeldung.batch.App; -import org.junit.Test; - -public class SpringContextIntegrationTest { - - @Test - public void testMain() throws Exception { - App.main(null); - } -} diff --git a/spring-bom/pom.xml b/spring-bom/pom.xml index f974eb2334..e82c650fa9 100644 --- a/spring-bom/pom.xml +++ b/spring-bom/pom.xml @@ -1,8 +1,7 @@ <?xml version="1.0"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-bom</artifactId> <version>1.0.0-SNAPSHOT</version> <name>spring-bom</name> diff --git a/spring-bom/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-bom/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 6dee4b808e..0000000000 --- a/spring-bom/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.baeldung; - -import org.junit.Test; - -import com.baeldung.spring.bom.HelloWorldApp; - -public class SpringContextIntegrationTest { - - @Test - public final void testMain() throws Exception { - HelloWorldApp.main(null); - } -} diff --git a/spring-boot-admin/pom.xml b/spring-boot-admin/pom.xml index c553790359..ab2b92102c 100644 --- a/spring-boot-admin/pom.xml +++ b/spring-boot-admin/pom.xml @@ -1,9 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-boot-admin</artifactId> <version>0.0.1-SNAPSHOT</version> - <name>spring-boot-admin</name> + <name>spring-boot-admin</name> <packaging>pom</packaging> <parent> diff --git a/spring-boot-admin/spring-boot-admin-client/pom.xml b/spring-boot-admin/spring-boot-admin-client/pom.xml index aa2daf8d45..47abfdddc2 100644 --- a/spring-boot-admin/spring-boot-admin-client/pom.xml +++ b/spring-boot-admin/spring-boot-admin-client/pom.xml @@ -1,16 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-boot-admin-client</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-boot-admin-client</name> - <description>Spring Boot Admin Client</description> <packaging>jar</packaging> + <description>Spring Boot Admin Client</description> <parent> - <artifactId>spring-boot-admin</artifactId> <groupId>com.baeldung</groupId> + <artifactId>spring-boot-admin</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../spring-boot-admin</relativePath> </parent> diff --git a/spring-boot-admin/spring-boot-admin-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-admin/spring-boot-admin-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 1f1fae17bc..0000000000 --- a/spring-boot-admin/spring-boot-admin-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.springbootadminclient.SpringBootAdminClientApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringBootAdminClientApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-boot-admin/spring-boot-admin-server/pom.xml b/spring-boot-admin/spring-boot-admin-server/pom.xml index 5ef99976c8..d0d2d7a1ef 100644 --- a/spring-boot-admin/spring-boot-admin-server/pom.xml +++ b/spring-boot-admin/spring-boot-admin-server/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-boot-admin-server</artifactId> <version>0.0.1-SNAPSHOT</version> @@ -9,8 +9,8 @@ <packaging>jar</packaging> <parent> - <artifactId>spring-boot-admin</artifactId> <groupId>com.baeldung</groupId> + <artifactId>spring-boot-admin</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../spring-boot-admin</relativePath> </parent> @@ -51,12 +51,12 @@ <version>${spring-boot-admin-starter-client.version}</version> </dependency> <!--mail notifications --> - + <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-mail</artifactId> </dependency> - + <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> @@ -67,7 +67,6 @@ <artifactId>spring-security-test</artifactId> <scope>test</scope> </dependency> - </dependencies> <build> diff --git a/spring-boot-admin/spring-boot-admin-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-admin/spring-boot-admin-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 4c151d97df..0000000000 --- a/spring-boot-admin/spring-boot-admin-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.springbootadminserver.SpringBootAdminServerApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringBootAdminServerApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-boot-angular/pom.xml b/spring-boot-angular/pom.xml index 8c26668752..d78761e921 100644 --- a/spring-boot-angular/pom.xml +++ b/spring-boot-angular/pom.xml @@ -1,18 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.springbootangular</groupId> <artifactId>spring-boot-angular</artifactId> - <name>spring-boot-angular</name> <version>1.0</version> + <name>spring-boot-angular</name> <packaging>jar</packaging> - <parent> + <groupId>com.baeldung</groupId> <artifactId>parent-boot-2</artifactId> - <groupId>com.baeldung</groupId> - <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-boot-2</relativePath> + <version>0.0.1-SNAPSHOT</version> + <relativePath>../parent-boot-2</relativePath> </parent> <dependencies> @@ -45,4 +45,5 @@ </plugin> </plugins> </build> + </project> diff --git a/spring-boot-angular/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-angular/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 4f595916f7..0000000000 --- a/spring-boot-angular/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.ecommerce.EcommerceApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = EcommerceApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-boot-artifacts/pom.xml b/spring-boot-artifacts/pom.xml index 8301533606..97d3c53b49 100644 --- a/spring-boot-artifacts/pom.xml +++ b/spring-boot-artifacts/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-boot-artifacts</artifactId> <name>spring-boot-artifacts</name> @@ -8,8 +8,8 @@ <description>Demo project for Spring Boot</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -90,7 +90,7 @@ <artifactId>spring-cloud-context</artifactId> <version>${springcloud.version}</version> </dependency> - + <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> @@ -132,9 +132,9 @@ <configuration> <!-- Skips integration tests if the value of skip.integration.tests property is true --> - <includes> - <include>**/ExternalPropertyFileLoaderIntegrationTest.java</include> - </includes> + <includes> + <include>**/ExternalPropertyFileLoaderIntegrationTest.java</include> + </includes> </configuration> </execution> </executions> @@ -178,7 +178,7 @@ </build> </profile> </profiles> - + <properties> <!-- The main class to start by executing java -jar --> <start-class>org.baeldung.boot.Application</start-class> diff --git a/spring-boot-autoconfiguration/pom.xml b/spring-boot-autoconfiguration/pom.xml index 5b3b0eb86c..a39bf0f071 100644 --- a/spring-boot-autoconfiguration/pom.xml +++ b/spring-boot-autoconfiguration/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-boot-autoconfiguration</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-boot-autoconfiguration</name> @@ -9,8 +9,8 @@ <description>This is simple boot application demonstrating a custom auto-configuration</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> diff --git a/spring-boot-bootstrap/pom.xml b/spring-boot-bootstrap/pom.xml index 70ebb225c8..a81908d8b6 100644 --- a/spring-boot-bootstrap/pom.xml +++ b/spring-boot-bootstrap/pom.xml @@ -1,336 +1,335 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> - <artifactId>spring-boot-bootstrap</artifactId> - <name>spring-boot-bootstrap</name> - <description>Demo project for Spring Boot</description> - <packaging>jar</packaging> - - <parent> - <artifactId>parent-boot-2</artifactId> - <groupId>com.baeldung</groupId> - <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-boot-2</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-thymeleaf</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-data-jpa</artifactId> - </dependency> - <dependency> - <groupId>com.h2database</groupId> - <artifactId>h2</artifactId> - </dependency> - <dependency> - <groupId>mysql</groupId> - <artifactId>mysql-connector-java</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-security</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>io.rest-assured</groupId> - <artifactId>rest-assured</artifactId> - <version>${rest-assured.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - <version>${servlet.version}</version> - </dependency> - </dependencies> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>spring-boot-bootstrap</artifactId> + <name>spring-boot-bootstrap</name> + <packaging>jar</packaging> + <description>Demo project for Spring Boot</description> + + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> + <version>0.0.1-SNAPSHOT</version> + <relativePath>../parent-boot-2</relativePath> + </parent> + + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-thymeleaf</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-jpa</artifactId> + </dependency> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + </dependency> + <dependency> + <groupId>mysql</groupId> + <artifactId>mysql-connector-java</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-security</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>io.rest-assured</groupId> + <artifactId>rest-assured</artifactId> + <version>${rest-assured.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet-api</artifactId> + <version>${servlet.version}</version> + </dependency> + </dependencies> + + <profiles> + <profile> + <id>beanstalk</id> + <build> + <finalName>${project.name}-eb</finalName> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <excludes> + <exclude>**/cloud/config/*.java</exclude> + </excludes> + </configuration> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>openshift</id> + <properties> + <spring-cloud-k8s.version>0.3.0.RELEASE</spring-cloud-k8s.version> + <spring-cloud.version>Greenwich.RELEASE</spring-cloud.version> + <fabric8.maven.plugin.version>3.5.37</fabric8.maven.plugin.version> + </properties> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-kubernetes-dependencies</artifactId> + <version>${spring-cloud-k8s.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-dependencies</artifactId> + <version>${spring-cloud.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-kubernetes-config</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-actuator</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-actuator</artifactId> + </dependency> + </dependencies> + <build> + <resources> + <resource> + <directory>src/main/resources</directory> + <excludes> + <exclude>**/logback.xml</exclude> + </excludes> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <excludes> + <exclude>**/cloud/config/*.java</exclude> + </excludes> + </configuration> + </plugin> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>io.fabric8</groupId> + <artifactId>fabric8-maven-plugin</artifactId> + <version>${fabric8.maven.plugin.version}</version> + <executions> + <execution> + <id>fmp</id> + <goals> + <goal>resource</goal> + <goal>build</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>cloud-gcp</id> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-dependencies</artifactId> + <version>Greenwich.RELEASE</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-gcp-starter</artifactId> + <version>1.0.0.RELEASE</version> + </dependency> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-gcp-starter-sql-mysql</artifactId> + <version>1.0.0.RELEASE</version> + </dependency> + </dependencies> + <build> + <finalName>${project.name}-gcp</finalName> + <resources> + <resource> + <directory>src/main/resources</directory> + <excludes> + <exclude>**/logback.xml</exclude> + </excludes> + </resource> + </resources> + <plugins> + <plugin> + <groupId>com.google.cloud.tools</groupId> + <artifactId>appengine-maven-plugin</artifactId> + <version>1.3.2</version> + </plugin> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>cloudfoundry</id> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-dependencies</artifactId> + <version>Greenwich.RELEASE</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-cloud-connectors</artifactId> + </dependency> + </dependencies> + <build> + <finalName>${project.name}-cf</finalName> + <resources> + <resource> + <directory>src/main/resources</directory> + <excludes> + <exclude>**/logback.xml</exclude> + </excludes> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <excludes> + <exclude>**/cloud/config/*.java</exclude> + </excludes> + </configuration> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>autoconfiguration</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <executions> + <execution> + <phase>integration-test</phase> + <goals> + <goal>test</goal> + </goals> + <configuration> + <excludes> + <exclude>**/*LiveTest.java</exclude> + <exclude>**/*IntegrationTest.java</exclude> + <exclude>**/*IntTest.java</exclude> + </excludes> + <includes> + <include>**/AutoconfigurationTest.java</include> + </includes> + </configuration> + </execution> + </executions> + <configuration> + <systemPropertyVariables> + <test.mime>json</test.mime> + </systemPropertyVariables> + </configuration> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>thin-jar</id> + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot.experimental</groupId> + <artifactId>spring-boot-thin-maven-plugin</artifactId> + <version>${thin.version}</version> + <executions> + <execution> + <!-- Download the dependencies at build time --> + <id>resolve</id> + <goals> + <goal>resolve</goal> + </goals> + <inherited>false</inherited> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> - <profiles> - <profile> - <id>beanstalk</id> - <build> - <finalName>${project.name}-eb</finalName> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <excludes> - <exclude>**/cloud/config/*.java</exclude> - </excludes> - </configuration> - </plugin> - </plugins> - </build> - </profile> - <profile> - <id>openshift</id> - <properties> - <spring-cloud-k8s.version>0.3.0.RELEASE</spring-cloud-k8s.version> - <spring-cloud.version>Greenwich.RELEASE</spring-cloud.version> - <fabric8.maven.plugin.version>3.5.37</fabric8.maven.plugin.version> - </properties> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-kubernetes-dependencies</artifactId> - <version>${spring-cloud-k8s.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-dependencies</artifactId> - <version>${spring-cloud.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-kubernetes-config</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-actuator</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-actuator</artifactId> - </dependency> - </dependencies> - <build> - <resources> - <resource> - <directory>src/main/resources</directory> - <excludes> - <exclude>**/logback.xml</exclude> - </excludes> - </resource> - </resources> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <excludes> - <exclude>**/cloud/config/*.java</exclude> - </excludes> - </configuration> - </plugin> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - </plugin> - <plugin> - <groupId>io.fabric8</groupId> - <artifactId>fabric8-maven-plugin</artifactId> - <version>${fabric8.maven.plugin.version}</version> - <executions> - <execution> - <id>fmp</id> - <goals> - <goal>resource</goal> - <goal>build</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - <profile> - <id>cloud-gcp</id> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-dependencies</artifactId> - <version>Greenwich.RELEASE</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-gcp-starter</artifactId> - <version>1.0.0.RELEASE</version> - </dependency> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-gcp-starter-sql-mysql</artifactId> - <version>1.0.0.RELEASE</version> - </dependency> - </dependencies> - <build> - <finalName>${project.name}-gcp</finalName> - <resources> - <resource> - <directory>src/main/resources</directory> - <excludes> - <exclude>**/logback.xml</exclude> - </excludes> - </resource> - </resources> - <plugins> - <plugin> - <groupId>com.google.cloud.tools</groupId> - <artifactId>appengine-maven-plugin</artifactId> - <version>1.3.2</version> - </plugin> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - </plugin> - </plugins> - </build> - </profile> - <profile> - <id>cloudfoundry</id> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-dependencies</artifactId> - <version>Greenwich.RELEASE</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-cloud-connectors</artifactId> - </dependency> - </dependencies> - <build> - <finalName>${project.name}-cf</finalName> - <resources> - <resource> - <directory>src/main/resources</directory> - <excludes> - <exclude>**/logback.xml</exclude> - </excludes> - </resource> - </resources> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <excludes> - <exclude>**/cloud/config/*.java</exclude> - </excludes> - </configuration> - </plugin> - </plugins> - </build> - </profile> - <profile> - <id>autoconfiguration</id> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <executions> - <execution> - <phase>integration-test</phase> - <goals> - <goal>test</goal> - </goals> - <configuration> - <excludes> - <exclude>**/*LiveTest.java</exclude> - <exclude>**/*IntegrationTest.java</exclude> - <exclude>**/*IntTest.java</exclude> - </excludes> - <includes> - <include>**/AutoconfigurationTest.java</include> - </includes> - </configuration> - </execution> - </executions> - <configuration> - <systemPropertyVariables> - <test.mime>json</test.mime> - </systemPropertyVariables> - </configuration> - </plugin> - </plugins> - </build> - </profile> - <profile> - <id>thin-jar</id> - <build> - <plugins> - <plugin> - <groupId>org.springframework.boot.experimental</groupId> - <artifactId>spring-boot-thin-maven-plugin</artifactId> - <version>${thin.version}</version> - <executions> - <execution> - <!-- Download the dependencies at build time --> - <id>resolve</id> - <goals> - <goal>resolve</goal> - </goals> - <inherited>false</inherited> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - </profiles> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <excludes> - <exclude>**/cloud/config/*.java</exclude> - </excludes> - </configuration> - </plugin> - </plugins> - </build> - + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <excludes> + <exclude>**/cloud/config/*.java</exclude> + </excludes> + </configuration> + </plugin> + </plugins> + </build> + <properties> - <servlet.version>4.0.0</servlet.version> - </properties> + <servlet.version>4.0.0</servlet.version> + </properties> </project> diff --git a/spring-boot-bootstrap/src/test/java/com/baeldung/SpringContextIntegrationTest.java b/spring-boot-bootstrap/src/test/java/com/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 08c6692689..0000000000 --- a/spring-boot-bootstrap/src/test/java/com/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class SpringContextIntegrationTest { - - @Test - public void contextLoads() { - } -} diff --git a/spring-boot-camel/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-camel/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 6eee0abf1e..0000000000 --- a/spring-boot-camel/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.camel.Application; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-boot-client/pom.xml b/spring-boot-client/pom.xml index 4850849039..2cfd413e93 100644 --- a/spring-boot-client/pom.xml +++ b/spring-boot-client/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-boot-client</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-boot-client</name> @@ -9,8 +9,8 @@ <description>This is simple boot client application for Spring boot actuator test</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> diff --git a/spring-boot-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 97debc5b63..0000000000 --- a/spring-boot-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.baeldung; - -import org.baeldung.boot.Application; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-boot-config-jpa-error/data-jpa-application/README.md b/spring-boot-config-jpa-error/data-jpa-application/README.md new file mode 100644 index 0000000000..443ec07183 --- /dev/null +++ b/spring-boot-config-jpa-error/data-jpa-application/README.md @@ -0,0 +1,3 @@ +### Relevant Articles + +- [Unable to Find @SpringBootConfiguration with @DataJpaTest](https://www.baeldung.com/spring-boot-unable-to-find-springbootconfiguration-with-datajpatest) diff --git a/spring-boot-config-jpa-error/data-jpa-application/pom.xml b/spring-boot-config-jpa-error/data-jpa-application/pom.xml index 2952ff4c4c..9a311adfec 100644 --- a/spring-boot-config-jpa-error/data-jpa-application/pom.xml +++ b/spring-boot-config-jpa-error/data-jpa-application/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -9,4 +10,5 @@ <artifactId>spring-boot-config-jpa-error</artifactId> <version>0.0.1-SNAPSHOT</version> </parent> + </project> \ No newline at end of file diff --git a/spring-boot-config-jpa-error/data-jpa-library/README.md b/spring-boot-config-jpa-error/data-jpa-library/README.md new file mode 100644 index 0000000000..4e852f8a90 --- /dev/null +++ b/spring-boot-config-jpa-error/data-jpa-library/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Unable to Find @SpringBootConfiguration with @DataJpaTest](https://www.baeldung.com/spring-boot-unable-to-find-springbootconfiguration-with-datajpatest) diff --git a/spring-boot-config-jpa-error/data-jpa-library/pom.xml b/spring-boot-config-jpa-error/data-jpa-library/pom.xml index f8b876b65b..2da9e5aa2c 100644 --- a/spring-boot-config-jpa-error/data-jpa-library/pom.xml +++ b/spring-boot-config-jpa-error/data-jpa-library/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -9,4 +10,5 @@ <artifactId>spring-boot-config-jpa-error</artifactId> <version>0.0.1-SNAPSHOT</version> </parent> + </project> \ No newline at end of file diff --git a/spring-boot-config-jpa-error/pom.xml b/spring-boot-config-jpa-error/pom.xml index 12087aa610..4b99f9be93 100644 --- a/spring-boot-config-jpa-error/pom.xml +++ b/spring-boot-config-jpa-error/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -58,4 +59,5 @@ </plugin> </plugins> </build> + </project> \ No newline at end of file diff --git a/spring-boot-crud/pom.xml b/spring-boot-crud/pom.xml index 1d956bdba6..e78e939f0c 100644 --- a/spring-boot-crud/pom.xml +++ b/spring-boot-crud/pom.xml @@ -4,15 +4,15 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-boot-crud</artifactId> - <name>spring-boot-crud</name> - + <name>spring-boot-crud</name> + <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> - + <dependencies> <dependency> <groupId>org.springframework.boot</groupId> @@ -39,9 +39,9 @@ <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <scope>runtime</scope> - </dependency> + </dependency> </dependencies> - + <build> <finalName>spring-boot-crud</finalName> <resources> @@ -54,11 +54,11 @@ <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> - <configuration> - <classifier>exec</classifier> - </configuration> + <configuration> + <classifier>exec</classifier> + </configuration> </plugin> - <plugin> + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <configuration> @@ -75,12 +75,12 @@ </goals> </execution> </executions> - </plugin> + </plugin> </plugins> </build> - + <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> - + </project> diff --git a/spring-boot-ctx-fluent/pom.xml b/spring-boot-ctx-fluent/pom.xml index b238374612..782e1fd7f6 100644 --- a/spring-boot-ctx-fluent/pom.xml +++ b/spring-boot-ctx-fluent/pom.xml @@ -1,15 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-boot-ctx-fluent</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-boot-ctx-fluent</name> <packaging>jar</packaging> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> diff --git a/spring-boot-ctx-fluent/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-ctx-fluent/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index c9f7220ab9..0000000000 --- a/spring-boot-ctx-fluent/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.baeldung; - -import org.junit.Test; - -import com.baeldung.parent.App; - -public class SpringContextIntegrationTest { - - @Test - public final void testMain() throws Exception { - App.main(new String[] {}); - } -} diff --git a/spring-boot-custom-starter/README.md b/spring-boot-custom-starter/README.md index c22aab7a2b..d74dc222d5 100644 --- a/spring-boot-custom-starter/README.md +++ b/spring-boot-custom-starter/README.md @@ -1,6 +1,6 @@ ## Spring Boot Custom Starter -This module contains articles about writing Spring Boot [starters](https://www.baeldung.com/spring-boot-starters). +This module contains articles about writing [Spring Boot Starters](https://www.baeldung.com/spring-boot-starters). ### Relevant Articles: - [Creating a Custom Starter with Spring Boot](https://www.baeldung.com/spring-boot-custom-starter) diff --git a/spring-boot-custom-starter/greeter-library/pom.xml b/spring-boot-custom-starter/greeter-library/pom.xml index 7e0c5c4d22..da30f2e4be 100644 --- a/spring-boot-custom-starter/greeter-library/pom.xml +++ b/spring-boot-custom-starter/greeter-library/pom.xml @@ -1,15 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>greeter-library</artifactId> <version>0.0.1-SNAPSHOT</version> <name>greeter-library</name> <parent> - <artifactId>spring-boot-custom-starter</artifactId> <groupId>com.baeldung</groupId> + <artifactId>spring-boot-custom-starter</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../spring-boot-custom-starter</relativePath> </parent> + </project> \ No newline at end of file diff --git a/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/pom.xml b/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/pom.xml index 4fe92e8e45..58dd683131 100644 --- a/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/pom.xml +++ b/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/pom.xml @@ -1,14 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>greeter-spring-boot-autoconfigure</artifactId> <version>0.0.1-SNAPSHOT</version> <name>greeter-spring-boot-autoconfigure</name> <parent> - <artifactId>spring-boot-custom-starter</artifactId> <groupId>com.baeldung</groupId> + <artifactId>spring-boot-custom-starter</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../spring-boot-custom-starter</relativePath> </parent> @@ -39,7 +39,7 @@ <version>${greeter.version}</version> <optional>true</optional> </dependency> - + <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> diff --git a/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 9c8d825ea4..0000000000 --- a/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import com.baeldung.greeter.autoconfigure.GreeterAutoConfiguration; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = GreeterAutoConfiguration.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} 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 1528853b0c..bb1e656963 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 @@ -1,14 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>greeter-spring-boot-sample-app</artifactId> <version>0.0.1-SNAPSHOT</version> <name>greeter-spring-boot-sample-app</name> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../spring-boot-custom-starter</relativePath> </parent> diff --git a/spring-boot-custom-starter/greeter-spring-boot-sample-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-custom-starter/greeter-spring-boot-sample-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 23f285238b..0000000000 --- a/spring-boot-custom-starter/greeter-spring-boot-sample-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.greeter.sample.GreeterSampleApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = GreeterSampleApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-boot-custom-starter/greeter-spring-boot-starter/pom.xml b/spring-boot-custom-starter/greeter-spring-boot-starter/pom.xml index 560d6fa79b..d298756b8e 100644 --- a/spring-boot-custom-starter/greeter-spring-boot-starter/pom.xml +++ b/spring-boot-custom-starter/greeter-spring-boot-starter/pom.xml @@ -1,14 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>greeter-spring-boot-starter</artifactId> <version>0.0.1-SNAPSHOT</version> <name>greeter-spring-boot-starter</name> <parent> - <artifactId>spring-boot-custom-starter</artifactId> <groupId>com.baeldung</groupId> + <artifactId>spring-boot-custom-starter</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../spring-boot-custom-starter</relativePath> </parent> diff --git a/spring-boot-custom-starter/greeter/pom.xml b/spring-boot-custom-starter/greeter/pom.xml index 95fcaa66c8..3117cfa355 100644 --- a/spring-boot-custom-starter/greeter/pom.xml +++ b/spring-boot-custom-starter/greeter/pom.xml @@ -1,15 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>greeter</artifactId> <version>0.0.1-SNAPSHOT</version> <name>greeter</name> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-1</relativePath> </parent> + </project> \ No newline at end of file diff --git a/spring-boot-custom-starter/pom.xml b/spring-boot-custom-starter/pom.xml index 9c03cfdd0e..96c0d0a585 100644 --- a/spring-boot-custom-starter/pom.xml +++ b/spring-boot-custom-starter/pom.xml @@ -1,10 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-boot-custom-starter</artifactId> <version>0.0.1-SNAPSHOT</version> - <name>spring-boot-custom-starter</name> + <name>spring-boot-custom-starter</name> <packaging>pom</packaging> <parent> @@ -19,6 +19,5 @@ <module>greeter-spring-boot-starter</module> <module>greeter-spring-boot-sample-app</module> </modules> - </project> \ No newline at end of file diff --git a/spring-boot-data/README.md b/spring-boot-data/README.md index eb3cd5bbaa..f023bb772f 100644 --- a/spring-boot-data/README.md +++ b/spring-boot-data/README.md @@ -8,3 +8,4 @@ This module contains articles about Spring Boot with Spring Data - [Rendering Exceptions in JSON with Spring](https://www.baeldung.com/spring-exceptions-json) - [Disable Spring Data Auto Configuration](https://www.baeldung.com/spring-data-disable-auto-config) - [Repositories with Multiple Spring Data Modules](https://www.baeldung.com/spring-multiple-data-modules) +- [Spring Custom Property Editor](https://www.baeldung.com/spring-mvc-custom-property-editor) diff --git a/spring-boot-data/pom.xml b/spring-boot-data/pom.xml index 4c41eb8e3c..663ee640f3 100644 --- a/spring-boot-data/pom.xml +++ b/spring-boot-data/pom.xml @@ -3,13 +3,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-boot-data</artifactId> - <packaging>war</packaging> <name>spring-boot-data</name> + <packaging>war</packaging> <description>Spring Boot Data Module</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -54,7 +54,7 @@ </dependencies> <build> - <finalName>spring-boot</finalName> + <finalName>spring-boot-data</finalName> <resources> <resource> <directory>src/main/resources</directory> @@ -169,4 +169,5 @@ <javers.version>5.6.3</javers.version> <git-commit-id-plugin.version>2.2.4</git-commit-id-plugin.version> </properties> + </project> diff --git a/spring-resttemplate/src/main/java/com/baeldung/propertyeditor/PropertyEditorApplication.java b/spring-boot-data/src/main/java/com/baeldung/propertyeditor/PropertyEditorApplication.java similarity index 100% rename from spring-resttemplate/src/main/java/com/baeldung/propertyeditor/PropertyEditorApplication.java rename to spring-boot-data/src/main/java/com/baeldung/propertyeditor/PropertyEditorApplication.java diff --git a/spring-resttemplate/src/main/java/com/baeldung/propertyeditor/PropertyEditorRestController.java b/spring-boot-data/src/main/java/com/baeldung/propertyeditor/PropertyEditorRestController.java similarity index 100% rename from spring-resttemplate/src/main/java/com/baeldung/propertyeditor/PropertyEditorRestController.java rename to spring-boot-data/src/main/java/com/baeldung/propertyeditor/PropertyEditorRestController.java diff --git a/spring-resttemplate/src/main/java/com/baeldung/propertyeditor/creditcard/CreditCard.java b/spring-boot-data/src/main/java/com/baeldung/propertyeditor/creditcard/CreditCard.java similarity index 100% rename from spring-resttemplate/src/main/java/com/baeldung/propertyeditor/creditcard/CreditCard.java rename to spring-boot-data/src/main/java/com/baeldung/propertyeditor/creditcard/CreditCard.java diff --git a/spring-resttemplate/src/main/java/com/baeldung/propertyeditor/creditcard/CreditCardEditor.java b/spring-boot-data/src/main/java/com/baeldung/propertyeditor/creditcard/CreditCardEditor.java similarity index 100% rename from spring-resttemplate/src/main/java/com/baeldung/propertyeditor/creditcard/CreditCardEditor.java rename to spring-boot-data/src/main/java/com/baeldung/propertyeditor/creditcard/CreditCardEditor.java diff --git a/spring-resttemplate/src/main/java/com/baeldung/propertyeditor/exotictype/editor/CustomExoticTypeEditor.java b/spring-boot-data/src/main/java/com/baeldung/propertyeditor/exotictype/editor/CustomExoticTypeEditor.java similarity index 100% rename from spring-resttemplate/src/main/java/com/baeldung/propertyeditor/exotictype/editor/CustomExoticTypeEditor.java rename to spring-boot-data/src/main/java/com/baeldung/propertyeditor/exotictype/editor/CustomExoticTypeEditor.java diff --git a/spring-resttemplate/src/main/java/com/baeldung/propertyeditor/exotictype/model/ExoticType.java b/spring-boot-data/src/main/java/com/baeldung/propertyeditor/exotictype/model/ExoticType.java similarity index 100% rename from spring-resttemplate/src/main/java/com/baeldung/propertyeditor/exotictype/model/ExoticType.java rename to spring-boot-data/src/main/java/com/baeldung/propertyeditor/exotictype/model/ExoticType.java diff --git a/spring-resttemplate/src/test/java/com/baeldung/propertyeditor/creditcard/CreditCardEditorUnitTest.java b/spring-boot-data/src/test/java/com/baeldung/propertyeditor/creditcard/CreditCardEditorUnitTest.java similarity index 100% rename from spring-resttemplate/src/test/java/com/baeldung/propertyeditor/creditcard/CreditCardEditorUnitTest.java rename to spring-boot-data/src/test/java/com/baeldung/propertyeditor/creditcard/CreditCardEditorUnitTest.java diff --git a/spring-boot-deployment/pom.xml b/spring-boot-deployment/pom.xml index 69a54fd482..6f724f312b 100644 --- a/spring-boot-deployment/pom.xml +++ b/spring-boot-deployment/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-boot-deployment</artifactId> <name>spring-boot-deployment</name> @@ -8,8 +8,8 @@ <description>Demo project for Spring Boot</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -90,7 +90,7 @@ <artifactId>spring-cloud-context</artifactId> <version>${springcloud.version}</version> </dependency> - + <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> @@ -141,9 +141,9 @@ <configuration> <!-- Skips integration tests if the value of skip.integration.tests property is true --> - <includes> - <include>**/ExternalPropertyFileLoaderIntegrationTest.java</include> - </includes> + <includes> + <include>**/ExternalPropertyFileLoaderIntegrationTest.java</include> + </includes> </configuration> </execution> </executions> @@ -187,7 +187,7 @@ </build> </profile> </profiles> - + <properties> <!-- The main class to start by executing java -jar --> <start-class>org.baeldung.boot.Application</start-class> diff --git a/spring-boot-deployment/src/test/java/com/baeldung/springbootconfiguration/SpringContextIntegrationTest.java b/spring-boot-deployment/src/test/java/com/baeldung/springbootconfiguration/SpringContextIntegrationTest.java deleted file mode 100644 index 24bef73ef9..0000000000 --- a/spring-boot-deployment/src/test/java/com/baeldung/springbootconfiguration/SpringContextIntegrationTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.springbootconfiguration; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class SpringContextIntegrationTest { - - @Test - public void contextLoads() { - } -} diff --git a/spring-boot-di/pom.xml b/spring-boot-di/pom.xml index 31ccff03da..61059630c4 100644 --- a/spring-boot-di/pom.xml +++ b/spring-boot-di/pom.xml @@ -1,64 +1,64 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <artifactId>spring-boot-di</artifactId> - <name>spring-boot-di</name> - <packaging>jar</packaging> - <description>Module For Spring Boot DI</description> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>spring-boot-di</artifactId> + <name>spring-boot-di</name> + <packaging>jar</packaging> + <description>Module For Spring Boot DI</description> - <parent> - <artifactId>parent-boot-2</artifactId> - <groupId>com.baeldung</groupId> - <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-boot-2</relativePath> - </parent> + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> + <version>0.0.1-SNAPSHOT</version> + <relativePath>../parent-boot-2</relativePath> + </parent> - <dependencies> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>aspectjweaver</artifactId> - </dependency> + <dependencies> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>aspectjweaver</artifactId> + </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-tomcat</artifactId> - <scope>provided</scope> - </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-tomcat</artifactId> + <scope>provided</scope> + </dependency> - <dependency> - <groupId>org.apache.tomcat.embed</groupId> - <artifactId>tomcat-embed-jasper</artifactId> - <scope>provided</scope> - </dependency> - <dependency> + <dependency> + <groupId>org.apache.tomcat.embed</groupId> + <artifactId>tomcat-embed-jasper</artifactId> + <scope>provided</scope> + </dependency> + <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> - </dependencies> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - <configuration> - <mainClass>com.baeldung.SpringBootDiApplication</mainClass> - <layout>JAR</layout> - </configuration> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <configuration> + <mainClass>com.baeldung.SpringBootDiApplication</mainClass> + <layout>JAR</layout> + </configuration> + </plugin> + </plugins> + </build> - <properties> - <start-class>com.baeldung.SpringBootDiApplication</start-class> - </properties> + <properties> + <start-class>com.baeldung.SpringBootDiApplication</start-class> + </properties> </project> diff --git a/spring-boot-environment/pom.xml b/spring-boot-environment/pom.xml index 4e4a363fee..531ef697d7 100644 --- a/spring-boot-environment/pom.xml +++ b/spring-boot-environment/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-boot-environment</artifactId> <name>spring-boot-environment</name> @@ -8,8 +8,8 @@ <description>Demo project for Spring Boot</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -78,7 +78,7 @@ <artifactId>spring-cloud-context</artifactId> <version>${springcloud.version}</version> </dependency> - + <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> @@ -136,7 +136,7 @@ </build> </profile> </profiles> - + <properties> <jpa.version>2.2</jpa.version> <guava.version>18.0</guava.version> diff --git a/spring-boot-flowable/pom.xml b/spring-boot-flowable/pom.xml index f7fc943389..96558b8595 100644 --- a/spring-boot-flowable/pom.xml +++ b/spring-boot-flowable/pom.xml @@ -1,62 +1,62 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <artifactId>spring-boot-flowable</artifactId> - <packaging>war</packaging> - <name>spring-boot-flowable</name> - <description>Spring Boot Flowable Module</description> - - <parent> - <artifactId>parent-boot-2</artifactId> - <groupId>com.baeldung</groupId> - <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-boot-2</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> - <dependency> - <groupId>com.h2database</groupId> - <artifactId>h2</artifactId> - <scope>runtime</scope> - </dependency> - <dependency> - <groupId>org.flowable</groupId> - <artifactId>flowable-spring-boot-starter-rest</artifactId> - <version>${flowable.version}</version> - </dependency> - <dependency> - <groupId>org.flowable</groupId> - <artifactId>flowable-spring-boot-starter-actuator</artifactId> - <version>${flowable.version}</version> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-engine</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - </plugin> - </plugins> - </build> - - <properties> - <flowable.version>6.4.1</flowable.version> - </properties> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>spring-boot-flowable</artifactId> + <name>spring-boot-flowable</name> + <packaging>war</packaging> + <description>Spring Boot Flowable Module</description> + + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> + <version>0.0.1-SNAPSHOT</version> + <relativePath>../parent-boot-2</relativePath> + </parent> + + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.flowable</groupId> + <artifactId>flowable-spring-boot-starter-rest</artifactId> + <version>${flowable.version}</version> + </dependency> + <dependency> + <groupId>org.flowable</groupId> + <artifactId>flowable-spring-boot-starter-actuator</artifactId> + <version>${flowable.version}</version> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-engine</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + </plugins> + </build> + + <properties> + <flowable.version>6.4.1</flowable.version> + </properties> </project> \ No newline at end of file diff --git a/spring-boot-jasypt/pom.xml b/spring-boot-jasypt/pom.xml index ae0483f107..76a501c455 100644 --- a/spring-boot-jasypt/pom.xml +++ b/spring-boot-jasypt/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example.jasypt</groupId> <artifactId>spring-boot-jasypt</artifactId> @@ -9,8 +9,8 @@ <description>Demo project for Spring Boot</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> diff --git a/spring-boot-jasypt/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-jasypt/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index dce3819a26..0000000000 --- a/spring-boot-jasypt/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.jasypt.Main; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Main.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-boot-keycloak/pom.xml b/spring-boot-keycloak/pom.xml index b13805b4bf..609b4d1dec 100644 --- a/spring-boot-keycloak/pom.xml +++ b/spring-boot-keycloak/pom.xml @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.keycloak</groupId> <artifactId>spring-boot-keycloak</artifactId> <version>0.0.1</version> <name>spring-boot-keycloak</name> - <description>This is a simple application demonstrating integration between Keycloak and Spring Boot.</description> <packaging>jar</packaging> + <description>This is a simple application demonstrating integration between Keycloak and Spring Boot.</description> <parent> <groupId>com.baeldung</groupId> @@ -16,6 +16,18 @@ <relativePath>../parent-boot-1</relativePath> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.keycloak.bom</groupId> + <artifactId>keycloak-adapter-bom</artifactId> + <version>${keycloak-adapter-bom.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>org.springframework.boot</groupId> @@ -53,17 +65,6 @@ <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.keycloak.bom</groupId> - <artifactId>keycloak-adapter-bom</artifactId> - <version>${keycloak-adapter-bom.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> <build> <plugins> diff --git a/spring-boot-keycloak/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-keycloak/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 7367568611..0000000000 --- a/spring-boot-keycloak/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.keycloak.SpringBoot; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringBoot.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-boot-kotlin/pom.xml b/spring-boot-kotlin/pom.xml index ccb1585a75..a98d76a398 100644 --- a/spring-boot-kotlin/pom.xml +++ b/spring-boot-kotlin/pom.xml @@ -8,8 +8,8 @@ <description>Demo project showing how to use non-blocking in Kotlin with Spring Boot</description> <parent> - <artifactId>parent-kotlin</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-kotlin</artifactId> <version>1.0.0-SNAPSHOT</version> <relativePath>../parent-kotlin</relativePath> </parent> diff --git a/spring-boot-libraries/pom.xml b/spring-boot-libraries/pom.xml index b448d6fd66..d9c9073542 100644 --- a/spring-boot-libraries/pom.xml +++ b/spring-boot-libraries/pom.xml @@ -1,157 +1,158 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <artifactId>spring-boot-libraries</artifactId> - <name>spring-boot-libraries</name> - <packaging>war</packaging> - <description>This is simple boot application for Spring boot actuator test</description> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>spring-boot-libraries</artifactId> + <name>spring-boot-libraries</name> + <packaging>war</packaging> + <description>This is simple boot application for Spring boot actuator test</description> - <parent> - <artifactId>parent-boot-2</artifactId> - <groupId>com.baeldung</groupId> - <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-boot-2</relativePath> - </parent> + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> + <version>0.0.1-SNAPSHOT</version> + <relativePath>../parent-boot-2</relativePath> + </parent> - <dependencies> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-security</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-tomcat</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> - - <!-- Problem Spring Web --> - <dependency> - <groupId>org.zalando</groupId> - <artifactId>problem-spring-web</artifactId> - <version>${problem-spring-web.version}</version> - </dependency> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-security</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-tomcat</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> - <!-- ShedLock --> - <dependency> - <groupId>net.javacrumbs.shedlock</groupId> - <artifactId>shedlock-spring</artifactId> - <version>${shedlock.version}</version> - </dependency> - <dependency> - <groupId>net.javacrumbs.shedlock</groupId> - <artifactId>shedlock-provider-jdbc-template</artifactId> - <version>${shedlock.version}</version> - </dependency> + <!-- Problem Spring Web --> + <dependency> + <groupId>org.zalando</groupId> + <artifactId>problem-spring-web</artifactId> + <version>${problem-spring-web.version}</version> + </dependency> - </dependencies> + <!-- ShedLock --> + <dependency> + <groupId>net.javacrumbs.shedlock</groupId> + <artifactId>shedlock-spring</artifactId> + <version>${shedlock.version}</version> + </dependency> + <dependency> + <groupId>net.javacrumbs.shedlock</groupId> + <artifactId>shedlock-provider-jdbc-template</artifactId> + <version>${shedlock.version}</version> + </dependency> - <build> - <finalName>spring-boot</finalName> - <resources> - <resource> - <directory>src/main/resources</directory> - <filtering>true</filtering> - </resource> - </resources> + </dependencies> - <plugins> + <build> + <finalName>spring-boot-libraries</finalName> + <resources> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + </resource> + </resources> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-war-plugin</artifactId> - </plugin> + <plugins> - <plugin> - <groupId>pl.project13.maven</groupId> - <artifactId>git-commit-id-plugin</artifactId> - <version>${git-commit-id-plugin.version}</version> - <executions> - <execution> - <id>get-the-git-infos</id> - <goals> - <goal>revision</goal> - </goals> - <phase>initialize</phase> - </execution> - <execution> - <id>validate-the-git-infos</id> - <goals> - <goal>validateRevision</goal> - </goals> - <phase>package</phase> - </execution> - </executions> - <configuration> - <generateGitPropertiesFile>true</generateGitPropertiesFile> - <generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename> - </configuration> - </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + </plugin> - </plugins> + <plugin> + <groupId>pl.project13.maven</groupId> + <artifactId>git-commit-id-plugin</artifactId> + <version>${git-commit-id-plugin.version}</version> + <executions> + <execution> + <id>get-the-git-infos</id> + <goals> + <goal>revision</goal> + </goals> + <phase>initialize</phase> + </execution> + <execution> + <id>validate-the-git-infos</id> + <goals> + <goal>validateRevision</goal> + </goals> + <phase>package</phase> + </execution> + </executions> + <configuration> + <generateGitPropertiesFile>true</generateGitPropertiesFile> + <generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename> + </configuration> + </plugin> - </build> + </plugins> - <profiles> - <profile> - <id>autoconfiguration</id> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <executions> - <execution> - <phase>integration-test</phase> - <goals> - <goal>test</goal> - </goals> - <configuration> - <excludes> - <exclude>**/*LiveTest.java</exclude> - <exclude>**/*IntegrationTest.java</exclude> - <exclude>**/*IntTest.java</exclude> - </excludes> - <includes> - <include>**/AutoconfigurationTest.java</include> - </includes> - </configuration> - </execution> - </executions> - <configuration> - <systemPropertyVariables> - <test.mime>json</test.mime> - </systemPropertyVariables> - </configuration> - </plugin> - </plugins> - </build> - </profile> - </profiles> + </build> - <properties> - <!-- The main class to start by executing java -jar --> - <start-class>com.baeldung.intro.App</start-class> - <tomee-servlet-api.version>8.5.11</tomee-servlet-api.version> - <togglz.version>2.4.1.Final</togglz.version> - <rome.version>1.9.0</rome.version> - <chaos.monkey.version>2.0.0</chaos.monkey.version> - <graphql-spring-boot-starter.version>5.0.2</graphql-spring-boot-starter.version> - <graphiql-spring-boot-starter.version>5.0.2</graphiql-spring-boot-starter.version> - <graphql-java-tools.version>5.2.4</graphql-java-tools.version> - <guava.version>18.0</guava.version> - <git-commit-id-plugin.version>2.2.4</git-commit-id-plugin.version> - <modelmapper.version>2.3.2</modelmapper.version> - <problem-spring-web.version>0.23.0</problem-spring-web.version> - <shedlock.version>2.1.0</shedlock.version> - </properties> + <profiles> + <profile> + <id>autoconfiguration</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <executions> + <execution> + <phase>integration-test</phase> + <goals> + <goal>test</goal> + </goals> + <configuration> + <excludes> + <exclude>**/*LiveTest.java</exclude> + <exclude>**/*IntegrationTest.java</exclude> + <exclude>**/*IntTest.java</exclude> + </excludes> + <includes> + <include>**/AutoconfigurationTest.java</include> + </includes> + </configuration> + </execution> + </executions> + <configuration> + <systemPropertyVariables> + <test.mime>json</test.mime> + </systemPropertyVariables> + </configuration> + </plugin> + </plugins> + </build> + </profile> + </profiles> + + <properties> + <!-- The main class to start by executing java -jar --> + <start-class>com.baeldung.intro.App</start-class> + <tomee-servlet-api.version>8.5.11</tomee-servlet-api.version> + <togglz.version>2.4.1.Final</togglz.version> + <rome.version>1.9.0</rome.version> + <chaos.monkey.version>2.0.0</chaos.monkey.version> + <graphql-spring-boot-starter.version>5.0.2</graphql-spring-boot-starter.version> + <graphiql-spring-boot-starter.version>5.0.2</graphiql-spring-boot-starter.version> + <graphql-java-tools.version>5.2.4</graphql-java-tools.version> + <guava.version>18.0</guava.version> + <git-commit-id-plugin.version>2.2.4</git-commit-id-plugin.version> + <modelmapper.version>2.3.2</modelmapper.version> + <problem-spring-web.version>0.23.0</problem-spring-web.version> + <shedlock.version>2.1.0</shedlock.version> + </properties> </project> diff --git a/spring-boot-logging-log4j2/pom.xml b/spring-boot-logging-log4j2/pom.xml index 8e4bf60f91..a7065bc925 100644 --- a/spring-boot-logging-log4j2/pom.xml +++ b/spring-boot-logging-log4j2/pom.xml @@ -1,18 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-boot-logging-log4j2</artifactId> - <name>spring-boot-logging-log4j2</name> + <name>spring-boot-logging-log4j2</name> <packaging>jar</packaging> <description>Demo project for Spring Boot Logging with Log4J2</description> - <!-- this needs to use the boot parent directly in order to not inherit logback dependencies --> - + <!-- this needs to use the boot parent directly in order to not inherit logback dependencies --> + <parent> - <artifactId>spring-boot-starter-parent</artifactId> <groupId>org.springframework.boot</groupId> - <version>2.0.5.RELEASE</version> + <artifactId>spring-boot-starter-parent</artifactId> + <version>2.2.1.RELEASE</version> </parent> <dependencies> @@ -35,12 +35,12 @@ <artifactId>spring-boot-starter-log4j2</artifactId> </dependency> <dependency> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - <version>${lombok.version}</version> - <scope>provided</scope> - </dependency> - + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <version>${lombok.version}</version> + <scope>provided</scope> + </dependency> + <!-- for Graylog demo --> <dependency> <!-- forcing spring boot 1.x sing log4j was dropped in spring boot 1.4 and beyond --> @@ -55,30 +55,31 @@ <scope>compile</scope> </dependency> </dependencies> - + <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <forkCount>3</forkCount> - <reuseForks>true</reuseForks> - <excludes> - <exclude>**/*IntegrationTest.java</exclude> - <exclude>**/*IntTest.java</exclude> - <exclude>**/*ManualTest.java</exclude> - <exclude>**/*LiveTest.java</exclude> - </excludes> - </configuration> - </plugin> - </plugins> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <forkCount>3</forkCount> + <reuseForks>true</reuseForks> + <excludes> + <exclude>**/*IntegrationTest.java</exclude> + <exclude>**/*IntTest.java</exclude> + <exclude>**/*ManualTest.java</exclude> + <exclude>**/*LiveTest.java</exclude> + </excludes> + </configuration> + </plugin> + </plugins> </build> - + <properties> <start-class>com.baeldung.springbootlogging.SpringBootLoggingApplication</start-class> - <spring-boot-starter-log4j.version>1.3.8.RELEASE</spring-boot-starter-log4j.version> - <gelfj.version>1.1.16</gelfj.version> - <lombok.version>1.18.4</lombok.version> + <spring-boot-starter-log4j.version>1.3.8.RELEASE</spring-boot-starter-log4j.version> + <gelfj.version>1.1.16</gelfj.version> + <lombok.version>1.18.4</lombok.version> </properties> + </project> diff --git a/spring-boot-logging-log4j2/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-logging-log4j2/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 2d46b21ba5..0000000000 --- a/spring-boot-logging-log4j2/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.springbootlogging.SpringBootLoggingApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringBootLoggingApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-boot-mvc-2/pom.xml b/spring-boot-mvc-2/pom.xml index 18121325a5..e6538c4418 100644 --- a/spring-boot-mvc-2/pom.xml +++ b/spring-boot-mvc-2/pom.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-boot-mvc-2</artifactId> <name>spring-boot-mvc-2</name> @@ -12,7 +12,7 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.2.0.BUILD-SNAPSHOT</version> - <relativePath /> <!-- lookup parent from repository --> + <relativePath/> <!-- lookup parent from repository --> </parent> <dependencies> @@ -50,6 +50,7 @@ <url>https://repo.spring.io/milestone</url> </repository> </repositories> + <pluginRepositories> <pluginRepository> <id>spring-snapshots</id> @@ -65,4 +66,5 @@ <url>https://repo.spring.io/milestone</url> </pluginRepository> </pluginRepositories> + </project> \ No newline at end of file diff --git a/spring-boot-mvc-birt/pom.xml b/spring-boot-mvc-birt/pom.xml index 3532b20c15..76760e661b 100644 --- a/spring-boot-mvc-birt/pom.xml +++ b/spring-boot-mvc-birt/pom.xml @@ -1,18 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-boot-mvc-birt</artifactId> - <name>spring-boot-mvc-birt</name> <version>0.0.1-SNAPSHOT</version> + <name>spring-boot-mvc-birt</name> <packaging>jar</packaging> <description>Module For Spring Boot Integration with BIRT</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> diff --git a/spring-boot-mvc/pom.xml b/spring-boot-mvc/pom.xml index a414ed7bb2..1c79a423bf 100644 --- a/spring-boot-mvc/pom.xml +++ b/spring-boot-mvc/pom.xml @@ -9,11 +9,20 @@ <description>Module For Spring Boot MVC</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> + + <repositories> + <!-- Snapshot repository location --> + <repository> + <id>jcenter-snapshots</id> + <name>jcenter</name> + <url>http://oss.jfrog.org/artifactory/oss-snapshot-local/</url> + </repository> + </repositories> <dependencies> @@ -34,7 +43,14 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> - + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-jpa</artifactId> + </dependency> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + </dependency> <!--JSF --> <dependency> @@ -82,6 +98,18 @@ <artifactId>springfox-swagger-ui</artifactId> <version>${spring.fox.version}</version> </dependency> + + <dependency> + <groupId>io.springfox</groupId> + <artifactId>springfox-data-rest</artifactId> + <version>${spring.fox.version}</version> + </dependency> + + <dependency> + <groupId>io.springfox</groupId> + <artifactId>springfox-bean-validators</artifactId> + <version>${spring.fox.version}</version> + </dependency> <dependency> <groupId>org.apache.tomcat.embed</groupId> @@ -117,7 +145,7 @@ </build> <properties> - <spring.fox.version>2.9.2</spring.fox.version> + <spring.fox.version>3.0.0-SNAPSHOT</spring.fox.version> <!-- ROME for RSS --> <rome.version>1.10.0</rome.version> <javax.faces.version>2.3.7</javax.faces.version> diff --git a/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/configuration/SpringFoxConfig.java b/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/configuration/SpringFoxConfig.java index 68e2c55deb..434a8d77cb 100644 --- a/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/configuration/SpringFoxConfig.java +++ b/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/configuration/SpringFoxConfig.java @@ -1,22 +1,29 @@ package com.baeldung.swagger2boot.configuration; +import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; + +import com.baeldung.swagger2boot.plugin.EmailAnnotationPlugin; + +import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.service.ApiInfo; import springfox.documentation.service.Contact; import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.data.rest.configuration.SpringDataRestConfiguration; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger.web.*; -import springfox.documentation.swagger2.annotations.EnableSwagger2; +import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc; import java.util.Collections; @Configuration -@EnableSwagger2 -@ComponentScan("com.baeldung.swaggerboot.controller") +@EnableSwagger2WebMvc +@Import({SpringDataRestConfiguration.class, BeanValidatorPluginsConfiguration.class}) public class SpringFoxConfig { private ApiInfo apiInfo() { @@ -65,4 +72,8 @@ public class SpringFoxConfig { .build(); } + @Bean + public EmailAnnotationPlugin emailPlugin() { + return new EmailAnnotationPlugin(); + } } diff --git a/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/model/User.java b/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/model/User.java new file mode 100644 index 0000000000..b724031536 --- /dev/null +++ b/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/model/User.java @@ -0,0 +1,58 @@ +package com.baeldung.swagger2boot.model; + +import javax.persistence.Id; +import javax.validation.constraints.Email; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import javax.persistence.Entity; + +@Entity +public class User { + + @Id + private Long id; + + @NotNull(message = "First Name cannot be null") + private String firstName; + + @Min(value = 15, message = "Age should not be less than 15") + @Max(value = 65, message = "Age should not be greater than 65") + private int age; + + @Email(regexp=".@.\\..*", message = "Email should be valid") + private String email; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + +} diff --git a/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/plugin/EmailAnnotationPlugin.java b/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/plugin/EmailAnnotationPlugin.java new file mode 100644 index 0000000000..22ca144fb4 --- /dev/null +++ b/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/plugin/EmailAnnotationPlugin.java @@ -0,0 +1,39 @@ +package com.baeldung.swagger2boot.plugin; + +import static springfox.bean.validators.plugins.Validators.annotationFromBean; + +import java.util.Optional; + +import javax.validation.constraints.Email; + +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import springfox.bean.validators.plugins.Validators; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spi.schema.ModelPropertyBuilderPlugin; +import springfox.documentation.spi.schema.contexts.ModelPropertyContext; + +@Component +@Order(Validators.BEAN_VALIDATOR_PLUGIN_ORDER) +public class EmailAnnotationPlugin implements ModelPropertyBuilderPlugin { + + @Override + public boolean supports(DocumentationType delimiter) { + return true; + } + + /** + * read Email annotation + */ + @Override + public void apply(ModelPropertyContext context) { + Optional<Email> email = annotationFromBean(context, Email.class); + if (email.isPresent()) { + context.getBuilder().pattern(email.get().regexp()); + context.getBuilder().example("email@email.com"); + } + } + +} + diff --git a/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/repository/UserRepository.java b/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/repository/UserRepository.java new file mode 100644 index 0000000000..0cbffa06d4 --- /dev/null +++ b/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/repository/UserRepository.java @@ -0,0 +1,11 @@ +package com.baeldung.swagger2boot.repository; + +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +import com.baeldung.swagger2boot.model.User; + +@Repository +public interface UserRepository extends CrudRepository<User, Long> { + +} diff --git a/spring-boot-mvc/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-mvc/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 6ed93e8c44..0000000000 --- a/spring-boot-mvc/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.springbootmvc.SpringBootMvcApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringBootMvcApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-boot-nashorn/pom.xml b/spring-boot-nashorn/pom.xml index 0f43752993..af11f14fdc 100644 --- a/spring-boot-nashorn/pom.xml +++ b/spring-boot-nashorn/pom.xml @@ -1,17 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.nashorn</groupId> <artifactId>spring-boot-nashorn</artifactId> - <name>spring-boot-nashorn</name> <version>1.0</version> + <name>spring-boot-nashorn</name> <packaging>jar</packaging> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -48,4 +48,5 @@ </plugin> </plugins> </build> + </project> \ No newline at end of file diff --git a/spring-boot-parent/pom.xml b/spring-boot-parent/pom.xml index 0924917505..7ce5bdc428 100644 --- a/spring-boot-parent/pom.xml +++ b/spring-boot-parent/pom.xml @@ -1,15 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-boot-parent</artifactId> <version>1.0.0-SNAPSHOT</version> <name>spring-boot-parent</name> - <description>spring-boot-parent</description> <packaging>pom</packaging> + <description>spring-boot-parent</description> <parent> <groupId>com.baeldung</groupId> diff --git a/spring-boot-parent/spring-boot-with-custom-parent/pom.xml b/spring-boot-parent/spring-boot-with-custom-parent/pom.xml index a64ebc246a..8a55f252d6 100644 --- a/spring-boot-parent/spring-boot-with-custom-parent/pom.xml +++ b/spring-boot-parent/spring-boot-with-custom-parent/pom.xml @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-boot-with-custom-parent</artifactId> <version>1.0.0-SNAPSHOT</version> diff --git a/spring-boot-parent/spring-boot-with-starter-parent/pom.xml b/spring-boot-parent/spring-boot-with-starter-parent/pom.xml index 1c6479ca60..9ea26e49fe 100644 --- a/spring-boot-parent/spring-boot-with-starter-parent/pom.xml +++ b/spring-boot-parent/spring-boot-with-starter-parent/pom.xml @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung</groupId> <artifactId>spring-boot-with-starter-parent</artifactId> diff --git a/spring-boot-performance/pom.xml b/spring-boot-performance/pom.xml index a4efa4a8d7..7bf3885618 100644 --- a/spring-boot-performance/pom.xml +++ b/spring-boot-performance/pom.xml @@ -8,8 +8,8 @@ <description>This is a simple Spring Boot application taking advantage of the latest Spring Boot improvements/features. Current version: 2.2</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> diff --git a/spring-boot-properties/pom.xml b/spring-boot-properties/pom.xml index 5e65aadc28..705a0eb786 100644 --- a/spring-boot-properties/pom.xml +++ b/spring-boot-properties/pom.xml @@ -3,13 +3,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-boot-properties</artifactId> - <packaging>jar</packaging> <name>spring-boot-properties</name> + <packaging>jar</packaging> <description>Spring Boot Properties Module</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> diff --git a/spring-boot-property-exp/pom.xml b/spring-boot-property-exp/pom.xml index 7d8f2480ac..b16fcd1c22 100644 --- a/spring-boot-property-exp/pom.xml +++ b/spring-boot-property-exp/pom.xml @@ -1,15 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <name>spring-boot-property-exp</name> - <groupId>com.baeldung</groupId> <artifactId>spring-boot-property-exp</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>pom</packaging> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> diff --git a/spring-boot-property-exp/property-exp-custom-config/pom.xml b/spring-boot-property-exp/property-exp-custom-config/pom.xml index 9988924408..f9c3d6ef62 100644 --- a/spring-boot-property-exp/property-exp-custom-config/pom.xml +++ b/spring-boot-property-exp/property-exp-custom-config/pom.xml @@ -1,15 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>property-exp-custom-config</artifactId> <version>0.0.1-SNAPSHOT</version> - <name>property-exp-custom-config</name> + <name>property-exp-custom-config</name> <packaging>jar</packaging> <parent> - <artifactId>spring-boot-property-exp</artifactId> <groupId>com.baeldung</groupId> + <artifactId>spring-boot-property-exp</artifactId> <version>0.0.1-SNAPSHOT</version> </parent> @@ -26,7 +26,6 @@ <scope>test</scope> </dependency> </dependencies> - <build> <resources> diff --git a/spring-boot-property-exp/property-exp-custom-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-property-exp/property-exp-custom-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 6dd3419d39..0000000000 --- a/spring-boot-property-exp/property-exp-custom-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.propertyexpansion.SpringBootPropertyExpansionApp; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringBootPropertyExpansionApp.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-boot-property-exp/property-exp-default-config/pom.xml b/spring-boot-property-exp/property-exp-default-config/pom.xml index 7892288f45..9cb1de33f6 100644 --- a/spring-boot-property-exp/property-exp-default-config/pom.xml +++ b/spring-boot-property-exp/property-exp-default-config/pom.xml @@ -1,15 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>property-exp-default-config</artifactId> <version>0.0.1-SNAPSHOT</version> - <name>property-exp-default-config</name> + <name>property-exp-default-config</name> <packaging>jar</packaging> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-1</relativePath> </parent> diff --git a/spring-boot-property-exp/property-exp-default-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-property-exp/property-exp-default-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 6dd3419d39..0000000000 --- a/spring-boot-property-exp/property-exp-default-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.propertyexpansion.SpringBootPropertyExpansionApp; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringBootPropertyExpansionApp.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-boot-rest/pom.xml b/spring-boot-rest/pom.xml index 598b589ea0..3787e21493 100644 --- a/spring-boot-rest/pom.xml +++ b/spring-boot-rest/pom.xml @@ -1,17 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.web</groupId> <artifactId>spring-boot-rest</artifactId> <name>spring-boot-rest</name> - <description>Spring Boot Rest Module</description> <packaging>war</packaging> + <description>Spring Boot Rest Module</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -44,7 +44,7 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> - + <!-- Spring HATEOAS --> <dependency> <groupId>org.springframework.boot</groupId> @@ -89,6 +89,7 @@ <start-class>com.baeldung.SpringBootRestApplication</start-class> <guava.version>27.0.1-jre</guava.version> <xstream.version>1.4.11.1</xstream.version> - <modelmapper.version>2.3.3</modelmapper.version> + <modelmapper.version>2.3.5</modelmapper.version> </properties> + </project> diff --git a/spring-boot-rest/src/main/java/com/baeldung/modelmapper/controller/PostRestController.java b/spring-boot-rest/src/main/java/com/baeldung/modelmapper/controller/PostRestController.java index 68c17975d4..e2def62466 100644 --- a/spring-boot-rest/src/main/java/com/baeldung/modelmapper/controller/PostRestController.java +++ b/spring-boot-rest/src/main/java/com/baeldung/modelmapper/controller/PostRestController.java @@ -1,24 +1,25 @@ package com.baeldung.modelmapper.controller; -import java.text.ParseException; -import java.util.List; -import java.util.stream.Collectors; - -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -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 com.baeldung.modelmapper.dto.PostDto; import com.baeldung.modelmapper.model.Post; import com.baeldung.modelmapper.service.IPostService; import com.baeldung.modelmapper.service.IUserService; +import org.modelmapper.ModelMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; + +import java.text.ParseException; +import java.util.List; +import java.util.stream.Collectors; @Controller @RequestMapping("/posts") @@ -33,7 +34,7 @@ public class PostRestController { @Autowired private ModelMapper modelMapper; - @RequestMapping(method = RequestMethod.GET) + @GetMapping @ResponseBody public List<PostDto> getPosts( @PathVariable("page") int page, @@ -43,11 +44,11 @@ public class PostRestController { List<Post> posts = postService.getPostsList(page, size, sortDir, sort); return posts.stream() - .map(post -> convertToDto(post)) + .map(this::convertToDto) .collect(Collectors.toList()); } - @RequestMapping(method = RequestMethod.POST) + @PostMapping @ResponseStatus(HttpStatus.CREATED) @ResponseBody public PostDto createPost(@RequestBody PostDto postDto) throws ParseException { @@ -56,13 +57,13 @@ public class PostRestController { return convertToDto(postCreated); } - @RequestMapping(value = "/{id}", method = RequestMethod.GET) + @GetMapping(value = "/{id}") @ResponseBody public PostDto getPost(@PathVariable("id") Long id) { return convertToDto(postService.getPostById(id)); } - @RequestMapping(value = "/{id}", method = RequestMethod.PUT) + @PutMapping(value = "/{id}") @ResponseStatus(HttpStatus.OK) public void updatePost(@RequestBody PostDto postDto) throws ParseException { Post post = convertToEntity(postDto); diff --git a/spring-boot-rest/src/test/java/com/baeldung/SpringContextIntegrationTest.java b/spring-boot-rest/src/test/java/com/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 3db1ecb462..0000000000 --- a/spring-boot-rest/src/test/java/com/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = {SpringBootRestApplication.class}) -public class SpringContextIntegrationTest { - - @Test - public void contextLoads() { - } - -} diff --git a/spring-boot-rest/src/test/java/com/baeldung/modelmapper/PostDtoUnitTest.java b/spring-boot-rest/src/test/java/com/baeldung/modelmapper/PostDtoUnitTest.java index 34ec4db783..6e94cc4289 100644 --- a/spring-boot-rest/src/test/java/com/baeldung/modelmapper/PostDtoUnitTest.java +++ b/spring-boot-rest/src/test/java/com/baeldung/modelmapper/PostDtoUnitTest.java @@ -15,7 +15,7 @@ public class PostDtoUnitTest { @Test public void whenConvertPostEntityToPostDto_thenCorrect() { Post post = new Post(); - post.setId(Long.valueOf(1)); + post.setId(1L); post.setTitle(randomAlphabetic(6)); post.setUrl("www.test.com"); @@ -28,7 +28,7 @@ public class PostDtoUnitTest { @Test public void whenConvertPostDtoToPostEntity_thenCorrect() { PostDto postDto = new PostDto(); - postDto.setId(Long.valueOf(1)); + postDto.setId(1L); postDto.setTitle(randomAlphabetic(6)); postDto.setUrl("www.test.com"); diff --git a/spring-boot-runtime/README.md b/spring-boot-runtime/README.md index d3dc19493d..a544faf830 100644 --- a/spring-boot-runtime/README.md +++ b/spring-boot-runtime/README.md @@ -7,4 +7,8 @@ This module contains articles about administering a Spring Boot runtime - [Programmatically Restarting a Spring Boot Application](https://www.baeldung.com/java-restart-spring-boot-app) - [Logging HTTP Requests with Spring Boot Actuator HTTP Tracing](https://www.baeldung.com/spring-boot-actuator-http) - [How to Disable Console Logging in Spring Boot](https://www.baeldung.com/spring-boot-disable-console-logging) - - [Spring Boot Embedded Tomcat Logs](https://www.baeldung.com/spring-boot-embedded-tomcat-logs) \ No newline at end of file + - [Spring Boot Embedded Tomcat Logs](https://www.baeldung.com/spring-boot-embedded-tomcat-logs) + - [How to Change the Default Port in Spring Boot](https://www.baeldung.com/spring-boot-change-port) + - [Project Configuration with Spring](https://www.baeldung.com/project-configuration-with-spring) + - [CORS with Spring](https://www.baeldung.com/spring-cors) + - [Spring – Log Incoming Requests](https://www.baeldung.com/spring-http-logging) \ No newline at end of file diff --git a/spring-boot-runtime/disabling-console-jul/README.md b/spring-boot-runtime/disabling-console-jul/README.md new file mode 100644 index 0000000000..554f051b41 --- /dev/null +++ b/spring-boot-runtime/disabling-console-jul/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [How to Disable Console Logging in Spring Boot](https://www.baeldung.com/spring-boot-disable-console-logging) diff --git a/spring-boot-runtime/disabling-console-jul/pom.xml b/spring-boot-runtime/disabling-console-jul/pom.xml index f6f7890df1..2dc1a834b6 100644 --- a/spring-boot-runtime/disabling-console-jul/pom.xml +++ b/spring-boot-runtime/disabling-console-jul/pom.xml @@ -1,11 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>disabling-console-jul</artifactId> - <name>disabling-console-jul</name> - <!-- this needs to use the boot parent directly in order to not inherit logback dependencies --> - - <parent> + <name>disabling-console-jul</name> + <!-- this needs to use the boot parent directly in order to not inherit logback dependencies --> + + <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.1.RELEASE</version> diff --git a/spring-boot-runtime/disabling-console-log4j2/README.md b/spring-boot-runtime/disabling-console-log4j2/README.md new file mode 100644 index 0000000000..554f051b41 --- /dev/null +++ b/spring-boot-runtime/disabling-console-log4j2/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [How to Disable Console Logging in Spring Boot](https://www.baeldung.com/spring-boot-disable-console-logging) diff --git a/spring-boot-runtime/disabling-console-log4j2/pom.xml b/spring-boot-runtime/disabling-console-log4j2/pom.xml index 1cf3eb3e68..b743c4bdac 100644 --- a/spring-boot-runtime/disabling-console-log4j2/pom.xml +++ b/spring-boot-runtime/disabling-console-log4j2/pom.xml @@ -1,44 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <artifactId>disabling-console-log4j2</artifactId> - <name>disabling-console-log4j2</name> - <!-- this needs to use the boot parent directly in order to not inherit logback dependencies --> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>disabling-console-log4j2</artifactId> + <name>disabling-console-log4j2</name> + <!-- this needs to use the boot parent directly in order to not inherit logback dependencies --> - <parent> + <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.1.RELEASE</version> </parent> - <dependencies> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter</artifactId> - <exclusions> - <exclusion> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-log4j2</artifactId> - </dependency> - </dependencies> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter</artifactId> + <exclusions> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-log4j2</artifactId> + </dependency> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + </plugins> + </build> </project> \ No newline at end of file diff --git a/spring-boot-runtime/disabling-console-logback/README.md b/spring-boot-runtime/disabling-console-logback/README.md new file mode 100644 index 0000000000..554f051b41 --- /dev/null +++ b/spring-boot-runtime/disabling-console-logback/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [How to Disable Console Logging in Spring Boot](https://www.baeldung.com/spring-boot-disable-console-logging) diff --git a/spring-boot-runtime/disabling-console-logback/pom.xml b/spring-boot-runtime/disabling-console-logback/pom.xml index 4b64885c66..1a415328b6 100644 --- a/spring-boot-runtime/disabling-console-logback/pom.xml +++ b/spring-boot-runtime/disabling-console-logback/pom.xml @@ -1,13 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>disabling-console-logback</artifactId> <name>disabling-console-logback</name> <parent> - <artifactId>spring-boot-disable-console-logging</artifactId> <groupId>com.baeldung</groupId> + <artifactId>spring-boot-disable-console-logging</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../</relativePath> </parent> diff --git a/spring-boot-runtime/pom.xml b/spring-boot-runtime/pom.xml index dca9b47410..baa7faebf8 100644 --- a/spring-boot-runtime/pom.xml +++ b/spring-boot-runtime/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-boot-runtime</artifactId> <name>spring-boot-runtime</name> @@ -8,8 +8,8 @@ <description>Demo project for Spring Boot</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -32,6 +32,12 @@ <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> + <!-- https://mvnrepository.com/artifact/commons-io/commons-io --> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>2.6</version> + </dependency> <dependency> <groupId>org.springframework.boot</groupId> @@ -57,6 +63,10 @@ <artifactId>spring-boot-admin-starter-client</artifactId> <version>${spring-boot-admin-starter-client.version}</version> </dependency> + <dependency> + <groupId>org.springframework.security</groupId> + <artifactId>spring-security-test</artifactId> + </dependency> <dependency> <groupId>com.h2database</groupId> @@ -88,7 +98,7 @@ <artifactId>spring-cloud-context</artifactId> <version>${springcloud.version}</version> </dependency> - + <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> @@ -146,7 +156,7 @@ </build> </profile> </profiles> - + <properties> <jpa.version>2.2</jpa.version> <guava.version>18.0</guava.version> diff --git a/spring-resttemplate/src/main/java/com/baeldung/changeport/CustomApplication.java b/spring-boot-runtime/src/main/java/com/baeldung/changeport/CustomApplication.java similarity index 100% rename from spring-resttemplate/src/main/java/com/baeldung/changeport/CustomApplication.java rename to spring-boot-runtime/src/main/java/com/baeldung/changeport/CustomApplication.java diff --git a/spring-resttemplate/src/main/java/com/baeldung/changeport/ServerPortCustomizer.java b/spring-boot-runtime/src/main/java/com/baeldung/changeport/ServerPortCustomizer.java similarity index 100% rename from spring-resttemplate/src/main/java/com/baeldung/changeport/ServerPortCustomizer.java rename to spring-boot-runtime/src/main/java/com/baeldung/changeport/ServerPortCustomizer.java diff --git a/spring-rest-simple/src/main/java/com/baeldung/cors/Account.java b/spring-boot-runtime/src/main/java/com/baeldung/cors/Account.java similarity index 100% rename from spring-rest-simple/src/main/java/com/baeldung/cors/Account.java rename to spring-boot-runtime/src/main/java/com/baeldung/cors/Account.java diff --git a/spring-rest-simple/src/main/java/com/baeldung/cors/AccountController.java b/spring-boot-runtime/src/main/java/com/baeldung/cors/AccountController.java similarity index 100% rename from spring-rest-simple/src/main/java/com/baeldung/cors/AccountController.java rename to spring-boot-runtime/src/main/java/com/baeldung/cors/AccountController.java diff --git a/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/config/MainApplication.java b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/config/MainApplication.java new file mode 100644 index 0000000000..507f340e9d --- /dev/null +++ b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/config/MainApplication.java @@ -0,0 +1,15 @@ +package com.baeldung.sampleapp.config; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@EnableAutoConfiguration +@ComponentScan("com.baeldung.sampleapp") +public class MainApplication implements WebMvcConfigurer { + + public static void main(final String[] args) { + SpringApplication.run(MainApplication.class, args); + } +} \ No newline at end of file diff --git a/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/config/RestClientConfig.java b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/config/RestClientConfig.java new file mode 100644 index 0000000000..cbaa21f4ca --- /dev/null +++ b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/config/RestClientConfig.java @@ -0,0 +1,29 @@ +package com.baeldung.sampleapp.config; + +import java.util.ArrayList; +import java.util.List; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.client.ClientHttpRequestInterceptor; +import org.springframework.util.CollectionUtils; +import org.springframework.web.client.RestTemplate; + +import com.baeldung.sampleapp.interceptors.RestTemplateHeaderModifierInterceptor; + +@Configuration +public class RestClientConfig { + + @Bean + public RestTemplate restTemplate() { + RestTemplate restTemplate = new RestTemplate(); + + List<ClientHttpRequestInterceptor> interceptors = restTemplate.getInterceptors(); + if (CollectionUtils.isEmpty(interceptors)) { + interceptors = new ArrayList<ClientHttpRequestInterceptor>(); + } + interceptors.add(new RestTemplateHeaderModifierInterceptor()); + restTemplate.setInterceptors(interceptors); + return restTemplate; + } +} diff --git a/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/config/WebConfig.java b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/config/WebConfig.java new file mode 100644 index 0000000000..dc4fb9c695 --- /dev/null +++ b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/config/WebConfig.java @@ -0,0 +1,42 @@ +package com.baeldung.sampleapp.config; + +import java.text.SimpleDateFormat; +import java.util.List; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +/* + * Please note that main web configuration is in src/main/webapp/WEB-INF/api-servlet.xml + */ +@Configuration +@EnableWebMvc +@ComponentScan({ "com.baeldung.sampleapp.web" }) +public class WebConfig implements WebMvcConfigurer { + + public WebConfig() { + super(); + } + + /* + @Override + public void configureMessageConverters(final List<HttpMessageConverter<?>> messageConverters) { + final Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder(); + builder.indentOutput(true) + .dateFormat(new SimpleDateFormat("dd-MM-yyyy hh:mm")); + messageConverters.add(new MappingJackson2HttpMessageConverter(builder.build())); + // messageConverters.add(new MappingJackson2XmlHttpMessageConverter(builder.createXmlMapper(true).build())); + + // messageConverters.add(new MappingJackson2HttpMessageConverter()); + + // messageConverters.add(new ProtobufHttpMessageConverter()); + + } + + */ +} diff --git a/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/interceptors/RestTemplateHeaderModifierInterceptor.java b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/interceptors/RestTemplateHeaderModifierInterceptor.java new file mode 100644 index 0000000000..9ebe1553a5 --- /dev/null +++ b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/interceptors/RestTemplateHeaderModifierInterceptor.java @@ -0,0 +1,18 @@ +package com.baeldung.sampleapp.interceptors; + +import java.io.IOException; + +import org.springframework.http.HttpRequest; +import org.springframework.http.client.ClientHttpRequestExecution; +import org.springframework.http.client.ClientHttpRequestInterceptor; +import org.springframework.http.client.ClientHttpResponse; + +public class RestTemplateHeaderModifierInterceptor implements ClientHttpRequestInterceptor { + + @Override + public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException { + ClientHttpResponse response = execution.execute(request, body); + response.getHeaders().add("Foo", "bar"); + return response; + } +} diff --git a/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/repository/HeavyResourceRepository.java b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/repository/HeavyResourceRepository.java new file mode 100644 index 0000000000..ea9541c31a --- /dev/null +++ b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/repository/HeavyResourceRepository.java @@ -0,0 +1,28 @@ +package com.baeldung.sampleapp.repository; + +import java.util.Map; + +import com.baeldung.sampleapp.web.dto.HeavyResource; +import com.baeldung.sampleapp.web.dto.HeavyResourceAddressOnly; + +public class HeavyResourceRepository { + + public void save(HeavyResource heavyResource) { + } + + public void save(HeavyResourceAddressOnly partialUpdate) { + + } + + public void save(Map<String, Object> updates, String id) { + + } + + public void save(HeavyResource heavyResource, String id) { + + } + + public void save(HeavyResourceAddressOnly partialUpdate, String id) { + + } +} diff --git a/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/BarMappingExamplesController.java b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/BarMappingExamplesController.java new file mode 100644 index 0000000000..c6b8d23944 --- /dev/null +++ b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/BarMappingExamplesController.java @@ -0,0 +1,47 @@ +package com.baeldung.sampleapp.web.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +@RequestMapping(value = "/ex") +public class BarMappingExamplesController { + + public BarMappingExamplesController() { + super(); + } + + // API + + // with @RequestParam + + @RequestMapping(value = "/bars") + @ResponseBody + public String getBarBySimplePathWithRequestParam(@RequestParam("id") final long id) { + return "Get a specific Bar with id=" + id; + } + + @RequestMapping(value = "/bars", params = "id") + @ResponseBody + public String getBarBySimplePathWithExplicitRequestParam(@RequestParam("id") final long id) { + return "Get a specific Bar with id=" + id; + } + + @RequestMapping(value = "/bars", params = { "id", "second" }) + @ResponseBody + public String getBarBySimplePathWithExplicitRequestParams(@RequestParam("id") final long id) { + return "Get a specific Bar with id=" + id; + } + + // with @PathVariable + + @RequestMapping(value = "/bars/{numericId:[\\d]+}") + @ResponseBody + public String getBarsBySimplePathWithPathVariable(@PathVariable final long numericId) { + return "Get a specific Bar with id=" + numericId; + } + +} diff --git a/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/CompanyController.java b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/CompanyController.java new file mode 100644 index 0000000000..bfda2fe0d6 --- /dev/null +++ b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/CompanyController.java @@ -0,0 +1,17 @@ +package com.baeldung.sampleapp.web.controller; + +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.baeldung.sampleapp.web.dto.Company; + +@RestController +public class CompanyController { + + @RequestMapping(value = "/companyRest", produces = MediaType.APPLICATION_JSON_VALUE) + public Company getCompanyRest() { + final Company company = new Company(1, "Xpto"); + return company; + } +} diff --git a/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/DeferredResultController.java b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/DeferredResultController.java new file mode 100644 index 0000000000..8f4eb3218a --- /dev/null +++ b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/DeferredResultController.java @@ -0,0 +1,85 @@ +package com.baeldung.sampleapp.web.controller; + +import java.util.concurrent.CompletableFuture; +import java.util.function.Consumer; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.context.request.async.DeferredResult; + +@RestController +public class DeferredResultController { + + private final static Logger LOG = LoggerFactory.getLogger(DeferredResultController.class); + + @GetMapping("/async-deferredresult") + public DeferredResult<ResponseEntity<?>> handleReqDefResult(Model model) { + LOG.info("Received request"); + DeferredResult<ResponseEntity<?>> deferredResult = new DeferredResult<>(); + + deferredResult.onCompletion(() -> LOG.info("Processing complete")); + + CompletableFuture.supplyAsync(() -> { + LOG.info("Processing in separate thread"); + try { + Thread.sleep(6000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + return "OK"; + }) + .whenCompleteAsync((result, exc) -> deferredResult.setResult(ResponseEntity.ok(result))); + + LOG.info("Servlet thread freed"); + return deferredResult; + } + + @GetMapping("/process-blocking") + public ResponseEntity<?> handleReqSync(Model model) { + // ... + return ResponseEntity.ok("ok"); + } + + @GetMapping("/async-deferredresult-timeout") + public DeferredResult<ResponseEntity<?>> handleReqWithTimeouts(Model model) { + LOG.info("Received async request with a configured timeout"); + DeferredResult<ResponseEntity<?>> deferredResult = new DeferredResult<>(500l); + deferredResult.onTimeout(() -> deferredResult.setErrorResult(ResponseEntity.status(HttpStatus.REQUEST_TIMEOUT) + .body("Request timeout occurred."))); + + CompletableFuture.supplyAsync(() -> { + LOG.info("Processing in separate thread"); + try { + Thread.sleep(6000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + return "error"; + }) + .whenCompleteAsync((result, exc) -> deferredResult.setResult(ResponseEntity.ok(result))); + LOG.info("servlet thread freed"); + return deferredResult; + } + + @GetMapping("/async-deferredresult-error") + public DeferredResult<ResponseEntity<?>> handleAsyncFailedRequest(Model model) { + LOG.info("Received async request with a configured error handler"); + DeferredResult<ResponseEntity<?>> deferredResult = new DeferredResult<>(); + deferredResult.onError(new Consumer<Throwable>() { + @Override + public void accept(Throwable t) { + deferredResult.setErrorResult(ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) + .body("An error occurred.")); + } + + }); + LOG.info("servlet thread freed"); + return deferredResult; + } + +} diff --git a/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/HeavyResourceController.java b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/HeavyResourceController.java new file mode 100644 index 0000000000..8156fc14a9 --- /dev/null +++ b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/HeavyResourceController.java @@ -0,0 +1,42 @@ +package com.baeldung.sampleapp.web.controller; + + +import java.util.Map; + +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +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.RestController; + +import com.baeldung.sampleapp.repository.HeavyResourceRepository; +import com.baeldung.sampleapp.web.dto.HeavyResource; +import com.baeldung.sampleapp.web.dto.HeavyResourceAddressOnly; + +@RestController +public class HeavyResourceController { + + private HeavyResourceRepository heavyResourceRepository = new HeavyResourceRepository(); + + @RequestMapping(value = "/heavyresource/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity<?> saveResource(@RequestBody HeavyResource heavyResource, @PathVariable("id") String id) { + heavyResourceRepository.save(heavyResource, id); + return ResponseEntity.ok("resource saved"); + } + + @RequestMapping(value = "/heavyresource/{id}", method = RequestMethod.PATCH, consumes = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity<?> partialUpdateName(@RequestBody HeavyResourceAddressOnly partialUpdate, @PathVariable("id") String id) { + heavyResourceRepository.save(partialUpdate, id); + return ResponseEntity.ok("resource address updated"); + } + + @RequestMapping(value = "/heavyresource2/{id}", method = RequestMethod.PATCH, consumes = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity<?> partialUpdateGeneric(@RequestBody Map<String, Object> updates, + @PathVariable("id") String id) { + heavyResourceRepository.save(updates, id); + return ResponseEntity.ok("resource updated"); + } + +} diff --git a/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/ItemController.java b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/ItemController.java new file mode 100644 index 0000000000..69bd458968 --- /dev/null +++ b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/ItemController.java @@ -0,0 +1,39 @@ +package com.baeldung.sampleapp.web.controller; + +import java.util.Date; + +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.baeldung.sampleapp.web.dto.Item; +import com.baeldung.sampleapp.web.dto.ItemManager; +import com.baeldung.sampleapp.web.dto.Views; +import com.fasterxml.jackson.annotation.JsonView; + +@RestController +public class ItemController { + + @JsonView(Views.Public.class) + @RequestMapping("/items/{id}") + public Item getItemPublic(@PathVariable final int id) { + return ItemManager.getById(id); + } + + @JsonView(Views.Internal.class) + @RequestMapping("/items/internal/{id}") + public Item getItemInternal(@PathVariable final int id) { + return ItemManager.getById(id); + } + + @RequestMapping("/date") + public Date getCurrentDate() throws Exception { + return new Date(); + } + + @RequestMapping("/delay/{seconds}") + public void getCurrentTime(@PathVariable final int seconds) throws Exception { + + Thread.sleep(seconds * 1000); + } +} \ No newline at end of file diff --git a/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/MyFooController.java b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/MyFooController.java new file mode 100644 index 0000000000..11ea5b70c9 --- /dev/null +++ b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/MyFooController.java @@ -0,0 +1,85 @@ +package com.baeldung.sampleapp.web.controller; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.http.HttpServletResponse; + +import org.springframework.http.HttpStatus; +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.servlet.support.ServletUriComponentsBuilder; + +import com.baeldung.sampleapp.web.dto.Foo; +import com.baeldung.sampleapp.web.exception.ResourceNotFoundException; + +@Controller +@RequestMapping(value = "/foos") +public class MyFooController { + + private final Map<Long, Foo> myfoos; + + public MyFooController() { + super(); + myfoos = new HashMap<Long, Foo>(); + myfoos.put(1L, new Foo(1L, "sample foo")); + } + + // API - read + + @RequestMapping(method = RequestMethod.GET, produces = { "application/json" }) + @ResponseBody + public Collection<Foo> findAll() { + return myfoos.values(); + } + + @RequestMapping(method = RequestMethod.GET, value = "/{id}", produces = { "application/json" }) + @ResponseBody + public Foo findById(@PathVariable final long id) { + final Foo foo = myfoos.get(id); + if (foo == null) { + throw new ResourceNotFoundException(); + } + return foo; + } + + // API - write + + @RequestMapping(method = RequestMethod.PUT, value = "/{id}") + @ResponseStatus(HttpStatus.OK) + @ResponseBody + public Foo updateFoo(@PathVariable("id") final long id, @RequestBody final Foo foo) { + myfoos.put(id, foo); + return foo; + } + + @RequestMapping(method = RequestMethod.PATCH, value = "/{id}") + @ResponseStatus(HttpStatus.OK) + public void updateFoo2(@PathVariable("id") final long id, @RequestBody final Foo foo) { + myfoos.put(id, foo); + } + + @RequestMapping(method = RequestMethod.POST) + @ResponseStatus(HttpStatus.CREATED) + @ResponseBody + public Foo createFoo(@RequestBody final Foo foo, HttpServletResponse response) { + myfoos.put(foo.getId(), foo); + response.setHeader("Location", ServletUriComponentsBuilder.fromCurrentRequest() + .path("/" + foo.getId()) + .toUriString()); + return foo; + } + + @RequestMapping(method = RequestMethod.DELETE, value = "/{id}") + @ResponseStatus(HttpStatus.OK) + public void deleteById(@PathVariable final long id) { + myfoos.remove(id); + } + +} diff --git a/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/PactController.java b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/PactController.java new file mode 100644 index 0000000000..0f5d7f1acb --- /dev/null +++ b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/PactController.java @@ -0,0 +1,33 @@ +package com.baeldung.sampleapp.web.controller; + +import java.util.ArrayList; +import java.util.List; + +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestController; + +import com.baeldung.sampleapp.web.dto.PactDto; + +@RestController +public class PactController { + + List<PactDto> pacts = new ArrayList<>(); + + @GetMapping(value = "/pact", produces = MediaType.APPLICATION_JSON_VALUE) + @ResponseBody + public PactDto getPact() { + return new PactDto(true, "tom"); + } + + @PostMapping("/pact") + @ResponseStatus(HttpStatus.CREATED) + public void createPact(PactDto pact) { + pacts.add(pact); + } + +} diff --git a/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/SimplePostController.java b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/SimplePostController.java new file mode 100644 index 0000000000..7b57d35088 --- /dev/null +++ b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/SimplePostController.java @@ -0,0 +1,74 @@ +package com.baeldung.sampleapp.web.controller; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; + +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.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import com.baeldung.sampleapp.web.dto.Foo; + +// used to test HttpClientPostingTest +@RestController +public class SimplePostController { + + @RequestMapping(value = "/users", method = RequestMethod.POST) + public String postUser(@RequestParam final String username, @RequestParam final String password) { + return "Success" + username; + } + + @RequestMapping(value = "/users/detail", method = RequestMethod.POST) + public String postUserDetail(@RequestBody final Foo entity) { + return "Success" + entity.getId(); + } + + @RequestMapping(value = "/users/multipart", method = RequestMethod.POST) + public String uploadFile(@RequestParam final String username, @RequestParam final String password, @RequestParam("file") final MultipartFile file) { + if (!file.isEmpty()) { + try { + final DateFormat dateFormat = new SimpleDateFormat("yyyy_MM_dd_HH.mm.ss"); + final String fileName = dateFormat.format(new Date()); + final File fileServer = new File(fileName); + fileServer.createNewFile(); + final byte[] bytes = file.getBytes(); + final BufferedOutputStream stream = new BufferedOutputStream(new FileOutputStream(fileServer)); + stream.write(bytes); + stream.close(); + return "You successfully uploaded " + username; + } catch (final Exception e) { + return "You failed to upload " + e.getMessage(); + } + } else { + return "You failed to upload because the file was empty."; + } + } + + @RequestMapping(value = "/users/upload", method = RequestMethod.POST) + public String postMultipart(@RequestParam("file") final MultipartFile file) { + if (!file.isEmpty()) { + try { + final DateFormat dateFormat = new SimpleDateFormat("yyyy_MM_dd_HH.mm.ss"); + final String fileName = dateFormat.format(new Date()); + final File fileServer = new File(fileName); + fileServer.createNewFile(); + final byte[] bytes = file.getBytes(); + final BufferedOutputStream stream = new BufferedOutputStream(new FileOutputStream(fileServer)); + stream.write(bytes); + stream.close(); + return "You successfully uploaded "; + } catch (final Exception e) { + return "You failed to upload " + e.getMessage(); + } + } else { + return "You failed to upload because the file was empty."; + } + } +} diff --git a/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/mediatypes/CustomMediaTypeController.java b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/mediatypes/CustomMediaTypeController.java new file mode 100644 index 0000000000..fc73bade87 --- /dev/null +++ b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/mediatypes/CustomMediaTypeController.java @@ -0,0 +1,25 @@ +package com.baeldung.sampleapp.web.controller.mediatypes; + +import org.springframework.web.bind.annotation.PathVariable; +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.RestController; + +import com.baeldung.sampleapp.web.dto.BaeldungItem; +import com.baeldung.sampleapp.web.dto.BaeldungItemV2; + +@RestController +@RequestMapping(value = "/", produces = "application/vnd.baeldung.api.v1+json") +public class CustomMediaTypeController { + + @RequestMapping(method = RequestMethod.GET, value = "/public/api/items/{id}", produces = "application/vnd.baeldung.api.v1+json") + public @ResponseBody BaeldungItem getItem(@PathVariable("id") String id) { + return new BaeldungItem("itemId1"); + } + + @RequestMapping(method = RequestMethod.GET, value = "/public/api/items/{id}", produces = "application/vnd.baeldung.api.v2+json") + public @ResponseBody BaeldungItemV2 getItemSecondAPIVersion(@PathVariable("id") String id) { + return new BaeldungItemV2("itemName"); + } +} diff --git a/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/redirect/RedirectController.java b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/redirect/RedirectController.java new file mode 100644 index 0000000000..321f3be3ef --- /dev/null +++ b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/controller/redirect/RedirectController.java @@ -0,0 +1,68 @@ +package com.baeldung.sampleapp.web.controller.redirect; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.View; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; +import org.springframework.web.servlet.view.RedirectView; + +@Controller +@RequestMapping("/") +public class RedirectController { + + @RequestMapping(value = "/redirectWithXMLConfig", method = RequestMethod.GET) + public ModelAndView redirectWithUsingXMLConfig(final ModelMap model) { + model.addAttribute("attribute", "redirectWithXMLConfig"); + return new ModelAndView("RedirectedUrl", model); + } + + @RequestMapping(value = "/redirectWithRedirectPrefix", method = RequestMethod.GET) + public ModelAndView redirectWithUsingRedirectPrefix(final ModelMap model) { + model.addAttribute("attribute", "redirectWithRedirectPrefix"); + return new ModelAndView("redirect:/redirectedUrl", model); + } + + @RequestMapping(value = "/redirectWithRedirectAttributes", method = RequestMethod.GET) + public RedirectView redirectWithRedirectAttributes(final RedirectAttributes redirectAttributes) { + redirectAttributes.addFlashAttribute("flashAttribute", "redirectWithRedirectAttributes"); + redirectAttributes.addAttribute("attribute", "redirectWithRedirectAttributes"); + return new RedirectView("redirectedUrl"); + } + + @RequestMapping(value = "/redirectWithRedirectView", method = RequestMethod.GET) + public RedirectView redirectWithUsingRedirectView(final ModelMap model) { + model.addAttribute("attribute", "redirectWithRedirectView"); + return new RedirectView("redirectedUrl"); + } + + @RequestMapping(value = "/forwardWithForwardPrefix", method = RequestMethod.GET) + public ModelAndView forwardWithUsingForwardPrefix(final ModelMap model) { + model.addAttribute("attribute", "redirectWithForwardPrefix"); + return new ModelAndView("forward:/redirectedUrl", model); + } + + @RequestMapping(value = "/redirectedUrl", method = RequestMethod.GET) + public ModelAndView redirection(final ModelMap model, @ModelAttribute("flashAttribute") final Object flashAttribute) { + model.addAttribute("redirectionAttribute", flashAttribute); + return new ModelAndView("redirection", model); + } + + @RequestMapping(value = "/redirectPostToPost", method = RequestMethod.POST) + public ModelAndView redirectPostToPost(HttpServletRequest request) { + request.setAttribute(View.RESPONSE_STATUS_ATTRIBUTE, HttpStatus.TEMPORARY_REDIRECT); + return new ModelAndView("redirect:/redirectedPostToPost"); + } + + @RequestMapping(value = "/redirectedPostToPost", method = RequestMethod.POST) + public ModelAndView redirectedPostToPost() { + return new ModelAndView("redirection"); + } + +} \ No newline at end of file diff --git a/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/BaeldungItem.java b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/BaeldungItem.java new file mode 100644 index 0000000000..807a254cfc --- /dev/null +++ b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/BaeldungItem.java @@ -0,0 +1,13 @@ +package com.baeldung.sampleapp.web.dto; + +public class BaeldungItem { + private final String itemId; + + public BaeldungItem(String itemId) { + this.itemId = itemId; + } + + public String getItemId() { + return itemId; + } +} diff --git a/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/BaeldungItemV2.java b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/BaeldungItemV2.java new file mode 100644 index 0000000000..f84591ea43 --- /dev/null +++ b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/BaeldungItemV2.java @@ -0,0 +1,14 @@ +package com.baeldung.sampleapp.web.dto; + + +public class BaeldungItemV2 { + private final String itemName; + + public BaeldungItemV2(String itemName) { + this.itemName = itemName; + } + + public String getItemName() { + return itemName; + } +} diff --git a/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/Company.java b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/Company.java new file mode 100644 index 0000000000..6cfcc079d9 --- /dev/null +++ b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/Company.java @@ -0,0 +1,38 @@ +package com.baeldung.sampleapp.web.dto; + +public class Company { + + private long id; + private String name; + + public Company() { + super(); + } + + public Company(final long id, final String name) { + this.id = id; + this.name = name; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + + public long getId() { + return id; + } + + public void setId(final long id) { + this.id = id; + } + + @Override + public String toString() { + return "Company [id=" + id + ", name=" + name + "]"; + } + +} diff --git a/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/Foo.java b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/Foo.java new file mode 100644 index 0000000000..de1d76ed92 --- /dev/null +++ b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/Foo.java @@ -0,0 +1,42 @@ +package com.baeldung.sampleapp.web.dto; + +public class Foo { + private long id; + private String name; + + public Foo() { + super(); + } + + public Foo(final String name) { + super(); + + this.name = name; + } + + public Foo(final long id, final String name) { + super(); + + this.id = id; + this.name = name; + } + + // API + + public long getId() { + return id; + } + + public void setId(final long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + +} \ No newline at end of file diff --git a/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/HeavyResource.java b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/HeavyResource.java new file mode 100644 index 0000000000..2821341888 --- /dev/null +++ b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/HeavyResource.java @@ -0,0 +1,62 @@ +package com.baeldung.sampleapp.web.dto; + + +public class HeavyResource { + private Integer id; + private String name; + private String surname; + private Integer age; + private String address; + + + public HeavyResource() { + } + + public HeavyResource(Integer id, String name, String surname, Integer age, String address) { + this.id = id; + this.name = name; + this.surname = surname; + this.age = age; + this.address = address; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSurname() { + return surname; + } + + public void setSurname(String surname) { + this.surname = surname; + } + + public Integer getAge() { + return age; + } + + public void setAge(Integer age) { + this.age = age; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } +} diff --git a/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/HeavyResourceAddressOnly.java b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/HeavyResourceAddressOnly.java new file mode 100644 index 0000000000..01ee6e7dd4 --- /dev/null +++ b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/HeavyResourceAddressOnly.java @@ -0,0 +1,31 @@ +package com.baeldung.sampleapp.web.dto; + + +public class HeavyResourceAddressOnly { + private Integer id; + private String address; + + public HeavyResourceAddressOnly() { + } + + public HeavyResourceAddressOnly(Integer id, String address) { + this.id = id; + this.address = address; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } +} diff --git a/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/HeavyResourceAddressPartialUpdate.java b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/HeavyResourceAddressPartialUpdate.java new file mode 100644 index 0000000000..1832a1a58b --- /dev/null +++ b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/HeavyResourceAddressPartialUpdate.java @@ -0,0 +1,31 @@ +package com.baeldung.sampleapp.web.dto; + + +public class HeavyResourceAddressPartialUpdate { + private Integer id; + private String address; + + public HeavyResourceAddressPartialUpdate() { + } + + public HeavyResourceAddressPartialUpdate(Integer id, String address) { + this.id = id; + this.address = address; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } +} diff --git a/jackson/src/test/java/com/baeldung/jackson/jsonview/Item.java b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/Item.java similarity index 94% rename from jackson/src/test/java/com/baeldung/jackson/jsonview/Item.java rename to spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/Item.java index 26d20d4847..a4fcef5dce 100644 --- a/jackson/src/test/java/com/baeldung/jackson/jsonview/Item.java +++ b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/Item.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.jsonview; +package com.baeldung.sampleapp.web.dto; import com.fasterxml.jackson.annotation.JsonView; @@ -33,4 +33,4 @@ public class Item { public String getOwnerName() { return ownerName; } -} +} \ No newline at end of file diff --git a/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/ItemManager.java b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/ItemManager.java new file mode 100644 index 0000000000..0009c0180b --- /dev/null +++ b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/ItemManager.java @@ -0,0 +1,9 @@ +package com.baeldung.sampleapp.web.dto; + +public class ItemManager { + + public static Item getById(final int id) { + final Item item = new Item(2, "book", "John"); + return item; + } +} diff --git a/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/PactDto.java b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/PactDto.java new file mode 100644 index 0000000000..e184119611 --- /dev/null +++ b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/PactDto.java @@ -0,0 +1,33 @@ +package com.baeldung.sampleapp.web.dto; + +public class PactDto { + + private boolean condition; + private String name; + + public PactDto() { + } + + public PactDto(boolean condition, String name) { + super(); + this.condition = condition; + this.name = name; + } + + public boolean isCondition() { + return condition; + } + + public void setCondition(boolean condition) { + this.condition = condition; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + +} diff --git a/jackson/src/test/java/com/baeldung/jackson/jsonview/Views.java b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/Views.java similarity index 75% rename from jackson/src/test/java/com/baeldung/jackson/jsonview/Views.java rename to spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/Views.java index 65950b7f9f..e2d83fda22 100644 --- a/jackson/src/test/java/com/baeldung/jackson/jsonview/Views.java +++ b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/dto/Views.java @@ -1,4 +1,4 @@ -package com.baeldung.jackson.jsonview; +package com.baeldung.sampleapp.web.dto; public class Views { public static class Public { diff --git a/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/exception/ResourceNotFoundException.java b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/exception/ResourceNotFoundException.java new file mode 100644 index 0000000000..69532f196d --- /dev/null +++ b/spring-boot-runtime/src/main/java/com/baeldung/sampleapp/web/exception/ResourceNotFoundException.java @@ -0,0 +1,8 @@ +package com.baeldung.sampleapp.web.exception; + +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.ResponseStatus; + +@ResponseStatus(value = HttpStatus.NOT_FOUND) +public class ResourceNotFoundException extends RuntimeException { +} diff --git a/spring-resttemplate/src/main/java/com/baeldung/web/log/app/Application.java b/spring-boot-runtime/src/main/java/com/baeldung/web/log/app/Application.java similarity index 93% rename from spring-resttemplate/src/main/java/com/baeldung/web/log/app/Application.java rename to spring-boot-runtime/src/main/java/com/baeldung/web/log/app/Application.java index 6e2607339c..f20fba737a 100644 --- a/spring-resttemplate/src/main/java/com/baeldung/web/log/app/Application.java +++ b/spring-boot-runtime/src/main/java/com/baeldung/web/log/app/Application.java @@ -11,6 +11,7 @@ import org.springframework.context.annotation.ComponentScan; import org.springframework.web.context.ContextLoaderListener; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; import org.springframework.web.servlet.DispatcherServlet; +import org.springframework.context.annotation.PropertySource; import com.baeldung.web.log.config.CustomeRequestLoggingFilter; @@ -18,6 +19,7 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer @EnableAutoConfiguration @ComponentScan("com.baeldung.web.log") +@PropertySource("application-log.properties") @SpringBootApplication public class Application extends SpringBootServletInitializer { diff --git a/spring-resttemplate/src/main/java/com/baeldung/web/log/app/TaxiFareRequestInterceptor.java b/spring-boot-runtime/src/main/java/com/baeldung/web/log/app/TaxiFareRequestInterceptor.java similarity index 100% rename from spring-resttemplate/src/main/java/com/baeldung/web/log/app/TaxiFareRequestInterceptor.java rename to spring-boot-runtime/src/main/java/com/baeldung/web/log/app/TaxiFareRequestInterceptor.java diff --git a/spring-resttemplate/src/main/java/com/baeldung/web/log/config/CustomeRequestLoggingFilter.java b/spring-boot-runtime/src/main/java/com/baeldung/web/log/config/CustomeRequestLoggingFilter.java similarity index 100% rename from spring-resttemplate/src/main/java/com/baeldung/web/log/config/CustomeRequestLoggingFilter.java rename to spring-boot-runtime/src/main/java/com/baeldung/web/log/config/CustomeRequestLoggingFilter.java diff --git a/spring-resttemplate/src/main/java/com/baeldung/web/log/config/RequestLoggingFilterConfig.java b/spring-boot-runtime/src/main/java/com/baeldung/web/log/config/RequestLoggingFilterConfig.java similarity index 100% rename from spring-resttemplate/src/main/java/com/baeldung/web/log/config/RequestLoggingFilterConfig.java rename to spring-boot-runtime/src/main/java/com/baeldung/web/log/config/RequestLoggingFilterConfig.java diff --git a/spring-resttemplate/src/main/java/com/baeldung/web/log/config/TaxiFareMVCConfig.java b/spring-boot-runtime/src/main/java/com/baeldung/web/log/config/TaxiFareMVCConfig.java similarity index 100% rename from spring-resttemplate/src/main/java/com/baeldung/web/log/config/TaxiFareMVCConfig.java rename to spring-boot-runtime/src/main/java/com/baeldung/web/log/config/TaxiFareMVCConfig.java diff --git a/spring-resttemplate/src/main/java/com/baeldung/web/log/controller/TaxiFareController.java b/spring-boot-runtime/src/main/java/com/baeldung/web/log/controller/TaxiFareController.java similarity index 100% rename from spring-resttemplate/src/main/java/com/baeldung/web/log/controller/TaxiFareController.java rename to spring-boot-runtime/src/main/java/com/baeldung/web/log/controller/TaxiFareController.java diff --git a/spring-resttemplate/src/main/java/com/baeldung/web/log/data/RateCard.java b/spring-boot-runtime/src/main/java/com/baeldung/web/log/data/RateCard.java similarity index 100% rename from spring-resttemplate/src/main/java/com/baeldung/web/log/data/RateCard.java rename to spring-boot-runtime/src/main/java/com/baeldung/web/log/data/RateCard.java diff --git a/spring-resttemplate/src/main/java/com/baeldung/web/log/data/TaxiRide.java b/spring-boot-runtime/src/main/java/com/baeldung/web/log/data/TaxiRide.java similarity index 100% rename from spring-resttemplate/src/main/java/com/baeldung/web/log/data/TaxiRide.java rename to spring-boot-runtime/src/main/java/com/baeldung/web/log/data/TaxiRide.java diff --git a/spring-resttemplate/src/main/java/com/baeldung/web/log/service/TaxiFareCalculatorService.java b/spring-boot-runtime/src/main/java/com/baeldung/web/log/service/TaxiFareCalculatorService.java similarity index 100% rename from spring-resttemplate/src/main/java/com/baeldung/web/log/service/TaxiFareCalculatorService.java rename to spring-boot-runtime/src/main/java/com/baeldung/web/log/service/TaxiFareCalculatorService.java diff --git a/spring-resttemplate/src/main/java/com/baeldung/web/log/util/RequestLoggingUtil.java b/spring-boot-runtime/src/main/java/com/baeldung/web/log/util/RequestLoggingUtil.java similarity index 100% rename from spring-resttemplate/src/main/java/com/baeldung/web/log/util/RequestLoggingUtil.java rename to spring-boot-runtime/src/main/java/com/baeldung/web/log/util/RequestLoggingUtil.java diff --git a/spring-boot-runtime/src/main/resources/application-log.properties b/spring-boot-runtime/src/main/resources/application-log.properties new file mode 100644 index 0000000000..1a26e3ad99 --- /dev/null +++ b/spring-boot-runtime/src/main/resources/application-log.properties @@ -0,0 +1,2 @@ +server.port=8082 +server.servlet.context-path=/spring-rest \ No newline at end of file diff --git a/spring-boot-runtime/src/main/resources/application-logging.properties b/spring-boot-runtime/src/main/resources/application-logging.properties index 338251cf9b..d3bdaa00b7 100644 --- a/spring-boot-runtime/src/main/resources/application-logging.properties +++ b/spring-boot-runtime/src/main/resources/application-logging.properties @@ -20,3 +20,4 @@ spring.application.name=spring-boot-management server.port=8081 + diff --git a/spring-rest/src/main/webapp/WEB-INF/api-servlet.xml b/spring-boot-runtime/src/main/webapp/WEB-INF/api-servlet.xml similarity index 100% rename from spring-rest/src/main/webapp/WEB-INF/api-servlet.xml rename to spring-boot-runtime/src/main/webapp/WEB-INF/api-servlet.xml diff --git a/spring-rest/src/main/webapp/WEB-INF/company.html b/spring-boot-runtime/src/main/webapp/WEB-INF/company.html similarity index 100% rename from spring-rest/src/main/webapp/WEB-INF/company.html rename to spring-boot-runtime/src/main/webapp/WEB-INF/company.html diff --git a/spring-rest/src/main/webapp/WEB-INF/spring-views.xml b/spring-boot-runtime/src/main/webapp/WEB-INF/spring-views.xml similarity index 100% rename from spring-rest/src/main/webapp/WEB-INF/spring-views.xml rename to spring-boot-runtime/src/main/webapp/WEB-INF/spring-views.xml diff --git a/spring-rest/src/main/webapp/WEB-INF/web.xml b/spring-boot-runtime/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from spring-rest/src/main/webapp/WEB-INF/web.xml rename to spring-boot-runtime/src/main/webapp/WEB-INF/web.xml diff --git a/spring-resttemplate/src/test/java/com/baeldung/web/controller/HeavyResourceControllerIntegrationTest.java b/spring-boot-runtime/src/test/java/com/baeldung/web/controller/HeavyResourceControllerIntegrationTest.java similarity index 100% rename from spring-resttemplate/src/test/java/com/baeldung/web/controller/HeavyResourceControllerIntegrationTest.java rename to spring-boot-runtime/src/test/java/com/baeldung/web/controller/HeavyResourceControllerIntegrationTest.java diff --git a/spring-resttemplate/src/test/java/com/baeldung/web/controller/TaxiFareControllerIntegrationTest.java b/spring-boot-runtime/src/test/java/com/baeldung/web/controller/TaxiFareControllerIntegrationTest.java similarity index 56% rename from spring-resttemplate/src/test/java/com/baeldung/web/controller/TaxiFareControllerIntegrationTest.java rename to spring-boot-runtime/src/test/java/com/baeldung/web/controller/TaxiFareControllerIntegrationTest.java index 1cc098abf1..97d669d3fa 100644 --- a/spring-resttemplate/src/test/java/com/baeldung/web/controller/TaxiFareControllerIntegrationTest.java +++ b/spring-boot-runtime/src/test/java/com/baeldung/web/controller/TaxiFareControllerIntegrationTest.java @@ -7,14 +7,17 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.context.annotation.Configuration; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import com.baeldung.web.log.app.Application; import com.baeldung.web.log.data.TaxiRide; @RunWith(SpringRunner.class) -@SpringBootTest(classes = { Application.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@SpringBootTest(classes = { Application.class, TaxiFareControllerIntegrationTest.SecurityConfig.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class TaxiFareControllerIntegrationTest { @LocalServerPort @@ -22,7 +25,8 @@ public class TaxiFareControllerIntegrationTest { @Test public void givenRequest_whenFetchTaxiFareRateCard_thanOK() { - + + System.out.println(port); String URL = "http://localhost:" + port + "/spring-rest"; TestRestTemplate testRestTemplate = new TestRestTemplate(); TaxiRide taxiRide = new TaxiRide(true, 10l); @@ -32,4 +36,17 @@ public class TaxiFareControllerIntegrationTest { assertThat(fare, equalTo("200")); } + + @Configuration + static class SecurityConfig extends WebSecurityConfigurerAdapter { + @Override + protected void configure(HttpSecurity http) throws Exception { + System.out.println("security being set"); + http + .authorizeRequests() + .anyRequest().permitAll() + .and() + .csrf().disable(); + } + } } \ No newline at end of file diff --git a/spring-boot-security/pom.xml b/spring-boot-security/pom.xml index 79a77775de..62c04b4dc3 100644 --- a/spring-boot-security/pom.xml +++ b/spring-boot-security/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-boot-security</artifactId> <name>spring-boot-security</name> @@ -8,8 +8,8 @@ <packaging>jar</packaging> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -25,9 +25,9 @@ <version>2.3.3.RELEASE</version> </dependency> <dependency> - <groupId>org.springframework.security.oauth.boot</groupId> - <artifactId>spring-security-oauth2-autoconfigure</artifactId> - <version>2.1.2.RELEASE</version> + <groupId>org.springframework.security.oauth.boot</groupId> + <artifactId>spring-security-oauth2-autoconfigure</artifactId> + <version>2.1.2.RELEASE</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> @@ -66,7 +66,6 @@ <artifactId>spring-boot-autoconfigure</artifactId> <version>2.1.1.RELEASE</version> </dependency> - </dependencies> <build> diff --git a/spring-boot-springdoc/pom.xml b/spring-boot-springdoc/pom.xml index a818db6e53..8c35e38ae6 100644 --- a/spring-boot-springdoc/pom.xml +++ b/spring-boot-springdoc/pom.xml @@ -1,18 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-boot-springdoc</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-boot-springdoc</name> - <description>Project for Springdoc integration</description> <packaging>jar</packaging> + <description>Project for Springdoc integration</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -102,5 +101,4 @@ </profile> </profiles> - </project> \ No newline at end of file diff --git a/spring-boot-springdoc/src/test/java/com/baeldung/springdoc/SpringContextIntegrationTest.java b/spring-boot-springdoc/src/test/java/com/baeldung/springdoc/SpringContextTest.java similarity index 88% rename from spring-boot-springdoc/src/test/java/com/baeldung/springdoc/SpringContextIntegrationTest.java rename to spring-boot-springdoc/src/test/java/com/baeldung/springdoc/SpringContextTest.java index 58c12dc3bc..4cd84477b9 100644 --- a/spring-boot-springdoc/src/test/java/com/baeldung/springdoc/SpringContextIntegrationTest.java +++ b/spring-boot-springdoc/src/test/java/com/baeldung/springdoc/SpringContextTest.java @@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest -public class SpringContextIntegrationTest { +public class SpringContextTest { @Test public void whenSpringContextIsBootstrapped_thenNoExceptions() { diff --git a/spring-boot-testing/pom.xml b/spring-boot-testing/pom.xml index 12fb14b366..ebe87fdd70 100644 --- a/spring-boot-testing/pom.xml +++ b/spring-boot-testing/pom.xml @@ -1,15 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-boot-testing</artifactId> <name>spring-boot-testing</name> - <description>This is simple boot application for demonstrating testing features.</description> <packaging>war</packaging> + <description>This is simple boot application for demonstrating testing features.</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -58,17 +59,17 @@ <version>${spock.version}</version> <scope>test</scope> </dependency> - + <dependency> <groupId>io.rest-assured</groupId> <artifactId>rest-assured</artifactId> <scope>test</scope> </dependency> - + </dependencies> <build> - <finalName>spring-boot</finalName> + <finalName>spring-boot-testing</finalName> <resources> <resource> <directory>src/main/resources</directory> @@ -120,9 +121,8 @@ </goals> </execution> </executions> - </plugin> + </plugin> </plugins> - </build> <properties> diff --git a/spring-boot-testing/src/test/java/com/baeldung/boot/SpringContextIntegrationTest.java b/spring-boot-testing/src/test/java/com/baeldung/boot/SpringContextIntegrationTest.java deleted file mode 100644 index 63ab07fdb7..0000000000 --- a/spring-boot-testing/src/test/java/com/baeldung/boot/SpringContextIntegrationTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.boot; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-boot-vue/pom.xml b/spring-boot-vue/pom.xml index 5d19f01d1e..98bba784d2 100644 --- a/spring-boot-vue/pom.xml +++ b/spring-boot-vue/pom.xml @@ -1,52 +1,51 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> - <artifactId>spring-boot-vue</artifactId> - <version>0.0.1-SNAPSHOT</version> - <name>spring-boot-vue</name> - <packaging>jar</packaging> - <description>Demo project for Spring Boot Vue project</description> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>spring-boot-vue</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>spring-boot-vue</name> + <packaging>jar</packaging> + <description>Demo project for Spring Boot Vue project</description> - <parent> - <artifactId>parent-boot-2</artifactId> + <parent> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> - <dependencies> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> <!-- needed to render html templates in /resources/templates --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> - </dependencies> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + </plugins> + </build> - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - </properties> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + </properties> </project> diff --git a/spring-boot-vue/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-vue/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 6ed93e8c44..0000000000 --- a/spring-boot-vue/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.springbootmvc.SpringBootMvcApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringBootMvcApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-boot/pom.xml b/spring-boot/pom.xml index 401e0289e8..2152a0a00d 100644 --- a/spring-boot/pom.xml +++ b/spring-boot/pom.xml @@ -1,6 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-boot</artifactId> <name>spring-boot</name> @@ -8,14 +9,14 @@ <description>This is simple boot application for Spring boot actuator test</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> <dependencies> - + <!-- JUnit Jupiter dependencies --> <dependency> <groupId>org.junit.jupiter</groupId> diff --git a/spring-caching/pom.xml b/spring-caching/pom.xml index 3329cd5f77..c3ededbd14 100644 --- a/spring-caching/pom.xml +++ b/spring-caching/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -7,8 +8,8 @@ <packaging>war</packaging> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -40,4 +41,5 @@ <properties> <ehcache.version>3.5.2</ehcache.version> </properties> + </project> \ No newline at end of file diff --git a/spring-cloud-bus/pom.xml b/spring-cloud-bus/pom.xml index fdaf8c024f..513c8bade6 100644 --- a/spring-cloud-bus/pom.xml +++ b/spring-cloud-bus/pom.xml @@ -1,40 +1,40 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung.spring.cloud</groupId> - <artifactId>spring-cloud-bus</artifactId> - <version>1.0.0-SNAPSHOT</version> - <name>spring-cloud-bus</name> - <packaging>pom</packaging> + xmlns="http://maven.apache.org/POM/4.0.0" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>com.baeldung.spring.cloud</groupId> + <artifactId>spring-cloud-bus</artifactId> + <version>1.0.0-SNAPSHOT</version> + <name>spring-cloud-bus</name> + <packaging>pom</packaging> - <parent> - <artifactId>parent-boot-1</artifactId> - <groupId>com.baeldung</groupId> - <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-boot-1</relativePath> - </parent> + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> + <version>0.0.1-SNAPSHOT</version> + <relativePath>../parent-boot-1</relativePath> + </parent> - <modules> - <module>spring-cloud-config-client</module> - <module>spring-cloud-config-server</module> - </modules> + <modules> + <module>spring-cloud-config-client</module> + <module>spring-cloud-config-server</module> + </modules> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-dependencies</artifactId> - <version>${spring-cloud-dependencies.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-dependencies</artifactId> + <version>${spring-cloud-dependencies.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> - <properties> - <spring-cloud-dependencies.version>Brixton.SR7</spring-cloud-dependencies.version> - </properties> + <properties> + <spring-cloud-dependencies.version>Brixton.SR7</spring-cloud-dependencies.version> + </properties> </project> diff --git a/spring-cloud-bus/spring-cloud-config-client/pom.xml b/spring-cloud-bus/spring-cloud-config-client/pom.xml index 4994626ba5..7e1185415b 100644 --- a/spring-cloud-bus/spring-cloud-config-client/pom.xml +++ b/spring-cloud-bus/spring-cloud-config-client/pom.xml @@ -1,52 +1,52 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <artifactId>spring-cloud-config-client</artifactId> - <name>spring-cloud-config-client</name> - <packaging>jar</packaging> - <description>Demo Spring Cloud Config Client</description> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>spring-cloud-config-client</artifactId> + <name>spring-cloud-config-client</name> + <packaging>jar</packaging> + <description>Demo Spring Cloud Config Client</description> - <parent> - <artifactId>spring-cloud-bus</artifactId> - <groupId>com.baeldung.spring.cloud</groupId> - <version>1.0.0-SNAPSHOT</version> - </parent> + <parent> + <groupId>com.baeldung.spring.cloud</groupId> + <artifactId>spring-cloud-bus</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-config</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-config</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-actuator</artifactId> - </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-actuator</artifactId> + </dependency> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-bus-amqp</artifactId> - </dependency> - </dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-bus-amqp</artifactId> + </dependency> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + </plugins> + </build> </project> diff --git a/spring-cloud-bus/spring-cloud-config-server/pom.xml b/spring-cloud-bus/spring-cloud-config-server/pom.xml index 51b447161e..a61008f3dd 100644 --- a/spring-cloud-bus/spring-cloud-config-server/pom.xml +++ b/spring-cloud-bus/spring-cloud-config-server/pom.xml @@ -1,53 +1,53 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <artifactId>spring-cloud-config-server</artifactId> - <name>spring-cloud-config-server</name> - <packaging>jar</packaging> - <description>Demo Spring Cloud Config Server</description> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>spring-cloud-config-server</artifactId> + <name>spring-cloud-config-server</name> + <packaging>jar</packaging> + <description>Demo Spring Cloud Config Server</description> - <parent> - <artifactId>spring-cloud-bus</artifactId> - <groupId>com.baeldung.spring.cloud</groupId> - <version>1.0.0-SNAPSHOT</version> - </parent> + <parent> + <groupId>com.baeldung.spring.cloud</groupId> + <artifactId>spring-cloud-bus</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-config-server</artifactId> - </dependency> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-config-server</artifactId> + </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-security</artifactId> - </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-security</artifactId> + </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-config-monitor</artifactId> - </dependency> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-config-monitor</artifactId> + </dependency> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-stream-rabbit</artifactId> - </dependency> - </dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-stream-rabbit</artifactId> + </dependency> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + </plugins> + </build> </project> diff --git a/spring-cloud-bus/spring-cloud-config-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud-bus/spring-cloud-config-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index c43bb9f067..0000000000 --- a/spring-cloud-bus/spring-cloud-config-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.SpringCloudConfigServerApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringCloudConfigServerApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void contextLoads() { - } - -} diff --git a/spring-cloud-data-flow/apache-spark-job/pom.xml b/spring-cloud-data-flow/apache-spark-job/pom.xml index 306b23c60a..65a57671ea 100644 --- a/spring-cloud-data-flow/apache-spark-job/pom.xml +++ b/spring-cloud-data-flow/apache-spark-job/pom.xml @@ -5,18 +5,18 @@ <modelVersion>4.0.0</modelVersion> <artifactId>apache-spark-job</artifactId> <name>apache-spark-job</name> - + <parent> - <artifactId>spring-cloud-data-flow</artifactId> <groupId>com.baeldung</groupId> + <artifactId>spring-cloud-data-flow</artifactId> <version>0.0.1-SNAPSHOT</version> </parent> - + <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-task-core</artifactId> - <version>${spring-cloud-task-core.version}</version> + <version>${spring-cloud-task-core.version}</version> </dependency> <dependency> <groupId>org.apache.spark</groupId> diff --git a/spring-cloud-data-flow/batch-job/pom.xml b/spring-cloud-data-flow/batch-job/pom.xml index 04187badb4..1ed0017bc0 100644 --- a/spring-cloud-data-flow/batch-job/pom.xml +++ b/spring-cloud-data-flow/batch-job/pom.xml @@ -1,21 +1,33 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.baeldung.spring.cloud</groupId> <artifactId>batch-job</artifactId> <version>0.0.1-SNAPSHOT</version> <name>batch-job</name> - <description>Demo project for Spring Boot</description> <packaging>jar</packaging> + <description>Demo project for Spring Boot</description> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-1</relativePath> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-dependencies</artifactId> + <version>Brixton.SR5</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> @@ -35,18 +47,6 @@ </dependency> </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-dependencies</artifactId> - <version>Brixton.SR5</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <properties> <spring-cloud-task-starter.version>1.0.3.RELEASE</spring-cloud-task-starter.version> </properties> diff --git a/spring-cloud-data-flow/batch-job/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud-data-flow/batch-job/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index b87ace74a4..0000000000 --- a/spring-cloud-data-flow/batch-job/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.baeldung; - -import org.baeldung.spring.cloud.JobConfiguration; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -@ContextConfiguration(classes = JobConfiguration.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-cloud-data-flow/pom.xml b/spring-cloud-data-flow/pom.xml index 32e16c72fc..e2a0664f30 100644 --- a/spring-cloud-data-flow/pom.xml +++ b/spring-cloud-data-flow/pom.xml @@ -1,11 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-cloud-data-flow</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-cloud-data-flow</name> <packaging>pom</packaging> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> diff --git a/spring-cloud-data-flow/spring-cloud-data-flow-etl/customer-mongodb-sink/pom.xml b/spring-cloud-data-flow/spring-cloud-data-flow-etl/customer-mongodb-sink/pom.xml index 409db34829..9fd378b171 100644 --- a/spring-cloud-data-flow/spring-cloud-data-flow-etl/customer-mongodb-sink/pom.xml +++ b/spring-cloud-data-flow/spring-cloud-data-flow-etl/customer-mongodb-sink/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>customer-mongodb-sink</artifactId> <name>customer-mongodb-sink</name> @@ -8,12 +8,24 @@ <description>Example ETL Load Project</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../../parent-boot-2</relativePath> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-dependencies</artifactId> + <version>${spring-cloud.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> @@ -39,18 +51,6 @@ </dependency> </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-dependencies</artifactId> - <version>${spring-cloud.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <build> <plugins> <plugin> diff --git a/spring-cloud-data-flow/spring-cloud-data-flow-etl/customer-transform/pom.xml b/spring-cloud-data-flow/spring-cloud-data-flow-etl/customer-transform/pom.xml index 66f1d5e0d7..fdec22f3b3 100644 --- a/spring-cloud-data-flow/spring-cloud-data-flow-etl/customer-transform/pom.xml +++ b/spring-cloud-data-flow/spring-cloud-data-flow-etl/customer-transform/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>customer-transform</artifactId> <name>customer-transform</name> @@ -8,12 +8,24 @@ <description>Example transform ETL step</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../../parent-boot-2</relativePath> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-dependencies</artifactId> + <version>${spring-cloud.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> @@ -31,18 +43,6 @@ </dependency> </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-dependencies</artifactId> - <version>${spring-cloud.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <build> <plugins> <plugin> diff --git a/spring-cloud-data-flow/spring-cloud-data-flow-etl/pom.xml b/spring-cloud-data-flow/spring-cloud-data-flow-etl/pom.xml index 0274b5fed1..91abdf3442 100644 --- a/spring-cloud-data-flow/spring-cloud-data-flow-etl/pom.xml +++ b/spring-cloud-data-flow/spring-cloud-data-flow-etl/pom.xml @@ -1,11 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-cloud-data-flow-etl</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-cloud-data-flow-etl</name> <packaging>pom</packaging> - + <parent> <groupId>com.baeldung</groupId> <artifactId>spring-cloud-data-flow</artifactId> diff --git a/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/data-flow-server/pom.xml b/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/data-flow-server/pom.xml index 7166b0fd32..ba108dc5c7 100644 --- a/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/data-flow-server/pom.xml +++ b/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/data-flow-server/pom.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>data-flow-server</artifactId> <version>0.0.1-SNAPSHOT</version> @@ -10,29 +10,12 @@ <description>Demo project for Spring Boot</description> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../../parent-boot-1</relativePath> </parent> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-dataflow-server-local</artifactId> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-core</artifactId> - <version>${hibernate.compatible.version}</version> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-entitymanager</artifactId> - <version>${hibernate.compatible.version}</version> - </dependency> - </dependencies> - <dependencyManagement> <dependencies> <dependency> @@ -52,6 +35,23 @@ </dependencies> </dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-dataflow-server-local</artifactId> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-core</artifactId> + <version>${hibernate.compatible.version}</version> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-entitymanager</artifactId> + <version>${hibernate.compatible.version}</version> + </dependency> + </dependencies> + <properties> <spring-cloud-dataflow-dependencies.version>1.3.1.RELEASE</spring-cloud-dataflow-dependencies.version> <spring-cloud-dependencies.version>Edgware.SR6</spring-cloud-dependencies.version> diff --git a/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/data-flow-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/data-flow-server/src/test/java/org/baeldung/SpringContextTest.java similarity index 90% rename from spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/data-flow-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/data-flow-server/src/test/java/org/baeldung/SpringContextTest.java index eb2a5c54ef..83cb8067cf 100644 --- a/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/data-flow-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/data-flow-server/src/test/java/org/baeldung/SpringContextTest.java @@ -8,7 +8,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest(classes = DataFlowServerApplication.class) -public class SpringContextIntegrationTest { +public class SpringContextTest { @Test public void whenSpringContextIsBootstrapped_thenNoExceptions() { diff --git a/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/data-flow-shell/pom.xml b/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/data-flow-shell/pom.xml index 9c379624d3..cc37e76aa4 100644 --- a/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/data-flow-shell/pom.xml +++ b/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/data-flow-shell/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>data-flow-shell</artifactId> <version>0.0.1-SNAPSHOT</version> @@ -9,19 +9,12 @@ <description>Demo project for Spring Boot</description> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../../parent-boot-1</relativePath> </parent> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-dataflow-shell</artifactId> - </dependency> - </dependencies> - <dependencyManagement> <dependencies> <dependency> @@ -41,6 +34,13 @@ </dependencies> </dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-dataflow-shell</artifactId> + </dependency> + </dependencies> + <properties> <spring-cloud-dependencies.version>Brixton.SR7</spring-cloud-dependencies.version> <spring-cloud-dataflow-dependencies.version>1.1.0.RELEASE</spring-cloud-dataflow-dependencies.version> diff --git a/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/log-sink/pom.xml b/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/log-sink/pom.xml index 73fb82d79f..02d572aeb7 100644 --- a/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/log-sink/pom.xml +++ b/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/log-sink/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>log-sink</artifactId> <version>0.0.1-SNAPSHOT</version> @@ -9,19 +9,12 @@ <description>Demo project for Spring Boot</description> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../../parent-boot-1</relativePath> </parent> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-stream-rabbit</artifactId> - </dependency> - </dependencies> - <dependencyManagement> <dependencies> <dependency> @@ -33,6 +26,13 @@ </dependency> </dependencies> </dependencyManagement> + + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-stream-rabbit</artifactId> + </dependency> + </dependencies> <properties> <spring-cloud-dependencies.version>Brixton.SR7</spring-cloud-dependencies.version> diff --git a/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/log-sink/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/log-sink/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 8dc814ddce..0000000000 --- a/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/log-sink/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.baeldung.spring.cloud.LogSinkApplication; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = LogSinkApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void contextLoads() { - } - -} diff --git a/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/pom.xml b/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/pom.xml index bcb0ace973..5342049d73 100644 --- a/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/pom.xml +++ b/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/pom.xml @@ -1,11 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-cloud-data-flow-stream-processing</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-cloud-data-flow-stream-processing</name> <packaging>pom</packaging> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> diff --git a/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/time-processor/pom.xml b/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/time-processor/pom.xml index 28a9d3e6e0..f8db434423 100644 --- a/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/time-processor/pom.xml +++ b/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/time-processor/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>time-processor</artifactId> <version>0.0.1-SNAPSHOT</version> @@ -9,19 +9,12 @@ <description>Demo project for Spring Boot</description> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../../parent-boot-1</relativePath> </parent> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-stream-rabbit</artifactId> - </dependency> - </dependencies> - <dependencyManagement> <dependencies> <dependency> @@ -34,6 +27,13 @@ </dependencies> </dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-stream-rabbit</artifactId> + </dependency> + </dependencies> + <properties> <spring-cloud-dependencies.version>Brixton.SR7</spring-cloud-dependencies.version> </properties> diff --git a/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/time-processor/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/time-processor/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index dcfeafa2bb..0000000000 --- a/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/time-processor/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.baeldung.spring.cloud.TimeProcessorApplication; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = TimeProcessorApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void contextLoads() { - } - -} diff --git a/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/time-source/pom.xml b/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/time-source/pom.xml index 3b748fd7df..8194755814 100644 --- a/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/time-source/pom.xml +++ b/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/time-source/pom.xml @@ -1,27 +1,20 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>time-source</artifactId> <version>0.0.1-SNAPSHOT</version> - <packaging>jar</packaging> <name>time-source</name> + <packaging>jar</packaging> <description>Demo project for Spring Boot</description> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../../parent-boot-1</relativePath> </parent> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-stream-rabbit</artifactId> - </dependency> - </dependencies> - <dependencyManagement> <dependencies> <dependency> @@ -34,6 +27,13 @@ </dependencies> </dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-stream-rabbit</artifactId> + </dependency> + </dependencies> + <properties> <spring-cloud-dependencies.version>Brixton.SR7</spring-cloud-dependencies.version> </properties> diff --git a/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/time-source/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/time-source/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 2c402824f0..0000000000 --- a/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/time-source/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.baeldung.spring.cloud.TimeSourceApplication; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = TimeSourceApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void contextLoads() { - } - -} diff --git a/spring-cloud/pom.xml b/spring-cloud/pom.xml index 7138efc128..23ad11b03f 100644 --- a/spring-cloud/pom.xml +++ b/spring-cloud/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.spring.cloud</groupId> <artifactId>spring-cloud</artifactId> @@ -33,7 +33,7 @@ <module>spring-cloud-contract</module> <module>spring-cloud-kubernetes</module> <module>spring-cloud-archaius</module> - <module>spring-cloud-functions</module> + <module>spring-cloud-functions</module> <module>spring-cloud-vault</module> <!-- <module>spring-cloud-security</module> --> <!-- Fixing in BAEL-10887 --> <module>spring-cloud-task</module> diff --git a/spring-cloud/spring-cloud-archaius/additional-sources-simple/pom.xml b/spring-cloud/spring-cloud-archaius/additional-sources-simple/pom.xml index cc100833cd..cc20511fc6 100644 --- a/spring-cloud/spring-cloud-archaius/additional-sources-simple/pom.xml +++ b/spring-cloud/spring-cloud-archaius/additional-sources-simple/pom.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns="http://maven.apache.org/POM/4.0.0" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>additional-sources-simple</artifactId> <version>1.0.0-SNAPSHOT</version> @@ -21,4 +21,5 @@ <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies> + </project> diff --git a/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/test/java/com/baeldung/spring/cloud/archaius/additionalsources/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/test/java/com/baeldung/spring/cloud/archaius/additionalsources/SpringContextIntegrationTest.java deleted file mode 100644 index 4811ebaa13..0000000000 --- a/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/test/java/com/baeldung/spring/cloud/archaius/additionalsources/SpringContextIntegrationTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.spring.cloud.archaius.additionalsources; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = AdditionalSourcesSimpleApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-cloud/spring-cloud-archaius/basic-config/pom.xml b/spring-cloud/spring-cloud-archaius/basic-config/pom.xml index be77eeb71c..a13fff2f9d 100644 --- a/spring-cloud/spring-cloud-archaius/basic-config/pom.xml +++ b/spring-cloud/spring-cloud-archaius/basic-config/pom.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns="http://maven.apache.org/POM/4.0.0" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>basic-config</artifactId> <version>1.0.0-SNAPSHOT</version> @@ -21,4 +21,5 @@ <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies> + </project> diff --git a/spring-cloud/spring-cloud-archaius/basic-config/src/test/java/com/baeldung/spring/cloud/archaius/basic/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-archaius/basic-config/src/test/java/com/baeldung/spring/cloud/archaius/basic/SpringContextIntegrationTest.java deleted file mode 100644 index 818e313c98..0000000000 --- a/spring-cloud/spring-cloud-archaius/basic-config/src/test/java/com/baeldung/spring/cloud/archaius/basic/SpringContextIntegrationTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.spring.cloud.archaius.basic; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } - -} diff --git a/spring-cloud/spring-cloud-archaius/basic-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-archaius/basic-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 16542981e8..0000000000 --- a/spring-cloud/spring-cloud-archaius/basic-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.spring.cloud.archaius.basic.BasicArchaiusApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = BasicArchaiusApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-cloud/spring-cloud-archaius/dynamodb-config/pom.xml b/spring-cloud/spring-cloud-archaius/dynamodb-config/pom.xml index 96f6c8711e..9ff267425c 100644 --- a/spring-cloud/spring-cloud-archaius/dynamodb-config/pom.xml +++ b/spring-cloud/spring-cloud-archaius/dynamodb-config/pom.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>dynamodb-config</artifactId> - <name>dynamodb-config</name> + <name>dynamodb-config</name> <packaging>jar</packaging> <parent> @@ -45,4 +45,5 @@ <spring.dynamo.version>5.0.3</spring.dynamo.version> <archaius.version>0.7.6</archaius.version> </properties> + </project> diff --git a/spring-cloud/spring-cloud-archaius/extra-configs/pom.xml b/spring-cloud/spring-cloud-archaius/extra-configs/pom.xml index f7e5807f43..70f736642c 100644 --- a/spring-cloud/spring-cloud-archaius/extra-configs/pom.xml +++ b/spring-cloud/spring-cloud-archaius/extra-configs/pom.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns="http://maven.apache.org/POM/4.0.0" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>extra-configs</artifactId> <version>1.0.0-SNAPSHOT</version> @@ -41,4 +41,5 @@ <properties> <spring-cloud-dependencies.version>2.0.1.RELEASE</spring-cloud-dependencies.version> </properties> + </project> diff --git a/spring-cloud/spring-cloud-archaius/extra-configs/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-archaius/extra-configs/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 4c2531f490..0000000000 --- a/spring-cloud/spring-cloud-archaius/extra-configs/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.spring.cloud.archaius.extraconfigs.ExtraConfigsApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = ExtraConfigsApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-cloud/spring-cloud-archaius/jdbc-config/pom.xml b/spring-cloud/spring-cloud-archaius/jdbc-config/pom.xml index 59dea4890e..b7e4917bea 100644 --- a/spring-cloud/spring-cloud-archaius/jdbc-config/pom.xml +++ b/spring-cloud/spring-cloud-archaius/jdbc-config/pom.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>jdbc-config</artifactId> - <name>jdbc-config</name> + <name>jdbc-config</name> <packaging>jar</packaging> <parent> @@ -28,4 +28,5 @@ <scope>runtime</scope> </dependency> </dependencies> + </project> diff --git a/spring-cloud/spring-cloud-archaius/jdbc-config/src/test/java/com/baeldung/spring/cloud/archaius/jdbconfig/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-archaius/jdbc-config/src/test/java/com/baeldung/spring/cloud/archaius/jdbconfig/SpringContextIntegrationTest.java deleted file mode 100644 index b3cd01e684..0000000000 --- a/spring-cloud/spring-cloud-archaius/jdbc-config/src/test/java/com/baeldung/spring/cloud/archaius/jdbconfig/SpringContextIntegrationTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.spring.cloud.archaius.jdbconfig; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = JdbcSourcesApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} \ No newline at end of file diff --git a/spring-cloud/spring-cloud-archaius/pom.xml b/spring-cloud/spring-cloud-archaius/pom.xml index fd3e34e463..df8162efa5 100644 --- a/spring-cloud/spring-cloud-archaius/pom.xml +++ b/spring-cloud/spring-cloud-archaius/pom.xml @@ -1,14 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns="http://maven.apache.org/POM/4.0.0" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung.spring.cloud</groupId> <artifactId>spring-cloud-archaius</artifactId> <version>1.0.0-SNAPSHOT</version> <name>spring-cloud-archaius</name> - <description>Spring Cloud Archaius Pom parent</description> <packaging>pom</packaging> + <description>Spring Cloud Archaius Pom parent</description> <parent> <groupId>com.baeldung.spring.cloud</groupId> @@ -26,6 +25,18 @@ <module>zookeeper-config</module> </modules> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-netflix</artifactId> + <version>${spring-cloud-dependencies.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> @@ -48,20 +59,9 @@ </dependency> </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-netflix</artifactId> - <version>${spring-cloud-dependencies.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <properties> <spring-cloud-dependencies.version>2.0.1.RELEASE</spring-cloud-dependencies.version> <junit.platform.version>1.2.0</junit.platform.version> </properties> + </project> diff --git a/spring-cloud/spring-cloud-archaius/zookeeper-config/pom.xml b/spring-cloud/spring-cloud-archaius/zookeeper-config/pom.xml index 51010eefb2..25eaf4435c 100644 --- a/spring-cloud/spring-cloud-archaius/zookeeper-config/pom.xml +++ b/spring-cloud/spring-cloud-archaius/zookeeper-config/pom.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>zookeeper-config</artifactId> - <name>zookeeper-config</name> + <name>zookeeper-config</name> <packaging>jar</packaging> <parent> @@ -46,4 +46,5 @@ <cloud.zookeeper.version>2.0.0.RELEASE</cloud.zookeeper.version> <zookeeper.version>3.4.13</zookeeper.version> </properties> + </project> diff --git a/spring-cloud/spring-cloud-aws/pom.xml b/spring-cloud/spring-cloud-aws/pom.xml index 26c407a77e..c1fc458a24 100644 --- a/spring-cloud/spring-cloud-aws/pom.xml +++ b/spring-cloud/spring-cloud-aws/pom.xml @@ -1,16 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.spring.cloud</groupId> <artifactId>spring-cloud-aws</artifactId> <name>spring-cloud-aws</name> - <description>Spring Cloud AWS Examples</description> <packaging>jar</packaging> + <description>Spring Cloud AWS Examples</description> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-1</relativePath> </parent> @@ -61,4 +61,5 @@ <start-class>com.baeldung.spring.cloud.aws.SpringCloudAwsApplication</start-class> <spring-cloud.version>Dalston.SR4</spring-cloud.version> </properties> + </project> diff --git a/spring-cloud/spring-cloud-aws/src/main/resources/application.properties b/spring-cloud/spring-cloud-aws/src/main/resources/application.properties index a769b70ddd..690eda13a2 100644 --- a/spring-cloud/spring-cloud-aws/src/main/resources/application.properties +++ b/spring-cloud/spring-cloud-aws/src/main/resources/application.properties @@ -10,5 +10,5 @@ cloud.aws.rds.spring-cloud-test-db.username=testuser cloud.aws.rds.spring-cloud-test-db.readReplicaSupport=true cloud.aws.rds.spring-cloud-test-db.databaseName=test -# Disable auto cloudfromation +# Disable auto cloudformation cloud.aws.stack.auto=false diff --git a/spring-cloud/spring-cloud-bootstrap/config/pom.xml b/spring-cloud/spring-cloud-bootstrap/config/pom.xml index 1379af0b05..67831d0c7f 100644 --- a/spring-cloud/spring-cloud-bootstrap/config/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/config/pom.xml @@ -4,11 +4,11 @@ <modelVersion>4.0.0</modelVersion> <artifactId>config</artifactId> <version>1.0.0-SNAPSHOT</version> - <name>config</name> + <name>config</name> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../../parent-boot-1</relativePath> </parent> diff --git a/spring-cloud/spring-cloud-bootstrap/config/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-bootstrap/config/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 6016788eab..0000000000 --- a/spring-cloud/spring-cloud-bootstrap/config/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.spring.cloud.bootstrap.config.ConfigApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = ConfigApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml b/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml index 09bea4864a..46550031e1 100644 --- a/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml @@ -4,15 +4,27 @@ <modelVersion>4.0.0</modelVersion> <artifactId>discovery</artifactId> <version>1.0.0-SNAPSHOT</version> - <name>discovery</name> + <name>discovery</name> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../../parent-boot-1</relativePath> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-dependencies</artifactId> + <version>${spring-cloud-dependencies.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> @@ -37,19 +49,8 @@ </dependency> </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-dependencies</artifactId> - <version>${spring-cloud-dependencies.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <properties> <spring-cloud-dependencies.version>Edgware.SR5</spring-cloud-dependencies.version> </properties> + </project> \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml b/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml index 6cbaa5ac2d..10a04db197 100644 --- a/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml @@ -4,15 +4,27 @@ <modelVersion>4.0.0</modelVersion> <artifactId>gateway</artifactId> <version>1.0.0-SNAPSHOT</version> - <name>gateway</name> + <name>gateway</name> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../../parent-boot-1</relativePath> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-dependencies</artifactId> + <version>${spring-cloud-dependencies.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> @@ -51,18 +63,6 @@ </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-dependencies</artifactId> - <version>${spring-cloud-dependencies.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <build> <plugins> <plugin> @@ -101,4 +101,5 @@ <properties> <spring-cloud-dependencies.version>Dalston.RELEASE</spring-cloud-dependencies.version> </properties> + </project> \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/pom.xml b/spring-cloud/spring-cloud-bootstrap/pom.xml index 46460c0d74..2447b90538 100644 --- a/spring-cloud/spring-cloud-bootstrap/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/pom.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-cloud-bootstrap</artifactId> <version>1.0.0-SNAPSHOT</version> - <name>spring-cloud-bootstrap</name> + <name>spring-cloud-bootstrap</name> <packaging>pom</packaging> <parent> diff --git a/spring-cloud/spring-cloud-bootstrap/svc-book/pom.xml b/spring-cloud/spring-cloud-bootstrap/svc-book/pom.xml index a88b77dda0..36227f93c6 100644 --- a/spring-cloud/spring-cloud-bootstrap/svc-book/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/svc-book/pom.xml @@ -5,15 +5,27 @@ <groupId>com.baeldung.spring.cloud</groupId> <artifactId>svc-book</artifactId> <version>1.0.0-SNAPSHOT</version> - <name>svc-book</name> + <name>svc-book</name> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../../parent-boot-1</relativePath> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-dependencies</artifactId> + <version>${spring-cloud-dependencies.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> @@ -59,18 +71,6 @@ </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-dependencies</artifactId> - <version>${spring-cloud-dependencies.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <properties> <spring-cloud-dependencies.version>Dalston.RELEASE</spring-cloud-dependencies.version> </properties> diff --git a/spring-cloud/spring-cloud-bootstrap/svc-rating/pom.xml b/spring-cloud/spring-cloud-bootstrap/svc-rating/pom.xml index f0b19922d8..0a01488628 100644 --- a/spring-cloud/spring-cloud-bootstrap/svc-rating/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/svc-rating/pom.xml @@ -5,11 +5,11 @@ <groupId>com.baeldung.spring.cloud</groupId> <artifactId>svc-rating</artifactId> <version>1.0.0-SNAPSHOT</version> - <name>svc-rating</name> + <name>svc-rating</name> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../../parent-boot-1</relativePath> </parent> diff --git a/spring-cloud/spring-cloud-bootstrap/zipkin/pom.xml b/spring-cloud/spring-cloud-bootstrap/zipkin/pom.xml index 1bf9ecb9e7..bf7525a8e4 100644 --- a/spring-cloud/spring-cloud-bootstrap/zipkin/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/zipkin/pom.xml @@ -4,11 +4,11 @@ <modelVersion>4.0.0</modelVersion> <artifactId>zipkin</artifactId> <version>1.0.0-SNAPSHOT</version> - <name>zipkin</name> + <name>zipkin</name> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../../parent-boot-1</relativePath> </parent> diff --git a/spring-cloud/spring-cloud-bootstrap/zipkin/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-bootstrap/zipkin/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 4403d9e93b..0000000000 --- a/spring-cloud/spring-cloud-bootstrap/zipkin/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.spring.cloud.bootstrap.zipkin.ZipkinApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = ZipkinApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-cloud/spring-cloud-config/client/pom.xml b/spring-cloud/spring-cloud-config/client/pom.xml index 14b0d2f9b1..4f4a420238 100644 --- a/spring-cloud/spring-cloud-config/client/pom.xml +++ b/spring-cloud/spring-cloud-config/client/pom.xml @@ -4,8 +4,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>client</artifactId> - <name>client</name> - + <name>client</name> + <parent> <groupId>com.baeldung.spring.cloud</groupId> <artifactId>spring-cloud-config</artifactId> @@ -16,7 +16,7 @@ <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-config</artifactId> - </dependency> + </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> diff --git a/spring-cloud/spring-cloud-config/client/src/main/java/com/baeldung/spring/cloud/config/client/ConfigClient.java b/spring-cloud/spring-cloud-config/client/src/main/java/com/baeldung/spring/cloud/config/client/ConfigClient.java index 1dd3bbdab0..57d6606469 100644 --- a/spring-cloud/spring-cloud-config/client/src/main/java/com/baeldung/spring/cloud/config/client/ConfigClient.java +++ b/spring-cloud/spring-cloud-config/client/src/main/java/com/baeldung/spring/cloud/config/client/ConfigClient.java @@ -4,9 +4,8 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; @SpringBootApplication @@ -22,7 +21,7 @@ public class ConfigClient { SpringApplication.run(ConfigClient.class, args); } - @RequestMapping(value = "/whoami/{username}", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE) + @GetMapping(value = "/whoami/{username}", produces = MediaType.TEXT_PLAIN_VALUE) public String whoami(@PathVariable("username") String username) { return String.format("Hello %s! You are a(n) %s and your password is '%s'.\n", username, role, password); } diff --git a/spring-cloud/spring-cloud-config/pom.xml b/spring-cloud/spring-cloud-config/pom.xml index 1a4efc7a60..5097a63092 100644 --- a/spring-cloud/spring-cloud-config/pom.xml +++ b/spring-cloud/spring-cloud-config/pom.xml @@ -1,18 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.spring.cloud</groupId> <artifactId>spring-cloud-config</artifactId> <version>1.0-SNAPSHOT</version> - <name>spring-cloud-config</name> + <name>spring-cloud-config</name> <packaging>pom</packaging> <parent> - <artifactId>parent-boot-1</artifactId> + <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> <version>0.0.1-SNAPSHOT</version> - <relativePath>../../parent-boot-1</relativePath> + <relativePath>../../parent-boot-2</relativePath> </parent> <modules> @@ -33,7 +33,8 @@ </dependencyManagement> <properties> - <spring-cloud-dependencies.version>Brixton.SR7</spring-cloud-dependencies.version> + <spring-cloud-dependencies.version>Hoxton.RELEASE</spring-cloud-dependencies.version> + <spring-boot.version>2.2.2.RELEASE</spring-boot.version> </properties> </project> diff --git a/spring-cloud/spring-cloud-config/server/pom.xml b/spring-cloud/spring-cloud-config/server/pom.xml index 674749a48d..9574834457 100644 --- a/spring-cloud/spring-cloud-config/server/pom.xml +++ b/spring-cloud/spring-cloud-config/server/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>server</artifactId> - <name>server</name> + <name>server</name> <parent> <groupId>com.baeldung.spring.cloud</groupId> @@ -16,11 +16,11 @@ <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-config-server</artifactId> - </dependency> + </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> - </dependency> + </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> @@ -37,7 +37,7 @@ <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> - </plugin> + </plugin> </plugins> </build> diff --git a/spring-cloud/spring-cloud-config/server/src/main/java/com/baeldung/spring/cloud/config/server/SecurityConfiguration.java b/spring-cloud/spring-cloud-config/server/src/main/java/com/baeldung/spring/cloud/config/server/SecurityConfiguration.java new file mode 100644 index 0000000000..b50184f296 --- /dev/null +++ b/spring-cloud/spring-cloud-config/server/src/main/java/com/baeldung/spring/cloud/config/server/SecurityConfiguration.java @@ -0,0 +1,18 @@ +package com.baeldung.spring.cloud.config.server; + +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; + +@Configuration +public class SecurityConfiguration extends WebSecurityConfigurerAdapter { + + @Override + public void configure(HttpSecurity http) throws Exception { + http.csrf() + .ignoringAntMatchers("/encrypt/**") + .ignoringAntMatchers("/decrypt/**"); + + super.configure(http); + } +} diff --git a/spring-cloud/spring-cloud-config/server/src/main/resources/application.properties b/spring-cloud/spring-cloud-config/server/src/main/resources/application.properties index 3d4f3bcd47..18d4b3596a 100644 --- a/spring-cloud/spring-cloud-config/server/src/main/resources/application.properties +++ b/spring-cloud/spring-cloud-config/server/src/main/resources/application.properties @@ -1,9 +1,5 @@ server.port=8888 spring.cloud.config.server.git.uri= spring.cloud.config.server.git.clone-on-start=true -security.user.name=root -security.user.password=s3cr3t -encrypt.key-store.location=classpath:/config-server.jks -encrypt.key-store.password=my-s70r3-s3cr3t -encrypt.key-store.alias=config-server-key -encrypt.key-store.secret=my-k34-s3cr3t +spring.security.user.name=root +spring.security.user.password=s3cr3t diff --git a/spring-cloud/spring-cloud-config/server/src/main/resources/bootstrap.properties b/spring-cloud/spring-cloud-config/server/src/main/resources/bootstrap.properties new file mode 100644 index 0000000000..f2d75f5846 --- /dev/null +++ b/spring-cloud/spring-cloud-config/server/src/main/resources/bootstrap.properties @@ -0,0 +1,4 @@ +encrypt.keyStore.location=classpath:/config-server.jks +encrypt.keyStore.password=my-s70r3-s3cr3t +encrypt.keyStore.alias=config-server-key +encrypt.keyStore.secret=my-k34-s3cr3t diff --git a/spring-cloud/spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/SpringContextIntegrationTest.java deleted file mode 100644 index b2c6ef85ea..0000000000 --- a/spring-cloud/spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/SpringContextIntegrationTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.spring.cloud.config.server; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; - -@RunWith(SpringJUnit4ClassRunner.class) -@SpringBootTest(classes = ConfigServer.class) -@WebAppConfiguration -public class SpringContextIntegrationTest { - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-cloud/spring-cloud-connectors-heroku/pom.xml b/spring-cloud/spring-cloud-connectors-heroku/pom.xml index d2e9292511..1dad3ddcb7 100644 --- a/spring-cloud/spring-cloud-connectors-heroku/pom.xml +++ b/spring-cloud/spring-cloud-connectors-heroku/pom.xml @@ -1,15 +1,15 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.spring.cloud</groupId> <artifactId>spring-cloud-connectors-heroku</artifactId> <version>1.0.0-SNAPSHOT</version> - <name>spring-cloud-connectors-heroku</name> + <name>spring-cloud-connectors-heroku</name> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-1</relativePath> </parent> @@ -34,7 +34,7 @@ <dependency> <groupId>org.postgresql</groupId> <artifactId>postgresql</artifactId> - </dependency> + </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> @@ -58,4 +58,5 @@ <spring-cloud-dependencies.version>Brixton.SR7</spring-cloud-dependencies.version> <postgresql.version>9.4-1201-jdbc4</postgresql.version> </properties> + </project> \ No newline at end of file diff --git a/spring-cloud/spring-cloud-connectors-heroku/src/test/java/com/baeldung/spring/cloud/connectors/heroku/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-connectors-heroku/src/test/java/com/baeldung/spring/cloud/connectors/heroku/SpringContextIntegrationTest.java deleted file mode 100644 index dca4c25c71..0000000000 --- a/spring-cloud/spring-cloud-connectors-heroku/src/test/java/com/baeldung/spring/cloud/connectors/heroku/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung.spring.cloud.connectors.heroku; - -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.baeldung.spring.cloud.connectors.heroku.ConnectorsHerokuApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = ConnectorsHerokuApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-cloud/spring-cloud-consul/pom.xml b/spring-cloud/spring-cloud-consul/pom.xml index 456a7ec302..b1f6acd9fe 100644 --- a/spring-cloud/spring-cloud-consul/pom.xml +++ b/spring-cloud/spring-cloud-consul/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.baeldung</groupId> <artifactId>spring-cloud-consul</artifactId> @@ -25,7 +25,7 @@ <artifactId>spring-cloud-starter-consul-config</artifactId> <version>${spring-cloud-starter-consul.version}</version> </dependency> - + <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> diff --git a/spring-cloud/spring-cloud-contract/pom.xml b/spring-cloud/spring-cloud-contract/pom.xml index a7ee52e954..2f868980db 100644 --- a/spring-cloud/spring-cloud-contract/pom.xml +++ b/spring-cloud/spring-cloud-contract/pom.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung.spring.cloud</groupId> <artifactId>spring-cloud-contract</artifactId> <version>1.0.0-SNAPSHOT</version> - <name>spring-cloud-contract</name> + <name>spring-cloud-contract</name> <packaging>pom</packaging> <parent> @@ -59,4 +58,5 @@ <spring-cloud.version>2.1.1.RELEASE</spring-cloud.version> <spring-boot.version>2.1.4.RELEASE</spring-boot.version> </properties> + </project> \ No newline at end of file diff --git a/spring-cloud/spring-cloud-contract/spring-cloud-contract-consumer/pom.xml b/spring-cloud/spring-cloud-contract/spring-cloud-contract-consumer/pom.xml index 3b711c58d9..7616032320 100644 --- a/spring-cloud/spring-cloud-contract/spring-cloud-contract-consumer/pom.xml +++ b/spring-cloud/spring-cloud-contract/spring-cloud-contract-consumer/pom.xml @@ -2,12 +2,11 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung.spring.cloud</groupId> <artifactId>spring-cloud-contract-consumer</artifactId> <version>1.0.0-SNAPSHOT</version> <name>spring-cloud-contract-consumer</name> - <description>Spring Cloud Consumer Sample</description> <packaging>jar</packaging> + <description>Spring Cloud Consumer Sample</description> <parent> <groupId>com.baeldung.spring.cloud</groupId> diff --git a/spring-cloud/spring-cloud-contract/spring-cloud-contract-consumer/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-contract/spring-cloud-contract-consumer/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 1c1192cc3f..0000000000 --- a/spring-cloud/spring-cloud-contract/spring-cloud-contract-consumer/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.spring.cloud.springcloudcontractconsumer.SpringCloudContractConsumerApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringCloudContractConsumerApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/pom.xml b/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/pom.xml index 7a0fa7db10..c41ad687ed 100644 --- a/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/pom.xml +++ b/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/pom.xml @@ -2,12 +2,11 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung.spring.cloud</groupId> <artifactId>spring-cloud-contract-producer</artifactId> <version>1.0.0-SNAPSHOT</version> <name>spring-cloud-contract-producer</name> - <description>Spring Cloud Producer Sample</description> <packaging>jar</packaging> + <description>Spring Cloud Producer Sample</description> <parent> <groupId>com.baeldung.spring.cloud</groupId> diff --git a/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 2b6703ae5c..0000000000 --- a/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.spring.cloud.springcloudcontractproducer.SpringCloudContractProducerApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringCloudContractProducerApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-cloud/spring-cloud-eureka-self-preservation/README.md b/spring-cloud/spring-cloud-eureka-self-preservation/README.md new file mode 100644 index 0000000000..52e321b1cb --- /dev/null +++ b/spring-cloud/spring-cloud-eureka-self-preservation/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Guide to Eureka Self Preservation and Renewal](https://www.baeldung.com/eureka-self-preservation-renewal) diff --git a/spring-cloud/spring-cloud-eureka-self-preservation/pom.xml b/spring-cloud/spring-cloud-eureka-self-preservation/pom.xml index ce9272ed59..41ebba7d79 100644 --- a/spring-cloud/spring-cloud-eureka-self-preservation/pom.xml +++ b/spring-cloud/spring-cloud-eureka-self-preservation/pom.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.spring.cloud.eureka</groupId> <artifactId>spring-cloud-eureka-self-preservation</artifactId> <name>spring-cloud-eureka-self-preservation</name> - <description>Spring Cloud Eureka Server Self Preservation</description> <packaging>pom</packaging> + <description>Spring Cloud Eureka Server Self Preservation</description> <parent> <groupId>com.baeldung.spring.cloud</groupId> @@ -19,7 +19,7 @@ <module>spring-cloud-eureka-server</module> <module>spring-cloud-eureka-client</module> </modules> - + <dependencies> <dependency> <groupId>org.springframework.boot</groupId> diff --git a/spring-cloud/spring-cloud-eureka-self-preservation/spring-cloud-eureka-client/pom.xml b/spring-cloud/spring-cloud-eureka-self-preservation/spring-cloud-eureka-client/pom.xml index 2c522a8d9d..fc7d8bec33 100644 --- a/spring-cloud/spring-cloud-eureka-self-preservation/spring-cloud-eureka-client/pom.xml +++ b/spring-cloud/spring-cloud-eureka-self-preservation/spring-cloud-eureka-client/pom.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-cloud-eureka-client</artifactId> <name>spring-cloud-eureka-client</name> - <description>Spring Cloud Eureka Sample Client</description> <packaging>jar</packaging> + <description>Spring Cloud Eureka Sample Client</description> <parent> <groupId>com.baeldung.spring.cloud.eureka</groupId> @@ -14,17 +14,6 @@ <relativePath>..</relativePath> </parent> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> - </dependencies> - <dependencyManagement> <dependencies> <dependency> @@ -37,4 +26,15 @@ </dependencies> </dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + </dependencies> + </project> diff --git a/spring-cloud/spring-cloud-eureka-self-preservation/spring-cloud-eureka-server/pom.xml b/spring-cloud/spring-cloud-eureka-self-preservation/spring-cloud-eureka-server/pom.xml index 7d9d9d33a8..02d1c8c354 100644 --- a/spring-cloud/spring-cloud-eureka-self-preservation/spring-cloud-eureka-server/pom.xml +++ b/spring-cloud/spring-cloud-eureka-self-preservation/spring-cloud-eureka-server/pom.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-cloud-eureka-server</artifactId> <name>spring-cloud-eureka-server</name> - <description>Spring Cloud Eureka Server</description> <packaging>jar</packaging> + <description>Spring Cloud Eureka Server</description> <parent> <groupId>com.baeldung.spring.cloud.eureka</groupId> @@ -14,13 +14,6 @@ <relativePath>..</relativePath> </parent> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> - </dependency> - </dependencies> - <dependencyManagement> <dependencies> <dependency> @@ -33,4 +26,11 @@ </dependencies> </dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> + </dependency> + </dependencies> + </project> diff --git a/spring-cloud/spring-cloud-eureka/pom.xml b/spring-cloud/spring-cloud-eureka/pom.xml index 5afb006d41..7af0c15352 100644 --- a/spring-cloud/spring-cloud-eureka/pom.xml +++ b/spring-cloud/spring-cloud-eureka/pom.xml @@ -1,13 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung.spring.cloud</groupId> <artifactId>spring-cloud-eureka</artifactId> <version>1.0.0-SNAPSHOT</version> <name>spring-cloud-eureka</name> - <description>Spring Cloud Eureka Server and Sample Clients</description> <packaging>pom</packaging> + <description>Spring Cloud Eureka Server and Sample Clients</description> <parent> <groupId>com.baeldung.spring.cloud</groupId> @@ -21,7 +20,7 @@ <module>spring-cloud-eureka-client</module> <module>spring-cloud-eureka-feign-client</module> </modules> - + <dependencies> <dependency> <groupId>org.springframework.boot</groupId> diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml index 04a5bd3e58..d82ee6566d 100644 --- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml +++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-cloud-eureka-client</artifactId> <version>1.0.0-SNAPSHOT</version> <name>spring-cloud-eureka-client</name> - <description>Spring Cloud Eureka Sample Client</description> <packaging>jar</packaging> + <description>Spring Cloud Eureka Sample Client</description> <parent> <groupId>com.baeldung.spring.cloud</groupId> @@ -15,17 +15,6 @@ <relativePath>..</relativePath> </parent> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> - </dependencies> - <dependencyManagement> <dependencies> <dependency> @@ -38,4 +27,15 @@ </dependencies> </dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + </dependencies> + </project> diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/src/test/java/com/baeldung/spring/cloud/eureka/client/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/src/test/java/com/baeldung/spring/cloud/eureka/client/SpringContextIntegrationTest.java deleted file mode 100644 index 8e379fd5a0..0000000000 --- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/src/test/java/com/baeldung/spring/cloud/eureka/client/SpringContextIntegrationTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.spring.cloud.eureka.client; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } - -} diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/pom.xml b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/pom.xml index acc436c574..1ecc50a81f 100644 --- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/pom.xml +++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/pom.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-cloud-eureka-feign-client</artifactId> <version>1.0.0-SNAPSHOT</version> <name>spring-cloud-eureka-feign-client</name> - <description>Spring Cloud Eureka - Sample Feign Client</description> <packaging>jar</packaging> + <description>Spring Cloud Eureka - Sample Feign Client</description> <parent> <groupId>com.baeldung.spring.cloud</groupId> @@ -15,6 +15,18 @@ <relativePath>..</relativePath> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-parent</artifactId> + <version>${spring-cloud-dependencies.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> @@ -34,15 +46,4 @@ </dependency> </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-parent</artifactId> - <version>${spring-cloud-dependencies.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> </project> diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/src/test/java/com/baeldung/spring/cloud/feign/client/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/src/test/java/com/baeldung/spring/cloud/feign/client/SpringContextIntegrationTest.java deleted file mode 100644 index ff742735b3..0000000000 --- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/src/test/java/com/baeldung/spring/cloud/feign/client/SpringContextIntegrationTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.spring.cloud.feign.client; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } - -} diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/pom.xml b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/pom.xml index 95edba29f9..627be513ba 100644 --- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/pom.xml +++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/pom.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-cloud-eureka-server</artifactId> <version>1.0.0-SNAPSHOT</version> <name>spring-cloud-eureka-server</name> - <description>Spring Cloud Eureka Server Demo</description> <packaging>jar</packaging> + <description>Spring Cloud Eureka Server Demo</description> <parent> <groupId>com.baeldung.spring.cloud</groupId> @@ -15,13 +15,6 @@ <relativePath>..</relativePath> </parent> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> - </dependency> - </dependencies> - <dependencyManagement> <dependencies> <dependency> @@ -34,4 +27,11 @@ </dependencies> </dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> + </dependency> + </dependencies> + </project> diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/src/test/java/com/baeldung/spring/cloud/eureka/server/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/src/test/java/com/baeldung/spring/cloud/eureka/server/SpringContextIntegrationTest.java deleted file mode 100644 index f03913b474..0000000000 --- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/src/test/java/com/baeldung/spring/cloud/eureka/server/SpringContextIntegrationTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.spring.cloud.eureka.server; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } - -} diff --git a/spring-cloud/spring-cloud-functions/pom.xml b/spring-cloud/spring-cloud-functions/pom.xml index 82147cea28..2e1b747c2e 100644 --- a/spring-cloud/spring-cloud-functions/pom.xml +++ b/spring-cloud/spring-cloud-functions/pom.xml @@ -7,17 +7,16 @@ <artifactId>spring-cloud-functions</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-cloud-functions</name> - <description>Demo project for Spring Cloud Function</description> <packaging>jar</packaging> + <description>Demo project for Spring Cloud Function</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-2</relativePath> </parent> - - + <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> @@ -26,7 +25,7 @@ </dependency> <!-- We don't need spring-cloud-starter-function-web when deploying to AWS--> <!-- It is used only for local testing--> - <dependency> + <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-function-web</artifactId> <version>${spring-cloud-function.version}</version> diff --git a/spring-cloud/spring-cloud-functions/src/test/java/com/baeldung/spring/cloudfunction/aws/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-functions/src/test/java/com/baeldung/spring/cloudfunction/aws/SpringContextIntegrationTest.java deleted file mode 100644 index beee84246d..0000000000 --- a/spring-cloud/spring-cloud-functions/src/test/java/com/baeldung/spring/cloudfunction/aws/SpringContextIntegrationTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.spring.cloudfunction.aws; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = CloudFunctionAwsApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} \ No newline at end of file diff --git a/spring-cloud/spring-cloud-gateway/pom.xml b/spring-cloud/spring-cloud-gateway/pom.xml index c297d90896..10cd49cc04 100644 --- a/spring-cloud/spring-cloud-gateway/pom.xml +++ b/spring-cloud/spring-cloud-gateway/pom.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://maven.apache.org/POM/4.0.0" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-cloud-gateway</artifactId> - <packaging>jar</packaging> <name>spring-cloud-gateway</name> + <packaging>jar</packaging> <parent> <groupId>com.baeldung.spring.cloud</groupId> @@ -17,8 +18,25 @@ <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-gateway</artifactId> - <version>${cloud.version}</version> + <artifactId>spring-cloud-dependencies</artifactId> + <version>${spring-cloud-dependencies.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <!-- Junit bom upgrade needed only because of a bug with STS, + should be removed with Spring Boot 2.2.0 --> + <!-- https://github.com/spring-projects/sts4/issues/371 --> + <dependency> + <groupId>org.junit</groupId> + <artifactId>junit-bom</artifactId> + <version>5.5.2</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-dependencies</artifactId> + <version>${spring-boot.version}</version> <type>pom</type> <scope>import</scope> </dependency> @@ -28,20 +46,7 @@ <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-actuator</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-webflux</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> + <artifactId>spring-cloud-starter-gateway</artifactId> </dependency> <dependency> @@ -54,13 +59,31 @@ <artifactId>validation-api</artifactId> </dependency> <dependency> - <groupId>io.projectreactor.ipc</groupId> - <artifactId>reactor-netty</artifactId> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-actuator</artifactId> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> </dependency> </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + </plugins> + </build> + <properties> - <cloud.version>2.0.1.RELEASE</cloud.version> + <spring-cloud-dependencies.version>Greenwich.SR3</spring-cloud-dependencies.version> + + <!-- Spring Boot version compatible with Spring Cloud Release train --> + <spring-boot.version>2.1.9.RELEASE</spring-boot.version> <hibernate-validator.version>6.0.2.Final</hibernate-validator.version> </properties> diff --git a/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/CustomFiltersGatewayApplication.java b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/CustomFiltersGatewayApplication.java new file mode 100644 index 0000000000..fae25bb7cc --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/CustomFiltersGatewayApplication.java @@ -0,0 +1,15 @@ +package com.baeldung.springcloudgateway.customfilters.gatewayapp; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.PropertySource; + +@SpringBootApplication +@PropertySource("classpath:customfilters-global-application.properties") +public class CustomFiltersGatewayApplication { + + public static void main(String[] args) { + SpringApplication.run(CustomFiltersGatewayApplication.class, args); + } + +} \ No newline at end of file diff --git a/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/config/WebClientConfig.java b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/config/WebClientConfig.java new file mode 100644 index 0000000000..0589d8c321 --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/config/WebClientConfig.java @@ -0,0 +1,16 @@ +package com.baeldung.springcloudgateway.customfilters.gatewayapp.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.reactive.function.client.WebClient; + +@Configuration +public class WebClientConfig { + + @Bean + WebClient client() { + return WebClient.builder() + .build(); + } + +} diff --git a/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/filters/factories/ChainRequestGatewayFilterFactory.java b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/filters/factories/ChainRequestGatewayFilterFactory.java new file mode 100644 index 0000000000..f53b0a3c93 --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/filters/factories/ChainRequestGatewayFilterFactory.java @@ -0,0 +1,89 @@ +package com.baeldung.springcloudgateway.customfilters.gatewayapp.filters.factories; + +import java.util.Arrays; +import java.util.List; +import java.util.Locale.LanguageRange; +import java.util.stream.Collectors; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cloud.gateway.filter.GatewayFilter; +import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory; +import org.springframework.stereotype.Component; +import org.springframework.web.reactive.function.client.WebClient; + +import reactor.core.publisher.Mono; + +@Component +public class ChainRequestGatewayFilterFactory extends AbstractGatewayFilterFactory<ChainRequestGatewayFilterFactory.Config> { + + final Logger logger = LoggerFactory.getLogger(ChainRequestGatewayFilterFactory.class); + + private final WebClient client; + + public ChainRequestGatewayFilterFactory(WebClient client) { + super(Config.class); + this.client = client; + } + + @Override + public List<String> shortcutFieldOrder() { + return Arrays.asList("languageServiceEndpoint", "defaultLanguage"); + } + + @Override + public GatewayFilter apply(Config config) { + return (exchange, chain) -> { + return client.get() + .uri(config.getLanguageServiceEndpoint()) + .exchange() + .flatMap(response -> { + return (response.statusCode() + .is2xxSuccessful()) ? response.bodyToMono(String.class) : Mono.just(config.getDefaultLanguage()); + }) + .map(LanguageRange::parse) + .map(range -> { + exchange.getRequest() + .mutate() + .headers(h -> h.setAcceptLanguage(range)); + + String allOutgoingRequestLanguages = exchange.getRequest() + .getHeaders() + .getAcceptLanguage() + .stream() + .map(r -> r.getRange()) + .collect(Collectors.joining(",")); + + logger.info("Chain Request output - Request contains Accept-Language header: " + allOutgoingRequestLanguages); + + return exchange; + }) + .flatMap(chain::filter); + + }; + } + + public static class Config { + private String languageServiceEndpoint; + private String defaultLanguage; + + public Config() { + } + + public String getLanguageServiceEndpoint() { + return languageServiceEndpoint; + } + + public void setLanguageServiceEndpoint(String languageServiceEndpoint) { + this.languageServiceEndpoint = languageServiceEndpoint; + } + + public String getDefaultLanguage() { + return defaultLanguage; + } + + public void setDefaultLanguage(String defaultLanguage) { + this.defaultLanguage = defaultLanguage; + } + } +} diff --git a/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/filters/factories/LoggingGatewayFilterFactory.java b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/filters/factories/LoggingGatewayFilterFactory.java new file mode 100644 index 0000000000..900d36cc02 --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/filters/factories/LoggingGatewayFilterFactory.java @@ -0,0 +1,85 @@ +package com.baeldung.springcloudgateway.customfilters.gatewayapp.filters.factories; + +import java.util.Arrays; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cloud.gateway.filter.GatewayFilter; +import org.springframework.cloud.gateway.filter.OrderedGatewayFilter; +import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory; +import org.springframework.stereotype.Component; + +import reactor.core.publisher.Mono; + +@Component +public class LoggingGatewayFilterFactory extends AbstractGatewayFilterFactory<LoggingGatewayFilterFactory.Config> { + + final Logger logger = LoggerFactory.getLogger(LoggingGatewayFilterFactory.class); + + public static final String BASE_MSG = "baseMessage"; + public static final String PRE_LOGGER = "preLogger"; + public static final String POST_LOGGER = "postLogger"; + + public LoggingGatewayFilterFactory() { + super(Config.class); + } + + @Override + public List<String> shortcutFieldOrder() { + return Arrays.asList(BASE_MSG, PRE_LOGGER, POST_LOGGER); + } + + @Override + public GatewayFilter apply(Config config) { + return new OrderedGatewayFilter((exchange, chain) -> { + if (config.isPreLogger()) + logger.info("Pre GatewayFilter logging: " + config.getBaseMessage()); + return chain.filter(exchange) + .then(Mono.fromRunnable(() -> { + if (config.isPostLogger()) + logger.info("Post GatewayFilter logging: " + config.getBaseMessage()); + })); + }, 1); + } + + public static class Config { + private String baseMessage; + private boolean preLogger; + private boolean postLogger; + + public Config() { + }; + + public Config(String baseMessage, boolean preLogger, boolean postLogger) { + super(); + this.baseMessage = baseMessage; + this.preLogger = preLogger; + this.postLogger = postLogger; + } + + public String getBaseMessage() { + return this.baseMessage; + } + + public boolean isPreLogger() { + return preLogger; + } + + public boolean isPostLogger() { + return postLogger; + } + + public void setBaseMessage(String baseMessage) { + this.baseMessage = baseMessage; + } + + public void setPreLogger(boolean preLogger) { + this.preLogger = preLogger; + } + + public void setPostLogger(boolean postLogger) { + this.postLogger = postLogger; + } + } +} diff --git a/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/filters/factories/ModifyRequestGatewayFilterFactory.java b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/filters/factories/ModifyRequestGatewayFilterFactory.java new file mode 100644 index 0000000000..5828f35a36 --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/filters/factories/ModifyRequestGatewayFilterFactory.java @@ -0,0 +1,92 @@ +package com.baeldung.springcloudgateway.customfilters.gatewayapp.filters.factories; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Locale; +import java.util.Optional; +import java.util.stream.Collectors; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cloud.gateway.filter.GatewayFilter; +import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory; +import org.springframework.stereotype.Component; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.web.server.ServerWebExchange; +import org.springframework.web.util.UriComponentsBuilder; + +@Component +public class ModifyRequestGatewayFilterFactory extends AbstractGatewayFilterFactory<ModifyRequestGatewayFilterFactory.Config> { + + final Logger logger = LoggerFactory.getLogger(ModifyRequestGatewayFilterFactory.class); + + public ModifyRequestGatewayFilterFactory() { + super(Config.class); + } + + @Override + public List<String> shortcutFieldOrder() { + return Arrays.asList("defaultLocale"); + } + + @Override + public GatewayFilter apply(Config config) { + return (exchange, chain) -> { + if (exchange.getRequest() + .getHeaders() + .getAcceptLanguage() + .isEmpty()) { + + String queryParamLocale = exchange.getRequest() + .getQueryParams() + .getFirst("locale"); + + Locale requestLocale = Optional.ofNullable(queryParamLocale) + .map(l -> Locale.forLanguageTag(l)) + .orElse(config.getDefaultLocale()); + + exchange.getRequest() + .mutate() + .headers(h -> h.setAcceptLanguageAsLocales(Collections.singletonList(requestLocale))); + } + + String allOutgoingRequestLanguages = exchange.getRequest() + .getHeaders() + .getAcceptLanguage() + .stream() + .map(range -> range.getRange()) + .collect(Collectors.joining(",")); + + logger.info("Modify request output - Request contains Accept-Language header: {}", allOutgoingRequestLanguages); + + ServerWebExchange modifiedExchange = exchange.mutate() + .request(originalRequest -> originalRequest.uri(UriComponentsBuilder.fromUri(exchange.getRequest() + .getURI()) + .replaceQueryParams(new LinkedMultiValueMap<String, String>()) + .build() + .toUri())) + .build(); + + logger.info("Removed all query params: {}", modifiedExchange.getRequest() + .getURI()); + + return chain.filter(modifiedExchange); + }; + } + + public static class Config { + private Locale defaultLocale; + + public Config() { + } + + public Locale getDefaultLocale() { + return defaultLocale; + } + + public void setDefaultLocale(String defaultLocale) { + this.defaultLocale = Locale.forLanguageTag(defaultLocale); + }; + } +} diff --git a/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/filters/factories/ModifyResponseGatewayFilterFactory.java b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/filters/factories/ModifyResponseGatewayFilterFactory.java new file mode 100644 index 0000000000..f5efa69402 --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/filters/factories/ModifyResponseGatewayFilterFactory.java @@ -0,0 +1,48 @@ +package com.baeldung.springcloudgateway.customfilters.gatewayapp.filters.factories; + +import java.util.Optional; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cloud.gateway.filter.GatewayFilter; +import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory; +import org.springframework.http.server.reactive.ServerHttpResponse; +import org.springframework.stereotype.Component; + +import reactor.core.publisher.Mono; + +@Component +public class ModifyResponseGatewayFilterFactory extends AbstractGatewayFilterFactory<ModifyResponseGatewayFilterFactory.Config> { + + final Logger logger = LoggerFactory.getLogger(ModifyResponseGatewayFilterFactory.class); + + public ModifyResponseGatewayFilterFactory() { + super(Config.class); + } + + @Override + public GatewayFilter apply(Config config) { + return (exchange, chain) -> { + return chain.filter(exchange) + .then(Mono.fromRunnable(() -> { + ServerHttpResponse response = exchange.getResponse(); + + Optional.ofNullable(exchange.getRequest() + .getQueryParams() + .getFirst("locale")) + .ifPresent(qp -> { + String responseContentLanguage = response.getHeaders() + .getContentLanguage() + .getLanguage(); + + response.getHeaders() + .add("Bael-Custom-Language-Header", responseContentLanguage); + logger.info("Added custom header to Response"); + }); + })); + }; + } + + public static class Config { + } +} diff --git a/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/filters/global/FirstPreLastPostGlobalFilter.java b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/filters/global/FirstPreLastPostGlobalFilter.java new file mode 100644 index 0000000000..687f3fe685 --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/filters/global/FirstPreLastPostGlobalFilter.java @@ -0,0 +1,31 @@ +package com.baeldung.springcloudgateway.customfilters.gatewayapp.filters.global; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cloud.gateway.filter.GatewayFilterChain; +import org.springframework.cloud.gateway.filter.GlobalFilter; +import org.springframework.core.Ordered; +import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; + +import reactor.core.publisher.Mono; + +@Component +public class FirstPreLastPostGlobalFilter implements GlobalFilter, Ordered { + + final Logger logger = LoggerFactory.getLogger(FirstPreLastPostGlobalFilter.class); + + @Override + public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) { + logger.info("First Pre Global Filter"); + return chain.filter(exchange) + .then(Mono.fromRunnable(() -> { + logger.info("Last Post Global Filter"); + })); + } + + @Override + public int getOrder() { + return -1; + } +} diff --git a/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/filters/global/LoggingGlobalFiltersConfigurations.java b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/filters/global/LoggingGlobalFiltersConfigurations.java new file mode 100644 index 0000000000..2dead8da3b --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/filters/global/LoggingGlobalFiltersConfigurations.java @@ -0,0 +1,25 @@ +package com.baeldung.springcloudgateway.customfilters.gatewayapp.filters.global; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cloud.gateway.filter.GlobalFilter; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import reactor.core.publisher.Mono; + +@Configuration +public class LoggingGlobalFiltersConfigurations { + + final Logger logger = LoggerFactory.getLogger(LoggingGlobalFiltersConfigurations.class); + + @Bean + public GlobalFilter postGlobalFilter() { + return (exchange, chain) -> { + return chain.filter(exchange) + .then(Mono.fromRunnable(() -> { + logger.info("Global Post Filter executed"); + })); + }; + } +} diff --git a/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/filters/global/LoggingGlobalPreFilter.java b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/filters/global/LoggingGlobalPreFilter.java new file mode 100644 index 0000000000..2bacf033db --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/filters/global/LoggingGlobalPreFilter.java @@ -0,0 +1,22 @@ +package com.baeldung.springcloudgateway.customfilters.gatewayapp.filters.global; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cloud.gateway.filter.GatewayFilterChain; +import org.springframework.cloud.gateway.filter.GlobalFilter; +import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; + +import reactor.core.publisher.Mono; + +@Component +public class LoggingGlobalPreFilter implements GlobalFilter { + + final Logger logger = LoggerFactory.getLogger(LoggingGlobalPreFilter.class); + + @Override + public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) { + logger.info("Global Pre Filter executed"); + return chain.filter(exchange); + } +} diff --git a/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/routes/ServiceRouteConfiguration.java b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/routes/ServiceRouteConfiguration.java new file mode 100644 index 0000000000..17d4827d93 --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/routes/ServiceRouteConfiguration.java @@ -0,0 +1,28 @@ +package com.baeldung.springcloudgateway.customfilters.gatewayapp.routes; + +import org.springframework.cloud.gateway.route.RouteLocator; +import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder; +import org.springframework.context.annotation.Bean; + +import com.baeldung.springcloudgateway.customfilters.gatewayapp.filters.factories.LoggingGatewayFilterFactory; +import com.baeldung.springcloudgateway.customfilters.gatewayapp.filters.factories.LoggingGatewayFilterFactory.Config; + +/** + * Note: We want to keep this as an example of configuring a Route with a custom filter + * + * This corresponds with the properties configuration we have + */ +// @Configuration +public class ServiceRouteConfiguration { + + @Bean + public RouteLocator routes(RouteLocatorBuilder builder, LoggingGatewayFilterFactory loggingFactory) { + + return builder.routes() + .route("service_route_java_config", r -> r.path("/service/**") + .filters(f -> f.rewritePath("/service(?<segment>/?.*)", "$\\{segment}") + .filter(loggingFactory.apply(new Config("My Custom Message", true, true)))) + .uri("http://localhost:8081")) + .build(); + } +} diff --git a/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/secondservice/SecondServiceApplication.java b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/secondservice/SecondServiceApplication.java new file mode 100644 index 0000000000..b65d0efbd6 --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/secondservice/SecondServiceApplication.java @@ -0,0 +1,15 @@ +package com.baeldung.springcloudgateway.customfilters.secondservice; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.PropertySource; + +@SpringBootApplication +@PropertySource("classpath:secondservice-application.properties") +public class SecondServiceApplication { + + public static void main(String[] args) { + SpringApplication.run(SecondServiceApplication.class, args); + } + +} diff --git a/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/secondservice/web/SecondServiceRestController.java b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/secondservice/web/SecondServiceRestController.java new file mode 100644 index 0000000000..1ac44ba6b1 --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/secondservice/web/SecondServiceRestController.java @@ -0,0 +1,18 @@ +package com.baeldung.springcloudgateway.customfilters.secondservice.web; + +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import reactor.core.publisher.Mono; + +@RestController +public class SecondServiceRestController { + + @GetMapping("/resource/language") + public Mono<ResponseEntity<String>> getResource() { + return Mono.just(ResponseEntity.ok() + .body("es")); + + } +} diff --git a/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/service/ServiceApplication.java b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/service/ServiceApplication.java new file mode 100644 index 0000000000..1e2ffb63c2 --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/service/ServiceApplication.java @@ -0,0 +1,15 @@ +package com.baeldung.springcloudgateway.customfilters.service; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.PropertySource; + +@SpringBootApplication +@PropertySource("classpath:service-application.properties") +public class ServiceApplication { + + public static void main(String[] args) { + SpringApplication.run(ServiceApplication.class, args); + } + +} diff --git a/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/service/web/ServiceRestController.java b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/service/web/ServiceRestController.java new file mode 100644 index 0000000000..3ca09f6853 --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/customfilters/service/web/ServiceRestController.java @@ -0,0 +1,22 @@ +package com.baeldung.springcloudgateway.customfilters.service.web; + +import java.util.Locale; + +import org.springframework.http.HttpHeaders; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import reactor.core.publisher.Mono; + +@RestController +public class ServiceRestController { + + @GetMapping("/resource") + public Mono<ResponseEntity<String>> getResource() { + return Mono.just(ResponseEntity.ok() + .header(HttpHeaders.CONTENT_LANGUAGE, Locale.ENGLISH.getLanguage()) + .body("Service Resource")); + + } +} diff --git a/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/introduction/IntroductionGatewayApplication.java b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/introduction/IntroductionGatewayApplication.java new file mode 100644 index 0000000000..d276597a6b --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/introduction/IntroductionGatewayApplication.java @@ -0,0 +1,15 @@ +package com.baeldung.springcloudgateway.introduction; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.PropertySource; + +@SpringBootApplication +@PropertySource("classpath:introduction-application.properties") +public class IntroductionGatewayApplication { + + public static void main(String[] args) { + SpringApplication.run(IntroductionGatewayApplication.class, args); + } + +} \ No newline at end of file diff --git a/spring-cloud/spring-cloud-gateway/src/main/resources/application.yml b/spring-cloud/spring-cloud-gateway/src/main/resources/application.yml index 2450638e46..a33bca2055 100644 --- a/spring-cloud/spring-cloud-gateway/src/main/resources/application.yml +++ b/spring-cloud/spring-cloud-gateway/src/main/resources/application.yml @@ -1,16 +1,4 @@ -server: - port: 80 -spring: - cloud: - gateway: - routes: - - id: baeldung_route - uri: http://www.baeldung.com - predicates: - - Path=/baeldung - -management: - endpoints: - web: - exposure: - include: "*" +logging: + level: + org.springframework.cloud.gateway: DEBUG + reactor.netty.http.client: DEBUG diff --git a/spring-cloud/spring-cloud-gateway/src/main/resources/customfilters-global-application.properties b/spring-cloud/spring-cloud-gateway/src/main/resources/customfilters-global-application.properties new file mode 100644 index 0000000000..08421a0653 --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/main/resources/customfilters-global-application.properties @@ -0,0 +1,19 @@ +spring.cloud.gateway.routes[0].id=service_route +spring.cloud.gateway.routes[0].uri=http://localhost:8081 +spring.cloud.gateway.routes[0].predicates[0]=Path=/service/** +spring.cloud.gateway.routes[0].filters[0]=RewritePath=/service(?<segment>/?.*), $\{segment} +spring.cloud.gateway.routes[0].filters[1]=Logging=My Custom Message, true, true +# Or, as an alternative: +#spring.cloud.gateway.routes[0].filters[1].name=Logging +#spring.cloud.gateway.routes[0].filters[1].args[baseMessage]=My Custom Message +#spring.cloud.gateway.routes[0].filters[1].args[preLogger]=true +#spring.cloud.gateway.routes[0].filters[1].args[postLogger]=true + +spring.cloud.gateway.routes[0].filters[2]=ModifyResponse +spring.cloud.gateway.routes[0].filters[3]=ModifyRequest=en +spring.cloud.gateway.routes[0].filters[4]=ChainRequest=http://localhost:8082/resource/language, fr + +management.endpoints.web.exposure.include=* + +server.port=80 + diff --git a/spring-cloud/spring-cloud-gateway/src/main/resources/introduction-application.properties b/spring-cloud/spring-cloud-gateway/src/main/resources/introduction-application.properties new file mode 100644 index 0000000000..d7a6c4e072 --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/main/resources/introduction-application.properties @@ -0,0 +1,7 @@ +spring.cloud.gateway.routes[0].id=baeldung_route +spring.cloud.gateway.routes[0].uri=http://www.baeldung.com +spring.cloud.gateway.routes[0].predicates[0]=Path=/baeldung + +management.endpoints.web.exposure.include=* + +server.port=80 diff --git a/spring-security-mvc-boot/src/main/resources/application.properties b/spring-cloud/spring-cloud-gateway/src/main/resources/secondservice-application.properties similarity index 100% rename from spring-security-mvc-boot/src/main/resources/application.properties rename to spring-cloud/spring-cloud-gateway/src/main/resources/secondservice-application.properties diff --git a/spring-cloud/spring-cloud-gateway/src/main/resources/service-application.properties b/spring-cloud/spring-cloud-gateway/src/main/resources/service-application.properties new file mode 100644 index 0000000000..4d360de145 --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/main/resources/service-application.properties @@ -0,0 +1 @@ +server.port=8081 diff --git a/spring-cloud/spring-cloud-gateway/src/test/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/CustomFiltersLiveTest.java b/spring-cloud/spring-cloud-gateway/src/test/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/CustomFiltersLiveTest.java new file mode 100644 index 0000000000..a4bb3f8068 --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/test/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/CustomFiltersLiveTest.java @@ -0,0 +1,110 @@ +package com.baeldung.springcloudgateway.customfilters.gatewayapp; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.assertj.core.api.Condition; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.test.web.reactive.server.WebTestClient; +import org.springframework.test.web.reactive.server.WebTestClient.ResponseSpec; + +import com.baeldung.springcloudgateway.customfilters.gatewayapp.utils.LoggerListAppender; + +import ch.qos.logback.classic.spi.ILoggingEvent; + +/** + * This test requires: + * * the service in com.baeldung.service running + * * the 'second service' in com.baeldung.secondservice running + * + */ +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) +public class CustomFiltersLiveTest { + + @LocalServerPort + String port; + + private WebTestClient client; + + @BeforeEach + public void clearLogList() { + LoggerListAppender.clearEventList(); + client = WebTestClient.bindToServer() + .baseUrl("http://localhost:" + port) + .build(); + } + + @Test + public void whenCallServiceThroughGateway_thenAllConfiguredFiltersGetExecuted() { + ResponseSpec response = client.get() + .uri("/service/resource") + .exchange(); + + response.expectStatus() + .isOk() + .expectHeader() + .doesNotExist("Bael-Custom-Language-Header") + .expectBody(String.class) + .isEqualTo("Service Resource"); + + assertThat(LoggerListAppender.getEvents()) + // Global Pre Filter + .haveAtLeastOne(eventContains("Global Pre Filter executed")) + // Global Post Filter + .haveAtLeastOne(eventContains("Global Post Filter executed")) + // Global Pre and Post Filter + .haveAtLeastOne(eventContains("First Pre Global Filter")) + .haveAtLeastOne(eventContains("Last Post Global Filter")) + // Logging Filter Factory + .haveAtLeastOne(eventContains("Pre GatewayFilter logging: My Custom Message")) + .haveAtLeastOne(eventContains("Post GatewayFilter logging: My Custom Message")) + // Modify Request + .haveAtLeastOne(eventContains("Modify request output - Request contains Accept-Language header:")) + .haveAtLeastOne(eventContainsExcept("Removed all query params: ", "locale")) + // Modify Response + .areNot(eventContains("Added custom header to Response")) + // Chain Request + .haveAtLeastOne(eventContains("Chain Request output - Request contains Accept-Language header:")); + } + + @Test + public void givenRequestWithLocaleQueryParam_whenCallServiceThroughGateway_thenAllConfiguredFiltersGetExecuted() { + ResponseSpec response = client.get() + .uri("/service/resource?locale=en") + .exchange(); + + response.expectStatus() + .isOk() + .expectHeader() + .exists("Bael-Custom-Language-Header") + .expectBody(String.class) + .isEqualTo("Service Resource"); + + assertThat(LoggerListAppender.getEvents()) + // Modify Response + .haveAtLeastOne(eventContains("Added custom header to Response")) + .haveAtLeastOne(eventContainsExcept("Removed all query params: ", "locale")); + } + + /** + * This condition will be successful if the event contains a substring + */ + private Condition<ILoggingEvent> eventContains(String substring) { + return new Condition<ILoggingEvent>(entry -> (substring == null || (entry.getFormattedMessage() != null && entry.getFormattedMessage() + .contains(substring))), String.format("entry with message '%s'", substring)); + } + + /** + * This condition will be successful if the event contains a substring, but not another one + */ + private Condition<ILoggingEvent> eventContainsExcept(String substring, String except) { + return new Condition<ILoggingEvent>(entry -> (substring == null || (entry.getFormattedMessage() != null && entry.getFormattedMessage() + .contains(substring) + && !entry.getFormattedMessage() + .contains(except))), + String.format("entry with message '%s'", substring)); + } +} diff --git a/spring-cloud/spring-cloud-gateway/src/test/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/utils/LoggerListAppender.java b/spring-cloud/spring-cloud-gateway/src/test/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/utils/LoggerListAppender.java new file mode 100644 index 0000000000..8e113b417b --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/test/java/com/baeldung/springcloudgateway/customfilters/gatewayapp/utils/LoggerListAppender.java @@ -0,0 +1,25 @@ +package com.baeldung.springcloudgateway.customfilters.gatewayapp.utils; + +import java.util.ArrayList; +import java.util.List; + +import ch.qos.logback.classic.spi.ILoggingEvent; +import ch.qos.logback.core.AppenderBase; + +public class LoggerListAppender extends AppenderBase<ILoggingEvent> { + + static private List<ILoggingEvent> events = new ArrayList<>(); + + @Override + protected void append(ILoggingEvent eventObject) { + events.add(eventObject); + } + + public static List<ILoggingEvent> getEvents() { + return events; + } + + public static void clearEventList() { + events.clear(); + } +} \ No newline at end of file diff --git a/spring-cloud/spring-cloud-gateway/src/test/java/com/baeldung/springcloudgateway/customfilters/secondservice/SecondServiceIntegrationTest.java b/spring-cloud/spring-cloud-gateway/src/test/java/com/baeldung/springcloudgateway/customfilters/secondservice/SecondServiceIntegrationTest.java new file mode 100644 index 0000000000..6b2a432d20 --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/test/java/com/baeldung/springcloudgateway/customfilters/secondservice/SecondServiceIntegrationTest.java @@ -0,0 +1,26 @@ +package com.baeldung.springcloudgateway.customfilters.secondservice; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest; +import org.springframework.test.web.reactive.server.WebTestClient; + +import com.baeldung.springcloudgateway.customfilters.secondservice.web.SecondServiceRestController; + +@WebFluxTest(SecondServiceRestController.class) +public class SecondServiceIntegrationTest { + + @Autowired + private WebTestClient webClient; + + @Test + public void whenResourceLanguageEndpointCalled_thenRetrievesSpanishLanguageString() throws Exception { + this.webClient.get() + .uri("/resource/language") + .exchange() + .expectStatus() + .isOk() + .expectBody(String.class) + .isEqualTo("es"); + } +} diff --git a/spring-cloud/spring-cloud-gateway/src/test/java/com/baeldung/springcloudgateway/customfilters/secondservice/SpringContextTest.java b/spring-cloud/spring-cloud-gateway/src/test/java/com/baeldung/springcloudgateway/customfilters/secondservice/SpringContextTest.java new file mode 100644 index 0000000000..eaf94c0a42 --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/test/java/com/baeldung/springcloudgateway/customfilters/secondservice/SpringContextTest.java @@ -0,0 +1,12 @@ +package com.baeldung.springcloudgateway.customfilters.secondservice; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest(classes = SecondServiceApplication.class) +public class SpringContextTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-gateway/src/test/java/com/baeldung/springcloudgateway/customfilters/service/ServiceIntegrationTest.java b/spring-cloud/spring-cloud-gateway/src/test/java/com/baeldung/springcloudgateway/customfilters/service/ServiceIntegrationTest.java new file mode 100644 index 0000000000..bfb3f23f0d --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/test/java/com/baeldung/springcloudgateway/customfilters/service/ServiceIntegrationTest.java @@ -0,0 +1,29 @@ +package com.baeldung.springcloudgateway.customfilters.service; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest; +import org.springframework.http.HttpHeaders; +import org.springframework.test.web.reactive.server.WebTestClient; + +import com.baeldung.springcloudgateway.customfilters.service.web.ServiceRestController; + +@WebFluxTest(ServiceRestController.class) +public class ServiceIntegrationTest { + + @Autowired + private WebTestClient webClient; + + @Test + public void whenResourceEndpointCalled_thenRetrievesResourceStringWithContentLanguageHeader() throws Exception { + this.webClient.get() + .uri("/resource") + .exchange() + .expectStatus() + .isOk() + .expectHeader() + .valueEquals(HttpHeaders.CONTENT_LANGUAGE, "en") + .expectBody(String.class) + .isEqualTo("Service Resource"); + } +} diff --git a/spring-cloud/spring-cloud-gateway/src/test/java/com/baeldung/springcloudgateway/customfilters/service/SpringContextTest.java b/spring-cloud/spring-cloud-gateway/src/test/java/com/baeldung/springcloudgateway/customfilters/service/SpringContextTest.java new file mode 100644 index 0000000000..2a9b322d5e --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/test/java/com/baeldung/springcloudgateway/customfilters/service/SpringContextTest.java @@ -0,0 +1,12 @@ +package com.baeldung.springcloudgateway.customfilters.service; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest(classes = ServiceApplication.class) +public class SpringContextTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-gateway/src/test/java/com/baeldung/springcloudgateway/introduction/SpringContextTest.java b/spring-cloud/spring-cloud-gateway/src/test/java/com/baeldung/springcloudgateway/introduction/SpringContextTest.java new file mode 100644 index 0000000000..1550265f22 --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/test/java/com/baeldung/springcloudgateway/introduction/SpringContextTest.java @@ -0,0 +1,15 @@ +package com.baeldung.springcloudgateway.introduction; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +import com.baeldung.springcloudgateway.introduction.IntroductionGatewayApplication; + + +@SpringBootTest(classes = IntroductionGatewayApplication.class) +public class SpringContextTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-gateway/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-gateway/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index f2addf5c1a..0000000000 --- a/spring-cloud/spring-cloud-gateway/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.spring.cloud.GatewayApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = GatewayApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-cloud/spring-cloud-gateway/src/test/java/org/baeldung/SpringContextTest.java b/spring-cloud/spring-cloud-gateway/src/test/java/org/baeldung/SpringContextTest.java deleted file mode 100644 index b7e2acf7a8..0000000000 --- a/spring-cloud/spring-cloud-gateway/src/test/java/org/baeldung/SpringContextTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.spring.cloud.GatewayApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = GatewayApplication.class) -public class SpringContextTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-cloud/spring-cloud-gateway/src/test/resources/logback-test.xml b/spring-cloud/spring-cloud-gateway/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..6fcdb6317f --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/test/resources/logback-test.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<configuration> + <appender name="LISTAPPENDER" + class="com.baeldung.springcloudgateway.customfilters.gatewayapp.utils.LoggerListAppender"> + </appender> + <root level="info"> + <appender-ref ref="LISTAPPENDER" /> + </root> +</configuration> \ No newline at end of file diff --git a/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml b/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml index a345d6856b..367b7c111e 100644 --- a/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml +++ b/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml @@ -15,6 +15,18 @@ <relativePath>..</relativePath> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-parent</artifactId> + <version>${spring-cloud-dependencies.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>com.baeldung.spring.cloud</groupId> @@ -46,25 +58,14 @@ <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-parent</artifactId> - <version>${spring-cloud-dependencies.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <properties> <rest-producer.version>1.0.0-SNAPSHOT</rest-producer.version> </properties> + </project> diff --git a/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/src/test/java/com/baeldung/spring/cloud/hystrix/rest/consumer/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/src/test/java/com/baeldung/spring/cloud/hystrix/rest/consumer/SpringContextIntegrationTest.java deleted file mode 100644 index 47ee5dcd49..0000000000 --- a/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/src/test/java/com/baeldung/spring/cloud/hystrix/rest/consumer/SpringContextIntegrationTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung.spring.cloud.hystrix.rest.consumer; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = RestConsumerFeignApplication.class) -@WebAppConfiguration -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } - -} diff --git a/spring-cloud/spring-cloud-hystrix/pom.xml b/spring-cloud/spring-cloud-hystrix/pom.xml index 51f6a4e82b..4aec8050ff 100644 --- a/spring-cloud/spring-cloud-hystrix/pom.xml +++ b/spring-cloud/spring-cloud-hystrix/pom.xml @@ -3,7 +3,6 @@ xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung.spring.cloud</groupId> <artifactId>spring-cloud-hystrix</artifactId> <version>1.0.0-SNAPSHOT</version> <name>spring-cloud-hystrix</name> diff --git a/spring-cloud/spring-cloud-hystrix/rest-consumer/pom.xml b/spring-cloud/spring-cloud-hystrix/rest-consumer/pom.xml index 43ccfcc26d..ba03ad3348 100644 --- a/spring-cloud/spring-cloud-hystrix/rest-consumer/pom.xml +++ b/spring-cloud/spring-cloud-hystrix/rest-consumer/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>rest-consumer</artifactId> <version>1.0.0-SNAPSHOT</version> @@ -14,6 +14,18 @@ <relativePath>..</relativePath> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-parent</artifactId> + <version>${spring-cloud-dependencies.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> @@ -40,7 +52,7 @@ <artifactId>spring-boot-starter-actuator</artifactId> <version>${spring-boot-starter-web.version}</version> </dependency> - + <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> @@ -49,18 +61,6 @@ </dependency> </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-parent</artifactId> - <version>${spring-cloud-dependencies.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <properties> <!-- we need the Mockito version provided by Spring Boot --> <mockito.version>1.10.19</mockito.version> diff --git a/spring-cloud/spring-cloud-hystrix/rest-consumer/src/test/java/com/baeldung/spring/cloud/hystrix/rest/consumer/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-hystrix/rest-consumer/src/test/java/com/baeldung/spring/cloud/hystrix/rest/consumer/SpringContextIntegrationTest.java deleted file mode 100644 index 3af30acc51..0000000000 --- a/spring-cloud/spring-cloud-hystrix/rest-consumer/src/test/java/com/baeldung/spring/cloud/hystrix/rest/consumer/SpringContextIntegrationTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung.spring.cloud.hystrix.rest.consumer; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = RestConsumerApplication.class) -@WebAppConfiguration -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } - -} diff --git a/spring-cloud/spring-cloud-hystrix/rest-producer/pom.xml b/spring-cloud/spring-cloud-hystrix/rest-producer/pom.xml index 07437634f5..cb7377d705 100644 --- a/spring-cloud/spring-cloud-hystrix/rest-producer/pom.xml +++ b/spring-cloud/spring-cloud-hystrix/rest-producer/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>rest-producer</artifactId> <version>1.0.0-SNAPSHOT</version> @@ -20,7 +20,7 @@ <artifactId>spring-boot-starter-web</artifactId> <version>${spring-boot-starter-web.version}</version> </dependency> - + <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> @@ -28,7 +28,7 @@ <scope>test</scope> </dependency> </dependencies> - + <properties> <!-- we need the Mockito version provided by Spring Boot --> <mockito.version>1.10.19</mockito.version> diff --git a/spring-cloud/spring-cloud-hystrix/rest-producer/src/test/java/com/baeldung/spring/cloud/hystrix/rest/producer/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-hystrix/rest-producer/src/test/java/com/baeldung/spring/cloud/hystrix/rest/producer/SpringContextIntegrationTest.java deleted file mode 100644 index de696dc2b1..0000000000 --- a/spring-cloud/spring-cloud-hystrix/rest-producer/src/test/java/com/baeldung/spring/cloud/hystrix/rest/producer/SpringContextIntegrationTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.spring.cloud.hystrix.rest.producer; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } - -} diff --git a/spring-cloud/spring-cloud-kubernetes/README.md b/spring-cloud/spring-cloud-kubernetes/README.md index b64ad65ef9..328b870a44 100644 --- a/spring-cloud/spring-cloud-kubernetes/README.md +++ b/spring-cloud/spring-cloud-kubernetes/README.md @@ -1,9 +1,9 @@ ## Spring Cloud Kubernetes -This moudle contains articles about Spring Cloud Kubernetes +This module contains articles about Spring Cloud Kubernetes. ### Relevant Articles: -- [Running Spring Boot Applications With Minikube](https://www.baeldung.com/spring-boot-minikube) +- [Running Spring Boot Applications with Minikube](https://www.baeldung.com/spring-boot-minikube) - [Self-Healing Applications with Kubernetes and Spring Boot](https://www.baeldung.com/spring-boot-kubernetes-self-healing-apps) - [Guide to Spring Cloud Kubernetes](https://www.baeldung.com/spring-cloud-kubernetes) diff --git a/spring-cloud/spring-cloud-kubernetes/client-service/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-kubernetes/client-service/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index a6a978a354..0000000000 --- a/spring-cloud/spring-cloud-kubernetes/client-service/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.spring.cloud.kubernetes.client.Application; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -public class SpringContextIntegrationTest { - - @Test - public void contextLoads() { - } -} diff --git a/spring-cloud/spring-cloud-kubernetes/demo-backend/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-kubernetes/demo-backend/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index ce57cf5052..0000000000 --- a/spring-cloud/spring-cloud-kubernetes/demo-backend/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.spring.cloud.kubernetes.backend.KubernetesBackendApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = KubernetesBackendApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void contextLoads() { - } - -} diff --git a/spring-cloud/spring-cloud-kubernetes/demo-frontend/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-kubernetes/demo-frontend/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index f7e9e35540..0000000000 --- a/spring-cloud/spring-cloud-kubernetes/demo-frontend/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.spring.cloud.kubernetes.frontend.KubernetesFrontendApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = KubernetesFrontendApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void contextLoads() { - } - -} diff --git a/spring-cloud/spring-cloud-kubernetes/client-service/.gitignore b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/client-service/.gitignore similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/client-service/.gitignore rename to spring-cloud/spring-cloud-kubernetes/kubernetes-guide/client-service/.gitignore diff --git a/spring-cloud/spring-cloud-kubernetes/client-service/Dockerfile b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/client-service/Dockerfile similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/client-service/Dockerfile rename to spring-cloud/spring-cloud-kubernetes/kubernetes-guide/client-service/Dockerfile diff --git a/spring-cloud/spring-cloud-kubernetes/client-service/client-config.yaml b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/client-service/client-config.yaml similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/client-service/client-config.yaml rename to spring-cloud/spring-cloud-kubernetes/kubernetes-guide/client-service/client-config.yaml diff --git a/spring-cloud/spring-cloud-kubernetes/client-service/client-service-deployment.yaml b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/client-service/client-service-deployment.yaml similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/client-service/client-service-deployment.yaml rename to spring-cloud/spring-cloud-kubernetes/kubernetes-guide/client-service/client-service-deployment.yaml diff --git a/spring-cloud/spring-cloud-kubernetes/client-service/pom.xml b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/client-service/pom.xml similarity index 94% rename from spring-cloud/spring-cloud-kubernetes/client-service/pom.xml rename to spring-cloud/spring-cloud-kubernetes/kubernetes-guide/client-service/pom.xml index 41e09fa13b..e5f76d5d9c 100644 --- a/spring-cloud/spring-cloud-kubernetes/client-service/pom.xml +++ b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/client-service/pom.xml @@ -1,15 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>client-service</artifactId> - <name>client-service</name> + <name>client-service</name> <version>1.0-SNAPSHOT</version> <parent> <groupId>com.baeldung.spring.cloud</groupId> <artifactId>spring-cloud-kubernetes</artifactId> <version>1.0-SNAPSHOT</version> + <relativePath>../../../spring-cloud-kubernetes</relativePath> </parent> <dependencyManagement> diff --git a/spring-cloud/spring-cloud-kubernetes/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/Application.java b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/Application.java similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/Application.java rename to spring-cloud/spring-cloud-kubernetes/kubernetes-guide/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/Application.java diff --git a/spring-cloud/spring-cloud-kubernetes/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/ClientConfig.java b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/ClientConfig.java similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/ClientConfig.java rename to spring-cloud/spring-cloud-kubernetes/kubernetes-guide/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/ClientConfig.java diff --git a/spring-cloud/spring-cloud-kubernetes/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/ClientController.java b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/ClientController.java old mode 100755 new mode 100644 similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/ClientController.java rename to spring-cloud/spring-cloud-kubernetes/kubernetes-guide/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/ClientController.java diff --git a/spring-cloud/spring-cloud-kubernetes/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/RibbonConfiguration.java b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/RibbonConfiguration.java old mode 100755 new mode 100644 similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/RibbonConfiguration.java rename to spring-cloud/spring-cloud-kubernetes/kubernetes-guide/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/RibbonConfiguration.java diff --git a/spring-cloud/spring-cloud-kubernetes/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/TravelAgencyService.java b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/TravelAgencyService.java similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/TravelAgencyService.java rename to spring-cloud/spring-cloud-kubernetes/kubernetes-guide/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/TravelAgencyService.java diff --git a/spring-cloud/spring-cloud-kubernetes/client-service/src/main/resources/application.yaml b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/client-service/src/main/resources/application.yaml similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/client-service/src/main/resources/application.yaml rename to spring-cloud/spring-cloud-kubernetes/kubernetes-guide/client-service/src/main/resources/application.yaml diff --git a/spring-cloud/spring-cloud-kubernetes/demo-backend/src/main/resources/logback.xml b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/client-service/src/main/resources/logback.xml similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/demo-backend/src/main/resources/logback.xml rename to spring-cloud/spring-cloud-kubernetes/kubernetes-guide/client-service/src/main/resources/logback.xml diff --git a/spring-cloud/spring-cloud-kubernetes/client-service/src/test/java/org/baeldung/SpringContextTest.java b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/client-service/src/test/java/org/baeldung/SpringContextTest.java similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/client-service/src/test/java/org/baeldung/SpringContextTest.java rename to spring-cloud/spring-cloud-kubernetes/kubernetes-guide/client-service/src/test/java/org/baeldung/SpringContextTest.java diff --git a/spring-cloud/spring-cloud-kubernetes/deployment-travel-client.sh b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/deployment-travel-client.sh old mode 100755 new mode 100644 similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/deployment-travel-client.sh rename to spring-cloud/spring-cloud-kubernetes/kubernetes-guide/deployment-travel-client.sh diff --git a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/Dockerfile b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/Dockerfile old mode 100755 new mode 100644 similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/travel-agency-service/Dockerfile rename to spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/Dockerfile diff --git a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/mongo-deployment.yaml b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/mongo-deployment.yaml similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/travel-agency-service/mongo-deployment.yaml rename to spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/mongo-deployment.yaml diff --git a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/pom.xml b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/pom.xml old mode 100755 new mode 100644 similarity index 91% rename from spring-cloud/spring-cloud-kubernetes/travel-agency-service/pom.xml rename to spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/pom.xml index 0d7639b179..93734a19a7 --- a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/pom.xml +++ b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/pom.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>travel-agency-service</artifactId> <version>1.0-SNAPSHOT</version> @@ -8,6 +9,7 @@ <groupId>com.baeldung.spring.cloud</groupId> <artifactId>spring-cloud-kubernetes</artifactId> <version>1.0-SNAPSHOT</version> + <relativePath>../../../spring-cloud-kubernetes</relativePath> </parent> <dependencyManagement> diff --git a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/secret.yaml b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/secret.yaml similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/travel-agency-service/secret.yaml rename to spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/secret.yaml diff --git a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/Application.java b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/Application.java old mode 100755 new mode 100644 similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/Application.java rename to spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/Application.java diff --git a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/controller/TravelAgencyController.java b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/controller/TravelAgencyController.java similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/controller/TravelAgencyController.java rename to spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/controller/TravelAgencyController.java diff --git a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/model/TravelDeal.java b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/model/TravelDeal.java similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/model/TravelDeal.java rename to spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/model/TravelDeal.java diff --git a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/repository/TravelDealRepository.java b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/repository/TravelDealRepository.java similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/repository/TravelDealRepository.java rename to spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/repository/TravelDealRepository.java diff --git a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/resources/application.properties b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/src/main/resources/application.properties similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/resources/application.properties rename to spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/src/main/resources/application.properties diff --git a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/resources/logback-spring.xml b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/src/main/resources/logback-spring.xml similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/resources/logback-spring.xml rename to spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/src/main/resources/logback-spring.xml diff --git a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/resources/logback.xml b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/src/main/resources/logback.xml similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/resources/logback.xml rename to spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/src/main/resources/logback.xml diff --git a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/test/java/com/baeldung/spring/cloud/kubernetes/travelagency/SpringContextTest.java b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/src/test/java/com/baeldung/spring/cloud/kubernetes/travelagency/SpringContextTest.java similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/test/java/com/baeldung/spring/cloud/kubernetes/travelagency/SpringContextTest.java rename to spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/src/test/java/com/baeldung/spring/cloud/kubernetes/travelagency/SpringContextTest.java diff --git a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/travel-agency-deployment.yaml b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/travel-agency-deployment.yaml similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/travel-agency-service/travel-agency-deployment.yaml rename to spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/travel-agency-deployment.yaml diff --git a/spring-cloud/spring-cloud-kubernetes/demo-backend/.gitignore b/spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-backend/.gitignore similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/demo-backend/.gitignore rename to spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-backend/.gitignore diff --git a/spring-cloud/spring-cloud-kubernetes/demo-backend/Dockerfile b/spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-backend/Dockerfile similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/demo-backend/Dockerfile rename to spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-backend/Dockerfile diff --git a/spring-cloud/spring-cloud-kubernetes/demo-backend/pom.xml b/spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-backend/pom.xml similarity index 83% rename from spring-cloud/spring-cloud-kubernetes/demo-backend/pom.xml rename to spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-backend/pom.xml index f7b04baec3..5bd7d3f5ea 100644 --- a/spring-cloud/spring-cloud-kubernetes/demo-backend/pom.xml +++ b/spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-backend/pom.xml @@ -1,14 +1,15 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>demo-backend</artifactId> - <name>demo-backend</name> - + <name>demo-backend</name> + <parent> <groupId>com.baeldung.spring.cloud</groupId> <artifactId>spring-cloud-kubernetes</artifactId> <version>1.0-SNAPSHOT</version> + <relativePath>../../../spring-cloud-kubernetes</relativePath> </parent> <dependencies> diff --git a/spring-cloud/spring-cloud-kubernetes/demo-backend/src/main/java/com/baeldung/spring/cloud/kubernetes/backend/KubernetesBackendApplication.java b/spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-backend/src/main/java/com/baeldung/spring/cloud/kubernetes/backend/KubernetesBackendApplication.java similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/demo-backend/src/main/java/com/baeldung/spring/cloud/kubernetes/backend/KubernetesBackendApplication.java rename to spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-backend/src/main/java/com/baeldung/spring/cloud/kubernetes/backend/KubernetesBackendApplication.java diff --git a/spring-cloud/spring-cloud-kubernetes/demo-backend/src/main/resources/application.properties b/spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-backend/src/main/resources/application.properties similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/demo-backend/src/main/resources/application.properties rename to spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-backend/src/main/resources/application.properties diff --git a/spring-cloud/spring-cloud-kubernetes/demo-frontend/src/main/resources/logback.xml b/spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-backend/src/main/resources/logback.xml similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/demo-frontend/src/main/resources/logback.xml rename to spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-backend/src/main/resources/logback.xml diff --git a/spring-cloud/spring-cloud-kubernetes/demo-backend/src/test/java/org/baeldung/SpringContextTest.java b/spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-backend/src/test/java/org/baeldung/SpringContextTest.java similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/demo-backend/src/test/java/org/baeldung/SpringContextTest.java rename to spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-backend/src/test/java/org/baeldung/SpringContextTest.java diff --git a/spring-cloud/spring-cloud-kubernetes/demo-frontend/.gitignore b/spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-frontend/.gitignore similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/demo-frontend/.gitignore rename to spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-frontend/.gitignore diff --git a/spring-cloud/spring-cloud-kubernetes/demo-frontend/Dockerfile b/spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-frontend/Dockerfile similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/demo-frontend/Dockerfile rename to spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-frontend/Dockerfile diff --git a/spring-cloud/spring-cloud-kubernetes/demo-frontend/pom.xml b/spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-frontend/pom.xml similarity index 83% rename from spring-cloud/spring-cloud-kubernetes/demo-frontend/pom.xml rename to spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-frontend/pom.xml index da55ca5034..9a4924b903 100644 --- a/spring-cloud/spring-cloud-kubernetes/demo-frontend/pom.xml +++ b/spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-frontend/pom.xml @@ -1,14 +1,15 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>demo-frontend</artifactId> - <name>demo-frontend</name> - + <name>demo-frontend</name> + <parent> <groupId>com.baeldung.spring.cloud</groupId> <artifactId>spring-cloud-kubernetes</artifactId> <version>1.0-SNAPSHOT</version> + <relativePath>../../../spring-cloud-kubernetes</relativePath> </parent> <dependencies> diff --git a/spring-cloud/spring-cloud-kubernetes/demo-frontend/src/main/java/com/baeldung/spring/cloud/kubernetes/frontend/KubernetesFrontendApplication.java b/spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-frontend/src/main/java/com/baeldung/spring/cloud/kubernetes/frontend/KubernetesFrontendApplication.java similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/demo-frontend/src/main/java/com/baeldung/spring/cloud/kubernetes/frontend/KubernetesFrontendApplication.java rename to spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-frontend/src/main/java/com/baeldung/spring/cloud/kubernetes/frontend/KubernetesFrontendApplication.java diff --git a/spring-cloud/spring-cloud-kubernetes/demo-frontend/src/main/resources/application.properties b/spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-frontend/src/main/resources/application.properties similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/demo-frontend/src/main/resources/application.properties rename to spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-frontend/src/main/resources/application.properties diff --git a/spring-cloud/spring-cloud-kubernetes/liveness-example/src/main/resources/resources/logback.xml b/spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-frontend/src/main/resources/logback.xml similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/liveness-example/src/main/resources/resources/logback.xml rename to spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-frontend/src/main/resources/logback.xml diff --git a/spring-cloud/spring-cloud-kubernetes/demo-frontend/src/test/java/org/baeldung/SpringContextTest.java b/spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-frontend/src/test/java/org/baeldung/SpringContextTest.java similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/demo-frontend/src/test/java/org/baeldung/SpringContextTest.java rename to spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-frontend/src/test/java/org/baeldung/SpringContextTest.java diff --git a/spring-cloud/spring-cloud-kubernetes/object-configurations/backend-deployment.yaml b/spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/object-configurations/backend-deployment.yaml similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/object-configurations/backend-deployment.yaml rename to spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/object-configurations/backend-deployment.yaml diff --git a/spring-cloud/spring-cloud-kubernetes/object-configurations/frontend-deployment.yaml b/spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/object-configurations/frontend-deployment.yaml similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/object-configurations/frontend-deployment.yaml rename to spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/object-configurations/frontend-deployment.yaml diff --git a/spring-cloud/spring-cloud-kubernetes/liveness-example/Dockerfile b/spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/liveness-example/Dockerfile similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/liveness-example/Dockerfile rename to spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/liveness-example/Dockerfile diff --git a/spring-cloud/spring-cloud-kubernetes/liveness-example/pom.xml b/spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/liveness-example/pom.xml similarity index 93% rename from spring-cloud/spring-cloud-kubernetes/liveness-example/pom.xml rename to spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/liveness-example/pom.xml index 293b215918..66d8f096ce 100644 --- a/spring-cloud/spring-cloud-kubernetes/liveness-example/pom.xml +++ b/spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/liveness-example/pom.xml @@ -4,14 +4,14 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>liveness-example</artifactId> - <name>liveness-example</name> + <name>liveness-example</name> <version>1.0-SNAPSHOT</version> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> - <relativePath>../../../parent-boot-1</relativePath> + <relativePath>../../../../parent-boot-1</relativePath> </parent> <dependencies> diff --git a/spring-cloud/spring-cloud-kubernetes/liveness-example/src/main/java/com/baeldung/liveness/Application.java b/spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/liveness-example/src/main/java/com/baeldung/liveness/Application.java similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/liveness-example/src/main/java/com/baeldung/liveness/Application.java rename to spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/liveness-example/src/main/java/com/baeldung/liveness/Application.java diff --git a/spring-cloud/spring-cloud-kubernetes/liveness-example/src/main/java/com/baeldung/liveness/health/CustomHealthIndicator.java b/spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/liveness-example/src/main/java/com/baeldung/liveness/health/CustomHealthIndicator.java similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/liveness-example/src/main/java/com/baeldung/liveness/health/CustomHealthIndicator.java rename to spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/liveness-example/src/main/java/com/baeldung/liveness/health/CustomHealthIndicator.java diff --git a/spring-cloud/spring-cloud-kubernetes/liveness-example/src/main/resources/resources/application.properties b/spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/liveness-example/src/main/resources/resources/application.properties similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/liveness-example/src/main/resources/resources/application.properties rename to spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/liveness-example/src/main/resources/resources/application.properties diff --git a/spring-cloud/spring-cloud-kubernetes/readiness-example/src/main/resources/resources/logback.xml b/spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/liveness-example/src/main/resources/resources/logback.xml similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/readiness-example/src/main/resources/resources/logback.xml rename to spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/liveness-example/src/main/resources/resources/logback.xml diff --git a/spring-cloud/spring-cloud-kubernetes/liveness-example/src/test/java/com/baeldung/SpringContextTest.java b/spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/liveness-example/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/liveness-example/src/test/java/com/baeldung/SpringContextTest.java rename to spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/liveness-example/src/test/java/com/baeldung/SpringContextTest.java diff --git a/spring-cloud/spring-cloud-kubernetes/object-configurations/liveness-example-k8s-template.yaml b/spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/object-configurations/liveness-example-k8s-template.yaml similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/object-configurations/liveness-example-k8s-template.yaml rename to spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/object-configurations/liveness-example-k8s-template.yaml diff --git a/spring-cloud/spring-cloud-kubernetes/object-configurations/readiness-example-k8s-template.yaml b/spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/object-configurations/readiness-example-k8s-template.yaml similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/object-configurations/readiness-example-k8s-template.yaml rename to spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/object-configurations/readiness-example-k8s-template.yaml diff --git a/spring-cloud/spring-cloud-kubernetes/readiness-example/Dockerfile b/spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/readiness-example/Dockerfile similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/readiness-example/Dockerfile rename to spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/readiness-example/Dockerfile diff --git a/spring-cloud/spring-cloud-kubernetes/readiness-example/pom.xml b/spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/readiness-example/pom.xml similarity index 93% rename from spring-cloud/spring-cloud-kubernetes/readiness-example/pom.xml rename to spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/readiness-example/pom.xml index 07589e65b6..fbb9e09d07 100644 --- a/spring-cloud/spring-cloud-kubernetes/readiness-example/pom.xml +++ b/spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/readiness-example/pom.xml @@ -4,14 +4,14 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>readiness-example</artifactId> - <name>readiness-example</name> + <name>readiness-example</name> <version>1.0-SNAPSHOT</version> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> - <relativePath>../../../parent-boot-1</relativePath> + <relativePath>../../../../parent-boot-1</relativePath> </parent> <dependencies> diff --git a/spring-cloud/spring-cloud-kubernetes/readiness-example/src/main/java/com/baeldung/readiness/Application.java b/spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/readiness-example/src/main/java/com/baeldung/readiness/Application.java similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/readiness-example/src/main/java/com/baeldung/readiness/Application.java rename to spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/readiness-example/src/main/java/com/baeldung/readiness/Application.java diff --git a/spring-cloud/spring-cloud-kubernetes/readiness-example/src/main/java/com/baeldung/readiness/health/CustomHealthIndicator.java b/spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/readiness-example/src/main/java/com/baeldung/readiness/health/CustomHealthIndicator.java similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/readiness-example/src/main/java/com/baeldung/readiness/health/CustomHealthIndicator.java rename to spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/readiness-example/src/main/java/com/baeldung/readiness/health/CustomHealthIndicator.java diff --git a/spring-cloud/spring-cloud-kubernetes/readiness-example/src/main/resources/resources/application.properties b/spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/readiness-example/src/main/resources/resources/application.properties similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/readiness-example/src/main/resources/resources/application.properties rename to spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/readiness-example/src/main/resources/resources/application.properties diff --git a/spring-security-acl/src/main/resources/logback.xml b/spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/readiness-example/src/main/resources/resources/logback.xml similarity index 100% rename from spring-security-acl/src/main/resources/logback.xml rename to spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/readiness-example/src/main/resources/resources/logback.xml diff --git a/spring-cloud/spring-cloud-kubernetes/readiness-example/src/test/java/com/baeldung/SpringContextTest.java b/spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/readiness-example/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-cloud/spring-cloud-kubernetes/readiness-example/src/test/java/com/baeldung/SpringContextTest.java rename to spring-cloud/spring-cloud-kubernetes/kubernetes-selfhealing/readiness-example/src/test/java/com/baeldung/SpringContextTest.java diff --git a/spring-cloud/spring-cloud-kubernetes/liveness-example/src/test/java/com/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-kubernetes/liveness-example/src/test/java/com/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 60b4a28aa6..0000000000 --- a/spring-cloud/spring-cloud-kubernetes/liveness-example/src/test/java/com/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung; - -import com.baeldung.liveness.Application; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -public class SpringContextIntegrationTest { - - @Test - public void contextLoads() { - } - -} diff --git a/spring-cloud/spring-cloud-kubernetes/pom.xml b/spring-cloud/spring-cloud-kubernetes/pom.xml index a9563fc582..ed4bccbf78 100644 --- a/spring-cloud/spring-cloud-kubernetes/pom.xml +++ b/spring-cloud/spring-cloud-kubernetes/pom.xml @@ -1,27 +1,27 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.spring.cloud</groupId> <artifactId>spring-cloud-kubernetes</artifactId> <version>1.0-SNAPSHOT</version> - <name>spring-cloud-kubernetes</name> + <name>spring-cloud-kubernetes</name> <packaging>pom</packaging> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-2</relativePath> </parent> <modules> - <module>demo-frontend</module> - <module>demo-backend</module> - <module>liveness-example</module> - <module>readiness-example</module> - <module>client-service</module> - <module>travel-agency-service</module> + <module>kubernetes-minikube/demo-frontend</module> + <module>kubernetes-minikube/demo-backend</module> + <module>kubernetes-selfhealing/liveness-example</module> + <module>kubernetes-selfhealing/readiness-example</module> + <module>kubernetes-guide/client-service</module> + <module>kubernetes-guide/travel-agency-service</module> </modules> </project> \ No newline at end of file diff --git a/spring-cloud/spring-cloud-kubernetes/readiness-example/src/test/java/com/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-kubernetes/readiness-example/src/test/java/com/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 18458182c7..0000000000 --- a/spring-cloud/spring-cloud-kubernetes/readiness-example/src/test/java/com/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung; - -import com.baeldung.readiness.Application; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -public class SpringContextIntegrationTest { - - @Test - public void contextLoads() { - } - -} diff --git a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/test/java/com/baeldung/spring/cloud/kubernetes/travelagency/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/test/java/com/baeldung/spring/cloud/kubernetes/travelagency/SpringContextIntegrationTest.java deleted file mode 100644 index 2f901d39f6..0000000000 --- a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/test/java/com/baeldung/spring/cloud/kubernetes/travelagency/SpringContextIntegrationTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.spring.cloud.kubernetes.travelagency; - - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} \ No newline at end of file diff --git a/spring-cloud/spring-cloud-openfeign/pom.xml b/spring-cloud/spring-cloud-openfeign/pom.xml index 92de33572b..e20fe338c1 100644 --- a/spring-cloud/spring-cloud-openfeign/pom.xml +++ b/spring-cloud/spring-cloud-openfeign/pom.xml @@ -2,7 +2,6 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung.cloud</groupId> <artifactId>openfeign</artifactId> <version>0.0.1-SNAPSHOT</version> @@ -10,12 +9,24 @@ <description>OpenFeign project for Spring Boot</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-2</relativePath> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-dependencies</artifactId> + <version>${spring-cloud.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> @@ -39,18 +50,6 @@ </dependency> </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-dependencies</artifactId> - <version>${spring-cloud.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <properties> <spring-boot.version>2.0.1.RELEASE</spring-boot.version> <spring-cloud.version>Finchley.SR2</spring-cloud.version> diff --git a/spring-cloud/spring-cloud-openfeign/src/test/java/com/baeldung/cloud/openfeign/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-openfeign/src/test/java/com/baeldung/cloud/openfeign/SpringContextIntegrationTest.java deleted file mode 100644 index 77d294093c..0000000000 --- a/spring-cloud/spring-cloud-openfeign/src/test/java/com/baeldung/cloud/openfeign/SpringContextIntegrationTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.cloud.openfeign; - - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = ExampleApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} \ No newline at end of file diff --git a/spring-cloud/spring-cloud-rest/pom.xml b/spring-cloud/spring-cloud-rest/pom.xml index 7f316f47fc..8677b742de 100644 --- a/spring-cloud/spring-cloud-rest/pom.xml +++ b/spring-cloud/spring-cloud-rest/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.baeldung</groupId> <artifactId>spring-cloud-rest</artifactId> diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/pom.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/pom.xml index a196ed8531..b34e325eb8 100644 --- a/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/pom.xml +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/pom.xml @@ -1,21 +1,33 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.baeldung</groupId> <artifactId>spring-cloud-rest-books-api</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-cloud-rest-books-api</name> - <description>Simple books API</description> <packaging>jar</packaging> + <description>Simple books API</description> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../../parent-boot-1</relativePath> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-dependencies</artifactId> + <version>Camden.SR4</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> @@ -56,16 +68,4 @@ </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-dependencies</artifactId> - <version>Camden.SR4</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - </project> diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/pom.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/pom.xml index 7a71cdb13b..b3bb6fafdc 100644 --- a/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/pom.xml +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/pom.xml @@ -1,21 +1,33 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.baeldung</groupId> <artifactId>spring-cloud-rest-config-server</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-cloud-rest-config-server</name> - <description>Spring Cloud REST configuration server</description> <packaging>jar</packaging> + <description>Spring Cloud REST configuration server</description> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../../parent-boot-1</relativePath> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-dependencies</artifactId> + <version>${spring-cloud.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> @@ -31,18 +43,6 @@ </dependency> </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-dependencies</artifactId> - <version>${spring-cloud.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <properties> <spring-cloud.version>Camden.SR4</spring-cloud.version> </properties> diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 28c6e67377..0000000000 --- a/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringCloudRestConfigApplication.class) -public class SpringContextIntegrationTest { - @Test - public void contextLoads() { - } - -} diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/pom.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/pom.xml index 7ce04f2815..aec51ca38a 100644 --- a/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/pom.xml +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/pom.xml @@ -1,21 +1,33 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.baeldung</groupId> <artifactId>spring-cloud-rest-discovery-server</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-cloud-rest-discovery-server</name> - <description>Spring Cloud REST server</description> <packaging>jar</packaging> + <description>Spring Cloud REST server</description> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../../parent-boot-1</relativePath> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-dependencies</artifactId> + <version>${spring-cloud.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> @@ -39,18 +51,6 @@ </dependency> </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-dependencies</artifactId> - <version>${spring-cloud.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <properties> <spring-cloud.version>Edgware.SR4</spring-cloud.version> </properties> diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/pom.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/pom.xml index cd7749460e..161b996496 100644 --- a/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/pom.xml +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/pom.xml @@ -1,21 +1,33 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.baeldung</groupId> <artifactId>spring-cloud-rest-reviews-api</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-cloud-rest-reviews-api</name> - <description>Simple reviews API</description> <packaging>jar</packaging> + <description>Simple reviews API</description> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../../parent-boot-1</relativePath> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-dependencies</artifactId> + <version>Camden.SR4</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> @@ -60,18 +72,6 @@ </dependency> </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-dependencies</artifactId> - <version>Camden.SR4</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <properties> <rest-assured.version>3.0.1</rest-assured.version> <embedded-redis.version>0.6</embedded-redis.version> diff --git a/spring-cloud/spring-cloud-ribbon-client/pom.xml b/spring-cloud/spring-cloud-ribbon-client/pom.xml index f677009a41..ac86447164 100644 --- a/spring-cloud/spring-cloud-ribbon-client/pom.xml +++ b/spring-cloud/spring-cloud-ribbon-client/pom.xml @@ -1,7 +1,6 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-cloud-ribbon-client</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-cloud-ribbon-client</name> @@ -9,23 +8,12 @@ <description>Introduction to Spring Cloud Rest Client with Netflix Ribbon</description> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-1</relativePath> </parent> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-ribbon</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> - </dependencies> - <dependencyManagement> <dependencies> <dependency> @@ -38,6 +26,17 @@ </dependencies> </dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-ribbon</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + </dependencies> + <properties> <spring-cloud-dependencies.version>Brixton.SR7</spring-cloud-dependencies.version> </properties> diff --git a/spring-cloud/spring-cloud-ribbon-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-ribbon-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index baa1b12eff..0000000000 --- a/spring-cloud/spring-cloud-ribbon-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.spring.cloud.ribbon.client.ServerLocationApp; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = ServerLocationApp.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-cloud/spring-cloud-security/auth-client/pom.xml b/spring-cloud/spring-cloud-security/auth-client/pom.xml index c414e584e5..2852638c1a 100644 --- a/spring-cloud/spring-cloud-security/auth-client/pom.xml +++ b/spring-cloud/spring-cloud-security/auth-client/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>auth-client</artifactId> <name>auth-client</name> @@ -8,8 +8,8 @@ <description>Spring Cloud Security APP Client Module</description> <parent> - <artifactId>spring-cloud-security</artifactId> <groupId>com.baeldung</groupId> + <artifactId>spring-cloud-security</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> diff --git a/spring-cloud/spring-cloud-security/auth-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-security/auth-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 60a208d6f4..0000000000 --- a/spring-cloud/spring-cloud-security/auth-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.CloudSite; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = CloudSite.class) -public class SpringContextIntegrationTest { - - @Test - public void contextLoads() { - } - -} diff --git a/spring-cloud/spring-cloud-security/auth-resource/pom.xml b/spring-cloud/spring-cloud-security/auth-resource/pom.xml index a60eca740c..0a642250e7 100644 --- a/spring-cloud/spring-cloud-security/auth-resource/pom.xml +++ b/spring-cloud/spring-cloud-security/auth-resource/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>auth-resource</artifactId> <name>auth-resource</name> @@ -8,11 +8,23 @@ <description>Spring Cloud Security APP Resource Module</description> <parent> - <artifactId>spring-cloud-security</artifactId> <groupId>com.baeldung</groupId> + <artifactId>spring-cloud-security</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-dependencies</artifactId> + <version>${spring-cloud.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>org.springframework.boot</groupId> @@ -34,18 +46,6 @@ </dependency> </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-dependencies</artifactId> - <version>${spring-cloud.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <build> <plugins> <plugin> diff --git a/spring-cloud/spring-cloud-security/auth-resource/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-security/auth-resource/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 4d4c312bce..0000000000 --- a/spring-cloud/spring-cloud-security/auth-resource/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.Application; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -public class SpringContextIntegrationTest { - - @Test - public void contextLoads() { - } - -} diff --git a/spring-cloud/spring-cloud-security/auth-server/pom.xml b/spring-cloud/spring-cloud-security/auth-server/pom.xml index afd8dbef44..f6d0861552 100644 --- a/spring-cloud/spring-cloud-security/auth-server/pom.xml +++ b/spring-cloud/spring-cloud-security/auth-server/pom.xml @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>auth-server</artifactId> - <name>auth-server</name> + <name>auth-server</name> <description>Spring Cloud Security APP Server Module</description> - + <parent> - <artifactId>spring-cloud-security</artifactId> <groupId>com.baeldung</groupId> + <artifactId>spring-cloud-security</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> @@ -36,7 +36,7 @@ <version>${spring-cloud-starter-oauth2.version}</version> </dependency> </dependencies> - + <properties> <spring-cloud-starter-oauth2.version>2.1.2.RELEASE</spring-cloud-starter-oauth2.version> </properties> diff --git a/spring-cloud/spring-cloud-security/auth-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-security/auth-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 63a89ac45c..0000000000 --- a/spring-cloud/spring-cloud-security/auth-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.AuthServer; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = AuthServer.class) -public class SpringContextIntegrationTest { - - @Test - public void contextLoads() { - } - -} diff --git a/spring-cloud/spring-cloud-security/pom.xml b/spring-cloud/spring-cloud-security/pom.xml index d65fd6520b..498c88ac48 100644 --- a/spring-cloud/spring-cloud-security/pom.xml +++ b/spring-cloud/spring-cloud-security/pom.xml @@ -1,23 +1,23 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-cloud-security</artifactId> <version>1.0.0-SNAPSHOT</version> <name>spring-cloud-security</name> <packaging>pom</packaging> - <parent> - <artifactId>parent-boot-2</artifactId> + <parent> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-2</relativePath> </parent> - + <modules> <module>auth-client</module> - <module>auth-resource</module> - <module>auth-server</module> + <module>auth-resource</module> + <module>auth-server</module> </modules> </project> diff --git a/spring-cloud/spring-cloud-stream-starters/twitterhdfs/pom.xml b/spring-cloud/spring-cloud-stream-starters/twitterhdfs/pom.xml index 8846773338..1cfbf7e7c8 100644 --- a/spring-cloud/spring-cloud-stream-starters/twitterhdfs/pom.xml +++ b/spring-cloud/spring-cloud-stream-starters/twitterhdfs/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.twitterhdfs</groupId> <artifactId>twitterhdfs</artifactId> @@ -9,8 +9,8 @@ <packaging>jar</packaging> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../../parent-boot-1</relativePath> </parent> diff --git a/spring-cloud/spring-cloud-stream-starters/twitterhdfs/src/test/java/com/baeldung/twitterhdfs/aggregate/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-stream-starters/twitterhdfs/src/test/java/com/baeldung/twitterhdfs/aggregate/SpringContextIntegrationTest.java deleted file mode 100644 index b5cef1b5ed..0000000000 --- a/spring-cloud/spring-cloud-stream-starters/twitterhdfs/src/test/java/com/baeldung/twitterhdfs/aggregate/SpringContextIntegrationTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.twitterhdfs.aggregate; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = AggregateApp.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-cloud/spring-cloud-stream/pom.xml b/spring-cloud/spring-cloud-stream/pom.xml index 76a51cc3ca..df17b778da 100644 --- a/spring-cloud/spring-cloud-stream/pom.xml +++ b/spring-cloud/spring-cloud-stream/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.baeldung</groupId> <artifactId>spring-cloud-stream</artifactId> diff --git a/spring-cloud/spring-cloud-stream/spring-cloud-stream-kafka/pom.xml b/spring-cloud/spring-cloud-stream/spring-cloud-stream-kafka/pom.xml index 2ba9d55358..3a4cf6c56e 100644 --- a/spring-cloud/spring-cloud-stream/spring-cloud-stream-kafka/pom.xml +++ b/spring-cloud/spring-cloud-stream/spring-cloud-stream-kafka/pom.xml @@ -1,11 +1,11 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-cloud-stream-kafka</artifactId> <name>spring-cloud-stream-kafka</name> - <description>Simple Spring Cloud Stream</description> <packaging>jar</packaging> + <description>Simple Spring Cloud Stream</description> <parent> <groupId>org.springframework.boot</groupId> @@ -13,6 +13,18 @@ <version>2.1.5.RELEASE</version> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-dependencies</artifactId> + <version>${spring-cloud.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> @@ -51,18 +63,6 @@ </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-dependencies</artifactId> - <version>${spring-cloud.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <build> <plugins> <plugin> diff --git a/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/pom.xml b/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/pom.xml index 1649cfc0b5..4273bd8701 100644 --- a/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/pom.xml +++ b/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/pom.xml @@ -4,8 +4,8 @@ <modelVersion>4.0.0</modelVersion> <artifactId>spring-cloud-stream-rabbit</artifactId> <name>spring-cloud-stream-rabbit</name> - <description>Simple Spring Cloud Stream</description> <packaging>jar</packaging> + <description>Simple Spring Cloud Stream</description> <parent> <groupId>org.baeldung</groupId> diff --git a/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 70c5f46aa1..0000000000 --- a/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.spring.cloud.stream.rabbit.MultipleOutputsServiceApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = MultipleOutputsServiceApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-cloud/spring-cloud-task/pom.xml b/spring-cloud/spring-cloud-task/pom.xml index 7c2c0d17f2..377d16a999 100644 --- a/spring-cloud/spring-cloud-task/pom.xml +++ b/spring-cloud/spring-cloud-task/pom.xml @@ -1,16 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.spring.cloud</groupId> <artifactId>spring-cloud-task</artifactId> <version>1.0.0-SNAPSHOT</version> - <name>spring-cloud-task</name> + <name>spring-cloud-task</name> <packaging>pom</packaging> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-1</relativePath> </parent> @@ -22,7 +22,7 @@ <dependencyManagement> <dependencies> - <dependency> + <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-task-dependencies</artifactId> <version>${spring-cloud-task.version}</version> diff --git a/spring-cloud/spring-cloud-task/springcloudtaskbatch/pom.xml b/spring-cloud/spring-cloud-task/springcloudtaskbatch/pom.xml index b6b5a1cf0f..be920bb93d 100644 --- a/spring-cloud/spring-cloud-task/springcloudtaskbatch/pom.xml +++ b/spring-cloud/spring-cloud-task/springcloudtaskbatch/pom.xml @@ -1,14 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.baeldung.cloud</groupId> <artifactId>springcloudtaskbatch</artifactId> <name>springcloudtaskbatch</name> <parent> - <artifactId>spring-cloud-task</artifactId> <groupId>com.baeldung.spring.cloud</groupId> + <artifactId>spring-cloud-task</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> diff --git a/spring-cloud/spring-cloud-task/springcloudtaskbatch/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-task/springcloudtaskbatch/src/test/java/org/baeldung/SpringContextTest.java similarity index 94% rename from spring-cloud/spring-cloud-task/springcloudtaskbatch/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to spring-cloud/spring-cloud-task/springcloudtaskbatch/src/test/java/org/baeldung/SpringContextTest.java index 0caa626c14..3dd350b571 100644 --- a/spring-cloud/spring-cloud-task/springcloudtaskbatch/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/spring-cloud/spring-cloud-task/springcloudtaskbatch/src/test/java/org/baeldung/SpringContextTest.java @@ -13,7 +13,7 @@ import com.baeldung.task.TaskDemo; @RunWith(SpringJUnit4ClassRunner.class) @SpringBootApplication @ContextConfiguration(classes = { JobConfiguration.class, TaskDemo.class }, initializers = { ConfigFileApplicationContextInitializer.class }) -public class SpringContextIntegrationTest { +public class SpringContextTest { @Test public void whenSpringContextIsBootstrapped_thenNoExceptions() { diff --git a/spring-cloud/spring-cloud-task/springcloudtasksink/pom.xml b/spring-cloud/spring-cloud-task/springcloudtasksink/pom.xml index 03bfe7b1cb..441924f1d3 100644 --- a/spring-cloud/spring-cloud-task/springcloudtasksink/pom.xml +++ b/spring-cloud/spring-cloud-task/springcloudtasksink/pom.xml @@ -1,15 +1,15 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>SpringCloudTaskSink</artifactId> <name>SpringCloudTaskSink</name> <packaging>jar</packaging> <description>Demo project for Spring Boot</description> - <parent> - <artifactId>spring-cloud-task</artifactId> + <parent> <groupId>com.baeldung.spring.cloud</groupId> + <artifactId>spring-cloud-task</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> diff --git a/spring-cloud/spring-cloud-task/springcloudtasksink/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-task/springcloudtasksink/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index b8dd03d65f..0000000000 --- a/spring-cloud/spring-cloud-task/springcloudtasksink/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.SpringCloudTaskFinal.SpringCloudTaskSinkApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringCloudTaskSinkApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-cloud/spring-cloud-vault/pom.xml b/spring-cloud/spring-cloud-vault/pom.xml index faf27b6ac8..cbb32ac937 100644 --- a/spring-cloud/spring-cloud-vault/pom.xml +++ b/spring-cloud/spring-cloud-vault/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.baeldung.spring.cloud</groupId> <artifactId>spring-cloud-vault</artifactId> @@ -15,6 +15,18 @@ <relativePath>../../parent-boot-2</relativePath> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-dependencies</artifactId> + <version>${spring-cloud.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> @@ -43,31 +55,19 @@ <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-devtools</artifactId> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-devtools</artifactId> </dependency> <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-data-jpa</artifactId> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-dependencies</artifactId> - <version>${spring-cloud.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <build> <plugins> <plugin> diff --git a/spring-cloud/spring-cloud-zookeeper/Greeting/pom.xml b/spring-cloud/spring-cloud-zookeeper/Greeting/pom.xml index 2da47cf40d..b0ee448e87 100644 --- a/spring-cloud/spring-cloud-zookeeper/Greeting/pom.xml +++ b/spring-cloud/spring-cloud-zookeeper/Greeting/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>Greeting</artifactId> <name>Greeting</name> @@ -12,6 +12,18 @@ <version>1.0.0-SNAPSHOT</version> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-dependencies</artifactId> <!--changed --> + <version>${spring-cloud-dependencies.version}</version> <!--changed --> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>org.springframework.boot</groupId> @@ -52,18 +64,6 @@ </dependency> </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-dependencies</artifactId> <!--changed --> - <version>${spring-cloud-dependencies.version}</version> <!--changed --> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <properties> <spring-cloud-starter-feign.version>1.2.5.RELEASE</spring-cloud-starter-feign.version> <hamcrest.version>1.3</hamcrest.version> diff --git a/spring-cloud/spring-cloud-zookeeper/Greeting/src/test/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-zookeeper/Greeting/src/test/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 0f544b3ed1..0000000000 --- a/spring-cloud/spring-cloud-zookeeper/Greeting/src/test/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.spring.cloud.ribbon.client.ServerLocationApp; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = GreetingApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-cloud/spring-cloud-zookeeper/HelloWorld/pom.xml b/spring-cloud/spring-cloud-zookeeper/HelloWorld/pom.xml index 0da0f7503e..3a263e4ded 100644 --- a/spring-cloud/spring-cloud-zookeeper/HelloWorld/pom.xml +++ b/spring-cloud/spring-cloud-zookeeper/HelloWorld/pom.xml @@ -1,17 +1,29 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>HelloWorld</artifactId> - <packaging>jar</packaging> <name>HelloWorld</name> - + <packaging>jar</packaging> + <parent> <groupId>com.baeldung.spring.cloud</groupId> <artifactId>spring-cloud-zookeeper</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-dependencies</artifactId> <!--changed --> + <version>${spring-cloud-dependencies.version}</version> <!--changed --> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>org.springframework.boot</groupId> @@ -42,18 +54,6 @@ </dependency> </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-dependencies</artifactId> <!--changed --> - <version>${spring-cloud-dependencies.version}</version> <!--changed --> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <build> <plugins> <plugin> diff --git a/spring-cloud/spring-cloud-zookeeper/HelloWorld/src/test/java/com/baeldung/spring/cloud/helloworld/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-zookeeper/HelloWorld/src/test/java/com/baeldung/spring/cloud/helloworld/SpringContextIntegrationTest.java deleted file mode 100644 index 2770649aa3..0000000000 --- a/spring-cloud/spring-cloud-zookeeper/HelloWorld/src/test/java/com/baeldung/spring/cloud/helloworld/SpringContextIntegrationTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.spring.cloud.helloworld; - - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = HelloWorldApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} \ No newline at end of file diff --git a/spring-cloud/spring-cloud-zookeeper/pom.xml b/spring-cloud/spring-cloud-zookeeper/pom.xml index 4ea9b22e9d..64d30b19a6 100644 --- a/spring-cloud/spring-cloud-zookeeper/pom.xml +++ b/spring-cloud/spring-cloud-zookeeper/pom.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-cloud-zookeeper</artifactId> - <name>spring-cloud-zookeeper</name> + <name>spring-cloud-zookeeper</name> <packaging>pom</packaging> - + <parent> <groupId>com.baeldung.spring.cloud</groupId> <artifactId>spring-cloud</artifactId> @@ -22,5 +22,5 @@ <springframework.version>4.3.7.RELEASE</springframework.version> <spring-cloud-starter-zookeeper-discovery.version>1.0.3.RELEASE</spring-cloud-starter-zookeeper-discovery.version> </properties> - + </project> \ No newline at end of file diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/bin/eureka-client/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/bin/eureka-client/pom.xml index 9c075ebfe3..118a9e2c11 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/bin/eureka-client/pom.xml +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/bin/eureka-client/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>eureka-client</artifactId> <version>1.0.0-SNAPSHOT</version> @@ -14,6 +14,18 @@ <version>1.0.0-SNAPSHOT</version> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-parent</artifactId> + <version>${spring-cloud-dependencies.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> @@ -27,16 +39,4 @@ </dependency> </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-parent</artifactId> - <version>${spring-cloud-dependencies.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - </project> diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/bin/eureka-server/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/bin/eureka-server/pom.xml index 97933210de..08854b02fd 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/bin/eureka-server/pom.xml +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/bin/eureka-server/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>eureka-server</artifactId> <version>1.0.0-SNAPSHOT</version> @@ -14,6 +14,18 @@ <version>1.0.0-SNAPSHOT</version> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-parent</artifactId> + <version>${spring-cloud-dependencies.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> @@ -27,16 +39,4 @@ </dependency> </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-parent</artifactId> - <version>${spring-cloud-dependencies.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - </project> diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/bin/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/bin/pom.xml index fbae051277..c7b35ef934 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/bin/pom.xml +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/bin/pom.xml @@ -1,13 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung.spring.cloud</groupId> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> <artifactId>spring-cloud-zuul-eureka-integration</artifactId> <version>1.0.0-SNAPSHOT</version> <name>Spring Cloud Zuul and Eureka Integration</name> - <description>Spring Cloud Zuul and Eureka Integration</description> <packaging>pom</packaging> + <description>Spring Cloud Zuul and Eureka Integration</description> <parent> <groupId>com.baeldung.spring.cloud</groupId> @@ -28,4 +27,5 @@ <spring-boot-maven-plugin.version>1.4.2.RELEASE</spring-boot-maven-plugin.version> <commons-config.version>1.10</commons-config.version> </properties> + </project> diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/bin/zuul-server/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/bin/zuul-server/pom.xml index 1c2cb85da5..2a899760dd 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/bin/zuul-server/pom.xml +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/bin/zuul-server/pom.xml @@ -1,14 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>zuul-server</artifactId> - + <parent> <groupId>com.baeldung.spring.cloud</groupId> <artifactId>spring-cloud-zuul-eureka-integration</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> - + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-parent</artifactId> + <version>${spring-cloud-dependencies.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>org.springframework.boot</groupId> @@ -32,16 +45,5 @@ <artifactId>spring-boot-starter-security</artifactId> </dependency> </dependencies> - - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-parent</artifactId> - <version>${spring-cloud-dependencies.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> + </project> \ No newline at end of file diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml index af7df71d17..9cf96df60e 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>eureka-client</artifactId> <version>1.0.0-SNAPSHOT</version> @@ -14,26 +14,6 @@ <version>1.0.0-SNAPSHOT</version> </parent> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> - <version>${spring-cloud-starter-eureka.version}</version> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - <version>${spring-boot-starter-web.version}</version> - </dependency> - - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <version>${spring-boot-starter-web.version}</version> - <scope>test</scope> - </dependency> - </dependencies> - <dependencyManagement> <dependencies> <dependency> @@ -46,4 +26,24 @@ </dependencies> </dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> + <version>${spring-cloud-starter-eureka.version}</version> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + <version>${spring-boot-starter-web.version}</version> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <version>${spring-boot-starter-web.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + </project> diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/src/test/java/com/baeldung/spring/cloud/eureka/client/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/src/test/java/com/baeldung/spring/cloud/eureka/client/SpringContextIntegrationTest.java deleted file mode 100644 index 9eaff8f510..0000000000 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/src/test/java/com/baeldung/spring/cloud/eureka/client/SpringContextIntegrationTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.spring.cloud.eureka.client; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } - -} diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml index d1f618507f..cd25f5f294 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>eureka-server</artifactId> <version>1.0.0-SNAPSHOT</version> @@ -14,26 +14,6 @@ <version>1.0.0-SNAPSHOT</version> </parent> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> - <version>${spring-cloud-starter-eureka.version}</version> - </dependency> - <dependency> - <groupId>commons-configuration</groupId> - <artifactId>commons-configuration</artifactId> - <version>${commons-config.version}</version> - </dependency> - - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <version>${spring-boot-starter-web.version}</version> - <scope>test</scope> - </dependency> - </dependencies> - <dependencyManagement> <dependencies> <dependency> @@ -46,4 +26,24 @@ </dependencies> </dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> + <version>${spring-cloud-starter-eureka.version}</version> + </dependency> + <dependency> + <groupId>commons-configuration</groupId> + <artifactId>commons-configuration</artifactId> + <version>${commons-config.version}</version> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <version>${spring-boot-starter-web.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + </project> diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/src/test/java/com/baeldung/spring/cloud/eureka/server/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/src/test/java/com/baeldung/spring/cloud/eureka/server/SpringContextIntegrationTest.java deleted file mode 100644 index f03913b474..0000000000 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/src/test/java/com/baeldung/spring/cloud/eureka/server/SpringContextIntegrationTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.spring.cloud.eureka.server; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } - -} diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/pom.xml index 7fe0cf6ac3..996110f875 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/pom.xml +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/pom.xml @@ -3,7 +3,6 @@ xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung.spring.cloud</groupId> <artifactId>spring-cloud-zuul-eureka-integration</artifactId> <version>1.0.0-SNAPSHOT</version> <name>spring-cloud-zuul-eureka-integration</name> diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/pom.xml index 57a11f3385..3d238d5d5f 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/pom.xml +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/pom.xml @@ -1,15 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>zuul-server</artifactId> - <name>zuul-server</name> - + <name>zuul-server</name> + <parent> <groupId>com.baeldung.spring.cloud</groupId> <artifactId>spring-cloud-zuul-eureka-integration</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> - + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-parent</artifactId> + <version>${spring-cloud-dependencies.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>org.springframework.boot</groupId> @@ -33,7 +46,7 @@ <artifactId>rxjava</artifactId> <version>${rxjava.version}</version> </dependency> - + <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> @@ -41,17 +54,5 @@ <scope>test</scope> </dependency> </dependencies> - - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-parent</artifactId> - <version>${spring-cloud-dependencies.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - + </project> \ No newline at end of file diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/src/test/java/com/baeldung/spring/cloud/zuul/config/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/src/test/java/com/baeldung/spring/cloud/zuul/config/SpringContextIntegrationTest.java deleted file mode 100644 index cfd362edf8..0000000000 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/src/test/java/com/baeldung/spring/cloud/zuul/config/SpringContextIntegrationTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.spring.cloud.zuul.config; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } - -} diff --git a/spring-cloud/spring-cloud-zuul-fallback/api-gateway/pom.xml b/spring-cloud/spring-cloud-zuul-fallback/api-gateway/pom.xml index ee0f607d8a..136461ccb9 100644 --- a/spring-cloud/spring-cloud-zuul-fallback/api-gateway/pom.xml +++ b/spring-cloud/spring-cloud-zuul-fallback/api-gateway/pom.xml @@ -1,11 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>api-gateway</artifactId> <name>api-gateway</name> - <description>API Gateway using Zuul</description> <packaging>jar</packaging> + <description>API Gateway using Zuul</description> <parent> <groupId>com.baeldung.spring.cloud</groupId> @@ -13,6 +14,18 @@ <version>1.0.0-SNAPSHOT</version> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-parent</artifactId> + <version>${spring-cloud-dependencies.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>org.springframework.boot</groupId> @@ -29,15 +42,4 @@ </dependency> </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-parent</artifactId> - <version>${spring-cloud-dependencies.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> </project> diff --git a/spring-cloud/spring-cloud-zuul-fallback/pom.xml b/spring-cloud/spring-cloud-zuul-fallback/pom.xml index 5bdd1d49ca..cb762eb099 100644 --- a/spring-cloud/spring-cloud-zuul-fallback/pom.xml +++ b/spring-cloud/spring-cloud-zuul-fallback/pom.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-cloud-zuul-fallback</artifactId> - <packaging>pom</packaging> <name>spring-cloud-zuul-fallback</name> + <packaging>pom</packaging> <description>Spring Cloud Zuul Fallback</description> <parent> @@ -25,4 +25,5 @@ <spring-cloud-dependencies.version>Finchley.SR2</spring-cloud-dependencies.version> <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version> </properties> + </project> diff --git a/spring-cloud/spring-cloud-zuul-fallback/weather-service/pom.xml b/spring-cloud/spring-cloud-zuul-fallback/weather-service/pom.xml index 611f1dcd4f..bafd4ffcd1 100644 --- a/spring-cloud/spring-cloud-zuul-fallback/weather-service/pom.xml +++ b/spring-cloud/spring-cloud-zuul-fallback/weather-service/pom.xml @@ -1,6 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>weather-service</artifactId> <name>Weather Service</name> @@ -12,6 +13,18 @@ <version>1.0.0-SNAPSHOT</version> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-parent</artifactId> + <version>${spring-cloud-dependencies.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>org.springframework.boot</groupId> @@ -25,15 +38,4 @@ </dependency> </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-parent</artifactId> - <version>${spring-cloud-dependencies.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> </project> diff --git a/spring-cloud/spring-cloud-zuul/README.md b/spring-cloud/spring-cloud-zuul/README.md index 834917f159..b8e1773930 100644 --- a/spring-cloud/spring-cloud-zuul/README.md +++ b/spring-cloud/spring-cloud-zuul/README.md @@ -1,2 +1,7 @@ +## Spring Cloud Zuul + +This module contains articles about Spring with Netflix Zuul + ### Relevant Articles: - [Rate Limiting in Spring Cloud Netflix Zuul](https://www.baeldung.com/spring-cloud-zuul-rate-limit) +- [Spring REST with a Zuul Proxy](https://www.baeldung.com/spring-rest-with-zuul-proxy) diff --git a/spring-cloud/spring-cloud-zuul/pom.xml b/spring-cloud/spring-cloud-zuul/pom.xml index 5d44ae9590..b1f2e886de 100644 --- a/spring-cloud/spring-cloud-zuul/pom.xml +++ b/spring-cloud/spring-cloud-zuul/pom.xml @@ -1,77 +1,80 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung.spring.cloud</groupId> - <artifactId>spring-cloud-zuul</artifactId> - <version>0.0.1-SNAPSHOT</version> - <name>spring-cloud-zuul</name> - <packaging>jar</packaging> - <description>Demo project for Spring Boot</description> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>com.baeldung.spring.cloud</groupId> + <artifactId>spring-cloud-zuul</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>spring-cloud-zuul</name> + <packaging>pom</packaging> - <parent> - <artifactId>parent-boot-2</artifactId> + <parent> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-2</relativePath> </parent> - <dependencies> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-netflix-zuul</artifactId> - </dependency> - <dependency> - <groupId>com.marcosbarbero.cloud</groupId> - <artifactId>spring-cloud-zuul-ratelimit</artifactId> - <version>2.2.0.RELEASE</version> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-data-jpa</artifactId> - </dependency> - <dependency> - <groupId>com.h2database</groupId> - <artifactId>h2</artifactId> - </dependency> + <modules> + <module>spring-zuul-foos-resource</module> + <module>spring-zuul-ui</module> + <module>spring-zuul-rate-limiting</module> + </modules> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> - </dependencies> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-dependencies</artifactId> + <version>${spring-cloud.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-dependencies</artifactId> - <version>${spring-cloud.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-netflix-zuul</artifactId> + </dependency> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <version>${maven-war-plugin.version}</version> + <configuration> + <failOnMissingWebXml>false</failOnMissingWebXml> + </configuration> + </plugin> + </plugins> + </build> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <spring-cloud.version>Hoxton.RELEASE</spring-cloud.version> + <spring-boot.version>2.2.2.RELEASE</spring-boot.version> + </properties> - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - <spring-cloud.version>Finchley.SR1</spring-cloud.version> - <spring-boot.version>2.0.6.RELEASE</spring-boot.version> - </properties> - </project> diff --git a/spring-zuul/spring-zuul-foos-resource/pom.xml b/spring-cloud/spring-cloud-zuul/spring-zuul-foos-resource/pom.xml similarity index 67% rename from spring-zuul/spring-zuul-foos-resource/pom.xml rename to spring-cloud/spring-cloud-zuul/spring-zuul-foos-resource/pom.xml index 4fe4e1dbbc..f5a8c3b613 100644 --- a/spring-zuul/spring-zuul-foos-resource/pom.xml +++ b/spring-cloud/spring-cloud-zuul/spring-zuul-foos-resource/pom.xml @@ -1,21 +1,17 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-zuul-foos-resource</artifactId> <name>spring-zuul-foos-resource</name> <packaging>war</packaging> <parent> - <groupId>com.baeldung</groupId> - <artifactId>spring-zuul</artifactId> - <version>1.0.0-SNAPSHOT</version> + <groupId>com.baeldung.spring.cloud</groupId> + <artifactId>spring-cloud-zuul</artifactId> + <version>0.0.1-SNAPSHOT</version> </parent> <dependencies> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> diff --git a/spring-zuul/spring-zuul-foos-resource/src/main/java/org/baeldung/config/ResourceServerApplication.java b/spring-cloud/spring-cloud-zuul/spring-zuul-foos-resource/src/main/java/com/baeldung/config/ResourceServerApplication.java similarity index 93% rename from spring-zuul/spring-zuul-foos-resource/src/main/java/org/baeldung/config/ResourceServerApplication.java rename to spring-cloud/spring-cloud-zuul/spring-zuul-foos-resource/src/main/java/com/baeldung/config/ResourceServerApplication.java index 77eabe771b..b1db6db87a 100644 --- a/spring-zuul/spring-zuul-foos-resource/src/main/java/org/baeldung/config/ResourceServerApplication.java +++ b/spring-cloud/spring-cloud-zuul/spring-zuul-foos-resource/src/main/java/com/baeldung/config/ResourceServerApplication.java @@ -1,4 +1,4 @@ -package org.baeldung.config; +package com.baeldung.config; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/spring-zuul/spring-zuul-foos-resource/src/main/java/org/baeldung/config/ResourceServerWebConfig.java b/spring-cloud/spring-cloud-zuul/spring-zuul-foos-resource/src/main/java/com/baeldung/config/ResourceServerWebConfig.java similarity index 82% rename from spring-zuul/spring-zuul-foos-resource/src/main/java/org/baeldung/config/ResourceServerWebConfig.java rename to spring-cloud/spring-cloud-zuul/spring-zuul-foos-resource/src/main/java/com/baeldung/config/ResourceServerWebConfig.java index 1a45d20edb..b3af890d32 100644 --- a/spring-zuul/spring-zuul-foos-resource/src/main/java/org/baeldung/config/ResourceServerWebConfig.java +++ b/spring-cloud/spring-cloud-zuul/spring-zuul-foos-resource/src/main/java/com/baeldung/config/ResourceServerWebConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.config; +package com.baeldung.config; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -7,7 +7,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration @EnableWebMvc -@ComponentScan({ "org.baeldung.web.controller" }) +@ComponentScan({ "com.baeldung.web.controller" }) public class ResourceServerWebConfig implements WebMvcConfigurer { } diff --git a/spring-zuul/spring-zuul-foos-resource/src/main/java/org/baeldung/web/controller/FooController.java b/spring-cloud/spring-cloud-zuul/spring-zuul-foos-resource/src/main/java/com/baeldung/web/controller/FooController.java similarity index 51% rename from spring-zuul/spring-zuul-foos-resource/src/main/java/org/baeldung/web/controller/FooController.java rename to spring-cloud/spring-cloud-zuul/spring-zuul-foos-resource/src/main/java/com/baeldung/web/controller/FooController.java index 486f858ab5..f8f07342f6 100644 --- a/spring-zuul/spring-zuul-foos-resource/src/main/java/org/baeldung/web/controller/FooController.java +++ b/spring-cloud/spring-cloud-zuul/spring-zuul-foos-resource/src/main/java/com/baeldung/web/controller/FooController.java @@ -1,34 +1,25 @@ -package org.baeldung.web.controller; +package com.baeldung.web.controller; -import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; -import static org.apache.commons.lang3.RandomStringUtils.randomNumeric; +import com.baeldung.web.dto.Foo; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.baeldung.web.dto.Foo; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; +import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; +import static org.apache.commons.lang3.RandomStringUtils.randomNumeric; -@Controller +@RestController public class FooController { - public FooController() { - super(); - } - - // API - read - @RequestMapping(method = RequestMethod.GET, value = "/foos/{id}") - @ResponseBody + @GetMapping("/foos/{id}") public Foo findById(@PathVariable final long id, HttpServletRequest req, HttpServletResponse res) { - // System.out.println(req.getHeaderNames()); - // System.out.println("------" + req.getHeader("Test")); if (req.getHeader("Test") != null) { res.addHeader("Test", req.getHeader("Test")); } + return new Foo(Long.parseLong(randomNumeric(2)), randomAlphabetic(4)); } diff --git a/spring-zuul/spring-zuul-foos-resource/src/main/java/org/baeldung/web/dto/Foo.java b/spring-cloud/spring-cloud-zuul/spring-zuul-foos-resource/src/main/java/com/baeldung/web/dto/Foo.java similarity index 81% rename from spring-zuul/spring-zuul-foos-resource/src/main/java/org/baeldung/web/dto/Foo.java rename to spring-cloud/spring-cloud-zuul/spring-zuul-foos-resource/src/main/java/com/baeldung/web/dto/Foo.java index 9d26618e7f..b25aef266d 100644 --- a/spring-zuul/spring-zuul-foos-resource/src/main/java/org/baeldung/web/dto/Foo.java +++ b/spring-cloud/spring-cloud-zuul/spring-zuul-foos-resource/src/main/java/com/baeldung/web/dto/Foo.java @@ -1,22 +1,15 @@ -package org.baeldung.web.dto; +package com.baeldung.web.dto; public class Foo { + private long id; private String name; - public Foo() { - super(); - } - public Foo(final long id, final String name) { - super(); - this.id = id; this.name = name; } - // - public long getId() { return id; } diff --git a/spring-zuul/spring-zuul-foos-resource/src/main/resources/application.properties b/spring-cloud/spring-cloud-zuul/spring-zuul-foos-resource/src/main/resources/application.properties similarity index 100% rename from spring-zuul/spring-zuul-foos-resource/src/main/resources/application.properties rename to spring-cloud/spring-cloud-zuul/spring-zuul-foos-resource/src/main/resources/application.properties diff --git a/spring-security-angular/server/src/main/resources/logback.xml b/spring-cloud/spring-cloud-zuul/spring-zuul-foos-resource/src/main/resources/logback.xml similarity index 100% rename from spring-security-angular/server/src/main/resources/logback.xml rename to spring-cloud/spring-cloud-zuul/spring-zuul-foos-resource/src/main/resources/logback.xml diff --git a/spring-zuul/spring-zuul-foos-resource/src/test/java/org/baeldung/SpringContextTest.java b/spring-cloud/spring-cloud-zuul/spring-zuul-foos-resource/src/test/java/com/baeldung/SpringContextTest.java similarity index 83% rename from spring-zuul/spring-zuul-foos-resource/src/test/java/org/baeldung/SpringContextTest.java rename to spring-cloud/spring-cloud-zuul/spring-zuul-foos-resource/src/test/java/com/baeldung/SpringContextTest.java index 2a57d7aa07..5503a5a738 100644 --- a/spring-zuul/spring-zuul-foos-resource/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-cloud/spring-cloud-zuul/spring-zuul-foos-resource/src/test/java/com/baeldung/SpringContextTest.java @@ -1,6 +1,6 @@ -package org.baeldung; +package com.baeldung; -import org.baeldung.config.ResourceServerApplication; +import com.baeldung.config.ResourceServerApplication; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; diff --git a/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/pom.xml b/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/pom.xml new file mode 100644 index 0000000000..34f0e6b7ae --- /dev/null +++ b/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/pom.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>spring-zuul-rate-limiting</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>spring-zuul-rate-limiting</name> + <packaging>jar</packaging> + + <parent> + <groupId>com.baeldung.spring.cloud</groupId> + <artifactId>spring-cloud-zuul</artifactId> + <version>0.0.1-SNAPSHOT</version> + </parent> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-dependencies</artifactId> + <version>${spring-cloud.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <dependency> + <groupId>com.marcosbarbero.cloud</groupId> + <artifactId>spring-cloud-zuul-ratelimit</artifactId> + <version>${rate.limit.version}</version> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-jpa</artifactId> + </dependency> + </dependencies> + + <build> + <finalName>spring-zuul-rate-limiting</finalName> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + </plugins> + </build> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <spring-cloud.version>Finchley.SR1</spring-cloud.version> + <spring-boot.version>2.0.6.RELEASE</spring-boot.version> + <rate.limit.version>2.2.0.RELEASE</rate.limit.version> + </properties> + +</project> diff --git a/spring-cloud/spring-cloud-zuul/src/main/java/com/baeldung/spring/cloud/zuulratelimitdemo/ZuulRatelimitDemoApplication.java b/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/main/java/com/baeldung/spring/cloud/zuulratelimitdemo/ZuulRatelimitDemoApplication.java similarity index 100% rename from spring-cloud/spring-cloud-zuul/src/main/java/com/baeldung/spring/cloud/zuulratelimitdemo/ZuulRatelimitDemoApplication.java rename to spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/main/java/com/baeldung/spring/cloud/zuulratelimitdemo/ZuulRatelimitDemoApplication.java diff --git a/spring-cloud/spring-cloud-zuul/src/main/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/GreetingController.java b/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/main/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/GreetingController.java similarity index 100% rename from spring-cloud/spring-cloud-zuul/src/main/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/GreetingController.java rename to spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/main/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/GreetingController.java diff --git a/spring-cloud/spring-cloud-zuul/src/main/resources/application.yml b/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/main/resources/application.yml similarity index 100% rename from spring-cloud/spring-cloud-zuul/src/main/resources/application.yml rename to spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/main/resources/application.yml diff --git a/spring-cloud/spring-cloud-zuul/src/test/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/GreetingControllerUnitTest.java b/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/test/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/GreetingControllerUnitTest.java similarity index 100% rename from spring-cloud/spring-cloud-zuul/src/test/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/GreetingControllerUnitTest.java rename to spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/test/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/GreetingControllerUnitTest.java diff --git a/spring-cloud/spring-cloud-zuul/src/test/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/SpringContextTest.java b/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/test/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/SpringContextTest.java similarity index 100% rename from spring-cloud/spring-cloud-zuul/src/test/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/SpringContextTest.java rename to spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/test/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/SpringContextTest.java diff --git a/spring-zuul/spring-zuul-ui/pom.xml b/spring-cloud/spring-cloud-zuul/spring-zuul-ui/pom.xml similarity index 64% rename from spring-zuul/spring-zuul-ui/pom.xml rename to spring-cloud/spring-cloud-zuul/spring-zuul-ui/pom.xml index 619e6c6b78..09c94663b1 100644 --- a/spring-zuul/spring-zuul-ui/pom.xml +++ b/spring-cloud/spring-cloud-zuul/spring-zuul-ui/pom.xml @@ -1,27 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-zuul-ui</artifactId> <name>spring-zuul-ui</name> <packaging>war</packaging> <parent> - <groupId>com.baeldung</groupId> - <artifactId>spring-zuul</artifactId> - <version>1.0.0-SNAPSHOT</version> + <groupId>com.baeldung.spring.cloud</groupId> + <artifactId>spring-cloud-zuul</artifactId> + <version>0.0.1-SNAPSHOT</version> </parent> <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-netflix-zuul</artifactId> - <version>${spring-cloud.version}</version> - </dependency> - <!-- <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-netflix-core</artifactId> <version>1.0.4.RELEASE</version> </dependency> --> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> @@ -57,4 +48,5 @@ </resource> </resources> </build> + </project> \ No newline at end of file diff --git a/spring-zuul/spring-zuul-ui/src/main/java/org/baeldung/config/CustomZuulFilter.java b/spring-cloud/spring-cloud-zuul/spring-zuul-ui/src/main/java/com/baeldung/config/CustomZuulFilter.java similarity index 95% rename from spring-zuul/spring-zuul-ui/src/main/java/org/baeldung/config/CustomZuulFilter.java rename to spring-cloud/spring-cloud-zuul/spring-zuul-ui/src/main/java/com/baeldung/config/CustomZuulFilter.java index 826ac64e9f..3d22cfa6e3 100644 --- a/spring-zuul/spring-zuul-ui/src/main/java/org/baeldung/config/CustomZuulFilter.java +++ b/spring-cloud/spring-cloud-zuul/spring-zuul-ui/src/main/java/com/baeldung/config/CustomZuulFilter.java @@ -1,4 +1,4 @@ -package org.baeldung.config; +package com.baeldung.config; import org.springframework.stereotype.Component; diff --git a/spring-zuul/spring-zuul-ui/src/main/java/org/baeldung/config/UiApplication.java b/spring-cloud/spring-cloud-zuul/spring-zuul-ui/src/main/java/com/baeldung/config/UiApplication.java similarity index 94% rename from spring-zuul/spring-zuul-ui/src/main/java/org/baeldung/config/UiApplication.java rename to spring-cloud/spring-cloud-zuul/spring-zuul-ui/src/main/java/com/baeldung/config/UiApplication.java index d3e13639ef..0772f9cab4 100644 --- a/spring-zuul/spring-zuul-ui/src/main/java/org/baeldung/config/UiApplication.java +++ b/spring-cloud/spring-cloud-zuul/spring-zuul-ui/src/main/java/com/baeldung/config/UiApplication.java @@ -1,4 +1,4 @@ -package org.baeldung.config; +package com.baeldung.config; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/spring-zuul/spring-zuul-ui/src/main/java/org/baeldung/config/UiWebConfig.java b/spring-cloud/spring-cloud-zuul/spring-zuul-ui/src/main/java/com/baeldung/config/UiWebConfig.java similarity index 97% rename from spring-zuul/spring-zuul-ui/src/main/java/org/baeldung/config/UiWebConfig.java rename to spring-cloud/spring-cloud-zuul/spring-zuul-ui/src/main/java/com/baeldung/config/UiWebConfig.java index 7cda1f0e95..1aa4205a77 100644 --- a/spring-zuul/spring-zuul-ui/src/main/java/org/baeldung/config/UiWebConfig.java +++ b/spring-cloud/spring-cloud-zuul/spring-zuul-ui/src/main/java/com/baeldung/config/UiWebConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.config; +package com.baeldung.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-zuul/spring-zuul-ui/src/main/resources/application.yml b/spring-cloud/spring-cloud-zuul/spring-zuul-ui/src/main/resources/application.yml similarity index 100% rename from spring-zuul/spring-zuul-ui/src/main/resources/application.yml rename to spring-cloud/spring-cloud-zuul/spring-zuul-ui/src/main/resources/application.yml diff --git a/spring-security-cache-control/src/main/resources/logback.xml b/spring-cloud/spring-cloud-zuul/spring-zuul-ui/src/main/resources/logback.xml similarity index 100% rename from spring-security-cache-control/src/main/resources/logback.xml rename to spring-cloud/spring-cloud-zuul/spring-zuul-ui/src/main/resources/logback.xml diff --git a/spring-zuul/spring-zuul-ui/src/main/resources/templates/index.html b/spring-cloud/spring-cloud-zuul/spring-zuul-ui/src/main/resources/templates/index.html old mode 100755 new mode 100644 similarity index 100% rename from spring-zuul/spring-zuul-ui/src/main/resources/templates/index.html rename to spring-cloud/spring-cloud-zuul/spring-zuul-ui/src/main/resources/templates/index.html diff --git a/spring-zuul/spring-zuul-ui/src/main/webapp/resources/angular-utf8-base64.min.js b/spring-cloud/spring-cloud-zuul/spring-zuul-ui/src/main/webapp/resources/angular-utf8-base64.min.js similarity index 100% rename from spring-zuul/spring-zuul-ui/src/main/webapp/resources/angular-utf8-base64.min.js rename to spring-cloud/spring-cloud-zuul/spring-zuul-ui/src/main/webapp/resources/angular-utf8-base64.min.js diff --git a/spring-zuul/spring-zuul-ui/src/test/java/org/baeldung/SpringContextTest.java b/spring-cloud/spring-cloud-zuul/spring-zuul-ui/src/test/java/com/baeldung/SpringContextTest.java similarity index 85% rename from spring-zuul/spring-zuul-ui/src/test/java/org/baeldung/SpringContextTest.java rename to spring-cloud/spring-cloud-zuul/spring-zuul-ui/src/test/java/com/baeldung/SpringContextTest.java index fd35ec0841..322db6b39b 100644 --- a/spring-zuul/spring-zuul-ui/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-cloud/spring-cloud-zuul/spring-zuul-ui/src/test/java/com/baeldung/SpringContextTest.java @@ -1,6 +1,6 @@ -package org.baeldung; +package com.baeldung; -import org.baeldung.config.UiApplication; +import com.baeldung.config.UiApplication; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; diff --git a/spring-zuul/spring-zuul-ui/src/test/java/org/baeldung/web/LiveTest.java b/spring-cloud/spring-cloud-zuul/spring-zuul-ui/src/test/java/com/baeldung/web/LiveTest.java similarity index 96% rename from spring-zuul/spring-zuul-ui/src/test/java/org/baeldung/web/LiveTest.java rename to spring-cloud/spring-cloud-zuul/spring-zuul-ui/src/test/java/com/baeldung/web/LiveTest.java index 38563cdbe8..cb7c0e76dc 100644 --- a/spring-zuul/spring-zuul-ui/src/test/java/org/baeldung/web/LiveTest.java +++ b/spring-cloud/spring-cloud-zuul/spring-zuul-ui/src/test/java/com/baeldung/web/LiveTest.java @@ -1,11 +1,10 @@ -package org.baeldung.web; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; +package com.baeldung.web; import io.restassured.RestAssured; import io.restassured.response.Response; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; public class LiveTest { diff --git a/jackson/.gitignore b/spring-cloud/spring-cloud-zuul/spring-zuul-ui/src/test/resources/.gitignore similarity index 100% rename from jackson/.gitignore rename to spring-cloud/spring-cloud-zuul/spring-zuul-ui/src/test/resources/.gitignore diff --git a/spring-rest-full/src/main/resources/persistence-mysql.properties b/spring-cloud/spring-cloud-zuul/spring-zuul-ui/src/test/resources/persistence-mysql.properties similarity index 100% rename from spring-rest-full/src/main/resources/persistence-mysql.properties rename to spring-cloud/spring-cloud-zuul/spring-zuul-ui/src/test/resources/persistence-mysql.properties diff --git a/spring-cloud/spring-cloud-zuul/src/test/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-zuul/src/test/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/SpringContextIntegrationTest.java deleted file mode 100644 index dbcdbdd434..0000000000 --- a/spring-cloud/spring-cloud-zuul/src/test/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung.spring.cloud.zuulratelimitdemo.controller; - -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.baeldung.spring.cloud.zuulratelimitdemo.ZuulRatelimitDemoApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = ZuulRatelimitDemoApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} \ No newline at end of file diff --git a/spring-core-2/README.md b/spring-core-2/README.md index 027c049163..0ed303162d 100644 --- a/spring-core-2/README.md +++ b/spring-core-2/README.md @@ -17,4 +17,4 @@ This module contains articles about core Spring functionality - [Using @Autowired in Abstract Classes](https://www.baeldung.com/spring-autowired-abstract-class) - [Guide to the Spring BeanFactory](https://www.baeldung.com/spring-beanfactory) - [Read HttpServletRequest Multiple Times](https://www.baeldung.com/spring-reading-httpservletrequest-multiple-times) -- More articles: [[<-- prev]](/spring-core) \ No newline at end of file +- More articles: [[<-- prev]](/spring-core)[[next -->]](/spring-core-3) \ No newline at end of file diff --git a/spring-core-2/pom.xml b/spring-core-2/pom.xml index 21548d6984..f89a093f30 100644 --- a/spring-core-2/pom.xml +++ b/spring-core-2/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -7,12 +8,34 @@ <packaging>war</packaging> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-framework-bom</artifactId> + <version>${org.springframework.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + <version>${org.springframework.version}</version> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-thymeleaf</artifactId> + <version>${org.springframework.version}</version> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>com.fasterxml.jackson.core</groupId> @@ -139,28 +162,6 @@ </dependency> </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-framework-bom</artifactId> - <version>${org.springframework.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-core</artifactId> - <version>${org.springframework.version}</version> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-thymeleaf</artifactId> - <version>${org.springframework.version}</version> - </dependency> - </dependencies> - </dependencyManagement> - <build> <finalName>spring-core-2</finalName> <resources> @@ -180,6 +181,7 @@ </plugin> </plugins> </build> + <profiles> <profile> <id>dev</id> diff --git a/spring-core-2/src/test/java/org/baeldung/cachedrequest/PersonControllerIntegrationTest.java b/spring-core-2/src/test/java/org/baeldung/cachedrequest/PersonControllerIntegrationTest.java deleted file mode 100644 index 77d6a816e3..0000000000 --- a/spring-core-2/src/test/java/org/baeldung/cachedrequest/PersonControllerIntegrationTest.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.baeldung.cachedrequest; - -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import java.io.IOException; - -import javax.print.attribute.PrintRequestAttribute; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.http.MediaType; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.ResultActions; - -import com.fasterxml.jackson.databind.ObjectMapper; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = { HttpRequestDemoConfig.class, ContentCachingFilter.class, PrintRequestAttribute.class }) -@AutoConfigureMockMvc -public class PersonControllerIntegrationTest { - - @Autowired - private MockMvc mockMvc; - - ObjectMapper objectMapper = new ObjectMapper(); - - @Test - public void whenValidInput_thenCreateBook() throws IOException, Exception { - // assign - given - Person book = new Person("sumit", "abc", 100); - - // act - when - ResultActions result = mockMvc.perform(post("/person").accept(MediaType.APPLICATION_JSON) - .contentType(MediaType.APPLICATION_JSON) - .content(objectMapper.writeValueAsString(book))); - - // assert - then - result.andExpect(status().isNoContent()); - } - -} diff --git a/spring-core-3/README.md b/spring-core-3/README.md index 1c5d911402..ae2d33c196 100644 --- a/spring-core-3/README.md +++ b/spring-core-3/README.md @@ -1,3 +1,7 @@ +## Spring Core + +This module contains articles about core Spring functionality + ## Relevant Articles: - [Understanding getBean() in Spring](https://www.baeldung.com/spring-getbean) diff --git a/spring-core/pom.xml b/spring-core/pom.xml index 7e5a9b3feb..eb25bcd517 100644 --- a/spring-core/pom.xml +++ b/spring-core/pom.xml @@ -1,8 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-core</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-core</name> @@ -57,7 +56,7 @@ <version>${mockito.spring.boot.version}</version> <scope>test</scope> </dependency> - <dependency> + <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> <version>${assertj.version}</version> diff --git a/spring-cucumber/pom.xml b/spring-cucumber/pom.xml index 85980fbc60..245d10e77b 100644 --- a/spring-cucumber/pom.xml +++ b/spring-cucumber/pom.xml @@ -1,17 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-cucumber</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-cucumber</name> - <description>Demo project for Spring Boot</description> <packaging>jar</packaging> + <description>Demo project for Spring Boot</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> diff --git a/spring-cucumber/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cucumber/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 80efd86f13..0000000000 --- a/spring-cucumber/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.SpringDemoApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringDemoApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-data-rest-querydsl/pom.xml b/spring-data-rest-querydsl/pom.xml index 2c75990c65..9f53f6b55f 100644 --- a/spring-data-rest-querydsl/pom.xml +++ b/spring-data-rest-querydsl/pom.xml @@ -1,16 +1,15 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns="http://maven.apache.org/POM/4.0.0" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-data-rest-querydsl</artifactId> <version>1.0</version> <name>spring-data-rest-querydsl</name> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-1</relativePath> </parent> diff --git a/spring-data-rest/pom.xml b/spring-data-rest/pom.xml index 8400993a38..05f2ccbbae 100644 --- a/spring-data-rest/pom.xml +++ b/spring-data-rest/pom.xml @@ -9,8 +9,8 @@ <description>Intro to Spring Data REST</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -89,7 +89,7 @@ <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <start-class>com.baeldung.SpringDataRestApplication</start-class> + <start-class>com.baeldung.books.SpringDataRestApplication</start-class> </properties> </project> \ No newline at end of file diff --git a/spring-data-rest/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-data-rest/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index c2682855b8..0000000000 --- a/spring-data-rest/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.books.SpringDataRestApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringDataRestApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-di/pom.xml b/spring-di/pom.xml index c865815753..48cdf60673 100644 --- a/spring-di/pom.xml +++ b/spring-di/pom.xml @@ -5,8 +5,8 @@ <modelVersion>4.0.0</modelVersion> <artifactId>spring-di</artifactId> <version>1.0-SNAPSHOT</version> - <packaging>war</packaging> <name>spring-di</name> + <packaging>war</packaging> <parent> <groupId>com.baeldung</groupId> @@ -15,6 +15,23 @@ <relativePath>../parent-spring-5</relativePath> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-framework-bom</artifactId> + <version>${org.springframework.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + <version>${org.springframework.version}</version> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>org.springframework</groupId> @@ -68,11 +85,17 @@ <artifactId>commons-io</artifactId> <version>${commons.io.version}</version> </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>aspectjweaver</artifactId> + <version>${aspectjweaver.version}</version> + </dependency> + <!-- Spring --> -<!-- <dependency>--> -<!-- <groupId>org.springframework</groupId>--> -<!-- <artifactId>spring-context</artifactId>--> -<!-- </dependency>--> + <!-- <dependency>--> + <!-- <groupId>org.springframework</groupId>--> + <!-- <artifactId>spring-context</artifactId>--> + <!-- </dependency>--> <dependency> <groupId>javax.annotation</groupId> @@ -80,32 +103,15 @@ <version>${annotation-api.version}</version> </dependency> -<!-- <!– test scoped –>--> -<!-- <dependency>--> -<!-- <groupId>org.springframework</groupId>--> -<!-- <artifactId>spring-test</artifactId>--> -<!-- <scope>test</scope>--> -<!-- </dependency>--> + <!-- <!– test scoped –>--> + <!-- <dependency>--> + <!-- <groupId>org.springframework</groupId>--> + <!-- <artifactId>spring-test</artifactId>--> + <!-- <scope>test</scope>--> + <!-- </dependency>--> </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-framework-bom</artifactId> - <version>${org.springframework.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-core</artifactId> - <version>${org.springframework.version}</version> - </dependency> - </dependencies> - </dependencyManagement> - <build> <finalName>spring-di</finalName> <resources> @@ -157,6 +163,7 @@ <spring-boot.version>1.5.2.RELEASE</spring-boot.version> <mockito.version>1.10.19</mockito.version> <assertj.version>3.12.2</assertj.version> + <aspectjweaver.version>1.9.5</aspectjweaver.version> </properties> </project> \ No newline at end of file diff --git a/spring-di/src/main/java/com/baeldung/componentscan/filter/annotation/Animal.java b/spring-di/src/main/java/com/baeldung/componentscan/filter/annotation/Animal.java new file mode 100644 index 0000000000..7ec076abc7 --- /dev/null +++ b/spring-di/src/main/java/com/baeldung/componentscan/filter/annotation/Animal.java @@ -0,0 +1,11 @@ +package com.baeldung.componentscan.filter.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface Animal { +} diff --git a/spring-di/src/main/java/com/baeldung/componentscan/filter/annotation/ComponentScanAnnotationFilterApp.java b/spring-di/src/main/java/com/baeldung/componentscan/filter/annotation/ComponentScanAnnotationFilterApp.java new file mode 100644 index 0000000000..7849e4e10a --- /dev/null +++ b/spring-di/src/main/java/com/baeldung/componentscan/filter/annotation/ComponentScanAnnotationFilterApp.java @@ -0,0 +1,13 @@ +package com.baeldung.componentscan.filter.annotation; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.FilterType; + +@Configuration +@ComponentScan(includeFilters = @ComponentScan.Filter(type = FilterType.ANNOTATION, classes = Animal.class)) +public class ComponentScanAnnotationFilterApp { + + public static void main(String[] args) { + } +} diff --git a/spring-di/src/main/java/com/baeldung/componentscan/filter/annotation/Elephant.java b/spring-di/src/main/java/com/baeldung/componentscan/filter/annotation/Elephant.java new file mode 100644 index 0000000000..758775a737 --- /dev/null +++ b/spring-di/src/main/java/com/baeldung/componentscan/filter/annotation/Elephant.java @@ -0,0 +1,5 @@ +package com.baeldung.componentscan.filter.annotation; + +@Animal +public class Elephant { +} diff --git a/spring-boot-di/src/main/java/com/baeldung/componentscan/filter/aspectj/Cat.java b/spring-di/src/main/java/com/baeldung/componentscan/filter/aspectj/Cat.java similarity index 100% rename from spring-boot-di/src/main/java/com/baeldung/componentscan/filter/aspectj/Cat.java rename to spring-di/src/main/java/com/baeldung/componentscan/filter/aspectj/Cat.java diff --git a/spring-boot-di/src/main/java/com/baeldung/componentscan/filter/aspectj/ComponentScanAspectJFilterApp.java b/spring-di/src/main/java/com/baeldung/componentscan/filter/aspectj/ComponentScanAspectJFilterApp.java similarity index 100% rename from spring-boot-di/src/main/java/com/baeldung/componentscan/filter/aspectj/ComponentScanAspectJFilterApp.java rename to spring-di/src/main/java/com/baeldung/componentscan/filter/aspectj/ComponentScanAspectJFilterApp.java diff --git a/spring-boot-di/src/main/java/com/baeldung/componentscan/filter/aspectj/Elephant.java b/spring-di/src/main/java/com/baeldung/componentscan/filter/aspectj/Elephant.java similarity index 100% rename from spring-boot-di/src/main/java/com/baeldung/componentscan/filter/aspectj/Elephant.java rename to spring-di/src/main/java/com/baeldung/componentscan/filter/aspectj/Elephant.java diff --git a/spring-boot-di/src/main/java/com/baeldung/componentscan/filter/aspectj/Loin.java b/spring-di/src/main/java/com/baeldung/componentscan/filter/aspectj/Loin.java similarity index 100% rename from spring-boot-di/src/main/java/com/baeldung/componentscan/filter/aspectj/Loin.java rename to spring-di/src/main/java/com/baeldung/componentscan/filter/aspectj/Loin.java diff --git a/spring-boot-di/src/main/java/com/baeldung/componentscan/filter/assignable/Animal.java b/spring-di/src/main/java/com/baeldung/componentscan/filter/assignable/Animal.java similarity index 100% rename from spring-boot-di/src/main/java/com/baeldung/componentscan/filter/assignable/Animal.java rename to spring-di/src/main/java/com/baeldung/componentscan/filter/assignable/Animal.java diff --git a/spring-boot-di/src/main/java/com/baeldung/componentscan/filter/assignable/Cat.java b/spring-di/src/main/java/com/baeldung/componentscan/filter/assignable/Cat.java similarity index 100% rename from spring-boot-di/src/main/java/com/baeldung/componentscan/filter/assignable/Cat.java rename to spring-di/src/main/java/com/baeldung/componentscan/filter/assignable/Cat.java diff --git a/spring-boot-di/src/main/java/com/baeldung/componentscan/filter/assignable/ComponentScanAssignableTypeFilterApp.java b/spring-di/src/main/java/com/baeldung/componentscan/filter/assignable/ComponentScanAssignableTypeFilterApp.java similarity index 100% rename from spring-boot-di/src/main/java/com/baeldung/componentscan/filter/assignable/ComponentScanAssignableTypeFilterApp.java rename to spring-di/src/main/java/com/baeldung/componentscan/filter/assignable/ComponentScanAssignableTypeFilterApp.java diff --git a/spring-boot-di/src/main/java/com/baeldung/componentscan/filter/assignable/Elephant.java b/spring-di/src/main/java/com/baeldung/componentscan/filter/assignable/Elephant.java similarity index 100% rename from spring-boot-di/src/main/java/com/baeldung/componentscan/filter/assignable/Elephant.java rename to spring-di/src/main/java/com/baeldung/componentscan/filter/assignable/Elephant.java diff --git a/spring-boot-di/src/main/java/com/baeldung/componentscan/filter/custom/Cat.java b/spring-di/src/main/java/com/baeldung/componentscan/filter/custom/Cat.java similarity index 100% rename from spring-boot-di/src/main/java/com/baeldung/componentscan/filter/custom/Cat.java rename to spring-di/src/main/java/com/baeldung/componentscan/filter/custom/Cat.java diff --git a/spring-boot-di/src/main/java/com/baeldung/componentscan/filter/custom/ComponentScanCustomFilter.java b/spring-di/src/main/java/com/baeldung/componentscan/filter/custom/ComponentScanCustomFilter.java similarity index 100% rename from spring-boot-di/src/main/java/com/baeldung/componentscan/filter/custom/ComponentScanCustomFilter.java rename to spring-di/src/main/java/com/baeldung/componentscan/filter/custom/ComponentScanCustomFilter.java diff --git a/spring-boot-di/src/main/java/com/baeldung/componentscan/filter/custom/ComponentScanCustomFilterApp.java b/spring-di/src/main/java/com/baeldung/componentscan/filter/custom/ComponentScanCustomFilterApp.java similarity index 100% rename from spring-boot-di/src/main/java/com/baeldung/componentscan/filter/custom/ComponentScanCustomFilterApp.java rename to spring-di/src/main/java/com/baeldung/componentscan/filter/custom/ComponentScanCustomFilterApp.java diff --git a/spring-boot-di/src/main/java/com/baeldung/componentscan/filter/custom/Elephant.java b/spring-di/src/main/java/com/baeldung/componentscan/filter/custom/Elephant.java similarity index 100% rename from spring-boot-di/src/main/java/com/baeldung/componentscan/filter/custom/Elephant.java rename to spring-di/src/main/java/com/baeldung/componentscan/filter/custom/Elephant.java diff --git a/spring-boot-di/src/main/java/com/baeldung/componentscan/filter/custom/Loin.java b/spring-di/src/main/java/com/baeldung/componentscan/filter/custom/Loin.java similarity index 100% rename from spring-boot-di/src/main/java/com/baeldung/componentscan/filter/custom/Loin.java rename to spring-di/src/main/java/com/baeldung/componentscan/filter/custom/Loin.java diff --git a/spring-boot-di/src/main/java/com/baeldung/componentscan/filter/regex/Cat.java b/spring-di/src/main/java/com/baeldung/componentscan/filter/regex/Cat.java similarity index 100% rename from spring-boot-di/src/main/java/com/baeldung/componentscan/filter/regex/Cat.java rename to spring-di/src/main/java/com/baeldung/componentscan/filter/regex/Cat.java diff --git a/spring-boot-di/src/main/java/com/baeldung/componentscan/filter/regex/ComponentScanRegexFilterApp.java b/spring-di/src/main/java/com/baeldung/componentscan/filter/regex/ComponentScanRegexFilterApp.java similarity index 100% rename from spring-boot-di/src/main/java/com/baeldung/componentscan/filter/regex/ComponentScanRegexFilterApp.java rename to spring-di/src/main/java/com/baeldung/componentscan/filter/regex/ComponentScanRegexFilterApp.java diff --git a/spring-boot-di/src/main/java/com/baeldung/componentscan/filter/regex/Elephant.java b/spring-di/src/main/java/com/baeldung/componentscan/filter/regex/Elephant.java similarity index 100% rename from spring-boot-di/src/main/java/com/baeldung/componentscan/filter/regex/Elephant.java rename to spring-di/src/main/java/com/baeldung/componentscan/filter/regex/Elephant.java diff --git a/spring-boot-di/src/main/java/com/baeldung/componentscan/filter/regex/Loin.java b/spring-di/src/main/java/com/baeldung/componentscan/filter/regex/Loin.java similarity index 100% rename from spring-boot-di/src/main/java/com/baeldung/componentscan/filter/regex/Loin.java rename to spring-di/src/main/java/com/baeldung/componentscan/filter/regex/Loin.java diff --git a/spring-di/src/main/java/org/baeldung/store/AppConfig.java b/spring-di/src/main/java/org/baeldung/store/AppConfig.java new file mode 100644 index 0000000000..80b6733dff --- /dev/null +++ b/spring-di/src/main/java/org/baeldung/store/AppConfig.java @@ -0,0 +1,23 @@ +package org.baeldung.store; + +import org.springframework.context.annotation.Bean; + +public class AppConfig { + + @Bean + public Item item1() { + return new ItemImpl1(); + } + + @Bean + public Store storeThroughConstructorInjection() { + return new Store(item1()); + } + + @Bean + public Store storeThroughSetterInjection() { + Store store = new Store(); + store.setItem(item1()); + return store; + } +} diff --git a/spring-di/src/main/java/org/baeldung/store/Item.java b/spring-di/src/main/java/org/baeldung/store/Item.java new file mode 100644 index 0000000000..1d7292fc35 --- /dev/null +++ b/spring-di/src/main/java/org/baeldung/store/Item.java @@ -0,0 +1,5 @@ +package org.baeldung.store; + +public interface Item { + +} diff --git a/spring-di/src/main/java/org/baeldung/store/ItemImpl1.java b/spring-di/src/main/java/org/baeldung/store/ItemImpl1.java new file mode 100644 index 0000000000..8bda9f24c9 --- /dev/null +++ b/spring-di/src/main/java/org/baeldung/store/ItemImpl1.java @@ -0,0 +1,5 @@ +package org.baeldung.store; + +public class ItemImpl1 implements Item { + +} diff --git a/spring-di/src/main/java/org/baeldung/store/Store.java b/spring-di/src/main/java/org/baeldung/store/Store.java new file mode 100644 index 0000000000..dcc2c3be48 --- /dev/null +++ b/spring-di/src/main/java/org/baeldung/store/Store.java @@ -0,0 +1,23 @@ +package org.baeldung.store; + +import org.springframework.beans.factory.annotation.Autowired; + +public class Store { + + @Autowired + private Item item; + + public Store() {} + + public Store(Item item) { + this.item = item; + } + + public Item getItem() { + return item; + } + + public void setItem(Item item) { + this.item = item; + } +} diff --git a/spring-di/src/main/resources/ioc-context-by-type.xml b/spring-di/src/main/resources/ioc-context-by-type.xml new file mode 100644 index 0000000000..1249ce51af --- /dev/null +++ b/spring-di/src/main/resources/ioc-context-by-type.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> + + <!-- Autowired injection --> + + <bean id="item" class="org.baeldung.store.ItemImpl1" /> + + <bean id="xml-store-by-autowire-type" class="org.baeldung.store.Store" autowire="byType"> + </bean> + +</beans> \ No newline at end of file diff --git a/spring-di/src/main/resources/ioc-context.xml b/spring-di/src/main/resources/ioc-context.xml new file mode 100644 index 0000000000..0e1d0ac29c --- /dev/null +++ b/spring-di/src/main/resources/ioc-context.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> + + <!-- Constructor injection --> + + <bean id="item1" class="org.baeldung.store.ItemImpl1" /> + <bean id="xml-store-by-constructor" class="org.baeldung.store.Store"> + <constructor-arg type="Item" index="0" name="item" ref="item1" /> + </bean> + + <!-- Setter injection --> + + <bean id="xml-store-by-setter" class="org.baeldung.store.Store"> + <property name="item" ref="item1" /> + </bean> + + <!-- Autowired injection --> + + <bean id="item" class="org.baeldung.store.ItemImpl1" /> + + <bean id="xml-store-by-autowire-name" class="org.baeldung.store.Store" autowire="byName"> + </bean> + + <!-- Lazy instantiation --> + + <bean id="item1-lazy" class="org.baeldung.store.ItemImpl1" lazy-init="true" /> + <bean id="xml-store-by-setter-lazy" class="org.baeldung.store.Store"> + <property name="item" ref="item1-lazy" /> + </bean> + +</beans> \ No newline at end of file diff --git a/spring-boot-di/src/test/java/com/baeldung/componentscan/filter/annotation/ComponentScanAnnotationFilterAppIntegrationTest.java b/spring-di/src/test/java/com/baeldung/componentscan/filter/annotation/ComponentScanAnnotationFilterAppIntegrationTest.java similarity index 100% rename from spring-boot-di/src/test/java/com/baeldung/componentscan/filter/annotation/ComponentScanAnnotationFilterAppIntegrationTest.java rename to spring-di/src/test/java/com/baeldung/componentscan/filter/annotation/ComponentScanAnnotationFilterAppIntegrationTest.java diff --git a/spring-boot-di/src/test/java/com/baeldung/componentscan/filter/aspectj/ComponentScanAspectJFilterAppIntegrationTest.java b/spring-di/src/test/java/com/baeldung/componentscan/filter/aspectj/ComponentScanAspectJFilterAppUnitTest.java similarity index 95% rename from spring-boot-di/src/test/java/com/baeldung/componentscan/filter/aspectj/ComponentScanAspectJFilterAppIntegrationTest.java rename to spring-di/src/test/java/com/baeldung/componentscan/filter/aspectj/ComponentScanAspectJFilterAppUnitTest.java index 945a0085f6..a85c451299 100644 --- a/spring-boot-di/src/test/java/com/baeldung/componentscan/filter/aspectj/ComponentScanAspectJFilterAppIntegrationTest.java +++ b/spring-di/src/test/java/com/baeldung/componentscan/filter/aspectj/ComponentScanAspectJFilterAppUnitTest.java @@ -16,7 +16,7 @@ import static org.hamcrest.CoreMatchers.*; @RunWith(SpringRunner.class) @SpringBootTest(classes = ComponentScanAspectJFilterApp.class) -public class ComponentScanAspectJFilterAppIntegrationTest { +public class ComponentScanAspectJFilterAppUnitTest { @Test public void whenAspectJFilterIsUsed_thenComponentScanShouldRegisterBeanMatchingAspectJCreteria() { diff --git a/spring-boot-di/src/test/java/com/baeldung/componentscan/filter/assignable/ComponentScanAssignableTypeFilterAppIntegrationTest.java b/spring-di/src/test/java/com/baeldung/componentscan/filter/assignable/ComponentScanAssignableTypeFilterAppIntegrationTest.java similarity index 96% rename from spring-boot-di/src/test/java/com/baeldung/componentscan/filter/assignable/ComponentScanAssignableTypeFilterAppIntegrationTest.java rename to spring-di/src/test/java/com/baeldung/componentscan/filter/assignable/ComponentScanAssignableTypeFilterAppIntegrationTest.java index 3e5c7ee4f7..edd82f435c 100644 --- a/spring-boot-di/src/test/java/com/baeldung/componentscan/filter/assignable/ComponentScanAssignableTypeFilterAppIntegrationTest.java +++ b/spring-di/src/test/java/com/baeldung/componentscan/filter/assignable/ComponentScanAssignableTypeFilterAppIntegrationTest.java @@ -19,7 +19,7 @@ import static org.hamcrest.CoreMatchers.*; public class ComponentScanAssignableTypeFilterAppIntegrationTest { @Test - public void whenAssignableTypeFilterIsUsed_thenComponentScanShouldRegisterBeanOfAssignableTypeAndItsSubClass() { + public void whenAssignableTypeFilterIsUsed_thenComponentScanShouldRegisterBean() { ApplicationContext applicationContext = new AnnotationConfigApplicationContext(ComponentScanAssignableTypeFilterApp.class); List<String> beans = Arrays.stream(applicationContext.getBeanDefinitionNames()) .filter(bean -> !bean.contains("org.springframework") && !bean.contains("componentScanAssignableTypeFilterApp")) diff --git a/spring-boot-di/src/test/java/com/baeldung/componentscan/filter/custom/ComponentScanCustomFilterAppIntegrationTest.java b/spring-di/src/test/java/com/baeldung/componentscan/filter/custom/ComponentScanCustomFilterAppIntegrationTest.java similarity index 100% rename from spring-boot-di/src/test/java/com/baeldung/componentscan/filter/custom/ComponentScanCustomFilterAppIntegrationTest.java rename to spring-di/src/test/java/com/baeldung/componentscan/filter/custom/ComponentScanCustomFilterAppIntegrationTest.java diff --git a/spring-boot-di/src/test/java/com/baeldung/componentscan/filter/regex/ComponentScanRegexFilterAppIntegrationTest.java b/spring-di/src/test/java/com/baeldung/componentscan/filter/regex/ComponentScanRegexFilterAppIntegrationTest.java similarity index 100% rename from spring-boot-di/src/test/java/com/baeldung/componentscan/filter/regex/ComponentScanRegexFilterAppIntegrationTest.java rename to spring-di/src/test/java/com/baeldung/componentscan/filter/regex/ComponentScanRegexFilterAppIntegrationTest.java diff --git a/spring-di/src/test/java/org/baeldung/store/AppConfigUnitTest.java b/spring-di/src/test/java/org/baeldung/store/AppConfigUnitTest.java new file mode 100644 index 0000000000..3260114679 --- /dev/null +++ b/spring-di/src/test/java/org/baeldung/store/AppConfigUnitTest.java @@ -0,0 +1,35 @@ +package org.baeldung.store; + +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = AppConfig.class) +public class AppConfigUnitTest { + + @Autowired + @Qualifier("storeThroughConstructorInjection") + private Store storeByConstructorInjection; + + @Autowired + @Qualifier("storeThroughSetterInjection") + private Store storeBySetterInjection; + + @Test + public void givenValidXmlConfig_WhenInjectStoreByConstructorInjection_ThenBeanIsNotNull() { + assertNotNull(storeByConstructorInjection); + assertNotNull(storeByConstructorInjection.getItem()); + } + + @Test + public void givenValidXmlConfig_WhenInjectStoreBySetterInjection_ThenBeanIsNotNull() { + assertNotNull(storeBySetterInjection); + assertNotNull(storeByConstructorInjection.getItem()); + } +} diff --git a/spring-di/src/test/java/org/baeldung/store/XmlAppConfigByTypeUnitTest.java b/spring-di/src/test/java/org/baeldung/store/XmlAppConfigByTypeUnitTest.java new file mode 100644 index 0000000000..036399e537 --- /dev/null +++ b/spring-di/src/test/java/org/baeldung/store/XmlAppConfigByTypeUnitTest.java @@ -0,0 +1,30 @@ +package org.baeldung.store; + +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * Separate unit test class where only one Item object is available for + * autowiring. If the ioc-context.xml were used for autowiring by type, there + * would be multiple qualifying Item objects, causing a failure. + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration("classpath:/ioc-context-by-type.xml") +public class XmlAppConfigByTypeUnitTest { + + @Autowired + @Qualifier("xml-store-by-autowire-type") + private Store storeByAutowireInjectionByType; + + @Test + public void givenValidXmlConfig_WhenInjectStoreByAutowireInjectionByType_ThenBeanIsNotNull() { + assertNotNull(storeByAutowireInjectionByType); + assertNotNull(storeByAutowireInjectionByType.getItem()); + } +} diff --git a/spring-di/src/test/java/org/baeldung/store/XmlAppConfigUnitTest.java b/spring-di/src/test/java/org/baeldung/store/XmlAppConfigUnitTest.java new file mode 100644 index 0000000000..2dd4d6ccd6 --- /dev/null +++ b/spring-di/src/test/java/org/baeldung/store/XmlAppConfigUnitTest.java @@ -0,0 +1,55 @@ +package org.baeldung.store; + +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration("classpath:/ioc-context.xml") +public class XmlAppConfigUnitTest { + + @Autowired + @Qualifier("xml-store-by-constructor") + private Store storeByConstructorInjection; + + @Autowired + @Qualifier("xml-store-by-setter") + private Store storeBySetterInjection; + + @Autowired + @Qualifier("xml-store-by-autowire-name") + private Store storeByAutowireInjectionByName; + + @Autowired + @Qualifier("xml-store-by-setter-lazy") + private Store storeBySetterInjectionLazy; + + @Test + public void givenValidXmlConfig_WhenInjectStoreByConstructorInjection_ThenBeanIsNotNull() { + assertNotNull(storeByConstructorInjection); + assertNotNull(storeByConstructorInjection.getItem()); + } + + @Test + public void givenValidXmlConfig_WhenInjectStoreBySetterInjection_ThenBeanIsNotNull() { + assertNotNull(storeBySetterInjection); + assertNotNull(storeByConstructorInjection.getItem()); + } + + @Test + public void givenValidXmlConfig_WhenInjectStoreByAutowireInjectionByName_ThenBeanIsNotNull() { + assertNotNull(storeByAutowireInjectionByName); + assertNotNull(storeByAutowireInjectionByName.getItem()); + } + + @Test + public void givenValidXmlConfig_WhenInjectStoreBySetterInjectionLazy_ThenBeanIsNotNull() { + assertNotNull(storeBySetterInjectionLazy); + assertNotNull(storeByConstructorInjection.getItem()); + } +} diff --git a/spring-dispatcher-servlet/pom.xml b/spring-dispatcher-servlet/pom.xml index 6f816986be..9b9f7fb4c6 100644 --- a/spring-dispatcher-servlet/pom.xml +++ b/spring-dispatcher-servlet/pom.xml @@ -1,8 +1,7 @@ <?xml version="1.0"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-dispatcher-servlet</artifactId> <version>1.0.0</version> <name>spring-dispatcher-servlet</name> @@ -62,11 +61,11 @@ <version>${commons-fileupload.version}</version> </dependency> <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <version>1.5.10.RELEASE</version> - <scope>test</scope> - </dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <version>1.5.10.RELEASE</version> + <scope>test</scope> + </dependency> </dependencies> <build> diff --git a/spring-dispatcher-servlet/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-dispatcher-servlet/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 8a9d3421c2..0000000000 --- a/spring-dispatcher-servlet/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; - -import com.baeldung.springdispatcherservlet.configuration.AppConfig; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = AppConfig.class) -@WebAppConfiguration -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-drools/pom.xml b/spring-drools/pom.xml index 5bb2d6a8e9..5adef4b2a9 100644 --- a/spring-drools/pom.xml +++ b/spring-drools/pom.xml @@ -1,12 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-drools</artifactId> <version>1.0.0-SNAPSHOT</version> - <name>spring-drools</name> - + <name>spring-drools</name> + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> diff --git a/spring-drools/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-drools/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 68325682e5..0000000000 --- a/spring-drools/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import com.baeldung.spring.drools.service.TaxiFareConfiguration; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = TaxiFareConfiguration.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-ehcache/pom.xml b/spring-ehcache/pom.xml index b8378617c5..bf78e1392c 100644 --- a/spring-ehcache/pom.xml +++ b/spring-ehcache/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-ehcache</artifactId> <version>0.1-SNAPSHOT</version> @@ -7,14 +8,13 @@ <packaging>jar</packaging> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> <dependencies> - <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> diff --git a/spring-ejb/ejb-beans/pom.xml b/spring-ejb/ejb-beans/pom.xml index 168809ee6d..b8978a0cc3 100644 --- a/spring-ejb/ejb-beans/pom.xml +++ b/spring-ejb/ejb-beans/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.singletonsession</groupId> <artifactId>ejb-beans</artifactId> @@ -42,6 +43,7 @@ <scope>test</scope> </dependency> </dependencies> + <profiles> <profile> <id>arquillian-glassfish-embedded</id> diff --git a/spring-ejb/pom.xml b/spring-ejb/pom.xml index 4422223c6f..1b3a52184e 100755 --- a/spring-ejb/pom.xml +++ b/spring-ejb/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.spring.ejb</groupId> <artifactId>spring-ejb</artifactId> @@ -74,10 +74,10 @@ <modules> <module>spring-ejb-remote</module> <module>ejb-beans</module> - <module>spring-ejb-client</module> - <module>wildfly</module> + <module>spring-ejb-client</module> + <module>wildfly</module> </modules> - + <properties> <spring-ejb-remote.version>1.0.0-SNAPSHOT</spring-ejb-remote.version> <javaee.version>8.0</javaee.version> diff --git a/spring-ejb/spring-ejb-client/pom.xml b/spring-ejb/spring-ejb-client/pom.xml index 2dd3120532..6c335e8982 100644 --- a/spring-ejb/spring-ejb-client/pom.xml +++ b/spring-ejb/spring-ejb-client/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-ejb-client</artifactId> <name>spring-ejb-client</name> @@ -61,7 +61,7 @@ <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> - <version>${spring-boot.version}</version> + <version>${spring-boot.version}</version> </plugin> </plugins> </build> diff --git a/spring-ejb/spring-ejb-remote/pom.xml b/spring-ejb/spring-ejb-remote/pom.xml index 633e0387b0..28d5398b97 100644 --- a/spring-ejb/spring-ejb-remote/pom.xml +++ b/spring-ejb/spring-ejb-remote/pom.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-ejb-remote</artifactId> <name>spring-ejb-remote</name> diff --git a/spring-ejb/wildfly/pom.xml b/spring-ejb/wildfly/pom.xml index e2c3ffb50c..fdf2517139 100644 --- a/spring-ejb/wildfly/pom.xml +++ b/spring-ejb/wildfly/pom.xml @@ -1,10 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.wildfly</groupId> <artifactId>wildfly</artifactId> <version>0.0.1-SNAPSHOT</version> - <name>wildfly</name> + <name>wildfly</name> <packaging>pom</packaging> <parent> diff --git a/spring-ejb/wildfly/widlfly-web/pom.xml b/spring-ejb/wildfly/widlfly-web/pom.xml index 5eefada2fc..79d0dca470 100644 --- a/spring-ejb/wildfly/widlfly-web/pom.xml +++ b/spring-ejb/wildfly/widlfly-web/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -38,4 +39,5 @@ <version>${wildlfy.version}</version> </dependency> </dependencies> + </project> \ No newline at end of file diff --git a/spring-ejb/wildfly/wildfly-ear/pom.xml b/spring-ejb/wildfly/wildfly-ear/pom.xml index 62d15a53dc..9393820b12 100644 --- a/spring-ejb/wildfly/wildfly-ear/pom.xml +++ b/spring-ejb/wildfly/wildfly-ear/pom.xml @@ -1,10 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>wildfly-ear</artifactId> - <name>wildfly-ear</name> + <name>wildfly-ear</name> <packaging>ear</packaging> - + <parent> <groupId>com.baeldung.wildfly</groupId> <artifactId>wildfly</artifactId> @@ -61,9 +62,10 @@ </plugin> </plugins> </build> - + <properties> <maven-ear-plugin.version>2.10.1</maven-ear-plugin.version> <wildfly-maven-plugin.version>1.2.0.Final</wildfly-maven-plugin.version> </properties> + </project> \ No newline at end of file diff --git a/spring-ejb/wildfly/wildfly-ejb-interfaces/pom.xml b/spring-ejb/wildfly/wildfly-ejb-interfaces/pom.xml index 41c7012ea9..21fc26106a 100644 --- a/spring-ejb/wildfly/wildfly-ejb-interfaces/pom.xml +++ b/spring-ejb/wildfly/wildfly-ejb-interfaces/pom.xml @@ -1,9 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>wildfly-ejb-interfaces</artifactId> - <name>wildfly-ejb-interfaces</name> - + <name>wildfly-ejb-interfaces</name> + <parent> <groupId>com.baeldung.wildfly</groupId> <artifactId>wildfly</artifactId> diff --git a/spring-ejb/wildfly/wildfly-ejb/pom.xml b/spring-ejb/wildfly/wildfly-ejb/pom.xml index f03bfb341c..c35e340ac9 100644 --- a/spring-ejb/wildfly/wildfly-ejb/pom.xml +++ b/spring-ejb/wildfly/wildfly-ejb/pom.xml @@ -1,10 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>wildfly-ejb</artifactId> - <name>wildfly-ejb</name> + <name>wildfly-ejb</name> <packaging>ejb</packaging> - + <parent> <groupId>com.baeldung.wildfly</groupId> <artifactId>wildfly</artifactId> @@ -48,8 +49,9 @@ </plugin> </plugins> </build> - + <properties> <ejb.version>3.2</ejb.version> </properties> + </project> \ No newline at end of file diff --git a/spring-ejb/wildfly/wildfly-jpa/pom.xml b/spring-ejb/wildfly/wildfly-jpa/pom.xml index 3005ab714c..1bc618a296 100644 --- a/spring-ejb/wildfly/wildfly-jpa/pom.xml +++ b/spring-ejb/wildfly/wildfly-jpa/pom.xml @@ -1,9 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>wildfly-jpa</artifactId> - <name>wildfly-jpa</name> - + <name>wildfly-jpa</name> + <parent> <groupId>com.baeldung.wildfly</groupId> <artifactId>wildfly</artifactId> diff --git a/spring-ejb/wildfly/wildfly-mdb/pom.xml b/spring-ejb/wildfly/wildfly-mdb/pom.xml index a2ffca2fc5..109cff861b 100644 --- a/spring-ejb/wildfly/wildfly-mdb/pom.xml +++ b/spring-ejb/wildfly/wildfly-mdb/pom.xml @@ -1,9 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>wildfly-mdb</artifactId> - <name>wildfly-mdb</name> - + <name>wildfly-mdb</name> + <parent> <groupId>com.baeldung.wildfly</groupId> <artifactId>wildfly</artifactId> @@ -19,4 +20,5 @@ <scope>provided</scope> </dependency> </dependencies> + </project> \ No newline at end of file diff --git a/spring-exceptions/pom.xml b/spring-exceptions/pom.xml index 45c80f2c9f..29ed7d5caa 100644 --- a/spring-exceptions/pom.xml +++ b/spring-exceptions/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-exceptions</artifactId> <version>0.1-SNAPSHOT</version> <name>spring-exceptions</name> diff --git a/spring-freemarker/pom.xml b/spring-freemarker/pom.xml index be34f84495..bdf7e97bce 100644 --- a/spring-freemarker/pom.xml +++ b/spring-freemarker/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.freemarker</groupId> <artifactId>spring-freemarker</artifactId> @@ -46,12 +47,11 @@ </dependency> <!-- Test --> <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <version>${spring-boot.version}</version> - <scope>test</scope> - </dependency> - + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <version>${spring-boot.version}</version> + <scope>test</scope> + </dependency> </dependencies> <properties> diff --git a/spring-freemarker/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-freemarker/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index ab0e6e8f49..0000000000 --- a/spring-freemarker/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; - -import com.baeldung.freemarker.config.SpringWebConfig; -import com.baeldung.freemarker.config.WebConfiguration; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { SpringWebConfig.class, WebConfiguration.class }) -@WebAppConfiguration -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-groovy/pom.xml b/spring-groovy/pom.xml index c26de0b6dd..ef5613adf6 100644 --- a/spring-groovy/pom.xml +++ b/spring-groovy/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldug</groupId> <artifactId>spring-groovy</artifactId> @@ -53,7 +54,6 @@ </dependency> </dependencies> </plugin> - </plugins> </build> diff --git a/spring-integration/pom.xml b/spring-integration/pom.xml index f06cb91ef6..ebdde5a1ee 100644 --- a/spring-integration/pom.xml +++ b/spring-integration/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.samples.spring.integration</groupId> <artifactId>spring-integration</artifactId> diff --git a/spring-integration/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-integration/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 92e80a0903..0000000000 --- a/spring-integration/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import com.baeldung.si.security.MessageConsumer; -import com.baeldung.si.security.SecuredDirectChannel; -import com.baeldung.si.security.SecurityConfig; -import com.baeldung.si.security.SecurityPubSubChannel; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { SecurityConfig.class, SecuredDirectChannel.class, SecurityPubSubChannel.class, - MessageConsumer.class }) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-jenkins-pipeline/pom.xml b/spring-jenkins-pipeline/pom.xml index 54b4cc478c..aa6008162c 100644 --- a/spring-jenkins-pipeline/pom.xml +++ b/spring-jenkins-pipeline/pom.xml @@ -1,16 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-jenkins-pipeline</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-jenkins-pipeline</name> - <description>Intro to Jenkins 2 and the power of pipelines</description> <packaging>jar</packaging> + <description>Intro to Jenkins 2 and the power of pipelines</description> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-1</relativePath> </parent> diff --git a/spring-jenkins-pipeline/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-jenkins-pipeline/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 0354f7211c..0000000000 --- a/spring-jenkins-pipeline/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.SpringJenkinsPipelineApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringJenkinsPipelineApplication.class) -@DirtiesContext -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-jersey/pom.xml b/spring-jersey/pom.xml index cf80ac4069..3c84e9c11e 100644 --- a/spring-jersey/pom.xml +++ b/spring-jersey/pom.xml @@ -1,13 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-jersey</artifactId> <version>0.1-SNAPSHOT</version> - <name>spring-jersey</name> + <name>spring-jersey</name> <packaging>war</packaging> - + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> @@ -119,14 +118,14 @@ <version>${assertj-core.version}</version> <scope>test</scope> </dependency> - + <!-- Test --> <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <version>${spring-boot.version}</version> - <scope>test</scope> - </dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <version>${spring-boot.version}</version> + <scope>test</scope> + </dependency> </dependencies> diff --git a/spring-jersey/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-jersey/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 21f180854c..0000000000 --- a/spring-jersey/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import com.baeldung.server.config.RestConfig; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = RestConfig.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-jinq/pom.xml b/spring-jinq/pom.xml index 1661614fa0..991401c4a1 100644 --- a/spring-jinq/pom.xml +++ b/spring-jinq/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-jinq</artifactId> <version>0.1-SNAPSHOT</version> diff --git a/spring-jinq/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-jinq/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index ccf774330f..0000000000 --- a/spring-jinq/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.spring.jinq.JinqApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = JinqApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-jms/pom.xml b/spring-jms/pom.xml index ea4af32216..a0d2625477 100644 --- a/spring-jms/pom.xml +++ b/spring-jms/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-jms</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-jms</name> diff --git a/spring-jms/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-jms/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 483ffec208..0000000000 --- a/spring-jms/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { "classpath:applicationContext.xml" }) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-jooq/pom.xml b/spring-jooq/pom.xml index 8a1fa877da..620172f2a1 100644 --- a/spring-jooq/pom.xml +++ b/spring-jooq/pom.xml @@ -1,16 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-jooq</artifactId> - <name>spring-jooq</name> - + <name>spring-jooq</name> + <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <!-- Import dependency management from Spring Boot --> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-dependencies</artifactId> + <version>${spring-boot.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <!-- jOOQ --> <dependency> @@ -129,7 +143,7 @@ <packageName>com.baeldung.jooq.introduction.db</packageName> <directory>src/main/java</directory> </target> - <database> + <database> <inputCatalog></inputCatalog> </database> </generator> @@ -174,19 +188,6 @@ </pluginManagement> </build> - <dependencyManagement> - <dependencies> - <dependency> - <!-- Import dependency management from Spring Boot --> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-dependencies</artifactId> - <version>${spring-boot.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <properties> <org.jooq.version>3.11.7</org.jooq.version> <lifecycle-mapping.version>1.0.0</lifecycle-mapping.version> diff --git a/spring-kafka/pom.xml b/spring-kafka/pom.xml index 3d08aaa928..d60a2ee506 100644 --- a/spring-kafka/pom.xml +++ b/spring-kafka/pom.xml @@ -1,15 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-kafka</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-kafka</name> <description>Intro to Kafka with Spring</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> diff --git a/spring-katharsis/pom.xml b/spring-katharsis/pom.xml index 18bf198948..3aeaa973af 100644 --- a/spring-katharsis/pom.xml +++ b/spring-katharsis/pom.xml @@ -1,15 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.springframework.samples</groupId> <artifactId>spring-katharsis</artifactId> <version>0.0.1-SNAPSHOT</version> - <name>spring-katharsis</name> + <name>spring-katharsis</name> <packaging>war</packaging> - + <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-1</relativePath> </parent> diff --git a/spring-katharsis/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-katharsis/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 48081903b6..0000000000 --- a/spring-katharsis/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.baeldung; - -import org.baeldung.Application; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-ldap/pom.xml b/spring-ldap/pom.xml index 7399a84c2b..a9882ccb52 100644 --- a/spring-ldap/pom.xml +++ b/spring-ldap/pom.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-ldap</artifactId> <version>0.1-SNAPSHOT</version> + <name>spring-ldap</name> <packaging>jar</packaging> - <name>spring-ldap</name> <parent> <groupId>com.baeldung</groupId> @@ -103,7 +103,6 @@ <finalName>spring-ldap</finalName> </build> - <profiles> <profile> <id>live</id> diff --git a/spring-ldap/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-ldap/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 9c233e6562..0000000000 --- a/spring-ldap/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import com.baeldung.ldap.javaconfig.AppConfig; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = AppConfig.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-mobile/pom.xml b/spring-mobile/pom.xml index 71d0d05933..ff90ac6ecb 100644 --- a/spring-mobile/pom.xml +++ b/spring-mobile/pom.xml @@ -1,8 +1,7 @@ <?xml version="1.0"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-mobile</artifactId> <version>1.0-SNAPSHOT</version> <name>spring-mobile</name> @@ -10,8 +9,8 @@ <url>http://maven.apache.org</url> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-1</relativePath> </parent> diff --git a/spring-mobile/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-mobile/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 7f906bdbcd..0000000000 --- a/spring-mobile/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.Application; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-mockito/pom.xml b/spring-mockito/pom.xml index 766234c41b..f3e0b04808 100644 --- a/spring-mockito/pom.xml +++ b/spring-mockito/pom.xml @@ -1,17 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-mockito</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-mockito</name> - <description>Injecting Mockito Mocks into Spring Beans</description> <packaging>jar</packaging> + <description>Injecting Mockito Mocks into Spring Beans</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> diff --git a/spring-mockito/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-mockito/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 7ce9f70302..0000000000 --- a/spring-mockito/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.MocksApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = MocksApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-mvc-basics-2/README.md b/spring-mvc-basics-2/README.md index 8cf753bbdc..4a5ea24283 100644 --- a/spring-mvc-basics-2/README.md +++ b/spring-mvc-basics-2/README.md @@ -1,11 +1,14 @@ -========= +## Spring MVC Basics -## Spring MVC Basics with Java Configuration Example Project +This module contains articles about the basics of Spring MVC. Articles about more specific areas of Spring MVC have +their own module. ### The Course The "REST With Spring" Classes: http://bit.ly/restwithspring ### Relevant Articles: -- [Quick Guide to Spring Controllers](http://www.baeldung.com/spring-controllers)- [The Spring @Controller and @RestController Annotations](http://www.baeldung.com/spring-controller-vs-restcontroller) +- [Quick Guide to Spring Controllers](http://www.baeldung.com/spring-controllers) +- [The Spring @Controller and @RestController Annotations](http://www.baeldung.com/spring-controller-vs-restcontroller) - [Model, ModelMap, and ModelView in Spring MVC](http://www.baeldung.com/spring-mvc-model-model-map-model-view) -- [Spring Web Contexts](http://www.baeldung.com/spring-web-contexts) \ No newline at end of file +- [Spring Web Contexts](http://www.baeldung.com/spring-web-contexts) +- [[<-- Prev]](/spring-mvc-basics) \ No newline at end of file diff --git a/spring-mvc-basics-2/pom.xml b/spring-mvc-basics-2/pom.xml index 706459a268..8e36eb38d8 100644 --- a/spring-mvc-basics-2/pom.xml +++ b/spring-mvc-basics-2/pom.xml @@ -8,8 +8,8 @@ <packaging>war</packaging> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/model/Article.java b/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/Article.java similarity index 87% rename from spring-mvc-basics-2/src/main/java/com/baeldung/model/Article.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/Article.java index 141bd17db7..f6675295ed 100644 --- a/spring-mvc-basics-2/src/main/java/com/baeldung/model/Article.java +++ b/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/Article.java @@ -1,4 +1,4 @@ -package com.baeldung.model; +package com.baeldung.controller.optionalpathvars; public class Article { diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerController.java b/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerController.java index 62c2502242..14b16e148b 100644 --- a/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerController.java +++ b/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerController.java @@ -1,13 +1,11 @@ package com.baeldung.controller.optionalpathvars; -import static com.baeldung.model.Article.DEFAULT_ARTICLE; +import static com.baeldung.controller.optionalpathvars.Article.DEFAULT_ARTICLE; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import com.baeldung.model.Article; - @RestController public class ArticleViewerController { diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithMapParamController.java b/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithMapParamController.java index d16cf4115c..50744b6067 100644 --- a/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithMapParamController.java +++ b/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithMapParamController.java @@ -1,6 +1,6 @@ package com.baeldung.controller.optionalpathvars; -import static com.baeldung.model.Article.DEFAULT_ARTICLE; +import static com.baeldung.controller.optionalpathvars.Article.DEFAULT_ARTICLE; import java.util.Map; @@ -8,8 +8,6 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import com.baeldung.model.Article; - @RestController @RequestMapping(value = "/mapParam") public class ArticleViewerWithMapParamController { diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithOptionalParamController.java b/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithOptionalParamController.java index fd7b900535..ff645fbcc7 100644 --- a/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithOptionalParamController.java +++ b/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithOptionalParamController.java @@ -1,14 +1,12 @@ package com.baeldung.controller.optionalpathvars; -import static com.baeldung.model.Article.DEFAULT_ARTICLE; +import static com.baeldung.controller.optionalpathvars.Article.DEFAULT_ARTICLE; import java.util.Optional; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import com.baeldung.model.Article;; +import org.springframework.web.bind.annotation.RestController;; @RestController @RequestMapping("/optionalParam") diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithRequiredAttributeController.java b/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithRequiredAttributeController.java index d9b36f93e8..8cd1539391 100644 --- a/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithRequiredAttributeController.java +++ b/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithRequiredAttributeController.java @@ -1,12 +1,10 @@ package com.baeldung.controller.optionalpathvars; -import static com.baeldung.model.Article.DEFAULT_ARTICLE; +import static com.baeldung.controller.optionalpathvars.Article.DEFAULT_ARTICLE; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import com.baeldung.model.Article;; +import org.springframework.web.bind.annotation.RestController;; @RestController @RequestMapping(value = "/requiredAttribute") diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithTwoSeparateMethodsController.java b/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithTwoSeparateMethodsController.java index 0b66b6cf43..0ea401a589 100644 --- a/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithTwoSeparateMethodsController.java +++ b/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithTwoSeparateMethodsController.java @@ -1,13 +1,11 @@ package com.baeldung.controller.optionalpathvars; -import static com.baeldung.model.Article.DEFAULT_ARTICLE; +import static com.baeldung.controller.optionalpathvars.Article.DEFAULT_ARTICLE; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import com.baeldung.model.Article; - @RestController @RequestMapping(value = "/seperateMethods") public class ArticleViewerWithTwoSeparateMethodsController { diff --git a/spring-mvc-basics-2/src/test/java/com/baeldung/controller/optionalpathvars/ArticleViewerControllerWithOptionalParamIntegrationTest.java b/spring-mvc-basics-2/src/test/java/com/baeldung/controller/optionalpathvars/ArticleViewerControllerWithOptionalParamIntegrationTest.java index 629e37f963..c7b568b68e 100644 --- a/spring-mvc-basics-2/src/test/java/com/baeldung/controller/optionalpathvars/ArticleViewerControllerWithOptionalParamIntegrationTest.java +++ b/spring-mvc-basics-2/src/test/java/com/baeldung/controller/optionalpathvars/ArticleViewerControllerWithOptionalParamIntegrationTest.java @@ -12,8 +12,6 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import org.springframework.test.web.servlet.result.MockMvcResultMatchers; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; - -import com.baeldung.model.Article; import org.baeldung.controller.config.WebConfig; @RunWith(SpringJUnit4ClassRunner.class) diff --git a/spring-mvc-basics-2/src/test/java/com/baeldung/controller/optionalpathvars/ArticleViewerControllerWithRequiredAttributeIntegrationTest.java b/spring-mvc-basics-2/src/test/java/com/baeldung/controller/optionalpathvars/ArticleViewerControllerWithRequiredAttributeIntegrationTest.java index 00494171c0..760d94af17 100644 --- a/spring-mvc-basics-2/src/test/java/com/baeldung/controller/optionalpathvars/ArticleViewerControllerWithRequiredAttributeIntegrationTest.java +++ b/spring-mvc-basics-2/src/test/java/com/baeldung/controller/optionalpathvars/ArticleViewerControllerWithRequiredAttributeIntegrationTest.java @@ -12,8 +12,6 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import org.springframework.test.web.servlet.result.MockMvcResultMatchers; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; - -import com.baeldung.model.Article; import org.baeldung.controller.config.WebConfig; @RunWith(SpringJUnit4ClassRunner.class) diff --git a/spring-mvc-basics-2/src/test/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithMapParamIntegrationTest.java b/spring-mvc-basics-2/src/test/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithMapParamIntegrationTest.java index 3c82b11578..fca6bba5fd 100644 --- a/spring-mvc-basics-2/src/test/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithMapParamIntegrationTest.java +++ b/spring-mvc-basics-2/src/test/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithMapParamIntegrationTest.java @@ -12,8 +12,6 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import org.springframework.test.web.servlet.result.MockMvcResultMatchers; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; - -import com.baeldung.model.Article; import org.baeldung.controller.config.WebConfig; @RunWith(SpringJUnit4ClassRunner.class) diff --git a/spring-mvc-basics-2/src/test/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithTwoSeparateMethodsIntegrationTest.java b/spring-mvc-basics-2/src/test/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithTwoSeparateMethodsIntegrationTest.java index 9532270c43..5d2733ec92 100644 --- a/spring-mvc-basics-2/src/test/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithTwoSeparateMethodsIntegrationTest.java +++ b/spring-mvc-basics-2/src/test/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithTwoSeparateMethodsIntegrationTest.java @@ -12,8 +12,6 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import org.springframework.test.web.servlet.result.MockMvcResultMatchers; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; - -import com.baeldung.model.Article; import org.baeldung.controller.config.WebConfig; @RunWith(SpringJUnit4ClassRunner.class) diff --git a/spring-mvc-basics/README.md b/spring-mvc-basics/README.md index 0855015e70..a995c89a07 100644 --- a/spring-mvc-basics/README.md +++ b/spring-mvc-basics/README.md @@ -17,3 +17,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Using Spring @ResponseStatus to Set HTTP Status Code](https://www.baeldung.com/spring-response-status) - [Spring MVC and the @ModelAttribute Annotation](https://www.baeldung.com/spring-mvc-and-the-modelattribute-annotation) - [The HttpMediaTypeNotAcceptableException in Spring MVC](https://www.baeldung.com/spring-httpmediatypenotacceptable) +- [[Next -->]](/spring-mvc-basics-2) \ No newline at end of file diff --git a/spring-mvc-basics/pom.xml b/spring-mvc-basics/pom.xml index 8c52c60b65..ab6d200e67 100644 --- a/spring-mvc-basics/pom.xml +++ b/spring-mvc-basics/pom.xml @@ -1,17 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-mvc-basics</artifactId> <version>0.1-SNAPSHOT</version> <name>spring-mvc-basics</name> <packaging>jar</packaging> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -50,5 +49,6 @@ </plugin> </plugins> </build> + </project> diff --git a/spring-mvc-basics/src/test/java/com/baeldung/SpringContextIntegrationTest.java b/spring-mvc-basics/src/test/java/com/baeldung/SpringContextTest.java similarity index 83% rename from spring-mvc-basics/src/test/java/com/baeldung/SpringContextIntegrationTest.java rename to spring-mvc-basics/src/test/java/com/baeldung/SpringContextTest.java index 2feb9efce1..f475e5d626 100644 --- a/spring-mvc-basics/src/test/java/com/baeldung/SpringContextIntegrationTest.java +++ b/spring-mvc-basics/src/test/java/com/baeldung/SpringContextTest.java @@ -4,7 +4,7 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest -public class SpringContextIntegrationTest { +public class SpringContextTest { @Test public void whenSpringContextIsBootstrapped_thenNoExceptions() { diff --git a/spring-mvc-forms-jsp/pom.xml b/spring-mvc-forms-jsp/pom.xml index 5ce2d19414..2bab93908f 100644 --- a/spring-mvc-forms-jsp/pom.xml +++ b/spring-mvc-forms-jsp/pom.xml @@ -1,9 +1,7 @@ <?xml version="1.0"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <version>0.1-SNAPSHOT</version> <artifactId>spring-mvc-forms-jsp</artifactId> <name>spring-mvc-forms-jsp</name> @@ -64,11 +62,11 @@ <version>${jackson.version}</version> </dependency> <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <version>1.5.10.RELEASE</version> - <scope>test</scope> - </dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <version>1.5.10.RELEASE</version> + <scope>test</scope> + </dependency> </dependencies> <profiles> diff --git a/spring-mvc-forms-jsp/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-mvc-forms-jsp/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index c1e9b71550..0000000000 --- a/spring-mvc-forms-jsp/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.baeldung; - -import com.baeldung.springmvcforms.configuration.ApplicationConfiguration; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = ApplicationConfiguration.class) -@WebAppConfiguration -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-mvc-forms-thymeleaf/pom.xml b/spring-mvc-forms-thymeleaf/pom.xml index 99bf465b44..2aed7f70ad 100644 --- a/spring-mvc-forms-thymeleaf/pom.xml +++ b/spring-mvc-forms-thymeleaf/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-mvc-forms-thymeleaf</artifactId> <name>spring-mvc-forms-thymeleaf</name> @@ -8,8 +8,8 @@ <description>spring forms examples using thymeleaf</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -41,4 +41,5 @@ <thymeleaf.version>3.0.9.RELEASE</thymeleaf.version> <start-class>com.baeldung.sessionattrs.SessionAttrsApplication</start-class> </properties> + </project> diff --git a/spring-mvc-forms-thymeleaf/src/test/java/org/baeldung/listbindingexample/SpringContextIntegrationTest.java b/spring-mvc-forms-thymeleaf/src/test/java/org/baeldung/listbindingexample/SpringContextIntegrationTest.java deleted file mode 100644 index da87a6830a..0000000000 --- a/spring-mvc-forms-thymeleaf/src/test/java/org/baeldung/listbindingexample/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung.listbindingexample; - -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.baeldung.listbindingexample.ListBindingApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = {ListBindingApplication.class}) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-mvc-forms-thymeleaf/src/test/java/org/baeldung/sessionattrs/SpringContextIntegrationTest.java b/spring-mvc-forms-thymeleaf/src/test/java/org/baeldung/sessionattrs/SpringContextIntegrationTest.java deleted file mode 100644 index e6b0dbf98c..0000000000 --- a/spring-mvc-forms-thymeleaf/src/test/java/org/baeldung/sessionattrs/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung.sessionattrs; - -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.baeldung.sessionattrs.SessionAttrsApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = {SessionAttrsApplication.class}) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-mvc-java/pom.xml b/spring-mvc-java/pom.xml index ea0acdcb00..7d0afd85ec 100644 --- a/spring-mvc-java/pom.xml +++ b/spring-mvc-java/pom.xml @@ -1,15 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-mvc-java</artifactId> <version>0.1-SNAPSHOT</version> <name>spring-mvc-java</name> <packaging>war</packaging> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -46,7 +46,7 @@ <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> - <version>${jackson.version}</version> + <version>${jackson.version}</version> </dependency> <!-- AOP --> @@ -188,7 +188,6 @@ </build> <profiles> - <profile> <id>live</id> <build> @@ -285,7 +284,6 @@ <javax.el.version>3.0.1-b09</javax.el.version> <start-class>com.baeldung.SpringMVCApplication</start-class> - </properties> </project> diff --git a/spring-mvc-java/src/main/java/com/baeldung/web/controller/MultipartFileUploadStubController.java b/spring-mvc-java/src/main/java/com/baeldung/web/controller/MultipartFileUploadStubController.java new file mode 100644 index 0000000000..28c35e8603 --- /dev/null +++ b/spring-mvc-java/src/main/java/com/baeldung/web/controller/MultipartFileUploadStubController.java @@ -0,0 +1,58 @@ +package com.baeldung.web.controller; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.multipart.MultipartFile; + +@Controller +public class MultipartFileUploadStubController { + + @PostMapping("/stub/multipart") + public ResponseEntity<UploadResultResource> uploadFile(MultipartFile file, String text, String text1, String text2, MultipartFile upstream) { + UploadResultResource result = new UploadResultResource(file, text, text1, text2, upstream); + return new ResponseEntity<>(result, HttpStatus.OK); + } + + public static class UploadResultResource { + + private final String file; + private final String text; + private final String text1; + private final String text2; + private final String upstream; + + public UploadResultResource(MultipartFile file, String text, String text1, String text2, MultipartFile upstream) { + this.file = format(file); + this.text = text; + this.text1 = text1; + this.text2 = text2; + this.upstream = format(upstream); + } + + private static String format(MultipartFile file) { + return file == null ? null : file.getOriginalFilename() + " (size: " + file.getSize() + " bytes)"; + } + + public String getFile() { + return file; + } + + public String getText() { + return text; + } + + public String getText1() { + return text1; + } + + public String getText2() { + return text2; + } + + public String getUpstream() { + return upstream; + } + } +} diff --git a/spring-mvc-java/src/test/java/com/baeldung/SpringContextIntegrationTest.java b/spring-mvc-java/src/test/java/com/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index ae91d4dc1e..0000000000 --- a/spring-mvc-java/src/test/java/com/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.config.TestConfig; - -@RunWith(SpringRunner.class) -@ContextConfiguration(classes = {TestConfig.class}) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - - } -} diff --git a/spring-mvc-kotlin/pom.xml b/spring-mvc-kotlin/pom.xml index fb1f242644..30d2c32ecf 100644 --- a/spring-mvc-kotlin/pom.xml +++ b/spring-mvc-kotlin/pom.xml @@ -1,82 +1,82 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <artifactId>spring-mvc-kotlin</artifactId> - <name>spring-mvc-kotlin</name> - <packaging>war</packaging> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>spring-mvc-kotlin</artifactId> + <name>spring-mvc-kotlin</name> + <packaging>war</packaging> - <parent> - <artifactId>parent-kotlin</artifactId> - <groupId>com.baeldung</groupId> - <version>1.0.0-SNAPSHOT</version> - <relativePath>../parent-kotlin</relativePath> - </parent> + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-kotlin</artifactId> + <version>1.0.0-SNAPSHOT</version> + <relativePath>../parent-kotlin</relativePath> + </parent> - <dependencies> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-json</artifactId> - </dependency> - <dependency> - <groupId>org.thymeleaf</groupId> - <artifactId>thymeleaf</artifactId> - </dependency> - <dependency> - <groupId>org.thymeleaf</groupId> - <artifactId>thymeleaf-spring4</artifactId> - <version>${thymeleaf.version}</version> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-core</artifactId> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-testing</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>com.h2database</groupId> - <artifactId>h2</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> - </dependencies> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-json</artifactId> + </dependency> + <dependency> + <groupId>org.thymeleaf</groupId> + <artifactId>thymeleaf</artifactId> + </dependency> + <dependency> + <groupId>org.thymeleaf</groupId> + <artifactId>thymeleaf-spring4</artifactId> + <version>${thymeleaf.version}</version> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-core</artifactId> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-testing</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + </dependencies> - <build> - <plugins> - <plugin> - <artifactId>kotlin-maven-plugin</artifactId> - <groupId>org.jetbrains.kotlin</groupId> - <version>${kotlin.version}</version> - <configuration> - <compilerPlugins> - <plugin>spring</plugin> - <plugin>jpa</plugin> - </compilerPlugins> - </configuration> - <dependencies> - <dependency> - <groupId>org.jetbrains.kotlin</groupId> - <artifactId>kotlin-maven-noarg</artifactId> - <version>${kotlin.version}</version> - </dependency> - </dependencies> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <artifactId>kotlin-maven-plugin</artifactId> + <groupId>org.jetbrains.kotlin</groupId> + <version>${kotlin.version}</version> + <configuration> + <compilerPlugins> + <plugin>spring</plugin> + <plugin>jpa</plugin> + </compilerPlugins> + </configuration> + <dependencies> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-maven-noarg</artifactId> + <version>${kotlin.version}</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> - <properties> - <thymeleaf.version>3.0.7.RELEASE</thymeleaf.version> - </properties> + <properties> + <thymeleaf.version>3.0.7.RELEASE</thymeleaf.version> + </properties> </project> \ No newline at end of file diff --git a/spring-mvc-simple-2/pom.xml b/spring-mvc-simple-2/pom.xml index 7faa832552..307e8bc94b 100644 --- a/spring-mvc-simple-2/pom.xml +++ b/spring-mvc-simple-2/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-mvc-simple-2</artifactId> <name>spring-mvc-simple-2</name> @@ -8,8 +8,8 @@ <description>Demo project for Spring Boot</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -20,7 +20,7 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> - + <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> @@ -78,7 +78,7 @@ <artifactId>spring-cloud-context</artifactId> <version>${springcloud.version}</version> </dependency> - + <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> @@ -135,7 +135,7 @@ </build> </profile> </profiles> - + <properties> <!-- The main class to start by executing java -jar --> <start-class>org.baeldung.boot.Application</start-class> diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/form_submission/Application.java b/spring-mvc-simple-2/src/main/java/com/baeldung/form_submission/Application.java new file mode 100644 index 0000000000..34c14141b0 --- /dev/null +++ b/spring-mvc-simple-2/src/main/java/com/baeldung/form_submission/Application.java @@ -0,0 +1,14 @@ +package com.baeldung.form_submission; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; + +@SpringBootApplication +public class Application extends SpringBootServletInitializer { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/form_submission/controllers/FeedbackForm.java b/spring-mvc-simple-2/src/main/java/com/baeldung/form_submission/controllers/FeedbackForm.java new file mode 100644 index 0000000000..791fc75cef --- /dev/null +++ b/spring-mvc-simple-2/src/main/java/com/baeldung/form_submission/controllers/FeedbackForm.java @@ -0,0 +1,42 @@ +package com.baeldung.form_submission.controllers; + +import com.baeldung.form_submission.model.Feedback; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.util.MultiValueMap; +import org.springframework.web.bind.annotation.*; + +@Controller +public class FeedbackForm { + + @GetMapping(path = "/feedback") + public String getFeedbackForm(Model model) { + Feedback feedback = new Feedback(); + model.addAttribute("feedback", feedback); + return "feedback"; + } + + @PostMapping( + path = "/web/feedback", + consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE}) + public String handleBrowserSubmissions(Feedback feedback) throws Exception { + // Save feedback data + return "redirect:/feedback/success"; + } + + @GetMapping("/feedback/success") + public ResponseEntity<String> getSuccess() { + return new ResponseEntity<String>("Thank you for submitting feedback.", HttpStatus.OK); + } + + @PostMapping( + path = "/feedback", + consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE}) + public ResponseEntity<String> handleNonBrowserSubmissions(@RequestParam MultiValueMap paramMap) throws Exception { + // Save feedback data + return new ResponseEntity<String>("Thank you for submitting feedback", HttpStatus.OK); + } +} \ No newline at end of file diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/form_submission/model/Feedback.java b/spring-mvc-simple-2/src/main/java/com/baeldung/form_submission/model/Feedback.java new file mode 100644 index 0000000000..f8d416460c --- /dev/null +++ b/spring-mvc-simple-2/src/main/java/com/baeldung/form_submission/model/Feedback.java @@ -0,0 +1,23 @@ +package com.baeldung.form_submission.model; + +public class Feedback { + private String emailId; + private String comment; + + public String getEmailId() { + return this.emailId; + } + + public void setEmailId(String emailId) { + this.emailId = emailId; + } + + public String getComment() { + return this.comment; + } + + public void setComment(String comment) { + this.comment = comment; + } + +} diff --git a/spring-core-2/src/main/java/org/baeldung/cachedrequest/CachedBodyHttpServletRequest.java b/spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/CachedBodyHttpServletRequest.java similarity index 100% rename from spring-core-2/src/main/java/org/baeldung/cachedrequest/CachedBodyHttpServletRequest.java rename to spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/CachedBodyHttpServletRequest.java diff --git a/spring-core-2/src/main/java/org/baeldung/cachedrequest/CachedBodyServletInputStream.java b/spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/CachedBodyServletInputStream.java similarity index 100% rename from spring-core-2/src/main/java/org/baeldung/cachedrequest/CachedBodyServletInputStream.java rename to spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/CachedBodyServletInputStream.java diff --git a/spring-core-2/src/main/java/org/baeldung/cachedrequest/ContentCachingFilter.java b/spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/ContentCachingFilter.java similarity index 100% rename from spring-core-2/src/main/java/org/baeldung/cachedrequest/ContentCachingFilter.java rename to spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/ContentCachingFilter.java diff --git a/spring-core-2/src/main/java/org/baeldung/cachedrequest/HttpRequestDemoConfig.java b/spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/HttpRequestDemoConfig.java similarity index 100% rename from spring-core-2/src/main/java/org/baeldung/cachedrequest/HttpRequestDemoConfig.java rename to spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/HttpRequestDemoConfig.java diff --git a/spring-core-2/src/main/java/org/baeldung/cachedrequest/Person.java b/spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/Person.java similarity index 100% rename from spring-core-2/src/main/java/org/baeldung/cachedrequest/Person.java rename to spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/Person.java diff --git a/spring-core-2/src/main/java/org/baeldung/cachedrequest/PersonController.java b/spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/PersonController.java similarity index 100% rename from spring-core-2/src/main/java/org/baeldung/cachedrequest/PersonController.java rename to spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/PersonController.java diff --git a/spring-core-2/src/main/java/org/baeldung/cachedrequest/PrintRequestContentFilter.java b/spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/PrintRequestContentFilter.java similarity index 100% rename from spring-core-2/src/main/java/org/baeldung/cachedrequest/PrintRequestContentFilter.java rename to spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/PrintRequestContentFilter.java diff --git a/spring-mvc-simple-2/src/main/resources/templates/feedback.html b/spring-mvc-simple-2/src/main/resources/templates/feedback.html new file mode 100644 index 0000000000..4b6a487fc2 --- /dev/null +++ b/spring-mvc-simple-2/src/main/resources/templates/feedback.html @@ -0,0 +1,41 @@ +<!DOCTYPE HTML> +<html xmlns:th="http://www.thymeleaf.org"> +<head> + <title>Poetry Contest: Submission</title> +</head> +<body> + +<form action="#" method="post" th:action="@{/web/feedback}" th:object="${feedback}"> + + <table border='0' cellpadding='2' cellspacing='2' width='480px'> + + <tr> + <td align='center'> + <label for="email">Email:</label> + </td> + <td> + <input th:field=*{emailId} type="text"/> + </td> + </tr> + + <tr> + <td align='center'> + <label for="comment">Comment:</label> + </td> + <td> + <textarea cols="30" rows="30" th:field=*{comment}/> + </td> + </tr> + + <tr> + <td align='center'> + <input type="submit" value="Submit Feedback"> + </td> + </tr> + + + </table> +</form> + +</body> +</html> \ No newline at end of file diff --git a/spring-core-2/src/test/java/org/baeldung/cachedrequest/CachedBodyHttpServletRequestUnitTest.java b/spring-mvc-simple-2/src/test/java/org/baeldung/cachedrequest/CachedBodyHttpServletRequestUnitTest.java similarity index 100% rename from spring-core-2/src/test/java/org/baeldung/cachedrequest/CachedBodyHttpServletRequestUnitTest.java rename to spring-mvc-simple-2/src/test/java/org/baeldung/cachedrequest/CachedBodyHttpServletRequestUnitTest.java diff --git a/spring-core-2/src/test/java/org/baeldung/cachedrequest/CachedBodyServletInputStreamUnitTest.java b/spring-mvc-simple-2/src/test/java/org/baeldung/cachedrequest/CachedBodyServletInputStreamUnitTest.java similarity index 100% rename from spring-core-2/src/test/java/org/baeldung/cachedrequest/CachedBodyServletInputStreamUnitTest.java rename to spring-mvc-simple-2/src/test/java/org/baeldung/cachedrequest/CachedBodyServletInputStreamUnitTest.java diff --git a/spring-core-2/src/test/java/org/baeldung/cachedrequest/ContentCachingFilterUnitTest.java b/spring-mvc-simple-2/src/test/java/org/baeldung/cachedrequest/ContentCachingFilterUnitTest.java similarity index 100% rename from spring-core-2/src/test/java/org/baeldung/cachedrequest/ContentCachingFilterUnitTest.java rename to spring-mvc-simple-2/src/test/java/org/baeldung/cachedrequest/ContentCachingFilterUnitTest.java diff --git a/spring-mvc-simple-2/src/test/java/org/baeldung/cachedrequest/PersonControllerIntegrationTest.java b/spring-mvc-simple-2/src/test/java/org/baeldung/cachedrequest/PersonControllerIntegrationTest.java new file mode 100644 index 0000000000..046a310cc0 --- /dev/null +++ b/spring-mvc-simple-2/src/test/java/org/baeldung/cachedrequest/PersonControllerIntegrationTest.java @@ -0,0 +1,64 @@ +package org.baeldung.cachedrequest; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.web.AnnotationConfigWebContextLoader; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.ResultActions; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; + +import java.io.IOException; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +@RunWith(SpringRunner.class) +@ContextConfiguration(loader = AnnotationConfigWebContextLoader.class, classes = { HttpRequestDemoConfig.class, ContentCachingFilter.class, PrintRequestContentFilter.class, PersonController.class }) +@WebAppConfiguration +public class PersonControllerIntegrationTest { + + @Autowired + private WebApplicationContext wac; + + private MockMvc mockMvc; + + ObjectMapper objectMapper = new ObjectMapper(); + + @Autowired + private ContentCachingFilter contentCachingFilter; + + @Autowired + private PrintRequestContentFilter printRequestContentFilter; + + @Before + public void setup() throws Exception { + + this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac) + .addFilter(contentCachingFilter, "/**") + .addFilter(printRequestContentFilter, "/**") + .build(); + } + + @Test + public void whenValidInput_thenCreateBook() throws IOException, Exception { + // assign - given + Person person = new Person("sumit", "abc", 100); + + // act - when + ResultActions result = mockMvc.perform(post("/person").accept(MediaType.APPLICATION_JSON) + .contentType(MediaType.APPLICATION_JSON) + .content(objectMapper.writeValueAsString(person))); + + // assert - then + result.andExpect(status().isNoContent()); + } + +} diff --git a/spring-core-2/src/test/java/org/baeldung/cachedrequest/PrintRequestContentFilterUnitTest.java b/spring-mvc-simple-2/src/test/java/org/baeldung/cachedrequest/PrintRequestContentFilterUnitTest.java similarity index 100% rename from spring-core-2/src/test/java/org/baeldung/cachedrequest/PrintRequestContentFilterUnitTest.java rename to spring-mvc-simple-2/src/test/java/org/baeldung/cachedrequest/PrintRequestContentFilterUnitTest.java diff --git a/spring-mvc-simple/pom.xml b/spring-mvc-simple/pom.xml index 580a40e50b..539e81307a 100644 --- a/spring-mvc-simple/pom.xml +++ b/spring-mvc-simple/pom.xml @@ -1,10 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-mvc-simple</artifactId> - <packaging>war</packaging> <version>0.0.1-SNAPSHOT</version> <name>spring-mvc-simple</name> + <packaging>war</packaging> <parent> <groupId>com.baeldung</groupId> @@ -131,15 +132,16 @@ <artifactId>json</artifactId> <version>${json.version}</version> </dependency> - <dependency> - <groupId>org.apache.maven.surefire</groupId> - <artifactId>surefire-logger-api</artifactId> - <version>${maven-surefire-plugin.version}</version> - <!-- to get around bug https://github.com/junit-team/junit5/issues/1367 --> - <scope>test</scope> - <optional>true</optional> - </dependency> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-logger-api</artifactId> + <version>${maven-surefire-plugin.version}</version> + <!-- to get around bug https://github.com/junit-team/junit5/issues/1367 --> + <scope>test</scope> + <optional>true</optional> + </dependency> </dependencies> + <build> <pluginManagement> <plugins> diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/requestparam/RequestParamController.java b/spring-mvc-simple/src/main/java/com/baeldung/spring/requestparam/RequestParamController.java index bcb1fe5a82..eb445f7801 100644 --- a/spring-mvc-simple/src/main/java/com/baeldung/spring/requestparam/RequestParamController.java +++ b/spring-mvc-simple/src/main/java/com/baeldung/spring/requestparam/RequestParamController.java @@ -2,6 +2,7 @@ package com.baeldung.spring.requestparam; import java.util.List; import java.util.Map; +import java.util.Optional; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; @@ -31,6 +32,12 @@ public class RequestParamController { public String getFoos2(@RequestParam(required = false) String id){ return "ID: " + id; } + + @GetMapping("/api/foosOptional") + @ResponseBody + public String getFoosOptional(@RequestParam Optional<String> id){ + return "ID: " + id.orElseGet(() -> "not provided"); + } @GetMapping("/api/foos3") @ResponseBody diff --git a/spring-mvc-simple/src/test/java/com/baeldung/SpringContextIntegrationTest.java b/spring-mvc-simple/src/test/java/com/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 994c4865f7..0000000000 --- a/spring-mvc-simple/src/test/java/com/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; - -import com.baeldung.spring.configuration.ApplicationConfiguration; - - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes={ApplicationConfiguration.class}) -@WebAppConfiguration -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} - diff --git a/spring-mvc-velocity/pom.xml b/spring-mvc-velocity/pom.xml index 5954e48e8f..2269f05fa4 100644 --- a/spring-mvc-velocity/pom.xml +++ b/spring-mvc-velocity/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-mvc-velocity</artifactId> <version>0.1-SNAPSHOT</version> @@ -104,7 +105,6 @@ </build> <properties> - <!-- testing --> <powermock.version>1.6.6</powermock.version> @@ -117,7 +117,6 @@ <!-- Maven plugins --> <maven-resources-plugin.version>2.7</maven-resources-plugin.version> <cargo-maven2-plugin.version>1.6.1</cargo-maven2-plugin.version> - </properties> </project> \ No newline at end of file diff --git a/spring-mvc-velocity/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-mvc-velocity/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 3649332870..0000000000 --- a/spring-mvc-velocity/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; - -import com.baeldung.mvc.velocity.spring.config.WebConfig; -import com.baeldung.mvc.velocity.test.config.TestConfig; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { TestConfig.class, WebConfig.class }) -@WebAppConfiguration -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-mvc-views/pom.xml b/spring-mvc-views/pom.xml new file mode 100644 index 0000000000..b23403fe31 --- /dev/null +++ b/spring-mvc-views/pom.xml @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>spring-mvc-views</artifactId> + <packaging>war</packaging> + <name>spring-mvc-views</name> + + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-spring-5</artifactId> + <version>0.0.1-SNAPSHOT</version> + <relativePath>../parent-spring-5</relativePath> + </parent> + + <dependencies> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-webmvc</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet-api</artifactId> + <version>${javax.servlet-api.version}</version> + </dependency> + <dependency> + <groupId>javax.servlet.jsp</groupId> + <artifactId>javax.servlet.jsp-api</artifactId> + <version>${javax.servlet.jsp-api.version}</version> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>jstl</artifactId> + <version>${jstl.version}</version> + </dependency> + <dependency> + <groupId>org.springframework.data</groupId> + <artifactId>spring-data-jpa</artifactId> + <version>${spring.data.version}</version> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-core</artifactId> + <version>${hibernate.version}</version> + </dependency> + + <dependency> + <groupId>org.hsqldb</groupId> + <artifactId>hsqldb</artifactId> + <version>${hsqldb.version}</version> + </dependency> + + <dependency> + <groupId>org.springframework.security</groupId> + <artifactId>spring-security-web</artifactId> + <version>${spring.security.version}</version> + </dependency> + + <dependency> + <groupId>org.springframework.security</groupId> + <artifactId>spring-security-config</artifactId> + <version>${spring.security.version}</version> + </dependency> + + <dependency> + <groupId>org.springframework.security</groupId> + <artifactId>spring-security-taglibs</artifactId> + <version>${spring.security.version}</version> + </dependency> + + </dependencies> + + <build> + <finalName>spring-mvc-views</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>2.0.2</version> + <configuration> + <source>${java.version}</source> + <target>${java.version}</target> + </configuration> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <version>${maven-war-plugin.version}</version> + <configuration> + <warSourceDirectory>src/main/webapp</warSourceDirectory> + <warName>spring-mvc-views</warName> + <failOnMissingWebXml>false</failOnMissingWebXml> + <outputDirectory>${deploy-path}</outputDirectory> + </configuration> + </plugin> + </plugins> + </build> + + <properties> + <java.version>1.8</java.version> + <javax.servlet.jsp-api.version>2.3.3</javax.servlet.jsp-api.version> + <javax.servlet-api.version>4.0.1</javax.servlet-api.version> + <spring.version>5.2.1.RELEASE</spring.version> + <spring.security.version>5.2.1.RELEASE</spring.security.version> + <spring.data.version>2.2.2.RELEASE</spring.data.version> + <cglib.version>2.2.2</cglib.version> + <hsqldb.version>2.5.0</hsqldb.version> + <hibernate.version>5.4.9.Final</hibernate.version> + <deploy-path>enter-location-of-server</deploy-path> + </properties> + +</project> \ No newline at end of file diff --git a/spring-mvc-views/src/main/java/com/baeldung/config/DataSourceConfig.java b/spring-mvc-views/src/main/java/com/baeldung/config/DataSourceConfig.java new file mode 100644 index 0000000000..803c30f29d --- /dev/null +++ b/spring-mvc-views/src/main/java/com/baeldung/config/DataSourceConfig.java @@ -0,0 +1,44 @@ +package com.baeldung.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; +import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; +import org.springframework.transaction.PlatformTransactionManager; + +import javax.persistence.EntityManagerFactory; +import javax.sql.DataSource; + +@EnableJpaRepositories(basePackages = "com.baeldung") +public class DataSourceConfig { + @Bean + public DataSource dataSource() { + EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder(); + return builder.setType(EmbeddedDatabaseType.HSQL) + .addScripts("db/sql/create-db.sql", "db/sql/insert-data.sql") + .build(); + } + + @Bean + public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource) { + LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); + em.setDataSource(dataSource); + em.setPackagesToScan("com.baeldung.domain"); + em.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); + return em; + } + + @Bean + public PlatformTransactionManager transactionManager(EntityManagerFactory emf) { + return new JpaTransactionManager(emf); + } + + @Bean + public PersistenceExceptionTranslationPostProcessor exceptionTranslation(){ + return new PersistenceExceptionTranslationPostProcessor(); + } +} diff --git a/spring-mvc-views/src/main/java/com/baeldung/config/InitSecurity.java b/spring-mvc-views/src/main/java/com/baeldung/config/InitSecurity.java new file mode 100644 index 0000000000..2bf659f476 --- /dev/null +++ b/spring-mvc-views/src/main/java/com/baeldung/config/InitSecurity.java @@ -0,0 +1,6 @@ +package com.baeldung.config; + +import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer; + +public class InitSecurity extends AbstractSecurityWebApplicationInitializer { +} diff --git a/spring-mvc-views/src/main/java/com/baeldung/config/SecurityConfig.java b/spring-mvc-views/src/main/java/com/baeldung/config/SecurityConfig.java new file mode 100644 index 0000000000..2e0a413cf3 --- /dev/null +++ b/spring-mvc-views/src/main/java/com/baeldung/config/SecurityConfig.java @@ -0,0 +1,56 @@ +package com.baeldung.config; + +import org.springframework.beans.factory.annotation.Autowired; +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.builders.WebSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; + +import javax.sql.DataSource; + +@EnableWebSecurity +public class SecurityConfig extends WebSecurityConfigurerAdapter { + + @Autowired + DataSource dataSource; + + @Bean + public PasswordEncoder passwordEncoder() { + return new BCryptPasswordEncoder(); + } + + @Override + protected void configure(AuthenticationManagerBuilder auth) throws Exception { + auth.jdbcAuthentication() + .passwordEncoder(passwordEncoder()) + .dataSource(dataSource); + } + + @Override + protected void configure(HttpSecurity http) throws Exception { + + http.csrf() + .disable() + .authorizeRequests() + .antMatchers("/anonymous*").anonymous() + .antMatchers("/login*").permitAll() + .anyRequest().authenticated() + .and() + .formLogin() + .and() + .logout() + .logoutUrl("/logout.do") + .invalidateHttpSession(true) + .clearAuthentication(true); + } + + @Override + public void configure(WebSecurity web) throws Exception { + web.ignoring().antMatchers("/themes/**"); + } + +} diff --git a/spring-mvc-views/src/main/java/com/baeldung/config/ThemeMVCConfig.java b/spring-mvc-views/src/main/java/com/baeldung/config/ThemeMVCConfig.java new file mode 100644 index 0000000000..86f6f54195 --- /dev/null +++ b/spring-mvc-views/src/main/java/com/baeldung/config/ThemeMVCConfig.java @@ -0,0 +1,53 @@ +package com.baeldung.config; + +import com.baeldung.theme.resolver.UserPreferenceThemeResolver; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.ui.context.support.ResourceBundleThemeSource; +import org.springframework.web.servlet.ThemeResolver; +import org.springframework.web.servlet.config.annotation.*; +import org.springframework.web.servlet.theme.ThemeChangeInterceptor; + +@Configuration +@ComponentScan(basePackages="com.baeldung") +@EnableWebMvc +public class ThemeMVCConfig implements WebMvcConfigurer { + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + registry.addResourceHandler("/themes/**").addResourceLocations("classpath:/themes/"); + } + + @Override + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(themeChangeInterceptor()); + } + + @Bean + public ThemeChangeInterceptor themeChangeInterceptor() { + ThemeChangeInterceptor interceptor = new ThemeChangeInterceptor(); + interceptor.setParamName("theme"); + return interceptor; + } + + @Bean + public ResourceBundleThemeSource resourceBundleThemeSource() { + ResourceBundleThemeSource themeSource = new ResourceBundleThemeSource(); + themeSource.setFallbackToSystemLocale(true); + return themeSource; + } + + @Bean + public ThemeResolver themeResolver() { + UserPreferenceThemeResolver themeResolver = new UserPreferenceThemeResolver(); + themeResolver.setDefaultThemeName("light"); + return themeResolver; + } + + + @Override + public void configureViewResolvers(ViewResolverRegistry resolverRegistry) { + resolverRegistry.jsp(); + } +} diff --git a/spring-mvc-views/src/main/java/com/baeldung/config/WebInitializer.java b/spring-mvc-views/src/main/java/com/baeldung/config/WebInitializer.java new file mode 100644 index 0000000000..5516fb7b3c --- /dev/null +++ b/spring-mvc-views/src/main/java/com/baeldung/config/WebInitializer.java @@ -0,0 +1,28 @@ +package com.baeldung.config; + +import org.springframework.web.WebApplicationInitializer; +import org.springframework.web.context.ContextLoaderListener; +import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; +import org.springframework.web.servlet.DispatcherServlet; + +import javax.servlet.ServletException; +import javax.servlet.ServletRegistration; + +public class WebInitializer implements WebApplicationInitializer { + @Override + public void onStartup(javax.servlet.ServletContext servletContext) throws ServletException { + AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); + context.register(DataSourceConfig.class); + context.register(ThemeMVCConfig.class); + + + servletContext.addListener(new ContextLoaderListener(context)); + servletContext.setInitParameter("spring.profiles.active", "database"); + + ServletRegistration.Dynamic servlet = servletContext.addServlet("dispatcher", new DispatcherServlet(context)); + + servlet.setLoadOnStartup(1); + servlet.addMapping("/"); + + } +} diff --git a/spring-mvc-views/src/main/java/com/baeldung/controllers/AppController.java b/spring-mvc-views/src/main/java/com/baeldung/controllers/AppController.java new file mode 100644 index 0000000000..31343492e1 --- /dev/null +++ b/spring-mvc-views/src/main/java/com/baeldung/controllers/AppController.java @@ -0,0 +1,13 @@ +package com.baeldung.controllers; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +public class AppController { + + @RequestMapping("/") + public String home() { + return "index"; + } +} diff --git a/spring-mvc-views/src/main/java/com/baeldung/domain/UserPreference.java b/spring-mvc-views/src/main/java/com/baeldung/domain/UserPreference.java new file mode 100644 index 0000000000..81034de947 --- /dev/null +++ b/spring-mvc-views/src/main/java/com/baeldung/domain/UserPreference.java @@ -0,0 +1,30 @@ +package com.baeldung.domain; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name = "preferences") +public class UserPreference { + @Id + private String username; + + private String theme; + + public String getTheme() { + return theme; + } + + public void setTheme(String theme) { + this.theme = theme; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } +} diff --git a/spring-mvc-views/src/main/java/com/baeldung/repository/UserPreferenceRepository.java b/spring-mvc-views/src/main/java/com/baeldung/repository/UserPreferenceRepository.java new file mode 100644 index 0000000000..77e5da0498 --- /dev/null +++ b/spring-mvc-views/src/main/java/com/baeldung/repository/UserPreferenceRepository.java @@ -0,0 +1,7 @@ +package com.baeldung.repository; + +import com.baeldung.domain.UserPreference; +import org.springframework.data.repository.PagingAndSortingRepository; + +public interface UserPreferenceRepository extends PagingAndSortingRepository<UserPreference, String> { +} diff --git a/spring-mvc-views/src/main/java/com/baeldung/theme/resolver/UserPreferenceThemeResolver.java b/spring-mvc-views/src/main/java/com/baeldung/theme/resolver/UserPreferenceThemeResolver.java new file mode 100644 index 0000000000..4c59734d41 --- /dev/null +++ b/spring-mvc-views/src/main/java/com/baeldung/theme/resolver/UserPreferenceThemeResolver.java @@ -0,0 +1,74 @@ +package com.baeldung.theme.resolver; + +import com.baeldung.domain.UserPreference; +import com.baeldung.repository.UserPreferenceRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.User; +import org.springframework.util.StringUtils; +import org.springframework.web.servlet.ThemeResolver; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Optional; + +public class UserPreferenceThemeResolver implements ThemeResolver { + + public static final String THEME_REQUEST_ATTRIBUTE_NAME = UserPreferenceThemeResolver.class.getName() + ".THEME"; + + @Autowired(required = false) + Authentication authentication; + + @Autowired + UserPreferenceRepository userPreferenceRepository; + + private String defaultThemeName; + + public String getDefaultThemeName() { + return defaultThemeName; + } + + public void setDefaultThemeName(String defaultThemeName) { + this.defaultThemeName = defaultThemeName; + } + + @Override + public String resolveThemeName(HttpServletRequest request) { + String themeName = findThemeFromRequest(request).orElse(findUserPreferredTheme().orElse(getDefaultThemeName())); + request.setAttribute(THEME_REQUEST_ATTRIBUTE_NAME, themeName); + return themeName; + } + + private Optional<String> findUserPreferredTheme() { + Authentication authentication = SecurityContextHolder.getContext() + .getAuthentication(); + UserPreference userPreference = getUserPreference(authentication).orElse(new UserPreference()); + return Optional.ofNullable(userPreference.getTheme()); + } + + private Optional<String> findThemeFromRequest(HttpServletRequest request) { + return Optional.ofNullable((String) request.getAttribute(THEME_REQUEST_ATTRIBUTE_NAME)); + } + + private Optional<UserPreference> getUserPreference(Authentication authentication) { + return isAuthenticated(authentication) ? userPreferenceRepository.findById(((User) authentication.getPrincipal()).getUsername()) : Optional.empty(); + } + + private boolean isAuthenticated(Authentication authentication) { + return authentication != null && authentication.isAuthenticated(); + } + + @Override + public void setThemeName(HttpServletRequest request, HttpServletResponse response, String theme) { + Authentication authentication = SecurityContextHolder.getContext() + .getAuthentication(); + if (isAuthenticated(authentication)) { + request.setAttribute(THEME_REQUEST_ATTRIBUTE_NAME, theme); + UserPreference userPreference = getUserPreference(authentication).orElse(new UserPreference()); + userPreference.setUsername(((User) authentication.getPrincipal()).getUsername()); + userPreference.setTheme(StringUtils.hasText(theme) ? theme : null); + userPreferenceRepository.save(userPreference); + } + } +} diff --git a/spring-mvc-views/src/main/resources/dark.properties b/spring-mvc-views/src/main/resources/dark.properties new file mode 100644 index 0000000000..c82264da75 --- /dev/null +++ b/spring-mvc-views/src/main/resources/dark.properties @@ -0,0 +1,2 @@ +styleSheet=themes/black.css +background=black \ No newline at end of file diff --git a/spring-mvc-views/src/main/resources/dark_en_US.properties b/spring-mvc-views/src/main/resources/dark_en_US.properties new file mode 100644 index 0000000000..c82264da75 --- /dev/null +++ b/spring-mvc-views/src/main/resources/dark_en_US.properties @@ -0,0 +1,2 @@ +styleSheet=themes/black.css +background=black \ No newline at end of file diff --git a/spring-mvc-views/src/main/resources/db/sql/create-db.sql b/spring-mvc-views/src/main/resources/db/sql/create-db.sql new file mode 100644 index 0000000000..0a6fd5ad59 --- /dev/null +++ b/spring-mvc-views/src/main/resources/db/sql/create-db.sql @@ -0,0 +1,17 @@ +create table users ( + username varchar(50) not null primary key, + password varchar(256) not null, + enabled boolean not null +); + + +create table authorities ( + username varchar(50) not null, + authority varchar(50) not null +); + + +create table preferences ( + username varchar(50) not null, + theme varchar(50) +); \ No newline at end of file diff --git a/spring-mvc-views/src/main/resources/db/sql/insert-data.sql b/spring-mvc-views/src/main/resources/db/sql/insert-data.sql new file mode 100644 index 0000000000..7ddf684d9a --- /dev/null +++ b/spring-mvc-views/src/main/resources/db/sql/insert-data.sql @@ -0,0 +1,6 @@ +insert into users values('john', '$2a$10$cjcbIX/aLe12PpGZ.vQfweLiB7K1QTC5enTk3oD0deCMdtj2Sx.im', 1); +insert into users values('admin', '$2a$10$cjcbIX/aLe12PpGZ.vQfweLiB7K1QTC5enTk3oD0deCMdtj2Sx.im', 1); + +insert into authorities values('john', 'USER'); +insert into authorities values('admin', 'USER'); +insert into authorities values('admin', 'ADMIN'); \ No newline at end of file diff --git a/spring-mvc-views/src/main/resources/light.properties b/spring-mvc-views/src/main/resources/light.properties new file mode 100644 index 0000000000..f6e0d10b4c --- /dev/null +++ b/spring-mvc-views/src/main/resources/light.properties @@ -0,0 +1,2 @@ +styleSheet=themes/white.css +background=black \ No newline at end of file diff --git a/spring-mvc-views/src/main/resources/light_en_US.properties b/spring-mvc-views/src/main/resources/light_en_US.properties new file mode 100644 index 0000000000..f6e0d10b4c --- /dev/null +++ b/spring-mvc-views/src/main/resources/light_en_US.properties @@ -0,0 +1,2 @@ +styleSheet=themes/white.css +background=black \ No newline at end of file diff --git a/spring-mvc-views/src/main/resources/themes/black.css b/spring-mvc-views/src/main/resources/themes/black.css new file mode 100644 index 0000000000..8a44cd969f --- /dev/null +++ b/spring-mvc-views/src/main/resources/themes/black.css @@ -0,0 +1,8 @@ +body { + justify-content : center; + background-color : black; + color : white; + text-align : center; + margin-left : 15%; + margin-right : 15%; +} \ No newline at end of file diff --git a/spring-mvc-views/src/main/resources/themes/white.css b/spring-mvc-views/src/main/resources/themes/white.css new file mode 100644 index 0000000000..939bd1e4c9 --- /dev/null +++ b/spring-mvc-views/src/main/resources/themes/white.css @@ -0,0 +1,8 @@ +body { + justify-content : center; + background-color : white; + color : black; + text-align : center; + margin-left : 15%; + margin-right : 15%; +} \ No newline at end of file diff --git a/spring-mvc-views/src/main/webapp/WEB-INF/index.jsp b/spring-mvc-views/src/main/webapp/WEB-INF/index.jsp new file mode 100644 index 0000000000..b36c21eb71 --- /dev/null +++ b/spring-mvc-views/src/main/webapp/WEB-INF/index.jsp @@ -0,0 +1,46 @@ +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %> +<html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <link rel="stylesheet" href="<spring:theme code='styleSheet'/>"/> + <title>Themed Application</title> + </head> + <body> + <header> + <h1>Themed Application</h1> + <hr /> + </header> + <section> + <h2>Spring MVC Theme Demo</h2> + <security:authorize access="isAuthenticated()"> + <h4>User : <security:authentication property="principal.username" /></h4> + </security:authorize> + <form action="<c:url value='/'/>" method="POST" name="themeChangeForm" id="themeChangeForm"> + <div> + <h4> + Change Theme + </h4> + </div> + <select id="theme" name="theme" onChange="submitForm()"> + <option value="">Reset</option> + <option value="light">Light</option> + <option value="dark">Dark</option> + </select> + </form> + </section> + + <section> + <form action="<c:url value='/logout.do'/>" method="POST" name="logoutForm"> + <button type="submit" name="submit">Sign Out</button> + </form> + </section> + + <script> + function submitForm() { + document.themeChangeForm.submit(); + } + </script> + </body> +</html> diff --git a/spring-mvc-webflow/pom.xml b/spring-mvc-webflow/pom.xml index 219a2be689..5a6856385c 100644 --- a/spring-mvc-webflow/pom.xml +++ b/spring-mvc-webflow/pom.xml @@ -1,9 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> - <version>0.1-SNAPSHOT</version> <artifactId>spring-mvc-webflow</artifactId> + <version>0.1-SNAPSHOT</version> <name>spring-mvc-webflow</name> <packaging>war</packaging> @@ -52,14 +52,14 @@ <artifactId>log4j-over-slf4j</artifactId> <version>${org.slf4j.version}</version> </dependency> - + <!-- Test --> <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <version>1.5.10.RELEASE</version> - <scope>test</scope> - </dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <version>1.5.10.RELEASE</version> + <scope>test</scope> + </dependency> </dependencies> @@ -96,7 +96,6 @@ <!-- Maven plugins --> <maven-resources-plugin.version>2.7</maven-resources-plugin.version> <cargo-maven2-plugin.version>1.6.1</cargo-maven2-plugin.version> - </properties> </project> \ No newline at end of file diff --git a/spring-mvc-webflow/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-mvc-webflow/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 6f028c78d8..0000000000 --- a/spring-mvc-webflow/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.baeldung; - -import org.baeldung.spring.WebFlowConfig; -import org.baeldung.spring.WebMvcConfig; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = {WebFlowConfig.class, WebMvcConfig.class}) -@WebAppConfiguration -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-mvc-xml/pom.xml b/spring-mvc-xml/pom.xml index 9f7a24b358..e93b426119 100644 --- a/spring-mvc-xml/pom.xml +++ b/spring-mvc-xml/pom.xml @@ -1,9 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <version>0.1-SNAPSHOT</version> <artifactId>spring-mvc-xml</artifactId> + <version>0.1-SNAPSHOT</version> <name>spring-mvc-xml</name> <packaging>war</packaging> @@ -111,7 +112,6 @@ </plugin> </plugins> - </build> <properties> diff --git a/spring-mvc-xml/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-mvc-xml/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index ec34abd367..0000000000 --- a/spring-mvc-xml/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; - -import com.baeldung.spring.ClientWebConfig; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = ClientWebConfig.class) -@WebAppConfiguration -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-protobuf/pom.xml b/spring-protobuf/pom.xml index 372f969bd7..f43faef0d1 100644 --- a/spring-protobuf/pom.xml +++ b/spring-protobuf/pom.xml @@ -1,14 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-protobuf</artifactId> <version>0.1-SNAPSHOT</version> <name>spring-protobuf</name> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> diff --git a/spring-protobuf/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-protobuf/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 8315d0ff6c..0000000000 --- a/spring-protobuf/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.baeldung; - -import com.baeldung.protobuf.Application; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; - -@DirtiesContext -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-quartz/pom.xml b/spring-quartz/pom.xml index 4c7ac6eee9..283d1a1734 100644 --- a/spring-quartz/pom.xml +++ b/spring-quartz/pom.xml @@ -1,17 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-quartz</artifactId> <name>spring-quartz</name> <version>0.0.1-SNAPSHOT</version> - <description>Demo project for Scheduling in Spring with Quartz</description> <packaging>jar</packaging> + <description>Demo project for Scheduling in Spring with Quartz</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> diff --git a/spring-quartz/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-quartz/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index fec47f045c..0000000000 --- a/spring-quartz/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.baeldung; - -import org.baeldung.springquartz.SpringQuartzApp; -import org.baeldung.springquartz.basics.service.SampleJobService; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import static org.assertj.core.api.Assertions.assertThat; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringQuartzApp.class) -public class SpringContextIntegrationTest { - - @Autowired - private SampleJobService sampleJobService; - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } - - @Test - public void whenSchedulerStarts_thenJobsRun() throws InterruptedException { - assertThat(sampleJobService.getNumberOfInvocations()).isEqualTo(0); - Thread.sleep(SampleJobService.EXECUTION_TIME); - assertThat(sampleJobService.getNumberOfInvocations()).isEqualTo(1); - } -} diff --git a/spring-reactive-kotlin/pom.xml b/spring-reactive-kotlin/pom.xml index 90764111cb..3a693837df 100644 --- a/spring-reactive-kotlin/pom.xml +++ b/spring-reactive-kotlin/pom.xml @@ -1,57 +1,58 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <artifactId>spring-reactive-kotlin</artifactId> - <name>spring-reactive-kotlin</name> - <packaging>jar</packaging> - <description>Demo project for Spring Boot</description> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>spring-reactive-kotlin</artifactId> + <name>spring-reactive-kotlin</name> + <description>Demo project for Spring Boot</description> + <packaging>jar</packaging> - <parent> - <artifactId>parent-kotlin</artifactId> - <groupId>com.baeldung</groupId> - <version>1.0.0-SNAPSHOT</version> - <relativePath>../parent-kotlin</relativePath> - </parent> + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-kotlin</artifactId> + <version>1.0.0-SNAPSHOT</version> + <relativePath>../parent-kotlin</relativePath> + </parent> - <dependencies> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-webflux</artifactId> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.module</groupId> - <artifactId>jackson-module-kotlin</artifactId> - </dependency> - - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>io.projectreactor</groupId> - <artifactId>reactor-test</artifactId> - <scope>test</scope> - </dependency> - </dependencies> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-webflux</artifactId> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.module</groupId> + <artifactId>jackson-module-kotlin</artifactId> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>io.projectreactor</groupId> + <artifactId>reactor-test</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>kotlin-maven-plugin</artifactId> + <groupId>org.jetbrains.kotlin</groupId> + <version>${kotlin.version}</version> + <configuration> + <args> + <arg>-Xjsr305=strict</arg> + </args> + </configuration> + </plugin> + </plugins> + </build> - <build> - <plugins> - <plugin> - <artifactId>kotlin-maven-plugin</artifactId> - <groupId>org.jetbrains.kotlin</groupId> - <version>${kotlin.version}</version> - <configuration> - <args> - <arg>-Xjsr305=strict</arg> - </args> - </configuration> - </plugin> - </plugins> - </build> </project> diff --git a/spring-reactor/pom.xml b/spring-reactor/pom.xml index 2d69096c58..0115826fd6 100644 --- a/spring-reactor/pom.xml +++ b/spring-reactor/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-reactor</artifactId> <version>1.0-SNAPSHOT</version> <name>spring-reactor</name> @@ -9,8 +9,8 @@ <url>http://maven.apache.org</url> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -40,4 +40,5 @@ <spring-cloud-sleuth.version>2.0.2.RELEASE</spring-cloud-sleuth.version> <reactor.version>2.0.8.RELEASE</reactor.version> </properties> + </project> diff --git a/spring-reactor/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-reactor/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 7f906bdbcd..0000000000 --- a/spring-reactor/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.Application; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-remoting/pom.xml b/spring-remoting/pom.xml index e11c5b06f9..59cb9f863e 100644 --- a/spring-remoting/pom.xml +++ b/spring-remoting/pom.xml @@ -1,18 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-remoting</artifactId> <version>1.0-SNAPSHOT</version> <name>spring-remoting</name> - <description>Parent for all projects related to Spring Remoting, except remoting-hessian-burlap</description> <packaging>pom</packaging> + <description>Parent for all projects related to Spring Remoting, except remoting-hessian-burlap</description> <!-- remoting-hessian-burlap needs to stick to spring-boot-1, some classes were removed in spring 5 --> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> diff --git a/spring-remoting/remoting-amqp/pom.xml b/spring-remoting/remoting-amqp/pom.xml index 901ce69d6b..ea0b605980 100644 --- a/spring-remoting/remoting-amqp/pom.xml +++ b/spring-remoting/remoting-amqp/pom.xml @@ -1,13 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>remoting-amqp</artifactId> - <packaging>pom</packaging> <name>remoting-amqp</name> + <packaging>pom</packaging> <parent> - <artifactId>spring-remoting</artifactId> <groupId>com.baeldung</groupId> + <artifactId>spring-remoting</artifactId> <version>1.0-SNAPSHOT</version> </parent> diff --git a/spring-remoting/remoting-amqp/remoting-amqp-client/pom.xml b/spring-remoting/remoting-amqp/remoting-amqp-client/pom.xml index 40b2fa7965..17c5b31e62 100644 --- a/spring-remoting/remoting-amqp/remoting-amqp-client/pom.xml +++ b/spring-remoting/remoting-amqp/remoting-amqp-client/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -7,8 +8,8 @@ <url>http://maven.apache.org</url> <parent> - <artifactId>remoting-amqp</artifactId> <groupId>com.baeldung</groupId> + <artifactId>remoting-amqp</artifactId> <version>1.0-SNAPSHOT</version> </parent> @@ -29,4 +30,5 @@ <version>${project.version}</version> </dependency> </dependencies> + </project> diff --git a/spring-remoting/remoting-amqp/remoting-amqp-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-remoting/remoting-amqp/remoting-amqp-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 2de3ed94d1..0000000000 --- a/spring-remoting/remoting-amqp/remoting-amqp-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.client.AmqpClient; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = AmqpClient.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-remoting/remoting-amqp/remoting-amqp-server/pom.xml b/spring-remoting/remoting-amqp/remoting-amqp-server/pom.xml index e8eb665815..13d0c0a6da 100644 --- a/spring-remoting/remoting-amqp/remoting-amqp-server/pom.xml +++ b/spring-remoting/remoting-amqp/remoting-amqp-server/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>remoting-amqp-server</artifactId> <name>remoting-amqp-server</name> @@ -7,8 +8,8 @@ <url>http://maven.apache.org</url> <parent> - <artifactId>remoting-amqp</artifactId> <groupId>com.baeldung</groupId> + <artifactId>remoting-amqp</artifactId> <version>1.0-SNAPSHOT</version> </parent> diff --git a/spring-remoting/remoting-hessian-burlap/pom.xml b/spring-remoting/remoting-hessian-burlap/pom.xml index e94d1bee82..fac6e1cb2e 100644 --- a/spring-remoting/remoting-hessian-burlap/pom.xml +++ b/spring-remoting/remoting-hessian-burlap/pom.xml @@ -4,13 +4,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>remoting-hessian-burlap</artifactId> - <name>remoting-hessian-burlap</name> <version>1.0-SNAPSHOT</version> + <name>remoting-hessian-burlap</name> <packaging>pom</packaging> - - <parent> - <artifactId>parent-boot-1</artifactId> + + <parent> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-1</relativePath> </parent> @@ -19,4 +19,5 @@ <module>remoting-hessian-burlap-server</module> <module>remoting-hessian-burlap-client</module> </modules> + </project> \ No newline at end of file diff --git a/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-client/pom.xml b/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-client/pom.xml index ec237ca815..1f6181a365 100644 --- a/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-client/pom.xml +++ b/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-client/pom.xml @@ -5,13 +5,13 @@ <modelVersion>4.0.0</modelVersion> <artifactId>remoting-hessian-burlap-client</artifactId> <name>remoting-hessian-burlap-client</name> - - <parent> - <artifactId>remoting-hessian-burlap</artifactId> + + <parent> <groupId>com.baeldung</groupId> + <artifactId>remoting-hessian-burlap</artifactId> <version>1.0-SNAPSHOT</version> </parent> - + <dependencies> <dependency> <groupId>org.springframework.boot</groupId> @@ -58,4 +58,5 @@ </dependency> <!-- test --> </dependencies> + </project> \ No newline at end of file diff --git a/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 1aec444aa0..0000000000 --- a/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.client.BurlapClient; -import com.baeldung.client.HessianClient; - -@SpringBootTest(classes = {BurlapClient.class, HessianClient.class}) -@RunWith(SpringRunner.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-server/pom.xml b/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-server/pom.xml index fa16a9a9b1..6e4f2e81e4 100644 --- a/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-server/pom.xml +++ b/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-server/pom.xml @@ -4,11 +4,11 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>remoting-hessian-burlap-server</artifactId> - <name>remoting-hessian-burlap-server</name> - + <name>remoting-hessian-burlap-server</name> + <parent> - <artifactId>remoting-hessian-burlap</artifactId> <groupId>com.baeldung</groupId> + <artifactId>remoting-hessian-burlap</artifactId> <version>1.0-SNAPSHOT</version> </parent> diff --git a/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index f1aad1f601..0000000000 --- a/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.server.Server; - -@SpringBootTest(classes = Server.class) -@RunWith(SpringRunner.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-remoting/remoting-http/pom.xml b/spring-remoting/remoting-http/pom.xml index c4ed511bb5..2e5195a909 100644 --- a/spring-remoting/remoting-http/pom.xml +++ b/spring-remoting/remoting-http/pom.xml @@ -4,10 +4,10 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>remoting-http</artifactId> - <name>remoting-http</name> + <name>remoting-http</name> <packaging>pom</packaging> <description>Parent for all modules related to HTTP Spring Remoting.</description> - + <parent> <groupId>com.baeldung</groupId> <artifactId>spring-remoting</artifactId> @@ -19,4 +19,5 @@ <module>remoting-http-client</module> <module>remoting-http-api</module> </modules> + </project> \ No newline at end of file diff --git a/spring-remoting/remoting-http/remoting-http-api/pom.xml b/spring-remoting/remoting-http/remoting-http-api/pom.xml index 579255060d..697c3f44e5 100644 --- a/spring-remoting/remoting-http/remoting-http-api/pom.xml +++ b/spring-remoting/remoting-http/remoting-http-api/pom.xml @@ -6,10 +6,10 @@ <artifactId>remoting-http-api</artifactId> <name>remoting-http-api</name> <description>API definition shared between client and server.</description> - - <parent> - <artifactId>remoting-http</artifactId> + + <parent> <groupId>com.baeldung</groupId> + <artifactId>remoting-http</artifactId> <version>1.0-SNAPSHOT</version> </parent> diff --git a/spring-remoting/remoting-http/remoting-http-client/pom.xml b/spring-remoting/remoting-http/remoting-http-client/pom.xml index 56412d3cdf..03de2d3e4d 100644 --- a/spring-remoting/remoting-http/remoting-http-client/pom.xml +++ b/spring-remoting/remoting-http/remoting-http-client/pom.xml @@ -4,9 +4,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>remoting-http-client</artifactId> - <name>remoting-http-client</name> + <name>remoting-http-client</name> <description>Shows how to invoke a remote service using Spring Remoting HTTP.</description> - + <parent> <groupId>com.baeldung</groupId> <artifactId>remoting-http</artifactId> @@ -30,4 +30,5 @@ <version>${project.version}</version> </dependency> </dependencies> + </project> \ No newline at end of file diff --git a/spring-remoting/remoting-http/remoting-http-server/pom.xml b/spring-remoting/remoting-http/remoting-http-server/pom.xml index c3f87e776e..872688e683 100644 --- a/spring-remoting/remoting-http/remoting-http-server/pom.xml +++ b/spring-remoting/remoting-http/remoting-http-server/pom.xml @@ -4,9 +4,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>remoting-http-server</artifactId> - <name>remoting-http-server</name> + <name>remoting-http-server</name> <description>Shows how to expose a service using Spring Remoting HTTP.</description> - + <parent> <groupId>com.baeldung</groupId> <artifactId>remoting-http</artifactId> @@ -24,4 +24,5 @@ <version>${project.version}</version> </dependency> </dependencies> + </project> \ No newline at end of file diff --git a/spring-remoting/remoting-http/remoting-http-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-remoting/remoting-http/remoting-http-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index f1aad1f601..0000000000 --- a/spring-remoting/remoting-http/remoting-http-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.server.Server; - -@SpringBootTest(classes = Server.class) -@RunWith(SpringRunner.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-remoting/remoting-jms/pom.xml b/spring-remoting/remoting-jms/pom.xml index e24b5b7929..33299cd2c5 100644 --- a/spring-remoting/remoting-jms/pom.xml +++ b/spring-remoting/remoting-jms/pom.xml @@ -4,12 +4,12 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>remoting-jms</artifactId> - <name>remoting-jms</name> + <name>remoting-jms</name> <packaging>pom</packaging> <parent> - <artifactId>spring-remoting</artifactId> <groupId>com.baeldung</groupId> + <artifactId>spring-remoting</artifactId> <version>1.0-SNAPSHOT</version> </parent> diff --git a/spring-remoting/remoting-jms/remoting-jms-client/pom.xml b/spring-remoting/remoting-jms/remoting-jms-client/pom.xml index 043ced8527..d8b9701600 100644 --- a/spring-remoting/remoting-jms/remoting-jms-client/pom.xml +++ b/spring-remoting/remoting-jms/remoting-jms-client/pom.xml @@ -4,11 +4,11 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>remoting-jms-client</artifactId> - <name>remoting-jms-client</name> + <name>remoting-jms-client</name> <parent> - <artifactId>remoting-jms</artifactId> <groupId>com.baeldung</groupId> + <artifactId>remoting-jms</artifactId> <version>1.0-SNAPSHOT</version> </parent> diff --git a/spring-remoting/remoting-jms/remoting-jms-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-remoting/remoting-jms/remoting-jms-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index a94e639dc8..0000000000 --- a/spring-remoting/remoting-jms/remoting-jms-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.client.JmsClient; - -@SpringBootTest(classes = JmsClient.class) -@RunWith(SpringRunner.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-remoting/remoting-jms/remoting-jms-server/pom.xml b/spring-remoting/remoting-jms/remoting-jms-server/pom.xml index 13de66977a..5d6d63219d 100644 --- a/spring-remoting/remoting-jms/remoting-jms-server/pom.xml +++ b/spring-remoting/remoting-jms/remoting-jms-server/pom.xml @@ -4,11 +4,11 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>remoting-jms-server</artifactId> - <name>remoting-jms-server</name> - + <name>remoting-jms-server</name> + <parent> - <artifactId>remoting-jms</artifactId> <groupId>com.baeldung</groupId> + <artifactId>remoting-jms</artifactId> <version>1.0-SNAPSHOT</version> </parent> diff --git a/spring-remoting/remoting-rmi/pom.xml b/spring-remoting/remoting-rmi/pom.xml index 7b6e807550..037e73658e 100644 --- a/spring-remoting/remoting-rmi/pom.xml +++ b/spring-remoting/remoting-rmi/pom.xml @@ -4,17 +4,18 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>remoting-rmi</artifactId> - <name>remoting-rmi</name> + <name>remoting-rmi</name> <packaging>pom</packaging> - - <parent> - <artifactId>spring-remoting</artifactId> + + <parent> <groupId>com.baeldung</groupId> + <artifactId>spring-remoting</artifactId> <version>1.0-SNAPSHOT</version> </parent> - - <modules> + + <modules> <module>remoting-rmi-server</module> <module>remoting-rmi-client</module> </modules> + </project> \ No newline at end of file diff --git a/spring-remoting/remoting-rmi/remoting-rmi-client/pom.xml b/spring-remoting/remoting-rmi/remoting-rmi-client/pom.xml index 4ac0283e94..5d8d82d6ab 100644 --- a/spring-remoting/remoting-rmi/remoting-rmi-client/pom.xml +++ b/spring-remoting/remoting-rmi/remoting-rmi-client/pom.xml @@ -4,14 +4,14 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>remoting-rmi-client</artifactId> - <name>remoting-rmi-client</name> + <name>remoting-rmi-client</name> <parent> - <artifactId>remoting-rmi</artifactId> <groupId>com.baeldung</groupId> + <artifactId>remoting-rmi</artifactId> <version>1.0-SNAPSHOT</version> </parent> - + <dependencies> <dependency> <groupId>org.springframework.boot</groupId> @@ -29,4 +29,5 @@ <version>${project.version}</version> </dependency> </dependencies> + </project> \ No newline at end of file diff --git a/spring-remoting/remoting-rmi/remoting-rmi-server/pom.xml b/spring-remoting/remoting-rmi/remoting-rmi-server/pom.xml index 2a19ebbbf6..94bdccd093 100644 --- a/spring-remoting/remoting-rmi/remoting-rmi-server/pom.xml +++ b/spring-remoting/remoting-rmi/remoting-rmi-server/pom.xml @@ -4,11 +4,11 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>remoting-rmi-server</artifactId> - <name>remoting-rmi-server</name> - + <name>remoting-rmi-server</name> + <parent> - <artifactId>remoting-rmi</artifactId> <groupId>com.baeldung</groupId> + <artifactId>remoting-rmi</artifactId> <version>1.0-SNAPSHOT</version> </parent> diff --git a/spring-remoting/remoting-rmi/remoting-rmi-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-remoting/remoting-rmi/remoting-rmi-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 2063dd5e6e..0000000000 --- a/spring-remoting/remoting-rmi/remoting-rmi-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.server.RmiServer; - -@SpringBootTest(classes = RmiServer.class) -@RunWith(SpringRunner.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-rest-angular/pom.xml b/spring-rest-angular/pom.xml index 69becfb4ae..1c6ab77a2d 100644 --- a/spring-rest-angular/pom.xml +++ b/spring-rest-angular/pom.xml @@ -1,15 +1,15 @@ <?xml version="1.0"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-rest-angular</artifactId> - <name>spring-rest-angular</name> <version>1.0</version> + <name>spring-rest-angular</name> <packaging>war</packaging> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -60,7 +60,7 @@ </dependencies> <build> - <finalName>angular-spring-rest-sample</finalName> + <finalName>spring-rest-angular</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> diff --git a/spring-rest-angular/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-rest-angular/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 228d0019bd..0000000000 --- a/spring-rest-angular/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.baeldung; - -import org.baeldung.web.main.Application; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-rest-compress/pom.xml b/spring-rest-compress/pom.xml index ca00bdc659..9ff0be9682 100644 --- a/spring-rest-compress/pom.xml +++ b/spring-rest-compress/pom.xml @@ -1,15 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-rest-compress</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-rest-compress</name> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -62,4 +61,5 @@ <java.version>1.8</java.version> <commons-io.version>2.6</commons-io.version> </properties> + </project> diff --git a/spring-rest-hal-browser/pom.xml b/spring-rest-hal-browser/pom.xml index cc3b1b65fe..94ce837b27 100644 --- a/spring-rest-hal-browser/pom.xml +++ b/spring-rest-hal-browser/pom.xml @@ -1,58 +1,57 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> - <artifactId>spring-rest-hal-browser</artifactId> - <version>1.0-SNAPSHOT</version> - <name>spring-rest-hal-browser</name> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>spring-rest-hal-browser</artifactId> + <version>1.0-SNAPSHOT</version> + <name>spring-rest-hal-browser</name> - <parent> - <artifactId>parent-boot-1</artifactId> - <groupId>com.baeldung</groupId> - <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-boot-1</relativePath> - </parent> + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> + <version>0.0.1-SNAPSHOT</version> + <relativePath>../parent-boot-1</relativePath> + </parent> - <dependencies> - <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web --> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - <version>2.0.3.RELEASE</version> - </dependency> - <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-jpa --> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-data-jpa</artifactId> - <version>2.0.3.RELEASE</version> - </dependency> - <!-- https://mvnrepository.com/artifact/org.springframework.data/spring-data-rest-hal-browser --> - <dependency> - <groupId>org.springframework.data</groupId> - <artifactId>spring-data-rest-hal-browser</artifactId> - <version>3.0.8.RELEASE</version> - </dependency> - <!-- https://mvnrepository.com/artifact/com.h2database/h2 --> - <dependency> - <groupId>com.h2database</groupId> - <artifactId>h2</artifactId> - <version>1.4.197</version> - </dependency> - </dependencies> + <dependencies> + <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web --> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + <version>2.0.3.RELEASE</version> + </dependency> + <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-jpa --> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-jpa</artifactId> + <version>2.0.3.RELEASE</version> + </dependency> + <!-- https://mvnrepository.com/artifact/org.springframework.data/spring-data-rest-hal-browser --> + <dependency> + <groupId>org.springframework.data</groupId> + <artifactId>spring-data-rest-hal-browser</artifactId> + <version>3.0.8.RELEASE</version> + </dependency> + <!-- https://mvnrepository.com/artifact/com.h2database/h2 --> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <version>1.4.197</version> + </dependency> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.8</source> + <target>1.8</target> + </configuration> + </plugin> + </plugins> + </build> </project> \ No newline at end of file diff --git a/spring-rest-http/README.md b/spring-rest-http/README.md new file mode 100644 index 0000000000..51f5ed4000 --- /dev/null +++ b/spring-rest-http/README.md @@ -0,0 +1,14 @@ +## Spring REST HTTP + +This module contains articles about HTTP in REST APIs with Spring + +### The Course +The "REST With Spring" Classes: http://bit.ly/restwithspring + +### Relevant Articles: + +- [Guide to UriComponentsBuilder in Spring](https://www.baeldung.com/spring-uricomponentsbuilder) +- [How to Set a Header on a Response with Spring 5](https://www.baeldung.com/spring-response-header) - The tests contained for this article rely on the sample application within the [spring-resttemplate](/spring-resttemplate) module +- [Returning Custom Status Codes from Spring Controllers](https://www.baeldung.com/spring-mvc-controller-custom-http-status-code) +- [Spring @RequestMapping](https://www.baeldung.com/spring-requestmapping) +- [Guide to DeferredResult in Spring](https://www.baeldung.com/spring-deferred-result) \ No newline at end of file diff --git a/spring-rest-http/pom.xml b/spring-rest-http/pom.xml new file mode 100644 index 0000000000..c5c6b8d44c --- /dev/null +++ b/spring-rest-http/pom.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>spring-rest-http</artifactId> + <version>0.1-SNAPSHOT</version> + <name>spring-rest-http</name> + <packaging>war</packaging> + + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> + <version>0.0.1-SNAPSHOT</version> + <relativePath>../parent-boot-2</relativePath> + </parent> + + <dependencies> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-oxm</artifactId> + </dependency> + <dependency> + <groupId>com.thoughtworks.xstream</groupId> + <artifactId>xstream</artifactId> + <version>${xstream.version}</version> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-actuator</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-devtools</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + </dependency> + + </dependencies> + + + <properties> + <xstream.version>1.4.9</xstream.version> + </properties> + +</project> diff --git a/spring-rest-http/src/main/java/com/baeldung/config/MvcConfig.java b/spring-rest-http/src/main/java/com/baeldung/config/MvcConfig.java new file mode 100644 index 0000000000..ea2c536757 --- /dev/null +++ b/spring-rest-http/src/main/java/com/baeldung/config/MvcConfig.java @@ -0,0 +1,51 @@ +package com.baeldung.config; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.MediaType; +import org.springframework.http.converter.HttpMessageConverter; + +import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; + +import org.springframework.oxm.xstream.XStreamMarshaller; +import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +import java.text.SimpleDateFormat; +import java.util.List; + +/* + * Please note that main web configuration is in src/main/webapp/WEB-INF/api-servlet.xml + */ +@Configuration +@EnableWebMvc +@ComponentScan({ "com.baeldung.web", "com.baeldung.requestmapping" }) +public class MvcConfig implements WebMvcConfigurer { + + public MvcConfig() { + super(); + } + + // + + @Override + public void configureMessageConverters(final List<HttpMessageConverter<?>> messageConverters) { + final Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder(); + builder.indentOutput(true) + .dateFormat(new SimpleDateFormat("dd-MM-yyyy hh:mm")); + + } + + + @Override + public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { + configurer.defaultContentType(MediaType.APPLICATION_JSON); + } + + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**"); + } +} diff --git a/spring-rest/src/main/java/com/baeldung/controllers/DeferredResultController.java b/spring-rest-http/src/main/java/com/baeldung/controllers/DeferredResultController.java similarity index 100% rename from spring-rest/src/main/java/com/baeldung/controllers/DeferredResultController.java rename to spring-rest-http/src/main/java/com/baeldung/controllers/DeferredResultController.java diff --git a/spring-rest-simple/src/main/java/com/baeldung/requestmapping/BarMappingExamplesController.java b/spring-rest-http/src/main/java/com/baeldung/requestmapping/BarMappingExamplesController.java similarity index 100% rename from spring-rest-simple/src/main/java/com/baeldung/requestmapping/BarMappingExamplesController.java rename to spring-rest-http/src/main/java/com/baeldung/requestmapping/BarMappingExamplesController.java diff --git a/spring-rest-simple/src/main/java/com/baeldung/requestmapping/BazzNewMappingsExampleController.java b/spring-rest-http/src/main/java/com/baeldung/requestmapping/BazzNewMappingsExampleController.java similarity index 100% rename from spring-rest-simple/src/main/java/com/baeldung/requestmapping/BazzNewMappingsExampleController.java rename to spring-rest-http/src/main/java/com/baeldung/requestmapping/BazzNewMappingsExampleController.java diff --git a/spring-rest-simple/src/main/java/com/baeldung/requestmapping/FooMappingExamplesController.java b/spring-rest-http/src/main/java/com/baeldung/requestmapping/FooMappingExamplesController.java similarity index 100% rename from spring-rest-simple/src/main/java/com/baeldung/requestmapping/FooMappingExamplesController.java rename to spring-rest-http/src/main/java/com/baeldung/requestmapping/FooMappingExamplesController.java diff --git a/spring-rest-simple/src/main/java/com/baeldung/web/controller/status/ExampleController.java b/spring-rest-http/src/main/java/com/baeldung/web/controller/status/ExampleController.java similarity index 100% rename from spring-rest-simple/src/main/java/com/baeldung/web/controller/status/ExampleController.java rename to spring-rest-http/src/main/java/com/baeldung/web/controller/status/ExampleController.java diff --git a/spring-rest-simple/src/main/java/com/baeldung/web/controller/status/ForbiddenException.java b/spring-rest-http/src/main/java/com/baeldung/web/controller/status/ForbiddenException.java similarity index 100% rename from spring-rest-simple/src/main/java/com/baeldung/web/controller/status/ForbiddenException.java rename to spring-rest-http/src/main/java/com/baeldung/web/controller/status/ForbiddenException.java diff --git a/spring-rest-http/src/main/java/com/baeldung/web/dto/Bazz.java b/spring-rest-http/src/main/java/com/baeldung/web/dto/Bazz.java new file mode 100644 index 0000000000..861b4009b5 --- /dev/null +++ b/spring-rest-http/src/main/java/com/baeldung/web/dto/Bazz.java @@ -0,0 +1,22 @@ +package com.baeldung.web.dto; + +public class Bazz { + + + public String id; + public String name; + + public Bazz(String id){ + this.id = id; + } + public Bazz(String id, String name) { + this.id = id; + this.name = name; + } + + @Override + public String toString() { + return "Bazz [id=" + id + ", name=" + name + "]"; + } + +} diff --git a/spring-rest-http/src/main/java/com/baeldung/web/dto/Foo.java b/spring-rest-http/src/main/java/com/baeldung/web/dto/Foo.java new file mode 100644 index 0000000000..5a54539927 --- /dev/null +++ b/spring-rest-http/src/main/java/com/baeldung/web/dto/Foo.java @@ -0,0 +1,45 @@ +package com.baeldung.web.dto; + +import com.thoughtworks.xstream.annotations.XStreamAlias; + +@XStreamAlias("Foo") +public class Foo { + private long id; + private String name; + + public Foo() { + super(); + } + + public Foo(final String name) { + super(); + + this.name = name; + } + + public Foo(final long id, final String name) { + super(); + + this.id = id; + this.name = name; + } + + // API + + public long getId() { + return id; + } + + public void setId(final long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + +} \ No newline at end of file diff --git a/spring-rest-simple/src/test/java/com/baeldung/requestmapping/BazzNewMappingsExampleIntegrationTest.java b/spring-rest-http/src/test/java/com/baeldung/requestmapping/BazzNewMappingsExampleIntegrationTest.java similarity index 100% rename from spring-rest-simple/src/test/java/com/baeldung/requestmapping/BazzNewMappingsExampleIntegrationTest.java rename to spring-rest-http/src/test/java/com/baeldung/requestmapping/BazzNewMappingsExampleIntegrationTest.java diff --git a/spring-rest/src/test/java/com/baeldung/responseheaders/ResponseHeaderLiveTest.java b/spring-rest-http/src/test/java/com/baeldung/responseheaders/ResponseHeaderLiveTest.java similarity index 100% rename from spring-rest/src/test/java/com/baeldung/responseheaders/ResponseHeaderLiveTest.java rename to spring-rest-http/src/test/java/com/baeldung/responseheaders/ResponseHeaderLiveTest.java diff --git a/spring-rest/src/test/java/com/baeldung/uribuilder/SpringUriBuilderIntegrationTest.java b/spring-rest-http/src/test/java/com/baeldung/uribuilder/SpringUriBuilderIntegrationTest.java similarity index 100% rename from spring-rest/src/test/java/com/baeldung/uribuilder/SpringUriBuilderIntegrationTest.java rename to spring-rest-http/src/test/java/com/baeldung/uribuilder/SpringUriBuilderIntegrationTest.java diff --git a/spring-rest-simple/src/test/java/com/baeldung/web/controller/status/ExampleControllerIntegrationTest.java b/spring-rest-http/src/test/java/com/baeldung/web/controller/status/ExampleControllerIntegrationTest.java similarity index 100% rename from spring-rest-simple/src/test/java/com/baeldung/web/controller/status/ExampleControllerIntegrationTest.java rename to spring-rest-http/src/test/java/com/baeldung/web/controller/status/ExampleControllerIntegrationTest.java diff --git a/spring-rest-query-language/pom.xml b/spring-rest-query-language/pom.xml index 293bac9479..25b149367e 100644 --- a/spring-rest-query-language/pom.xml +++ b/spring-rest-query-language/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-rest-query-language</artifactId> <version>0.1-SNAPSHOT</version> @@ -7,8 +8,8 @@ <packaging>war</packaging> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -149,7 +150,7 @@ <dependency> <groupId>org.javassist</groupId> <artifactId>javassist</artifactId> - <version>${javassist.version}</version> + <version>${javassist.version}</version> </dependency> <dependency> <groupId>mysql</groupId> @@ -352,10 +353,10 @@ <xstream.version>1.4.9</xstream.version> <javassist.version>3.21.0-GA</javassist.version> <xml-apis.version>1.4.01</xml-apis.version> - + <!-- util --> <guava.version>19.0</guava.version> - + <!-- Maven plugins --> <cargo-maven2-plugin.version>1.7.0</cargo-maven2-plugin.version> <apt-maven-plugin.version>1.1.3</apt-maven-plugin.version> diff --git a/spring-rest-shell/pom.xml b/spring-rest-shell/pom.xml index acf33cf98f..1148a5c093 100644 --- a/spring-rest-shell/pom.xml +++ b/spring-rest-shell/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-rest-shell</artifactId> <name>spring-rest-shell</name> @@ -8,8 +8,8 @@ <description>A simple project to demonstrate Spring REST Shell features.</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> diff --git a/spring-rest-simple/README.md b/spring-rest-simple/README.md index 1ad32bf120..1ceb83b7a7 100644 --- a/spring-rest-simple/README.md +++ b/spring-rest-simple/README.md @@ -4,9 +4,12 @@ This module contains articles about REST APIs in Spring ## Relevant articles: -- [Guide to UriComponentsBuilder in Spring](https://www.baeldung.com/spring-uricomponentsbuilder) -- [Returning Custom Status Codes from Spring Controllers](https://www.baeldung.com/spring-mvc-controller-custom-http-status-code) -- [Spring RequestMapping](https://www.baeldung.com/spring-requestmapping) - [Spring and Apache FileUpload](https://www.baeldung.com/spring-apache-file-upload) - [Test a REST API with curl](https://www.baeldung.com/curl-rest) -- [CORS with Spring](https://www.baeldung.com/spring-cors) +- [Best Practices for REST API Error Handling](https://www.baeldung.com/rest-api-error-handling-best-practices) +- [Binary Data Formats in a Spring REST API](https://www.baeldung.com/spring-rest-api-with-binary-data-formats) + +### NOTE: + +This module is closed and should **not** be used to store the code +for any further articles. \ No newline at end of file diff --git a/spring-rest-simple/pom.xml b/spring-rest-simple/pom.xml index 263e451c62..59f7a94b8d 100644 --- a/spring-rest-simple/pom.xml +++ b/spring-rest-simple/pom.xml @@ -1,15 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-rest-simple</artifactId> <version>0.1-SNAPSHOT</version> <name>spring-rest-simple</name> <packaging>war</packaging> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -183,7 +183,7 @@ </dependencies> <build> - <finalName>spring-rest</finalName> + <finalName>spring-rest-simple</finalName> <resources> <resource> <directory>src/main/resources</directory> @@ -263,7 +263,7 @@ </plugins> </build> </profile> - + <profile> <id>live</id> <build> diff --git a/spring-rest-simple/src/test/java/com/baeldung/SpringContextIntegrationTest.java b/spring-rest-simple/src/test/java/com/baeldung/SpringContextTest.java similarity index 89% rename from spring-rest-simple/src/test/java/com/baeldung/SpringContextIntegrationTest.java rename to spring-rest-simple/src/test/java/com/baeldung/SpringContextTest.java index b66e642b80..13c1c162f1 100644 --- a/spring-rest-simple/src/test/java/com/baeldung/SpringContextIntegrationTest.java +++ b/spring-rest-simple/src/test/java/com/baeldung/SpringContextTest.java @@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest(classes = Application.class) -public class SpringContextIntegrationTest { +public class SpringContextTest { @Test public void whenSpringContextIsBootstrapped_thenNoExceptions() { diff --git a/jackson/src/test/resources/.gitignore b/spring-rest-testing/.gitignore similarity index 100% rename from jackson/src/test/resources/.gitignore rename to spring-rest-testing/.gitignore diff --git a/spring-rest-full/README.md b/spring-rest-testing/README.md similarity index 80% rename from spring-rest-full/README.md rename to spring-rest-testing/README.md index df7856725f..18bfeddc7c 100644 --- a/spring-rest-full/README.md +++ b/spring-rest-testing/README.md @@ -1,6 +1,6 @@ -## Spring REST Full +## Spring REST Testing -This module contains articles about REST APIs with Spring +This module contains articles about testing REST APIs with Spring ### Courses @@ -10,7 +10,6 @@ The "Learn Spring Security" Classes: http://github.learnspringsecurity.com ### Relevant Articles: - [Integration Testing with the Maven Cargo plugin](https://www.baeldung.com/integration-testing-with-the-maven-cargo-plugin) -- [Project Configuration with Spring](https://www.baeldung.com/project-configuration-with-spring) - [Metrics for your Spring REST API](https://www.baeldung.com/spring-rest-api-metrics) ### Build the Project @@ -18,7 +17,6 @@ The "Learn Spring Security" Classes: http://github.learnspringsecurity.com mvn clean install ``` - ### Set up MySQL ``` mysql -u root -p diff --git a/spring-rest-full/pom.xml b/spring-rest-testing/pom.xml similarity index 97% rename from spring-rest-full/pom.xml rename to spring-rest-testing/pom.xml index a2736ba03c..dcd8b677be 100644 --- a/spring-rest-full/pom.xml +++ b/spring-rest-testing/pom.xml @@ -1,15 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> - <artifactId>spring-rest-full</artifactId> + <artifactId>spring-rest-testing</artifactId> <version>0.1-SNAPSHOT</version> - <name>spring-rest-full</name> + <name>spring-rest-testing</name> <packaging>war</packaging> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> @@ -197,7 +197,7 @@ </dependencies> <build> - <finalName>spring-rest-full</finalName> + <finalName>spring-rest-testing</finalName> <resources> <resource> <directory>src/main/resources</directory> diff --git a/spring-rest-full/src/main/java/org/baeldung/persistence/IOperations.java b/spring-rest-testing/src/main/java/org/baeldung/persistence/IOperations.java similarity index 100% rename from spring-rest-full/src/main/java/org/baeldung/persistence/IOperations.java rename to spring-rest-testing/src/main/java/org/baeldung/persistence/IOperations.java diff --git a/spring-rest-full/src/main/java/org/baeldung/persistence/dao/IFooDao.java b/spring-rest-testing/src/main/java/org/baeldung/persistence/dao/IFooDao.java similarity index 100% rename from spring-rest-full/src/main/java/org/baeldung/persistence/dao/IFooDao.java rename to spring-rest-testing/src/main/java/org/baeldung/persistence/dao/IFooDao.java diff --git a/spring-rest-full/src/main/java/org/baeldung/persistence/model/Foo.java b/spring-rest-testing/src/main/java/org/baeldung/persistence/model/Foo.java similarity index 100% rename from spring-rest-full/src/main/java/org/baeldung/persistence/model/Foo.java rename to spring-rest-testing/src/main/java/org/baeldung/persistence/model/Foo.java diff --git a/spring-rest-full/src/main/java/org/baeldung/persistence/model/User.java b/spring-rest-testing/src/main/java/org/baeldung/persistence/model/User.java similarity index 100% rename from spring-rest-full/src/main/java/org/baeldung/persistence/model/User.java rename to spring-rest-testing/src/main/java/org/baeldung/persistence/model/User.java diff --git a/spring-rest-full/src/main/java/org/baeldung/persistence/service/IFooService.java b/spring-rest-testing/src/main/java/org/baeldung/persistence/service/IFooService.java similarity index 100% rename from spring-rest-full/src/main/java/org/baeldung/persistence/service/IFooService.java rename to spring-rest-testing/src/main/java/org/baeldung/persistence/service/IFooService.java diff --git a/spring-rest-full/src/main/java/org/baeldung/persistence/service/common/AbstractService.java b/spring-rest-testing/src/main/java/org/baeldung/persistence/service/common/AbstractService.java similarity index 100% rename from spring-rest-full/src/main/java/org/baeldung/persistence/service/common/AbstractService.java rename to spring-rest-testing/src/main/java/org/baeldung/persistence/service/common/AbstractService.java diff --git a/spring-rest-full/src/main/java/org/baeldung/persistence/service/impl/FooService.java b/spring-rest-testing/src/main/java/org/baeldung/persistence/service/impl/FooService.java similarity index 100% rename from spring-rest-full/src/main/java/org/baeldung/persistence/service/impl/FooService.java rename to spring-rest-testing/src/main/java/org/baeldung/persistence/service/impl/FooService.java diff --git a/spring-rest-full/src/main/java/org/baeldung/spring/Application.java b/spring-rest-testing/src/main/java/org/baeldung/spring/Application.java similarity index 100% rename from spring-rest-full/src/main/java/org/baeldung/spring/Application.java rename to spring-rest-testing/src/main/java/org/baeldung/spring/Application.java diff --git a/spring-rest-full/src/main/java/org/baeldung/spring/PersistenceConfig.java b/spring-rest-testing/src/main/java/org/baeldung/spring/PersistenceConfig.java similarity index 100% rename from spring-rest-full/src/main/java/org/baeldung/spring/PersistenceConfig.java rename to spring-rest-testing/src/main/java/org/baeldung/spring/PersistenceConfig.java diff --git a/spring-rest-full/src/main/java/org/baeldung/spring/WebConfig.java b/spring-rest-testing/src/main/java/org/baeldung/spring/WebConfig.java similarity index 100% rename from spring-rest-full/src/main/java/org/baeldung/spring/WebConfig.java rename to spring-rest-testing/src/main/java/org/baeldung/spring/WebConfig.java diff --git a/spring-rest-full/src/main/java/org/baeldung/web/controller/FooController.java b/spring-rest-testing/src/main/java/org/baeldung/web/controller/FooController.java similarity index 100% rename from spring-rest-full/src/main/java/org/baeldung/web/controller/FooController.java rename to spring-rest-testing/src/main/java/org/baeldung/web/controller/FooController.java diff --git a/spring-rest-full/src/main/java/org/baeldung/web/controller/HomeController.java b/spring-rest-testing/src/main/java/org/baeldung/web/controller/HomeController.java similarity index 100% rename from spring-rest-full/src/main/java/org/baeldung/web/controller/HomeController.java rename to spring-rest-testing/src/main/java/org/baeldung/web/controller/HomeController.java diff --git a/spring-rest-full/src/main/java/org/baeldung/web/controller/RootController.java b/spring-rest-testing/src/main/java/org/baeldung/web/controller/RootController.java similarity index 100% rename from spring-rest-full/src/main/java/org/baeldung/web/controller/RootController.java rename to spring-rest-testing/src/main/java/org/baeldung/web/controller/RootController.java diff --git a/spring-rest-full/src/main/java/org/baeldung/web/exception/MyResourceNotFoundException.java b/spring-rest-testing/src/main/java/org/baeldung/web/exception/MyResourceNotFoundException.java similarity index 100% rename from spring-rest-full/src/main/java/org/baeldung/web/exception/MyResourceNotFoundException.java rename to spring-rest-testing/src/main/java/org/baeldung/web/exception/MyResourceNotFoundException.java diff --git a/spring-rest-full/src/main/java/org/baeldung/web/metric/ActuatorMetricService.java b/spring-rest-testing/src/main/java/org/baeldung/web/metric/ActuatorMetricService.java similarity index 100% rename from spring-rest-full/src/main/java/org/baeldung/web/metric/ActuatorMetricService.java rename to spring-rest-testing/src/main/java/org/baeldung/web/metric/ActuatorMetricService.java diff --git a/spring-rest-full/src/main/java/org/baeldung/web/metric/CustomActuatorMetricService.java b/spring-rest-testing/src/main/java/org/baeldung/web/metric/CustomActuatorMetricService.java similarity index 100% rename from spring-rest-full/src/main/java/org/baeldung/web/metric/CustomActuatorMetricService.java rename to spring-rest-testing/src/main/java/org/baeldung/web/metric/CustomActuatorMetricService.java diff --git a/spring-rest-full/src/main/java/org/baeldung/web/metric/IActuatorMetricService.java b/spring-rest-testing/src/main/java/org/baeldung/web/metric/IActuatorMetricService.java similarity index 100% rename from spring-rest-full/src/main/java/org/baeldung/web/metric/IActuatorMetricService.java rename to spring-rest-testing/src/main/java/org/baeldung/web/metric/IActuatorMetricService.java diff --git a/spring-rest-full/src/main/java/org/baeldung/web/metric/ICustomActuatorMetricService.java b/spring-rest-testing/src/main/java/org/baeldung/web/metric/ICustomActuatorMetricService.java similarity index 100% rename from spring-rest-full/src/main/java/org/baeldung/web/metric/ICustomActuatorMetricService.java rename to spring-rest-testing/src/main/java/org/baeldung/web/metric/ICustomActuatorMetricService.java diff --git a/spring-rest-full/src/main/java/org/baeldung/web/metric/IMetricService.java b/spring-rest-testing/src/main/java/org/baeldung/web/metric/IMetricService.java similarity index 100% rename from spring-rest-full/src/main/java/org/baeldung/web/metric/IMetricService.java rename to spring-rest-testing/src/main/java/org/baeldung/web/metric/IMetricService.java diff --git a/spring-rest-full/src/main/java/org/baeldung/web/metric/MetricFilter.java b/spring-rest-testing/src/main/java/org/baeldung/web/metric/MetricFilter.java similarity index 100% rename from spring-rest-full/src/main/java/org/baeldung/web/metric/MetricFilter.java rename to spring-rest-testing/src/main/java/org/baeldung/web/metric/MetricFilter.java diff --git a/spring-rest-full/src/main/java/org/baeldung/web/metric/MetricService.java b/spring-rest-testing/src/main/java/org/baeldung/web/metric/MetricService.java similarity index 100% rename from spring-rest-full/src/main/java/org/baeldung/web/metric/MetricService.java rename to spring-rest-testing/src/main/java/org/baeldung/web/metric/MetricService.java diff --git a/spring-rest-full/src/main/java/org/baeldung/web/util/RestPreconditions.java b/spring-rest-testing/src/main/java/org/baeldung/web/util/RestPreconditions.java similarity index 100% rename from spring-rest-full/src/main/java/org/baeldung/web/util/RestPreconditions.java rename to spring-rest-testing/src/main/java/org/baeldung/web/util/RestPreconditions.java diff --git a/spring-rest-full/src/main/resources/application.properties b/spring-rest-testing/src/main/resources/application.properties similarity index 100% rename from spring-rest-full/src/main/resources/application.properties rename to spring-rest-testing/src/main/resources/application.properties diff --git a/spring-rest-full/src/main/resources/logback.xml b/spring-rest-testing/src/main/resources/logback.xml similarity index 100% rename from spring-rest-full/src/main/resources/logback.xml rename to spring-rest-testing/src/main/resources/logback.xml diff --git a/spring-rest-full/src/main/resources/persistence-h2.properties b/spring-rest-testing/src/main/resources/persistence-h2.properties similarity index 100% rename from spring-rest-full/src/main/resources/persistence-h2.properties rename to spring-rest-testing/src/main/resources/persistence-h2.properties diff --git a/spring-zuul/spring-zuul-ui/src/test/resources/persistence-mysql.properties b/spring-rest-testing/src/main/resources/persistence-mysql.properties similarity index 100% rename from spring-zuul/spring-zuul-ui/src/test/resources/persistence-mysql.properties rename to spring-rest-testing/src/main/resources/persistence-mysql.properties diff --git a/spring-rest-full/src/main/resources/springDataPersistenceConfig.xml b/spring-rest-testing/src/main/resources/springDataPersistenceConfig.xml similarity index 100% rename from spring-rest-full/src/main/resources/springDataPersistenceConfig.xml rename to spring-rest-testing/src/main/resources/springDataPersistenceConfig.xml diff --git a/spring-rest-full/src/main/webapp/WEB-INF/api-servlet.xml b/spring-rest-testing/src/main/webapp/WEB-INF/api-servlet.xml similarity index 100% rename from spring-rest-full/src/main/webapp/WEB-INF/api-servlet.xml rename to spring-rest-testing/src/main/webapp/WEB-INF/api-servlet.xml diff --git a/spring-rest-full/src/main/webapp/WEB-INF/view/graph.jsp b/spring-rest-testing/src/main/webapp/WEB-INF/view/graph.jsp similarity index 100% rename from spring-rest-full/src/main/webapp/WEB-INF/view/graph.jsp rename to spring-rest-testing/src/main/webapp/WEB-INF/view/graph.jsp diff --git a/spring-rest-full/src/main/webapp/WEB-INF/view/homepage.jsp b/spring-rest-testing/src/main/webapp/WEB-INF/view/homepage.jsp similarity index 100% rename from spring-rest-full/src/main/webapp/WEB-INF/view/homepage.jsp rename to spring-rest-testing/src/main/webapp/WEB-INF/view/homepage.jsp diff --git a/spring-rest-full/src/main/webapp/WEB-INF/web.xml b/spring-rest-testing/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from spring-rest-full/src/main/webapp/WEB-INF/web.xml rename to spring-rest-testing/src/main/webapp/WEB-INF/web.xml diff --git a/spring-rest-full/src/test/java/org/baeldung/Consts.java b/spring-rest-testing/src/test/java/org/baeldung/Consts.java similarity index 100% rename from spring-rest-full/src/test/java/org/baeldung/Consts.java rename to spring-rest-testing/src/test/java/org/baeldung/Consts.java diff --git a/spring-rest-full/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-rest-testing/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 100% rename from spring-rest-full/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to spring-rest-testing/src/test/java/org/baeldung/SpringContextIntegrationTest.java diff --git a/spring-rest-full/src/test/java/org/baeldung/SpringContextTest.java b/spring-rest-testing/src/test/java/org/baeldung/SpringContextTest.java similarity index 100% rename from spring-rest-full/src/test/java/org/baeldung/SpringContextTest.java rename to spring-rest-testing/src/test/java/org/baeldung/SpringContextTest.java diff --git a/spring-rest-full/src/test/java/org/baeldung/persistence/PersistenceTestSuite.java b/spring-rest-testing/src/test/java/org/baeldung/persistence/PersistenceTestSuite.java similarity index 100% rename from spring-rest-full/src/test/java/org/baeldung/persistence/PersistenceTestSuite.java rename to spring-rest-testing/src/test/java/org/baeldung/persistence/PersistenceTestSuite.java diff --git a/spring-rest-full/src/test/java/org/baeldung/persistence/service/AbstractServicePersistenceIntegrationTest.java b/spring-rest-testing/src/test/java/org/baeldung/persistence/service/AbstractServicePersistenceIntegrationTest.java similarity index 100% rename from spring-rest-full/src/test/java/org/baeldung/persistence/service/AbstractServicePersistenceIntegrationTest.java rename to spring-rest-testing/src/test/java/org/baeldung/persistence/service/AbstractServicePersistenceIntegrationTest.java diff --git a/spring-rest-full/src/test/java/org/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java b/spring-rest-testing/src/test/java/org/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java similarity index 100% rename from spring-rest-full/src/test/java/org/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java rename to spring-rest-testing/src/test/java/org/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java diff --git a/spring-rest-full/src/test/java/org/baeldung/util/IDUtil.java b/spring-rest-testing/src/test/java/org/baeldung/util/IDUtil.java similarity index 100% rename from spring-rest-full/src/test/java/org/baeldung/util/IDUtil.java rename to spring-rest-testing/src/test/java/org/baeldung/util/IDUtil.java diff --git a/spring-rest-full/.gitignore b/spring-rest-testing/src/test/resources/.gitignore similarity index 100% rename from spring-rest-full/.gitignore rename to spring-rest-testing/src/test/resources/.gitignore diff --git a/spring-rest-full/src/testFile b/spring-rest-testing/src/testFile similarity index 100% rename from spring-rest-full/src/testFile rename to spring-rest-testing/src/testFile diff --git a/spring-rest/README.md b/spring-rest/README.md deleted file mode 100644 index af054b2dcf..0000000000 --- a/spring-rest/README.md +++ /dev/null @@ -1,20 +0,0 @@ -## Spring REST - -This module contains articles about REST APIs with Spring - -### The Course -The "REST With Spring" Classes: http://bit.ly/restwithspring - -### Relevant Articles: -- [Spring @RequestMapping](https://www.baeldung.com/spring-requestmapping) -- [Returning Custom Status Codes from Spring Controllers](https://www.baeldung.com/spring-mvc-controller-custom-http-status-code) -- [Binary Data Formats in a Spring REST API](https://www.baeldung.com/spring-rest-api-with-binary-data-formats) -- [Guide to UriComponentsBuilder in Spring](https://www.baeldung.com/spring-uricomponentsbuilder) -- [A Custom Media Type for a Spring REST API](https://www.baeldung.com/spring-rest-custom-media-type) -- [HTTP PUT vs HTTP PATCH in a REST API](https://www.baeldung.com/http-put-patch-difference-spring) -- [Spring – Log Incoming Requests](https://www.baeldung.com/spring-http-logging) -- [How to Change the Default Port in Spring Boot](https://www.baeldung.com/spring-boot-change-port) -- [Guide to DeferredResult in Spring](https://www.baeldung.com/spring-deferred-result) -- [Spring Custom Property Editor](https://www.baeldung.com/spring-mvc-custom-property-editor) -- [How to Set a Header on a Response with Spring 5](https://www.baeldung.com/spring-response-header) -- [Download an Image or a File with Spring MVC](https://www.baeldung.com/spring-controller-return-image-file) diff --git a/spring-rest/pom.xml b/spring-rest/pom.xml deleted file mode 100644 index fce04a8f2d..0000000000 --- a/spring-rest/pom.xml +++ /dev/null @@ -1,256 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <artifactId>spring-rest</artifactId> - <version>0.1-SNAPSHOT</version> - <name>spring-rest</name> - <packaging>war</packaging> - - <parent> - <artifactId>parent-boot-2</artifactId> - <groupId>com.baeldung</groupId> - <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-boot-2</relativePath> - </parent> - - <dependencies> - - <!-- Spring Boot Dependencies --> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> - - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-actuator</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-devtools</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - </dependency> - - <!-- Spring --> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-web</artifactId> - <exclusions> - <exclusion> - <artifactId>commons-logging</artifactId> - <groupId>commons-logging</groupId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-webmvc</artifactId> - </dependency> - <dependency> - <groupId>commons-fileupload</groupId> - <artifactId>commons-fileupload</artifactId> - <version>${commons-fileupload.version}</version> - </dependency> - - <!-- web --> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - <scope>provided</scope> - </dependency> - - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>jstl</artifactId> - <scope>runtime</scope> - </dependency> - - <!-- marshalling --> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - </dependency> - - <dependency> - <groupId>com.fasterxml.jackson.dataformat</groupId> - <artifactId>jackson-dataformat-xml</artifactId> - </dependency> - - <!-- util --> - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - <version>${guava.version}</version> - </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-lang3</artifactId> - </dependency> - - <!-- test scoped --> - <dependency> - <groupId>org.hamcrest</groupId> - <artifactId>hamcrest-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.hamcrest</groupId> - <artifactId>hamcrest-library</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-test</artifactId> - </dependency> - - <!-- --> - <dependency> - <groupId>com.google.protobuf</groupId> - <artifactId>protobuf-java</artifactId> - <version>${protobuf-java.version}</version> - </dependency> - <dependency> - <groupId>com.googlecode.protobuf-java-format</groupId> - <artifactId>protobuf-java-format</artifactId> - <version>${protobuf-java-format.version}</version> - </dependency> - <dependency> - <groupId>com.esotericsoftware</groupId> - <artifactId>kryo</artifactId> - <version>${kryo.version}</version> - </dependency> - <dependency> - <groupId>com.jayway.jsonpath</groupId> - <artifactId>json-path</artifactId> - </dependency> - - <!-- Apache common IO for utility --> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>${commons-io.version}</version> - </dependency> - - <dependency> - <groupId>io.rest-assured</groupId> - <artifactId>rest-assured</artifactId> - </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - <version>${httpclient.version}</version> - </dependency> - - </dependencies> - - <build> - <finalName>spring-rest</finalName> - <resources> - <resource> - <directory>src/main/resources</directory> - <filtering>true</filtering> - </resource> - </resources> - - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-war-plugin</artifactId> - </plugin> - - </plugins> - </build> - - <profiles> - <profile> - <id>live</id> - <build> - <plugins> - <plugin> - <groupId>org.codehaus.cargo</groupId> - <artifactId>cargo-maven2-plugin</artifactId> - <executions> - <execution> - <id>start-server</id> - <phase>pre-integration-test</phase> - <goals> - <goal>start</goal> - </goals> - </execution> - <execution> - <id>stop-server</id> - <phase>post-integration-test</phase> - <goals> - <goal>stop</goal> - </goals> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <executions> - <execution> - <phase>integration-test</phase> - <goals> - <goal>test</goal> - </goals> - <configuration> - <excludes> - <exclude>none</exclude> - </excludes> - <includes> - <include>**/*LiveTest.java</include> - </includes> - <systemPropertyVariables> - <webTarget>cargo</webTarget> - </systemPropertyVariables> - </configuration> - </execution> - </executions> - </plugin> - - </plugins> - </build> - </profile> - - </profiles> - - - - <properties> - <commons-fileupload.version>1.3.2</commons-fileupload.version> - <kryo.version>4.0.0</kryo.version> - <protobuf-java-format.version>1.4</protobuf-java-format.version> - <protobuf-java.version>3.1.0</protobuf-java.version> - - <!-- util --> - <guava.version>20.0</guava.version> - - <!-- Maven plugins --> - <cargo-maven2-plugin.version>1.6.0</cargo-maven2-plugin.version> - <findbugs-maven-plugin.version>3.0.4</findbugs-maven-plugin.version> - - <dependency.locations.enabled>false</dependency.locations.enabled> - - <json.path.version>2.2.0</json.path.version> - <pact.version>3.5.11</pact.version> - <rest-assured.version>3.1.0</rest-assured.version> - <httpclient.version>4.5.2</httpclient.version> - <start-class>com.baeldung.sampleapp.config.MainApplication</start-class> - </properties> - -</project> diff --git a/spring-rest/src/main/java/com/baeldung/controllers/ViewController.java b/spring-rest/src/main/java/com/baeldung/controllers/ViewController.java deleted file mode 100644 index 8eab0ce6da..0000000000 --- a/spring-rest/src/main/java/com/baeldung/controllers/ViewController.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.controllers; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; - -@Controller -public class ViewController { - - @GetMapping("/") - public String welcome() { - return "index"; - } - -} diff --git a/spring-rest/src/main/resources/application.properties b/spring-rest/src/main/resources/application.properties deleted file mode 100644 index dd7e4e2f2d..0000000000 --- a/spring-rest/src/main/resources/application.properties +++ /dev/null @@ -1,2 +0,0 @@ -server.port= 8082 -server.servlet.context-path=/spring-rest \ No newline at end of file diff --git a/spring-rest/src/main/resources/com/baeldung/produceimage/data.txt b/spring-rest/src/main/resources/com/baeldung/produceimage/data.txt deleted file mode 100644 index 3cd18170c0..0000000000 --- a/spring-rest/src/main/resources/com/baeldung/produceimage/data.txt +++ /dev/null @@ -1 +0,0 @@ -This is a sample file containing text data \ No newline at end of file diff --git a/spring-rest/src/main/resources/com/baeldung/produceimage/image.jpg b/spring-rest/src/main/resources/com/baeldung/produceimage/image.jpg deleted file mode 100644 index 0262656a33..0000000000 Binary files a/spring-rest/src/main/resources/com/baeldung/produceimage/image.jpg and /dev/null differ diff --git a/spring-rest/src/main/resources/com/baeldung/produceimage/images/favicon.ico b/spring-rest/src/main/resources/com/baeldung/produceimage/images/favicon.ico deleted file mode 100644 index 64105ac11c..0000000000 Binary files a/spring-rest/src/main/resources/com/baeldung/produceimage/images/favicon.ico and /dev/null differ diff --git a/spring-rest/src/main/resources/logback.xml b/spring-rest/src/main/resources/logback.xml deleted file mode 100644 index 9f48d36486..0000000000 --- a/spring-rest/src/main/resources/logback.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<configuration> - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> - <encoder> - <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - </pattern> - </encoder> - </appender> - - <logger name="org.springframework.web.filter.CommonsRequestLoggingFilter"> - <level value="DEBUG" /> - </logger> - - <logger name="org.springframework" level="WARN" /> - <logger name="org.springframework.transaction" level="WARN" /> - - <!-- in order to debug some marshalling issues, this needs to be TRACE --> - <logger name="org.springframework.web.servlet.mvc" level="WARN" /> - - <root level="INFO"> - <appender-ref ref="STDOUT" /> - </root> -</configuration> \ No newline at end of file diff --git a/spring-rest/src/main/resources/pacts/test_consumer-test_provider.json b/spring-rest/src/main/resources/pacts/test_consumer-test_provider.json deleted file mode 100644 index c8082798f4..0000000000 --- a/spring-rest/src/main/resources/pacts/test_consumer-test_provider.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "provider": { - "name": "test_provider" - }, - "consumer": { - "name": "test_consumer" - }, - "interactions": [ - { - "description": "GET REQUEST", - "request": { - "method": "GET", - "path": "/pact" - }, - "response": { - "status": 200, - "headers": { - "Content-Type": "application/json" - }, - "body": { - "condition": true, - "name": "tom" - } - }, - "providerStates": [ - { - "name": "test GET" - } - ] - }, - { - "description": "POST REQUEST", - "request": { - "method": "POST", - "path": "/pact", - "headers": { - "Content-Type": "application/json" - }, - "body": { - "name": "Michael" - } - }, - "response": { - "status": 201 - }, - "providerStates": [ - { - "name": "test POST" - } - ] - } - ], - "metadata": { - "pact-specification": { - "version": "3.0.0" - }, - "pact-jvm": { - "version": "3.5.0" - } - } -} \ No newline at end of file diff --git a/spring-rest/src/test/resources/cache/2d9345a30d2cc31bb3091d70a8ef6c18.0 b/spring-rest/src/test/resources/cache/2d9345a30d2cc31bb3091d70a8ef6c18.0 deleted file mode 100644 index e6cfcabe71..0000000000 --- a/spring-rest/src/test/resources/cache/2d9345a30d2cc31bb3091d70a8ef6c18.0 +++ /dev/null @@ -1,24 +0,0 @@ -https://publicobject.com/helloworld.txt -GET -0 -HTTP/1.1 200 OK -10 -Content-Type: text/plain -Content-Length: 1759 -Connection: keep-alive -Accept-Ranges: bytes -Server: nginx/1.10.0 (Ubuntu) -Date: Sat, 08 Dec 2018 13:02:07 GMT -Last-Modified: Tue, 27 May 2014 02:35:47 GMT -ETag: "5383fa03-6df" -OkHttp-Sent-Millis: 1489054646765 -OkHttp-Received-Millis: 1489054646966 - -TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 -4 -MIIFVTCCBD2gAwIBAgIRAKgHBM+t9Yx3v9G9tGZECWkwDQYJKoZIhvcNAQELBQAwgZAxCzAJBgNVBAYTAkdCMRswGQYDVQQIExJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAOBgNVBAcTB1NhbGZvcmQxGjAYBgNVBAoTEUNPTU9ETyBDQSBMaW1pdGVkMTYwNAYDVQQDEy1DT01PRE8gUlNBIERvbWFpbiBWYWxpZGF0aW9uIFNlY3VyZSBTZXJ2ZXIgQ0EwHhcNMTQxMDExMDAwMDAwWhcNMTkxMDEwMjM1OTU5WjBUMSEwHwYDVQQLExhEb21haW4gQ29udHJvbCBWYWxpZGF0ZWQxFDASBgNVBAsTC1Bvc2l0aXZlU1NMMRkwFwYDVQQDExBwdWJsaWNvYmplY3QuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjtgQtvL2kUr6ooHMOq7cxQLGycBW+ri9TGyQkO1lTb66RmcAujENxMh51wKodrveUdbqwpL4g1P49o/Y1fK5IHWAf3vpE8p3RyELY0NRlclRM24dgif/+dgRUUk+0kF3NH6MbB/kve07FMF2FyNDLxtbwJvmrn1MI5c52cpxI24vGcpOZ0VIW7+nS3V+QSrEinvrugAtu8b6Gpg+I8w6rAvmjpfCLmLP0zbjz5ExJzMC0TnR6JMgiqo2TUIyuDM2OuNJpyiluNvlUnzFrlRieg7xexoJxCbqqiOSm076fdT9qNzBp+4MzQ8w8Ofm8tsOnM4FNsz3ifX6KpJdIXfsAQIDAQABo4IB4zCCAd8wHwYDVR0jBBgwFoAUkK9qOpRaC9iQ6hJWc99DtDoo2ucwHQYDVR0OBBYEFAmSn3icQLzlRnBujuf7Y+i7/6HbMA4GA1UdDwEB/wQEAwIFoDAMBgNVHRMBAf8EAjAAMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjBPBgNVHSAESDBGMDoGCysGAQQBsjEBAgIHMCswKQYIKwYBBQUHAgEWHWh0dHBzOi8vc2VjdXJlLmNvbW9kby5jb20vQ1BTMAgGBmeBDAECATBUBgNVHR8ETTBLMEmgR6BFhkNodHRwOi8vY3JsLmNvbW9kb2NhLmNvbS9DT01PRE9SU0FEb21haW5WYWxpZGF0aW9uU2VjdXJlU2VydmVyQ0EuY3JsMIGFBggrBgEFBQcBAQR5MHcwTwYIKwYBBQUHMAKGQ2h0dHA6Ly9jcnQuY29tb2RvY2EuY29tL0NPTU9ET1JTQURvbWFpblZhbGlkYXRpb25TZWN1cmVTZXJ2ZXJDQS5jcnQwJAYIKwYBBQUHMAGGGGh0dHA6Ly9vY3NwLmNvbW9kb2NhLmNvbTAxBgNVHREEKjAoghBwdWJsaWNvYmplY3QuY29tghR3d3cucHVibGljb2JqZWN0LmNvbTANBgkqhkiG9w0BAQsFAAOCAQEATWNaqr7WgumGhxmAm7yluVhVZ/pxPabACY4HDLrYN61KB7XgI1PZIJhQkkreBtmDLIkOQqJxbhePp3z/nOil0QJT7ONcdnYBX0CO8xYhf8c0FM9z7XbLBLta1pkTF/bwgK3VUsGYOskyQ3YdTUrmZq5WrYJvdbP2G5F5eEVIHnXvjKcdFpEY5CmZagYPwVtSioiup+xUzrBibJxpOD9fB6GV8okLgVjIl29Hs1zC++9o3yWC3ep1qzU+m59Pwi7uPoqUA0LXHi4iIEUk8fRhkNlhkte9geOne+fVvm/Rj9MZD3Gtb5qKoqEld6bOSoMlYavj9GCBSNIx2+mGS0Tg6A== -MIIGCDCCA/CgAwIBAgIQKy5u6tl1NmwUim7bo3yMBzANBgkqhkiG9w0BAQwFADCBhTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTQwMjEyMDAwMDAwWhcNMjkwMjExMjM1OTU5WjCBkDELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxNjA0BgNVBAMTLUNPTU9ETyBSU0EgRG9tYWluIFZhbGlkYXRpb24gU2VjdXJlIFNlcnZlciBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI7CAhnhoFmk6zg1jSz9AdDTScBkxwtiBUUWOqigwAwCfx3M28ShbXcDow+G+eMGnD4LgYqbSRutA776S9uMIO3Vzl5ljj4Nr0zCsLdFXlIvNN5IJGS0Qa4Al/e+Z96e0HqnU4A7fK31llVvl0cKfIWLIpeNs4TgllfQcBhglo/uLQeTnaG6ytHNe+nEKpooIZFNb5JPJaXyejXdJtxGpdCsWTWM/06RQ1A/WZMebFEh7lgUq/51UHg+TLAchhP6a5i84DuUHoVS3AOTJBhuyydRReZw3iVDpA3hSqXttn7IzW3uLh0nc13cRTCAquOyQQuvvUSH2rnlG51/ruWFgqUCAwEAAaOCAWUwggFhMB8GA1UdIwQYMBaAFLuvfgI9+qbxPISOre44mOzZMjLUMB0GA1UdDgQWBBSQr2o6lFoL2JDqElZz30O0Oija5zAOBgNVHQ8BAf8EBAMCAYYwEgYDVR0TAQH/BAgwBgEB/wIBADAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwGwYDVR0gBBQwEjAGBgRVHSAAMAgGBmeBDAECATBMBgNVHR8ERTBDMEGgP6A9hjtodHRwOi8vY3JsLmNvbW9kb2NhLmNvbS9DT01PRE9SU0FDZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDBxBggrBgEFBQcBAQRlMGMwOwYIKwYBBQUHMAKGL2h0dHA6Ly9jcnQuY29tb2RvY2EuY29tL0NPTU9ET1JTQUFkZFRydXN0Q0EuY3J0MCQGCCsGAQUFBzABhhhodHRwOi8vb2NzcC5jb21vZG9jYS5jb20wDQYJKoZIhvcNAQEMBQADggIBAE4rdk+SHGI2ibp3wScF9BzWRJ2pmj6q1WZmAT7qSeaiNbz69t2Vjpk1mA42GHWx3d1Qcnyu3HeIzg/3kCDKo2cuH1Z/e+FE6kKVxF0NAVBGFfKBiVlsit2M8RKhjTpCipj4SzR7JzsItG8kO3KdY3RYPBpsP0/HEZrIqPW1N+8QRcZs2eBelSaz662jue5/DJpmNXMyYE7l3YphLG5SEXdoltMYdVEVABt0iN3hxzgEQyjpFv3ZBdRdRydg1vs4O2xyopT4Qhrf7W8GjEXCBgCq5Ojc2bXhc3js9iPc0d1sjhqPpepUfJa3w/5Vjo1JXvxku88+vZbrac2/4EjxYoIQ5QxGV/Iz2tDIY+3GH5QFlkoakdH368+PUq4NCNk+qKBR6cGHdNXJ93SrLlP7u3r7l+L4HyaPs9Kg4DdbKDsx5Q5XLVq4rXmsXiBmGqW5prU5wfWYQ//u+aen/e7KJD2AFsQXj4rBYKEMrltDR5FL1ZoXX/nUh8HCjLfn4g8wGTeGrODcQgPmlKidrv0PJFGUzpII0fxQ8ANAe4hZ7Q7drNJ3gjTcBpUC2JD5Leo31Rpg0Gcg19hCC0Wvgmje3WYkN5AplBlGGSW4gNfL1IYoakRwJiNiqZ+Gb7+6kHDSVneFeO/qJakXzlByjAA6quPbYzSf+AZxAeKCINT+b72x -MIIFdDCCBFygAwIBAgIQJ2buVutJ846r13Ci/ITeIjANBgkqhkiG9w0BAQwFADBvMQswCQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEwNDgzOFowgYUxCzAJBgNVBAYTAkdCMRswGQYDVQQIExJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAOBgNVBAcTB1NhbGZvcmQxGjAYBgNVBAoTEUNPTU9ETyBDQSBMaW1pdGVkMSswKQYDVQQDEyJDT01PRE8gUlNBIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAkehUktIKVrGsDSTdxc9EZ3SZKzejfSNwAHG8U9/E+ioSj0t/EFa9n3Byt2F/yUsPF6c947AEYe7/EZfH9IY+Cvo+XPmT5jR62RRr55yzhaCCenavcZDX7P0N+pxs+t+wgvQUfvm+xKYvT3+Zf7X8Z0NyvQwA1onrayzT7Y+YHBSrfuXjbvzYqOSSJNpDa2K4Vf3qwbxstovzDo2a5JtsaZn4eEgwRdWt4Q08RWD8MpZRJ7xnw8outmvqRsfHIKCxH2XeSAi6pE6p8oNGN4Tr6MyBSENnTnIqm1y9TBsoilwie7SrmNnu4FGDwwlGTm0+mfqVF9p8M1dBPI1R7Qu2XK8sYxrfV8g/vOldxJuvRZnio1oktLqpVj3Pb6r/SVi+8Kj/9Lit6Tf7urj0Czr56ENCHonYhMsT8dm74YlguIwoVqwUHZwK53Hrzw7dPamWoUi9PPevtQ0iTMARgexWO/bTouJbt7IEIlKVgJNp6I5MZfGRAy1wdALqi2cVKWlSArvX31BqVUa/oKMoYX9w0MOiqiwhqkfOKJwGRXa/ghgntNWutMtQ5mv0TIZxMOmm3xaG4Nj/QN370EKIf6MzOi5cHkERgWPOGHFrK+ymircxXDpqR+DDeVnWIBqv8mqYqnK8V0rSS527EPywTEHl7R09XiidnMy/s1Hap0flhFMCAwEAAaOB9DCB8TAfBgNVHSMEGDAWgBStvZh6NLQm9/rEJlTvA73gJMtUGjAdBgNVHQ4EFgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wEQYDVR0gBAowCDAGBgRVHSAAMEQGA1UdHwQ9MDswOaA3oDWGM2h0dHA6Ly9jcmwudXNlcnRydXN0LmNvbS9BZGRUcnVzdEV4dGVybmFsQ0FSb290LmNybDA1BggrBgEFBQcBAQQpMCcwJQYIKwYBBQUHMAGGGWh0dHA6Ly9vY3NwLnVzZXJ0cnVzdC5jb20wDQYJKoZIhvcNAQEMBQADggEBAGS/g/FfmoXQzbihKVcN6Fr30ek+8nYEbvFScLsePP9NDXRqzIGCJdPDoCpdTPW6i6FtxFQJdcfjJw5dhHk3QBN39bSsHNA7qxcS1u80GH4r6XnTq1dFDK8o+tDb5VCViLvfhVdpfZLYUspzgb8c8+a4bmYRBbMelC1/kZWSWfFMzqORcUx8Rww7Cxn2obFshj5cqsQugsv5B5a6SE2Q8pTIqXOi6wZ7I53eovNNVZ96YUWYGGjHXkBrI/V5eu+MtWuLt29G9HvxPUsE2JOAWVrgQSQdso8VYFhH2+9uRv0V9dlfmrPb2LjkQLPNlzmuhbsdjrzch5vRpu/xO28QOG8= -MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEwNDgzOFowbzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRUcnVzdCBFeHRlcm5hbCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0EgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvtH7xsD821+iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9uMq/NzgtHj6RQa1wVsfwTz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzXmk6vBbOmcZSccbNQYArHE504B4YCqOmoaSYYkKtMsE8jqzpPhNjfzp/haW+710LXa0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy2xSoRcRdKn23tNbE7qzNE0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv77+ldU9U0WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYDVR0PBAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0Jvf6xCZU7wO94CTLVBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRkVHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZlj7DYd7usQWxHYINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw56wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvCNr4TDea9Y355e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEXc4g/VhsxOBi0cQ+azcgOno4uG+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ= -0 -TLSv1.2 diff --git a/spring-rest/src/test/resources/cache/2d9345a30d2cc31bb3091d70a8ef6c18.1 b/spring-rest/src/test/resources/cache/2d9345a30d2cc31bb3091d70a8ef6c18.1 deleted file mode 100644 index 83db2312f0..0000000000 --- a/spring-rest/src/test/resources/cache/2d9345a30d2cc31bb3091d70a8ef6c18.1 +++ /dev/null @@ -1,39 +0,0 @@ - - \\ // - \\ .ooo. // - .@@@@@@@@@. - :@@@@@@@@@@@@@: - :@@. '@@@@@' .@@: - @@@@@@@@@@@@@@@@@ - @@@@@@@@@@@@@@@@@ - - :@@ :@@@@@@@@@@@@@@@@@. @@: - @@@ '@@@@@@@@@@@@@@@@@, @@@ - @@@ '@@@@@@@@@@@@@@@@@, @@@ - @@@ '@@@@@@@@@@@@@@@@@, @@@ - @@@ '@@@@@@@@@@@@@@@@@, @@@ - @@@ '@@@@@@@@@@@@@@@@@, @@@ - @@@ '@@@@@@@@@@@@@@@@@, @@@ - @@@@@@@@@@@@@@@@@ - '@@@@@@@@@@@@@@@' - @@@@ @@@@ - @@@@ @@@@ - @@@@ @@@@ - '@@' '@@' - - :@@@. - .@@@@@@@: +@@ `@@ @@` @@ @@ - .@@@@'@@@@: +@@ `@@ @@` @@ @@ - @@@ @@@ +@@ `@@ @@` @@ @@ - .@@ @@: +@@ @@@ `@@ @@` @@@@@@ @@@@@@ @@;@@@@@ - @@@ @@@ +@@ @@@ `@@ @@` @@@@@@ @@@@@@ @@@@@@@@@ - @@@ @@@ +@@ @@@ `@@@@@@@@@@` @@ @@ @@@ :@@ - @@@ @@@ +@@@@@ `@@@@@@@@@@` @@ @@ @@# @@+ - @@@ @@@ +@@@@@+ `@@ @@` @@ @@ @@: @@# - @@: .@@` +@@@+@@ `@@ @@` @@ @@ @@# @@+ - @@@. .@@@ +@@ @@@ `@@ @@` @@ @@ @@@ ,@@ - @@@@@@@@@ +@@ @@@ `@@ @@` @@@@ @@@@ @@@@#@@@@ - @@@@@@@ +@@ #@@ `@@ @@` @@@@: @@@@: @@'@@@@@ - @@: - @@: - @@: diff --git a/spring-rest/src/test/resources/cache/4b217e04ba52215f3a6b64d28f6729c6.0 b/spring-rest/src/test/resources/cache/4b217e04ba52215f3a6b64d28f6729c6.0 deleted file mode 100644 index 85fc22d658..0000000000 --- a/spring-rest/src/test/resources/cache/4b217e04ba52215f3a6b64d28f6729c6.0 +++ /dev/null @@ -1,13 +0,0 @@ -http://publicobject.com/helloworld.txt -GET -0 -HTTP/1.1 301 Moved Permanently -8 -Server: nginx/1.10.0 (Ubuntu) -Date: Sat, 08 Dec 2018 13:02:04 GMT -Content-Type: text/html -Content-Length: 194 -Connection: keep-alive -Location: https://publicobject.com/helloworld.txt -OkHttp-Sent-Millis: 1544274128028 -OkHttp-Received-Millis: 1544274128386 diff --git a/spring-rest/src/test/resources/cache/4b217e04ba52215f3a6b64d28f6729c6.1 b/spring-rest/src/test/resources/cache/4b217e04ba52215f3a6b64d28f6729c6.1 deleted file mode 100644 index acf72eabe3..0000000000 --- a/spring-rest/src/test/resources/cache/4b217e04ba52215f3a6b64d28f6729c6.1 +++ /dev/null @@ -1,7 +0,0 @@ -<html> -<head><title>301 Moved Permanently</title></head> -<body bgcolor="white"> -<center><h1>301 Moved Permanently</h1></center> -<hr><center>nginx/1.10.0 (Ubuntu)</center> -</body> -</html> diff --git a/spring-rest/src/test/resources/cache/journal b/spring-rest/src/test/resources/cache/journal deleted file mode 100644 index a139399103..0000000000 --- a/spring-rest/src/test/resources/cache/journal +++ /dev/null @@ -1,75 +0,0 @@ -libcore.io.DiskLruCache -1 -201105 -2 - -DIRTY 4b217e04ba52215f3a6b64d28f6729c6 -CLEAN 4b217e04ba52215f3a6b64d28f6729c6 333 194 -DIRTY 2d9345a30d2cc31bb3091d70a8ef6c18 -CLEAN 2d9345a30d2cc31bb3091d70a8ef6c18 7618 1759 -READ 4b217e04ba52215f3a6b64d28f6729c6 -DIRTY 4b217e04ba52215f3a6b64d28f6729c6 -CLEAN 4b217e04ba52215f3a6b64d28f6729c6 333 194 -READ 4b217e04ba52215f3a6b64d28f6729c6 -DIRTY 4b217e04ba52215f3a6b64d28f6729c6 -CLEAN 4b217e04ba52215f3a6b64d28f6729c6 333 194 -READ 2d9345a30d2cc31bb3091d70a8ef6c18 -DIRTY 2d9345a30d2cc31bb3091d70a8ef6c18 -CLEAN 2d9345a30d2cc31bb3091d70a8ef6c18 7618 1759 -READ 4b217e04ba52215f3a6b64d28f6729c6 -DIRTY 4b217e04ba52215f3a6b64d28f6729c6 -CLEAN 4b217e04ba52215f3a6b64d28f6729c6 333 194 -READ 4b217e04ba52215f3a6b64d28f6729c6 -DIRTY 4b217e04ba52215f3a6b64d28f6729c6 -CLEAN 4b217e04ba52215f3a6b64d28f6729c6 333 194 -READ 2d9345a30d2cc31bb3091d70a8ef6c18 -READ 4b217e04ba52215f3a6b64d28f6729c6 -DIRTY 4b217e04ba52215f3a6b64d28f6729c6 -CLEAN 4b217e04ba52215f3a6b64d28f6729c6 333 194 -READ 4b217e04ba52215f3a6b64d28f6729c6 -DIRTY 4b217e04ba52215f3a6b64d28f6729c6 -CLEAN 4b217e04ba52215f3a6b64d28f6729c6 333 194 -READ 2d9345a30d2cc31bb3091d70a8ef6c18 -READ 4b217e04ba52215f3a6b64d28f6729c6 -DIRTY 4b217e04ba52215f3a6b64d28f6729c6 -CLEAN 4b217e04ba52215f3a6b64d28f6729c6 333 194 -READ 4b217e04ba52215f3a6b64d28f6729c6 -DIRTY 4b217e04ba52215f3a6b64d28f6729c6 -CLEAN 4b217e04ba52215f3a6b64d28f6729c6 333 194 -READ 2d9345a30d2cc31bb3091d70a8ef6c18 -READ 4b217e04ba52215f3a6b64d28f6729c6 -DIRTY 4b217e04ba52215f3a6b64d28f6729c6 -CLEAN 4b217e04ba52215f3a6b64d28f6729c6 333 194 -READ 4b217e04ba52215f3a6b64d28f6729c6 -DIRTY 4b217e04ba52215f3a6b64d28f6729c6 -CLEAN 4b217e04ba52215f3a6b64d28f6729c6 333 194 -READ 2d9345a30d2cc31bb3091d70a8ef6c18 -READ 4b217e04ba52215f3a6b64d28f6729c6 -DIRTY 4b217e04ba52215f3a6b64d28f6729c6 -CLEAN 4b217e04ba52215f3a6b64d28f6729c6 333 194 -READ 4b217e04ba52215f3a6b64d28f6729c6 -DIRTY 4b217e04ba52215f3a6b64d28f6729c6 -CLEAN 4b217e04ba52215f3a6b64d28f6729c6 333 194 -READ 2d9345a30d2cc31bb3091d70a8ef6c18 -READ 4b217e04ba52215f3a6b64d28f6729c6 -DIRTY 4b217e04ba52215f3a6b64d28f6729c6 -CLEAN 4b217e04ba52215f3a6b64d28f6729c6 333 194 -READ 4b217e04ba52215f3a6b64d28f6729c6 -DIRTY 4b217e04ba52215f3a6b64d28f6729c6 -CLEAN 4b217e04ba52215f3a6b64d28f6729c6 333 194 -READ 2d9345a30d2cc31bb3091d70a8ef6c18 -READ 4b217e04ba52215f3a6b64d28f6729c6 -DIRTY 4b217e04ba52215f3a6b64d28f6729c6 -CLEAN 4b217e04ba52215f3a6b64d28f6729c6 333 194 -READ 4b217e04ba52215f3a6b64d28f6729c6 -DIRTY 4b217e04ba52215f3a6b64d28f6729c6 -CLEAN 4b217e04ba52215f3a6b64d28f6729c6 333 194 -READ 2d9345a30d2cc31bb3091d70a8ef6c18 -DIRTY 2d9345a30d2cc31bb3091d70a8ef6c18 -CLEAN 2d9345a30d2cc31bb3091d70a8ef6c18 7618 1759 -READ 4b217e04ba52215f3a6b64d28f6729c6 -DIRTY 4b217e04ba52215f3a6b64d28f6729c6 -CLEAN 4b217e04ba52215f3a6b64d28f6729c6 333 194 -READ 2d9345a30d2cc31bb3091d70a8ef6c18 -DIRTY 2d9345a30d2cc31bb3091d70a8ef6c18 -CLEAN 2d9345a30d2cc31bb3091d70a8ef6c18 7618 1759 diff --git a/spring-rest/src/test/resources/test.txt b/spring-rest/src/test/resources/test.txt deleted file mode 100644 index 95d09f2b10..0000000000 --- a/spring-rest/src/test/resources/test.txt +++ /dev/null @@ -1 +0,0 @@ -hello world \ No newline at end of file diff --git a/spring-resttemplate/README.md b/spring-resttemplate/README.md index 054071a4df..eef85792ce 100644 --- a/spring-resttemplate/README.md +++ b/spring-resttemplate/README.md @@ -17,3 +17,11 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Uploading MultipartFile with Spring RestTemplate](https://www.baeldung.com/spring-rest-template-multipart-upload) - [Get and Post Lists of Objects with RestTemplate](https://www.baeldung.com/spring-rest-template-list) - [Copy of RestTemplate Post Request with JSON](https://www.baeldung.com/spring-resttemplate-post-json-test) +- [HTTP PUT vs HTTP PATCH in a REST API](https://www.baeldung.com/http-put-patch-difference-spring) +- [A Custom Media Type for a Spring REST API](https://www.baeldung.com/spring-rest-custom-media-type) +- [Download an Image or a File with Spring MVC](https://www.baeldung.com/spring-controller-return-image-file) + +### NOTE: + +This module is closed and should **not** be used to store the code +for any further articles. diff --git a/spring-resttemplate/pom.xml b/spring-resttemplate/pom.xml index 26a3143d6d..0b5d0b20d0 100644 --- a/spring-resttemplate/pom.xml +++ b/spring-resttemplate/pom.xml @@ -1,15 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-resttemplate</artifactId> <version>0.1-SNAPSHOT</version> <name>spring-resttemplate</name> <packaging>war</packaging> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> diff --git a/spring-resttemplate/src/main/java/com/baeldung/SpringContextIntegrationTest.java b/spring-resttemplate/src/main/java/com/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 3c2cde4268..0000000000 --- a/spring-resttemplate/src/main/java/com/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.changeport.CustomApplication; -import com.baeldung.produceimage.ImageApplication; -import com.baeldung.propertyeditor.PropertyEditorApplication; -import com.baeldung.responseheaders.ResponseHeadersApplication; -import com.baeldung.sampleapp.config.MainApplication; -import com.baeldung.web.log.app.Application; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = { CustomApplication.class, ImageApplication.class, PropertyEditorApplication.class, - ResponseHeadersApplication.class, Application.class, com.baeldung.web.upload.app.UploadApplication.class, - MainApplication.class}) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-resttemplate/src/main/java/com/baeldung/SpringContextTest.java b/spring-resttemplate/src/main/java/com/baeldung/SpringContextTest.java index 0f39fc3983..19d5eabd2b 100644 --- a/spring-resttemplate/src/main/java/com/baeldung/SpringContextTest.java +++ b/spring-resttemplate/src/main/java/com/baeldung/SpringContextTest.java @@ -5,17 +5,14 @@ import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; -import com.baeldung.changeport.CustomApplication; import com.baeldung.produceimage.ImageApplication; -import com.baeldung.propertyeditor.PropertyEditorApplication; import com.baeldung.responseheaders.ResponseHeadersApplication; -import com.baeldung.sampleapp.config.MainApplication; -import com.baeldung.web.log.app.Application; @RunWith(SpringRunner.class) -@SpringBootTest(classes = { CustomApplication.class, ImageApplication.class, PropertyEditorApplication.class, - ResponseHeadersApplication.class, Application.class, com.baeldung.web.upload.app.UploadApplication.class, - MainApplication.class}) +@SpringBootTest(classes = { ImageApplication.class, + ResponseHeadersApplication.class, + com.baeldung.web.upload.app.UploadApplication.class, + }) public class SpringContextTest { @Test diff --git a/spring-resttemplate/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-resttemplate/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 3c762b894b..0000000000 --- a/spring-resttemplate/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.baeldung; - -import org.baeldung.resttemplate.RestTemplateConfigurationApplication; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = RestTemplateConfigurationApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-roo/pom.xml b/spring-roo/pom.xml index eb3a680d93..456642b1f0 100644 --- a/spring-roo/pom.xml +++ b/spring-roo/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <!-- Spring IO Platform is the parent of the generated application to be able to use Spring Boot and all its default configuration --> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung</groupId> @@ -13,7 +13,7 @@ <groupId>io.spring.platform</groupId> <artifactId>platform-bom</artifactId> <version>Athens-RELEASE</version> - <relativePath /> + <relativePath/> </parent> <dependencies> @@ -238,7 +238,6 @@ </dependencies> <build> - <pluginManagement> <plugins> <plugin> diff --git a/spring-scheduling/pom.xml b/spring-scheduling/pom.xml index 21327cf52f..a337de39b7 100644 --- a/spring-scheduling/pom.xml +++ b/spring-scheduling/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -7,8 +8,8 @@ <packaging>war</packaging> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> diff --git a/spring-security-acl/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-acl/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index c7890d79ac..0000000000 --- a/spring-security-acl/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.baeldung; - -import org.baeldung.acl.Application; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-security-angular/server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-angular/server/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 8c62ac5e91..0000000000 --- a/spring-security-angular/server/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.springbootsecurityrest.basicauth.SpringBootSecurityApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringBootSecurityApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-security-cache-control/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-cache-control/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index c047fc6210..0000000000 --- a/spring-security-cache-control/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.cachecontrol.AppRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = AppRunner.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-security-core/src/test/java/com/baeldung/SpringContextIntegrationTest.java b/spring-security-core/src/test/java/com/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 1cdff1342c..0000000000 --- a/spring-security-core/src/test/java/com/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.app.App; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = App.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-security-acl/README.md b/spring-security-modules/spring-security-acl/README.md similarity index 100% rename from spring-security-acl/README.md rename to spring-security-modules/spring-security-acl/README.md diff --git a/spring-security-acl/pom.xml b/spring-security-modules/spring-security-acl/pom.xml similarity index 92% rename from spring-security-acl/pom.xml rename to spring-security-modules/spring-security-acl/pom.xml index 8acc39b785..3c613f9d92 100644 --- a/spring-security-acl/pom.xml +++ b/spring-security-modules/spring-security-acl/pom.xml @@ -1,18 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-security-acl</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-security-acl</name> - <description>Spring Security ACL</description> <packaging>war</packaging> + <description>Spring Security ACL</description> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-boot-1</relativePath> + <relativePath>../../parent-boot-1</relativePath> </parent> <dependencies> diff --git a/spring-security-acl/src/main/java/org/baeldung/acl/Application.java b/spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/Application.java similarity index 100% rename from spring-security-acl/src/main/java/org/baeldung/acl/Application.java rename to spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/Application.java diff --git a/spring-security-acl/src/main/java/org/baeldung/acl/config/ACLContext.java b/spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/config/ACLContext.java similarity index 100% rename from spring-security-acl/src/main/java/org/baeldung/acl/config/ACLContext.java rename to spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/config/ACLContext.java diff --git a/spring-security-acl/src/main/java/org/baeldung/acl/config/AclMethodSecurityConfiguration.java b/spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/config/AclMethodSecurityConfiguration.java similarity index 100% rename from spring-security-acl/src/main/java/org/baeldung/acl/config/AclMethodSecurityConfiguration.java rename to spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/config/AclMethodSecurityConfiguration.java diff --git a/spring-security-acl/src/main/java/org/baeldung/acl/config/JPAPersistenceConfig.java b/spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/config/JPAPersistenceConfig.java similarity index 100% rename from spring-security-acl/src/main/java/org/baeldung/acl/config/JPAPersistenceConfig.java rename to spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/config/JPAPersistenceConfig.java diff --git a/spring-security-acl/src/main/java/org/baeldung/acl/persistence/dao/NoticeMessageRepository.java b/spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/persistence/dao/NoticeMessageRepository.java similarity index 100% rename from spring-security-acl/src/main/java/org/baeldung/acl/persistence/dao/NoticeMessageRepository.java rename to spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/persistence/dao/NoticeMessageRepository.java diff --git a/spring-security-acl/src/main/java/org/baeldung/acl/persistence/entity/NoticeMessage.java b/spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/persistence/entity/NoticeMessage.java similarity index 100% rename from spring-security-acl/src/main/java/org/baeldung/acl/persistence/entity/NoticeMessage.java rename to spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/persistence/entity/NoticeMessage.java diff --git a/spring-security-acl/src/main/resources/acl-data.sql b/spring-security-modules/spring-security-acl/src/main/resources/acl-data.sql similarity index 100% rename from spring-security-acl/src/main/resources/acl-data.sql rename to spring-security-modules/spring-security-acl/src/main/resources/acl-data.sql diff --git a/spring-security-acl/src/main/resources/acl-schema.sql b/spring-security-modules/spring-security-acl/src/main/resources/acl-schema.sql similarity index 100% rename from spring-security-acl/src/main/resources/acl-schema.sql rename to spring-security-modules/spring-security-acl/src/main/resources/acl-schema.sql diff --git a/spring-security-core/src/main/resources/logback.xml b/spring-security-modules/spring-security-acl/src/main/resources/logback.xml similarity index 100% rename from spring-security-core/src/main/resources/logback.xml rename to spring-security-modules/spring-security-acl/src/main/resources/logback.xml diff --git a/spring-security-acl/src/main/resources/org.baeldung.acl.datasource.properties b/spring-security-modules/spring-security-acl/src/main/resources/org.baeldung.acl.datasource.properties similarity index 100% rename from spring-security-acl/src/main/resources/org.baeldung.acl.datasource.properties rename to spring-security-modules/spring-security-acl/src/main/resources/org.baeldung.acl.datasource.properties diff --git a/spring-security-acl/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-acl/src/test/java/org/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-acl/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-acl/src/test/java/org/baeldung/SpringContextTest.java diff --git a/spring-security-acl/src/test/java/org/baeldung/acl/SpringACLIntegrationTest.java b/spring-security-modules/spring-security-acl/src/test/java/org/baeldung/acl/SpringACLIntegrationTest.java similarity index 100% rename from spring-security-acl/src/test/java/org/baeldung/acl/SpringACLIntegrationTest.java rename to spring-security-modules/spring-security-acl/src/test/java/org/baeldung/acl/SpringACLIntegrationTest.java diff --git a/spring-security-angular/README.md b/spring-security-modules/spring-security-angular/README.md similarity index 100% rename from spring-security-angular/README.md rename to spring-security-modules/spring-security-angular/README.md diff --git a/spring-security-angular/client/anguarjs/app.js b/spring-security-modules/spring-security-angular/client/anguarjs/app.js similarity index 100% rename from spring-security-angular/client/anguarjs/app.js rename to spring-security-modules/spring-security-angular/client/anguarjs/app.js diff --git a/spring-security-angular/client/anguarjs/home/home.controller.js b/spring-security-modules/spring-security-angular/client/anguarjs/home/home.controller.js similarity index 100% rename from spring-security-angular/client/anguarjs/home/home.controller.js rename to spring-security-modules/spring-security-angular/client/anguarjs/home/home.controller.js diff --git a/spring-security-angular/client/anguarjs/home/home.view.html b/spring-security-modules/spring-security-angular/client/anguarjs/home/home.view.html similarity index 100% rename from spring-security-angular/client/anguarjs/home/home.view.html rename to spring-security-modules/spring-security-angular/client/anguarjs/home/home.view.html diff --git a/spring-security-angular/client/anguarjs/index.html b/spring-security-modules/spring-security-angular/client/anguarjs/index.html similarity index 100% rename from spring-security-angular/client/anguarjs/index.html rename to spring-security-modules/spring-security-angular/client/anguarjs/index.html diff --git a/spring-security-angular/client/anguarjs/login/login.controller.js b/spring-security-modules/spring-security-angular/client/anguarjs/login/login.controller.js similarity index 100% rename from spring-security-angular/client/anguarjs/login/login.controller.js rename to spring-security-modules/spring-security-angular/client/anguarjs/login/login.controller.js diff --git a/spring-security-angular/client/anguarjs/login/login.view.html b/spring-security-modules/spring-security-angular/client/anguarjs/login/login.view.html similarity index 100% rename from spring-security-angular/client/anguarjs/login/login.view.html rename to spring-security-modules/spring-security-angular/client/anguarjs/login/login.view.html diff --git a/spring-security-angular/client/angular2/app.css b/spring-security-modules/spring-security-angular/client/angular2/app.css similarity index 100% rename from spring-security-angular/client/angular2/app.css rename to spring-security-modules/spring-security-angular/client/angular2/app.css diff --git a/spring-security-angular/client/angular2/app/app.component.html b/spring-security-modules/spring-security-angular/client/angular2/app/app.component.html similarity index 100% rename from spring-security-angular/client/angular2/app/app.component.html rename to spring-security-modules/spring-security-angular/client/angular2/app/app.component.html diff --git a/spring-security-angular/client/angular2/app/app.component.ts b/spring-security-modules/spring-security-angular/client/angular2/app/app.component.ts similarity index 100% rename from spring-security-angular/client/angular2/app/app.component.ts rename to spring-security-modules/spring-security-angular/client/angular2/app/app.component.ts diff --git a/spring-security-angular/client/angular2/app/app.module.ts b/spring-security-modules/spring-security-angular/client/angular2/app/app.module.ts similarity index 100% rename from spring-security-angular/client/angular2/app/app.module.ts rename to spring-security-modules/spring-security-angular/client/angular2/app/app.module.ts diff --git a/spring-security-angular/client/angular2/app/app.routing.ts b/spring-security-modules/spring-security-angular/client/angular2/app/app.routing.ts similarity index 100% rename from spring-security-angular/client/angular2/app/app.routing.ts rename to spring-security-modules/spring-security-angular/client/angular2/app/app.routing.ts diff --git a/spring-security-angular/client/angular2/app/home/home.component.html b/spring-security-modules/spring-security-angular/client/angular2/app/home/home.component.html similarity index 100% rename from spring-security-angular/client/angular2/app/home/home.component.html rename to spring-security-modules/spring-security-angular/client/angular2/app/home/home.component.html diff --git a/spring-security-angular/client/angular2/app/home/home.component.ts b/spring-security-modules/spring-security-angular/client/angular2/app/home/home.component.ts similarity index 100% rename from spring-security-angular/client/angular2/app/home/home.component.ts rename to spring-security-modules/spring-security-angular/client/angular2/app/home/home.component.ts diff --git a/spring-security-angular/client/angular2/app/login/login.component.html b/spring-security-modules/spring-security-angular/client/angular2/app/login/login.component.html similarity index 100% rename from spring-security-angular/client/angular2/app/login/login.component.html rename to spring-security-modules/spring-security-angular/client/angular2/app/login/login.component.html diff --git a/spring-security-angular/client/angular2/app/login/login.component.ts b/spring-security-modules/spring-security-angular/client/angular2/app/login/login.component.ts similarity index 100% rename from spring-security-angular/client/angular2/app/login/login.component.ts rename to spring-security-modules/spring-security-angular/client/angular2/app/login/login.component.ts diff --git a/spring-security-angular/client/angular2/app/main.ts b/spring-security-modules/spring-security-angular/client/angular2/app/main.ts similarity index 100% rename from spring-security-angular/client/angular2/app/main.ts rename to spring-security-modules/spring-security-angular/client/angular2/app/main.ts diff --git a/spring-security-angular/client/angular2/index.html b/spring-security-modules/spring-security-angular/client/angular2/index.html similarity index 100% rename from spring-security-angular/client/angular2/index.html rename to spring-security-modules/spring-security-angular/client/angular2/index.html diff --git a/spring-security-angular/client/angular2/package.json b/spring-security-modules/spring-security-angular/client/angular2/package.json similarity index 100% rename from spring-security-angular/client/angular2/package.json rename to spring-security-modules/spring-security-angular/client/angular2/package.json diff --git a/spring-security-angular/client/angular2/systemjs.config.js b/spring-security-modules/spring-security-angular/client/angular2/systemjs.config.js similarity index 100% rename from spring-security-angular/client/angular2/systemjs.config.js rename to spring-security-modules/spring-security-angular/client/angular2/systemjs.config.js diff --git a/spring-security-angular/client/angular2/tsconfig.json b/spring-security-modules/spring-security-angular/client/angular2/tsconfig.json similarity index 100% rename from spring-security-angular/client/angular2/tsconfig.json rename to spring-security-modules/spring-security-angular/client/angular2/tsconfig.json diff --git a/spring-security-angular/client/angular4/.angular-cli.json b/spring-security-modules/spring-security-angular/client/angular4/.angular-cli.json similarity index 95% rename from spring-security-angular/client/angular4/.angular-cli.json rename to spring-security-modules/spring-security-angular/client/angular4/.angular-cli.json index 967934b2f7..34274db4eb 100644 --- a/spring-security-angular/client/angular4/.angular-cli.json +++ b/spring-security-modules/spring-security-angular/client/angular4/.angular-cli.json @@ -1,65 +1,65 @@ -{ - "$schema": "./node_modules/@angular/cli/lib/config/schema.json", - "project": { - "name": "angular-crud" - }, - "apps": [ - { - "root": "src", - "outDir": "dist", - "assets": [ - "assets", - "favicon.ico" - ], - "index": "index.html", - "main": "main.ts", - "polyfills": "polyfills.ts", - "test": "test.ts", - "tsconfig": "tsconfig.app.json", - "testTsconfig": "tsconfig.spec.json", - "prefix": "app", - "styles": [ - "../node_modules/bootstrap/dist/css/bootstrap.min.css", - "styles.css", - "../node_modules/font-awesome/css/font-awesome.min.css" - ], - "scripts": [ - "../node_modules/jquery/dist/jquery.js", - "../node_modules/bootstrap/dist/js/bootstrap.js" - ], - "environmentSource": "environments/environment.ts", - "environments": { - "dev": "environments/environment.ts", - "prod": "environments/environment.prod.ts" - } - } - ], - "e2e": { - "protractor": { - "config": "./protractor.conf.js" - } - }, - "lint": [ - { - "project": "src/tsconfig.app.json", - "exclude": "**/node_modules/**" - }, - { - "project": "src/tsconfig.spec.json", - "exclude": "**/node_modules/**" - }, - { - "project": "e2e/tsconfig.e2e.json", - "exclude": "**/node_modules/**" - } - ], - "test": { - "karma": { - "config": "./karma.conf.js" - } - }, - "defaults": { - "styleExt": "css", - "component": {} - } +{ + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "project": { + "name": "angular-crud" + }, + "apps": [ + { + "root": "src", + "outDir": "dist", + "assets": [ + "assets", + "favicon.ico" + ], + "index": "index.html", + "main": "main.ts", + "polyfills": "polyfills.ts", + "test": "test.ts", + "tsconfig": "tsconfig.app.json", + "testTsconfig": "tsconfig.spec.json", + "prefix": "app", + "styles": [ + "../node_modules/bootstrap/dist/css/bootstrap.min.css", + "styles.css", + "../node_modules/font-awesome/css/font-awesome.min.css" + ], + "scripts": [ + "../node_modules/jquery/dist/jquery.js", + "../node_modules/bootstrap/dist/js/bootstrap.js" + ], + "environmentSource": "environments/environment.ts", + "environments": { + "dev": "environments/environment.ts", + "prod": "environments/environment.prod.ts" + } + } + ], + "e2e": { + "protractor": { + "config": "./protractor.conf.js" + } + }, + "lint": [ + { + "project": "src/tsconfig.app.json", + "exclude": "**/node_modules/**" + }, + { + "project": "src/tsconfig.spec.json", + "exclude": "**/node_modules/**" + }, + { + "project": "e2e/tsconfig.e2e.json", + "exclude": "**/node_modules/**" + } + ], + "test": { + "karma": { + "config": "./karma.conf.js" + } + }, + "defaults": { + "styleExt": "css", + "component": {} + } } \ No newline at end of file diff --git a/spring-security-angular/client/angular4/package.json b/spring-security-modules/spring-security-angular/client/angular4/package.json similarity index 100% rename from spring-security-angular/client/angular4/package.json rename to spring-security-modules/spring-security-angular/client/angular4/package.json diff --git a/spring-security-angular/client/angular4/src/app/app.component.html b/spring-security-modules/spring-security-angular/client/angular4/src/app/app.component.html similarity index 100% rename from spring-security-angular/client/angular4/src/app/app.component.html rename to spring-security-modules/spring-security-angular/client/angular4/src/app/app.component.html diff --git a/spring-security-angular/client/angular4/src/app/app.component.ts b/spring-security-modules/spring-security-angular/client/angular4/src/app/app.component.ts similarity index 100% rename from spring-security-angular/client/angular4/src/app/app.component.ts rename to spring-security-modules/spring-security-angular/client/angular4/src/app/app.component.ts diff --git a/spring-security-angular/client/angular4/src/app/app.module.ts b/spring-security-modules/spring-security-angular/client/angular4/src/app/app.module.ts similarity index 100% rename from spring-security-angular/client/angular4/src/app/app.module.ts rename to spring-security-modules/spring-security-angular/client/angular4/src/app/app.module.ts diff --git a/spring-security-angular/client/angular4/src/app/app.routing.ts b/spring-security-modules/spring-security-angular/client/angular4/src/app/app.routing.ts similarity index 100% rename from spring-security-angular/client/angular4/src/app/app.routing.ts rename to spring-security-modules/spring-security-angular/client/angular4/src/app/app.routing.ts diff --git a/spring-security-angular/client/angular4/src/app/home/home.component.html b/spring-security-modules/spring-security-angular/client/angular4/src/app/home/home.component.html similarity index 100% rename from spring-security-angular/client/angular4/src/app/home/home.component.html rename to spring-security-modules/spring-security-angular/client/angular4/src/app/home/home.component.html diff --git a/spring-security-angular/client/angular4/src/app/home/home.component.ts b/spring-security-modules/spring-security-angular/client/angular4/src/app/home/home.component.ts similarity index 100% rename from spring-security-angular/client/angular4/src/app/home/home.component.ts rename to spring-security-modules/spring-security-angular/client/angular4/src/app/home/home.component.ts diff --git a/spring-security-angular/client/angular4/src/app/login/login.component.html b/spring-security-modules/spring-security-angular/client/angular4/src/app/login/login.component.html similarity index 100% rename from spring-security-angular/client/angular4/src/app/login/login.component.html rename to spring-security-modules/spring-security-angular/client/angular4/src/app/login/login.component.html diff --git a/spring-security-angular/client/angular4/src/app/login/login.component.ts b/spring-security-modules/spring-security-angular/client/angular4/src/app/login/login.component.ts similarity index 100% rename from spring-security-angular/client/angular4/src/app/login/login.component.ts rename to spring-security-modules/spring-security-angular/client/angular4/src/app/login/login.component.ts diff --git a/spring-security-angular/client/angular4/src/index.html b/spring-security-modules/spring-security-angular/client/angular4/src/index.html similarity index 100% rename from spring-security-angular/client/angular4/src/index.html rename to spring-security-modules/spring-security-angular/client/angular4/src/index.html diff --git a/spring-security-angular/client/angular4/src/main.ts b/spring-security-modules/spring-security-angular/client/angular4/src/main.ts similarity index 100% rename from spring-security-angular/client/angular4/src/main.ts rename to spring-security-modules/spring-security-angular/client/angular4/src/main.ts diff --git a/spring-security-angular/client/angular6/src/polyfills.ts b/spring-security-modules/spring-security-angular/client/angular4/src/polyfills.ts similarity index 95% rename from spring-security-angular/client/angular6/src/polyfills.ts rename to spring-security-modules/spring-security-angular/client/angular4/src/polyfills.ts index a4984ced57..ec50a75aeb 100644 --- a/spring-security-angular/client/angular6/src/polyfills.ts +++ b/spring-security-modules/spring-security-angular/client/angular4/src/polyfills.ts @@ -1,68 +1,68 @@ -/** - * This file includes polyfills needed by Angular and is loaded before the app. - * You can add your own extra polyfills to this file. - * - * This file is divided into 2 sections: - * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. - * 2. Application imports. Files imported after ZoneJS that should be loaded before your main - * file. - * - * The current setup is for so-called "evergreen" browsers; the last versions of browsers that - * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), - * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. - * - * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html - */ - -/*************************************************************************************************** - * BROWSER POLYFILLS - */ - -/** IE9, IE10 and IE11 requires all of the following polyfills. **/ -// import 'core-js/es6/symbol'; -// import 'core-js/es6/object'; -// import 'core-js/es6/function'; -// import 'core-js/es6/parse-int'; -// import 'core-js/es6/parse-float'; -// import 'core-js/es6/number'; -// import 'core-js/es6/math'; -// import 'core-js/es6/string'; -// import 'core-js/es6/date'; -// import 'core-js/es6/array'; -// import 'core-js/es6/regexp'; -// import 'core-js/es6/map'; -// import 'core-js/es6/weak-map'; -// import 'core-js/es6/set'; -/** IE10 and IE11 requires the following for NgClass support on SVG elements */ -// import 'classlist.js'; // Run `npm install --save classlist.js`. -/** Evergreen browsers require these. **/ -import 'core-js/es6/reflect'; -import 'core-js/es7/reflect'; - - -/** - * Required to support Web Animations `@angular/animation`. - * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation - **/ -// import 'web-animations-js'; // Run `npm install --save web-animations-js`. - - -/*************************************************************************************************** - * Zone JS is required by Angular itself. - */ -import 'zone.js/dist/zone'; // Included with Angular CLI. - - -/*************************************************************************************************** - * APPLICATION IMPORTS - */ - -/** - * Date, currency, decimal and percent pipes. - * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 - */ -// import 'intl'; // Run `npm install --save intl`. -/** - * Need to import at least one locale-data with intl. - */ +/** + * This file includes polyfills needed by Angular and is loaded before the app. + * You can add your own extra polyfills to this file. + * + * This file is divided into 2 sections: + * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. + * 2. Application imports. Files imported after ZoneJS that should be loaded before your main + * file. + * + * The current setup is for so-called "evergreen" browsers; the last versions of browsers that + * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), + * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. + * + * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html + */ + +/*************************************************************************************************** + * BROWSER POLYFILLS + */ + +/** IE9, IE10 and IE11 requires all of the following polyfills. **/ +// import 'core-js/es6/symbol'; +// import 'core-js/es6/object'; +// import 'core-js/es6/function'; +// import 'core-js/es6/parse-int'; +// import 'core-js/es6/parse-float'; +// import 'core-js/es6/number'; +// import 'core-js/es6/math'; +// import 'core-js/es6/string'; +// import 'core-js/es6/date'; +// import 'core-js/es6/array'; +// import 'core-js/es6/regexp'; +// import 'core-js/es6/map'; +// import 'core-js/es6/weak-map'; +// import 'core-js/es6/set'; +/** IE10 and IE11 requires the following for NgClass support on SVG elements */ +// import 'classlist.js'; // Run `npm install --save classlist.js`. +/** Evergreen browsers require these. **/ +import 'core-js/es6/reflect'; +import 'core-js/es7/reflect'; + + +/** + * Required to support Web Animations `@angular/animation`. + * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation + **/ +// import 'web-animations-js'; // Run `npm install --save web-animations-js`. + + +/*************************************************************************************************** + * Zone JS is required by Angular itself. + */ +import 'zone.js/dist/zone'; // Included with Angular CLI. + + +/*************************************************************************************************** + * APPLICATION IMPORTS + */ + +/** + * Date, currency, decimal and percent pipes. + * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 + */ +// import 'intl'; // Run `npm install --save intl`. +/** + * Need to import at least one locale-data with intl. + */ // import 'intl/locale-data/jsonp/en'; \ No newline at end of file diff --git a/spring-security-angular/client/angular4/src/styles.css b/spring-security-modules/spring-security-angular/client/angular4/src/styles.css similarity index 100% rename from spring-security-angular/client/angular4/src/styles.css rename to spring-security-modules/spring-security-angular/client/angular4/src/styles.css diff --git a/spring-security-angular/client/angular4/src/tsconfig.app.json b/spring-security-modules/spring-security-angular/client/angular4/src/tsconfig.app.json similarity index 100% rename from spring-security-angular/client/angular4/src/tsconfig.app.json rename to spring-security-modules/spring-security-angular/client/angular4/src/tsconfig.app.json diff --git a/spring-security-angular/client/angular4/tsconfig.json b/spring-security-modules/spring-security-angular/client/angular4/tsconfig.json similarity index 100% rename from spring-security-angular/client/angular4/tsconfig.json rename to spring-security-modules/spring-security-angular/client/angular4/tsconfig.json diff --git a/spring-security-angular/client/angular4/tslint.json b/spring-security-modules/spring-security-angular/client/angular4/tslint.json similarity index 100% rename from spring-security-angular/client/angular4/tslint.json rename to spring-security-modules/spring-security-angular/client/angular4/tslint.json diff --git a/spring-security-angular/client/angular5/.angular-cli.json b/spring-security-modules/spring-security-angular/client/angular5/.angular-cli.json similarity index 100% rename from spring-security-angular/client/angular5/.angular-cli.json rename to spring-security-modules/spring-security-angular/client/angular5/.angular-cli.json diff --git a/spring-security-angular/client/angular5/package.json b/spring-security-modules/spring-security-angular/client/angular5/package.json similarity index 100% rename from spring-security-angular/client/angular5/package.json rename to spring-security-modules/spring-security-angular/client/angular5/package.json diff --git a/spring-security-angular/client/angular5/src/app/app.component.html b/spring-security-modules/spring-security-angular/client/angular5/src/app/app.component.html similarity index 100% rename from spring-security-angular/client/angular5/src/app/app.component.html rename to spring-security-modules/spring-security-angular/client/angular5/src/app/app.component.html diff --git a/spring-security-angular/client/angular5/src/app/app.component.ts b/spring-security-modules/spring-security-angular/client/angular5/src/app/app.component.ts similarity index 100% rename from spring-security-angular/client/angular5/src/app/app.component.ts rename to spring-security-modules/spring-security-angular/client/angular5/src/app/app.component.ts diff --git a/spring-security-angular/client/angular5/src/app/app.module.ts b/spring-security-modules/spring-security-angular/client/angular5/src/app/app.module.ts similarity index 100% rename from spring-security-angular/client/angular5/src/app/app.module.ts rename to spring-security-modules/spring-security-angular/client/angular5/src/app/app.module.ts diff --git a/spring-security-angular/client/angular5/src/app/app.routing.ts b/spring-security-modules/spring-security-angular/client/angular5/src/app/app.routing.ts similarity index 100% rename from spring-security-angular/client/angular5/src/app/app.routing.ts rename to spring-security-modules/spring-security-angular/client/angular5/src/app/app.routing.ts diff --git a/spring-security-angular/client/angular5/src/app/home/home.component.html b/spring-security-modules/spring-security-angular/client/angular5/src/app/home/home.component.html similarity index 100% rename from spring-security-angular/client/angular5/src/app/home/home.component.html rename to spring-security-modules/spring-security-angular/client/angular5/src/app/home/home.component.html diff --git a/spring-security-angular/client/angular5/src/app/home/home.component.ts b/spring-security-modules/spring-security-angular/client/angular5/src/app/home/home.component.ts similarity index 100% rename from spring-security-angular/client/angular5/src/app/home/home.component.ts rename to spring-security-modules/spring-security-angular/client/angular5/src/app/home/home.component.ts diff --git a/spring-security-angular/client/angular5/src/app/login/login.component.html b/spring-security-modules/spring-security-angular/client/angular5/src/app/login/login.component.html similarity index 100% rename from spring-security-angular/client/angular5/src/app/login/login.component.html rename to spring-security-modules/spring-security-angular/client/angular5/src/app/login/login.component.html diff --git a/spring-security-angular/client/angular5/src/app/login/login.component.ts b/spring-security-modules/spring-security-angular/client/angular5/src/app/login/login.component.ts similarity index 100% rename from spring-security-angular/client/angular5/src/app/login/login.component.ts rename to spring-security-modules/spring-security-angular/client/angular5/src/app/login/login.component.ts diff --git a/spring-security-angular/client/angular5/src/index.html b/spring-security-modules/spring-security-angular/client/angular5/src/index.html similarity index 100% rename from spring-security-angular/client/angular5/src/index.html rename to spring-security-modules/spring-security-angular/client/angular5/src/index.html diff --git a/spring-security-angular/client/angular5/src/main.ts b/spring-security-modules/spring-security-angular/client/angular5/src/main.ts similarity index 100% rename from spring-security-angular/client/angular5/src/main.ts rename to spring-security-modules/spring-security-angular/client/angular5/src/main.ts diff --git a/spring-security-angular/client/angular4/src/polyfills.ts b/spring-security-modules/spring-security-angular/client/angular5/src/polyfills.ts similarity index 95% rename from spring-security-angular/client/angular4/src/polyfills.ts rename to spring-security-modules/spring-security-angular/client/angular5/src/polyfills.ts index a4984ced57..ec50a75aeb 100644 --- a/spring-security-angular/client/angular4/src/polyfills.ts +++ b/spring-security-modules/spring-security-angular/client/angular5/src/polyfills.ts @@ -1,68 +1,68 @@ -/** - * This file includes polyfills needed by Angular and is loaded before the app. - * You can add your own extra polyfills to this file. - * - * This file is divided into 2 sections: - * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. - * 2. Application imports. Files imported after ZoneJS that should be loaded before your main - * file. - * - * The current setup is for so-called "evergreen" browsers; the last versions of browsers that - * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), - * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. - * - * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html - */ - -/*************************************************************************************************** - * BROWSER POLYFILLS - */ - -/** IE9, IE10 and IE11 requires all of the following polyfills. **/ -// import 'core-js/es6/symbol'; -// import 'core-js/es6/object'; -// import 'core-js/es6/function'; -// import 'core-js/es6/parse-int'; -// import 'core-js/es6/parse-float'; -// import 'core-js/es6/number'; -// import 'core-js/es6/math'; -// import 'core-js/es6/string'; -// import 'core-js/es6/date'; -// import 'core-js/es6/array'; -// import 'core-js/es6/regexp'; -// import 'core-js/es6/map'; -// import 'core-js/es6/weak-map'; -// import 'core-js/es6/set'; -/** IE10 and IE11 requires the following for NgClass support on SVG elements */ -// import 'classlist.js'; // Run `npm install --save classlist.js`. -/** Evergreen browsers require these. **/ -import 'core-js/es6/reflect'; -import 'core-js/es7/reflect'; - - -/** - * Required to support Web Animations `@angular/animation`. - * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation - **/ -// import 'web-animations-js'; // Run `npm install --save web-animations-js`. - - -/*************************************************************************************************** - * Zone JS is required by Angular itself. - */ -import 'zone.js/dist/zone'; // Included with Angular CLI. - - -/*************************************************************************************************** - * APPLICATION IMPORTS - */ - -/** - * Date, currency, decimal and percent pipes. - * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 - */ -// import 'intl'; // Run `npm install --save intl`. -/** - * Need to import at least one locale-data with intl. - */ +/** + * This file includes polyfills needed by Angular and is loaded before the app. + * You can add your own extra polyfills to this file. + * + * This file is divided into 2 sections: + * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. + * 2. Application imports. Files imported after ZoneJS that should be loaded before your main + * file. + * + * The current setup is for so-called "evergreen" browsers; the last versions of browsers that + * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), + * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. + * + * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html + */ + +/*************************************************************************************************** + * BROWSER POLYFILLS + */ + +/** IE9, IE10 and IE11 requires all of the following polyfills. **/ +// import 'core-js/es6/symbol'; +// import 'core-js/es6/object'; +// import 'core-js/es6/function'; +// import 'core-js/es6/parse-int'; +// import 'core-js/es6/parse-float'; +// import 'core-js/es6/number'; +// import 'core-js/es6/math'; +// import 'core-js/es6/string'; +// import 'core-js/es6/date'; +// import 'core-js/es6/array'; +// import 'core-js/es6/regexp'; +// import 'core-js/es6/map'; +// import 'core-js/es6/weak-map'; +// import 'core-js/es6/set'; +/** IE10 and IE11 requires the following for NgClass support on SVG elements */ +// import 'classlist.js'; // Run `npm install --save classlist.js`. +/** Evergreen browsers require these. **/ +import 'core-js/es6/reflect'; +import 'core-js/es7/reflect'; + + +/** + * Required to support Web Animations `@angular/animation`. + * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation + **/ +// import 'web-animations-js'; // Run `npm install --save web-animations-js`. + + +/*************************************************************************************************** + * Zone JS is required by Angular itself. + */ +import 'zone.js/dist/zone'; // Included with Angular CLI. + + +/*************************************************************************************************** + * APPLICATION IMPORTS + */ + +/** + * Date, currency, decimal and percent pipes. + * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 + */ +// import 'intl'; // Run `npm install --save intl`. +/** + * Need to import at least one locale-data with intl. + */ // import 'intl/locale-data/jsonp/en'; \ No newline at end of file diff --git a/spring-security-angular/client/angular5/src/styles.css b/spring-security-modules/spring-security-angular/client/angular5/src/styles.css similarity index 100% rename from spring-security-angular/client/angular5/src/styles.css rename to spring-security-modules/spring-security-angular/client/angular5/src/styles.css diff --git a/spring-security-angular/client/angular5/src/tsconfig.app.json b/spring-security-modules/spring-security-angular/client/angular5/src/tsconfig.app.json similarity index 100% rename from spring-security-angular/client/angular5/src/tsconfig.app.json rename to spring-security-modules/spring-security-angular/client/angular5/src/tsconfig.app.json diff --git a/spring-security-angular/client/angular5/tsconfig.json b/spring-security-modules/spring-security-angular/client/angular5/tsconfig.json similarity index 100% rename from spring-security-angular/client/angular5/tsconfig.json rename to spring-security-modules/spring-security-angular/client/angular5/tsconfig.json diff --git a/spring-security-angular/client/angular5/tslint.json b/spring-security-modules/spring-security-angular/client/angular5/tslint.json similarity index 100% rename from spring-security-angular/client/angular5/tslint.json rename to spring-security-modules/spring-security-angular/client/angular5/tslint.json diff --git a/spring-security-angular/client/angular6/angular.json b/spring-security-modules/spring-security-angular/client/angular6/angular.json similarity index 100% rename from spring-security-angular/client/angular6/angular.json rename to spring-security-modules/spring-security-angular/client/angular6/angular.json diff --git a/spring-security-angular/client/angular6/package.json b/spring-security-modules/spring-security-angular/client/angular6/package.json similarity index 100% rename from spring-security-angular/client/angular6/package.json rename to spring-security-modules/spring-security-angular/client/angular6/package.json diff --git a/spring-security-angular/client/angular6/src/app/app.component.html b/spring-security-modules/spring-security-angular/client/angular6/src/app/app.component.html similarity index 100% rename from spring-security-angular/client/angular6/src/app/app.component.html rename to spring-security-modules/spring-security-angular/client/angular6/src/app/app.component.html diff --git a/spring-security-angular/client/angular6/src/app/app.component.ts b/spring-security-modules/spring-security-angular/client/angular6/src/app/app.component.ts similarity index 100% rename from spring-security-angular/client/angular6/src/app/app.component.ts rename to spring-security-modules/spring-security-angular/client/angular6/src/app/app.component.ts diff --git a/spring-security-angular/client/angular6/src/app/app.module.ts b/spring-security-modules/spring-security-angular/client/angular6/src/app/app.module.ts similarity index 100% rename from spring-security-angular/client/angular6/src/app/app.module.ts rename to spring-security-modules/spring-security-angular/client/angular6/src/app/app.module.ts diff --git a/spring-security-angular/client/angular6/src/app/app.routing.ts b/spring-security-modules/spring-security-angular/client/angular6/src/app/app.routing.ts similarity index 100% rename from spring-security-angular/client/angular6/src/app/app.routing.ts rename to spring-security-modules/spring-security-angular/client/angular6/src/app/app.routing.ts diff --git a/spring-security-angular/client/angular6/src/app/home/home.component.html b/spring-security-modules/spring-security-angular/client/angular6/src/app/home/home.component.html similarity index 100% rename from spring-security-angular/client/angular6/src/app/home/home.component.html rename to spring-security-modules/spring-security-angular/client/angular6/src/app/home/home.component.html diff --git a/spring-security-angular/client/angular6/src/app/home/home.component.ts b/spring-security-modules/spring-security-angular/client/angular6/src/app/home/home.component.ts similarity index 100% rename from spring-security-angular/client/angular6/src/app/home/home.component.ts rename to spring-security-modules/spring-security-angular/client/angular6/src/app/home/home.component.ts diff --git a/spring-security-angular/client/angular6/src/app/login/login.component.html b/spring-security-modules/spring-security-angular/client/angular6/src/app/login/login.component.html similarity index 100% rename from spring-security-angular/client/angular6/src/app/login/login.component.html rename to spring-security-modules/spring-security-angular/client/angular6/src/app/login/login.component.html diff --git a/spring-security-angular/client/angular6/src/app/login/login.component.ts b/spring-security-modules/spring-security-angular/client/angular6/src/app/login/login.component.ts similarity index 100% rename from spring-security-angular/client/angular6/src/app/login/login.component.ts rename to spring-security-modules/spring-security-angular/client/angular6/src/app/login/login.component.ts diff --git a/spring-security-angular/client/angular6/src/index.html b/spring-security-modules/spring-security-angular/client/angular6/src/index.html similarity index 100% rename from spring-security-angular/client/angular6/src/index.html rename to spring-security-modules/spring-security-angular/client/angular6/src/index.html diff --git a/spring-security-angular/client/angular6/src/main.ts b/spring-security-modules/spring-security-angular/client/angular6/src/main.ts similarity index 100% rename from spring-security-angular/client/angular6/src/main.ts rename to spring-security-modules/spring-security-angular/client/angular6/src/main.ts diff --git a/spring-security-angular/client/angular5/src/polyfills.ts b/spring-security-modules/spring-security-angular/client/angular6/src/polyfills.ts similarity index 95% rename from spring-security-angular/client/angular5/src/polyfills.ts rename to spring-security-modules/spring-security-angular/client/angular6/src/polyfills.ts index a4984ced57..ec50a75aeb 100644 --- a/spring-security-angular/client/angular5/src/polyfills.ts +++ b/spring-security-modules/spring-security-angular/client/angular6/src/polyfills.ts @@ -1,68 +1,68 @@ -/** - * This file includes polyfills needed by Angular and is loaded before the app. - * You can add your own extra polyfills to this file. - * - * This file is divided into 2 sections: - * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. - * 2. Application imports. Files imported after ZoneJS that should be loaded before your main - * file. - * - * The current setup is for so-called "evergreen" browsers; the last versions of browsers that - * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), - * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. - * - * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html - */ - -/*************************************************************************************************** - * BROWSER POLYFILLS - */ - -/** IE9, IE10 and IE11 requires all of the following polyfills. **/ -// import 'core-js/es6/symbol'; -// import 'core-js/es6/object'; -// import 'core-js/es6/function'; -// import 'core-js/es6/parse-int'; -// import 'core-js/es6/parse-float'; -// import 'core-js/es6/number'; -// import 'core-js/es6/math'; -// import 'core-js/es6/string'; -// import 'core-js/es6/date'; -// import 'core-js/es6/array'; -// import 'core-js/es6/regexp'; -// import 'core-js/es6/map'; -// import 'core-js/es6/weak-map'; -// import 'core-js/es6/set'; -/** IE10 and IE11 requires the following for NgClass support on SVG elements */ -// import 'classlist.js'; // Run `npm install --save classlist.js`. -/** Evergreen browsers require these. **/ -import 'core-js/es6/reflect'; -import 'core-js/es7/reflect'; - - -/** - * Required to support Web Animations `@angular/animation`. - * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation - **/ -// import 'web-animations-js'; // Run `npm install --save web-animations-js`. - - -/*************************************************************************************************** - * Zone JS is required by Angular itself. - */ -import 'zone.js/dist/zone'; // Included with Angular CLI. - - -/*************************************************************************************************** - * APPLICATION IMPORTS - */ - -/** - * Date, currency, decimal and percent pipes. - * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 - */ -// import 'intl'; // Run `npm install --save intl`. -/** - * Need to import at least one locale-data with intl. - */ +/** + * This file includes polyfills needed by Angular and is loaded before the app. + * You can add your own extra polyfills to this file. + * + * This file is divided into 2 sections: + * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. + * 2. Application imports. Files imported after ZoneJS that should be loaded before your main + * file. + * + * The current setup is for so-called "evergreen" browsers; the last versions of browsers that + * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), + * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. + * + * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html + */ + +/*************************************************************************************************** + * BROWSER POLYFILLS + */ + +/** IE9, IE10 and IE11 requires all of the following polyfills. **/ +// import 'core-js/es6/symbol'; +// import 'core-js/es6/object'; +// import 'core-js/es6/function'; +// import 'core-js/es6/parse-int'; +// import 'core-js/es6/parse-float'; +// import 'core-js/es6/number'; +// import 'core-js/es6/math'; +// import 'core-js/es6/string'; +// import 'core-js/es6/date'; +// import 'core-js/es6/array'; +// import 'core-js/es6/regexp'; +// import 'core-js/es6/map'; +// import 'core-js/es6/weak-map'; +// import 'core-js/es6/set'; +/** IE10 and IE11 requires the following for NgClass support on SVG elements */ +// import 'classlist.js'; // Run `npm install --save classlist.js`. +/** Evergreen browsers require these. **/ +import 'core-js/es6/reflect'; +import 'core-js/es7/reflect'; + + +/** + * Required to support Web Animations `@angular/animation`. + * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation + **/ +// import 'web-animations-js'; // Run `npm install --save web-animations-js`. + + +/*************************************************************************************************** + * Zone JS is required by Angular itself. + */ +import 'zone.js/dist/zone'; // Included with Angular CLI. + + +/*************************************************************************************************** + * APPLICATION IMPORTS + */ + +/** + * Date, currency, decimal and percent pipes. + * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 + */ +// import 'intl'; // Run `npm install --save intl`. +/** + * Need to import at least one locale-data with intl. + */ // import 'intl/locale-data/jsonp/en'; \ No newline at end of file diff --git a/spring-security-angular/client/angular6/src/styles.css b/spring-security-modules/spring-security-angular/client/angular6/src/styles.css similarity index 100% rename from spring-security-angular/client/angular6/src/styles.css rename to spring-security-modules/spring-security-angular/client/angular6/src/styles.css diff --git a/spring-security-angular/client/angular6/src/tsconfig.app.json b/spring-security-modules/spring-security-angular/client/angular6/src/tsconfig.app.json similarity index 100% rename from spring-security-angular/client/angular6/src/tsconfig.app.json rename to spring-security-modules/spring-security-angular/client/angular6/src/tsconfig.app.json diff --git a/spring-security-angular/client/angular6/tsconfig.json b/spring-security-modules/spring-security-angular/client/angular6/tsconfig.json similarity index 100% rename from spring-security-angular/client/angular6/tsconfig.json rename to spring-security-modules/spring-security-angular/client/angular6/tsconfig.json diff --git a/spring-security-angular/client/angular6/tslint.json b/spring-security-modules/spring-security-angular/client/angular6/tslint.json similarity index 100% rename from spring-security-angular/client/angular6/tslint.json rename to spring-security-modules/spring-security-angular/client/angular6/tslint.json diff --git a/spring-security-angular/server/pom.xml b/spring-security-modules/spring-security-angular/server/pom.xml similarity index 96% rename from spring-security-angular/server/pom.xml rename to spring-security-modules/spring-security-angular/server/pom.xml index 6474bb5ed6..19d980062c 100644 --- a/spring-security-angular/server/pom.xml +++ b/spring-security-modules/spring-security-angular/server/pom.xml @@ -2,7 +2,6 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>server</artifactId> <version>0.0.1-SNAPSHOT</version> <name>server</name> @@ -13,7 +12,7 @@ <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> - <relativePath>../../</relativePath> + <relativePath>../../../</relativePath> </parent> <dependencyManagement> diff --git a/spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/basicauth/SpringBootSecurityApplication.java b/spring-security-modules/spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/basicauth/SpringBootSecurityApplication.java similarity index 100% rename from spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/basicauth/SpringBootSecurityApplication.java rename to spring-security-modules/spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/basicauth/SpringBootSecurityApplication.java diff --git a/spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/basicauth/config/BasicAuthConfiguration.java b/spring-security-modules/spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/basicauth/config/BasicAuthConfiguration.java similarity index 100% rename from spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/basicauth/config/BasicAuthConfiguration.java rename to spring-security-modules/spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/basicauth/config/BasicAuthConfiguration.java diff --git a/spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/controller/UserController.java b/spring-security-modules/spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/controller/UserController.java similarity index 97% rename from spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/controller/UserController.java rename to spring-security-modules/spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/controller/UserController.java index ab66065b61..0eef4198a1 100644 --- a/spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/controller/UserController.java +++ b/spring-security-modules/spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/controller/UserController.java @@ -1,29 +1,29 @@ -package com.baeldung.springbootsecurityrest.controller; - -import java.security.Principal; -import java.util.Base64; - -import javax.servlet.http.HttpServletRequest; - -import org.springframework.web.bind.annotation.CrossOrigin; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import com.baeldung.springbootsecurityrest.vo.User; - -@RestController -@CrossOrigin -public class UserController { - - @RequestMapping("/login") - public boolean login(@RequestBody User user) { - return user.getUserName().equals("user") && user.getPassword().equals("password"); - } - - @RequestMapping("/user") - public Principal user(HttpServletRequest request) { - String authToken = request.getHeader("Authorization").substring("Basic".length()).trim(); - return () -> new String(Base64.getDecoder().decode(authToken)).split(":")[0]; - } -} +package com.baeldung.springbootsecurityrest.controller; + +import java.security.Principal; +import java.util.Base64; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.baeldung.springbootsecurityrest.vo.User; + +@RestController +@CrossOrigin +public class UserController { + + @RequestMapping("/login") + public boolean login(@RequestBody User user) { + return user.getUserName().equals("user") && user.getPassword().equals("password"); + } + + @RequestMapping("/user") + public Principal user(HttpServletRequest request) { + String authToken = request.getHeader("Authorization").substring("Basic".length()).trim(); + return () -> new String(Base64.getDecoder().decode(authToken)).split(":")[0]; + } +} diff --git a/spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/vo/User.java b/spring-security-modules/spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/vo/User.java similarity index 94% rename from spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/vo/User.java rename to spring-security-modules/spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/vo/User.java index 0eda5ce9ec..52377ad741 100644 --- a/spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/vo/User.java +++ b/spring-security-modules/spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/vo/User.java @@ -1,21 +1,21 @@ -package com.baeldung.springbootsecurityrest.vo; - - -public class User { - - private String userName; - private String password; - - public String getUserName() { - return userName; - } - public void setUserName(String userName) { - this.userName = userName; - } - public String getPassword() { - return password; - } - public void setPassword(String password) { - this.password = password; - } -} +package com.baeldung.springbootsecurityrest.vo; + + +public class User { + + private String userName; + private String password; + + public String getUserName() { + return userName; + } + public void setUserName(String userName) { + this.userName = userName; + } + public String getPassword() { + return password; + } + public void setPassword(String password) { + this.password = password; + } +} diff --git a/spring-security-angular/server/src/main/resources/application.properties b/spring-security-modules/spring-security-angular/server/src/main/resources/application.properties similarity index 100% rename from spring-security-angular/server/src/main/resources/application.properties rename to spring-security-modules/spring-security-angular/server/src/main/resources/application.properties diff --git a/spring-security-mvc-boot/src/main/resources/logback.xml b/spring-security-modules/spring-security-angular/server/src/main/resources/logback.xml similarity index 100% rename from spring-security-mvc-boot/src/main/resources/logback.xml rename to spring-security-modules/spring-security-angular/server/src/main/resources/logback.xml diff --git a/spring-security-angular/server/src/test/java/com/baeldung/springbootsecurityrest/BasicAuthConfigurationIntegrationTest.java b/spring-security-modules/spring-security-angular/server/src/test/java/com/baeldung/springbootsecurityrest/BasicAuthConfigurationIntegrationTest.java similarity index 100% rename from spring-security-angular/server/src/test/java/com/baeldung/springbootsecurityrest/BasicAuthConfigurationIntegrationTest.java rename to spring-security-modules/spring-security-angular/server/src/test/java/com/baeldung/springbootsecurityrest/BasicAuthConfigurationIntegrationTest.java diff --git a/spring-security-angular/server/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-angular/server/src/test/java/org/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-angular/server/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-angular/server/src/test/java/org/baeldung/SpringContextTest.java diff --git a/spring-security-cache-control/README.md b/spring-security-modules/spring-security-cache-control/README.md similarity index 100% rename from spring-security-cache-control/README.md rename to spring-security-modules/spring-security-cache-control/README.md diff --git a/spring-security-cache-control/pom.xml b/spring-security-modules/spring-security-cache-control/pom.xml similarity index 89% rename from spring-security-cache-control/pom.xml rename to spring-security-modules/spring-security-cache-control/pom.xml index e68f92d2ee..ff96ae78dd 100644 --- a/spring-security-cache-control/pom.xml +++ b/spring-security-modules/spring-security-cache-control/pom.xml @@ -1,17 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-security-cache-control</artifactId> <version>1.0-SNAPSHOT</version> - <name>spring-security-cache-control</name> + <name>spring-security-cache-control</name> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-boot-1</relativePath> + <relativePath>../../parent-boot-1</relativePath> </parent> <dependencies> diff --git a/spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/AppRunner.java b/spring-security-modules/spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/AppRunner.java similarity index 100% rename from spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/AppRunner.java rename to spring-security-modules/spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/AppRunner.java diff --git a/spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/ResourceEndpoint.java b/spring-security-modules/spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/ResourceEndpoint.java similarity index 100% rename from spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/ResourceEndpoint.java rename to spring-security-modules/spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/ResourceEndpoint.java diff --git a/spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/config/SpringSecurityConfig.java b/spring-security-modules/spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/config/SpringSecurityConfig.java similarity index 100% rename from spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/config/SpringSecurityConfig.java rename to spring-security-modules/spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/config/SpringSecurityConfig.java diff --git a/spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/model/TimestampDto.java b/spring-security-modules/spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/model/TimestampDto.java similarity index 100% rename from spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/model/TimestampDto.java rename to spring-security-modules/spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/model/TimestampDto.java diff --git a/spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/model/UserDto.java b/spring-security-modules/spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/model/UserDto.java similarity index 100% rename from spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/model/UserDto.java rename to spring-security-modules/spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/model/UserDto.java diff --git a/spring-security-mvc-socket/src/main/resources/logback.xml b/spring-security-modules/spring-security-cache-control/src/main/resources/logback.xml similarity index 100% rename from spring-security-mvc-socket/src/main/resources/logback.xml rename to spring-security-modules/spring-security-cache-control/src/main/resources/logback.xml diff --git a/spring-security-cache-control/src/test/java/com/baeldung/cachecontrol/ResourceEndpointIntegrationTest.java b/spring-security-modules/spring-security-cache-control/src/test/java/com/baeldung/cachecontrol/ResourceEndpointIntegrationTest.java similarity index 100% rename from spring-security-cache-control/src/test/java/com/baeldung/cachecontrol/ResourceEndpointIntegrationTest.java rename to spring-security-modules/spring-security-cache-control/src/test/java/com/baeldung/cachecontrol/ResourceEndpointIntegrationTest.java diff --git a/spring-security-cache-control/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-cache-control/src/test/java/org/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-cache-control/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-cache-control/src/test/java/org/baeldung/SpringContextTest.java diff --git a/spring-rest-full/src/test/resources/.gitignore b/spring-security-modules/spring-security-core/.gitignore similarity index 100% rename from spring-rest-full/src/test/resources/.gitignore rename to spring-security-modules/spring-security-core/.gitignore diff --git a/spring-security-core/README.md b/spring-security-modules/spring-security-core/README.md similarity index 100% rename from spring-security-core/README.md rename to spring-security-modules/spring-security-core/README.md diff --git a/spring-security-core/pom.xml b/spring-security-modules/spring-security-core/pom.xml similarity index 97% rename from spring-security-core/pom.xml rename to spring-security-modules/spring-security-core/pom.xml index 00d12ed7d2..9f1e7cda29 100644 --- a/spring-security-core/pom.xml +++ b/spring-security-modules/spring-security-core/pom.xml @@ -1,17 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-security-core</artifactId> <version>0.1-SNAPSHOT</version> <name>spring-security-core</name> <packaging>war</packaging> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-boot-2</relativePath> + <relativePath>../../parent-boot-2</relativePath> </parent> <dependencies> @@ -50,7 +50,6 @@ </dependency> </dependencies> - <build> <finalName>spring-security-core</finalName> <resources> diff --git a/spring-security-core/src/main/java/com/baeldung/app/App.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/App.java similarity index 100% rename from spring-security-core/src/main/java/com/baeldung/app/App.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/App.java diff --git a/spring-security-core/src/main/java/com/baeldung/auditing/ExposeAttemptedPathAuthorizationAuditListener.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/auditing/ExposeAttemptedPathAuthorizationAuditListener.java similarity index 100% rename from spring-security-core/src/main/java/com/baeldung/auditing/ExposeAttemptedPathAuthorizationAuditListener.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/auditing/ExposeAttemptedPathAuthorizationAuditListener.java diff --git a/spring-security-core/src/main/java/com/baeldung/auditing/LoginAttemptsLogger.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/auditing/LoginAttemptsLogger.java similarity index 100% rename from spring-security-core/src/main/java/com/baeldung/auditing/LoginAttemptsLogger.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/auditing/LoginAttemptsLogger.java diff --git a/spring-security-core/src/main/java/com/baeldung/config/DatabaseLoader.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/config/DatabaseLoader.java similarity index 100% rename from spring-security-core/src/main/java/com/baeldung/config/DatabaseLoader.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/config/DatabaseLoader.java diff --git a/spring-security-core/src/main/java/com/baeldung/config/WebSecurityConfig.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/config/WebSecurityConfig.java similarity index 100% rename from spring-security-core/src/main/java/com/baeldung/config/WebSecurityConfig.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/config/WebSecurityConfig.java diff --git a/spring-security-core/src/main/java/com/baeldung/controller/TaskController.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/controller/TaskController.java similarity index 100% rename from spring-security-core/src/main/java/com/baeldung/controller/TaskController.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/controller/TaskController.java diff --git a/spring-security-core/src/main/java/com/baeldung/entity/Task.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/entity/Task.java similarity index 100% rename from spring-security-core/src/main/java/com/baeldung/entity/Task.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/entity/Task.java diff --git a/spring-security-core/src/main/java/com/baeldung/filter/CustomFilter.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/filter/CustomFilter.java similarity index 100% rename from spring-security-core/src/main/java/com/baeldung/filter/CustomFilter.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/filter/CustomFilter.java diff --git a/spring-security-core/src/main/java/com/baeldung/methodsecurity/annotation/IsViewer.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/methodsecurity/annotation/IsViewer.java similarity index 96% rename from spring-security-core/src/main/java/com/baeldung/methodsecurity/annotation/IsViewer.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/methodsecurity/annotation/IsViewer.java index bde4456f8e..a7fa08ff30 100644 --- a/spring-security-core/src/main/java/com/baeldung/methodsecurity/annotation/IsViewer.java +++ b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/methodsecurity/annotation/IsViewer.java @@ -1,14 +1,14 @@ -package com.baeldung.methodsecurity.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.springframework.security.access.prepost.PreAuthorize; - -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -@PreAuthorize("hasRole('VIEWER')") -public @interface IsViewer { +package com.baeldung.methodsecurity.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.springframework.security.access.prepost.PreAuthorize; + +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@PreAuthorize("hasRole('VIEWER')") +public @interface IsViewer { } \ No newline at end of file diff --git a/spring-security-core/src/main/java/com/baeldung/methodsecurity/config/MethodSecurityConfig.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/methodsecurity/config/MethodSecurityConfig.java similarity index 100% rename from spring-security-core/src/main/java/com/baeldung/methodsecurity/config/MethodSecurityConfig.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/methodsecurity/config/MethodSecurityConfig.java diff --git a/spring-security-core/src/main/java/com/baeldung/methodsecurity/entity/CustomUser.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/methodsecurity/entity/CustomUser.java similarity index 96% rename from spring-security-core/src/main/java/com/baeldung/methodsecurity/entity/CustomUser.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/methodsecurity/entity/CustomUser.java index 7daaef5984..cce7dc5f75 100644 --- a/spring-security-core/src/main/java/com/baeldung/methodsecurity/entity/CustomUser.java +++ b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/methodsecurity/entity/CustomUser.java @@ -1,30 +1,30 @@ -package com.baeldung.methodsecurity.entity; - -import java.util.Collection; - -import org.springframework.security.core.GrantedAuthority; -import org.springframework.security.core.userdetails.User; - -@SuppressWarnings("serial") -public class CustomUser extends User { - - private String nickName; - - public CustomUser(String username, String password, Collection<? extends GrantedAuthority> authorities) { - super(username, password, authorities); - } - - public CustomUser(String username, String password, Collection<? extends GrantedAuthority> authorities, String nickName) { - super(username, password, authorities); - this.nickName = nickName; - } - - public String getNickName() { - return nickName; - } - - public void setNickName(String nickName) { - this.nickName = nickName; - } - -} +package com.baeldung.methodsecurity.entity; + +import java.util.Collection; + +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.userdetails.User; + +@SuppressWarnings("serial") +public class CustomUser extends User { + + private String nickName; + + public CustomUser(String username, String password, Collection<? extends GrantedAuthority> authorities) { + super(username, password, authorities); + } + + public CustomUser(String username, String password, Collection<? extends GrantedAuthority> authorities, String nickName) { + super(username, password, authorities); + this.nickName = nickName; + } + + public String getNickName() { + return nickName; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } + +} diff --git a/spring-security-core/src/main/java/com/baeldung/methodsecurity/repository/UserRoleRepository.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/methodsecurity/repository/UserRoleRepository.java similarity index 97% rename from spring-security-core/src/main/java/com/baeldung/methodsecurity/repository/UserRoleRepository.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/methodsecurity/repository/UserRoleRepository.java index eef39189a7..20a1f4e85c 100644 --- a/spring-security-core/src/main/java/com/baeldung/methodsecurity/repository/UserRoleRepository.java +++ b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/methodsecurity/repository/UserRoleRepository.java @@ -1,58 +1,58 @@ -package com.baeldung.methodsecurity.repository; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.springframework.security.core.GrantedAuthority; -import org.springframework.security.core.authority.SimpleGrantedAuthority; -import org.springframework.security.core.userdetails.UsernameNotFoundException; -import org.springframework.stereotype.Service; - -import com.baeldung.methodsecurity.entity.CustomUser; - -@Service -public class UserRoleRepository { - - static Map<String, CustomUser> DB_BASED_USER_MAPPING; - - static { - DB_BASED_USER_MAPPING = new LinkedHashMap<>(); - DB_BASED_USER_MAPPING.put("jane", new CustomUser("jane", "1234", getGrantedAuthorities("ROLE_USER", "ROLE_VIEWER"), "jane")); - DB_BASED_USER_MAPPING.put("john", new CustomUser("john", "1234", getGrantedAuthorities("ROLE_EDITOR", "ROLE_ADMIN"), "jane")); - DB_BASED_USER_MAPPING.put("jack", new CustomUser("jack", "1234", getGrantedAuthorities("ROLE_USER", "ROLE_REVIEWER"), "jane")); - } - - private static List<GrantedAuthority> getGrantedAuthorities(String... roles) { - ArrayList<GrantedAuthority> authorities = new ArrayList<>(); - for (String role : roles) { - authorities.add(new SimpleGrantedAuthority(role)); - } - return authorities; - } - - public CustomUser loadUserByUserName(String username) { - if (DB_BASED_USER_MAPPING.containsKey(username)) { - return DB_BASED_USER_MAPPING.get(username); - } - throw new UsernameNotFoundException("User " + username + " cannot be found"); - } - - public boolean isValidUsername(String username) { - return DB_BASED_USER_MAPPING.containsKey(username); - } - - public boolean isValidRole(String roleName) { - return roleName.startsWith("ROLE_"); - } - - public List<String> getAllUsernames() { - List<String> usernames = new ArrayList<>(); - usernames.add("jane"); - usernames.add("john"); - usernames.add("jack"); - return usernames; - } - -} +package com.baeldung.methodsecurity.repository; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Service; + +import com.baeldung.methodsecurity.entity.CustomUser; + +@Service +public class UserRoleRepository { + + static Map<String, CustomUser> DB_BASED_USER_MAPPING; + + static { + DB_BASED_USER_MAPPING = new LinkedHashMap<>(); + DB_BASED_USER_MAPPING.put("jane", new CustomUser("jane", "1234", getGrantedAuthorities("ROLE_USER", "ROLE_VIEWER"), "jane")); + DB_BASED_USER_MAPPING.put("john", new CustomUser("john", "1234", getGrantedAuthorities("ROLE_EDITOR", "ROLE_ADMIN"), "jane")); + DB_BASED_USER_MAPPING.put("jack", new CustomUser("jack", "1234", getGrantedAuthorities("ROLE_USER", "ROLE_REVIEWER"), "jane")); + } + + private static List<GrantedAuthority> getGrantedAuthorities(String... roles) { + ArrayList<GrantedAuthority> authorities = new ArrayList<>(); + for (String role : roles) { + authorities.add(new SimpleGrantedAuthority(role)); + } + return authorities; + } + + public CustomUser loadUserByUserName(String username) { + if (DB_BASED_USER_MAPPING.containsKey(username)) { + return DB_BASED_USER_MAPPING.get(username); + } + throw new UsernameNotFoundException("User " + username + " cannot be found"); + } + + public boolean isValidUsername(String username) { + return DB_BASED_USER_MAPPING.containsKey(username); + } + + public boolean isValidRole(String roleName) { + return roleName.startsWith("ROLE_"); + } + + public List<String> getAllUsernames() { + List<String> usernames = new ArrayList<>(); + usernames.add("jane"); + usernames.add("john"); + usernames.add("jack"); + return usernames; + } + +} diff --git a/spring-security-core/src/main/java/com/baeldung/methodsecurity/service/CustomUserDetailsService.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/methodsecurity/service/CustomUserDetailsService.java similarity index 97% rename from spring-security-core/src/main/java/com/baeldung/methodsecurity/service/CustomUserDetailsService.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/methodsecurity/service/CustomUserDetailsService.java index 685621b55f..e6828b32a1 100644 --- a/spring-security-core/src/main/java/com/baeldung/methodsecurity/service/CustomUserDetailsService.java +++ b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/methodsecurity/service/CustomUserDetailsService.java @@ -1,20 +1,20 @@ -package com.baeldung.methodsecurity.service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.core.userdetails.UserDetails; -import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.stereotype.Service; - -import com.baeldung.methodsecurity.repository.UserRoleRepository; - -@Service("userDetailService") -public class CustomUserDetailsService implements UserDetailsService { - - @Autowired - UserRoleRepository userRoleRepo; - - @Override - public UserDetails loadUserByUsername(String username) { - return userRoleRepo.loadUserByUserName(username); - } +package com.baeldung.methodsecurity.service; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.stereotype.Service; + +import com.baeldung.methodsecurity.repository.UserRoleRepository; + +@Service("userDetailService") +public class CustomUserDetailsService implements UserDetailsService { + + @Autowired + UserRoleRepository userRoleRepo; + + @Override + public UserDetails loadUserByUsername(String username) { + return userRoleRepo.loadUserByUserName(username); + } } \ No newline at end of file diff --git a/spring-security-core/src/main/java/com/baeldung/methodsecurity/service/SystemService.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/methodsecurity/service/SystemService.java similarity index 95% rename from spring-security-core/src/main/java/com/baeldung/methodsecurity/service/SystemService.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/methodsecurity/service/SystemService.java index 623d51d34f..7e60f701ad 100644 --- a/spring-security-core/src/main/java/com/baeldung/methodsecurity/service/SystemService.java +++ b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/methodsecurity/service/SystemService.java @@ -1,18 +1,18 @@ -package com.baeldung.methodsecurity.service; - -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.stereotype.Service; - -@Service -@PreAuthorize("hasRole('ROLE_ADMIN')") -public class SystemService { - - public String getSystemYear(){ - return "2017"; - } - - public String getSystemDate(){ - return "31-12-2017"; - } - -} +package com.baeldung.methodsecurity.service; + +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.stereotype.Service; + +@Service +@PreAuthorize("hasRole('ROLE_ADMIN')") +public class SystemService { + + public String getSystemYear(){ + return "2017"; + } + + public String getSystemDate(){ + return "31-12-2017"; + } + +} diff --git a/spring-security-core/src/main/java/com/baeldung/methodsecurity/service/UserRoleService.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/methodsecurity/service/UserRoleService.java similarity index 97% rename from spring-security-core/src/main/java/com/baeldung/methodsecurity/service/UserRoleService.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/methodsecurity/service/UserRoleService.java index 4d090fd90c..1579044700 100644 --- a/spring-security-core/src/main/java/com/baeldung/methodsecurity/service/UserRoleService.java +++ b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/methodsecurity/service/UserRoleService.java @@ -1,109 +1,109 @@ -package com.baeldung.methodsecurity.service; - -import java.util.List; -import java.util.stream.Collectors; - -import javax.annotation.security.RolesAllowed; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.annotation.Secured; -import org.springframework.security.access.prepost.PostAuthorize; -import org.springframework.security.access.prepost.PostFilter; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.security.access.prepost.PreFilter; -import org.springframework.security.core.context.SecurityContext; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.stereotype.Service; - -import com.baeldung.methodsecurity.annotation.IsViewer; -import com.baeldung.methodsecurity.entity.CustomUser; -import com.baeldung.methodsecurity.repository.UserRoleRepository; - -@Service -public class UserRoleService { - - @Autowired - UserRoleRepository userRoleRepository; - - @Secured("ROLE_VIEWER") - public String getUsername() { - SecurityContext securityContext = SecurityContextHolder.getContext(); - return securityContext.getAuthentication().getName(); - } - - @Secured({ "ROLE_VIEWER", "ROLE_EDITOR" }) - public boolean isValidUsername(String username) { - return userRoleRepository.isValidUsername(username); - } - - @RolesAllowed("ROLE_VIEWER") - public String getUsername2() { - SecurityContext securityContext = SecurityContextHolder.getContext(); - return securityContext.getAuthentication().getName(); - } - - @RolesAllowed({ "ROLE_VIEWER", "ROLE_EDITOR" }) - public boolean isValidUsername2(String username) { - return userRoleRepository.isValidUsername(username); - } - - @PreAuthorize("hasRole('ROLE_VIEWER')") - public String getUsernameInUpperCase() { - return getUsername().toUpperCase(); - } - - @PreAuthorize("hasAuthority('SYS_ADMIN')") - public String getUsernameLC() { - return getUsername().toLowerCase(); - } - - @PreAuthorize("hasRole('ROLE_VIEWER') or hasRole('ROLE_EDITOR')") - public boolean isValidUsername3(String username) { - return userRoleRepository.isValidUsername(username); - } - - @PreAuthorize("#username == authentication.principal.username") - public String getMyRoles(String username) { - SecurityContext securityContext = SecurityContextHolder.getContext(); - return securityContext.getAuthentication().getAuthorities().stream().map(auth -> auth.getAuthority()).collect(Collectors.joining(",")); - } - - @PostAuthorize("#username == authentication.principal.username") - public String getMyRoles2(String username) { - SecurityContext securityContext = SecurityContextHolder.getContext(); - return securityContext.getAuthentication().getAuthorities().stream().map(auth -> auth.getAuthority()).collect(Collectors.joining(",")); - } - - @PostAuthorize("returnObject.username == authentication.principal.nickName") - public CustomUser loadUserDetail(String username) { - return userRoleRepository.loadUserByUserName(username); - } - - @PreFilter("filterObject != authentication.principal.username") - public String joinUsernames(List<String> usernames) { - return usernames.stream().collect(Collectors.joining(";")); - } - - @PreFilter(value = "filterObject != authentication.principal.username", filterTarget = "usernames") - public String joinUsernamesAndRoles(List<String> usernames, List<String> roles) { - return usernames.stream().collect(Collectors.joining(";")) + ":" + roles.stream().collect(Collectors.joining(";")); - } - - @PostFilter("filterObject != authentication.principal.username") - public List<String> getAllUsernamesExceptCurrent() { - return userRoleRepository.getAllUsernames(); - } - - @IsViewer - public String getUsername4() { - SecurityContext securityContext = SecurityContextHolder.getContext(); - return securityContext.getAuthentication().getName(); - } - - @PreAuthorize("#username == authentication.principal.username") - @PostAuthorize("returnObject.username == authentication.principal.nickName") - public CustomUser securedLoadUserDetail(String username) { - return userRoleRepository.loadUserByUserName(username); - } - -} +package com.baeldung.methodsecurity.service; + +import java.util.List; +import java.util.stream.Collectors; + +import javax.annotation.security.RolesAllowed; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.annotation.Secured; +import org.springframework.security.access.prepost.PostAuthorize; +import org.springframework.security.access.prepost.PostFilter; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.security.access.prepost.PreFilter; +import org.springframework.security.core.context.SecurityContext; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Service; + +import com.baeldung.methodsecurity.annotation.IsViewer; +import com.baeldung.methodsecurity.entity.CustomUser; +import com.baeldung.methodsecurity.repository.UserRoleRepository; + +@Service +public class UserRoleService { + + @Autowired + UserRoleRepository userRoleRepository; + + @Secured("ROLE_VIEWER") + public String getUsername() { + SecurityContext securityContext = SecurityContextHolder.getContext(); + return securityContext.getAuthentication().getName(); + } + + @Secured({ "ROLE_VIEWER", "ROLE_EDITOR" }) + public boolean isValidUsername(String username) { + return userRoleRepository.isValidUsername(username); + } + + @RolesAllowed("ROLE_VIEWER") + public String getUsername2() { + SecurityContext securityContext = SecurityContextHolder.getContext(); + return securityContext.getAuthentication().getName(); + } + + @RolesAllowed({ "ROLE_VIEWER", "ROLE_EDITOR" }) + public boolean isValidUsername2(String username) { + return userRoleRepository.isValidUsername(username); + } + + @PreAuthorize("hasRole('ROLE_VIEWER')") + public String getUsernameInUpperCase() { + return getUsername().toUpperCase(); + } + + @PreAuthorize("hasAuthority('SYS_ADMIN')") + public String getUsernameLC() { + return getUsername().toLowerCase(); + } + + @PreAuthorize("hasRole('ROLE_VIEWER') or hasRole('ROLE_EDITOR')") + public boolean isValidUsername3(String username) { + return userRoleRepository.isValidUsername(username); + } + + @PreAuthorize("#username == authentication.principal.username") + public String getMyRoles(String username) { + SecurityContext securityContext = SecurityContextHolder.getContext(); + return securityContext.getAuthentication().getAuthorities().stream().map(auth -> auth.getAuthority()).collect(Collectors.joining(",")); + } + + @PostAuthorize("#username == authentication.principal.username") + public String getMyRoles2(String username) { + SecurityContext securityContext = SecurityContextHolder.getContext(); + return securityContext.getAuthentication().getAuthorities().stream().map(auth -> auth.getAuthority()).collect(Collectors.joining(",")); + } + + @PostAuthorize("returnObject.username == authentication.principal.nickName") + public CustomUser loadUserDetail(String username) { + return userRoleRepository.loadUserByUserName(username); + } + + @PreFilter("filterObject != authentication.principal.username") + public String joinUsernames(List<String> usernames) { + return usernames.stream().collect(Collectors.joining(";")); + } + + @PreFilter(value = "filterObject != authentication.principal.username", filterTarget = "usernames") + public String joinUsernamesAndRoles(List<String> usernames, List<String> roles) { + return usernames.stream().collect(Collectors.joining(";")) + ":" + roles.stream().collect(Collectors.joining(";")); + } + + @PostFilter("filterObject != authentication.principal.username") + public List<String> getAllUsernamesExceptCurrent() { + return userRoleRepository.getAllUsernames(); + } + + @IsViewer + public String getUsername4() { + SecurityContext securityContext = SecurityContextHolder.getContext(); + return securityContext.getAuthentication().getName(); + } + + @PreAuthorize("#username == authentication.principal.username") + @PostAuthorize("returnObject.username == authentication.principal.nickName") + public CustomUser securedLoadUserDetail(String username) { + return userRoleRepository.loadUserByUserName(username); + } + +} diff --git a/spring-security-core/src/main/java/com/baeldung/repository/TaskRepository.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/repository/TaskRepository.java similarity index 100% rename from spring-security-core/src/main/java/com/baeldung/repository/TaskRepository.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/repository/TaskRepository.java diff --git a/spring-security-core/src/main/java/com/baeldung/service/TaskService.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/service/TaskService.java similarity index 100% rename from spring-security-core/src/main/java/com/baeldung/service/TaskService.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/service/TaskService.java diff --git a/spring-security-core/src/main/resources/application.properties b/spring-security-modules/spring-security-core/src/main/resources/application.properties similarity index 100% rename from spring-security-core/src/main/resources/application.properties rename to spring-security-modules/spring-security-core/src/main/resources/application.properties diff --git a/spring-security-openid/src/main/resources/logback.xml b/spring-security-modules/spring-security-core/src/main/resources/logback.xml similarity index 100% rename from spring-security-openid/src/main/resources/logback.xml rename to spring-security-modules/spring-security-core/src/main/resources/logback.xml diff --git a/spring-security-core/src/main/webapp/WEB-INF/web.xml b/spring-security-modules/spring-security-core/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from spring-security-core/src/main/webapp/WEB-INF/web.xml rename to spring-security-modules/spring-security-core/src/main/webapp/WEB-INF/web.xml diff --git a/spring-security-core/src/test/java/com/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-core/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-core/src/test/java/com/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-core/src/test/java/com/baeldung/SpringContextTest.java diff --git a/spring-security-core/src/test/java/com/baeldung/methodsecurity/ClassLevelSecurityIntegrationTest.java b/spring-security-modules/spring-security-core/src/test/java/com/baeldung/methodsecurity/ClassLevelSecurityIntegrationTest.java similarity index 97% rename from spring-security-core/src/test/java/com/baeldung/methodsecurity/ClassLevelSecurityIntegrationTest.java rename to spring-security-modules/spring-security-core/src/test/java/com/baeldung/methodsecurity/ClassLevelSecurityIntegrationTest.java index 943bfda72c..d5ebdaa33b 100644 --- a/spring-security-core/src/test/java/com/baeldung/methodsecurity/ClassLevelSecurityIntegrationTest.java +++ b/spring-security-modules/spring-security-core/src/test/java/com/baeldung/methodsecurity/ClassLevelSecurityIntegrationTest.java @@ -1,50 +1,50 @@ -package com.baeldung.methodsecurity; - -import static org.junit.Assert.*; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.access.AccessDeniedException; -import org.springframework.security.test.context.support.WithMockUser; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.methodsecurity.service.SystemService; - -@RunWith(SpringRunner.class) -@ContextConfiguration -public class ClassLevelSecurityIntegrationTest { - - @Autowired - SystemService systemService; - - @Configuration - @ComponentScan("com.baeldung.methodsecurity.*") - public static class SpringConfig { - - } - - @Test - @WithMockUser(username="john",roles={"ADMIN"}) - public void givenRoleAdmin_whenCallGetSystemYear_return2017(){ - String systemYear = systemService.getSystemYear(); - assertEquals("2017",systemYear); - } - - @Test(expected=AccessDeniedException.class) - @WithMockUser(username="john",roles={"VIEWER"}) - public void givenRoleViewer_whenCallGetSystemYear_returnAccessDenied(){ - String systemYear = systemService.getSystemYear(); - assertEquals("2017",systemYear); - } - - @Test - @WithMockUser(username="john",roles={"ADMIN"}) - public void givenRoleAdmin_whenCallGetSystemDate_returnDate(){ - String systemYear = systemService.getSystemDate(); - assertEquals("31-12-2017",systemYear); - } -} +package com.baeldung.methodsecurity; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.methodsecurity.service.SystemService; + +@RunWith(SpringRunner.class) +@ContextConfiguration +public class ClassLevelSecurityIntegrationTest { + + @Autowired + SystemService systemService; + + @Configuration + @ComponentScan("com.baeldung.methodsecurity.*") + public static class SpringConfig { + + } + + @Test + @WithMockUser(username="john",roles={"ADMIN"}) + public void givenRoleAdmin_whenCallGetSystemYear_return2017(){ + String systemYear = systemService.getSystemYear(); + assertEquals("2017",systemYear); + } + + @Test(expected=AccessDeniedException.class) + @WithMockUser(username="john",roles={"VIEWER"}) + public void givenRoleViewer_whenCallGetSystemYear_returnAccessDenied(){ + String systemYear = systemService.getSystemYear(); + assertEquals("2017",systemYear); + } + + @Test + @WithMockUser(username="john",roles={"ADMIN"}) + public void givenRoleAdmin_whenCallGetSystemDate_returnDate(){ + String systemYear = systemService.getSystemDate(); + assertEquals("31-12-2017",systemYear); + } +} diff --git a/spring-security-core/src/test/java/com/baeldung/methodsecurity/MethodSecurityIntegrationTest.java b/spring-security-modules/spring-security-core/src/test/java/com/baeldung/methodsecurity/MethodSecurityIntegrationTest.java similarity index 97% rename from spring-security-core/src/test/java/com/baeldung/methodsecurity/MethodSecurityIntegrationTest.java rename to spring-security-modules/spring-security-core/src/test/java/com/baeldung/methodsecurity/MethodSecurityIntegrationTest.java index 81b150f43e..0ad01d9954 100644 --- a/spring-security-core/src/test/java/com/baeldung/methodsecurity/MethodSecurityIntegrationTest.java +++ b/spring-security-modules/spring-security-core/src/test/java/com/baeldung/methodsecurity/MethodSecurityIntegrationTest.java @@ -1,177 +1,177 @@ -package com.baeldung.methodsecurity; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.access.AccessDeniedException; -import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException; -import org.springframework.security.test.context.support.WithAnonymousUser; -import org.springframework.security.test.context.support.WithMockUser; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.methodsecurity.service.UserRoleService; - -@RunWith(SpringRunner.class) -@ContextConfiguration -public class MethodSecurityIntegrationTest { - - @Autowired - UserRoleService userRoleService; - - @Configuration - @ComponentScan("com.baeldung.methodsecurity.*") - public static class SpringConfig { - - } - - @Test(expected = AuthenticationCredentialsNotFoundException.class) - public void givenNoSecurity_whenCallGetUsername_thenReturnException() { - String userName = userRoleService.getUsername(); - assertEquals("john", userName); - } - - @Test - @WithMockUser(username = "john", roles = { "VIEWER" }) - public void givenRoleViewer_whenCallGetUsername_thenReturnUsername() { - String userName = userRoleService.getUsername(); - assertEquals("john", userName); - } - - @Test - @WithMockUser(username = "john", roles = { "EDITOR" }) - public void givenUsernameJohn_whenCallIsValidUsername_thenReturnTrue() { - boolean isValid = userRoleService.isValidUsername("john"); - assertEquals(true, isValid); - } - - @Test(expected = AccessDeniedException.class) - @WithMockUser(username = "john", roles = { "ADMIN" }) - public void givenRoleAdmin_whenCallGetUsername_thenReturnAccessDenied() { - userRoleService.getUsername(); - } - - @Test(expected = AccessDeniedException.class) - @WithMockUser(username = "john", roles = { "USER" }) - public void givenRoleUser_whenCallGetUsername2_thenReturnAccessDenied() { - userRoleService.getUsername2(); - } - - @Test - @WithMockUser(username = "john", roles = { "VIEWER", "EDITOR" }) - public void givenRoleViewer_whenCallGetUsername2_thenReturnUsername() { - String userName = userRoleService.getUsername2(); - assertEquals("john", userName); - } - - @Test - @WithMockUser(username = "john", roles = { "VIEWER" }) - public void givenUsernameJerry_whenCallIsValidUsername2_thenReturnFalse() { - boolean isValid = userRoleService.isValidUsername2("jerry"); - assertEquals(false, isValid); - } - - @Test - @WithMockUser(username = "JOHN", authorities = { "SYS_ADMIN" }) - public void givenAuthoritySysAdmin_whenCallGetUsernameLC_thenReturnUsername() { - String username = userRoleService.getUsernameLC(); - assertEquals("john", username); - } - - @Test - @WithMockUser(username = "john", roles = { "ADMIN", "USER", "VIEWER" }) - public void givenUserJohn_whenCallGetMyRolesWithJohn_thenReturnRoles() { - String roles = userRoleService.getMyRoles("john"); - assertEquals("ROLE_ADMIN,ROLE_USER,ROLE_VIEWER", roles); - } - - @Test(expected = AccessDeniedException.class) - @WithMockUser(username = "john", roles = { "ADMIN", "USER", "VIEWER" }) - public void givenUserJane_whenCallGetMyRolesWithJane_thenAccessDenied() { - userRoleService.getMyRoles("jane"); - } - - @Test - @WithMockUser(username = "john", roles = { "ADMIN", "USER", "VIEWER" }) - public void givenUserJohn_whenCallGetMyRoles2WithJohn_thenReturnRoles() { - String roles = userRoleService.getMyRoles2("john"); - assertEquals("ROLE_ADMIN,ROLE_USER,ROLE_VIEWER", roles); - } - - @Test(expected = AccessDeniedException.class) - @WithMockUser(username = "john", roles = { "ADMIN", "USER", "VIEWER" }) - public void givenUserJane_whenCallGetMyRoles2WithJane_thenAccessDenied() { - userRoleService.getMyRoles2("jane"); - } - - @Test(expected = AccessDeniedException.class) - @WithAnonymousUser - public void givenAnomynousUser_whenCallGetUsername_thenAccessDenied() { - userRoleService.getUsername(); - } - - @Test - @WithMockJohnViewer - public void givenMockedJohnViewer_whenCallGetUsername_thenReturnUsername() { - String userName = userRoleService.getUsername(); - assertEquals("john", userName); - } - - @Test - @WithMockUser(username = "jane") - public void givenListContainCurrentUsername_whenJoinUsernames_thenReturnUsernames() { - List<String> usernames = new ArrayList<>(); - usernames.add("jane"); - usernames.add("john"); - usernames.add("jack"); - String containCurrentUser = userRoleService.joinUsernames(usernames); - assertEquals("john;jack", containCurrentUser); - } - - @Test - @WithMockUser(username = "john") - public void givenListContainCurrentUsername_whenCallJoinUsernamesAndRoles_thenReturnUsernameAndRoles() { - List<String> usernames = new ArrayList<>(); - usernames.add("jane"); - usernames.add("john"); - usernames.add("jack"); - - List<String> roles = new ArrayList<>(); - roles.add("ROLE_ADMIN"); - roles.add("ROLE_TEST"); - - String containCurrentUser = userRoleService.joinUsernamesAndRoles(usernames, roles); - assertEquals("jane;jack:ROLE_ADMIN;ROLE_TEST", containCurrentUser); - } - - @Test - @WithMockUser(username = "john") - public void givenUserJohn_whenCallGetAllUsernamesExceptCurrent_thenReturnOtherusernames() { - List<String> others = userRoleService.getAllUsernamesExceptCurrent(); - assertEquals(2, others.size()); - assertTrue(others.contains("jane")); - assertTrue(others.contains("jack")); - } - - @Test - @WithMockUser(username = "john", roles = { "VIEWER" }) - public void givenRoleViewer_whenCallGetUsername4_thenReturnUsername() { - String userName = userRoleService.getUsername4(); - assertEquals("john", userName); - } - - @Test(expected = AccessDeniedException.class) - @WithMockUser(username = "john") - public void givenDefaultRole_whenCallGetUsername4_thenAccessDenied() { - userRoleService.getUsername4(); - } - +package com.baeldung.methodsecurity; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException; +import org.springframework.security.test.context.support.WithAnonymousUser; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.methodsecurity.service.UserRoleService; + +@RunWith(SpringRunner.class) +@ContextConfiguration +public class MethodSecurityIntegrationTest { + + @Autowired + UserRoleService userRoleService; + + @Configuration + @ComponentScan("com.baeldung.methodsecurity.*") + public static class SpringConfig { + + } + + @Test(expected = AuthenticationCredentialsNotFoundException.class) + public void givenNoSecurity_whenCallGetUsername_thenReturnException() { + String userName = userRoleService.getUsername(); + assertEquals("john", userName); + } + + @Test + @WithMockUser(username = "john", roles = { "VIEWER" }) + public void givenRoleViewer_whenCallGetUsername_thenReturnUsername() { + String userName = userRoleService.getUsername(); + assertEquals("john", userName); + } + + @Test + @WithMockUser(username = "john", roles = { "EDITOR" }) + public void givenUsernameJohn_whenCallIsValidUsername_thenReturnTrue() { + boolean isValid = userRoleService.isValidUsername("john"); + assertEquals(true, isValid); + } + + @Test(expected = AccessDeniedException.class) + @WithMockUser(username = "john", roles = { "ADMIN" }) + public void givenRoleAdmin_whenCallGetUsername_thenReturnAccessDenied() { + userRoleService.getUsername(); + } + + @Test(expected = AccessDeniedException.class) + @WithMockUser(username = "john", roles = { "USER" }) + public void givenRoleUser_whenCallGetUsername2_thenReturnAccessDenied() { + userRoleService.getUsername2(); + } + + @Test + @WithMockUser(username = "john", roles = { "VIEWER", "EDITOR" }) + public void givenRoleViewer_whenCallGetUsername2_thenReturnUsername() { + String userName = userRoleService.getUsername2(); + assertEquals("john", userName); + } + + @Test + @WithMockUser(username = "john", roles = { "VIEWER" }) + public void givenUsernameJerry_whenCallIsValidUsername2_thenReturnFalse() { + boolean isValid = userRoleService.isValidUsername2("jerry"); + assertEquals(false, isValid); + } + + @Test + @WithMockUser(username = "JOHN", authorities = { "SYS_ADMIN" }) + public void givenAuthoritySysAdmin_whenCallGetUsernameLC_thenReturnUsername() { + String username = userRoleService.getUsernameLC(); + assertEquals("john", username); + } + + @Test + @WithMockUser(username = "john", roles = { "ADMIN", "USER", "VIEWER" }) + public void givenUserJohn_whenCallGetMyRolesWithJohn_thenReturnRoles() { + String roles = userRoleService.getMyRoles("john"); + assertEquals("ROLE_ADMIN,ROLE_USER,ROLE_VIEWER", roles); + } + + @Test(expected = AccessDeniedException.class) + @WithMockUser(username = "john", roles = { "ADMIN", "USER", "VIEWER" }) + public void givenUserJane_whenCallGetMyRolesWithJane_thenAccessDenied() { + userRoleService.getMyRoles("jane"); + } + + @Test + @WithMockUser(username = "john", roles = { "ADMIN", "USER", "VIEWER" }) + public void givenUserJohn_whenCallGetMyRoles2WithJohn_thenReturnRoles() { + String roles = userRoleService.getMyRoles2("john"); + assertEquals("ROLE_ADMIN,ROLE_USER,ROLE_VIEWER", roles); + } + + @Test(expected = AccessDeniedException.class) + @WithMockUser(username = "john", roles = { "ADMIN", "USER", "VIEWER" }) + public void givenUserJane_whenCallGetMyRoles2WithJane_thenAccessDenied() { + userRoleService.getMyRoles2("jane"); + } + + @Test(expected = AccessDeniedException.class) + @WithAnonymousUser + public void givenAnomynousUser_whenCallGetUsername_thenAccessDenied() { + userRoleService.getUsername(); + } + + @Test + @WithMockJohnViewer + public void givenMockedJohnViewer_whenCallGetUsername_thenReturnUsername() { + String userName = userRoleService.getUsername(); + assertEquals("john", userName); + } + + @Test + @WithMockUser(username = "jane") + public void givenListContainCurrentUsername_whenJoinUsernames_thenReturnUsernames() { + List<String> usernames = new ArrayList<>(); + usernames.add("jane"); + usernames.add("john"); + usernames.add("jack"); + String containCurrentUser = userRoleService.joinUsernames(usernames); + assertEquals("john;jack", containCurrentUser); + } + + @Test + @WithMockUser(username = "john") + public void givenListContainCurrentUsername_whenCallJoinUsernamesAndRoles_thenReturnUsernameAndRoles() { + List<String> usernames = new ArrayList<>(); + usernames.add("jane"); + usernames.add("john"); + usernames.add("jack"); + + List<String> roles = new ArrayList<>(); + roles.add("ROLE_ADMIN"); + roles.add("ROLE_TEST"); + + String containCurrentUser = userRoleService.joinUsernamesAndRoles(usernames, roles); + assertEquals("jane;jack:ROLE_ADMIN;ROLE_TEST", containCurrentUser); + } + + @Test + @WithMockUser(username = "john") + public void givenUserJohn_whenCallGetAllUsernamesExceptCurrent_thenReturnOtherusernames() { + List<String> others = userRoleService.getAllUsernamesExceptCurrent(); + assertEquals(2, others.size()); + assertTrue(others.contains("jane")); + assertTrue(others.contains("jack")); + } + + @Test + @WithMockUser(username = "john", roles = { "VIEWER" }) + public void givenRoleViewer_whenCallGetUsername4_thenReturnUsername() { + String userName = userRoleService.getUsername4(); + assertEquals("john", userName); + } + + @Test(expected = AccessDeniedException.class) + @WithMockUser(username = "john") + public void givenDefaultRole_whenCallGetUsername4_thenAccessDenied() { + userRoleService.getUsername4(); + } + } \ No newline at end of file diff --git a/spring-security-core/src/test/java/com/baeldung/methodsecurity/MockUserAtClassLevelIntegrationTest.java b/spring-security-modules/spring-security-core/src/test/java/com/baeldung/methodsecurity/MockUserAtClassLevelIntegrationTest.java similarity index 96% rename from spring-security-core/src/test/java/com/baeldung/methodsecurity/MockUserAtClassLevelIntegrationTest.java rename to spring-security-modules/spring-security-core/src/test/java/com/baeldung/methodsecurity/MockUserAtClassLevelIntegrationTest.java index fead89f75a..e7a2a2c828 100644 --- a/spring-security-core/src/test/java/com/baeldung/methodsecurity/MockUserAtClassLevelIntegrationTest.java +++ b/spring-security-modules/spring-security-core/src/test/java/com/baeldung/methodsecurity/MockUserAtClassLevelIntegrationTest.java @@ -1,35 +1,35 @@ -package com.baeldung.methodsecurity; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.test.context.support.WithMockUser; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.methodsecurity.service.UserRoleService; - -@RunWith(SpringRunner.class) -@ContextConfiguration -@WithMockUser(username = "john", roles = { "VIEWER" }) -public class MockUserAtClassLevelIntegrationTest { - - @Test - public void givenRoleViewer_whenCallGetUsername_thenReturnUsername() { - String currentUserName = userService.getUsername(); - assertEquals("john", currentUserName); - } - - @Autowired - UserRoleService userService; - - @Configuration - @ComponentScan("com.baeldung.methodsecurity.*") - public static class SpringConfig { - - } -} +package com.baeldung.methodsecurity; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.methodsecurity.service.UserRoleService; + +@RunWith(SpringRunner.class) +@ContextConfiguration +@WithMockUser(username = "john", roles = { "VIEWER" }) +public class MockUserAtClassLevelIntegrationTest { + + @Test + public void givenRoleViewer_whenCallGetUsername_thenReturnUsername() { + String currentUserName = userService.getUsername(); + assertEquals("john", currentUserName); + } + + @Autowired + UserRoleService userService; + + @Configuration + @ComponentScan("com.baeldung.methodsecurity.*") + public static class SpringConfig { + + } +} diff --git a/spring-security-core/src/test/java/com/baeldung/methodsecurity/UserDetailsIntegrationTest.java b/spring-security-modules/spring-security-core/src/test/java/com/baeldung/methodsecurity/UserDetailsIntegrationTest.java similarity index 97% rename from spring-security-core/src/test/java/com/baeldung/methodsecurity/UserDetailsIntegrationTest.java rename to spring-security-modules/spring-security-core/src/test/java/com/baeldung/methodsecurity/UserDetailsIntegrationTest.java index d43a26a5ff..c1298b1124 100644 --- a/spring-security-core/src/test/java/com/baeldung/methodsecurity/UserDetailsIntegrationTest.java +++ b/spring-security-modules/spring-security-core/src/test/java/com/baeldung/methodsecurity/UserDetailsIntegrationTest.java @@ -1,57 +1,57 @@ -package com.baeldung.methodsecurity; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.access.AccessDeniedException; -import org.springframework.security.test.context.support.WithUserDetails; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.methodsecurity.entity.CustomUser; -import com.baeldung.methodsecurity.service.UserRoleService; - -@RunWith(SpringRunner.class) -@ContextConfiguration -public class UserDetailsIntegrationTest { - - @Autowired - UserRoleService userService; - - @Configuration - @ComponentScan("com.baeldung.methodsecurity.*") - public static class SpringConfig { - - } - - @Test - @WithUserDetails(value = "john", userDetailsServiceBeanName = "userDetailService") - public void whenJohn_callLoadUserDetail_thenOK() { - CustomUser user = userService.loadUserDetail("jane"); - assertEquals("jane", user.getNickName()); - } - - @Test - @WithUserDetails(value = "jane", userDetailsServiceBeanName = "userDetailService") - public void givenJane_callSecuredLoadUserDetailWithJane_thenOK() { - CustomUser user = userService.securedLoadUserDetail("jane"); - assertEquals("jane", user.getNickName()); - assertEquals("jane", user.getUsername()); - } - - @Test(expected = AccessDeniedException.class) - @WithUserDetails(value = "john", userDetailsServiceBeanName = "userDetailService") - public void givenJohn_callSecuredLoadUserDetailWithJane_thenAccessDenied() { - userService.securedLoadUserDetail("jane"); - } - - @Test(expected = AccessDeniedException.class) - @WithUserDetails(value = "john", userDetailsServiceBeanName = "userDetailService") - public void givenJohn_callSecuredLoadUserDetailWithJohn_thenAccessDenied() { - userService.securedLoadUserDetail("john"); - } -} +package com.baeldung.methodsecurity; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.security.test.context.support.WithUserDetails; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.methodsecurity.entity.CustomUser; +import com.baeldung.methodsecurity.service.UserRoleService; + +@RunWith(SpringRunner.class) +@ContextConfiguration +public class UserDetailsIntegrationTest { + + @Autowired + UserRoleService userService; + + @Configuration + @ComponentScan("com.baeldung.methodsecurity.*") + public static class SpringConfig { + + } + + @Test + @WithUserDetails(value = "john", userDetailsServiceBeanName = "userDetailService") + public void whenJohn_callLoadUserDetail_thenOK() { + CustomUser user = userService.loadUserDetail("jane"); + assertEquals("jane", user.getNickName()); + } + + @Test + @WithUserDetails(value = "jane", userDetailsServiceBeanName = "userDetailService") + public void givenJane_callSecuredLoadUserDetailWithJane_thenOK() { + CustomUser user = userService.securedLoadUserDetail("jane"); + assertEquals("jane", user.getNickName()); + assertEquals("jane", user.getUsername()); + } + + @Test(expected = AccessDeniedException.class) + @WithUserDetails(value = "john", userDetailsServiceBeanName = "userDetailService") + public void givenJohn_callSecuredLoadUserDetailWithJane_thenAccessDenied() { + userService.securedLoadUserDetail("jane"); + } + + @Test(expected = AccessDeniedException.class) + @WithUserDetails(value = "john", userDetailsServiceBeanName = "userDetailService") + public void givenJohn_callSecuredLoadUserDetailWithJohn_thenAccessDenied() { + userService.securedLoadUserDetail("john"); + } +} diff --git a/spring-security-core/src/test/java/com/baeldung/methodsecurity/WithMockJohnViewer.java b/spring-security-modules/spring-security-core/src/test/java/com/baeldung/methodsecurity/WithMockJohnViewer.java similarity index 84% rename from spring-security-core/src/test/java/com/baeldung/methodsecurity/WithMockJohnViewer.java rename to spring-security-modules/spring-security-core/src/test/java/com/baeldung/methodsecurity/WithMockJohnViewer.java index f05a6bc20e..51c3904331 100644 --- a/spring-security-core/src/test/java/com/baeldung/methodsecurity/WithMockJohnViewer.java +++ b/spring-security-modules/spring-security-core/src/test/java/com/baeldung/methodsecurity/WithMockJohnViewer.java @@ -1,10 +1,10 @@ -package com.baeldung.methodsecurity; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -import org.springframework.security.test.context.support.WithMockUser; - -@Retention(RetentionPolicy.RUNTIME) -@WithMockUser(value="john",roles="VIEWER") +package com.baeldung.methodsecurity; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +import org.springframework.security.test.context.support.WithMockUser; + +@Retention(RetentionPolicy.RUNTIME) +@WithMockUser(value="john",roles="VIEWER") public @interface WithMockJohnViewer { } \ No newline at end of file diff --git a/spring-security-core/src/test/java/com/baeldung/test/LiveTest.java b/spring-security-modules/spring-security-core/src/test/java/com/baeldung/test/LiveTest.java similarity index 100% rename from spring-security-core/src/test/java/com/baeldung/test/LiveTest.java rename to spring-security-modules/spring-security-core/src/test/java/com/baeldung/test/LiveTest.java diff --git a/spring-rest/.gitignore b/spring-security-modules/spring-security-core/src/test/resources/.gitignore similarity index 100% rename from spring-rest/.gitignore rename to spring-security-modules/spring-security-core/src/test/resources/.gitignore diff --git a/spring-security-cors/README.md b/spring-security-modules/spring-security-cors/README.md similarity index 100% rename from spring-security-cors/README.md rename to spring-security-modules/spring-security-cors/README.md diff --git a/spring-security-cors/pom.xml b/spring-security-modules/spring-security-cors/pom.xml similarity index 98% rename from spring-security-cors/pom.xml rename to spring-security-modules/spring-security-cors/pom.xml index 0dd41e66c7..91e8f5adb6 100644 --- a/spring-security-cors/pom.xml +++ b/spring-security-modules/spring-security-cors/pom.xml @@ -2,11 +2,10 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-security-cors</artifactId> <version>0.0.1-SNAPSHOT</version> - <packaging>jar</packaging> <name>spring-security-cors</name> + <packaging>jar</packaging> <description>Spring Security CORS</description> <parent> diff --git a/spring-security-cors/src/main/java/com/baeldung/springbootsecuritycors/basicauth/SpringBootSecurityApplication.java b/spring-security-modules/spring-security-cors/src/main/java/com/baeldung/springbootsecuritycors/basicauth/SpringBootSecurityApplication.java similarity index 100% rename from spring-security-cors/src/main/java/com/baeldung/springbootsecuritycors/basicauth/SpringBootSecurityApplication.java rename to spring-security-modules/spring-security-cors/src/main/java/com/baeldung/springbootsecuritycors/basicauth/SpringBootSecurityApplication.java diff --git a/spring-security-cors/src/main/java/com/baeldung/springbootsecuritycors/basicauth/config/WebSecurityConfig.java b/spring-security-modules/spring-security-cors/src/main/java/com/baeldung/springbootsecuritycors/basicauth/config/WebSecurityConfig.java similarity index 100% rename from spring-security-cors/src/main/java/com/baeldung/springbootsecuritycors/basicauth/config/WebSecurityConfig.java rename to spring-security-modules/spring-security-cors/src/main/java/com/baeldung/springbootsecuritycors/basicauth/config/WebSecurityConfig.java diff --git a/spring-security-cors/src/main/java/com/baeldung/springbootsecuritycors/controller/ResourceController.java b/spring-security-modules/spring-security-cors/src/main/java/com/baeldung/springbootsecuritycors/controller/ResourceController.java similarity index 96% rename from spring-security-cors/src/main/java/com/baeldung/springbootsecuritycors/controller/ResourceController.java rename to spring-security-modules/spring-security-cors/src/main/java/com/baeldung/springbootsecuritycors/controller/ResourceController.java index 7292c7f4f4..5d7d9f7770 100644 --- a/spring-security-cors/src/main/java/com/baeldung/springbootsecuritycors/controller/ResourceController.java +++ b/spring-security-modules/spring-security-cors/src/main/java/com/baeldung/springbootsecuritycors/controller/ResourceController.java @@ -1,17 +1,17 @@ -package com.baeldung.springbootsecuritycors.controller; - -import java.security.Principal; - -import org.springframework.web.bind.annotation.CrossOrigin; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@CrossOrigin("http://localhost:4200") -public class ResourceController { - - @GetMapping("/user") - public String user(Principal principal) { - return principal.getName(); - } -} +package com.baeldung.springbootsecuritycors.controller; + +import java.security.Principal; + +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@CrossOrigin("http://localhost:4200") +public class ResourceController { + + @GetMapping("/user") + public String user(Principal principal) { + return principal.getName(); + } +} diff --git a/spring-security-cors/src/test/java/com/baeldung/springbootsecuritycors/ResourceControllerTest.java b/spring-security-modules/spring-security-cors/src/test/java/com/baeldung/springbootsecuritycors/ResourceControllerTest.java similarity index 97% rename from spring-security-cors/src/test/java/com/baeldung/springbootsecuritycors/ResourceControllerTest.java rename to spring-security-modules/spring-security-cors/src/test/java/com/baeldung/springbootsecuritycors/ResourceControllerTest.java index b45529ca5f..a471eb922f 100644 --- a/spring-security-cors/src/test/java/com/baeldung/springbootsecuritycors/ResourceControllerTest.java +++ b/spring-security-modules/spring-security-cors/src/test/java/com/baeldung/springbootsecuritycors/ResourceControllerTest.java @@ -1,42 +1,42 @@ -package com.baeldung.springbootsecuritycors; - -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.options; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -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.security.test.web.servlet.setup.SecurityMockMvcConfigurers; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import org.springframework.web.context.WebApplicationContext; - -import com.baeldung.springbootsecuritycors.basicauth.SpringBootSecurityApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = { SpringBootSecurityApplication.class }) -public class ResourceControllerTest { - - private MockMvc mockMvc; - - @Autowired - private WebApplicationContext wac; - - @Before - public void setUp() { - this.mockMvc = MockMvcBuilders.webAppContextSetup(wac) - .apply(SecurityMockMvcConfigurers.springSecurity()) - .build(); - } - - @Test - public void givenPreFlightRequest_whenPerfomed_shouldReturnOK() throws Exception { - mockMvc.perform(options("/user") - .header("Access-Control-Request-Method", "GET") - .header("Origin", "http://localhost:4200")) - .andExpect(status().isOk()); - } -} +package com.baeldung.springbootsecuritycors; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.options; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +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.security.test.web.servlet.setup.SecurityMockMvcConfigurers; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; + +import com.baeldung.springbootsecuritycors.basicauth.SpringBootSecurityApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = { SpringBootSecurityApplication.class }) +public class ResourceControllerTest { + + private MockMvc mockMvc; + + @Autowired + private WebApplicationContext wac; + + @Before + public void setUp() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac) + .apply(SecurityMockMvcConfigurers.springSecurity()) + .build(); + } + + @Test + public void givenPreFlightRequest_whenPerfomed_shouldReturnOK() throws Exception { + mockMvc.perform(options("/user") + .header("Access-Control-Request-Method", "GET") + .header("Origin", "http://localhost:4200")) + .andExpect(status().isOk()); + } +} diff --git a/spring-security-kerberos/README.md b/spring-security-modules/spring-security-kerberos/README.md similarity index 100% rename from spring-security-kerberos/README.md rename to spring-security-modules/spring-security-kerberos/README.md diff --git a/spring-security-kerberos/pom.xml b/spring-security-modules/spring-security-kerberos/pom.xml similarity index 95% rename from spring-security-kerberos/pom.xml rename to spring-security-modules/spring-security-kerberos/pom.xml index 437e8566bb..6846bdf063 100644 --- a/spring-security-kerberos/pom.xml +++ b/spring-security-modules/spring-security-kerberos/pom.xml @@ -1,18 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-security-kerberos</artifactId> <version>0.1-SNAPSHOT</version> <name>spring-security-kerberos</name> <packaging>war</packaging> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-boot-1</relativePath> + <relativePath>../../parent-boot-1</relativePath> </parent> <dependencies> @@ -65,4 +65,5 @@ <properties> <spring-security-kerberos.version>1.0.1.RELEASE</spring-security-kerberos.version> </properties> + </project> diff --git a/spring-security-kerberos/src/main/java/org/baeldung/Application.java b/spring-security-modules/spring-security-kerberos/src/main/java/org/baeldung/Application.java similarity index 100% rename from spring-security-kerberos/src/main/java/org/baeldung/Application.java rename to spring-security-modules/spring-security-kerberos/src/main/java/org/baeldung/Application.java diff --git a/spring-security-kerberos/src/main/java/org/baeldung/config/WebSecurityConfig.java b/spring-security-modules/spring-security-kerberos/src/main/java/org/baeldung/config/WebSecurityConfig.java similarity index 100% rename from spring-security-kerberos/src/main/java/org/baeldung/config/WebSecurityConfig.java rename to spring-security-modules/spring-security-kerberos/src/main/java/org/baeldung/config/WebSecurityConfig.java diff --git a/spring-security-kerberos/src/main/java/org/baeldung/security/DummyUserDetailsService.java b/spring-security-modules/spring-security-kerberos/src/main/java/org/baeldung/security/DummyUserDetailsService.java similarity index 100% rename from spring-security-kerberos/src/main/java/org/baeldung/security/DummyUserDetailsService.java rename to spring-security-modules/spring-security-kerberos/src/main/java/org/baeldung/security/DummyUserDetailsService.java diff --git a/spring-security-mvc-boot/README.md b/spring-security-modules/spring-security-mvc-boot/README.md similarity index 100% rename from spring-security-mvc-boot/README.md rename to spring-security-modules/spring-security-mvc-boot/README.md diff --git a/spring-security-mvc-boot/WebContent/META-INF/MANIFEST.MF b/spring-security-modules/spring-security-mvc-boot/WebContent/META-INF/MANIFEST.MF similarity index 100% rename from spring-security-mvc-boot/WebContent/META-INF/MANIFEST.MF rename to spring-security-modules/spring-security-mvc-boot/WebContent/META-INF/MANIFEST.MF diff --git a/spring-security-mvc-boot/pom.xml b/spring-security-modules/spring-security-mvc-boot/pom.xml similarity index 97% rename from spring-security-mvc-boot/pom.xml rename to spring-security-modules/spring-security-mvc-boot/pom.xml index 0063a2d82b..489ec2d427 100644 --- a/spring-security-mvc-boot/pom.xml +++ b/spring-security-modules/spring-security-mvc-boot/pom.xml @@ -1,9 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-security-mvc-boot</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-security-mvc-boot</name> @@ -11,10 +10,10 @@ <description>Spring Security MVC Boot</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-boot-2</relativePath> + <relativePath>../../parent-boot-2</relativePath> </parent> <dependencies> @@ -112,7 +111,6 @@ <version>${ehcache-core.version}</version> <type>jar</type> </dependency> - </dependencies> <build> @@ -228,7 +226,6 @@ </profile> </profiles> - <properties> <start-class>org.baeldung.custom.Application</start-class> <!--If you want to run the example with the voters comment the tag diff --git a/spring-security-mvc-boot/src/main/java/com/baeldung/AppConfig.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/com/baeldung/AppConfig.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/com/baeldung/AppConfig.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/com/baeldung/AppConfig.java diff --git a/spring-security-mvc-boot/src/main/java/com/baeldung/SpringSecurityConfig.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/com/baeldung/SpringSecurityConfig.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/com/baeldung/SpringSecurityConfig.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/com/baeldung/SpringSecurityConfig.java diff --git a/spring-security-mvc-boot/src/main/java/com/baeldung/data/repositories/TweetRepository.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/com/baeldung/data/repositories/TweetRepository.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/com/baeldung/data/repositories/TweetRepository.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/com/baeldung/data/repositories/TweetRepository.java diff --git a/spring-security-mvc-boot/src/main/java/com/baeldung/data/repositories/UserRepository.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/com/baeldung/data/repositories/UserRepository.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/com/baeldung/data/repositories/UserRepository.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/com/baeldung/data/repositories/UserRepository.java diff --git a/spring-security-mvc-boot/src/main/java/com/baeldung/models/AppUser.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/com/baeldung/models/AppUser.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/com/baeldung/models/AppUser.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/com/baeldung/models/AppUser.java diff --git a/spring-security-mvc-boot/src/main/java/com/baeldung/models/Tweet.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/com/baeldung/models/Tweet.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/com/baeldung/models/Tweet.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/com/baeldung/models/Tweet.java diff --git a/spring-security-mvc-boot/src/main/java/com/baeldung/security/AppUserPrincipal.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/com/baeldung/security/AppUserPrincipal.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/com/baeldung/security/AppUserPrincipal.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/com/baeldung/security/AppUserPrincipal.java diff --git a/spring-security-mvc-boot/src/main/java/com/baeldung/security/AuthenticationSuccessHandlerImpl.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/com/baeldung/security/AuthenticationSuccessHandlerImpl.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/com/baeldung/security/AuthenticationSuccessHandlerImpl.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/com/baeldung/security/AuthenticationSuccessHandlerImpl.java diff --git a/spring-security-mvc-boot/src/main/java/com/baeldung/security/CustomUserDetailsService.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/com/baeldung/security/CustomUserDetailsService.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/com/baeldung/security/CustomUserDetailsService.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/com/baeldung/security/CustomUserDetailsService.java diff --git a/spring-security-mvc-boot/src/main/java/com/baeldung/util/DummyContentUtil.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/com/baeldung/util/DummyContentUtil.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/com/baeldung/util/DummyContentUtil.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/com/baeldung/util/DummyContentUtil.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/custom/Application.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/Application.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/custom/Application.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/Application.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/custom/config/MethodSecurityConfig.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/config/MethodSecurityConfig.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/custom/config/MethodSecurityConfig.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/config/MethodSecurityConfig.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/custom/config/MvcConfig.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/config/MvcConfig.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/custom/config/MvcConfig.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/config/MvcConfig.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/custom/config/SecurityConfig.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/config/SecurityConfig.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/custom/config/SecurityConfig.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/config/SecurityConfig.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/SetupData.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/SetupData.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/SetupData.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/SetupData.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/dao/OrganizationRepository.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/dao/OrganizationRepository.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/dao/OrganizationRepository.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/dao/OrganizationRepository.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/dao/PrivilegeRepository.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/dao/PrivilegeRepository.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/dao/PrivilegeRepository.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/dao/PrivilegeRepository.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/dao/UserRepository.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/dao/UserRepository.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/dao/UserRepository.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/dao/UserRepository.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/model/Foo.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/model/Foo.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/model/Foo.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/model/Foo.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/model/Organization.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/model/Organization.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/model/Organization.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/model/Organization.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/model/Privilege.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/model/Privilege.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/model/Privilege.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/model/Privilege.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/model/User.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/model/User.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/model/User.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/persistence/model/User.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/custom/security/CustomMethodSecurityExpressionHandler.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/security/CustomMethodSecurityExpressionHandler.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/custom/security/CustomMethodSecurityExpressionHandler.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/security/CustomMethodSecurityExpressionHandler.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/custom/security/CustomMethodSecurityExpressionRoot.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/security/CustomMethodSecurityExpressionRoot.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/custom/security/CustomMethodSecurityExpressionRoot.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/security/CustomMethodSecurityExpressionRoot.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/custom/security/CustomPermissionEvaluator.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/security/CustomPermissionEvaluator.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/custom/security/CustomPermissionEvaluator.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/security/CustomPermissionEvaluator.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/custom/security/MySecurityExpressionRoot.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/security/MySecurityExpressionRoot.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/custom/security/MySecurityExpressionRoot.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/security/MySecurityExpressionRoot.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/custom/security/MyUserDetailsService.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/security/MyUserDetailsService.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/custom/security/MyUserDetailsService.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/security/MyUserDetailsService.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/custom/security/MyUserPrincipal.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/security/MyUserPrincipal.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/custom/security/MyUserPrincipal.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/security/MyUserPrincipal.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/custom/web/MainController.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/web/MainController.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/custom/web/MainController.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/custom/web/MainController.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/ip/IpApplication.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/ip/IpApplication.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/ip/IpApplication.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/ip/IpApplication.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/ip/config/CustomIpAuthenticationProvider.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/ip/config/CustomIpAuthenticationProvider.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/ip/config/CustomIpAuthenticationProvider.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/ip/config/CustomIpAuthenticationProvider.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/ip/config/SecurityConfig.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/ip/config/SecurityConfig.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/ip/config/SecurityConfig.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/ip/config/SecurityConfig.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/ip/config/SecurityXmlConfig.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/ip/config/SecurityXmlConfig.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/ip/config/SecurityXmlConfig.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/ip/config/SecurityXmlConfig.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/ip/web/MainController.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/ip/web/MainController.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/ip/web/MainController.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/ip/web/MainController.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/h2/H2JdbcAuthenticationApplication.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/h2/H2JdbcAuthenticationApplication.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/h2/H2JdbcAuthenticationApplication.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/h2/H2JdbcAuthenticationApplication.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/h2/config/SecurityConfiguration.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/h2/config/SecurityConfiguration.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/h2/config/SecurityConfiguration.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/h2/config/SecurityConfiguration.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/h2/web/UserController.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/h2/web/UserController.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/h2/web/UserController.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/h2/web/UserController.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/mysql/MySqlJdbcAuthenticationApplication.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/mysql/MySqlJdbcAuthenticationApplication.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/mysql/MySqlJdbcAuthenticationApplication.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/mysql/MySqlJdbcAuthenticationApplication.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/mysql/config/SecurityConfiguration.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/mysql/config/SecurityConfiguration.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/mysql/config/SecurityConfiguration.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/mysql/config/SecurityConfiguration.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/mysql/web/UserController.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/mysql/web/UserController.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/mysql/web/UserController.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/mysql/web/UserController.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/postgre/PostgreJdbcAuthenticationApplication.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/postgre/PostgreJdbcAuthenticationApplication.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/postgre/PostgreJdbcAuthenticationApplication.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/postgre/PostgreJdbcAuthenticationApplication.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/postgre/config/SecurityConfiguration.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/postgre/config/SecurityConfiguration.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/postgre/config/SecurityConfiguration.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/postgre/config/SecurityConfiguration.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/postgre/web/UserController.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/postgre/web/UserController.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/postgre/web/UserController.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/jdbcauthentication/postgre/web/UserController.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/multipleauthproviders/CustomAuthenticationProvider.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/multipleauthproviders/CustomAuthenticationProvider.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/multipleauthproviders/CustomAuthenticationProvider.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/multipleauthproviders/CustomAuthenticationProvider.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/multipleauthproviders/MultipleAuthController.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/multipleauthproviders/MultipleAuthController.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/multipleauthproviders/MultipleAuthController.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/multipleauthproviders/MultipleAuthController.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/multipleauthproviders/MultipleAuthProvidersApplication.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/multipleauthproviders/MultipleAuthProvidersApplication.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/multipleauthproviders/MultipleAuthProvidersApplication.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/multipleauthproviders/MultipleAuthProvidersApplication.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/multipleauthproviders/MultipleAuthProvidersSecurityConfig.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/multipleauthproviders/MultipleAuthProvidersSecurityConfig.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/multipleauthproviders/MultipleAuthProvidersSecurityConfig.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/multipleauthproviders/MultipleAuthProvidersSecurityConfig.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/multipleentrypoints/MultipleEntryPointsApplication.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/multipleentrypoints/MultipleEntryPointsApplication.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/multipleentrypoints/MultipleEntryPointsApplication.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/multipleentrypoints/MultipleEntryPointsApplication.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/multipleentrypoints/MultipleEntryPointsSecurityConfig.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/multipleentrypoints/MultipleEntryPointsSecurityConfig.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/multipleentrypoints/MultipleEntryPointsSecurityConfig.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/multipleentrypoints/MultipleEntryPointsSecurityConfig.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/multipleentrypoints/PagesController.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/multipleentrypoints/PagesController.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/multipleentrypoints/PagesController.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/multipleentrypoints/PagesController.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/multiplelogin/MultipleLoginApplication.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/multiplelogin/MultipleLoginApplication.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/multiplelogin/MultipleLoginApplication.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/multiplelogin/MultipleLoginApplication.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/multiplelogin/MultipleLoginMvcConfig.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/multiplelogin/MultipleLoginMvcConfig.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/multiplelogin/MultipleLoginMvcConfig.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/multiplelogin/MultipleLoginMvcConfig.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/multiplelogin/MultipleLoginSecurityConfig.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/multiplelogin/MultipleLoginSecurityConfig.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/multiplelogin/MultipleLoginSecurityConfig.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/multiplelogin/MultipleLoginSecurityConfig.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/multiplelogin/UsersController.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/multiplelogin/UsersController.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/multiplelogin/UsersController.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/multiplelogin/UsersController.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/CustomAuthenticationProvider.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/CustomAuthenticationProvider.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/CustomAuthenticationProvider.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/CustomAuthenticationProvider.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/MyLogoutSuccessHandler.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/MyLogoutSuccessHandler.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/MyLogoutSuccessHandler.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/MyLogoutSuccessHandler.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/MyUserDetailsService.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/MyUserDetailsService.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/MyUserDetailsService.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/MyUserDetailsService.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/RolesAuthoritiesApplication.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/RolesAuthoritiesApplication.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/RolesAuthoritiesApplication.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/RolesAuthoritiesApplication.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/config/MvcConfig.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/config/MvcConfig.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/config/MvcConfig.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/config/MvcConfig.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/config/SecurityConfig.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/config/SecurityConfig.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/config/SecurityConfig.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/config/SecurityConfig.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/model/Privilege.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/model/Privilege.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/model/Privilege.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/model/Privilege.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/model/Role.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/model/Role.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/model/Role.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/model/Role.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/model/User.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/model/User.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/model/User.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/model/User.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/IUserService.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/IUserService.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/IUserService.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/IUserService.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/PrivilegeRepository.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/PrivilegeRepository.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/PrivilegeRepository.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/PrivilegeRepository.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/RoleRepository.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/RoleRepository.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/RoleRepository.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/RoleRepository.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/SetupDataLoader.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/SetupDataLoader.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/SetupDataLoader.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/SetupDataLoader.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/UserRepository.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/UserRepository.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/UserRepository.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/UserRepository.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/UserService.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/UserService.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/UserService.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/UserService.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/HttpsEnabledApplication.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/HttpsEnabledApplication.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/ssl/HttpsEnabledApplication.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/HttpsEnabledApplication.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/SecurityConfig.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/SecurityConfig.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/ssl/SecurityConfig.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/SecurityConfig.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/WelcomeController.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/WelcomeController.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/ssl/WelcomeController.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/WelcomeController.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/voter/MinuteBasedVoter.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/voter/MinuteBasedVoter.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/voter/MinuteBasedVoter.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/voter/MinuteBasedVoter.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/voter/VoterApplication.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/voter/VoterApplication.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/voter/VoterApplication.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/voter/VoterApplication.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/voter/VoterMvcConfig.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/voter/VoterMvcConfig.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/voter/VoterMvcConfig.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/voter/VoterMvcConfig.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/voter/WebSecurityConfig.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/voter/WebSecurityConfig.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/voter/WebSecurityConfig.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/voter/WebSecurityConfig.java diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/voter/XmlSecurityConfig.java b/spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/voter/XmlSecurityConfig.java similarity index 100% rename from spring-security-mvc-boot/src/main/java/org/baeldung/voter/XmlSecurityConfig.java rename to spring-security-modules/spring-security-mvc-boot/src/main/java/org/baeldung/voter/XmlSecurityConfig.java diff --git a/spring-security-mvc-boot/src/main/resources/application-defaults.properties b/spring-security-modules/spring-security-mvc-boot/src/main/resources/application-defaults.properties similarity index 100% rename from spring-security-mvc-boot/src/main/resources/application-defaults.properties rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/application-defaults.properties diff --git a/spring-security-mvc-boot/src/main/resources/application-mysql.properties b/spring-security-modules/spring-security-mvc-boot/src/main/resources/application-mysql.properties similarity index 100% rename from spring-security-mvc-boot/src/main/resources/application-mysql.properties rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/application-mysql.properties diff --git a/spring-security-mvc-boot/src/main/resources/application-postgre.properties b/spring-security-modules/spring-security-mvc-boot/src/main/resources/application-postgre.properties similarity index 100% rename from spring-security-mvc-boot/src/main/resources/application-postgre.properties rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/application-postgre.properties diff --git a/spring-security-mvc-boot/src/main/resources/application-ssl.properties b/spring-security-modules/spring-security-mvc-boot/src/main/resources/application-ssl.properties similarity index 100% rename from spring-security-mvc-boot/src/main/resources/application-ssl.properties rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/application-ssl.properties diff --git a/spring-security-modules/spring-security-mvc-boot/src/main/resources/application.properties b/spring-security-modules/spring-security-mvc-boot/src/main/resources/application.properties new file mode 100644 index 0000000000..3cf12afeb9 --- /dev/null +++ b/spring-security-modules/spring-security-mvc-boot/src/main/resources/application.properties @@ -0,0 +1 @@ +server.port=8082 diff --git a/spring-security-mvc-boot/src/main/resources/data-mysql.sql b/spring-security-modules/spring-security-mvc-boot/src/main/resources/data-mysql.sql similarity index 100% rename from spring-security-mvc-boot/src/main/resources/data-mysql.sql rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/data-mysql.sql diff --git a/spring-security-mvc-boot/src/main/resources/data-postgre.sql b/spring-security-modules/spring-security-mvc-boot/src/main/resources/data-postgre.sql similarity index 100% rename from spring-security-mvc-boot/src/main/resources/data-postgre.sql rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/data-postgre.sql diff --git a/spring-security-mvc-boot/src/main/resources/keystore/baeldung.p12 b/spring-security-modules/spring-security-mvc-boot/src/main/resources/keystore/baeldung.p12 similarity index 100% rename from spring-security-mvc-boot/src/main/resources/keystore/baeldung.p12 rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/keystore/baeldung.p12 diff --git a/spring-security-sso/spring-security-sso-auth-server/src/main/resources/logback.xml b/spring-security-modules/spring-security-mvc-boot/src/main/resources/logback.xml similarity index 100% rename from spring-security-sso/spring-security-sso-auth-server/src/main/resources/logback.xml rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/logback.xml diff --git a/spring-security-mvc-boot/src/main/resources/persistence-h2.properties b/spring-security-modules/spring-security-mvc-boot/src/main/resources/persistence-h2.properties similarity index 100% rename from spring-security-mvc-boot/src/main/resources/persistence-h2.properties rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/persistence-h2.properties diff --git a/spring-security-mvc-boot/src/main/resources/schema-mysql.sql b/spring-security-modules/spring-security-mvc-boot/src/main/resources/schema-mysql.sql similarity index 100% rename from spring-security-mvc-boot/src/main/resources/schema-mysql.sql rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/schema-mysql.sql diff --git a/spring-security-mvc-boot/src/main/resources/schema-postgre.sql b/spring-security-modules/spring-security-mvc-boot/src/main/resources/schema-postgre.sql similarity index 100% rename from spring-security-mvc-boot/src/main/resources/schema-postgre.sql rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/schema-postgre.sql diff --git a/spring-security-mvc-boot/src/main/resources/spring-security-custom-voter.xml b/spring-security-modules/spring-security-mvc-boot/src/main/resources/spring-security-custom-voter.xml similarity index 100% rename from spring-security-mvc-boot/src/main/resources/spring-security-custom-voter.xml rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/spring-security-custom-voter.xml diff --git a/spring-security-mvc-boot/src/main/resources/spring-security-ip.xml b/spring-security-modules/spring-security-mvc-boot/src/main/resources/spring-security-ip.xml similarity index 100% rename from spring-security-mvc-boot/src/main/resources/spring-security-ip.xml rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/spring-security-ip.xml diff --git a/spring-security-mvc-boot/src/main/resources/spring-security-multiple-auth-providers.xml b/spring-security-modules/spring-security-mvc-boot/src/main/resources/spring-security-multiple-auth-providers.xml similarity index 100% rename from spring-security-mvc-boot/src/main/resources/spring-security-multiple-auth-providers.xml rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/spring-security-multiple-auth-providers.xml diff --git a/spring-security-mvc-boot/src/main/resources/spring-security-multiple-entry.xml b/spring-security-modules/spring-security-mvc-boot/src/main/resources/spring-security-multiple-entry.xml similarity index 100% rename from spring-security-mvc-boot/src/main/resources/spring-security-multiple-entry.xml rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/spring-security-multiple-entry.xml diff --git a/spring-security-mvc-boot/src/main/resources/templates/403.html b/spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/403.html similarity index 100% rename from spring-security-mvc-boot/src/main/resources/templates/403.html rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/403.html diff --git a/spring-security-mvc-boot/src/main/resources/templates/adminPage.html b/spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/adminPage.html similarity index 100% rename from spring-security-mvc-boot/src/main/resources/templates/adminPage.html rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/adminPage.html diff --git a/spring-security-mvc-boot/src/main/resources/templates/index.html b/spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/index.html similarity index 100% rename from spring-security-mvc-boot/src/main/resources/templates/index.html rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/index.html diff --git a/spring-security-mvc-boot/src/main/resources/templates/login.html b/spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/login.html similarity index 100% rename from spring-security-mvc-boot/src/main/resources/templates/login.html rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/login.html diff --git a/spring-security-mvc-boot/src/main/resources/templates/loginAdmin.html b/spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/loginAdmin.html similarity index 100% rename from spring-security-mvc-boot/src/main/resources/templates/loginAdmin.html rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/loginAdmin.html diff --git a/spring-security-mvc-boot/src/main/resources/templates/loginUser.html b/spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/loginUser.html similarity index 100% rename from spring-security-mvc-boot/src/main/resources/templates/loginUser.html rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/loginUser.html diff --git a/spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/login.html b/spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/login.html similarity index 100% rename from spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/login.html rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/login.html diff --git a/spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/loginWithWarning.html b/spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/loginWithWarning.html similarity index 100% rename from spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/loginWithWarning.html rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/loginWithWarning.html diff --git a/spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/multipleHttpLinks.html b/spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/multipleHttpLinks.html similarity index 100% rename from spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/multipleHttpLinks.html rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/multipleHttpLinks.html diff --git a/spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/myAdminPage.html b/spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/myAdminPage.html similarity index 100% rename from spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/myAdminPage.html rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/myAdminPage.html diff --git a/spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/myGuestPage.html b/spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/myGuestPage.html similarity index 100% rename from spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/myGuestPage.html rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/myGuestPage.html diff --git a/spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/myPrivateUserPage.html b/spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/myPrivateUserPage.html similarity index 100% rename from spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/myPrivateUserPage.html rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/myPrivateUserPage.html diff --git a/spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/myUserPage.html b/spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/myUserPage.html similarity index 100% rename from spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/myUserPage.html rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/multipleHttpElems/myUserPage.html diff --git a/spring-security-mvc-boot/src/main/resources/templates/private.html b/spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/private.html similarity index 100% rename from spring-security-mvc-boot/src/main/resources/templates/private.html rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/private.html diff --git a/spring-security-mvc-boot/src/main/resources/templates/protectedLinks.html b/spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/protectedLinks.html similarity index 100% rename from spring-security-mvc-boot/src/main/resources/templates/protectedLinks.html rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/protectedLinks.html diff --git a/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/home.html b/spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/home.html similarity index 100% rename from spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/home.html rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/home.html diff --git a/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/login.html b/spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/login.html similarity index 100% rename from spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/login.html rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/login.html diff --git a/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/protectedbyauthority.html b/spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/protectedbyauthority.html similarity index 100% rename from spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/protectedbyauthority.html rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/protectedbyauthority.html diff --git a/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/protectedbynothing.html b/spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/protectedbynothing.html similarity index 100% rename from spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/protectedbynothing.html rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/protectedbynothing.html diff --git a/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/protectedbyrole.html b/spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/protectedbyrole.html similarity index 100% rename from spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/protectedbyrole.html rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/protectedbyrole.html diff --git a/spring-security-mvc-boot/src/main/resources/templates/ssl/welcome.html b/spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/ssl/welcome.html similarity index 100% rename from spring-security-mvc-boot/src/main/resources/templates/ssl/welcome.html rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/ssl/welcome.html diff --git a/spring-security-mvc-boot/src/main/resources/templates/userPage.html b/spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/userPage.html similarity index 100% rename from spring-security-mvc-boot/src/main/resources/templates/userPage.html rename to spring-security-modules/spring-security-mvc-boot/src/main/resources/templates/userPage.html diff --git a/spring-security-mvc-boot/src/test/java/com/baeldung/relationships/SpringDataWithSecurityIntegrationTest.java b/spring-security-modules/spring-security-mvc-boot/src/test/java/com/baeldung/relationships/SpringDataWithSecurityIntegrationTest.java similarity index 100% rename from spring-security-mvc-boot/src/test/java/com/baeldung/relationships/SpringDataWithSecurityIntegrationTest.java rename to spring-security-modules/spring-security-mvc-boot/src/test/java/com/baeldung/relationships/SpringDataWithSecurityIntegrationTest.java diff --git a/spring-security-mvc-boot/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-mvc-boot/src/test/java/org/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-mvc-boot/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-mvc-boot/src/test/java/org/baeldung/SpringContextTest.java diff --git a/spring-security-mvc-boot/src/test/java/org/baeldung/jdbcauthentication/h2/SpringContextIntegrationTest.java b/spring-security-modules/spring-security-mvc-boot/src/test/java/org/baeldung/jdbcauthentication/h2/SpringContextTest.java similarity index 90% rename from spring-security-mvc-boot/src/test/java/org/baeldung/jdbcauthentication/h2/SpringContextIntegrationTest.java rename to spring-security-modules/spring-security-mvc-boot/src/test/java/org/baeldung/jdbcauthentication/h2/SpringContextTest.java index 55a7b9e2be..7aa26ff031 100644 --- a/spring-security-mvc-boot/src/test/java/org/baeldung/jdbcauthentication/h2/SpringContextIntegrationTest.java +++ b/spring-security-modules/spring-security-mvc-boot/src/test/java/org/baeldung/jdbcauthentication/h2/SpringContextTest.java @@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest(classes = H2JdbcAuthenticationApplication.class) -public class SpringContextIntegrationTest { +public class SpringContextTest { @Test public void whenSpringContextIsBootstrapped_thenNoExceptions() { diff --git a/spring-security-mvc-boot/src/test/java/org/baeldung/jdbcauthentication/h2/web/UserControllerLiveTest.java b/spring-security-modules/spring-security-mvc-boot/src/test/java/org/baeldung/jdbcauthentication/h2/web/UserControllerLiveTest.java similarity index 100% rename from spring-security-mvc-boot/src/test/java/org/baeldung/jdbcauthentication/h2/web/UserControllerLiveTest.java rename to spring-security-modules/spring-security-mvc-boot/src/test/java/org/baeldung/jdbcauthentication/h2/web/UserControllerLiveTest.java diff --git a/spring-security-mvc-boot/src/test/java/org/baeldung/jdbcauthentication/mysql/web/UserControllerLiveTest.java b/spring-security-modules/spring-security-mvc-boot/src/test/java/org/baeldung/jdbcauthentication/mysql/web/UserControllerLiveTest.java similarity index 100% rename from spring-security-mvc-boot/src/test/java/org/baeldung/jdbcauthentication/mysql/web/UserControllerLiveTest.java rename to spring-security-modules/spring-security-mvc-boot/src/test/java/org/baeldung/jdbcauthentication/mysql/web/UserControllerLiveTest.java diff --git a/spring-security-mvc-boot/src/test/java/org/baeldung/jdbcauthentication/postgre/web/UserControllerLiveTest.java b/spring-security-modules/spring-security-mvc-boot/src/test/java/org/baeldung/jdbcauthentication/postgre/web/UserControllerLiveTest.java similarity index 100% rename from spring-security-mvc-boot/src/test/java/org/baeldung/jdbcauthentication/postgre/web/UserControllerLiveTest.java rename to spring-security-modules/spring-security-mvc-boot/src/test/java/org/baeldung/jdbcauthentication/postgre/web/UserControllerLiveTest.java diff --git a/spring-security-mvc-boot/src/test/java/org/baeldung/web/ApplicationLiveTest.java b/spring-security-modules/spring-security-mvc-boot/src/test/java/org/baeldung/web/ApplicationLiveTest.java similarity index 100% rename from spring-security-mvc-boot/src/test/java/org/baeldung/web/ApplicationLiveTest.java rename to spring-security-modules/spring-security-mvc-boot/src/test/java/org/baeldung/web/ApplicationLiveTest.java diff --git a/spring-security-mvc-boot/src/test/java/org/baeldung/web/CustomUserDetailsServiceIntegrationTest.java b/spring-security-modules/spring-security-mvc-boot/src/test/java/org/baeldung/web/CustomUserDetailsServiceIntegrationTest.java similarity index 100% rename from spring-security-mvc-boot/src/test/java/org/baeldung/web/CustomUserDetailsServiceIntegrationTest.java rename to spring-security-modules/spring-security-mvc-boot/src/test/java/org/baeldung/web/CustomUserDetailsServiceIntegrationTest.java diff --git a/spring-security-mvc-boot/src/test/java/org/baeldung/web/HttpsApplicationIntegrationTest.java b/spring-security-modules/spring-security-mvc-boot/src/test/java/org/baeldung/web/HttpsApplicationIntegrationTest.java similarity index 100% rename from spring-security-mvc-boot/src/test/java/org/baeldung/web/HttpsApplicationIntegrationTest.java rename to spring-security-modules/spring-security-mvc-boot/src/test/java/org/baeldung/web/HttpsApplicationIntegrationTest.java diff --git a/spring-security-mvc-boot/src/test/java/org/baeldung/web/IpLiveTest.java b/spring-security-modules/spring-security-mvc-boot/src/test/java/org/baeldung/web/IpLiveTest.java similarity index 100% rename from spring-security-mvc-boot/src/test/java/org/baeldung/web/IpLiveTest.java rename to spring-security-modules/spring-security-mvc-boot/src/test/java/org/baeldung/web/IpLiveTest.java diff --git a/spring-security-mvc-boot/src/test/java/org/baeldung/web/MultipleAuthProvidersApplicationIntegrationTest.java b/spring-security-modules/spring-security-mvc-boot/src/test/java/org/baeldung/web/MultipleAuthProvidersApplicationIntegrationTest.java similarity index 100% rename from spring-security-mvc-boot/src/test/java/org/baeldung/web/MultipleAuthProvidersApplicationIntegrationTest.java rename to spring-security-modules/spring-security-mvc-boot/src/test/java/org/baeldung/web/MultipleAuthProvidersApplicationIntegrationTest.java diff --git a/spring-security-mvc-boot/src/test/java/org/baeldung/web/MultipleEntryPointsIntegrationTest.java b/spring-security-modules/spring-security-mvc-boot/src/test/java/org/baeldung/web/MultipleEntryPointsIntegrationTest.java similarity index 100% rename from spring-security-mvc-boot/src/test/java/org/baeldung/web/MultipleEntryPointsIntegrationTest.java rename to spring-security-modules/spring-security-mvc-boot/src/test/java/org/baeldung/web/MultipleEntryPointsIntegrationTest.java diff --git a/spring-rest/src/test/resources/.gitignore b/spring-security-modules/spring-security-mvc-custom/.gitignore similarity index 100% rename from spring-rest/src/test/resources/.gitignore rename to spring-security-modules/spring-security-mvc-custom/.gitignore diff --git a/spring-security-mvc-custom/README.md b/spring-security-modules/spring-security-mvc-custom/README.md similarity index 100% rename from spring-security-mvc-custom/README.md rename to spring-security-modules/spring-security-mvc-custom/README.md diff --git a/spring-security-mvc-custom/pom.xml b/spring-security-modules/spring-security-mvc-custom/pom.xml similarity index 98% rename from spring-security-mvc-custom/pom.xml rename to spring-security-modules/spring-security-mvc-custom/pom.xml index 3bae514bc1..fe8c749c59 100644 --- a/spring-security-mvc-custom/pom.xml +++ b/spring-security-modules/spring-security-mvc-custom/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-security-mvc-custom</artifactId> <version>0.1-SNAPSHOT</version> <name>spring-security-mvc-custom</name> @@ -11,7 +11,7 @@ <groupId>com.baeldung</groupId> <artifactId>parent-spring-5</artifactId> <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-spring-5</relativePath> + <relativePath>../../parent-spring-5</relativePath> </parent> <dependencies> diff --git a/spring-security-mvc-custom/src/main/java/org/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java b/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java similarity index 100% rename from spring-security-mvc-custom/src/main/java/org/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java rename to spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java diff --git a/spring-security-mvc-custom/src/main/java/org/baeldung/spring/MvcConfig.java b/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/spring/MvcConfig.java similarity index 100% rename from spring-security-mvc-custom/src/main/java/org/baeldung/spring/MvcConfig.java rename to spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/spring/MvcConfig.java diff --git a/spring-security-mvc-custom/src/main/java/org/baeldung/spring/SecSecurityConfig.java b/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/spring/SecSecurityConfig.java similarity index 100% rename from spring-security-mvc-custom/src/main/java/org/baeldung/spring/SecSecurityConfig.java rename to spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/spring/SecSecurityConfig.java diff --git a/spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/BankController.java b/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/BankController.java similarity index 100% rename from spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/BankController.java rename to spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/BankController.java diff --git a/spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/FooController.java b/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/FooController.java similarity index 100% rename from spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/FooController.java rename to spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/FooController.java diff --git a/spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/LoginController.java b/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/LoginController.java similarity index 100% rename from spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/LoginController.java rename to spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/LoginController.java diff --git a/spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/PrintUserController.java b/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/PrintUserController.java similarity index 100% rename from spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/PrintUserController.java rename to spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/PrintUserController.java diff --git a/spring-security-mvc-custom/src/main/java/org/baeldung/web/dto/Foo.java b/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/dto/Foo.java similarity index 100% rename from spring-security-mvc-custom/src/main/java/org/baeldung/web/dto/Foo.java rename to spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/dto/Foo.java diff --git a/spring-security-mvc-custom/src/main/java/org/baeldung/web/interceptor/LoggerInterceptor.java b/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/interceptor/LoggerInterceptor.java similarity index 100% rename from spring-security-mvc-custom/src/main/java/org/baeldung/web/interceptor/LoggerInterceptor.java rename to spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/interceptor/LoggerInterceptor.java diff --git a/spring-security-mvc-custom/src/main/java/org/baeldung/web/interceptor/SessionTimerInterceptor.java b/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/interceptor/SessionTimerInterceptor.java similarity index 100% rename from spring-security-mvc-custom/src/main/java/org/baeldung/web/interceptor/SessionTimerInterceptor.java rename to spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/interceptor/SessionTimerInterceptor.java diff --git a/spring-security-mvc-custom/src/main/java/org/baeldung/web/interceptor/UserInterceptor.java b/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/interceptor/UserInterceptor.java similarity index 100% rename from spring-security-mvc-custom/src/main/java/org/baeldung/web/interceptor/UserInterceptor.java rename to spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/interceptor/UserInterceptor.java diff --git a/spring-security-mvc-custom/src/main/resources/logback.xml b/spring-security-modules/spring-security-mvc-custom/src/main/resources/logback.xml similarity index 100% rename from spring-security-mvc-custom/src/main/resources/logback.xml rename to spring-security-modules/spring-security-mvc-custom/src/main/resources/logback.xml diff --git a/spring-security-mvc-custom/src/main/resources/webSecurityConfig.xml b/spring-security-modules/spring-security-mvc-custom/src/main/resources/webSecurityConfig.xml similarity index 100% rename from spring-security-mvc-custom/src/main/resources/webSecurityConfig.xml rename to spring-security-modules/spring-security-mvc-custom/src/main/resources/webSecurityConfig.xml diff --git a/spring-security-mvc-custom/src/main/webapp/WEB-INF/mvc-servlet.xml b/spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/mvc-servlet.xml similarity index 100% rename from spring-security-mvc-custom/src/main/webapp/WEB-INF/mvc-servlet.xml rename to spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/mvc-servlet.xml diff --git a/spring-security-mvc-custom/src/main/webapp/WEB-INF/view/anonymous.jsp b/spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/view/anonymous.jsp similarity index 100% rename from spring-security-mvc-custom/src/main/webapp/WEB-INF/view/anonymous.jsp rename to spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/view/anonymous.jsp diff --git a/spring-security-mvc-custom/src/main/webapp/WEB-INF/view/console.jsp b/spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/view/console.jsp similarity index 100% rename from spring-security-mvc-custom/src/main/webapp/WEB-INF/view/console.jsp rename to spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/view/console.jsp diff --git a/spring-security-mvc-custom/src/main/webapp/WEB-INF/view/csrfHome.jsp b/spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/view/csrfHome.jsp similarity index 100% rename from spring-security-mvc-custom/src/main/webapp/WEB-INF/view/csrfHome.jsp rename to spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/view/csrfHome.jsp diff --git a/spring-security-mvc-custom/src/main/webapp/WEB-INF/view/homepage.jsp b/spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/view/homepage.jsp similarity index 100% rename from spring-security-mvc-custom/src/main/webapp/WEB-INF/view/homepage.jsp rename to spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/view/homepage.jsp diff --git a/spring-security-mvc-custom/src/main/webapp/WEB-INF/view/login.jsp b/spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/view/login.jsp similarity index 100% rename from spring-security-mvc-custom/src/main/webapp/WEB-INF/view/login.jsp rename to spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/view/login.jsp diff --git a/spring-security-mvc-custom/src/main/webapp/WEB-INF/web.xml b/spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from spring-security-mvc-custom/src/main/webapp/WEB-INF/web.xml rename to spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/web.xml diff --git a/spring-security-mvc-custom/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-mvc-custom/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/SpringContextTest.java diff --git a/spring-security-mvc-custom/src/test/java/org/baeldung/security/csrf/CsrfAbstractIntegrationTest.java b/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/csrf/CsrfAbstractIntegrationTest.java similarity index 100% rename from spring-security-mvc-custom/src/test/java/org/baeldung/security/csrf/CsrfAbstractIntegrationTest.java rename to spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/csrf/CsrfAbstractIntegrationTest.java diff --git a/spring-security-mvc-custom/src/test/java/org/baeldung/security/csrf/CsrfDisabledIntegrationTest.java b/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/csrf/CsrfDisabledIntegrationTest.java similarity index 100% rename from spring-security-mvc-custom/src/test/java/org/baeldung/security/csrf/CsrfDisabledIntegrationTest.java rename to spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/csrf/CsrfDisabledIntegrationTest.java diff --git a/spring-security-mvc-custom/src/test/java/org/baeldung/security/csrf/CsrfEnabledIntegrationTest.java b/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/csrf/CsrfEnabledIntegrationTest.java similarity index 100% rename from spring-security-mvc-custom/src/test/java/org/baeldung/security/csrf/CsrfEnabledIntegrationTest.java rename to spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/csrf/CsrfEnabledIntegrationTest.java diff --git a/spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/ManualSecurityConfig.java b/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/ManualSecurityConfig.java similarity index 100% rename from spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/ManualSecurityConfig.java rename to spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/ManualSecurityConfig.java diff --git a/spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/ManualSecurityIntegrationTest.java b/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/ManualSecurityIntegrationTest.java similarity index 100% rename from spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/ManualSecurityIntegrationTest.java rename to spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/ManualSecurityIntegrationTest.java diff --git a/spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/SecurityWithCsrfConfig.java b/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/SecurityWithCsrfConfig.java similarity index 100% rename from spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/SecurityWithCsrfConfig.java rename to spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/SecurityWithCsrfConfig.java diff --git a/spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/SecurityWithoutCsrfConfig.java b/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/SecurityWithoutCsrfConfig.java similarity index 100% rename from spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/SecurityWithoutCsrfConfig.java rename to spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/SecurityWithoutCsrfConfig.java diff --git a/spring-security-mvc-custom/src/test/java/org/baeldung/web/interceptor/LoggerInterceptorIntegrationTest.java b/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/web/interceptor/LoggerInterceptorIntegrationTest.java similarity index 100% rename from spring-security-mvc-custom/src/test/java/org/baeldung/web/interceptor/LoggerInterceptorIntegrationTest.java rename to spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/web/interceptor/LoggerInterceptorIntegrationTest.java diff --git a/spring-security-mvc-custom/src/test/java/org/baeldung/web/interceptor/SessionTimerInterceptorIntegrationTest.java b/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/web/interceptor/SessionTimerInterceptorIntegrationTest.java similarity index 100% rename from spring-security-mvc-custom/src/test/java/org/baeldung/web/interceptor/SessionTimerInterceptorIntegrationTest.java rename to spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/web/interceptor/SessionTimerInterceptorIntegrationTest.java diff --git a/spring-security-mvc-custom/src/test/java/org/baeldung/web/interceptor/UserInterceptorIntegrationTest.java b/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/web/interceptor/UserInterceptorIntegrationTest.java similarity index 100% rename from spring-security-mvc-custom/src/test/java/org/baeldung/web/interceptor/UserInterceptorIntegrationTest.java rename to spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/web/interceptor/UserInterceptorIntegrationTest.java diff --git a/spring-security-core/.gitignore b/spring-security-modules/spring-security-mvc-custom/src/test/resources/.gitignore similarity index 100% rename from spring-security-core/.gitignore rename to spring-security-modules/spring-security-mvc-custom/src/test/resources/.gitignore diff --git a/spring-security-core/src/test/resources/.gitignore b/spring-security-modules/spring-security-mvc-digest-auth/.gitignore similarity index 100% rename from spring-security-core/src/test/resources/.gitignore rename to spring-security-modules/spring-security-mvc-digest-auth/.gitignore diff --git a/spring-security-mvc-digest-auth/README.md b/spring-security-modules/spring-security-mvc-digest-auth/README.md similarity index 100% rename from spring-security-mvc-digest-auth/README.md rename to spring-security-modules/spring-security-mvc-digest-auth/README.md diff --git a/spring-security-mvc-digest-auth/pom.xml b/spring-security-modules/spring-security-mvc-digest-auth/pom.xml similarity index 98% rename from spring-security-mvc-digest-auth/pom.xml rename to spring-security-modules/spring-security-mvc-digest-auth/pom.xml index 0baaea15ef..8061235c71 100644 --- a/spring-security-mvc-digest-auth/pom.xml +++ b/spring-security-modules/spring-security-mvc-digest-auth/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -10,7 +11,7 @@ <groupId>com.baeldung</groupId> <artifactId>parent-spring-4</artifactId> <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-spring-4</relativePath> + <relativePath>../../parent-spring-4</relativePath> </parent> <dependencies> diff --git a/spring-security-mvc-digest-auth/src/main/java/org/baeldung/basic/MyBasicAuthenticationEntryPoint.java b/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/org/baeldung/basic/MyBasicAuthenticationEntryPoint.java similarity index 100% rename from spring-security-mvc-digest-auth/src/main/java/org/baeldung/basic/MyBasicAuthenticationEntryPoint.java rename to spring-security-modules/spring-security-mvc-digest-auth/src/main/java/org/baeldung/basic/MyBasicAuthenticationEntryPoint.java diff --git a/spring-security-mvc-digest-auth/src/main/java/org/baeldung/client/HttpComponentsClientHttpRequestFactoryDigestAuth.java b/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/org/baeldung/client/HttpComponentsClientHttpRequestFactoryDigestAuth.java similarity index 100% rename from spring-security-mvc-digest-auth/src/main/java/org/baeldung/client/HttpComponentsClientHttpRequestFactoryDigestAuth.java rename to spring-security-modules/spring-security-mvc-digest-auth/src/main/java/org/baeldung/client/HttpComponentsClientHttpRequestFactoryDigestAuth.java diff --git a/spring-security-mvc-digest-auth/src/main/java/org/baeldung/spring/ClientConfig.java b/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/org/baeldung/spring/ClientConfig.java similarity index 100% rename from spring-security-mvc-digest-auth/src/main/java/org/baeldung/spring/ClientConfig.java rename to spring-security-modules/spring-security-mvc-digest-auth/src/main/java/org/baeldung/spring/ClientConfig.java diff --git a/spring-security-mvc-digest-auth/src/main/java/org/baeldung/spring/MvcConfig.java b/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/org/baeldung/spring/MvcConfig.java similarity index 100% rename from spring-security-mvc-digest-auth/src/main/java/org/baeldung/spring/MvcConfig.java rename to spring-security-modules/spring-security-mvc-digest-auth/src/main/java/org/baeldung/spring/MvcConfig.java diff --git a/spring-security-mvc-digest-auth/src/main/java/org/baeldung/spring/SecSecurityConfig.java b/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/org/baeldung/spring/SecSecurityConfig.java similarity index 100% rename from spring-security-mvc-digest-auth/src/main/java/org/baeldung/spring/SecSecurityConfig.java rename to spring-security-modules/spring-security-mvc-digest-auth/src/main/java/org/baeldung/spring/SecSecurityConfig.java diff --git a/spring-security-mvc-digest-auth/src/main/resources/logback.xml b/spring-security-modules/spring-security-mvc-digest-auth/src/main/resources/logback.xml similarity index 100% rename from spring-security-mvc-digest-auth/src/main/resources/logback.xml rename to spring-security-modules/spring-security-mvc-digest-auth/src/main/resources/logback.xml diff --git a/spring-security-mvc-digest-auth/src/main/resources/webSecurityConfig.xml b/spring-security-modules/spring-security-mvc-digest-auth/src/main/resources/webSecurityConfig.xml similarity index 100% rename from spring-security-mvc-digest-auth/src/main/resources/webSecurityConfig.xml rename to spring-security-modules/spring-security-mvc-digest-auth/src/main/resources/webSecurityConfig.xml diff --git a/spring-security-mvc-digest-auth/src/main/webapp/WEB-INF/mvc-servlet.xml b/spring-security-modules/spring-security-mvc-digest-auth/src/main/webapp/WEB-INF/mvc-servlet.xml similarity index 100% rename from spring-security-mvc-digest-auth/src/main/webapp/WEB-INF/mvc-servlet.xml rename to spring-security-modules/spring-security-mvc-digest-auth/src/main/webapp/WEB-INF/mvc-servlet.xml diff --git a/spring-security-mvc-digest-auth/src/main/webapp/WEB-INF/view/homepage.jsp b/spring-security-modules/spring-security-mvc-digest-auth/src/main/webapp/WEB-INF/view/homepage.jsp similarity index 100% rename from spring-security-mvc-digest-auth/src/main/webapp/WEB-INF/view/homepage.jsp rename to spring-security-modules/spring-security-mvc-digest-auth/src/main/webapp/WEB-INF/view/homepage.jsp diff --git a/spring-security-mvc-digest-auth/src/main/webapp/WEB-INF/web.xml b/spring-security-modules/spring-security-mvc-digest-auth/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from spring-security-mvc-digest-auth/src/main/webapp/WEB-INF/web.xml rename to spring-security-modules/spring-security-mvc-digest-auth/src/main/webapp/WEB-INF/web.xml diff --git a/spring-security-mvc-digest-auth/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-mvc-digest-auth/src/test/java/org/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-mvc-digest-auth/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-mvc-digest-auth/src/test/java/org/baeldung/SpringContextTest.java diff --git a/spring-security-mvc-digest-auth/src/test/java/org/baeldung/client/RawClientLiveTest.java b/spring-security-modules/spring-security-mvc-digest-auth/src/test/java/org/baeldung/client/RawClientLiveTest.java similarity index 100% rename from spring-security-mvc-digest-auth/src/test/java/org/baeldung/client/RawClientLiveTest.java rename to spring-security-modules/spring-security-mvc-digest-auth/src/test/java/org/baeldung/client/RawClientLiveTest.java diff --git a/spring-security-mvc-custom/.gitignore b/spring-security-modules/spring-security-mvc-digest-auth/src/test/resources/.gitignore similarity index 100% rename from spring-security-mvc-custom/.gitignore rename to spring-security-modules/spring-security-mvc-digest-auth/src/test/resources/.gitignore diff --git a/spring-security-mvc-custom/src/test/resources/.gitignore b/spring-security-modules/spring-security-mvc-jsonview/.gitignore similarity index 100% rename from spring-security-mvc-custom/src/test/resources/.gitignore rename to spring-security-modules/spring-security-mvc-jsonview/.gitignore diff --git a/spring-security-mvc-jsonview/README.md b/spring-security-modules/spring-security-mvc-jsonview/README.md similarity index 100% rename from spring-security-mvc-jsonview/README.md rename to spring-security-modules/spring-security-mvc-jsonview/README.md diff --git a/spring-security-mvc-jsonview/pom.xml b/spring-security-modules/spring-security-mvc-jsonview/pom.xml similarity index 97% rename from spring-security-mvc-jsonview/pom.xml rename to spring-security-modules/spring-security-mvc-jsonview/pom.xml index c21978203c..f6ba997c62 100644 --- a/spring-security-mvc-jsonview/pom.xml +++ b/spring-security-modules/spring-security-mvc-jsonview/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-security-mvc-jsonview</artifactId> <version>0.1-SNAPSHOT</version> <name>spring-security-mvc-jsonview</name> @@ -11,7 +11,7 @@ <groupId>com.baeldung</groupId> <artifactId>parent-spring-5</artifactId> <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-spring-5</relativePath> + <relativePath>../../parent-spring-5</relativePath> </parent> <dependencies> diff --git a/spring-security-mvc-jsonview/src/main/java/com/baeldung/AppInitializer.java b/spring-security-modules/spring-security-mvc-jsonview/src/main/java/com/baeldung/AppInitializer.java similarity index 100% rename from spring-security-mvc-jsonview/src/main/java/com/baeldung/AppInitializer.java rename to spring-security-modules/spring-security-mvc-jsonview/src/main/java/com/baeldung/AppInitializer.java diff --git a/spring-security-mvc-jsonview/src/main/java/com/baeldung/controller/ItemsController.java b/spring-security-modules/spring-security-mvc-jsonview/src/main/java/com/baeldung/controller/ItemsController.java similarity index 100% rename from spring-security-mvc-jsonview/src/main/java/com/baeldung/controller/ItemsController.java rename to spring-security-modules/spring-security-mvc-jsonview/src/main/java/com/baeldung/controller/ItemsController.java diff --git a/spring-security-mvc-jsonview/src/main/java/com/baeldung/controller/View.java b/spring-security-modules/spring-security-mvc-jsonview/src/main/java/com/baeldung/controller/View.java similarity index 100% rename from spring-security-mvc-jsonview/src/main/java/com/baeldung/controller/View.java rename to spring-security-modules/spring-security-mvc-jsonview/src/main/java/com/baeldung/controller/View.java diff --git a/spring-security-mvc-jsonview/src/main/java/com/baeldung/model/Item.java b/spring-security-modules/spring-security-mvc-jsonview/src/main/java/com/baeldung/model/Item.java similarity index 100% rename from spring-security-mvc-jsonview/src/main/java/com/baeldung/model/Item.java rename to spring-security-modules/spring-security-mvc-jsonview/src/main/java/com/baeldung/model/Item.java diff --git a/spring-security-mvc-jsonview/src/main/java/com/baeldung/spring/AppConfig.java b/spring-security-modules/spring-security-mvc-jsonview/src/main/java/com/baeldung/spring/AppConfig.java similarity index 100% rename from spring-security-mvc-jsonview/src/main/java/com/baeldung/spring/AppConfig.java rename to spring-security-modules/spring-security-mvc-jsonview/src/main/java/com/baeldung/spring/AppConfig.java diff --git a/spring-security-mvc-jsonview/src/main/java/com/baeldung/spring/SecurityJsonViewControllerAdvice.java b/spring-security-modules/spring-security-mvc-jsonview/src/main/java/com/baeldung/spring/SecurityJsonViewControllerAdvice.java similarity index 100% rename from spring-security-mvc-jsonview/src/main/java/com/baeldung/spring/SecurityJsonViewControllerAdvice.java rename to spring-security-modules/spring-security-mvc-jsonview/src/main/java/com/baeldung/spring/SecurityJsonViewControllerAdvice.java diff --git a/spring-security-mvc-jsonview/src/main/resources/logback.xml b/spring-security-modules/spring-security-mvc-jsonview/src/main/resources/logback.xml similarity index 100% rename from spring-security-mvc-jsonview/src/main/resources/logback.xml rename to spring-security-modules/spring-security-mvc-jsonview/src/main/resources/logback.xml diff --git a/spring-security-mvc-jsonview/src/test/java/com/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-mvc-jsonview/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-mvc-jsonview/src/test/java/com/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-mvc-jsonview/src/test/java/com/baeldung/SpringContextTest.java diff --git a/spring-security-mvc-jsonview/src/test/java/com/baeldung/security/SpringSecurityJsonViewIntegrationTest.java b/spring-security-modules/spring-security-mvc-jsonview/src/test/java/com/baeldung/security/SpringSecurityJsonViewIntegrationTest.java similarity index 100% rename from spring-security-mvc-jsonview/src/test/java/com/baeldung/security/SpringSecurityJsonViewIntegrationTest.java rename to spring-security-modules/spring-security-mvc-jsonview/src/test/java/com/baeldung/security/SpringSecurityJsonViewIntegrationTest.java diff --git a/spring-security-mvc-ldap/README.md b/spring-security-modules/spring-security-mvc-ldap/README.md similarity index 100% rename from spring-security-mvc-ldap/README.md rename to spring-security-modules/spring-security-mvc-ldap/README.md diff --git a/spring-security-mvc-ldap/pom.xml b/spring-security-modules/spring-security-mvc-ldap/pom.xml similarity index 90% rename from spring-security-mvc-ldap/pom.xml rename to spring-security-modules/spring-security-mvc-ldap/pom.xml index 1c5df368a7..2f227d7908 100644 --- a/spring-security-mvc-ldap/pom.xml +++ b/spring-security-modules/spring-security-mvc-ldap/pom.xml @@ -1,17 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-security-mvc-ldap</artifactId> <version>0.1-SNAPSHOT</version> <name>spring-security-mvc-ldap</name> <packaging>war</packaging> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-boot-1</relativePath> + <relativePath>../../parent-boot-1</relativePath> </parent> <dependencies> diff --git a/spring-security-mvc-ldap/src/main/java/org/baeldung/SampleLDAPApplication.java b/spring-security-modules/spring-security-mvc-ldap/src/main/java/org/baeldung/SampleLDAPApplication.java similarity index 100% rename from spring-security-mvc-ldap/src/main/java/org/baeldung/SampleLDAPApplication.java rename to spring-security-modules/spring-security-mvc-ldap/src/main/java/org/baeldung/SampleLDAPApplication.java diff --git a/spring-security-mvc-ldap/src/main/java/org/baeldung/controller/MyController.java b/spring-security-modules/spring-security-mvc-ldap/src/main/java/org/baeldung/controller/MyController.java similarity index 100% rename from spring-security-mvc-ldap/src/main/java/org/baeldung/controller/MyController.java rename to spring-security-modules/spring-security-mvc-ldap/src/main/java/org/baeldung/controller/MyController.java diff --git a/spring-security-mvc-ldap/src/main/java/org/baeldung/security/SecurityConfig.java b/spring-security-modules/spring-security-mvc-ldap/src/main/java/org/baeldung/security/SecurityConfig.java similarity index 100% rename from spring-security-mvc-ldap/src/main/java/org/baeldung/security/SecurityConfig.java rename to spring-security-modules/spring-security-mvc-ldap/src/main/java/org/baeldung/security/SecurityConfig.java diff --git a/spring-security-mvc-ldap/src/main/resources/logback.xml b/spring-security-modules/spring-security-mvc-ldap/src/main/resources/logback.xml similarity index 100% rename from spring-security-mvc-ldap/src/main/resources/logback.xml rename to spring-security-modules/spring-security-mvc-ldap/src/main/resources/logback.xml diff --git a/spring-security-mvc-ldap/src/main/resources/static/css/bootstrap.min.css b/spring-security-modules/spring-security-mvc-ldap/src/main/resources/static/css/bootstrap.min.css similarity index 100% rename from spring-security-mvc-ldap/src/main/resources/static/css/bootstrap.min.css rename to spring-security-modules/spring-security-mvc-ldap/src/main/resources/static/css/bootstrap.min.css diff --git a/spring-security-mvc-ldap/src/main/resources/templates/error.html b/spring-security-modules/spring-security-mvc-ldap/src/main/resources/templates/error.html similarity index 100% rename from spring-security-mvc-ldap/src/main/resources/templates/error.html rename to spring-security-modules/spring-security-mvc-ldap/src/main/resources/templates/error.html diff --git a/spring-security-mvc-ldap/src/main/resources/templates/home.html b/spring-security-modules/spring-security-mvc-ldap/src/main/resources/templates/home.html similarity index 100% rename from spring-security-mvc-ldap/src/main/resources/templates/home.html rename to spring-security-modules/spring-security-mvc-ldap/src/main/resources/templates/home.html diff --git a/spring-security-mvc-ldap/src/main/resources/templates/login.html b/spring-security-modules/spring-security-mvc-ldap/src/main/resources/templates/login.html similarity index 100% rename from spring-security-mvc-ldap/src/main/resources/templates/login.html rename to spring-security-modules/spring-security-mvc-ldap/src/main/resources/templates/login.html diff --git a/spring-security-mvc-ldap/src/main/resources/users.ldif b/spring-security-modules/spring-security-mvc-ldap/src/main/resources/users.ldif similarity index 100% rename from spring-security-mvc-ldap/src/main/resources/users.ldif rename to spring-security-modules/spring-security-mvc-ldap/src/main/resources/users.ldif diff --git a/spring-security-mvc-ldap/src/main/resources/webSecurityConfig.xml b/spring-security-modules/spring-security-mvc-ldap/src/main/resources/webSecurityConfig.xml similarity index 100% rename from spring-security-mvc-ldap/src/main/resources/webSecurityConfig.xml rename to spring-security-modules/spring-security-mvc-ldap/src/main/resources/webSecurityConfig.xml diff --git a/spring-security-mvc-ldap/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-mvc-ldap/src/test/java/org/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-mvc-ldap/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-mvc-ldap/src/test/java/org/baeldung/SpringContextTest.java diff --git a/spring-security-mvc-digest-auth/.gitignore b/spring-security-modules/spring-security-mvc-ldap/src/test/resources/.gitignore similarity index 100% rename from spring-security-mvc-digest-auth/.gitignore rename to spring-security-modules/spring-security-mvc-ldap/src/test/resources/.gitignore diff --git a/spring-security-mvc-digest-auth/src/test/resources/.gitignore b/spring-security-modules/spring-security-mvc-login/.gitignore similarity index 100% rename from spring-security-mvc-digest-auth/src/test/resources/.gitignore rename to spring-security-modules/spring-security-mvc-login/.gitignore diff --git a/spring-security-mvc-login/README.md b/spring-security-modules/spring-security-mvc-login/README.md similarity index 100% rename from spring-security-mvc-login/README.md rename to spring-security-modules/spring-security-mvc-login/README.md diff --git a/spring-security-mvc-login/pom.xml b/spring-security-modules/spring-security-mvc-login/pom.xml similarity index 98% rename from spring-security-mvc-login/pom.xml rename to spring-security-modules/spring-security-mvc-login/pom.xml index 1ca11bc1ab..4e0fe00176 100644 --- a/spring-security-mvc-login/pom.xml +++ b/spring-security-modules/spring-security-mvc-login/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-security-mvc-login</artifactId> <version>0.1-SNAPSHOT</version> <name>spring-security-mvc-login</name> @@ -11,7 +11,7 @@ <groupId>com.baeldung</groupId> <artifactId>parent-spring-5</artifactId> <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-spring-5</relativePath> + <relativePath>../../parent-spring-5</relativePath> </parent> <dependencies> diff --git a/spring-security-mvc-login/src/main/java/com/baeldung/AppInitializer.java b/spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/AppInitializer.java similarity index 100% rename from spring-security-mvc-login/src/main/java/com/baeldung/AppInitializer.java rename to spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/AppInitializer.java diff --git a/spring-security-mvc-login/src/main/java/com/baeldung/controller/SecuredResourceController.java b/spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/controller/SecuredResourceController.java similarity index 100% rename from spring-security-mvc-login/src/main/java/com/baeldung/controller/SecuredResourceController.java rename to spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/controller/SecuredResourceController.java diff --git a/spring-security-mvc-login/src/main/java/com/baeldung/security/CustomAccessDeniedHandler.java b/spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/security/CustomAccessDeniedHandler.java similarity index 100% rename from spring-security-mvc-login/src/main/java/com/baeldung/security/CustomAccessDeniedHandler.java rename to spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/security/CustomAccessDeniedHandler.java diff --git a/spring-security-mvc-login/src/main/java/com/baeldung/security/CustomAuthenticationFailureHandler.java b/spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/security/CustomAuthenticationFailureHandler.java similarity index 100% rename from spring-security-mvc-login/src/main/java/com/baeldung/security/CustomAuthenticationFailureHandler.java rename to spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/security/CustomAuthenticationFailureHandler.java diff --git a/spring-security-mvc-login/src/main/java/com/baeldung/security/CustomLogoutSuccessHandler.java b/spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/security/CustomLogoutSuccessHandler.java similarity index 100% rename from spring-security-mvc-login/src/main/java/com/baeldung/security/CustomLogoutSuccessHandler.java rename to spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/security/CustomLogoutSuccessHandler.java diff --git a/spring-security-mvc-login/src/main/java/com/baeldung/security/RefererAuthenticationSuccessHandler.java b/spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/security/RefererAuthenticationSuccessHandler.java similarity index 100% rename from spring-security-mvc-login/src/main/java/com/baeldung/security/RefererAuthenticationSuccessHandler.java rename to spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/security/RefererAuthenticationSuccessHandler.java diff --git a/spring-security-mvc-login/src/main/java/com/baeldung/security/config/SecSecurityConfig.java b/spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/security/config/SecSecurityConfig.java similarity index 100% rename from spring-security-mvc-login/src/main/java/com/baeldung/security/config/SecSecurityConfig.java rename to spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/security/config/SecSecurityConfig.java diff --git a/spring-security-mvc-login/src/main/java/com/baeldung/spring/ChannelSecSecurityConfig.java b/spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/spring/ChannelSecSecurityConfig.java similarity index 100% rename from spring-security-mvc-login/src/main/java/com/baeldung/spring/ChannelSecSecurityConfig.java rename to spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/spring/ChannelSecSecurityConfig.java diff --git a/spring-security-mvc-login/src/main/java/com/baeldung/spring/MvcConfig.java b/spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/spring/MvcConfig.java similarity index 100% rename from spring-security-mvc-login/src/main/java/com/baeldung/spring/MvcConfig.java rename to spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/spring/MvcConfig.java diff --git a/spring-security-mvc-login/src/main/java/com/baeldung/spring/RedirectionSecurityConfig.java b/spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/spring/RedirectionSecurityConfig.java similarity index 100% rename from spring-security-mvc-login/src/main/java/com/baeldung/spring/RedirectionSecurityConfig.java rename to spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/spring/RedirectionSecurityConfig.java diff --git a/spring-security-mvc-login/src/main/resources/RedirectionWebSecurityConfig.xml b/spring-security-modules/spring-security-mvc-login/src/main/resources/RedirectionWebSecurityConfig.xml similarity index 100% rename from spring-security-mvc-login/src/main/resources/RedirectionWebSecurityConfig.xml rename to spring-security-modules/spring-security-mvc-login/src/main/resources/RedirectionWebSecurityConfig.xml diff --git a/spring-security-mvc-login/src/main/resources/channelWebSecurityConfig.xml b/spring-security-modules/spring-security-mvc-login/src/main/resources/channelWebSecurityConfig.xml similarity index 100% rename from spring-security-mvc-login/src/main/resources/channelWebSecurityConfig.xml rename to spring-security-modules/spring-security-mvc-login/src/main/resources/channelWebSecurityConfig.xml diff --git a/spring-security-mvc-login/src/main/resources/logback.xml b/spring-security-modules/spring-security-mvc-login/src/main/resources/logback.xml similarity index 100% rename from spring-security-mvc-login/src/main/resources/logback.xml rename to spring-security-modules/spring-security-mvc-login/src/main/resources/logback.xml diff --git a/spring-security-mvc-login/src/main/resources/webSecurityConfig.xml b/spring-security-modules/spring-security-mvc-login/src/main/resources/webSecurityConfig.xml similarity index 100% rename from spring-security-mvc-login/src/main/resources/webSecurityConfig.xml rename to spring-security-modules/spring-security-mvc-login/src/main/resources/webSecurityConfig.xml diff --git a/spring-security-mvc-login/src/main/webapp/WEB-INF/mvc-servlet.xml b/spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/mvc-servlet.xml similarity index 100% rename from spring-security-mvc-login/src/main/webapp/WEB-INF/mvc-servlet.xml rename to spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/mvc-servlet.xml diff --git a/spring-security-mvc-login/src/main/webapp/WEB-INF/view/accessDenied.jsp b/spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/view/accessDenied.jsp similarity index 100% rename from spring-security-mvc-login/src/main/webapp/WEB-INF/view/accessDenied.jsp rename to spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/view/accessDenied.jsp diff --git a/spring-security-mvc-login/src/main/webapp/WEB-INF/view/admin/adminpage.jsp b/spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/view/admin/adminpage.jsp similarity index 100% rename from spring-security-mvc-login/src/main/webapp/WEB-INF/view/admin/adminpage.jsp rename to spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/view/admin/adminpage.jsp diff --git a/spring-security-mvc-login/src/main/webapp/WEB-INF/view/anonymous.jsp b/spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/view/anonymous.jsp similarity index 100% rename from spring-security-mvc-login/src/main/webapp/WEB-INF/view/anonymous.jsp rename to spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/view/anonymous.jsp diff --git a/spring-security-mvc-login/src/main/webapp/WEB-INF/view/homepage.jsp b/spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/view/homepage.jsp similarity index 100% rename from spring-security-mvc-login/src/main/webapp/WEB-INF/view/homepage.jsp rename to spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/view/homepage.jsp diff --git a/spring-security-mvc-login/src/main/webapp/WEB-INF/view/login.jsp b/spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/view/login.jsp similarity index 100% rename from spring-security-mvc-login/src/main/webapp/WEB-INF/view/login.jsp rename to spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/view/login.jsp diff --git a/spring-security-mvc-login/src/main/webapp/WEB-INF/web-old.xml b/spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/web-old.xml similarity index 100% rename from spring-security-mvc-login/src/main/webapp/WEB-INF/web-old.xml rename to spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/web-old.xml diff --git a/spring-security-mvc-login/src/test/java/com/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-mvc-login/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-mvc-login/src/test/java/com/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-mvc-login/src/test/java/com/baeldung/SpringContextTest.java diff --git a/spring-security-mvc-login/src/test/java/com/baeldung/security/FormLoginUnitTest.java b/spring-security-modules/spring-security-mvc-login/src/test/java/com/baeldung/security/FormLoginUnitTest.java similarity index 100% rename from spring-security-mvc-login/src/test/java/com/baeldung/security/FormLoginUnitTest.java rename to spring-security-modules/spring-security-mvc-login/src/test/java/com/baeldung/security/FormLoginUnitTest.java diff --git a/spring-security-mvc-login/src/test/java/com/baeldung/security/RedirectionSecurityIntegrationTest.java b/spring-security-modules/spring-security-mvc-login/src/test/java/com/baeldung/security/RedirectionSecurityIntegrationTest.java similarity index 100% rename from spring-security-mvc-login/src/test/java/com/baeldung/security/RedirectionSecurityIntegrationTest.java rename to spring-security-modules/spring-security-mvc-login/src/test/java/com/baeldung/security/RedirectionSecurityIntegrationTest.java diff --git a/spring-security-mvc-jsonview/.gitignore b/spring-security-modules/spring-security-mvc-login/src/test/resources/.gitignore similarity index 100% rename from spring-security-mvc-jsonview/.gitignore rename to spring-security-modules/spring-security-mvc-login/src/test/resources/.gitignore diff --git a/spring-security-mvc-login/src/test/resources/mvc-servlet.xml b/spring-security-modules/spring-security-mvc-login/src/test/resources/mvc-servlet.xml similarity index 100% rename from spring-security-mvc-login/src/test/resources/mvc-servlet.xml rename to spring-security-modules/spring-security-mvc-login/src/test/resources/mvc-servlet.xml diff --git a/spring-security-mvc-persisted-remember-me/.gitignore b/spring-security-modules/spring-security-mvc-persisted-remember-me/.gitignore similarity index 100% rename from spring-security-mvc-persisted-remember-me/.gitignore rename to spring-security-modules/spring-security-mvc-persisted-remember-me/.gitignore diff --git a/spring-security-mvc-persisted-remember-me/README.md b/spring-security-modules/spring-security-mvc-persisted-remember-me/README.md similarity index 100% rename from spring-security-mvc-persisted-remember-me/README.md rename to spring-security-modules/spring-security-mvc-persisted-remember-me/README.md diff --git a/spring-security-mvc-persisted-remember-me/pom.xml b/spring-security-modules/spring-security-mvc-persisted-remember-me/pom.xml similarity index 98% rename from spring-security-mvc-persisted-remember-me/pom.xml rename to spring-security-modules/spring-security-mvc-persisted-remember-me/pom.xml index 2f7989d573..9410793222 100644 --- a/spring-security-mvc-persisted-remember-me/pom.xml +++ b/spring-security-modules/spring-security-mvc-persisted-remember-me/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-security-mvc-persisted-remember-me</artifactId> <version>0.1-SNAPSHOT</version> <name>spring-security-mvc-persisted-remember-me</name> @@ -11,7 +11,7 @@ <groupId>com.baeldung</groupId> <artifactId>parent-spring-4</artifactId> <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-spring-4</relativePath> + <relativePath>../../parent-spring-4</relativePath> </parent> <dependencies> diff --git a/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/controller/MyController.java b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/controller/MyController.java similarity index 100% rename from spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/controller/MyController.java rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/controller/MyController.java diff --git a/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java similarity index 100% rename from spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java diff --git a/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/security/SecurityRole.java b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/security/SecurityRole.java similarity index 100% rename from spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/security/SecurityRole.java rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/security/SecurityRole.java diff --git a/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/security/SecurityWebApplicationInitializer.java b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/security/SecurityWebApplicationInitializer.java similarity index 100% rename from spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/security/SecurityWebApplicationInitializer.java rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/security/SecurityWebApplicationInitializer.java diff --git a/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/service/MyUserDetailsService.java b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/service/MyUserDetailsService.java similarity index 100% rename from spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/service/MyUserDetailsService.java rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/service/MyUserDetailsService.java diff --git a/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/spring/MvcConfig.java b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/spring/MvcConfig.java similarity index 100% rename from spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/spring/MvcConfig.java rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/spring/MvcConfig.java diff --git a/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/spring/PersistenceConfig.java b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/spring/PersistenceConfig.java similarity index 100% rename from spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/spring/PersistenceConfig.java rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/spring/PersistenceConfig.java diff --git a/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/spring/SecurityConfig.java b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/spring/SecurityConfig.java similarity index 100% rename from spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/spring/SecurityConfig.java rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/spring/SecurityConfig.java diff --git a/spring-security-mvc-persisted-remember-me/src/main/resources/logback.xml b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/resources/logback.xml similarity index 100% rename from spring-security-mvc-persisted-remember-me/src/main/resources/logback.xml rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/resources/logback.xml diff --git a/spring-security-mvc-persisted-remember-me/src/main/resources/persisted_logins_create_table.sql b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/resources/persisted_logins_create_table.sql similarity index 100% rename from spring-security-mvc-persisted-remember-me/src/main/resources/persisted_logins_create_table.sql rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/resources/persisted_logins_create_table.sql diff --git a/spring-security-mvc-persisted-remember-me/src/main/resources/persistence-h2.properties b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/resources/persistence-h2.properties similarity index 100% rename from spring-security-mvc-persisted-remember-me/src/main/resources/persistence-h2.properties rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/resources/persistence-h2.properties diff --git a/spring-security-mvc-persisted-remember-me/src/main/resources/persistence-postgres.properties b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/resources/persistence-postgres.properties similarity index 100% rename from spring-security-mvc-persisted-remember-me/src/main/resources/persistence-postgres.properties rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/resources/persistence-postgres.properties diff --git a/spring-security-mvc-persisted-remember-me/src/main/resources/webSecurityConfig.xml b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/resources/webSecurityConfig.xml similarity index 100% rename from spring-security-mvc-persisted-remember-me/src/main/resources/webSecurityConfig.xml rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/resources/webSecurityConfig.xml diff --git a/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/mvc-servlet.xml b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/mvc-servlet.xml similarity index 100% rename from spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/mvc-servlet.xml rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/mvc-servlet.xml diff --git a/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/view/anonymous.jsp b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/view/anonymous.jsp similarity index 100% rename from spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/view/anonymous.jsp rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/view/anonymous.jsp diff --git a/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/view/console.jsp b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/view/console.jsp similarity index 100% rename from spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/view/console.jsp rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/view/console.jsp diff --git a/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/view/homepage.jsp b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/view/homepage.jsp similarity index 100% rename from spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/view/homepage.jsp rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/view/homepage.jsp diff --git a/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/view/login.jsp b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/view/login.jsp similarity index 100% rename from spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/view/login.jsp rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/view/login.jsp diff --git a/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/web.xml b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/web.xml rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/web.xml diff --git a/spring-security-mvc-persisted-remember-me/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/test/java/org/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-mvc-persisted-remember-me/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/test/java/org/baeldung/SpringContextTest.java diff --git a/spring-security-mvc-ldap/src/test/resources/.gitignore b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/test/resources/.gitignore similarity index 100% rename from spring-security-mvc-ldap/src/test/resources/.gitignore rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/test/resources/.gitignore diff --git a/spring-security-mvc-socket/.gitignore b/spring-security-modules/spring-security-mvc-socket/.gitignore similarity index 100% rename from spring-security-mvc-socket/.gitignore rename to spring-security-modules/spring-security-mvc-socket/.gitignore diff --git a/spring-security-mvc-socket/README.md b/spring-security-modules/spring-security-mvc-socket/README.md similarity index 100% rename from spring-security-mvc-socket/README.md rename to spring-security-modules/spring-security-mvc-socket/README.md diff --git a/spring-security-mvc-socket/pom.xml b/spring-security-modules/spring-security-mvc-socket/pom.xml similarity index 97% rename from spring-security-mvc-socket/pom.xml rename to spring-security-modules/spring-security-mvc-socket/pom.xml index 96031e02f7..ff8cc708e3 100644 --- a/spring-security-mvc-socket/pom.xml +++ b/spring-security-modules/spring-security-mvc-socket/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.springsecuredsockets</groupId> <artifactId>spring-security-mvc-socket</artifactId> @@ -12,7 +12,7 @@ <groupId>com.baeldung</groupId> <artifactId>parent-spring-4</artifactId> <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-spring-4</relativePath> + <relativePath>../../parent-spring-4</relativePath> </parent> <dependencies> @@ -147,7 +147,7 @@ <artifactId>jackson-annotations</artifactId> <version>${jackson.version}</version> </dependency> - + <!-- Test --> <dependency> <groupId>org.springframework.boot</groupId> @@ -158,7 +158,7 @@ </dependencies> <build> - <finalName>spring-security-mvc-socket</finalName> + <finalName>spring-security-mvc-socket</finalName> <plugins> <plugin> <groupId>org.apache.tomcat.maven</groupId> diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/Constants.java b/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/Constants.java similarity index 100% rename from spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/Constants.java rename to spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/Constants.java diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/AppConfig.java b/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/AppConfig.java similarity index 100% rename from spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/AppConfig.java rename to spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/AppConfig.java diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/DataStoreConfig.java b/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/DataStoreConfig.java similarity index 100% rename from spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/DataStoreConfig.java rename to spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/DataStoreConfig.java diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SecurityConfig.java b/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SecurityConfig.java similarity index 100% rename from spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SecurityConfig.java rename to spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SecurityConfig.java diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SocketBrokerConfig.java b/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SocketBrokerConfig.java similarity index 100% rename from spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SocketBrokerConfig.java rename to spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SocketBrokerConfig.java diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SocketSecurityConfig.java b/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SocketSecurityConfig.java similarity index 100% rename from spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SocketSecurityConfig.java rename to spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SocketSecurityConfig.java diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/WebAppInitializer.java b/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/WebAppInitializer.java similarity index 100% rename from spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/WebAppInitializer.java rename to spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/WebAppInitializer.java diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/controllers/CsrfTokenController.java b/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/controllers/CsrfTokenController.java similarity index 100% rename from spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/controllers/CsrfTokenController.java rename to spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/controllers/CsrfTokenController.java diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/controllers/SocketController.java b/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/controllers/SocketController.java similarity index 100% rename from spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/controllers/SocketController.java rename to spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/controllers/SocketController.java diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/domain/Role.java b/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/domain/Role.java similarity index 100% rename from spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/domain/Role.java rename to spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/domain/Role.java diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/domain/User.java b/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/domain/User.java similarity index 100% rename from spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/domain/User.java rename to spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/domain/User.java diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/repositories/UserRepository.java b/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/repositories/UserRepository.java similarity index 100% rename from spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/repositories/UserRepository.java rename to spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/repositories/UserRepository.java diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomAccessDeniedHandler.java b/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomAccessDeniedHandler.java similarity index 100% rename from spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomAccessDeniedHandler.java rename to spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomAccessDeniedHandler.java diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomDaoAuthenticationProvider.java b/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomDaoAuthenticationProvider.java similarity index 100% rename from spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomDaoAuthenticationProvider.java rename to spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomDaoAuthenticationProvider.java diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomLoginSuccessHandler.java b/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomLoginSuccessHandler.java similarity index 100% rename from spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomLoginSuccessHandler.java rename to spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomLoginSuccessHandler.java diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomLogoutSuccessHandler.java b/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomLogoutSuccessHandler.java similarity index 100% rename from spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomLogoutSuccessHandler.java rename to spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomLogoutSuccessHandler.java diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomUserDetailsService.java b/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomUserDetailsService.java similarity index 100% rename from spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomUserDetailsService.java rename to spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomUserDetailsService.java diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/SecurityWebApplicationInitializer.java b/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/SecurityWebApplicationInitializer.java similarity index 100% rename from spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/SecurityWebApplicationInitializer.java rename to spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/SecurityWebApplicationInitializer.java diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/transfer/socket/Message.java b/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/transfer/socket/Message.java similarity index 100% rename from spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/transfer/socket/Message.java rename to spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/transfer/socket/Message.java diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/transfer/socket/OutputMessage.java b/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/transfer/socket/OutputMessage.java similarity index 100% rename from spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/transfer/socket/OutputMessage.java rename to spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/transfer/socket/OutputMessage.java diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/transfer/user/CustomUserDetails.java b/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/transfer/user/CustomUserDetails.java similarity index 100% rename from spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/transfer/user/CustomUserDetails.java rename to spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/transfer/user/CustomUserDetails.java diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/config/WebSocketMessageBrokerConfig.java b/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/config/WebSocketMessageBrokerConfig.java similarity index 100% rename from spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/config/WebSocketMessageBrokerConfig.java rename to spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/config/WebSocketMessageBrokerConfig.java diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/controllers/RestAPIController.java b/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/controllers/RestAPIController.java similarity index 100% rename from spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/controllers/RestAPIController.java rename to spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/controllers/RestAPIController.java diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/controllers/WebSocketController.java b/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/controllers/WebSocketController.java similarity index 100% rename from spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/controllers/WebSocketController.java rename to spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/controllers/WebSocketController.java diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/models/Greeting.java b/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/models/Greeting.java similarity index 100% rename from spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/models/Greeting.java rename to spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/models/Greeting.java diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/models/Message.java b/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/models/Message.java similarity index 100% rename from spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/models/Message.java rename to spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/models/Message.java diff --git a/spring-security-mvc-socket/src/main/resources/data.sql b/spring-security-modules/spring-security-mvc-socket/src/main/resources/data.sql similarity index 100% rename from spring-security-mvc-socket/src/main/resources/data.sql rename to spring-security-modules/spring-security-mvc-socket/src/main/resources/data.sql diff --git a/spring-security-sso/spring-security-sso-ui-2/src/main/resources/logback.xml b/spring-security-modules/spring-security-mvc-socket/src/main/resources/logback.xml similarity index 100% rename from spring-security-sso/spring-security-sso-ui-2/src/main/resources/logback.xml rename to spring-security-modules/spring-security-mvc-socket/src/main/resources/logback.xml diff --git a/spring-security-mvc-socket/src/main/resources/schema.sql b/spring-security-modules/spring-security-mvc-socket/src/main/resources/schema.sql similarity index 100% rename from spring-security-mvc-socket/src/main/resources/schema.sql rename to spring-security-modules/spring-security-mvc-socket/src/main/resources/schema.sql diff --git a/spring-security-mvc-socket/src/main/resources/static/rest.html b/spring-security-modules/spring-security-mvc-socket/src/main/resources/static/rest.html similarity index 100% rename from spring-security-mvc-socket/src/main/resources/static/rest.html rename to spring-security-modules/spring-security-mvc-socket/src/main/resources/static/rest.html diff --git a/spring-security-mvc-socket/src/main/resources/static/rest.js b/spring-security-modules/spring-security-mvc-socket/src/main/resources/static/rest.js similarity index 100% rename from spring-security-mvc-socket/src/main/resources/static/rest.js rename to spring-security-modules/spring-security-mvc-socket/src/main/resources/static/rest.js diff --git a/spring-security-mvc-socket/src/main/resources/static/ws.html b/spring-security-modules/spring-security-mvc-socket/src/main/resources/static/ws.html similarity index 100% rename from spring-security-mvc-socket/src/main/resources/static/ws.html rename to spring-security-modules/spring-security-mvc-socket/src/main/resources/static/ws.html diff --git a/spring-security-mvc-socket/src/main/resources/static/ws.js b/spring-security-modules/spring-security-mvc-socket/src/main/resources/static/ws.js similarity index 100% rename from spring-security-mvc-socket/src/main/resources/static/ws.js rename to spring-security-modules/spring-security-mvc-socket/src/main/resources/static/ws.js diff --git a/spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/denied.jsp b/spring-security-modules/spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/denied.jsp similarity index 100% rename from spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/denied.jsp rename to spring-security-modules/spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/denied.jsp diff --git a/spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/index.jsp b/spring-security-modules/spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/index.jsp similarity index 100% rename from spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/index.jsp rename to spring-security-modules/spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/index.jsp diff --git a/spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/login.jsp b/spring-security-modules/spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/login.jsp similarity index 100% rename from spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/login.jsp rename to spring-security-modules/spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/login.jsp diff --git a/spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/socket.jsp b/spring-security-modules/spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/socket.jsp similarity index 100% rename from spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/socket.jsp rename to spring-security-modules/spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/socket.jsp diff --git a/spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/success.jsp b/spring-security-modules/spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/success.jsp similarity index 100% rename from spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/success.jsp rename to spring-security-modules/spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/success.jsp diff --git a/spring-security-mvc-socket/src/main/webapp/resources/scripts/app.js b/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/scripts/app.js similarity index 100% rename from spring-security-mvc-socket/src/main/webapp/resources/scripts/app.js rename to spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/scripts/app.js diff --git a/spring-security-mvc-socket/src/main/webapp/resources/scripts/controllers/indexController.js b/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/scripts/controllers/indexController.js similarity index 100% rename from spring-security-mvc-socket/src/main/webapp/resources/scripts/controllers/indexController.js rename to spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/scripts/controllers/indexController.js diff --git a/spring-security-mvc-socket/src/main/webapp/resources/scripts/controllers/socketController.js b/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/scripts/controllers/socketController.js similarity index 100% rename from spring-security-mvc-socket/src/main/webapp/resources/scripts/controllers/socketController.js rename to spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/scripts/controllers/socketController.js diff --git a/spring-security-mvc-socket/src/main/webapp/resources/scripts/controllers/successController.js b/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/scripts/controllers/successController.js similarity index 100% rename from spring-security-mvc-socket/src/main/webapp/resources/scripts/controllers/successController.js rename to spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/scripts/controllers/successController.js diff --git a/spring-security-mvc-socket/src/main/webapp/resources/scripts/routes/router.js b/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/scripts/routes/router.js similarity index 100% rename from spring-security-mvc-socket/src/main/webapp/resources/scripts/routes/router.js rename to spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/scripts/routes/router.js diff --git a/spring-security-mvc-socket/src/main/webapp/resources/scripts/services/SocketService.js b/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/scripts/services/SocketService.js similarity index 100% rename from spring-security-mvc-socket/src/main/webapp/resources/scripts/services/SocketService.js rename to spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/scripts/services/SocketService.js diff --git a/spring-security-mvc-socket/src/main/webapp/resources/styles/app.css b/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/styles/app.css similarity index 100% rename from spring-security-mvc-socket/src/main/webapp/resources/styles/app.css rename to spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/styles/app.css diff --git a/spring-security-mvc-socket/src/main/webapp/resources/styles/denied.css b/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/styles/denied.css similarity index 100% rename from spring-security-mvc-socket/src/main/webapp/resources/styles/denied.css rename to spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/styles/denied.css diff --git a/spring-security-mvc-socket/src/main/webapp/resources/styles/index.css b/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/styles/index.css similarity index 100% rename from spring-security-mvc-socket/src/main/webapp/resources/styles/index.css rename to spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/styles/index.css diff --git a/spring-security-mvc-socket/src/main/webapp/resources/styles/login.css b/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/styles/login.css similarity index 100% rename from spring-security-mvc-socket/src/main/webapp/resources/styles/login.css rename to spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/styles/login.css diff --git a/spring-security-mvc-socket/src/main/webapp/resources/styles/socket.css b/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/styles/socket.css similarity index 100% rename from spring-security-mvc-socket/src/main/webapp/resources/styles/socket.css rename to spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/styles/socket.css diff --git a/spring-security-mvc-socket/src/main/webapp/resources/styles/success.css b/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/styles/success.css similarity index 100% rename from spring-security-mvc-socket/src/main/webapp/resources/styles/success.css rename to spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/styles/success.css diff --git a/spring-security-mvc-socket/src/main/webapp/resources/vendor/angular/angular-route.min.js b/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/angular/angular-route.min.js similarity index 100% rename from spring-security-mvc-socket/src/main/webapp/resources/vendor/angular/angular-route.min.js rename to spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/angular/angular-route.min.js diff --git a/spring-security-mvc-socket/src/main/webapp/resources/vendor/angular/angular-route.min.js.map b/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/angular/angular-route.min.js.map similarity index 100% rename from spring-security-mvc-socket/src/main/webapp/resources/vendor/angular/angular-route.min.js.map rename to spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/angular/angular-route.min.js.map diff --git a/spring-security-mvc-socket/src/main/webapp/resources/vendor/angular/angular.min.js b/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/angular/angular.min.js similarity index 100% rename from spring-security-mvc-socket/src/main/webapp/resources/vendor/angular/angular.min.js rename to spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/angular/angular.min.js diff --git a/spring-security-mvc-socket/src/main/webapp/resources/vendor/angular/angular.min.js.map b/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/angular/angular.min.js.map similarity index 100% rename from spring-security-mvc-socket/src/main/webapp/resources/vendor/angular/angular.min.js.map rename to spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/angular/angular.min.js.map diff --git a/spring-security-mvc-socket/src/main/webapp/resources/vendor/jquery/jquery.min.js b/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/jquery/jquery.min.js similarity index 100% rename from spring-security-mvc-socket/src/main/webapp/resources/vendor/jquery/jquery.min.js rename to spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/jquery/jquery.min.js diff --git a/spring-security-mvc-socket/src/main/webapp/resources/vendor/sockjs/sockjs.min.js b/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/sockjs/sockjs.min.js similarity index 100% rename from spring-security-mvc-socket/src/main/webapp/resources/vendor/sockjs/sockjs.min.js rename to spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/sockjs/sockjs.min.js diff --git a/spring-security-mvc-socket/src/main/webapp/resources/vendor/sockjs/sockjs.min.js.map b/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/sockjs/sockjs.min.js.map similarity index 100% rename from spring-security-mvc-socket/src/main/webapp/resources/vendor/sockjs/sockjs.min.js.map rename to spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/sockjs/sockjs.min.js.map diff --git a/spring-security-mvc-socket/src/main/webapp/resources/vendor/stomp/stomp.min.js b/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/stomp/stomp.min.js similarity index 100% rename from spring-security-mvc-socket/src/main/webapp/resources/vendor/stomp/stomp.min.js rename to spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/stomp/stomp.min.js diff --git a/spring-security-mvc-socket/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-mvc-socket/src/test/java/org/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-mvc-socket/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-mvc-socket/src/test/java/org/baeldung/SpringContextTest.java diff --git a/spring-security-mvc-login/.gitignore b/spring-security-modules/spring-security-mvc/.gitignore similarity index 100% rename from spring-security-mvc-login/.gitignore rename to spring-security-modules/spring-security-mvc/.gitignore diff --git a/spring-security-mvc/README.md b/spring-security-modules/spring-security-mvc/README.md similarity index 100% rename from spring-security-mvc/README.md rename to spring-security-modules/spring-security-mvc/README.md diff --git a/spring-security-mvc/pom.xml b/spring-security-modules/spring-security-mvc/pom.xml similarity index 90% rename from spring-security-mvc/pom.xml rename to spring-security-modules/spring-security-mvc/pom.xml index 98ad3daa46..7da047707a 100644 --- a/spring-security-mvc/pom.xml +++ b/spring-security-modules/spring-security-mvc/pom.xml @@ -1,8 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-security-mvc</artifactId> <version>0.1-SNAPSHOT</version> <name>spring-security-mvc</name> @@ -12,7 +12,7 @@ <groupId>com.baeldung</groupId> <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-boot-2</relativePath> + <relativePath>../../parent-boot-2</relativePath> </parent> <dependencies> diff --git a/spring-security-mvc/src/main/java/com/baeldung/monitoring/MetricRegistrySingleton.java b/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/monitoring/MetricRegistrySingleton.java similarity index 100% rename from spring-security-mvc/src/main/java/com/baeldung/monitoring/MetricRegistrySingleton.java rename to spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/monitoring/MetricRegistrySingleton.java diff --git a/spring-security-mvc/src/main/java/com/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java b/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java similarity index 100% rename from spring-security-mvc/src/main/java/com/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java rename to spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java diff --git a/spring-security-mvc/src/main/java/com/baeldung/session/SpringSessionApplication.java b/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/SpringSessionApplication.java similarity index 100% rename from spring-security-mvc/src/main/java/com/baeldung/session/SpringSessionApplication.java rename to spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/SpringSessionApplication.java diff --git a/spring-security-mvc/src/main/java/com/baeldung/session/bean/Constants.java b/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/bean/Constants.java similarity index 100% rename from spring-security-mvc/src/main/java/com/baeldung/session/bean/Constants.java rename to spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/bean/Constants.java diff --git a/spring-security-mvc/src/main/java/com/baeldung/session/bean/Foo.java b/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/bean/Foo.java similarity index 100% rename from spring-security-mvc/src/main/java/com/baeldung/session/bean/Foo.java rename to spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/bean/Foo.java diff --git a/spring-security-mvc/src/main/java/com/baeldung/session/filter/SessionFilter.java b/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/filter/SessionFilter.java similarity index 100% rename from spring-security-mvc/src/main/java/com/baeldung/session/filter/SessionFilter.java rename to spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/filter/SessionFilter.java diff --git a/spring-security-mvc/src/main/java/com/baeldung/session/security/config/SecSecurityConfig.java b/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/security/config/SecSecurityConfig.java similarity index 100% rename from spring-security-mvc/src/main/java/com/baeldung/session/security/config/SecSecurityConfig.java rename to spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/security/config/SecSecurityConfig.java diff --git a/spring-security-mvc/src/main/java/com/baeldung/session/web/FooController.java b/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/web/FooController.java similarity index 100% rename from spring-security-mvc/src/main/java/com/baeldung/session/web/FooController.java rename to spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/web/FooController.java diff --git a/spring-security-mvc/src/main/java/com/baeldung/session/web/SessionRestController.java b/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/web/SessionRestController.java similarity index 100% rename from spring-security-mvc/src/main/java/com/baeldung/session/web/SessionRestController.java rename to spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/web/SessionRestController.java diff --git a/spring-security-mvc/src/main/java/com/baeldung/session/web/config/MvcConfig.java b/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/web/config/MvcConfig.java similarity index 100% rename from spring-security-mvc/src/main/java/com/baeldung/session/web/config/MvcConfig.java rename to spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/web/config/MvcConfig.java diff --git a/spring-security-mvc/src/main/java/com/baeldung/web/SessionListenerWithMetrics.java b/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/web/SessionListenerWithMetrics.java similarity index 100% rename from spring-security-mvc/src/main/java/com/baeldung/web/SessionListenerWithMetrics.java rename to spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/web/SessionListenerWithMetrics.java diff --git a/spring-security-mvc/src/main/resources/application.properties b/spring-security-modules/spring-security-mvc/src/main/resources/application.properties similarity index 100% rename from spring-security-mvc/src/main/resources/application.properties rename to spring-security-modules/spring-security-mvc/src/main/resources/application.properties diff --git a/spring-security-mvc/src/main/resources/logback.xml b/spring-security-modules/spring-security-mvc/src/main/resources/logback.xml similarity index 100% rename from spring-security-mvc/src/main/resources/logback.xml rename to spring-security-modules/spring-security-mvc/src/main/resources/logback.xml diff --git a/spring-security-mvc/src/main/resources/webSecurityConfig.xml b/spring-security-modules/spring-security-mvc/src/main/resources/webSecurityConfig.xml similarity index 100% rename from spring-security-mvc/src/main/resources/webSecurityConfig.xml rename to spring-security-modules/spring-security-mvc/src/main/resources/webSecurityConfig.xml diff --git a/spring-security-mvc/src/main/webapp/WEB-INF/mvc-servlet.xml b/spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/mvc-servlet.xml similarity index 100% rename from spring-security-mvc/src/main/webapp/WEB-INF/mvc-servlet.xml rename to spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/mvc-servlet.xml diff --git a/spring-security-mvc/src/main/webapp/WEB-INF/view/anonymous.jsp b/spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/view/anonymous.jsp similarity index 100% rename from spring-security-mvc/src/main/webapp/WEB-INF/view/anonymous.jsp rename to spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/view/anonymous.jsp diff --git a/spring-security-mvc/src/main/webapp/WEB-INF/view/console.jsp b/spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/view/console.jsp similarity index 100% rename from spring-security-mvc/src/main/webapp/WEB-INF/view/console.jsp rename to spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/view/console.jsp diff --git a/spring-security-mvc/src/main/webapp/WEB-INF/view/homepage.jsp b/spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/view/homepage.jsp similarity index 100% rename from spring-security-mvc/src/main/webapp/WEB-INF/view/homepage.jsp rename to spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/view/homepage.jsp diff --git a/spring-security-mvc/src/main/webapp/WEB-INF/view/invalidSession.jsp b/spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/view/invalidSession.jsp similarity index 100% rename from spring-security-mvc/src/main/webapp/WEB-INF/view/invalidSession.jsp rename to spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/view/invalidSession.jsp diff --git a/spring-security-mvc/src/main/webapp/WEB-INF/view/login.jsp b/spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/view/login.jsp similarity index 100% rename from spring-security-mvc/src/main/webapp/WEB-INF/view/login.jsp rename to spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/view/login.jsp diff --git a/spring-security-mvc/src/main/webapp/WEB-INF/view/sessionExpired.jsp b/spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/view/sessionExpired.jsp similarity index 100% rename from spring-security-mvc/src/main/webapp/WEB-INF/view/sessionExpired.jsp rename to spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/view/sessionExpired.jsp diff --git a/spring-security-mvc/src/main/webapp/WEB-INF/web.xml b/spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from spring-security-mvc/src/main/webapp/WEB-INF/web.xml rename to spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/web.xml diff --git a/spring-security-mvc/src/test/java/com/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-mvc/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-mvc/src/test/java/com/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-mvc/src/test/java/com/baeldung/SpringContextTest.java diff --git a/spring-security-mvc/src/test/java/com/baeldung/session/SessionConfigurationLiveTest.java b/spring-security-modules/spring-security-mvc/src/test/java/com/baeldung/session/SessionConfigurationLiveTest.java similarity index 100% rename from spring-security-mvc/src/test/java/com/baeldung/session/SessionConfigurationLiveTest.java rename to spring-security-modules/spring-security-mvc/src/test/java/com/baeldung/session/SessionConfigurationLiveTest.java diff --git a/spring-security-mvc-login/src/test/resources/.gitignore b/spring-security-modules/spring-security-mvc/src/test/resources/.gitignore similarity index 100% rename from spring-security-mvc-login/src/test/resources/.gitignore rename to spring-security-modules/spring-security-mvc/src/test/resources/.gitignore diff --git a/spring-security-openid/README.md b/spring-security-modules/spring-security-openid/README.md similarity index 100% rename from spring-security-openid/README.md rename to spring-security-modules/spring-security-openid/README.md diff --git a/spring-security-openid/pom.xml b/spring-security-modules/spring-security-openid/pom.xml similarity index 92% rename from spring-security-openid/pom.xml rename to spring-security-modules/spring-security-openid/pom.xml index 0b5eaf6270..970182dc3b 100644 --- a/spring-security-openid/pom.xml +++ b/spring-security-modules/spring-security-openid/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-security-openid</artifactId> <name>spring-security-openid</name> @@ -8,10 +8,10 @@ <description>Spring OpenID sample project</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-boot-2</relativePath> + <relativePath>../../parent-boot-2</relativePath> </parent> <dependencies> diff --git a/spring-security-openid/src/main/java/org/baeldung/config/GoogleOpenIdConnectConfig.java b/spring-security-modules/spring-security-openid/src/main/java/org/baeldung/config/GoogleOpenIdConnectConfig.java similarity index 100% rename from spring-security-openid/src/main/java/org/baeldung/config/GoogleOpenIdConnectConfig.java rename to spring-security-modules/spring-security-openid/src/main/java/org/baeldung/config/GoogleOpenIdConnectConfig.java diff --git a/spring-security-openid/src/main/java/org/baeldung/config/HomeController.java b/spring-security-modules/spring-security-openid/src/main/java/org/baeldung/config/HomeController.java similarity index 100% rename from spring-security-openid/src/main/java/org/baeldung/config/HomeController.java rename to spring-security-modules/spring-security-openid/src/main/java/org/baeldung/config/HomeController.java diff --git a/spring-security-openid/src/main/java/org/baeldung/config/SecurityConfig.java b/spring-security-modules/spring-security-openid/src/main/java/org/baeldung/config/SecurityConfig.java similarity index 100% rename from spring-security-openid/src/main/java/org/baeldung/config/SecurityConfig.java rename to spring-security-modules/spring-security-openid/src/main/java/org/baeldung/config/SecurityConfig.java diff --git a/spring-security-openid/src/main/java/org/baeldung/config/SpringOpenidApplication.java b/spring-security-modules/spring-security-openid/src/main/java/org/baeldung/config/SpringOpenidApplication.java similarity index 100% rename from spring-security-openid/src/main/java/org/baeldung/config/SpringOpenidApplication.java rename to spring-security-modules/spring-security-openid/src/main/java/org/baeldung/config/SpringOpenidApplication.java diff --git a/spring-security-openid/src/main/java/org/baeldung/security/OpenIdConnectFilter.java b/spring-security-modules/spring-security-openid/src/main/java/org/baeldung/security/OpenIdConnectFilter.java similarity index 100% rename from spring-security-openid/src/main/java/org/baeldung/security/OpenIdConnectFilter.java rename to spring-security-modules/spring-security-openid/src/main/java/org/baeldung/security/OpenIdConnectFilter.java diff --git a/spring-security-openid/src/main/java/org/baeldung/security/OpenIdConnectUserDetails.java b/spring-security-modules/spring-security-openid/src/main/java/org/baeldung/security/OpenIdConnectUserDetails.java similarity index 100% rename from spring-security-openid/src/main/java/org/baeldung/security/OpenIdConnectUserDetails.java rename to spring-security-modules/spring-security-openid/src/main/java/org/baeldung/security/OpenIdConnectUserDetails.java diff --git a/spring-security-openid/src/main/resources/application.properties b/spring-security-modules/spring-security-openid/src/main/resources/application.properties similarity index 100% rename from spring-security-openid/src/main/resources/application.properties rename to spring-security-modules/spring-security-openid/src/main/resources/application.properties diff --git a/spring-security-sso/spring-security-sso-ui/src/main/resources/logback.xml b/spring-security-modules/spring-security-openid/src/main/resources/logback.xml similarity index 100% rename from spring-security-sso/spring-security-sso-ui/src/main/resources/logback.xml rename to spring-security-modules/spring-security-openid/src/main/resources/logback.xml diff --git a/spring-security-openid/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-openid/src/test/java/org/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-openid/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-openid/src/test/java/org/baeldung/SpringContextTest.java diff --git a/spring-security-react/.gitignore b/spring-security-modules/spring-security-react/.gitignore similarity index 100% rename from spring-security-react/.gitignore rename to spring-security-modules/spring-security-react/.gitignore diff --git a/spring-security-react/README.md b/spring-security-modules/spring-security-react/README.md similarity index 100% rename from spring-security-react/README.md rename to spring-security-modules/spring-security-react/README.md diff --git a/spring-security-react/pom.xml b/spring-security-modules/spring-security-react/pom.xml similarity index 92% rename from spring-security-react/pom.xml rename to spring-security-modules/spring-security-react/pom.xml index 40c284af7f..19240fe88c 100644 --- a/spring-security-react/pom.xml +++ b/spring-security-modules/spring-security-react/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -7,11 +8,11 @@ <packaging>war</packaging> <parent> - <groupId>com.baeldung</groupId> - <artifactId>parent-spring-4</artifactId> - <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-spring-4</relativePath> - </parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-spring-4</artifactId> + <version>0.0.1-SNAPSHOT</version> + <relativePath>../../parent-spring-4</relativePath> + </parent> <dependencies> @@ -81,14 +82,14 @@ <version>${jstl.version}</version> <scope>runtime</scope> </dependency> - + <!-- Test --> <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <version>1.5.10.RELEASE</version> - <scope>test</scope> - </dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <version>1.5.10.RELEASE</version> + <scope>test</scope> + </dependency> </dependencies> diff --git a/spring-security-react/src/main/java/org/baeldung/spring/MvcConfig.java b/spring-security-modules/spring-security-react/src/main/java/org/baeldung/spring/MvcConfig.java similarity index 100% rename from spring-security-react/src/main/java/org/baeldung/spring/MvcConfig.java rename to spring-security-modules/spring-security-react/src/main/java/org/baeldung/spring/MvcConfig.java diff --git a/spring-security-react/src/main/java/org/baeldung/spring/SecSecurityConfig.java b/spring-security-modules/spring-security-react/src/main/java/org/baeldung/spring/SecSecurityConfig.java similarity index 100% rename from spring-security-react/src/main/java/org/baeldung/spring/SecSecurityConfig.java rename to spring-security-modules/spring-security-react/src/main/java/org/baeldung/spring/SecSecurityConfig.java diff --git a/spring-security-react/src/main/resources/logback.xml b/spring-security-modules/spring-security-react/src/main/resources/logback.xml similarity index 100% rename from spring-security-react/src/main/resources/logback.xml rename to spring-security-modules/spring-security-react/src/main/resources/logback.xml diff --git a/spring-security-react/src/main/webapp/WEB-INF/mvc-servlet.xml b/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/mvc-servlet.xml similarity index 100% rename from spring-security-react/src/main/webapp/WEB-INF/mvc-servlet.xml rename to spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/mvc-servlet.xml diff --git a/spring-security-react/src/main/webapp/WEB-INF/view/accessDenied.jsp b/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/accessDenied.jsp similarity index 100% rename from spring-security-react/src/main/webapp/WEB-INF/view/accessDenied.jsp rename to spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/accessDenied.jsp diff --git a/spring-security-react/src/main/webapp/WEB-INF/view/admin/adminpage.jsp b/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/admin/adminpage.jsp similarity index 100% rename from spring-security-react/src/main/webapp/WEB-INF/view/admin/adminpage.jsp rename to spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/admin/adminpage.jsp diff --git a/spring-security-react/src/main/webapp/WEB-INF/view/anonymous.jsp b/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/anonymous.jsp similarity index 100% rename from spring-security-react/src/main/webapp/WEB-INF/view/anonymous.jsp rename to spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/anonymous.jsp diff --git a/spring-security-react/src/main/webapp/WEB-INF/view/homepage.jsp b/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/homepage.jsp similarity index 100% rename from spring-security-react/src/main/webapp/WEB-INF/view/homepage.jsp rename to spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/homepage.jsp diff --git a/spring-security-react/src/main/webapp/WEB-INF/view/react/.babelrc b/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/.babelrc similarity index 100% rename from spring-security-react/src/main/webapp/WEB-INF/view/react/.babelrc rename to spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/.babelrc diff --git a/spring-security-react/src/main/webapp/WEB-INF/view/react/.eslintignore b/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/.eslintignore similarity index 100% rename from spring-security-react/src/main/webapp/WEB-INF/view/react/.eslintignore rename to spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/.eslintignore diff --git a/spring-security-react/src/main/webapp/WEB-INF/view/react/.eslintrc b/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/.eslintrc similarity index 100% rename from spring-security-react/src/main/webapp/WEB-INF/view/react/.eslintrc rename to spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/.eslintrc diff --git a/spring-security-react/src/main/webapp/WEB-INF/view/react/.gitignore b/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/.gitignore similarity index 100% rename from spring-security-react/src/main/webapp/WEB-INF/view/react/.gitignore rename to spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/.gitignore diff --git a/spring-security-react/src/main/webapp/WEB-INF/view/react/package-lock.json b/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/package-lock.json similarity index 100% rename from spring-security-react/src/main/webapp/WEB-INF/view/react/package-lock.json rename to spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/package-lock.json diff --git a/spring-security-react/src/main/webapp/WEB-INF/view/react/package.json b/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/package.json similarity index 100% rename from spring-security-react/src/main/webapp/WEB-INF/view/react/package.json rename to spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/package.json diff --git a/spring-security-react/src/main/webapp/WEB-INF/view/react/public/favicon.ico b/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/public/favicon.ico similarity index 100% rename from spring-security-react/src/main/webapp/WEB-INF/view/react/public/favicon.ico rename to spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/public/favicon.ico diff --git a/spring-security-react/src/main/webapp/WEB-INF/view/react/public/index.html b/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/public/index.html similarity index 100% rename from spring-security-react/src/main/webapp/WEB-INF/view/react/public/index.html rename to spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/public/index.html diff --git a/spring-security-react/src/main/webapp/WEB-INF/view/react/public/manifest.json b/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/public/manifest.json similarity index 100% rename from spring-security-react/src/main/webapp/WEB-INF/view/react/public/manifest.json rename to spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/public/manifest.json diff --git a/spring-security-react/src/main/webapp/WEB-INF/view/react/src/Form.js b/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/src/Form.js similarity index 100% rename from spring-security-react/src/main/webapp/WEB-INF/view/react/src/Form.js rename to spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/src/Form.js diff --git a/spring-security-react/src/main/webapp/WEB-INF/view/react/src/Input.js b/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/src/Input.js similarity index 100% rename from spring-security-react/src/main/webapp/WEB-INF/view/react/src/Input.js rename to spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/src/Input.js diff --git a/spring-security-react/src/main/webapp/WEB-INF/view/react/src/index.css b/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/src/index.css similarity index 100% rename from spring-security-react/src/main/webapp/WEB-INF/view/react/src/index.css rename to spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/src/index.css diff --git a/spring-security-react/src/main/webapp/WEB-INF/view/react/src/index.js b/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/src/index.js similarity index 100% rename from spring-security-react/src/main/webapp/WEB-INF/view/react/src/index.js rename to spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/src/index.js diff --git a/spring-security-react/src/main/webapp/WEB-INF/view/react/src/registerServiceWorker.js b/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/src/registerServiceWorker.js similarity index 100% rename from spring-security-react/src/main/webapp/WEB-INF/view/react/src/registerServiceWorker.js rename to spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/src/registerServiceWorker.js diff --git a/spring-security-react/src/main/webapp/WEB-INF/web.xml b/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from spring-security-react/src/main/webapp/WEB-INF/web.xml rename to spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/web.xml diff --git a/spring-security-react/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-react/src/test/java/org/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-react/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-react/src/test/java/org/baeldung/SpringContextTest.java diff --git a/spring-security-mvc-persisted-remember-me/src/test/resources/.gitignore b/spring-security-modules/spring-security-rest-basic-auth/.gitignore similarity index 100% rename from spring-security-mvc-persisted-remember-me/src/test/resources/.gitignore rename to spring-security-modules/spring-security-rest-basic-auth/.gitignore diff --git a/spring-security-rest-basic-auth/README.md b/spring-security-modules/spring-security-rest-basic-auth/README.md similarity index 100% rename from spring-security-rest-basic-auth/README.md rename to spring-security-modules/spring-security-rest-basic-auth/README.md diff --git a/spring-security-rest-basic-auth/pom.xml b/spring-security-modules/spring-security-rest-basic-auth/pom.xml similarity index 98% rename from spring-security-rest-basic-auth/pom.xml rename to spring-security-modules/spring-security-rest-basic-auth/pom.xml index 143c61ae76..416882b3d4 100644 --- a/spring-security-rest-basic-auth/pom.xml +++ b/spring-security-modules/spring-security-rest-basic-auth/pom.xml @@ -1,8 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - - <groupId>com.baeldung</groupId> <artifactId>spring-security-rest-basic-auth</artifactId> <version>0.2-SNAPSHOT</version> <name>spring-security-rest-basic-auth</name> @@ -12,7 +11,7 @@ <groupId>com.baeldung</groupId> <artifactId>parent-spring-5</artifactId> <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-spring-5</relativePath> + <relativePath>../../parent-spring-5</relativePath> </parent> <dependencies> diff --git a/spring-security-rest-basic-auth/src/main/java/org/baeldung/basic/MyBasicAuthenticationEntryPoint.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/basic/MyBasicAuthenticationEntryPoint.java similarity index 100% rename from spring-security-rest-basic-auth/src/main/java/org/baeldung/basic/MyBasicAuthenticationEntryPoint.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/basic/MyBasicAuthenticationEntryPoint.java diff --git a/spring-security-rest-basic-auth/src/main/java/org/baeldung/client/HttpComponentsClientHttpRequestFactoryBasicAuth.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/client/HttpComponentsClientHttpRequestFactoryBasicAuth.java similarity index 100% rename from spring-security-rest-basic-auth/src/main/java/org/baeldung/client/HttpComponentsClientHttpRequestFactoryBasicAuth.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/client/HttpComponentsClientHttpRequestFactoryBasicAuth.java diff --git a/spring-security-rest-basic-auth/src/main/java/org/baeldung/client/RestTemplateFactory.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/client/RestTemplateFactory.java similarity index 100% rename from spring-security-rest-basic-auth/src/main/java/org/baeldung/client/RestTemplateFactory.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/client/RestTemplateFactory.java diff --git a/spring-security-rest-basic-auth/src/main/java/org/baeldung/client/spring/ClientConfig.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/client/spring/ClientConfig.java similarity index 100% rename from spring-security-rest-basic-auth/src/main/java/org/baeldung/client/spring/ClientConfig.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/client/spring/ClientConfig.java diff --git a/spring-security-rest-basic-auth/src/main/java/org/baeldung/filter/CustomFilter.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/filter/CustomFilter.java similarity index 100% rename from spring-security-rest-basic-auth/src/main/java/org/baeldung/filter/CustomFilter.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/filter/CustomFilter.java diff --git a/spring-security-rest-basic-auth/src/main/java/org/baeldung/filter/CustomWebSecurityConfigurerAdapter.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/filter/CustomWebSecurityConfigurerAdapter.java similarity index 100% rename from spring-security-rest-basic-auth/src/main/java/org/baeldung/filter/CustomWebSecurityConfigurerAdapter.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/filter/CustomWebSecurityConfigurerAdapter.java diff --git a/spring-security-rest-basic-auth/src/main/java/org/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java similarity index 100% rename from spring-security-rest-basic-auth/src/main/java/org/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java diff --git a/spring-security-rest-basic-auth/src/main/java/org/baeldung/security/RestAuthenticationEntryPoint.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/security/RestAuthenticationEntryPoint.java similarity index 100% rename from spring-security-rest-basic-auth/src/main/java/org/baeldung/security/RestAuthenticationEntryPoint.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/security/RestAuthenticationEntryPoint.java diff --git a/spring-security-rest-basic-auth/src/main/java/org/baeldung/spring/SecSecurityConfig.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/spring/SecSecurityConfig.java similarity index 100% rename from spring-security-rest-basic-auth/src/main/java/org/baeldung/spring/SecSecurityConfig.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/spring/SecSecurityConfig.java diff --git a/spring-security-rest-basic-auth/src/main/java/org/baeldung/spring/WebConfig.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/spring/WebConfig.java similarity index 100% rename from spring-security-rest-basic-auth/src/main/java/org/baeldung/spring/WebConfig.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/spring/WebConfig.java diff --git a/spring-security-rest-basic-auth/src/main/java/org/baeldung/web/controller/BarController.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/web/controller/BarController.java similarity index 100% rename from spring-security-rest-basic-auth/src/main/java/org/baeldung/web/controller/BarController.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/web/controller/BarController.java diff --git a/spring-security-rest-basic-auth/src/main/java/org/baeldung/web/controller/FooController.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/web/controller/FooController.java similarity index 100% rename from spring-security-rest-basic-auth/src/main/java/org/baeldung/web/controller/FooController.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/web/controller/FooController.java diff --git a/spring-security-rest-basic-auth/src/main/java/org/baeldung/web/dto/Bar.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/web/dto/Bar.java similarity index 100% rename from spring-security-rest-basic-auth/src/main/java/org/baeldung/web/dto/Bar.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/web/dto/Bar.java diff --git a/spring-security-rest-basic-auth/src/main/java/org/baeldung/web/dto/Foo.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/web/dto/Foo.java similarity index 100% rename from spring-security-rest-basic-auth/src/main/java/org/baeldung/web/dto/Foo.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/web/dto/Foo.java diff --git a/spring-security-rest-basic-auth/src/main/resources/logback.xml b/spring-security-modules/spring-security-rest-basic-auth/src/main/resources/logback.xml similarity index 100% rename from spring-security-rest-basic-auth/src/main/resources/logback.xml rename to spring-security-modules/spring-security-rest-basic-auth/src/main/resources/logback.xml diff --git a/spring-security-rest-basic-auth/src/main/resources/webSecurityConfig.xml b/spring-security-modules/spring-security-rest-basic-auth/src/main/resources/webSecurityConfig.xml similarity index 100% rename from spring-security-rest-basic-auth/src/main/resources/webSecurityConfig.xml rename to spring-security-modules/spring-security-rest-basic-auth/src/main/resources/webSecurityConfig.xml diff --git a/spring-security-rest-basic-auth/src/main/webapp/WEB-INF/api-servlet.xml b/spring-security-modules/spring-security-rest-basic-auth/src/main/webapp/WEB-INF/api-servlet.xml similarity index 100% rename from spring-security-rest-basic-auth/src/main/webapp/WEB-INF/api-servlet.xml rename to spring-security-modules/spring-security-rest-basic-auth/src/main/webapp/WEB-INF/api-servlet.xml diff --git a/spring-security-rest-basic-auth/src/main/webapp/WEB-INF/web.xml b/spring-security-modules/spring-security-rest-basic-auth/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from spring-security-rest-basic-auth/src/main/webapp/WEB-INF/web.xml rename to spring-security-modules/spring-security-rest-basic-auth/src/main/webapp/WEB-INF/web.xml diff --git a/spring-security-rest-basic-auth/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-rest-basic-auth/src/test/java/org/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-rest-basic-auth/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-rest-basic-auth/src/test/java/org/baeldung/SpringContextTest.java diff --git a/spring-security-mvc/.gitignore b/spring-security-modules/spring-security-rest-basic-auth/src/test/resources/.gitignore similarity index 100% rename from spring-security-mvc/.gitignore rename to spring-security-modules/spring-security-rest-basic-auth/src/test/resources/.gitignore diff --git a/spring-security-rest-custom/README.md b/spring-security-modules/spring-security-rest-custom/README.md similarity index 100% rename from spring-security-rest-custom/README.md rename to spring-security-modules/spring-security-rest-custom/README.md diff --git a/spring-security-rest-custom/pom.xml b/spring-security-modules/spring-security-rest-custom/pom.xml similarity index 96% rename from spring-security-rest-custom/pom.xml rename to spring-security-modules/spring-security-rest-custom/pom.xml index 4bab9b9d95..d9072ec8a2 100644 --- a/spring-security-rest-custom/pom.xml +++ b/spring-security-modules/spring-security-rest-custom/pom.xml @@ -1,17 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-security-rest-custom</artifactId> <version>0.1-SNAPSHOT</version> <name>spring-security-rest-custom</name> <packaging>war</packaging> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-boot-2</relativePath> + <relativePath>../../parent-boot-2</relativePath> </parent> <dependencies> diff --git a/spring-security-rest-custom/src/main/java/org/baeldung/config/MainWebAppInitializer.java b/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/config/MainWebAppInitializer.java similarity index 100% rename from spring-security-rest-custom/src/main/java/org/baeldung/config/MainWebAppInitializer.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/config/MainWebAppInitializer.java diff --git a/spring-security-rest-custom/src/main/java/org/baeldung/config/child/MethodSecurityConfig.java b/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/config/child/MethodSecurityConfig.java similarity index 100% rename from spring-security-rest-custom/src/main/java/org/baeldung/config/child/MethodSecurityConfig.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/config/child/MethodSecurityConfig.java diff --git a/spring-security-rest-custom/src/main/java/org/baeldung/config/child/WebConfig.java b/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/config/child/WebConfig.java similarity index 100% rename from spring-security-rest-custom/src/main/java/org/baeldung/config/child/WebConfig.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/config/child/WebConfig.java diff --git a/spring-security-rest-custom/src/main/java/org/baeldung/config/parent/SecurityConfig.java b/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/config/parent/SecurityConfig.java similarity index 100% rename from spring-security-rest-custom/src/main/java/org/baeldung/config/parent/SecurityConfig.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/config/parent/SecurityConfig.java diff --git a/spring-security-rest-custom/src/main/java/org/baeldung/config/parent/ServiceConfig.java b/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/config/parent/ServiceConfig.java similarity index 100% rename from spring-security-rest-custom/src/main/java/org/baeldung/config/parent/ServiceConfig.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/config/parent/ServiceConfig.java diff --git a/spring-security-rest-custom/src/main/java/org/baeldung/security/AuthenticationFacade.java b/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/security/AuthenticationFacade.java similarity index 100% rename from spring-security-rest-custom/src/main/java/org/baeldung/security/AuthenticationFacade.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/security/AuthenticationFacade.java diff --git a/spring-security-rest-custom/src/main/java/org/baeldung/security/CustomAuthenticationProvider.java b/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/security/CustomAuthenticationProvider.java similarity index 100% rename from spring-security-rest-custom/src/main/java/org/baeldung/security/CustomAuthenticationProvider.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/security/CustomAuthenticationProvider.java diff --git a/spring-security-rest-custom/src/main/java/org/baeldung/security/IAuthenticationFacade.java b/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/security/IAuthenticationFacade.java similarity index 100% rename from spring-security-rest-custom/src/main/java/org/baeldung/security/IAuthenticationFacade.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/security/IAuthenticationFacade.java diff --git a/spring-security-rest-custom/src/main/java/org/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java b/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java similarity index 100% rename from spring-security-rest-custom/src/main/java/org/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java diff --git a/spring-security-rest-custom/src/main/java/org/baeldung/security/RestAuthenticationEntryPoint.java b/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/security/RestAuthenticationEntryPoint.java similarity index 100% rename from spring-security-rest-custom/src/main/java/org/baeldung/security/RestAuthenticationEntryPoint.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/security/RestAuthenticationEntryPoint.java diff --git a/spring-security-rest-custom/src/main/java/org/baeldung/service/FooService.java b/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/service/FooService.java similarity index 100% rename from spring-security-rest-custom/src/main/java/org/baeldung/service/FooService.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/service/FooService.java diff --git a/spring-security-rest-custom/src/main/java/org/baeldung/service/IFooService.java b/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/service/IFooService.java similarity index 100% rename from spring-security-rest-custom/src/main/java/org/baeldung/service/IFooService.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/service/IFooService.java diff --git a/spring-security-rest-custom/src/main/java/org/baeldung/service/RunAsService.java b/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/service/RunAsService.java similarity index 100% rename from spring-security-rest-custom/src/main/java/org/baeldung/service/RunAsService.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/service/RunAsService.java diff --git a/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/FooController.java b/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/FooController.java similarity index 100% rename from spring-security-rest-custom/src/main/java/org/baeldung/web/controller/FooController.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/FooController.java diff --git a/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/GetUserWithCustomInterfaceController.java b/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/GetUserWithCustomInterfaceController.java similarity index 100% rename from spring-security-rest-custom/src/main/java/org/baeldung/web/controller/GetUserWithCustomInterfaceController.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/GetUserWithCustomInterfaceController.java diff --git a/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/GetUserWithHTTPServletRequestController.java b/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/GetUserWithHTTPServletRequestController.java similarity index 100% rename from spring-security-rest-custom/src/main/java/org/baeldung/web/controller/GetUserWithHTTPServletRequestController.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/GetUserWithHTTPServletRequestController.java diff --git a/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/RunAsController.java b/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/RunAsController.java similarity index 100% rename from spring-security-rest-custom/src/main/java/org/baeldung/web/controller/RunAsController.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/RunAsController.java diff --git a/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/SecurityController.java b/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/SecurityController.java similarity index 100% rename from spring-security-rest-custom/src/main/java/org/baeldung/web/controller/SecurityController.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/SecurityController.java diff --git a/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/SecurityController1.java b/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/SecurityController1.java similarity index 100% rename from spring-security-rest-custom/src/main/java/org/baeldung/web/controller/SecurityController1.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/SecurityController1.java diff --git a/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/SecurityController3.java b/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/SecurityController3.java similarity index 100% rename from spring-security-rest-custom/src/main/java/org/baeldung/web/controller/SecurityController3.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/SecurityController3.java diff --git a/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/ViewController.java b/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/ViewController.java similarity index 100% rename from spring-security-rest-custom/src/main/java/org/baeldung/web/controller/ViewController.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/ViewController.java diff --git a/spring-security-rest-custom/src/main/java/org/baeldung/web/dto/Foo.java b/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/dto/Foo.java similarity index 100% rename from spring-security-rest-custom/src/main/java/org/baeldung/web/dto/Foo.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/dto/Foo.java diff --git a/spring-security-rest-custom/src/main/resources/foo.properties b/spring-security-modules/spring-security-rest-custom/src/main/resources/foo.properties similarity index 100% rename from spring-security-rest-custom/src/main/resources/foo.properties rename to spring-security-modules/spring-security-rest-custom/src/main/resources/foo.properties diff --git a/spring-security-rest-custom/src/main/resources/logback.xml b/spring-security-modules/spring-security-rest-custom/src/main/resources/logback.xml similarity index 100% rename from spring-security-rest-custom/src/main/resources/logback.xml rename to spring-security-modules/spring-security-rest-custom/src/main/resources/logback.xml diff --git a/spring-security-rest-custom/src/main/resources/prop.xml b/spring-security-modules/spring-security-rest-custom/src/main/resources/prop.xml similarity index 100% rename from spring-security-rest-custom/src/main/resources/prop.xml rename to spring-security-modules/spring-security-rest-custom/src/main/resources/prop.xml diff --git a/spring-security-rest-custom/src/main/resources/webSecurityConfig.xml b/spring-security-modules/spring-security-rest-custom/src/main/resources/webSecurityConfig.xml similarity index 100% rename from spring-security-rest-custom/src/main/resources/webSecurityConfig.xml rename to spring-security-modules/spring-security-rest-custom/src/main/resources/webSecurityConfig.xml diff --git a/spring-security-rest-custom/src/main/webapp/WEB-INF/templates/index.html b/spring-security-modules/spring-security-rest-custom/src/main/webapp/WEB-INF/templates/index.html similarity index 100% rename from spring-security-rest-custom/src/main/webapp/WEB-INF/templates/index.html rename to spring-security-modules/spring-security-rest-custom/src/main/webapp/WEB-INF/templates/index.html diff --git a/spring-security-rest-custom/src/main/webapp/WEB-INF/templates/runas.html b/spring-security-modules/spring-security-rest-custom/src/main/webapp/WEB-INF/templates/runas.html similarity index 100% rename from spring-security-rest-custom/src/main/webapp/WEB-INF/templates/runas.html rename to spring-security-modules/spring-security-rest-custom/src/main/webapp/WEB-INF/templates/runas.html diff --git a/spring-security-rest-custom/src/main/webapp/WEB-INF/web_old.xml b/spring-security-modules/spring-security-rest-custom/src/main/webapp/WEB-INF/web_old.xml similarity index 100% rename from spring-security-rest-custom/src/main/webapp/WEB-INF/web_old.xml rename to spring-security-modules/spring-security-rest-custom/src/main/webapp/WEB-INF/web_old.xml diff --git a/spring-security-mvc/src/test/resources/.gitignore b/spring-security-modules/spring-security-rest-custom/src/test/resources/.gitignore similarity index 100% rename from spring-security-mvc/src/test/resources/.gitignore rename to spring-security-modules/spring-security-rest-custom/src/test/resources/.gitignore diff --git a/spring-security-rest-basic-auth/.gitignore b/spring-security-modules/spring-security-rest/.gitignore similarity index 100% rename from spring-security-rest-basic-auth/.gitignore rename to spring-security-modules/spring-security-rest/.gitignore diff --git a/spring-security-rest/README.md b/spring-security-modules/spring-security-rest/README.md similarity index 100% rename from spring-security-rest/README.md rename to spring-security-modules/spring-security-rest/README.md diff --git a/spring-security-rest/pom.xml b/spring-security-modules/spring-security-rest/pom.xml similarity index 97% rename from spring-security-rest/pom.xml rename to spring-security-modules/spring-security-rest/pom.xml index a66909a68e..9410f08378 100644 --- a/spring-security-rest/pom.xml +++ b/spring-security-modules/spring-security-rest/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <artifactId>spring-security-rest</artifactId> <version>0.1-SNAPSHOT</version> <name>spring-security-rest</name> @@ -11,7 +11,7 @@ <groupId>com.baeldung</groupId> <artifactId>parent-spring-5</artifactId> <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-spring-5</relativePath> + <relativePath>../../parent-spring-5</relativePath> </parent> <dependencies> @@ -282,4 +282,5 @@ <!-- Maven plugins --> <cargo-maven2-plugin.version>1.6.1</cargo-maven2-plugin.version> </properties> + </project> diff --git a/spring-security-rest/src/main/java/org/baeldung/errorhandling/ApiError.java b/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/errorhandling/ApiError.java similarity index 100% rename from spring-security-rest/src/main/java/org/baeldung/errorhandling/ApiError.java rename to spring-security-modules/spring-security-rest/src/main/java/org/baeldung/errorhandling/ApiError.java diff --git a/spring-security-rest/src/main/java/org/baeldung/errorhandling/CustomRestExceptionHandler.java b/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/errorhandling/CustomRestExceptionHandler.java similarity index 100% rename from spring-security-rest/src/main/java/org/baeldung/errorhandling/CustomRestExceptionHandler.java rename to spring-security-modules/spring-security-rest/src/main/java/org/baeldung/errorhandling/CustomRestExceptionHandler.java diff --git a/spring-security-rest/src/main/java/org/baeldung/persistence/model/Foo.java b/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/persistence/model/Foo.java similarity index 100% rename from spring-security-rest/src/main/java/org/baeldung/persistence/model/Foo.java rename to spring-security-modules/spring-security-rest/src/main/java/org/baeldung/persistence/model/Foo.java diff --git a/spring-security-rest/src/main/java/org/baeldung/security/SecurityJavaConfig.java b/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/security/SecurityJavaConfig.java similarity index 100% rename from spring-security-rest/src/main/java/org/baeldung/security/SecurityJavaConfig.java rename to spring-security-modules/spring-security-rest/src/main/java/org/baeldung/security/SecurityJavaConfig.java diff --git a/spring-security-rest/src/main/java/org/baeldung/security/web/MySavedRequestAwareAuthenticationSuccessHandler.java b/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/security/web/MySavedRequestAwareAuthenticationSuccessHandler.java similarity index 100% rename from spring-security-rest/src/main/java/org/baeldung/security/web/MySavedRequestAwareAuthenticationSuccessHandler.java rename to spring-security-modules/spring-security-rest/src/main/java/org/baeldung/security/web/MySavedRequestAwareAuthenticationSuccessHandler.java diff --git a/spring-security-rest/src/main/java/org/baeldung/security/web/RestAuthenticationEntryPoint.java b/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/security/web/RestAuthenticationEntryPoint.java similarity index 100% rename from spring-security-rest/src/main/java/org/baeldung/security/web/RestAuthenticationEntryPoint.java rename to spring-security-modules/spring-security-rest/src/main/java/org/baeldung/security/web/RestAuthenticationEntryPoint.java diff --git a/spring-security-rest/src/main/java/org/baeldung/spring/ClientWebConfig.java b/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/spring/ClientWebConfig.java similarity index 100% rename from spring-security-rest/src/main/java/org/baeldung/spring/ClientWebConfig.java rename to spring-security-modules/spring-security-rest/src/main/java/org/baeldung/spring/ClientWebConfig.java diff --git a/spring-security-rest/src/main/java/org/baeldung/spring/SecurityXmlConfig.java b/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/spring/SecurityXmlConfig.java similarity index 100% rename from spring-security-rest/src/main/java/org/baeldung/spring/SecurityXmlConfig.java rename to spring-security-modules/spring-security-rest/src/main/java/org/baeldung/spring/SecurityXmlConfig.java diff --git a/spring-security-rest/src/main/java/org/baeldung/spring/WebConfig.java b/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/spring/WebConfig.java similarity index 100% rename from spring-security-rest/src/main/java/org/baeldung/spring/WebConfig.java rename to spring-security-modules/spring-security-rest/src/main/java/org/baeldung/spring/WebConfig.java diff --git a/spring-security-rest/src/main/java/org/baeldung/swagger2/SwaggerConfig.java b/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/swagger2/SwaggerConfig.java similarity index 100% rename from spring-security-rest/src/main/java/org/baeldung/swagger2/SwaggerConfig.java rename to spring-security-modules/spring-security-rest/src/main/java/org/baeldung/swagger2/SwaggerConfig.java diff --git a/spring-security-rest/src/main/java/org/baeldung/web/controller/AsyncController.java b/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/controller/AsyncController.java similarity index 100% rename from spring-security-rest/src/main/java/org/baeldung/web/controller/AsyncController.java rename to spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/controller/AsyncController.java diff --git a/spring-security-rest/src/main/java/org/baeldung/web/controller/CustomController.java b/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/controller/CustomController.java similarity index 100% rename from spring-security-rest/src/main/java/org/baeldung/web/controller/CustomController.java rename to spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/controller/CustomController.java diff --git a/spring-security-rest/src/main/java/org/baeldung/web/controller/FooController.java b/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/controller/FooController.java similarity index 100% rename from spring-security-rest/src/main/java/org/baeldung/web/controller/FooController.java rename to spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/controller/FooController.java diff --git a/spring-security-rest/src/main/java/org/baeldung/web/controller/RootController.java b/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/controller/RootController.java similarity index 100% rename from spring-security-rest/src/main/java/org/baeldung/web/controller/RootController.java rename to spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/controller/RootController.java diff --git a/spring-security-rest/src/main/java/org/baeldung/web/error/CustomAccessDeniedHandler.java b/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/error/CustomAccessDeniedHandler.java similarity index 100% rename from spring-security-rest/src/main/java/org/baeldung/web/error/CustomAccessDeniedHandler.java rename to spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/error/CustomAccessDeniedHandler.java diff --git a/spring-security-rest/src/main/java/org/baeldung/web/error/RestResponseEntityExceptionHandler.java b/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/error/RestResponseEntityExceptionHandler.java similarity index 100% rename from spring-security-rest/src/main/java/org/baeldung/web/error/RestResponseEntityExceptionHandler.java rename to spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/error/RestResponseEntityExceptionHandler.java diff --git a/spring-security-rest/src/main/java/org/baeldung/web/exception/MyResourceNotFoundException.java b/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/exception/MyResourceNotFoundException.java similarity index 100% rename from spring-security-rest/src/main/java/org/baeldung/web/exception/MyResourceNotFoundException.java rename to spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/exception/MyResourceNotFoundException.java diff --git a/spring-security-rest/src/main/java/org/baeldung/web/service/AsyncService.java b/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/service/AsyncService.java similarity index 100% rename from spring-security-rest/src/main/java/org/baeldung/web/service/AsyncService.java rename to spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/service/AsyncService.java diff --git a/spring-security-rest/src/main/java/org/baeldung/web/service/AsyncServiceImpl.java b/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/service/AsyncServiceImpl.java similarity index 100% rename from spring-security-rest/src/main/java/org/baeldung/web/service/AsyncServiceImpl.java rename to spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/service/AsyncServiceImpl.java diff --git a/spring-security-rest/src/main/resources/logback.xml b/spring-security-modules/spring-security-rest/src/main/resources/logback.xml similarity index 100% rename from spring-security-rest/src/main/resources/logback.xml rename to spring-security-modules/spring-security-rest/src/main/resources/logback.xml diff --git a/spring-security-rest/src/main/resources/webSecurityConfig.xml b/spring-security-modules/spring-security-rest/src/main/resources/webSecurityConfig.xml similarity index 100% rename from spring-security-rest/src/main/resources/webSecurityConfig.xml rename to spring-security-modules/spring-security-rest/src/main/resources/webSecurityConfig.xml diff --git a/spring-security-rest/src/main/webapp/WEB-INF/api-servlet.xml b/spring-security-modules/spring-security-rest/src/main/webapp/WEB-INF/api-servlet.xml similarity index 100% rename from spring-security-rest/src/main/webapp/WEB-INF/api-servlet.xml rename to spring-security-modules/spring-security-rest/src/main/webapp/WEB-INF/api-servlet.xml diff --git a/spring-security-rest/src/main/webapp/WEB-INF/view/csrfAttacker.jsp b/spring-security-modules/spring-security-rest/src/main/webapp/WEB-INF/view/csrfAttacker.jsp similarity index 100% rename from spring-security-rest/src/main/webapp/WEB-INF/view/csrfAttacker.jsp rename to spring-security-modules/spring-security-rest/src/main/webapp/WEB-INF/view/csrfAttacker.jsp diff --git a/spring-security-rest/src/main/webapp/WEB-INF/web.xml b/spring-security-modules/spring-security-rest/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from spring-security-rest/src/main/webapp/WEB-INF/web.xml rename to spring-security-modules/spring-security-rest/src/main/webapp/WEB-INF/web.xml diff --git a/spring-security-rest/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-rest/src/test/java/org/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-rest/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-rest/src/test/java/org/baeldung/SpringContextTest.java diff --git a/spring-security-rest/src/test/java/org/baeldung/errorhandling/FooLiveTest.java b/spring-security-modules/spring-security-rest/src/test/java/org/baeldung/errorhandling/FooLiveTest.java similarity index 100% rename from spring-security-rest/src/test/java/org/baeldung/errorhandling/FooLiveTest.java rename to spring-security-modules/spring-security-rest/src/test/java/org/baeldung/errorhandling/FooLiveTest.java diff --git a/spring-security-rest/src/test/java/org/baeldung/web/AsyncControllerIntegrationTest.java b/spring-security-modules/spring-security-rest/src/test/java/org/baeldung/web/AsyncControllerIntegrationTest.java similarity index 100% rename from spring-security-rest/src/test/java/org/baeldung/web/AsyncControllerIntegrationTest.java rename to spring-security-modules/spring-security-rest/src/test/java/org/baeldung/web/AsyncControllerIntegrationTest.java diff --git a/spring-security-rest/src/test/java/org/baeldung/web/SwaggerLiveTest.java b/spring-security-modules/spring-security-rest/src/test/java/org/baeldung/web/SwaggerLiveTest.java similarity index 100% rename from spring-security-rest/src/test/java/org/baeldung/web/SwaggerLiveTest.java rename to spring-security-modules/spring-security-rest/src/test/java/org/baeldung/web/SwaggerLiveTest.java diff --git a/spring-security-rest/src/test/java/org/baeldung/web/TestConfig.java b/spring-security-modules/spring-security-rest/src/test/java/org/baeldung/web/TestConfig.java similarity index 100% rename from spring-security-rest/src/test/java/org/baeldung/web/TestConfig.java rename to spring-security-modules/spring-security-rest/src/test/java/org/baeldung/web/TestConfig.java diff --git a/spring-security-rest-basic-auth/src/test/resources/.gitignore b/spring-security-modules/spring-security-rest/src/test/resources/.gitignore similarity index 100% rename from spring-security-rest-basic-auth/src/test/resources/.gitignore rename to spring-security-modules/spring-security-rest/src/test/resources/.gitignore diff --git a/spring-security-sso/README.md b/spring-security-modules/spring-security-sso/README.md similarity index 100% rename from spring-security-sso/README.md rename to spring-security-modules/spring-security-sso/README.md diff --git a/spring-security-sso/pom.xml b/spring-security-modules/spring-security-sso/pom.xml similarity index 87% rename from spring-security-sso/pom.xml rename to spring-security-modules/spring-security-sso/pom.xml index ed8ad87a62..3d9c1bf595 100644 --- a/spring-security-sso/pom.xml +++ b/spring-security-modules/spring-security-sso/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -8,10 +9,10 @@ <packaging>pom</packaging> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-boot-2</relativePath> + <relativePath>../../parent-boot-2</relativePath> </parent> <modules> @@ -23,10 +24,10 @@ <properties> <rest-assured.version>3.1.0</rest-assured.version> - <oauth.version>2.3.3.RELEASE</oauth.version> + <oauth.version>2.3.3.RELEASE</oauth.version> <oauth-auto.version>2.1.1.RELEASE</oauth-auto.version> <spring-security-kerberos.version>1.0.1.RELEASE</spring-security-kerberos.version> <apacheds-jdbm1.version>2.0.0-M2</apacheds-jdbm1.version> - </properties> - + </properties> + </project> diff --git a/spring-security-sso/spring-security-sso-auth-server/pom.xml b/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/pom.xml similarity index 85% rename from spring-security-sso/spring-security-sso-auth-server/pom.xml rename to spring-security-modules/spring-security-sso/spring-security-sso-auth-server/pom.xml index 3c8f04a056..933cb6a2b2 100644 --- a/spring-security-sso/spring-security-sso-auth-server/pom.xml +++ b/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-security-sso-auth-server</artifactId> <name>spring-security-sso-auth-server</name> diff --git a/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/AuthServerConfig.java b/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/AuthServerConfig.java similarity index 100% rename from spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/AuthServerConfig.java rename to spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/AuthServerConfig.java diff --git a/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/AuthorizationServerApplication.java b/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/AuthorizationServerApplication.java similarity index 100% rename from spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/AuthorizationServerApplication.java rename to spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/AuthorizationServerApplication.java diff --git a/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/SecurityConfig.java b/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/SecurityConfig.java similarity index 100% rename from spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/SecurityConfig.java rename to spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/SecurityConfig.java diff --git a/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/UserController.java b/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/UserController.java similarity index 100% rename from spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/UserController.java rename to spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/UserController.java diff --git a/spring-security-sso/spring-security-sso-auth-server/src/main/resources/application.properties b/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/resources/application.properties similarity index 100% rename from spring-security-sso/spring-security-sso-auth-server/src/main/resources/application.properties rename to spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/resources/application.properties diff --git a/spring-security-stormpath/src/main/resources/logback.xml b/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/resources/logback.xml similarity index 100% rename from spring-security-stormpath/src/main/resources/logback.xml rename to spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/resources/logback.xml diff --git a/spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/SpringContextTest.java diff --git a/spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/UserInfoEndpointLiveTest.java b/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/UserInfoEndpointLiveTest.java similarity index 100% rename from spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/UserInfoEndpointLiveTest.java rename to spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/UserInfoEndpointLiveTest.java diff --git a/spring-security-sso/spring-security-sso-kerberos/.gitignore b/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/.gitignore similarity index 100% rename from spring-security-sso/spring-security-sso-kerberos/.gitignore rename to spring-security-modules/spring-security-sso/spring-security-sso-kerberos/.gitignore diff --git a/spring-security-sso/spring-security-sso-kerberos/README.md b/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/README.md similarity index 100% rename from spring-security-sso/spring-security-sso-kerberos/README.md rename to spring-security-modules/spring-security-sso/spring-security-sso-kerberos/README.md diff --git a/spring-security-sso/spring-security-sso-kerberos/pom.xml b/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/pom.xml similarity index 99% rename from spring-security-sso/spring-security-sso-kerberos/pom.xml rename to spring-security-modules/spring-security-sso/spring-security-sso-kerberos/pom.xml index 5fb435a9b9..88b9354538 100644 --- a/spring-security-sso/spring-security-sso-kerberos/pom.xml +++ b/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/pom.xml @@ -91,4 +91,5 @@ <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> </dependencies> + </project> \ No newline at end of file diff --git a/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/KerberosClientApp.java b/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/KerberosClientApp.java similarity index 100% rename from spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/KerberosClientApp.java rename to spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/KerberosClientApp.java diff --git a/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/SampleClient.java b/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/SampleClient.java similarity index 100% rename from spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/SampleClient.java rename to spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/SampleClient.java diff --git a/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/config/AppConfig.java b/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/config/AppConfig.java similarity index 100% rename from spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/config/AppConfig.java rename to spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/config/AppConfig.java diff --git a/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/config/KerberosConfig.java b/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/config/KerberosConfig.java similarity index 100% rename from spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/config/KerberosConfig.java rename to spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/config/KerberosConfig.java diff --git a/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/kdc/KerberosMiniKdc.java b/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/kdc/KerberosMiniKdc.java similarity index 100% rename from spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/kdc/KerberosMiniKdc.java rename to spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/kdc/KerberosMiniKdc.java diff --git a/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/kdc/MiniKdcConfigBuilder.java b/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/kdc/MiniKdcConfigBuilder.java similarity index 100% rename from spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/kdc/MiniKdcConfigBuilder.java rename to spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/kdc/MiniKdcConfigBuilder.java diff --git a/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/KerberizedServerApp.java b/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/KerberizedServerApp.java similarity index 100% rename from spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/KerberizedServerApp.java rename to spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/KerberizedServerApp.java diff --git a/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/config/MvcConfig.java b/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/config/MvcConfig.java similarity index 100% rename from spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/config/MvcConfig.java rename to spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/config/MvcConfig.java diff --git a/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/config/WebSecurityConfig.java b/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/config/WebSecurityConfig.java similarity index 100% rename from spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/config/WebSecurityConfig.java rename to spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/config/WebSecurityConfig.java diff --git a/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/controller/SampleController.java b/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/controller/SampleController.java similarity index 100% rename from spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/controller/SampleController.java rename to spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/controller/SampleController.java diff --git a/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/service/DummyUserDetailsService.java b/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/service/DummyUserDetailsService.java similarity index 100% rename from spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/service/DummyUserDetailsService.java rename to spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/service/DummyUserDetailsService.java diff --git a/spring-security-sso/spring-security-sso-kerberos/src/main/resources/application.properties b/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/resources/application.properties similarity index 100% rename from spring-security-sso/spring-security-sso-kerberos/src/main/resources/application.properties rename to spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/resources/application.properties diff --git a/spring-security-sso/spring-security-sso-kerberos/src/main/resources/minikdc-krb5.conf b/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/resources/minikdc-krb5.conf similarity index 100% rename from spring-security-sso/spring-security-sso-kerberos/src/main/resources/minikdc-krb5.conf rename to spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/resources/minikdc-krb5.conf diff --git a/spring-security-sso/spring-security-sso-kerberos/src/main/resources/minikdc.ldiff b/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/resources/minikdc.ldiff similarity index 100% rename from spring-security-sso/spring-security-sso-kerberos/src/main/resources/minikdc.ldiff rename to spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/resources/minikdc.ldiff diff --git a/spring-security-sso/spring-security-sso-kerberos/src/main/resources/templates/hello.html b/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/resources/templates/hello.html similarity index 100% rename from spring-security-sso/spring-security-sso-kerberos/src/main/resources/templates/hello.html rename to spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/resources/templates/hello.html diff --git a/spring-security-sso/spring-security-sso-kerberos/src/main/resources/templates/home.html b/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/resources/templates/home.html similarity index 100% rename from spring-security-sso/spring-security-sso-kerberos/src/main/resources/templates/home.html rename to spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/resources/templates/home.html diff --git a/spring-security-sso/spring-security-sso-kerberos/src/main/resources/templates/login.html b/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/resources/templates/login.html similarity index 100% rename from spring-security-sso/spring-security-sso-kerberos/src/main/resources/templates/login.html rename to spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/resources/templates/login.html diff --git a/spring-security-sso/spring-security-sso-kerberos/src/test/java/kerberos/client/SampleClientManualTest.java b/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/test/java/kerberos/client/SampleClientManualTest.java similarity index 100% rename from spring-security-sso/spring-security-sso-kerberos/src/test/java/kerberos/client/SampleClientManualTest.java rename to spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/test/java/kerberos/client/SampleClientManualTest.java diff --git a/spring-security-sso/spring-security-sso-ui-2/pom.xml b/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/pom.xml similarity index 90% rename from spring-security-sso/spring-security-sso-ui-2/pom.xml rename to spring-security-modules/spring-security-sso/spring-security-sso-ui-2/pom.xml index a6cf5e5386..10592a5e92 100644 --- a/spring-security-sso/spring-security-sso-ui-2/pom.xml +++ b/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-security-sso-ui-2</artifactId> <name>spring-security-sso-ui-2</name> diff --git a/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiApplication.java b/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiApplication.java similarity index 100% rename from spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiApplication.java rename to spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiApplication.java diff --git a/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiSecurityConfig.java b/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiSecurityConfig.java similarity index 100% rename from spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiSecurityConfig.java rename to spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiSecurityConfig.java diff --git a/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiWebConfig.java b/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiWebConfig.java similarity index 100% rename from spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiWebConfig.java rename to spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiWebConfig.java diff --git a/spring-security-sso/spring-security-sso-ui-2/src/main/resources/application.yml b/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/resources/application.yml similarity index 100% rename from spring-security-sso/spring-security-sso-ui-2/src/main/resources/application.yml rename to spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/resources/application.yml diff --git a/spring-security-thymeleaf/src/main/resources/logback.xml b/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/resources/logback.xml similarity index 100% rename from spring-security-thymeleaf/src/main/resources/logback.xml rename to spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/resources/logback.xml diff --git a/spring-security-sso/spring-security-sso-ui-2/src/main/resources/templates/index.html b/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/resources/templates/index.html similarity index 100% rename from spring-security-sso/spring-security-sso-ui-2/src/main/resources/templates/index.html rename to spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/resources/templates/index.html diff --git a/spring-security-sso/spring-security-sso-ui-2/src/main/resources/templates/securedPage.html b/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/resources/templates/securedPage.html similarity index 100% rename from spring-security-sso/spring-security-sso-ui-2/src/main/resources/templates/securedPage.html rename to spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/resources/templates/securedPage.html diff --git a/spring-security-sso/spring-security-sso-ui-2/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/test/java/org/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-sso/spring-security-sso-ui-2/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/test/java/org/baeldung/SpringContextTest.java diff --git a/spring-security-sso/spring-security-sso-ui/pom.xml b/spring-security-modules/spring-security-sso/spring-security-sso-ui/pom.xml similarity index 90% rename from spring-security-sso/spring-security-sso-ui/pom.xml rename to spring-security-modules/spring-security-sso/spring-security-sso-ui/pom.xml index 7edcee82c8..2f0ac3a42e 100644 --- a/spring-security-sso/spring-security-sso-ui/pom.xml +++ b/spring-security-modules/spring-security-sso/spring-security-sso-ui/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-security-sso-ui</artifactId> <name>spring-security-sso-ui</name> @@ -22,13 +23,13 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> - + <dependency> <groupId>org.springframework.security.oauth.boot</groupId> <artifactId>spring-security-oauth2-autoconfigure</artifactId> <version>${oauth-auto.version}</version> </dependency> - + <dependency> <groupId>org.springframework.boot</groupId> diff --git a/spring-security-sso/spring-security-sso-ui/src/main/java/org/baeldung/config/UiApplication.java b/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/org/baeldung/config/UiApplication.java similarity index 100% rename from spring-security-sso/spring-security-sso-ui/src/main/java/org/baeldung/config/UiApplication.java rename to spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/org/baeldung/config/UiApplication.java diff --git a/spring-security-sso/spring-security-sso-ui/src/main/java/org/baeldung/config/UiSecurityConfig.java b/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/org/baeldung/config/UiSecurityConfig.java similarity index 100% rename from spring-security-sso/spring-security-sso-ui/src/main/java/org/baeldung/config/UiSecurityConfig.java rename to spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/org/baeldung/config/UiSecurityConfig.java diff --git a/spring-security-sso/spring-security-sso-ui/src/main/java/org/baeldung/config/UiWebConfig.java b/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/org/baeldung/config/UiWebConfig.java similarity index 100% rename from spring-security-sso/spring-security-sso-ui/src/main/java/org/baeldung/config/UiWebConfig.java rename to spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/org/baeldung/config/UiWebConfig.java diff --git a/spring-security-sso/spring-security-sso-ui/src/main/resources/application.yml b/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/resources/application.yml similarity index 100% rename from spring-security-sso/spring-security-sso-ui/src/main/resources/application.yml rename to spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/resources/application.yml diff --git a/spring-security-x509/spring-security-x509-basic-auth/src/main/resources/logback.xml b/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/resources/logback.xml similarity index 100% rename from spring-security-x509/spring-security-x509-basic-auth/src/main/resources/logback.xml rename to spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/resources/logback.xml diff --git a/spring-security-sso/spring-security-sso-ui/src/main/resources/templates/index.html b/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/resources/templates/index.html similarity index 100% rename from spring-security-sso/spring-security-sso-ui/src/main/resources/templates/index.html rename to spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/resources/templates/index.html diff --git a/spring-security-sso/spring-security-sso-ui/src/main/resources/templates/securedPage.html b/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/resources/templates/securedPage.html similarity index 100% rename from spring-security-sso/spring-security-sso-ui/src/main/resources/templates/securedPage.html rename to spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/resources/templates/securedPage.html diff --git a/spring-security-sso/spring-security-sso-ui/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/test/java/org/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-sso/spring-security-sso-ui/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-sso/spring-security-sso-ui/src/test/java/org/baeldung/SpringContextTest.java diff --git a/spring-security-stormpath/README.md b/spring-security-modules/spring-security-stormpath/README.md similarity index 100% rename from spring-security-stormpath/README.md rename to spring-security-modules/spring-security-stormpath/README.md diff --git a/spring-security-stormpath/pom.xml b/spring-security-modules/spring-security-stormpath/pom.xml similarity index 91% rename from spring-security-stormpath/pom.xml rename to spring-security-modules/spring-security-stormpath/pom.xml index 6db4b38d80..81a7c40aef 100644 --- a/spring-security-stormpath/pom.xml +++ b/spring-security-modules/spring-security-stormpath/pom.xml @@ -1,13 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-security-stormpath</artifactId> <version>1.0-SNAPSHOT</version> <name>spring-security-stormpath</name> <packaging>war</packaging> <url>http://maven.apache.org</url> - + <developers> <developer> <email>abhinabkanrar@gmail.com</email> @@ -18,10 +18,10 @@ </developers> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-boot-1</relativePath> + <relativePath>../../parent-boot-1</relativePath> </parent> <dependencies> @@ -60,7 +60,7 @@ </plugin> </plugins> </build> - + <properties> <stormpath-spring.version>1.5.4</stormpath-spring.version> </properties> diff --git a/spring-security-stormpath/src/main/java/com/baeldung/Application.java b/spring-security-modules/spring-security-stormpath/src/main/java/com/baeldung/Application.java similarity index 100% rename from spring-security-stormpath/src/main/java/com/baeldung/Application.java rename to spring-security-modules/spring-security-stormpath/src/main/java/com/baeldung/Application.java diff --git a/spring-security-stormpath/src/main/java/com/baeldung/security/SecurityConfiguration.java b/spring-security-modules/spring-security-stormpath/src/main/java/com/baeldung/security/SecurityConfiguration.java similarity index 100% rename from spring-security-stormpath/src/main/java/com/baeldung/security/SecurityConfiguration.java rename to spring-security-modules/spring-security-stormpath/src/main/java/com/baeldung/security/SecurityConfiguration.java diff --git a/spring-security-stormpath/src/main/resources/application.properties b/spring-security-modules/spring-security-stormpath/src/main/resources/application.properties similarity index 100% rename from spring-security-stormpath/src/main/resources/application.properties rename to spring-security-modules/spring-security-stormpath/src/main/resources/application.properties diff --git a/spring-security-x509/spring-security-x509-client-auth/src/main/resources/logback.xml b/spring-security-modules/spring-security-stormpath/src/main/resources/logback.xml similarity index 100% rename from spring-security-x509/spring-security-x509-client-auth/src/main/resources/logback.xml rename to spring-security-modules/spring-security-stormpath/src/main/resources/logback.xml diff --git a/spring-security-thymeleaf/README.MD b/spring-security-modules/spring-security-thymeleaf/README.MD similarity index 100% rename from spring-security-thymeleaf/README.MD rename to spring-security-modules/spring-security-thymeleaf/README.MD diff --git a/spring-security-thymeleaf/pom.xml b/spring-security-modules/spring-security-thymeleaf/pom.xml similarity index 90% rename from spring-security-thymeleaf/pom.xml rename to spring-security-modules/spring-security-thymeleaf/pom.xml index 732eb1dc1d..a4ecbaff21 100644 --- a/spring-security-thymeleaf/pom.xml +++ b/spring-security-modules/spring-security-thymeleaf/pom.xml @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-security-thymeleaf</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-security-thymeleaf</name> @@ -10,10 +9,10 @@ <description>Spring Security with Thymeleaf tutorial</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-boot-2</relativePath> + <relativePath>../../parent-boot-2</relativePath> </parent> <dependencies> diff --git a/spring-security-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/SecurityConfiguration.java b/spring-security-modules/spring-security-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/SecurityConfiguration.java similarity index 97% rename from spring-security-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/SecurityConfiguration.java rename to spring-security-modules/spring-security-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/SecurityConfiguration.java index 0a4344db4d..f7f8cfb708 100644 --- a/spring-security-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/SecurityConfiguration.java +++ b/spring-security-modules/spring-security-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/SecurityConfiguration.java @@ -1,50 +1,50 @@ -package com.baeldung.springsecuritythymeleaf; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; -import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; -import org.springframework.security.web.util.matcher.AntPathRequestMatcher; - -@Configuration -@EnableWebSecurity -public class SecurityConfiguration extends WebSecurityConfigurerAdapter { - - @Override - protected void configure(HttpSecurity http) throws Exception { - http.authorizeRequests() - .anyRequest() - .authenticated() - .and() - .formLogin() - .loginPage("/login") - .permitAll() - .successForwardUrl("/index") - .and() - .logout() - .permitAll() - .logoutRequestMatcher(new AntPathRequestMatcher("/logout")) - .logoutSuccessUrl("/login"); - } - - @Autowired - public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { - auth.inMemoryAuthentication() - .withUser("user") - .password(passwordEncoder().encode("password")) - .roles("USER") - .and() - .withUser("admin") - .password(passwordEncoder().encode("admin")) - .roles("ADMIN"); - } - - @Bean - public BCryptPasswordEncoder passwordEncoder() { - return new BCryptPasswordEncoder(); - } -} +package com.baeldung.springsecuritythymeleaf; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.web.util.matcher.AntPathRequestMatcher; + +@Configuration +@EnableWebSecurity +public class SecurityConfiguration extends WebSecurityConfigurerAdapter { + + @Override + protected void configure(HttpSecurity http) throws Exception { + http.authorizeRequests() + .anyRequest() + .authenticated() + .and() + .formLogin() + .loginPage("/login") + .permitAll() + .successForwardUrl("/index") + .and() + .logout() + .permitAll() + .logoutRequestMatcher(new AntPathRequestMatcher("/logout")) + .logoutSuccessUrl("/login"); + } + + @Autowired + public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { + auth.inMemoryAuthentication() + .withUser("user") + .password(passwordEncoder().encode("password")) + .roles("USER") + .and() + .withUser("admin") + .password(passwordEncoder().encode("admin")) + .roles("ADMIN"); + } + + @Bean + public BCryptPasswordEncoder passwordEncoder() { + return new BCryptPasswordEncoder(); + } +} diff --git a/spring-security-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/SpringSecurityThymeleafApplication.java b/spring-security-modules/spring-security-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/SpringSecurityThymeleafApplication.java similarity index 100% rename from spring-security-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/SpringSecurityThymeleafApplication.java rename to spring-security-modules/spring-security-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/SpringSecurityThymeleafApplication.java diff --git a/spring-security-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/ViewController.java b/spring-security-modules/spring-security-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/ViewController.java similarity index 95% rename from spring-security-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/ViewController.java rename to spring-security-modules/spring-security-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/ViewController.java index a2337f9db5..bb8f04d965 100644 --- a/spring-security-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/ViewController.java +++ b/spring-security-modules/spring-security-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/ViewController.java @@ -1,18 +1,18 @@ -package com.baeldung.springsecuritythymeleaf; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; - -@Controller -public class ViewController { - - @RequestMapping("/login") - public String login() { - return "login"; - } - - @RequestMapping({ "/index", "/" }) - public String index() { - return "index"; - } -} +package com.baeldung.springsecuritythymeleaf; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +public class ViewController { + + @RequestMapping("/login") + public String login() { + return "login"; + } + + @RequestMapping({ "/index", "/" }) + public String index() { + return "index"; + } +} diff --git a/spring-security-modules/spring-security-thymeleaf/src/main/resources/application.properties b/spring-security-modules/spring-security-thymeleaf/src/main/resources/application.properties new file mode 100644 index 0000000000..e69de29bb2 diff --git a/spring-zuul/spring-zuul-foos-resource/src/main/resources/logback.xml b/spring-security-modules/spring-security-thymeleaf/src/main/resources/logback.xml similarity index 100% rename from spring-zuul/spring-zuul-foos-resource/src/main/resources/logback.xml rename to spring-security-modules/spring-security-thymeleaf/src/main/resources/logback.xml diff --git a/spring-security-thymeleaf/src/main/resources/templates/index.html b/spring-security-modules/spring-security-thymeleaf/src/main/resources/templates/index.html similarity index 96% rename from spring-security-thymeleaf/src/main/resources/templates/index.html rename to spring-security-modules/spring-security-thymeleaf/src/main/resources/templates/index.html index 27426ec496..a419655d9e 100644 --- a/spring-security-thymeleaf/src/main/resources/templates/index.html +++ b/spring-security-modules/spring-security-thymeleaf/src/main/resources/templates/index.html @@ -1,18 +1,18 @@ -<!DOCTYPE html> -<html xmlns:th="http://www.thymeleaf.org"> -<head> -<title>Welcome to Spring Security Thymeleaf tutorial</title> -</head> -<body> - <h2>Welcome</h2> - <p>Spring Security Thymeleaf tutorial</p> - <div sec:authorize="hasRole('USER')">Text visible to user.</div> - <div sec:authorize="hasRole('ADMIN')">Text visible to admin.</div> - <div sec:authorize="isAuthenticated()">Text visible only to - authenticated users.</div> - Authenticated username: - <div sec:authentication="name"></div> - Authenticated user roles: - <div sec:authentication="principal.authorities"></div> -</body> +<!DOCTYPE html> +<html xmlns:th="http://www.thymeleaf.org"> +<head> +<title>Welcome to Spring Security Thymeleaf tutorial</title> +</head> +<body> + <h2>Welcome</h2> + <p>Spring Security Thymeleaf tutorial</p> + <div sec:authorize="hasRole('USER')">Text visible to user.</div> + <div sec:authorize="hasRole('ADMIN')">Text visible to admin.</div> + <div sec:authorize="isAuthenticated()">Text visible only to + authenticated users.</div> + Authenticated username: + <div sec:authentication="name"></div> + Authenticated user roles: + <div sec:authentication="principal.authorities"></div> +</body> </html> \ No newline at end of file diff --git a/spring-security-thymeleaf/src/main/resources/templates/login.html b/spring-security-modules/spring-security-thymeleaf/src/main/resources/templates/login.html similarity index 95% rename from spring-security-thymeleaf/src/main/resources/templates/login.html rename to spring-security-modules/spring-security-thymeleaf/src/main/resources/templates/login.html index 0177f7d8e8..f4a32e0911 100644 --- a/spring-security-thymeleaf/src/main/resources/templates/login.html +++ b/spring-security-modules/spring-security-thymeleaf/src/main/resources/templates/login.html @@ -1,15 +1,15 @@ -<!DOCTYPE html> -<html xmlns:th="http://www.thymeleaf.org"> -<head> -<title>Custom Login Page</title> -</head> -<body> - <h2>Custom Login Page</h2> - <form th:action="@{/login}" method="post"> - <label for="username">Username</label>: <input type="text" - id="username" name="username" autofocus="autofocus" /> <label - for="password">Password</label>: <input type="password" id="password" - name="password" /><input type="submit" value="Log in" /> - </form> -</body> +<!DOCTYPE html> +<html xmlns:th="http://www.thymeleaf.org"> +<head> +<title>Custom Login Page</title> +</head> +<body> + <h2>Custom Login Page</h2> + <form th:action="@{/login}" method="post"> + <label for="username">Username</label>: <input type="text" + id="username" name="username" autofocus="autofocus" /> <label + for="password">Password</label>: <input type="password" id="password" + name="password" /><input type="submit" value="Log in" /> + </form> +</body> </html> \ No newline at end of file diff --git a/spring-security-thymeleaf/src/test/java/com/baeldung/springsecuritythymeleaf/SpringSecurityThymeleafApplicationIntegrationTest.java b/spring-security-modules/spring-security-thymeleaf/src/test/java/com/baeldung/springsecuritythymeleaf/SpringSecurityThymeleafApplicationIntegrationTest.java similarity index 100% rename from spring-security-thymeleaf/src/test/java/com/baeldung/springsecuritythymeleaf/SpringSecurityThymeleafApplicationIntegrationTest.java rename to spring-security-modules/spring-security-thymeleaf/src/test/java/com/baeldung/springsecuritythymeleaf/SpringSecurityThymeleafApplicationIntegrationTest.java diff --git a/spring-security-thymeleaf/src/test/java/com/baeldung/springsecuritythymeleaf/ViewControllerIntegrationTest.java b/spring-security-modules/spring-security-thymeleaf/src/test/java/com/baeldung/springsecuritythymeleaf/ViewControllerIntegrationTest.java similarity index 97% rename from spring-security-thymeleaf/src/test/java/com/baeldung/springsecuritythymeleaf/ViewControllerIntegrationTest.java rename to spring-security-modules/spring-security-thymeleaf/src/test/java/com/baeldung/springsecuritythymeleaf/ViewControllerIntegrationTest.java index d2e7354d2d..c87d1bacc3 100644 --- a/spring-security-thymeleaf/src/test/java/com/baeldung/springsecuritythymeleaf/ViewControllerIntegrationTest.java +++ b/spring-security-modules/spring-security-thymeleaf/src/test/java/com/baeldung/springsecuritythymeleaf/ViewControllerIntegrationTest.java @@ -1,27 +1,27 @@ -package com.baeldung.springsecuritythymeleaf; - -import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.user; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; - -@RunWith(SpringRunner.class) -@WebMvcTest -public class ViewControllerIntegrationTest { - - @Autowired - MockMvc mockMvc; - - @Test - public void givenUser_whenPerformingGet_thenReturnsIndex() throws Exception { - mockMvc.perform(get("/index").with(user("user").password("password"))).andExpect(status().isOk()).andExpect(view().name("index")); - } - -} +package com.baeldung.springsecuritythymeleaf; + +import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.user; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; + +@RunWith(SpringRunner.class) +@WebMvcTest +public class ViewControllerIntegrationTest { + + @Autowired + MockMvc mockMvc; + + @Test + public void givenUser_whenPerformingGet_thenReturnsIndex() throws Exception { + mockMvc.perform(get("/index").with(user("user").password("password"))).andExpect(status().isOk()).andExpect(view().name("index")); + } + +} diff --git a/spring-security-x509/README.md b/spring-security-modules/spring-security-x509/README.md similarity index 100% rename from spring-security-x509/README.md rename to spring-security-modules/spring-security-x509/README.md diff --git a/spring-security-x509/keystore/Makefile b/spring-security-modules/spring-security-x509/keystore/Makefile similarity index 100% rename from spring-security-x509/keystore/Makefile rename to spring-security-modules/spring-security-x509/keystore/Makefile diff --git a/spring-security-x509/keystore/keystore.jks b/spring-security-modules/spring-security-x509/keystore/keystore.jks similarity index 100% rename from spring-security-x509/keystore/keystore.jks rename to spring-security-modules/spring-security-x509/keystore/keystore.jks diff --git a/spring-security-x509/pom.xml b/spring-security-modules/spring-security-x509/pom.xml similarity index 83% rename from spring-security-x509/pom.xml rename to spring-security-modules/spring-security-x509/pom.xml index db7def0c02..a4ff908eed 100644 --- a/spring-security-x509/pom.xml +++ b/spring-security-modules/spring-security-x509/pom.xml @@ -1,18 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-security-x509</artifactId> <version>0.0.1-SNAPSHOT</version> - <name>spring-security-x509</name> + <name>spring-security-x509</name> <packaging>pom</packaging> - + <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-boot-1</relativePath> + <relativePath>../../parent-boot-1</relativePath> </parent> <modules> diff --git a/spring-security-x509/spring-security-x509-basic-auth/pom.xml b/spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/pom.xml similarity index 92% rename from spring-security-x509/spring-security-x509-basic-auth/pom.xml rename to spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/pom.xml index 0bbd5d3d3d..3cff638894 100644 --- a/spring-security-x509/spring-security-x509-basic-auth/pom.xml +++ b/spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-security-x509-basic-auth</artifactId> <version>0.0.1-SNAPSHOT</version> diff --git a/spring-security-x509/spring-security-x509-basic-auth/src/main/java/com/baeldung/spring/security/x509/UserController.java b/spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/main/java/com/baeldung/spring/security/x509/UserController.java similarity index 100% rename from spring-security-x509/spring-security-x509-basic-auth/src/main/java/com/baeldung/spring/security/x509/UserController.java rename to spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/main/java/com/baeldung/spring/security/x509/UserController.java diff --git a/spring-security-x509/spring-security-x509-basic-auth/src/main/java/com/baeldung/spring/security/x509/X509AuthenticationServer.java b/spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/main/java/com/baeldung/spring/security/x509/X509AuthenticationServer.java similarity index 100% rename from spring-security-x509/spring-security-x509-basic-auth/src/main/java/com/baeldung/spring/security/x509/X509AuthenticationServer.java rename to spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/main/java/com/baeldung/spring/security/x509/X509AuthenticationServer.java diff --git a/spring-security-x509/spring-security-x509-basic-auth/src/main/resources/application.properties b/spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/main/resources/application.properties similarity index 100% rename from spring-security-x509/spring-security-x509-basic-auth/src/main/resources/application.properties rename to spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/main/resources/application.properties diff --git a/spring-zuul/spring-zuul-ui/src/main/resources/logback.xml b/spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/main/resources/logback.xml similarity index 100% rename from spring-zuul/spring-zuul-ui/src/main/resources/logback.xml rename to spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/main/resources/logback.xml diff --git a/spring-security-x509/spring-security-x509-basic-auth/src/main/resources/templates/user.html b/spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/main/resources/templates/user.html similarity index 100% rename from spring-security-x509/spring-security-x509-basic-auth/src/main/resources/templates/user.html rename to spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/main/resources/templates/user.html diff --git a/spring-security-x509/spring-security-x509-basic-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerIntegrationTest.java b/spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerIntegrationTest.java similarity index 100% rename from spring-security-x509/spring-security-x509-basic-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerIntegrationTest.java rename to spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerIntegrationTest.java diff --git a/spring-security-x509/spring-security-x509-basic-auth/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/test/java/org/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-x509/spring-security-x509-basic-auth/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/test/java/org/baeldung/SpringContextTest.java diff --git a/spring-security-x509/spring-security-x509-client-auth/pom.xml b/spring-security-modules/spring-security-x509/spring-security-x509-client-auth/pom.xml similarity index 96% rename from spring-security-x509/spring-security-x509-client-auth/pom.xml rename to spring-security-modules/spring-security-x509/spring-security-x509-client-auth/pom.xml index 3e2e18223a..3a39f6af67 100644 --- a/spring-security-x509/spring-security-x509-client-auth/pom.xml +++ b/spring-security-modules/spring-security-x509/spring-security-x509-client-auth/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-security-x509-client-auth</artifactId> <version>0.0.1-SNAPSHOT</version> @@ -70,4 +70,5 @@ </build> </profile> </profiles> + </project> diff --git a/spring-security-x509/spring-security-x509-client-auth/src/main/java/com/baeldung/spring/security/x509/UserController.java b/spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/main/java/com/baeldung/spring/security/x509/UserController.java similarity index 100% rename from spring-security-x509/spring-security-x509-client-auth/src/main/java/com/baeldung/spring/security/x509/UserController.java rename to spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/main/java/com/baeldung/spring/security/x509/UserController.java diff --git a/spring-security-x509/spring-security-x509-client-auth/src/main/java/com/baeldung/spring/security/x509/X509AuthenticationServer.java b/spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/main/java/com/baeldung/spring/security/x509/X509AuthenticationServer.java similarity index 100% rename from spring-security-x509/spring-security-x509-client-auth/src/main/java/com/baeldung/spring/security/x509/X509AuthenticationServer.java rename to spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/main/java/com/baeldung/spring/security/x509/X509AuthenticationServer.java diff --git a/spring-security-x509/spring-security-x509-client-auth/src/main/resources/application.properties b/spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/main/resources/application.properties similarity index 100% rename from spring-security-x509/spring-security-x509-client-auth/src/main/resources/application.properties rename to spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/main/resources/application.properties diff --git a/spring-security-x509/spring-security-x509-client-auth/src/main/resources/keystore.jks b/spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/main/resources/keystore.jks similarity index 100% rename from spring-security-x509/spring-security-x509-client-auth/src/main/resources/keystore.jks rename to spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/main/resources/keystore.jks diff --git a/spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/main/resources/logback.xml b/spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/main/resources/logback.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<configuration> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + </pattern> + </encoder> + </appender> + + <root level="INFO"> + <appender-ref ref="STDOUT" /> + </root> +</configuration> \ No newline at end of file diff --git a/spring-security-x509/spring-security-x509-client-auth/src/main/resources/templates/user.html b/spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/main/resources/templates/user.html similarity index 100% rename from spring-security-x509/spring-security-x509-client-auth/src/main/resources/templates/user.html rename to spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/main/resources/templates/user.html diff --git a/spring-security-x509/spring-security-x509-client-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerIntegrationTest.java b/spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerIntegrationTest.java similarity index 100% rename from spring-security-x509/spring-security-x509-client-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerIntegrationTest.java rename to spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerIntegrationTest.java diff --git a/spring-security-x509/spring-security-x509-client-auth/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/test/java/org/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-x509/spring-security-x509-client-auth/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/test/java/org/baeldung/SpringContextTest.java diff --git a/spring-security-mvc-boot/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-mvc-boot/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index f01cac1c87..0000000000 --- a/spring-security-mvc-boot/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.baeldung; - -import org.baeldung.custom.Application; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-security-mvc-custom/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-mvc-custom/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 9e74e83a53..0000000000 --- a/spring-security-mvc-custom/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.baeldung; - -import org.baeldung.spring.MvcConfig; -import org.baeldung.spring.SecSecurityConfig; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { MvcConfig.class, SecSecurityConfig.class }) -@WebAppConfiguration -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-security-mvc-digest-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-mvc-digest-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index a4a85a8fa2..0000000000 --- a/spring-security-mvc-digest-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.baeldung; - -import org.baeldung.spring.ClientConfig; -import org.baeldung.spring.MvcConfig; -import org.baeldung.spring.SecSecurityConfig; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { ClientConfig.class, MvcConfig.class, SecSecurityConfig.class }) -@WebAppConfiguration -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-security-mvc-jsonview/src/test/java/com/baeldung/SpringContextIntegrationTest.java b/spring-security-mvc-jsonview/src/test/java/com/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index e22cd3d71a..0000000000 --- a/spring-security-mvc-jsonview/src/test/java/com/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung; - -import com.baeldung.spring.AppConfig; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = AppConfig.class) -@WebAppConfiguration -public class SpringContextIntegrationTest { - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-security-mvc-ldap/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-mvc-ldap/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 0b701e9acf..0000000000 --- a/spring-security-mvc-ldap/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SampleLDAPApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-security-mvc-login/src/test/java/com/baeldung/SpringContextIntegrationTest.java b/spring-security-mvc-login/src/test/java/com/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 20de02d5c5..0000000000 --- a/spring-security-mvc-login/src/test/java/com/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration({ "/RedirectionWebSecurityConfig.xml", "/mvc-servlet.xml" }) -@WebAppConfiguration -public class SpringContextIntegrationTest { - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-security-mvc-persisted-remember-me/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-mvc-persisted-remember-me/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index f1df880862..0000000000 --- a/spring-security-mvc-persisted-remember-me/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.baeldung; - -import org.baeldung.spring.MvcConfig; -import org.baeldung.spring.PersistenceConfig; -import org.baeldung.spring.SecurityConfig; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { MvcConfig.class, PersistenceConfig.class, SecurityConfig.class }) -@WebAppConfiguration -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-security-mvc-socket/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-mvc-socket/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 00202a98cb..0000000000 --- a/spring-security-mvc-socket/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; - -import com.baeldung.springsecuredsockets.config.AppConfig; -import com.baeldung.springsecuredsockets.config.DataStoreConfig; -import com.baeldung.springsecuredsockets.config.SecurityConfig; -import com.baeldung.springsecuredsockets.config.SocketBrokerConfig; -import com.baeldung.springsecuredsockets.config.SocketSecurityConfig; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { AppConfig.class, DataStoreConfig.class, SecurityConfig.class, - SocketBrokerConfig.class, SocketSecurityConfig.class }) -@WebAppConfiguration -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-security-mvc/src/test/java/com/baeldung/SpringContextIntegrationTest.java b/spring-security-mvc/src/test/java/com/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index ac9da5ca60..0000000000 --- a/spring-security-mvc/src/test/java/com/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.session.SpringSessionApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringSessionApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-security-openid/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-openid/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 79a725dcae..0000000000 --- a/spring-security-openid/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.baeldung; - -import org.baeldung.config.SpringOpenidApplication; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringOpenidApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-security-react/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-react/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index a921976fc3..0000000000 --- a/spring-security-react/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.baeldung.spring.MvcConfig; -import org.baeldung.spring.SecSecurityConfig; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { MvcConfig.class, SecSecurityConfig.class }) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-security-rest-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-rest-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 31b3f2be87..0000000000 --- a/spring-security-rest-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration({ "/webSecurityConfig.xml" }) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-security-rest-custom/src/test/resources/.gitignore b/spring-security-rest-custom/src/test/resources/.gitignore deleted file mode 100644 index 83c05e60c8..0000000000 --- a/spring-security-rest-custom/src/test/resources/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -*.class - -#folders# -/target -/neoDb* -/data -/src/main/webapp/WEB-INF/classes -*/META-INF/* - -# Packaged files # -*.jar -*.war -*.ear \ No newline at end of file diff --git a/spring-security-rest/.gitignore b/spring-security-rest/.gitignore deleted file mode 100644 index 83c05e60c8..0000000000 --- a/spring-security-rest/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -*.class - -#folders# -/target -/neoDb* -/data -/src/main/webapp/WEB-INF/classes -*/META-INF/* - -# Packaged files # -*.jar -*.war -*.ear \ No newline at end of file diff --git a/spring-security-rest/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-rest/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index ae0d80bb45..0000000000 --- a/spring-security-rest/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.baeldung; - -import org.baeldung.security.SecurityJavaConfig; -import org.baeldung.spring.ClientWebConfig; -import org.baeldung.spring.WebConfig; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; - -@RunWith(SpringJUnit4ClassRunner.class) -@WebAppConfiguration -@ContextConfiguration(classes = { ClientWebConfig.class, SecurityJavaConfig.class, WebConfig.class }) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-security-rest/src/test/resources/.gitignore b/spring-security-rest/src/test/resources/.gitignore deleted file mode 100644 index 83c05e60c8..0000000000 --- a/spring-security-rest/src/test/resources/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -*.class - -#folders# -/target -/neoDb* -/data -/src/main/webapp/WEB-INF/classes -*/META-INF/* - -# Packaged files # -*.jar -*.war -*.ear \ No newline at end of file diff --git a/spring-security-sso/spring-security-sso-auth-server/README.md b/spring-security-sso/spring-security-sso-auth-server/README.md new file mode 100644 index 0000000000..845fb50a93 --- /dev/null +++ b/spring-security-sso/spring-security-sso-auth-server/README.md @@ -0,0 +1,3 @@ +### Relevant Articles + +- [Simple Single Sign-On with Spring Security OAuth2](https://www.baeldung.com/sso-spring-security-oauth2) diff --git a/spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 66ee232b10..0000000000 --- a/spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.baeldung; - -import org.baeldung.config.AuthorizationServerApplication; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = AuthorizationServerApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) -public class SpringContextIntegrationTest { - - @Test - public void whenLoadApplication_thenSuccess() { - - } -} diff --git a/spring-security-sso/spring-security-sso-ui-2/README.md b/spring-security-sso/spring-security-sso-ui-2/README.md new file mode 100644 index 0000000000..aed217bdf0 --- /dev/null +++ b/spring-security-sso/spring-security-sso-ui-2/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Simple Single Sign-On with Spring Security OAuth2](https://www.baeldung.com/sso-spring-security-oauth2) diff --git a/spring-security-sso/spring-security-sso-ui-2/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-sso/spring-security-sso-ui-2/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 2fb0210929..0000000000 --- a/spring-security-sso/spring-security-sso-ui-2/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.baeldung; - -import org.baeldung.config.UiApplication; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = UiApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) -public class SpringContextIntegrationTest { - - @Test - public void whenLoadApplication_thenSuccess() { - - } -} diff --git a/spring-security-sso/spring-security-sso-ui/README.md b/spring-security-sso/spring-security-sso-ui/README.md new file mode 100644 index 0000000000..845fb50a93 --- /dev/null +++ b/spring-security-sso/spring-security-sso-ui/README.md @@ -0,0 +1,3 @@ +### Relevant Articles + +- [Simple Single Sign-On with Spring Security OAuth2](https://www.baeldung.com/sso-spring-security-oauth2) diff --git a/spring-security-sso/spring-security-sso-ui/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-sso/spring-security-sso-ui/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 2fb0210929..0000000000 --- a/spring-security-sso/spring-security-sso-ui/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.baeldung; - -import org.baeldung.config.UiApplication; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = UiApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) -public class SpringContextIntegrationTest { - - @Test - public void whenLoadApplication_thenSuccess() { - - } -} diff --git a/spring-security-x509/spring-security-x509-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-x509/spring-security-x509-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 7ec6125f84..0000000000 --- a/spring-security-x509/spring-security-x509-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.spring.security.x509.X509AuthenticationServer; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = X509AuthenticationServer.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-security-x509/spring-security-x509-client-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-x509/spring-security-x509-client-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 7ec6125f84..0000000000 --- a/spring-security-x509/spring-security-x509-client-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.spring.security.x509.X509AuthenticationServer; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = X509AuthenticationServer.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-session/pom.xml b/spring-session/pom.xml index 639686c8ee..579d2327e8 100644 --- a/spring-session/pom.xml +++ b/spring-session/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.baeldung</groupId> <artifactId>spring-session</artifactId> @@ -8,8 +9,8 @@ <packaging>pom</packaging> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-1</relativePath> </parent> diff --git a/spring-session/spring-session-jdbc/pom.xml b/spring-session/spring-session-jdbc/pom.xml index 432715bc0e..64cdb4dd09 100644 --- a/spring-session/spring-session-jdbc/pom.xml +++ b/spring-session/spring-session-jdbc/pom.xml @@ -3,7 +3,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-session-jdbc</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-session-jdbc</name> @@ -11,8 +10,8 @@ <description>Spring Session with JDBC tutorial</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-2</relativePath> </parent> diff --git a/spring-session/spring-session-jdbc/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-session/spring-session-jdbc/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index b921f76a0d..0000000000 --- a/spring-session/spring-session-jdbc/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.springsessionjdbc.SpringSessionJdbcApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringSessionJdbcApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-session/spring-session-mongodb/pom.xml b/spring-session/spring-session-mongodb/pom.xml index b9e06615de..00ffec93c0 100644 --- a/spring-session/spring-session-mongodb/pom.xml +++ b/spring-session/spring-session-mongodb/pom.xml @@ -3,7 +3,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-session-mongodb</artifactId> <version>0.0.1-SNAPSHOT</version> <name>spring-session-mongodb</name> @@ -11,8 +10,8 @@ <description>Spring Session with MongoDB tutorial</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-2</relativePath> </parent> @@ -40,7 +39,7 @@ <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> - + <dependency> <groupId>de.flapdoodle.embed</groupId> <artifactId>de.flapdoodle.embed.mongo</artifactId> diff --git a/spring-session/spring-session-mongodb/src/test/java/com/baeldung/springsessionmongodb/SpringSessionMongoDBIntegrationTest.java b/spring-session/spring-session-mongodb/src/test/java/com/baeldung/springsessionmongodb/SpringSessionMongoDBIntegrationTest.java index 9dc45c5b32..de41019e49 100644 --- a/spring-session/spring-session-mongodb/src/test/java/com/baeldung/springsessionmongodb/SpringSessionMongoDBIntegrationTest.java +++ b/spring-session/spring-session-mongodb/src/test/java/com/baeldung/springsessionmongodb/SpringSessionMongoDBIntegrationTest.java @@ -6,6 +6,7 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.boot.web.server.LocalServerPort; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; @@ -16,9 +17,12 @@ import java.util.Base64; @RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringSessionMongoDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT) +@SpringBootTest(classes = SpringSessionMongoDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class SpringSessionMongoDBIntegrationTest { + @LocalServerPort + private int port; + @Autowired private MongoOperationsSessionRepository repository; @@ -27,7 +31,7 @@ public class SpringSessionMongoDBIntegrationTest { @Test public void givenEndpointIsCalledTwiceAndResponseIsReturned_whenMongoDBIsQueriedForCount_thenCountMustBeSame() { HttpEntity<String> response = restTemplate - .exchange("http://localhost:" + 8080, HttpMethod.GET, null, String.class); + .exchange("http://localhost:" + port, HttpMethod.GET, null, String.class); HttpHeaders headers = response.getHeaders(); String set_cookie = headers.getFirst(HttpHeaders.SET_COOKIE); diff --git a/spring-session/spring-session-mongodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-session/spring-session-mongodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 1acc6a5cb1..0000000000 --- a/spring-session/spring-session-mongodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.baeldung; - -import com.baeldung.springsessionmongodb.SpringSessionMongoDBApplication; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringSessionMongoDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-session/spring-session-redis/pom.xml b/spring-session/spring-session-redis/pom.xml index 96d90b2776..37402634b0 100644 --- a/spring-session/spring-session-redis/pom.xml +++ b/spring-session/spring-session-redis/pom.xml @@ -4,12 +4,12 @@ <modelVersion>4.0.0</modelVersion> <artifactId>spring-session-redis</artifactId> <version>1.0.0-SNAPSHOT</version> + <name>spring-session-redis</name> <packaging>jar</packaging> - <name>spring-session-redis</name> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-1</relativePath> </parent> @@ -37,9 +37,9 @@ <version>${embedded-redis.version}</version> </dependency> </dependencies> - + <properties> - <embedded-redis.version>0.6</embedded-redis.version> + <embedded-redis.version>0.6</embedded-redis.version> </properties> </project> \ No newline at end of file diff --git a/spring-session/spring-session-redis/src/test/java/com/baeldung/spring/session/SessionControllerIntegrationTest.java b/spring-session/spring-session-redis/src/test/java/com/baeldung/spring/session/SessionControllerIntegrationTest.java index f739aeb3ab..7ee0294315 100644 --- a/spring-session/spring-session-redis/src/test/java/com/baeldung/spring/session/SessionControllerIntegrationTest.java +++ b/spring-session/spring-session-redis/src/test/java/com/baeldung/spring/session/SessionControllerIntegrationTest.java @@ -1,16 +1,11 @@ package com.baeldung.spring.session; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.util.Set; - import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; +import org.springframework.boot.context.embedded.LocalServerPort; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; @@ -20,19 +15,27 @@ import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.test.context.junit4.SpringRunner; - import redis.clients.jedis.Jedis; import redis.embedded.RedisServer; +import java.io.IOException; +import java.util.Set; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + @RunWith(SpringRunner.class) -@SpringBootTest(classes = SessionWebApplication.class, webEnvironment = WebEnvironment.DEFINED_PORT) +@SpringBootTest(classes = SessionWebApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) public class SessionControllerIntegrationTest { - private Jedis jedis; private static RedisServer redisServer; + + @LocalServerPort + private int port; + + private Jedis jedis; private TestRestTemplate testRestTemplate; private TestRestTemplate testRestTemplateWithAuth; - private String testUrl = "http://localhost:8080/"; @BeforeClass public static void startRedisServer() throws IOException { @@ -41,7 +44,7 @@ public class SessionControllerIntegrationTest { } @AfterClass - public static void stopRedisServer() throws IOException { + public static void stopRedisServer() { redisServer.stop(); } @@ -63,13 +66,13 @@ public class SessionControllerIntegrationTest { @Test public void testUnauthenticatedCantAccess() { - ResponseEntity<String> result = testRestTemplate.getForEntity(testUrl, String.class); + ResponseEntity<String> result = testRestTemplate.getForEntity(getTestUrl(), String.class); assertEquals(HttpStatus.UNAUTHORIZED, result.getStatusCode()); } @Test public void testRedisControlsSession() { - ResponseEntity<String> result = testRestTemplateWithAuth.getForEntity(testUrl, String.class); + ResponseEntity<String> result = testRestTemplateWithAuth.getForEntity(getTestUrl(), String.class); assertEquals("hello admin", result.getBody()); // login worked Set<String> redisResult = jedis.keys("*"); @@ -80,13 +83,16 @@ public class SessionControllerIntegrationTest { headers.add("Cookie", sessionCookie); HttpEntity<String> httpEntity = new HttpEntity<>(headers); - result = testRestTemplate.exchange(testUrl, HttpMethod.GET, httpEntity, String.class); + result = testRestTemplate.exchange(getTestUrl(), HttpMethod.GET, httpEntity, String.class); assertEquals("hello admin", result.getBody()); // access with session works worked jedis.flushAll(); // clear all keys in redis - result = testRestTemplate.exchange(testUrl, HttpMethod.GET, httpEntity, String.class); + result = testRestTemplate.exchange(getTestUrl(), HttpMethod.GET, httpEntity, String.class); assertEquals(HttpStatus.UNAUTHORIZED, result.getStatusCode());// access denied after sessions are removed in redis + } + private String getTestUrl(){ + return "http://localhost:" + port; } } \ No newline at end of file diff --git a/spring-shell/pom.xml b/spring-shell/pom.xml index 1b6fe28fdd..be1562b942 100644 --- a/spring-shell/pom.xml +++ b/spring-shell/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -7,8 +8,8 @@ <packaging>war</packaging> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> diff --git a/spring-sleuth/pom.xml b/spring-sleuth/pom.xml index 2387915c79..c37086558d 100644 --- a/spring-sleuth/pom.xml +++ b/spring-sleuth/pom.xml @@ -1,31 +1,19 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-sleuth</artifactId> <version>1.0.0-SNAPSHOT</version> <name>spring-sleuth</name> <packaging>jar</packaging> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-sleuth</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> - </dependencies> - <dependencyManagement> <dependencies> <dependency> @@ -38,6 +26,17 @@ </dependencies> </dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-sleuth</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + </dependencies> + <properties> <spring-cloud-sleuth.version>2.0.2.RELEASE</spring-cloud-sleuth.version> </properties> diff --git a/spring-sleuth/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-sleuth/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index ef722ecba0..0000000000 --- a/spring-sleuth/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.spring.session.SleuthWebApp; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SleuthWebApp.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-soap/pom.xml b/spring-soap/pom.xml index e155a0f6b2..9403b70636 100644 --- a/spring-soap/pom.xml +++ b/spring-soap/pom.xml @@ -3,12 +3,12 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-soap</artifactId> - <name>spring-soap</name> <version>1.0.0</version> + <name>spring-soap</name> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> diff --git a/spring-social-login/pom.xml b/spring-social-login/pom.xml index 655e885568..9fa839f1c2 100644 --- a/spring-social-login/pom.xml +++ b/spring-social-login/pom.xml @@ -1,13 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-social-login</artifactId> <name>spring-social-login</name> <packaging>war</packaging> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-1</relativePath> </parent> @@ -76,7 +77,6 @@ </dependencies> - <build> <finalName>spring-social-login</finalName> <resources> diff --git a/spring-social-login/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-social-login/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 29ed401118..0000000000 --- a/spring-social-login/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.baeldung; - -import org.baeldung.config.Application; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.RANDOM_PORT) -public class SpringContextIntegrationTest { - - @Test - public void whenLoadApplication_thenSuccess() { - - } -} diff --git a/spring-spel/pom.xml b/spring-spel/pom.xml index aa6eb45158..2109117a86 100644 --- a/spring-spel/pom.xml +++ b/spring-spel/pom.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-spel</artifactId> <version>1.0-SNAPSHOT</version> - <name>spring-spel</name> + <name>spring-spel</name> <parent> <groupId>com.baeldung</groupId> diff --git a/spring-spel/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-spel/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index f394374a94..0000000000 --- a/spring-spel/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = {"classpath:applicationContext.xml"}) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-state-machine/pom.xml b/spring-state-machine/pom.xml index b911b5b5ee..acb14a7613 100644 --- a/spring-state-machine/pom.xml +++ b/spring-state-machine/pom.xml @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-state-machine</artifactId> - <name>spring-state-machine</name> - + <name>spring-state-machine</name> + <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> diff --git a/spring-state-machine/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-state-machine/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 72292a5089..0000000000 --- a/spring-state-machine/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import com.baeldung.spring.statemachine.config.ForkJoinStateMachineConfiguration; -import com.baeldung.spring.statemachine.config.HierarchicalStateMachineConfiguration; -import com.baeldung.spring.statemachine.config.JunctionStateMachineConfiguration; -import com.baeldung.spring.statemachine.config.SimpleEnumStateMachineConfiguration; -import com.baeldung.spring.statemachine.config.SimpleStateMachineConfiguration; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { SimpleStateMachineConfiguration.class, SimpleEnumStateMachineConfiguration.class, - JunctionStateMachineConfiguration.class, HierarchicalStateMachineConfiguration.class, - ForkJoinStateMachineConfiguration.class }) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-static-resources/pom.xml b/spring-static-resources/pom.xml index b8068814ba..662c757f54 100644 --- a/spring-static-resources/pom.xml +++ b/spring-static-resources/pom.xml @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-static-resources</artifactId> <version>0.1.0-SNAPSHOT</version> <name>spring-static-resources</name> @@ -147,14 +146,14 @@ <artifactId>commons-io</artifactId> <version>${commons-io.version}</version> </dependency> - + <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> - <version>${spring.version}</version> + <version>${spring.version}</version> <scope>test</scope> </dependency> - + </dependencies> <build> diff --git a/spring-static-resources/src/test/java/com/baeldung/SpringContextIntegrationTest.java b/spring-static-resources/src/test/java/com/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 67dc50030c..0000000000 --- a/spring-static-resources/src/test/java/com/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.baeldung; - -import org.baeldung.spring.SecSecurityConfig; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; -import org.springframework.test.context.web.WebAppConfiguration; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { SecSecurityConfig.class }, loader = AnnotationConfigContextLoader.class) -@WebAppConfiguration -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - - } -} diff --git a/spring-swagger-codegen/pom.xml b/spring-swagger-codegen/pom.xml index e1bb98360e..dee9415679 100644 --- a/spring-swagger-codegen/pom.xml +++ b/spring-swagger-codegen/pom.xml @@ -1,10 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-swagger-codegen</artifactId> <version>0.0.1-SNAPSHOT</version> + <name>spring-swagger-codegen</name> <packaging>pom</packaging> - <name>spring-swagger-codegen</name> <parent> <groupId>com.baeldung</groupId> diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/pom.xml b/spring-swagger-codegen/spring-swagger-codegen-api-client/pom.xml index cfbc90155c..b9b97139d6 100644 --- a/spring-swagger-codegen/spring-swagger-codegen-api-client/pom.xml +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/pom.xml @@ -1,11 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-swagger-codegen-api-client</artifactId> <name>spring-swagger-codegen-api-client</name> + <packaging>jar</packaging> <url>https://github.com/swagger-api/swagger-codegen</url> <description>Swagger Java</description> - <packaging>jar</packaging> <scm> <connection>scm:git:git@github.com:swagger-api/swagger-codegen.git</connection> @@ -37,6 +38,53 @@ <relativePath>../../spring-swagger-codegen</relativePath> </parent> + <dependencies> + <dependency> + <groupId>io.swagger</groupId> + <artifactId>swagger-annotations</artifactId> + <version>${swagger-annotations-version}</version> + </dependency> + + <!-- HTTP client: Spring RestTemplate --> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> + <version>${spring-web-version}</version> + </dependency> + + <!-- JSON processing: jackson --> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + <version>${jackson.version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + <version>${jackson.version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>${jackson.version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.jaxrs</groupId> + <artifactId>jackson-jaxrs-json-provider</artifactId> + <version>${jackson.version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.datatype</groupId> + <artifactId>jackson-datatype-joda</artifactId> + <version>${jackson.version}</version> + </dependency> + <dependency> + <groupId>joda-time</groupId> + <artifactId>joda-time</artifactId> + <version>${jodatime-version}</version> + </dependency> + </dependencies> + <build> <plugins> <!-- attach test jar --> @@ -140,53 +188,6 @@ </profile> </profiles> - <dependencies> - <dependency> - <groupId>io.swagger</groupId> - <artifactId>swagger-annotations</artifactId> - <version>${swagger-annotations-version}</version> - </dependency> - - <!-- HTTP client: Spring RestTemplate --> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-web</artifactId> - <version>${spring-web-version}</version> - </dependency> - - <!-- JSON processing: jackson --> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-core</artifactId> - <version>${jackson.version}</version> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-annotations</artifactId> - <version>${jackson.version}</version> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - <version>${jackson.version}</version> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.jaxrs</groupId> - <artifactId>jackson-jaxrs-json-provider</artifactId> - <version>${jackson.version}</version> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.datatype</groupId> - <artifactId>jackson-datatype-joda</artifactId> - <version>${jackson.version}</version> - </dependency> - <dependency> - <groupId>joda-time</groupId> - <artifactId>joda-time</artifactId> - <version>${jodatime-version}</version> - </dependency> - </dependencies> - <properties> <swagger-annotations-version>1.5.15</swagger-annotations-version> <spring-web-version>4.3.9.RELEASE</spring-web-version> @@ -197,4 +198,5 @@ <maven-javadoc-plugin.version>2.10.4</maven-javadoc-plugin.version> <build-helper-maven-plugin.version>1.10</build-helper-maven-plugin.version> </properties> + </project> diff --git a/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml b/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml index f9410b6865..cb3fe89c8f 100644 --- a/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml +++ b/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml @@ -1,9 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-swagger-codegen-app</artifactId> - <name>spring-swagger-codegen-app</name> - + <name>spring-swagger-codegen-app</name> + <parent> <groupId>com.baeldung</groupId> <artifactId>spring-swagger-codegen</artifactId> @@ -42,6 +43,7 @@ <properties> <spring-swagger-codegen-api-client.version>0.0.1-SNAPSHOT</spring-swagger-codegen-api-client.version> - <spring.version>1.5.10.RELEASE</spring.version> + <spring.version>1.5.10.RELEASE</spring.version> </properties> + </project> diff --git a/spring-swagger-codegen/spring-swagger-codegen-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-swagger-codegen/spring-swagger-codegen-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 2143dc7f4d..0000000000 --- a/spring-swagger-codegen/spring-swagger-codegen-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.petstore.app.PetStoreApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = PetStoreApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-thymeleaf-2/pom.xml b/spring-thymeleaf-2/pom.xml index d53bb8ab1a..24c159dab9 100644 --- a/spring-thymeleaf-2/pom.xml +++ b/spring-thymeleaf-2/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-thymeleaf-2</artifactId> <name>spring-thymeleaf-2</name> @@ -65,4 +66,5 @@ <maven.compiler.target>1.8</maven.compiler.target> <tomcat7-maven-plugin.version>2.2</tomcat7-maven-plugin.version> </properties> + </project> diff --git a/spring-thymeleaf/pom.xml b/spring-thymeleaf/pom.xml index d260a78d76..c37c66a36d 100644 --- a/spring-thymeleaf/pom.xml +++ b/spring-thymeleaf/pom.xml @@ -1,10 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>spring-thymeleaf</artifactId> <version>0.1-SNAPSHOT</version> - <name>spring-thymeleaf</name> + <name>spring-thymeleaf</name> <packaging>war</packaging> <parent> @@ -62,7 +62,7 @@ <artifactId>spring-security-config</artifactId> <version>${spring-security.version}</version> </dependency> - + <!-- Thymeleaf --> <dependency> <groupId>org.thymeleaf</groupId> diff --git a/spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/SpringContextIntegrationTest.java b/spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/SpringContextIntegrationTest.java deleted file mode 100644 index 9a066b3101..0000000000 --- a/spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/SpringContextIntegrationTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung.thymeleaf; - -import com.baeldung.thymeleaf.config.InitSecurity; -import com.baeldung.thymeleaf.config.WebApp; -import com.baeldung.thymeleaf.config.WebMVCConfig; -import com.baeldung.thymeleaf.config.WebMVCSecurity; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; - -@RunWith(SpringJUnit4ClassRunner.class) -@WebAppConfiguration -@ContextConfiguration(classes = { WebApp.class, WebMVCConfig.class, WebMVCSecurity.class, InitSecurity.class }) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-vault/pom.xml b/spring-vault/pom.xml index ccad71c024..40967e2894 100644 --- a/spring-vault/pom.xml +++ b/spring-vault/pom.xml @@ -1,47 +1,45 @@ -<?xml version="1.0"?> -<project - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" - xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> - <artifactId>spring-vault</artifactId> - <version>0.0.1-SNAPSHOT</version> - <name>spring-vault</name> - <packaging>jar</packaging> - <description>Spring Vault sample project</description> +<?xml version="1.0" encoding="UTF-8"?> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + <artifactId>spring-vault</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>spring-vault</name> + <packaging>jar</packaging> + <description>Spring Vault sample project</description> - <parent> - <artifactId>parent-boot-2</artifactId> - <groupId>com.baeldung</groupId> - <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-boot-2</relativePath> - </parent> + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> + <version>0.0.1-SNAPSHOT</version> + <relativePath>../parent-boot-2</relativePath> + </parent> - <dependencies> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.vault</groupId> - <artifactId>spring-vault-core</artifactId> - <version>${spring.vault.core.version}</version> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.vault</groupId> + <artifactId>spring-vault-core</artifactId> + <version>${spring.vault.core.version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + </dependencies> - </dependencies> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <spring.vault.core.version>2.1.1.RELEASE</spring.vault.core.version> + </properties> - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <spring.vault.core.version>2.1.1.RELEASE</spring.vault.core.version> - </properties> </project> diff --git a/spring-vertx/pom.xml b/spring-vertx/pom.xml index 1a0e1c0223..ef169c9a27 100644 --- a/spring-vertx/pom.xml +++ b/spring-vertx/pom.xml @@ -1,15 +1,15 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>spring-vertx</artifactId> <name>spring-vertx</name> - <description>A demo project with vertx spring integration</description> <packaging>jar</packaging> + <description>A demo project with vertx spring integration</description> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> diff --git a/spring-vertx/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-vertx/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index b1f7b39f7e..0000000000 --- a/spring-vertx/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.vertxspring.VertxSpringApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = VertxSpringApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-webflux-amqp/pom.xml b/spring-webflux-amqp/pom.xml index 88f5eff403..f9b14eea06 100755 --- a/spring-webflux-amqp/pom.xml +++ b/spring-webflux-amqp/pom.xml @@ -1,76 +1,76 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>org.baeldung.spring</groupId> - <artifactId>spring-webflux-amqp</artifactId> - <version>1.0.0-SNAPSHOT</version> - <name>spring-webflux-amqp</name> - <packaging>jar</packaging> - <description>Spring WebFlux AMQP Sample</description> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.baeldung.spring</groupId> + <artifactId>spring-webflux-amqp</artifactId> + <version>1.0.0-SNAPSHOT</version> + <name>spring-webflux-amqp</name> + <packaging>jar</packaging> + <description>Spring WebFlux AMQP Sample</description> - <parent> - <artifactId>parent-boot-2</artifactId> - <groupId>com.baeldung</groupId> - <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-boot-2</relativePath> - </parent> + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> + <version>0.0.1-SNAPSHOT</version> + <relativePath>../parent-boot-2</relativePath> + </parent> - <dependencyManagement> - <dependencies> - <dependency> - <!-- Import dependency management from Spring Boot --> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-dependencies</artifactId> - <!-- <version>2.0.4.RELEASE</version> --><!-- works --> - <version>2.1.3.RELEASE</version> <!-- Works with workaround applied --> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> + <dependencyManagement> + <dependencies> + <dependency> + <!-- Import dependency management from Spring Boot --> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-dependencies</artifactId> + <!-- <version>2.0.4.RELEASE</version> --><!-- works --> + <version>2.1.3.RELEASE</version> <!-- Works with workaround applied --> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-amqp</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-webflux</artifactId> - </dependency> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-amqp</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-webflux</artifactId> + </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-configuration-processor</artifactId> - <optional>true</optional> - </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-configuration-processor</artifactId> + <optional>true</optional> + </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> - <dependency> - <groupId>io.projectreactor</groupId> - <artifactId>reactor-test</artifactId> - <scope>test</scope> - </dependency> + <dependency> + <groupId>io.projectreactor</groupId> + <artifactId>reactor-test</artifactId> + <scope>test</scope> + </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-integration</artifactId> - </dependency> - </dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-integration</artifactId> + </dependency> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + </plugins> + </build> </project> diff --git a/spring-zuul/README.md b/spring-zuul/README.md deleted file mode 100644 index e1067ebb9f..0000000000 --- a/spring-zuul/README.md +++ /dev/null @@ -1,6 +0,0 @@ -## Spring Zuul - -This module contains articles about Spring with Netflix Zuul - -### Relevant Articles: -- [Spring REST with a Zuul Proxy](https://www.baeldung.com/spring-rest-with-zuul-proxy) diff --git a/spring-zuul/pom.xml b/spring-zuul/pom.xml deleted file mode 100644 index a613f51c3f..0000000000 --- a/spring-zuul/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> - <artifactId>spring-zuul</artifactId> - <version>1.0.0-SNAPSHOT</version> - <name>spring-zuul</name> - <packaging>pom</packaging> - - <parent> - <artifactId>parent-boot-2</artifactId> - <groupId>com.baeldung</groupId> - <version>0.0.1-SNAPSHOT</version> - <relativePath>../parent-boot-2</relativePath> - </parent> - - <modules> - <module>spring-zuul-foos-resource</module> - <module>spring-zuul-ui</module> - </modules> - - <build> - <finalName>spring-zuul</finalName> - <pluginManagement> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-war-plugin</artifactId> - <version>${maven-war-plugin.version}</version> - <configuration> - <failOnMissingWebXml>false</failOnMissingWebXml> - </configuration> - </plugin> - </plugins> - </pluginManagement> - </build> - - <properties> - <!-- Spring --> - <spring-cloud.version>2.1.0.RELEASE</spring-cloud.version> - </properties> - -</project> \ No newline at end of file diff --git a/spring-zuul/spring-zuul-foos-resource/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-zuul/spring-zuul-foos-resource/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 623966373b..0000000000 --- a/spring-zuul/spring-zuul-foos-resource/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.baeldung; - -import org.baeldung.config.ResourceServerApplication; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = ResourceServerApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-zuul/spring-zuul-ui/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-zuul/spring-zuul-ui/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index a3d49627e5..0000000000 --- a/spring-zuul/spring-zuul-ui/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.baeldung; - -import org.baeldung.config.UiApplication; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = UiApplication.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-zuul/spring-zuul-ui/src/test/resources/.gitignore b/spring-zuul/spring-zuul-ui/src/test/resources/.gitignore deleted file mode 100644 index 83c05e60c8..0000000000 --- a/spring-zuul/spring-zuul-ui/src/test/resources/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -*.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/static-analysis/pom.xml b/static-analysis/pom.xml index 94d68f895b..87e5f55977 100644 --- a/static-analysis/pom.xml +++ b/static-analysis/pom.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>static-analysis</artifactId> <version>1.0-SNAPSHOT</version> - <name>static-analysis</name> + <name>static-analysis</name> <parent> <groupId>com.baeldung</groupId> diff --git a/stripe/pom.xml b/stripe/pom.xml index 7aa458bfd5..07d2968f5f 100644 --- a/stripe/pom.xml +++ b/stripe/pom.xml @@ -1,17 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.stripe</groupId> <artifactId>stripe</artifactId> <version>0.0.1-SNAPSHOT</version> <name>stripe</name> - <description>Demo project for Stripe API</description> <packaging>jar</packaging> + <description>Demo project for Stripe API</description> <parent> - <artifactId>parent-boot-1</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-1</relativePath> </parent> @@ -38,7 +38,7 @@ <version>${stripe.version}</version> </dependency> </dependencies> - + <properties> <stripe.version>4.2.0</stripe.version> </properties> diff --git a/structurizr/pom.xml b/structurizr/pom.xml index b9f9b68717..f1b4355dcf 100644 --- a/structurizr/pom.xml +++ b/structurizr/pom.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>structurizr</artifactId> - <name>structurizr</name> + <name>structurizr</name> <parent> <groupId>com.baeldung</groupId> diff --git a/struts-2/pom.xml b/struts-2/pom.xml index 1f7d6876d5..3211ad7253 100644 --- a/struts-2/pom.xml +++ b/struts-2/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>struts-2</artifactId> <version>0.0.1-SNAPSHOT</version> <name>struts-2</name> @@ -65,7 +65,7 @@ </plugin> </plugins> </build> - + <properties> <struts2.version>2.5.5</struts2.version> <struts2-convention-plugin.version>2.5.8</struts2-convention-plugin.version> diff --git a/tensorflow-java/pom.xml b/tensorflow-java/pom.xml index 1c34fa465b..379a901925 100644 --- a/tensorflow-java/pom.xml +++ b/tensorflow-java/pom.xml @@ -1,51 +1,51 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> - <artifactId>tensorflow-java</artifactId> - <version>1.0-SNAPSHOT</version> - <packaging>jar</packaging> - <name>tensorflow-java</name> - <url>http://maven.apache.org</url> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>tensorflow-java</artifactId> + <version>1.0-SNAPSHOT</version> + <name>tensorflow-java</name> + <packaging>jar</packaging> + <url>http://maven.apache.org</url> - <parent> - <groupId>com.baeldung</groupId> - <artifactId>parent-modules</artifactId> - <version>1.0.0-SNAPSHOT</version> - </parent> + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> - <dependencies> - <dependency> - <groupId>org.tensorflow</groupId> - <artifactId>tensorflow</artifactId> - <version>${tensorflow.version}</version> - </dependency> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-api</artifactId> - <version>${junit-jupiter.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-engine</artifactId> - <version>${junit-jupiter.version}</version> - <scope>test</scope> - </dependency> - </dependencies> + <dependencies> + <dependency> + <groupId>org.tensorflow</groupId> + <artifactId>tensorflow</artifactId> + <version>${tensorflow.version}</version> + </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-api</artifactId> + <version>${junit-jupiter.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-engine</artifactId> + <version>${junit-jupiter.version}</version> + <scope>test</scope> + </dependency> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + </plugins> + </build> + + <properties> + <tensorflow.version>1.12.0</tensorflow.version> + </properties> - <properties> - <tensorflow.version>1.12.0</tensorflow.version> - </properties> </project> \ No newline at end of file diff --git a/testing-modules/assertion-libraries/pom.xml b/testing-modules/assertion-libraries/pom.xml index 9d60d42533..c8ab512e4b 100644 --- a/testing-modules/assertion-libraries/pom.xml +++ b/testing-modules/assertion-libraries/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>assertion-libraries</artifactId> <version>0.1-SNAPSHOT</version> <name>assertion-libraries</name> diff --git a/testing-modules/easy-random/pom.xml b/testing-modules/easy-random/pom.xml index d80927c3e8..1a1f3f743d 100644 --- a/testing-modules/easy-random/pom.xml +++ b/testing-modules/easy-random/pom.xml @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>easy-random</artifactId> <name>easy-random</name> <parent> - <artifactId>parent-modules</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> <version>1.0.0-SNAPSHOT</version> <relativePath>../../</relativePath> </parent> diff --git a/testing-modules/easymock/pom.xml b/testing-modules/easymock/pom.xml index ed9a077f67..4146ae6df4 100644 --- a/testing-modules/easymock/pom.xml +++ b/testing-modules/easymock/pom.xml @@ -1,8 +1,7 @@ -<?xml version="1.0"?> -<project - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" - xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +<?xml version="1.0" encoding="UTF-8"?> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <artifactId>easymock</artifactId> <name>easymock</name> @@ -27,4 +26,5 @@ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <easymock.version>4.0.2</easymock.version> </properties> + </project> diff --git a/testing-modules/gatling/pom.xml b/testing-modules/gatling/pom.xml index d105cc8b3e..99eaaac044 100644 --- a/testing-modules/gatling/pom.xml +++ b/testing-modules/gatling/pom.xml @@ -15,7 +15,6 @@ <relativePath>../../</relativePath> </parent> - <dependencyManagement> <dependencies> <dependency> @@ -106,7 +105,6 @@ </plugins> </build> - <properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> diff --git a/testing-modules/groovy-spock/pom.xml b/testing-modules/groovy-spock/pom.xml index 35d8f5034f..fa2c98a884 100644 --- a/testing-modules/groovy-spock/pom.xml +++ b/testing-modules/groovy-spock/pom.xml @@ -1,11 +1,11 @@ <?xml version="1.0"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.spockframework</groupId> <artifactId>groovy-spock</artifactId> <version>1.0-SNAPSHOT</version> - <name>groovy-spock</name> + <name>groovy-spock</name> <packaging>jar</packaging> <parent> diff --git a/testing-modules/hamcrest/pom.xml b/testing-modules/hamcrest/pom.xml index 2136702b3a..cfd5bf5fac 100644 --- a/testing-modules/hamcrest/pom.xml +++ b/testing-modules/hamcrest/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>hamcrest</artifactId> <version>0.0.1-SNAPSHOT</version> <name>hamcrest</name> @@ -26,4 +26,5 @@ <properties> <hamcrest.version>2.0.0.0</hamcrest.version> </properties> + </project> diff --git a/testing-modules/junit-4/README.md b/testing-modules/junit-4/README.md index 6cc3981ed4..d19a0a1e47 100644 --- a/testing-modules/junit-4/README.md +++ b/testing-modules/junit-4/README.md @@ -4,4 +4,3 @@ - [Custom JUnit 4 Test Runners](http://www.baeldung.com/junit-4-custom-runners) - [Introduction to JUnitParams](http://www.baeldung.com/junit-params) - [Running JUnit Tests Programmatically, from a Java Application](https://www.baeldung.com/junit-tests-run-programmatically-from-java) -- [Introduction to Lambda Behave](https://www.baeldung.com/lambda-behave) diff --git a/testing-modules/junit-5-advanced/pom.xml b/testing-modules/junit-5-advanced/pom.xml index bc879ebfc3..4756223c3d 100644 --- a/testing-modules/junit-5-advanced/pom.xml +++ b/testing-modules/junit-5-advanced/pom.xml @@ -1,52 +1,53 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <artifactId>junit-5-advanced</artifactId> - <version>1.0-SNAPSHOT</version> - <name>junit-5-advanced</name> - <description>Advanced JUnit 5 Topics</description> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>junit-5-advanced</artifactId> + <version>1.0-SNAPSHOT</version> + <name>junit-5-advanced</name> + <description>Advanced JUnit 5 Topics</description> - <parent> - <groupId>com.baeldung</groupId> - <artifactId>parent-modules</artifactId> - <version>1.0.0-SNAPSHOT</version> - <relativePath>../../</relativePath> - </parent> + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> + <version>1.0.0-SNAPSHOT</version> + <relativePath>../../</relativePath> + </parent> - <dependencies> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter</artifactId> - <version>${junit-jupiter.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-engine</artifactId> - <version>${junit-jupiter.version}</version> - </dependency> - <dependency> - <groupId>org.junit.vintage</groupId> - <artifactId>junit-vintage-engine</artifactId> - <version>${junit.vintage.version}</version> - <scope>test</scope> - </dependency> - </dependencies> + <dependencies> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter</artifactId> + <version>${junit-jupiter.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-engine</artifactId> + <version>${junit-jupiter.version}</version> + </dependency> + <dependency> + <groupId>org.junit.vintage</groupId> + <artifactId>junit-vintage-engine</artifactId> + <version>${junit.vintage.version}</version> + <scope>test</scope> + </dependency> + </dependencies> - <build> - <plugins> - <plugin> - <artifactId>maven-surefire-plugin</artifactId> - <version>${maven-surefire-plugin.version}</version> - </plugin> - </plugins> - </build> - <properties> - <junit-jupiter.version>5.4.2</junit-jupiter.version> - <maven-surefire-plugin.version>2.21.0</maven-surefire-plugin.version> - <junit.vintage.version>5.4.2</junit.vintage.version> - </properties> + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <version>${maven-surefire-plugin.version}</version> + </plugin> + </plugins> + </build> + + <properties> + <junit-jupiter.version>5.4.2</junit-jupiter.version> + <maven-surefire-plugin.version>2.21.0</maven-surefire-plugin.version> + <junit.vintage.version>5.4.2</junit.vintage.version> + </properties> </project> diff --git a/testing-modules/junit-5-basics/pom.xml b/testing-modules/junit-5-basics/pom.xml index 68a0ceeee7..b9c9635dc4 100644 --- a/testing-modules/junit-5-basics/pom.xml +++ b/testing-modules/junit-5-basics/pom.xml @@ -85,7 +85,6 @@ <directory>src/main/resources</directory> <filtering>true</filtering> </resource> - </resources> </build> @@ -100,7 +99,7 @@ <plugin> <artifactId>maven-surefire-plugin</artifactId> <version>${maven-surefire-plugin.version}</version> - + <configuration> <excludes> **/*IntegrationTest.java @@ -146,9 +145,8 @@ </plugins> </build> </profile> - </profiles> - + <properties> <junit.vintage.version>5.4.2</junit.vintage.version> <junit-platform.version>1.2.0</junit-platform.version> diff --git a/testing-modules/junit-5-basics/src/test/java/com/baeldung/assertexception/ExceptionAssertionUnitTest.java b/testing-modules/junit-5-basics/src/test/java/com/baeldung/assertexception/ExceptionAssertionUnitTest.java index 1b1c70d824..ee2f696408 100644 --- a/testing-modules/junit-5-basics/src/test/java/com/baeldung/assertexception/ExceptionAssertionUnitTest.java +++ b/testing-modules/junit-5-basics/src/test/java/com/baeldung/assertexception/ExceptionAssertionUnitTest.java @@ -1,23 +1,32 @@ package com.baeldung.assertexception; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; public class ExceptionAssertionUnitTest { @Test public void whenExceptionThrown_thenAssertionSucceeds() { - String test = null; - assertThrows(NullPointerException.class, () -> { - test.length(); + Exception exception = assertThrows(NumberFormatException.class, () -> { + Integer.parseInt("1a"); }); + + String expectedMessage = "For input string"; + String actualMessage = exception.getMessage(); + + assertTrue(actualMessage.contains(expectedMessage)); } @Test public void whenDerivedExceptionThrown_thenAssertionSucceds() { - String test = null; - assertThrows(RuntimeException.class, () -> { - test.length(); + Exception exception = assertThrows(RuntimeException.class, () -> { + Integer.parseInt("1a"); }); + + String expectedMessage = "For input string"; + String actualMessage = exception.getMessage(); + + assertTrue(actualMessage.contains(expectedMessage)); } } \ No newline at end of file diff --git a/testing-modules/junit-5-basics/src/test/java/com/baeldung/migration/junit4/BeforeAndAfterAnnotationsUnitTest.java b/testing-modules/junit-5-basics/src/test/java/com/baeldung/migration/junit4/BeforeAndAfterAnnotationsUnitTest.java index aa3e46defb..fac07a20ef 100644 --- a/testing-modules/junit-5-basics/src/test/java/com/baeldung/migration/junit4/BeforeAndAfterAnnotationsUnitTest.java +++ b/testing-modules/junit-5-basics/src/test/java/com/baeldung/migration/junit4/BeforeAndAfterAnnotationsUnitTest.java @@ -34,7 +34,7 @@ public class BeforeAndAfterAnnotationsUnitTest { } @Test - public void whenCheckingListSize_ThenSizeEqualsToInit() { + public void whenCheckingListSize_thenSizeEqualsToInit() { LOG.info("executing test"); assertEquals(2, list.size()); @@ -42,7 +42,7 @@ public class BeforeAndAfterAnnotationsUnitTest { } @Test - public void whenCheckingListSizeAgain_ThenSizeEqualsToInit() { + public void whenCheckingListSizeAgain_thenSizeEqualsToInit() { LOG.info("executing another test"); assertEquals(2, list.size()); diff --git a/testing-modules/junit-5/README.md b/testing-modules/junit-5/README.md index ede60c45a9..e62f2dd345 100644 --- a/testing-modules/junit-5/README.md +++ b/testing-modules/junit-5/README.md @@ -6,3 +6,4 @@ - [Running JUnit Tests Programmatically, from a Java Application](https://www.baeldung.com/junit-tests-run-programmatically-from-java) - [Testing an Abstract Class With JUnit](https://www.baeldung.com/junit-test-abstract-class) - [Guide to Dynamic Tests in JUnit 5](https://www.baeldung.com/junit5-dynamic-tests) +- [Determine the Execution Time of JUnit Tests](https://www.baeldung.com/junit-test-execution-time) diff --git a/testing-modules/junit-5/pom.xml b/testing-modules/junit-5/pom.xml index a27e4da61b..33fd0bbce8 100644 --- a/testing-modules/junit-5/pom.xml +++ b/testing-modules/junit-5/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <!-- NOT NEEDED - JSP <groupId>com.baeldung</groupId> --> <artifactId>junit-5</artifactId> @@ -30,20 +30,20 @@ <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-api</artifactId> <version>${junit.jupiter.version}</version> - </dependency> + </dependency> <dependency> <groupId>org.junit.platform</groupId> <artifactId>junit-platform-runner</artifactId> <version>${junit.platform.version}</version> <scope>test</scope> </dependency> - <dependency> + <dependency> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> <version>${junit.vintage.version}</version> <scope>test</scope> </dependency> - <dependency> + <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-migrationsupport</artifactId> <version>${junit.vintage.version}</version> @@ -131,6 +131,7 @@ </plugin> </plugins> </build> + <properties> <junit.jupiter.version>5.4.2</junit.jupiter.version> <mockito.junit.jupiter.version>2.23.0</mockito.junit.jupiter.version> diff --git a/testing-modules/junit5-annotations/pom.xml b/testing-modules/junit5-annotations/pom.xml index c8abfe909d..080844c30b 100644 --- a/testing-modules/junit5-annotations/pom.xml +++ b/testing-modules/junit5-annotations/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>junit5-annotations</artifactId> <version>1.0-SNAPSHOT</version> diff --git a/testing-modules/junit5-migration/pom.xml b/testing-modules/junit5-migration/pom.xml index 536953afc8..3b2663d81d 100644 --- a/testing-modules/junit5-migration/pom.xml +++ b/testing-modules/junit5-migration/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>junit5-migration</artifactId> <version>1.0-SNAPSHOT</version> diff --git a/testing-modules/load-testing-comparison/pom.xml b/testing-modules/load-testing-comparison/pom.xml index 8441eb3db7..1143ecb9ac 100644 --- a/testing-modules/load-testing-comparison/pom.xml +++ b/testing-modules/load-testing-comparison/pom.xml @@ -4,11 +4,11 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>load-testing-comparison</artifactId> - <name>load-testing-comparison</name> - + <name>load-testing-comparison</name> + <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-boot-2</relativePath> </parent> @@ -65,13 +65,13 @@ <build> <!--<testSourceDirectory>src/test/scala</testSourceDirectory>--> <!--<pluginManagement>--> - <!--<plugins>--> - <!--<plugin>--> - <!--<groupId>net.alchim31.maven</groupId>--> - <!--<artifactId>scala-maven-plugin</artifactId>--> - <!--<version>${scala-maven-plugin.version}</version>--> - <!--</plugin>--> - <!--</plugins>--> + <!--<plugins>--> + <!--<plugin>--> + <!--<groupId>net.alchim31.maven</groupId>--> + <!--<artifactId>scala-maven-plugin</artifactId>--> + <!--<version>${scala-maven-plugin.version}</version>--> + <!--</plugin>--> + <!--</plugins>--> <!--</pluginManagement>--> <plugins> <plugin> @@ -80,40 +80,40 @@ <version>2.0.5.RELEASE</version> </plugin> <!--<plugin>--> - <!--<groupId>net.alchim31.maven</groupId>--> - <!--<artifactId>scala-maven-plugin</artifactId>--> - <!--<executions>--> - <!--<execution>--> - <!--<goals>--> - <!--<goal>testCompile</goal>--> - <!--</goals>--> - <!--<configuration>--> - <!--<args>--> - <!--<!–<arg>-Ybackend:GenBCode</arg> –>--> - <!--<arg>-Ydelambdafy:method</arg>--> - <!--<arg>-target:jvm-1.8</arg>--> - <!--<arg>-deprecation</arg>--> - <!--<arg>-feature</arg>--> - <!--<arg>-unchecked</arg>--> - <!--<arg>-language:implicitConversions</arg>--> - <!--<arg>-language:postfixOps</arg>--> - <!--</args>--> - <!--</configuration>--> - <!--</execution>--> - <!--</executions>--> + <!--<groupId>net.alchim31.maven</groupId>--> + <!--<artifactId>scala-maven-plugin</artifactId>--> + <!--<executions>--> + <!--<execution>--> + <!--<goals>--> + <!--<goal>testCompile</goal>--> + <!--</goals>--> + <!--<configuration>--> + <!--<args>--> + <!--<!–<arg>-Ybackend:GenBCode</arg> –>--> + <!--<arg>-Ydelambdafy:method</arg>--> + <!--<arg>-target:jvm-1.8</arg>--> + <!--<arg>-deprecation</arg>--> + <!--<arg>-feature</arg>--> + <!--<arg>-unchecked</arg>--> + <!--<arg>-language:implicitConversions</arg>--> + <!--<arg>-language:postfixOps</arg>--> + <!--</args>--> + <!--</configuration>--> + <!--</execution>--> + <!--</executions>--> <!--</plugin>--> <!--<plugin>--> - <!--<groupId>io.gatling</groupId>--> - <!--<artifactId>gatling-maven-plugin</artifactId>--> - <!--<version>${gatling-maven-plugin.version}</version>--> - <!--<executions>--> - <!--<execution>--> - <!--<phase>test</phase>--> - <!--<goals>--> - <!--<goal>execute</goal>--> - <!--</goals>--> - <!--</execution>--> - <!--</executions>--> + <!--<groupId>io.gatling</groupId>--> + <!--<artifactId>gatling-maven-plugin</artifactId>--> + <!--<version>${gatling-maven-plugin.version}</version>--> + <!--<executions>--> + <!--<execution>--> + <!--<phase>test</phase>--> + <!--<goals>--> + <!--<goal>execute</goal>--> + <!--</goals>--> + <!--</execution>--> + <!--</executions>--> <!--</plugin>--> </plugins> </build> @@ -128,5 +128,5 @@ <gatling-maven-plugin.version>2.2.1</gatling-maven-plugin.version> <!--2.2.1 --> <!--2.2.4 --> <jmeter.version>5.0</jmeter.version> </properties> - + </project> diff --git a/testing-modules/mockito-2/pom.xml b/testing-modules/mockito-2/pom.xml index e319dd9edd..76608a3039 100644 --- a/testing-modules/mockito-2/pom.xml +++ b/testing-modules/mockito-2/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>mockito-2</artifactId> <version>0.0.1-SNAPSHOT</version> <name>mockito-2</name> @@ -17,4 +17,5 @@ <properties> <mockito.version>2.21.0</mockito.version> </properties> + </project> diff --git a/testing-modules/mockito/pom.xml b/testing-modules/mockito/pom.xml index e0f32d88bf..0fb11d23ab 100644 --- a/testing-modules/mockito/pom.xml +++ b/testing-modules/mockito/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>mockito</artifactId> <version>0.1-SNAPSHOT</version> <name>mockito</name> @@ -14,7 +14,6 @@ </parent> <dependencies> - <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> @@ -83,9 +82,9 @@ </build> <properties> - <spring-boot.version>2.0.4.RELEASE</spring-boot.version> - <spring-framework.version>5.0.8.RELEASE</spring-framework.version> - <spring-data.version>2.0.9.RELEASE</spring-data.version> + <spring-boot.version>2.0.4.RELEASE</spring-boot.version> + <spring-framework.version>5.0.8.RELEASE</spring-framework.version> + <spring-data.version>2.0.9.RELEASE</spring-data.version> <!-- util --> <guava.version>19.0</guava.version> diff --git a/testing-modules/mockito/src/test/java/com/baeldung/mockito/MockitoInitWithMockitoJUnitRuleUnitTest.java b/testing-modules/mockito/src/test/java/com/baeldung/mockito/MockitoInitWithMockitoJUnitRuleUnitTest.java new file mode 100644 index 0000000000..1bbe13ec84 --- /dev/null +++ b/testing-modules/mockito/src/test/java/com/baeldung/mockito/MockitoInitWithMockitoJUnitRuleUnitTest.java @@ -0,0 +1,28 @@ +package com.baeldung.mockito; + +import org.junit.Rule; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnit; +import org.mockito.junit.MockitoRule; + +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.when; + +public class MockitoInitWithMockitoJUnitRuleUnitTest { + + @Rule + public MockitoRule initRule = MockitoJUnit.rule(); + + @Mock + private List<String> mockedList; + + @Test + public void whenUsingMockitoJUnitRule_thenMocksInitialized() { + when(mockedList.size()).thenReturn(41); + + assertThat(mockedList.size()).isEqualTo(41); + } +} diff --git a/testing-modules/mocks/pom.xml b/testing-modules/mocks/pom.xml index cbda386af8..abaf313dc5 100644 --- a/testing-modules/mocks/pom.xml +++ b/testing-modules/mocks/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> diff --git a/testing-modules/mockserver/pom.xml b/testing-modules/mockserver/pom.xml index 1db409bd7c..6d553f4b90 100644 --- a/testing-modules/mockserver/pom.xml +++ b/testing-modules/mockserver/pom.xml @@ -1,12 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>mockserver</artifactId> <version>1.0.0-SNAPSHOT</version> - <name>mockserver</name> - + <name>mockserver</name> + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> diff --git a/testing-modules/parallel-tests-junit/math-test-functions/pom.xml b/testing-modules/parallel-tests-junit/math-test-functions/pom.xml index cc9f27de05..ba645d00ff 100644 --- a/testing-modules/parallel-tests-junit/math-test-functions/pom.xml +++ b/testing-modules/parallel-tests-junit/math-test-functions/pom.xml @@ -1,52 +1,52 @@ -<?xml version="1.0"?> -<project - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" - xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <modelVersion>4.0.0</modelVersion> - <artifactId>math-test-functions</artifactId> - <name>math-test-functions</name> - <url>http://maven.apache.org</url> +<?xml version="1.0" encoding="UTF-8"?> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + <artifactId>math-test-functions</artifactId> + <name>math-test-functions</name> + <url>http://maven.apache.org</url> - <parent> - <groupId>com.baeldung</groupId> - <artifactId>parallel-tests-junit</artifactId> - <version>0.0.1-SNAPSHOT</version> - </parent> + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parallel-tests-junit</artifactId> + <version>0.0.1-SNAPSHOT</version> + </parent> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>${junit.version}</version> - <scope>test</scope> - </dependency> - </dependencies> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>${junit.version}</version> + <scope>test</scope> + </dependency> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>2.22.0</version> - <configuration> - <parallel>all</parallel> - <threadCount>10</threadCount> - <threadCountSuites>2</threadCountSuites> - <threadCountClasses>2</threadCountClasses> - <threadCountMethods>6</threadCountMethods> - <parallelTestTimeoutInSeconds>3.5</parallelTestTimeoutInSeconds> - <parallelTestTimeoutForcedInSeconds>5</parallelTestTimeoutForcedInSeconds> - <perCoreThreadCount>true</perCoreThreadCount> - <includes> - <include>FunctionTestSuite.class</include> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>2.22.0</version> + <configuration> + <parallel>all</parallel> + <threadCount>10</threadCount> + <threadCountSuites>2</threadCountSuites> + <threadCountClasses>2</threadCountClasses> + <threadCountMethods>6</threadCountMethods> + <parallelTestTimeoutInSeconds>3.5</parallelTestTimeoutInSeconds> + <parallelTestTimeoutForcedInSeconds>5</parallelTestTimeoutForcedInSeconds> + <perCoreThreadCount>true</perCoreThreadCount> + <includes> + <include>FunctionTestSuite.class</include> + </includes> + </configuration> + </plugin> + </plugins> + </build> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> </project> diff --git a/testing-modules/parallel-tests-junit/pom.xml b/testing-modules/parallel-tests-junit/pom.xml index 993974046c..f9c47c827c 100644 --- a/testing-modules/parallel-tests-junit/pom.xml +++ b/testing-modules/parallel-tests-junit/pom.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>parallel-tests-junit</artifactId> <version>0.0.1-SNAPSHOT</version> <name>parallel-tests-junit</name> @@ -13,7 +13,7 @@ <version>0.0.1-SNAPSHOT</version> <relativePath>../../parent-java</relativePath> </parent> - + <modules> <module>math-test-functions</module> <module>string-test-functions</module> diff --git a/testing-modules/parallel-tests-junit/string-test-functions/pom.xml b/testing-modules/parallel-tests-junit/string-test-functions/pom.xml index b0c0ed29fc..984dd64ce4 100644 --- a/testing-modules/parallel-tests-junit/string-test-functions/pom.xml +++ b/testing-modules/parallel-tests-junit/string-test-functions/pom.xml @@ -1,44 +1,44 @@ -<?xml version="1.0"?> -<project - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" - xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <modelVersion>4.0.0</modelVersion> - <artifactId>string-test-functions</artifactId> - <name>string-test-functions</name> - <url>http://maven.apache.org</url> +<?xml version="1.0" encoding="UTF-8"?> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + <artifactId>string-test-functions</artifactId> + <name>string-test-functions</name> + <url>http://maven.apache.org</url> - <parent> - <groupId>com.baeldung</groupId> - <artifactId>parallel-tests-junit</artifactId> - <version>0.0.1-SNAPSHOT</version> - </parent> + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parallel-tests-junit</artifactId> + <version>0.0.1-SNAPSHOT</version> + </parent> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>${junit.version}</version> - <scope>test</scope> - </dependency> - </dependencies> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>${junit.version}</version> + <scope>test</scope> + </dependency> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>2.22.0</version> - <configuration> - <parallel>all</parallel> - <useUnlimitedThreads>true</useUnlimitedThreads> - <threadCountMethods>2</threadCountMethods> - </configuration> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>2.22.0</version> + <configuration> + <parallel>all</parallel> + <useUnlimitedThreads>true</useUnlimitedThreads> + <threadCountMethods>2</threadCountMethods> + </configuration> + </plugin> + </plugins> + </build> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> </project> diff --git a/testing-modules/pom.xml b/testing-modules/pom.xml index aad709cfe9..f4a8368581 100644 --- a/testing-modules/pom.xml +++ b/testing-modules/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>testing-modules</artifactId> <name>testing-modules</name> @@ -41,4 +41,5 @@ <module>junit-4</module> <module>testing-libraries</module> </modules> + </project> diff --git a/testing-modules/rest-assured/pom.xml b/testing-modules/rest-assured/pom.xml index 75f33c26f1..74935bcf6f 100644 --- a/testing-modules/rest-assured/pom.xml +++ b/testing-modules/rest-assured/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>rest-assured</artifactId> <version>1.0</version> <name>rest-assured</name> @@ -213,7 +213,7 @@ <rest-assured.version>3.0.1</rest-assured.version> <rest-assured-json-schema-validator.version>3.0.1</rest-assured-json-schema-validator.version> - + <scribejava.version>2.5.3</scribejava.version> </properties> diff --git a/testing-modules/rest-testing/pom.xml b/testing-modules/rest-testing/pom.xml index a1995ce9ff..1e8a27afa5 100644 --- a/testing-modules/rest-testing/pom.xml +++ b/testing-modules/rest-testing/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>rest-testing</artifactId> <version>0.1-SNAPSHOT</version> <name>rest-testing</name> @@ -105,9 +105,9 @@ <filtering>true</filtering> </resource> </resources> - + <plugins> - <plugin> + <plugin> <artifactId>maven-failsafe-plugin</artifactId> <version>${maven-failsafe-plugin.version}</version> <configuration> @@ -122,27 +122,27 @@ </goals> </execution> </executions> - </plugin> + </plugin> <plugin> - <groupId>com.github.temyers</groupId> - <artifactId>cucumber-jvm-parallel-plugin</artifactId> - <version>5.0.0</version> - <executions> - <execution> - <id>generateRunners</id> - <phase>generate-test-sources</phase> - <goals> - <goal>generateRunners</goal> - </goals> - <configuration> - <glue> - <package>com.baeldung.rest.cucumber</package> - </glue> - <featuresDirectory>src/test/resources/Feature/</featuresDirectory> - <parallelScheme>SCENARIO</parallelScheme> - </configuration> - </execution> - </executions> + <groupId>com.github.temyers</groupId> + <artifactId>cucumber-jvm-parallel-plugin</artifactId> + <version>5.0.0</version> + <executions> + <execution> + <id>generateRunners</id> + <phase>generate-test-sources</phase> + <goals> + <goal>generateRunners</goal> + </goals> + <configuration> + <glue> + <package>com.baeldung.rest.cucumber</package> + </glue> + <featuresDirectory>src/test/resources/Feature/</featuresDirectory> + <parallelScheme>SCENARIO</parallelScheme> + </configuration> + </execution> + </executions> </plugin> </plugins> diff --git a/testing-modules/rest-testing/src/test/java/com/baeldung/rest/karate/KarateIntegrationTest.java b/testing-modules/rest-testing/src/test/java/com/baeldung/rest/karate/KarateIntegrationTest.java index 1a0b46f41f..5da2784179 100644 --- a/testing-modules/rest-testing/src/test/java/com/baeldung/rest/karate/KarateIntegrationTest.java +++ b/testing-modules/rest-testing/src/test/java/com/baeldung/rest/karate/KarateIntegrationTest.java @@ -1,6 +1,7 @@ package com.baeldung.rest.karate; import com.github.tomakehurst.wiremock.WireMockServer; +import com.github.tomakehurst.wiremock.core.WireMockConfiguration; import com.intuit.karate.junit4.Karate; import cucumber.api.CucumberOptions; import org.junit.AfterClass; @@ -14,13 +15,15 @@ import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; @CucumberOptions(features = "classpath:karate") public class KarateIntegrationTest { - private static final WireMockServer wireMockServer = new WireMockServer(); + private static final int PORT_NUMBER = 8097; + + private static final WireMockServer wireMockServer = new WireMockServer(WireMockConfiguration.options().port(PORT_NUMBER)); @BeforeClass public static void setUp() throws Exception { wireMockServer.start(); - configureFor("localhost", 8080); + configureFor("localhost", PORT_NUMBER); stubFor(get(urlEqualTo("/user/get")) .willReturn(aResponse() .withStatus(200) diff --git a/testing-modules/rest-testing/src/test/resources/karate/user.feature b/testing-modules/rest-testing/src/test/resources/karate/user.feature index d9f0f12a9c..33c57f28cb 100644 --- a/testing-modules/rest-testing/src/test/resources/karate/user.feature +++ b/testing-modules/rest-testing/src/test/resources/karate/user.feature @@ -1,41 +1,41 @@ Feature: Testing a REST API with Karate Scenario: Testing valid GET endpoint - Given url 'http://localhost:8080/user/get' + Given url 'http://localhost:8097/user/get' When method GET Then status 200 Scenario: Testing an invalid GET endpoint - 404 - Given url 'http://localhost:8080/user/wrong' + Given url 'http://localhost:8097/user/wrong' When method GET Then status 404 Scenario: Testing the exact response of a GET endpoint - Given url 'http://localhost:8080/user/get' + Given url 'http://localhost:8097/user/get' When method GET Then status 200 And match $ == {id:"1234",name:"John Smith"} Scenario: Testing the exact response field value of a GET endpoint - Given url 'http://localhost:8080/user/get' + Given url 'http://localhost:8097/user/get' When method GET Then status 200 And match $.id == "1234" Scenario: Testing that GET response contains specific field - Given url 'http://localhost:8080/user/get' + Given url 'http://localhost:8097/user/get' When method GET Then status 200 And match $ contains {id:"1234"} Scenario: Test GET response using markers - Given url 'http://localhost:8080/user/get' + Given url 'http://localhost:8097/user/get' When method GET Then status 200 And match $ == {id:"#notnull",name:"John Smith"} Scenario: Testing a POST endpoint with request body - Given url 'http://localhost:8080/user/create' + Given url 'http://localhost:8097/user/create' And request { id: '1234' , name: 'John Smith'} When method POST Then status 200 diff --git a/testing-modules/selenium-junit-testng/pom.xml b/testing-modules/selenium-junit-testng/pom.xml index ae15fc97c0..0616cdaa29 100644 --- a/testing-modules/selenium-junit-testng/pom.xml +++ b/testing-modules/selenium-junit-testng/pom.xml @@ -1,11 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>selenium-junit-testng</artifactId> <version>0.0.1-SNAPSHOT</version> - <name>selenium-junit-testng</name> - + <name>selenium-junit-testng</name> + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> @@ -45,7 +45,7 @@ <build> <sourceDirectory>src</sourceDirectory> </build> - + <profiles> <profile> <id>live</id> @@ -70,4 +70,5 @@ <testng.version>6.10</testng.version> <selenium-java.version>3.4.0</selenium-java.version> </properties> + </project> \ No newline at end of file diff --git a/testing-modules/spring-testing/pom.xml b/testing-modules/spring-testing/pom.xml index 15431cfb77..22f5f68240 100644 --- a/testing-modules/spring-testing/pom.xml +++ b/testing-modules/spring-testing/pom.xml @@ -1,6 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.baeldung</groupId> <artifactId>spring-testing</artifactId> @@ -15,7 +16,6 @@ </parent> <dependencies> - <dependency> <groupId>org.hamcrest</groupId> <artifactId>java-hamcrest</artifactId> @@ -110,7 +110,6 @@ <filtering>true</filtering> </resource> </resources> - </build> <properties> diff --git a/testing-modules/test-containers/pom.xml b/testing-modules/test-containers/pom.xml index bd87cb5b22..e83d3aff32 100644 --- a/testing-modules/test-containers/pom.xml +++ b/testing-modules/test-containers/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <!-- NOT NEEDED - JSP <groupId>com.baeldung</groupId> --> @@ -28,7 +28,7 @@ <artifactId>junit-platform-commons</artifactId> <version>${junit.platform.version}</version> <scope>test</scope> - </dependency> + </dependency> <dependency> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> @@ -47,12 +47,12 @@ </dependency> <dependency> <groupId>org.testcontainers</groupId> - <artifactId>postgresql </artifactId> + <artifactId>postgresql</artifactId> <version>${testcontainers.version}</version> </dependency> <dependency> <groupId>org.testcontainers</groupId> - <artifactId>selenium </artifactId> + <artifactId>selenium</artifactId> <version>${testcontainers.version}</version> </dependency> <dependency> @@ -69,7 +69,7 @@ <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-chrome-driver</artifactId> <version>${selenium-remote-driver.version}</version> - </dependency> + </dependency> </dependencies> <build> diff --git a/testing-modules/testing-libraries/pom.xml b/testing-modules/testing-libraries/pom.xml index 0838e81d14..53b58cee17 100644 --- a/testing-modules/testing-libraries/pom.xml +++ b/testing-modules/testing-libraries/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>testing-libraries</artifactId> <name>testing-libraries</name> @@ -18,19 +18,20 @@ <version>${lambda-behave.version}</version> </dependency> <dependency> - <groupId>info.cukes</groupId> + <groupId>io.cucumber</groupId> <artifactId>cucumber-junit</artifactId> <version>${cucumber.version}</version> <scope>test</scope> </dependency> <dependency> - <groupId>info.cukes</groupId> + <groupId>io.cucumber</groupId> <artifactId>cucumber-java</artifactId> <version>${cucumber.version}</version> <scope>test</scope> </dependency> + <dependency> - <groupId>info.cukes</groupId> + <groupId>io.cucumber</groupId> <artifactId>cucumber-java8</artifactId> <version>${cucumber.version}</version> <scope>test</scope> @@ -87,9 +88,8 @@ <properties> <lambda-behave.version>0.4</lambda-behave.version> - <cucumber.version>1.2.5</cucumber.version> + <cucumber.version>4.8.0</cucumber.version> <checkstyle-maven-plugin.version>3.0.0</checkstyle-maven-plugin.version> </properties> - </project> diff --git a/testing-modules/testing-libraries/src/main/java/com/baeldung/cucumber/books/Book.java b/testing-modules/testing-libraries/src/main/java/com/baeldung/cucumber/books/Book.java new file mode 100644 index 0000000000..f83623445b --- /dev/null +++ b/testing-modules/testing-libraries/src/main/java/com/baeldung/cucumber/books/Book.java @@ -0,0 +1,35 @@ +package com.baeldung.cucumber.books; + +public class Book { + + private String title; + private String author; + + public Book(String title, String author) { + this.title = title; + this.author = author; + } + + public Book() {} + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + + @Override + public String toString() { + return "Book [title=" + title + ", author=" + author + "]"; + } +} diff --git a/testing-modules/testing-libraries/src/main/java/com/baeldung/cucumber/books/BookCatalog.java b/testing-modules/testing-libraries/src/main/java/com/baeldung/cucumber/books/BookCatalog.java new file mode 100644 index 0000000000..69fa8e3160 --- /dev/null +++ b/testing-modules/testing-libraries/src/main/java/com/baeldung/cucumber/books/BookCatalog.java @@ -0,0 +1,22 @@ +package com.baeldung.cucumber.books; + +import java.util.ArrayList; +import java.util.List; + +public class BookCatalog { + + private List<Book> books = new ArrayList<>(); + + public void addBook(Book book) { + books.add(book); + } + + public List<Book> getBooks() { + return books; + } + + @Override + public String toString() { + return "BookCatalog [books=" + books + "]"; + } +} diff --git a/testing-modules/testing-libraries/src/main/java/com/baeldung/cucumber/books/BookStore.java b/testing-modules/testing-libraries/src/main/java/com/baeldung/cucumber/books/BookStore.java new file mode 100644 index 0000000000..da9b711a16 --- /dev/null +++ b/testing-modules/testing-libraries/src/main/java/com/baeldung/cucumber/books/BookStore.java @@ -0,0 +1,22 @@ +package com.baeldung.cucumber.books; + +import java.util.*; +import java.util.stream.Collectors; + +public class BookStore { + private List<Book> books = new ArrayList<>(); + + public void addBook(Book book) { + books.add(book); + } + + public void addAllBooks(Collection<Book> books) { + this.books.addAll(books); + } + + public List<Book> booksByAuthor(String author) { + return books.stream() + .filter(book -> Objects.equals(author, book.getAuthor())) + .collect(Collectors.toList()); + } +} diff --git a/testing-modules/testing-libraries/src/main/java/com/baeldung/cucumberbackground/books/Book.java b/testing-modules/testing-libraries/src/main/java/com/baeldung/cucumberbackground/books/Book.java new file mode 100644 index 0000000000..5fd1e680a0 --- /dev/null +++ b/testing-modules/testing-libraries/src/main/java/com/baeldung/cucumberbackground/books/Book.java @@ -0,0 +1,35 @@ +package com.baeldung.cucumberbackground.books; + +public class Book { + + private String title; + private String author; + + public Book(String title, String author) { + this.title = title; + this.author = author; + } + + public Book() {} + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + + @Override + public String toString() { + return "Book [title=" + title + ", author=" + author + "]"; + } +} diff --git a/testing-modules/testing-libraries/src/main/java/com/baeldung/cucumberbackground/books/BookStore.java b/testing-modules/testing-libraries/src/main/java/com/baeldung/cucumberbackground/books/BookStore.java new file mode 100644 index 0000000000..f22eecb5f3 --- /dev/null +++ b/testing-modules/testing-libraries/src/main/java/com/baeldung/cucumberbackground/books/BookStore.java @@ -0,0 +1,28 @@ +package com.baeldung.cucumberbackground.books; + +import java.util.*; +import java.util.stream.Collectors; + +public class BookStore { + private List<Book> books = new ArrayList<>(); + + public void addBook(Book book) { + books.add(book); + } + + public void addAllBooks(Collection<Book> books) { + this.books.addAll(books); + } + + public List<Book> booksByAuthor(String author) { + return books.stream() + .filter(book -> Objects.equals(author, book.getAuthor())) + .collect(Collectors.toList()); + } + + public Optional<Book> bookByTitle(String title) { + return books.stream() + .filter(book -> book.getTitle().equals(title)) + .findFirst(); + } +} diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/calculator/CalculatorIntegrationTest.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/calculator/CalculatorIntegrationTest.java index 00f666db2d..04b6357fce 100644 --- a/testing-modules/testing-libraries/src/test/java/com/baeldung/calculator/CalculatorIntegrationTest.java +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/calculator/CalculatorIntegrationTest.java @@ -1,14 +1,14 @@ package com.baeldung.calculator; -import cucumber.api.CucumberOptions; -import cucumber.api.junit.Cucumber; import org.junit.runner.RunWith; +import io.cucumber.junit.Cucumber; +import io.cucumber.junit.CucumberOptions; + @RunWith(Cucumber.class) @CucumberOptions( features = {"classpath:features/calculator.feature", "classpath:features/calculator-scenario-outline.feature"} , plugin = {"pretty", "json:target/reports/json/calculator.json"} - , glue = {"com.baeldung.cucumber.calculator"} ) public class CalculatorIntegrationTest { } diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/calculator/CalculatorRunSteps.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/calculator/CalculatorRunSteps.java index 7eda618566..1bf0c0eccd 100644 --- a/testing-modules/testing-libraries/src/test/java/com/baeldung/calculator/CalculatorRunSteps.java +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/calculator/CalculatorRunSteps.java @@ -1,13 +1,15 @@ package com.baeldung.calculator; -import com.baeldung.cucumber.Calculator; -import cucumber.api.java.Before; -import cucumber.api.java.en.Given; -import cucumber.api.java.en.Then; -import cucumber.api.java.en.When; import org.hamcrest.Matchers; import org.junit.Assert; +import com.baeldung.cucumber.Calculator; + +import io.cucumber.java.Before; +import io.cucumber.java.en.Given; +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; + public class CalculatorRunSteps { private int total; diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreIntegrationTest.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreIntegrationTest.java new file mode 100644 index 0000000000..5ed2700af8 --- /dev/null +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreIntegrationTest.java @@ -0,0 +1,13 @@ +package com.baeldung.cucumber.books; + +import org.junit.runner.RunWith; + +import io.cucumber.junit.Cucumber; +import io.cucumber.junit.CucumberOptions; + +@RunWith(Cucumber.class) +@CucumberOptions(features = "classpath:features/book-store.feature") +public class BookStoreIntegrationTest { + +} + diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRegistryConfigurer.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRegistryConfigurer.java new file mode 100644 index 0000000000..12de1ae71e --- /dev/null +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRegistryConfigurer.java @@ -0,0 +1,42 @@ +package com.baeldung.cucumber.books; + +import java.util.Locale; + +import io.cucumber.core.api.TypeRegistry; +import io.cucumber.core.api.TypeRegistryConfigurer; +import io.cucumber.datatable.DataTable; +import io.cucumber.datatable.DataTableType; +import io.cucumber.datatable.TableTransformer; + +public class BookStoreRegistryConfigurer implements TypeRegistryConfigurer { + + @Override + public Locale locale() { + return Locale.ENGLISH; + } + + @Override + public void configureTypeRegistry(TypeRegistry typeRegistry) { + typeRegistry.defineDataTableType( + new DataTableType(BookCatalog.class, new BookTableTransformer()) + ); + } + + private static class BookTableTransformer implements TableTransformer<BookCatalog> { + + @Override + public BookCatalog transform(DataTable table) throws Throwable { + + BookCatalog catalog = new BookCatalog(); + + table.cells() + .stream() + .skip(1) // Skip header row + .map(fields -> new Book(fields.get(0), fields.get(1))) + .forEach(catalog::addBook); + + return catalog; + } + + } +} diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRunSteps.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRunSteps.java new file mode 100644 index 0000000000..a0c759ab26 --- /dev/null +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRunSteps.java @@ -0,0 +1,73 @@ +package com.baeldung.cucumber.books; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import io.cucumber.java.Before; +import io.cucumber.java.en.Given; +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; +import io.cucumber.datatable.DataTable; + +import static org.junit.Assert.*; + +public class BookStoreRunSteps { + private BookStore store; + private List<Book> foundBooks; + private Book foundBook; + + @Before + public void setUp() { + store = new BookStore(); + foundBooks = new ArrayList<>(); + } + + @Given("^I have the following books in the store$") + public void haveBooksInTheStore(DataTable table) { + haveBooksInTheStoreByList(table); + } + + @Given("^I have the following books in the store by list$") + public void haveBooksInTheStoreByList(DataTable table) { + List<List<String>> rows = table.asLists(String.class); + + for (List<String> columns: rows) { + store.addBook(new Book(columns.get(0), columns.get(1))); + } + } + + @Given("^I have the following books in the store by map$") + public void haveBooksInTheStoreByMap(DataTable table) { + List<Map<String, String>> rows = table.asMaps(String.class, String.class); + + for (Map<String, String> columns: rows) { + store.addBook(new Book(columns.get("title"), columns.get("author"))); + } + } + + @Given("^I have the following books in the store with transformer$") + public void haveBooksInTheStoreByTransformer(BookCatalog catalog) { + store.addAllBooks(catalog.getBooks()); + } + + @When("^I search for books by author (.+)$") + public void searchForBooksByAuthor(String author) { + foundBooks = store.booksByAuthor(author); + } + + @Then("^I find (\\d+) books$") + public void findBooks(int count) { + assertEquals(count, foundBooks.size()); + } + + @Then("^I find a book$") + public void findABook() { + assertNotNull(foundBook); + } + + @Then("^I find no book$") + public void findNoBook() { + assertNull(foundBook); + } +} diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumberbackground/books/BookStoreRunSteps.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumberbackground/books/BookStoreRunSteps.java new file mode 100644 index 0000000000..981fe41f11 --- /dev/null +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumberbackground/books/BookStoreRunSteps.java @@ -0,0 +1,58 @@ +package com.baeldung.cucumberbackground.books; + +import io.cucumber.datatable.DataTable; +import io.cucumber.java.Before; +import io.cucumber.java.en.Given; +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.Assert.*; + +public class BookStoreRunSteps { + private BookStore store; + private List<Book> foundBooks; + private Book foundBook; + + @Before + public void setUp() { + store = new BookStore(); + foundBooks = new ArrayList<>(); + } + + @Given("^I have the following books in the store$") + public void haveBooksInTheStore(DataTable table) { + List<List<String>> rows = table.asLists(String.class); + + for (List<String> columns: rows) { + store.addBook(new Book(columns.get(0), columns.get(1))); + } + } + + @When("^I search for books by author (.+)$") + public void searchForBooksByAuthor(String author) { + foundBooks = store.booksByAuthor(author); + } + + @When("^I search for a book titled (.+)$") + public void searchForBookByTitle(String title) { + foundBook = store.bookByTitle(title).orElse(null); + } + + @Then("^I find (\\d+) books$") + public void findBooks(int count) { + assertEquals(count, foundBooks.size()); + } + + @Then("^I find a book$") + public void findABook() { + assertNotNull(foundBook); + } + + @Then("^I find no book$") + public void findNoBook() { + assertNull(foundBook); + } +} diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumberbackground/books/BookStoreWithBackgroundIntegrationTest.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumberbackground/books/BookStoreWithBackgroundIntegrationTest.java new file mode 100644 index 0000000000..528ccbc882 --- /dev/null +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumberbackground/books/BookStoreWithBackgroundIntegrationTest.java @@ -0,0 +1,12 @@ +package com.baeldung.cucumberbackground.books; + +import io.cucumber.junit.Cucumber; +import io.cucumber.junit.CucumberOptions; +import org.junit.runner.RunWith; + +@RunWith(Cucumber.class) +@CucumberOptions(features = "classpath:features/book-store-with-background.feature") +public class BookStoreWithBackgroundIntegrationTest { + +} + diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumberbackground/books/BookStoreWithoutBackgroundIntegrationTest.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumberbackground/books/BookStoreWithoutBackgroundIntegrationTest.java new file mode 100644 index 0000000000..6343a52cdc --- /dev/null +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumberbackground/books/BookStoreWithoutBackgroundIntegrationTest.java @@ -0,0 +1,12 @@ +package com.baeldung.cucumberbackground.books; + +import io.cucumber.junit.Cucumber; +import io.cucumber.junit.CucumberOptions; +import org.junit.runner.RunWith; + +@RunWith(Cucumber.class) +@CucumberOptions(features = "classpath:features/book-store-without-background.feature") +public class BookStoreWithoutBackgroundIntegrationTest { + +} + diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/shopping/ShoppingIntegrationTest.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/shopping/ShoppingIntegrationTest.java index 20fd65b02a..145b29a468 100644 --- a/testing-modules/testing-libraries/src/test/java/com/baeldung/shopping/ShoppingIntegrationTest.java +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/shopping/ShoppingIntegrationTest.java @@ -2,8 +2,9 @@ package com.baeldung.shopping; import org.junit.runner.RunWith; -import cucumber.api.CucumberOptions; -import cucumber.api.junit.Cucumber; +import io.cucumber.junit.Cucumber; +import io.cucumber.junit.CucumberOptions; + @RunWith(Cucumber.class) @CucumberOptions(features = { "classpath:features/shopping.feature" }) diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/shopping/ShoppingStepsDef.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/shopping/ShoppingStepsDef.java index c56ec95883..7a70eea951 100644 --- a/testing-modules/testing-libraries/src/test/java/com/baeldung/shopping/ShoppingStepsDef.java +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/shopping/ShoppingStepsDef.java @@ -1,7 +1,8 @@ package com.baeldung.shopping; import static org.junit.Assert.assertEquals; -import cucumber.api.java8.En; + +import io.cucumber.java8.En; public class ShoppingStepsDef implements En { diff --git a/testing-modules/testing-libraries/src/test/resources/features/book-store-with-background.feature b/testing-modules/testing-libraries/src/test/resources/features/book-store-with-background.feature new file mode 100644 index 0000000000..61bcdc5c50 --- /dev/null +++ b/testing-modules/testing-libraries/src/test/resources/features/book-store-with-background.feature @@ -0,0 +1,22 @@ +Feature: Book Store With Background + Background: The Book Store + Given I have the following books in the store + | The Devil in the White City | Erik Larson | + | The Lion, the Witch and the Wardrobe | C.S. Lewis | + | In the Garden of Beasts | Erik Larson | + + Scenario: Find books by author + When I search for books by author Erik Larson + Then I find 2 books + + Scenario: Find books by author, but isn't there + When I search for books by author Marcel Proust + Then I find 0 books + + Scenario: Find book by title + When I search for a book titled The Lion, the Witch and the Wardrobe + Then I find a book + + Scenario: Find book by title, but isn't there + When I search for a book titled Swann's Way + Then I find no book \ No newline at end of file diff --git a/testing-modules/testing-libraries/src/test/resources/features/book-store-without-background.feature b/testing-modules/testing-libraries/src/test/resources/features/book-store-without-background.feature new file mode 100644 index 0000000000..771c585127 --- /dev/null +++ b/testing-modules/testing-libraries/src/test/resources/features/book-store-without-background.feature @@ -0,0 +1,32 @@ +Feature: Book Store Without Background + Scenario: Find books by author + Given I have the following books in the store + | The Devil in the White City | Erik Larson | + | The Lion, the Witch and the Wardrobe | C.S. Lewis | + | In the Garden of Beasts | Erik Larson | + When I search for books by author Erik Larson + Then I find 2 books + + Scenario: Find books by author, but isn't there + Given I have the following books in the store + | The Devil in the White City | Erik Larson | + | The Lion, the Witch and the Wardrobe | C.S. Lewis | + | In the Garden of Beasts | Erik Larson | + When I search for books by author Marcel Proust + Then I find 0 books + + Scenario: Find book by title + Given I have the following books in the store + | The Devil in the White City | Erik Larson | + | The Lion, the Witch and the Wardrobe | C.S. Lewis | + | In the Garden of Beasts | Erik Larson | + When I search for a book titled The Lion, the Witch and the Wardrobe + Then I find a book + + Scenario: Find book by title, but isn't there + Given I have the following books in the store + | The Devil in the White City | Erik Larson | + | The Lion, the Witch and the Wardrobe | C.S. Lewis | + | In the Garden of Beasts | Erik Larson | + When I search for a book titled Swann's Way + Then I find no book \ No newline at end of file diff --git a/testing-modules/testing-libraries/src/test/resources/features/book-store.feature b/testing-modules/testing-libraries/src/test/resources/features/book-store.feature new file mode 100644 index 0000000000..6378477349 --- /dev/null +++ b/testing-modules/testing-libraries/src/test/resources/features/book-store.feature @@ -0,0 +1,27 @@ +Feature: Book Store + + Scenario: Correct non-zero number of books found by author by list + Given I have the following books in the store by list + | The Devil in the White City | Erik Larson | + | The Lion, the Witch and the Wardrobe | C.S. Lewis | + | In the Garden of Beasts | Erik Larson | + When I search for books by author Erik Larson + Then I find 2 books + + Scenario: Correct non-zero number of books found by author by map + Given I have the following books in the store by map + | title | author | + | The Devil in the White City | Erik Larson | + | The Lion, the Witch and the Wardrobe | C.S. Lewis | + | In the Garden of Beasts | Erik Larson | + When I search for books by author Erik Larson + Then I find 2 books + + Scenario: Correct non-zero number of books found by author with transformer + Given I have the following books in the store with transformer + | title | author | + | The Devil in the White City | Erik Larson | + | The Lion, the Witch and the Wardrobe | C.S. Lewis | + | In the Garden of Beasts | Erik Larson | + When I search for books by author Erik Larson + Then I find 2 books \ No newline at end of file diff --git a/testing-modules/testng/pom.xml b/testing-modules/testng/pom.xml index 5d0c9f126b..601b152144 100644 --- a/testing-modules/testng/pom.xml +++ b/testing-modules/testng/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>testng</artifactId> <version>0.1.0-SNAPSHOT</version> diff --git a/testing-modules/xmlunit-2/pom.xml b/testing-modules/xmlunit-2/pom.xml index aa516bfcc5..5689e680e6 100644 --- a/testing-modules/xmlunit-2/pom.xml +++ b/testing-modules/xmlunit-2/pom.xml @@ -1,8 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>xmlunit-2</artifactId> - <name>xmlunit-2</name> + <name>xmlunit-2</name> <parent> <groupId>com.baeldung</groupId> diff --git a/twilio/pom.xml b/twilio/pom.xml index 266ac45c92..76ad5faafb 100644 --- a/twilio/pom.xml +++ b/twilio/pom.xml @@ -1,16 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>twilio</artifactId> <version>1.0-SNAPSHOT</version> - <name>twilio</name> - - <parent> - <artifactId>parent-modules</artifactId> - <groupId>com.baeldung</groupId> - <version>1.0.0-SNAPSHOT</version> - </parent> + <name>twilio</name> + + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-modules</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> <dependencies> <dependency> diff --git a/twitter4j/pom.xml b/twitter4j/pom.xml index b82b9f6778..6d98e2fe58 100644 --- a/twitter4j/pom.xml +++ b/twitter4j/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>Twitter4J</artifactId> <name>Twitter4J</name> diff --git a/undertow/pom.xml b/undertow/pom.xml index 1c2cc3aa36..bed9c905c2 100644 --- a/undertow/pom.xml +++ b/undertow/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.undertow</groupId> <artifactId>undertow</artifactId> diff --git a/vaadin/pom.xml b/vaadin/pom.xml index 0cc6cd5757..9de1bec6e2 100644 --- a/vaadin/pom.xml +++ b/vaadin/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.test</groupId> <artifactId>vaadin</artifactId> @@ -9,12 +9,12 @@ <packaging>war</packaging> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> - + <dependencyManagement> <dependencies> <dependency> @@ -26,7 +26,7 @@ </dependency> </dependencies> </dependencyManagement> - + <dependencies> <dependency> <groupId>javax.servlet</groupId> diff --git a/vavr/pom.xml b/vavr/pom.xml index a2c6e29cde..16097af848 100644 --- a/vavr/pom.xml +++ b/vavr/pom.xml @@ -1,14 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>vavr</artifactId> <version>1.0</version> <name>vavr</name> <parent> - <artifactId>parent-boot-2</artifactId> <groupId>com.baeldung</groupId> + <artifactId>parent-boot-2</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent-boot-2</relativePath> </parent> diff --git a/vertx-and-rxjava/pom.xml b/vertx-and-rxjava/pom.xml index 389eaf687b..20b022a773 100644 --- a/vertx-and-rxjava/pom.xml +++ b/vertx-and-rxjava/pom.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>vertx-and-rxjava</artifactId> - <name>vertx-and-rxjava</name> - + <name>vertx-and-rxjava</name> + <parent> <groupId>com.baeldung</groupId> <artifactId>parent-modules</artifactId> diff --git a/vertx/pom.xml b/vertx/pom.xml index c566681073..81ede1ba0b 100644 --- a/vertx/pom.xml +++ b/vertx/pom.xml @@ -1,8 +1,7 @@ -<?xml version="1.0"?> +<?xml version="1.0" encoding="UTF-8"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>vertx</artifactId> <version>1.0-SNAPSHOT</version> <name>vertx</name> @@ -54,7 +53,7 @@ </manifestEntries> </transformer> </transformers> - <artifactSet /> + <artifactSet/> <outputFile>${project.build.directory}/${project.artifactId}-${project.version}-app.jar</outputFile> </configuration> </execution> diff --git a/video-tutorials/jackson-annotations/pom.xml b/video-tutorials/jackson-annotations/pom.xml index 200ca7577f..f396baf80b 100644 --- a/video-tutorials/jackson-annotations/pom.xml +++ b/video-tutorials/jackson-annotations/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>jackson-annotations</artifactId> <version>1.0.0-SNAPSHOT</version> <name>jackson-annotations</name> @@ -147,7 +147,6 @@ <assertj-core.version>3.6.1</assertj-core.version> <json-schema-validator.version>2.2.6</json-schema-validator.version> <json-path.version>3.0.1</json-path.version> - </properties> </project> \ No newline at end of file diff --git a/video-tutorials/pom.xml b/video-tutorials/pom.xml index a798f77863..53ff0c6d89 100644 --- a/video-tutorials/pom.xml +++ b/video-tutorials/pom.xml @@ -1,7 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>video-tutorials</artifactId> <version>1.0.0-SNAPSHOT</version> <name>video-tutorials</name> diff --git a/vraptor/pom.xml b/vraptor/pom.xml index 3904eb8c63..9956305e98 100644 --- a/vraptor/pom.xml +++ b/vraptor/pom.xml @@ -1,10 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.baeldung</groupId> <artifactId>vraptor</artifactId> <version>1.0.0</version> - <name>vraptor</name> + <name>vraptor</name> <packaging>war</packaging> <description>A demo project to start using VRaptor 4</description> diff --git a/webrtc/pom.xml b/webrtc/pom.xml new file mode 100644 index 0000000000..2a3b48b2ed --- /dev/null +++ b/webrtc/pom.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <artifactId>webrtc</artifactId> + <version>0.0.1</version> + + <parent> + <artifactId>parent-boot-2</artifactId> + <groupId>com.baeldung</groupId> + <version>0.0.1-SNAPSHOT</version> + <relativePath>../parent-boot-2</relativePath> + </parent> + + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-websocket</artifactId> + </dependency> + </dependencies> + + <properties> + <java.version>1.8</java.version> + </properties> + + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + </plugins> + </build> + +</project> diff --git a/webrtc/src/main/java/com/baeldung/webrtc/SocketHandler.java b/webrtc/src/main/java/com/baeldung/webrtc/SocketHandler.java new file mode 100644 index 0000000000..bffd57f6cf --- /dev/null +++ b/webrtc/src/main/java/com/baeldung/webrtc/SocketHandler.java @@ -0,0 +1,31 @@ +package com.baeldung.webrtc; + +import org.springframework.stereotype.Component; +import org.springframework.web.socket.TextMessage; +import org.springframework.web.socket.WebSocketSession; +import org.springframework.web.socket.handler.TextWebSocketHandler; + +import java.io.IOException; +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; + +@Component +public class SocketHandler extends TextWebSocketHandler { + + List<WebSocketSession> sessions = new CopyOnWriteArrayList<>(); + + @Override + public void handleTextMessage(WebSocketSession session, TextMessage message) throws InterruptedException, IOException { + + for (WebSocketSession webSocketSession : sessions) { + if (webSocketSession.isOpen() && !session.getId().equals(webSocketSession.getId())) { + webSocketSession.sendMessage(message); + } + } + } + + @Override + public void afterConnectionEstablished(WebSocketSession session) throws Exception { + sessions.add(session); + } +} \ No newline at end of file diff --git a/webrtc/src/main/java/com/baeldung/webrtc/WebRTCDemoApplication.java b/webrtc/src/main/java/com/baeldung/webrtc/WebRTCDemoApplication.java new file mode 100644 index 0000000000..f54946547d --- /dev/null +++ b/webrtc/src/main/java/com/baeldung/webrtc/WebRTCDemoApplication.java @@ -0,0 +1,12 @@ +package com.baeldung.webrtc; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class WebRTCDemoApplication { + + public static void main(String[] args) { + SpringApplication.run(WebRTCDemoApplication.class, args); + } +} diff --git a/webrtc/src/main/java/com/baeldung/webrtc/WebSocketConfiguration.java b/webrtc/src/main/java/com/baeldung/webrtc/WebSocketConfiguration.java new file mode 100644 index 0000000000..9deb395dad --- /dev/null +++ b/webrtc/src/main/java/com/baeldung/webrtc/WebSocketConfiguration.java @@ -0,0 +1,17 @@ +package com.baeldung.webrtc; + +import org.springframework.context.annotation.Configuration; +import org.springframework.web.socket.config.annotation.EnableWebSocket; +import org.springframework.web.socket.config.annotation.WebSocketConfigurer; +import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; + +@Configuration +@EnableWebSocket +public class WebSocketConfiguration implements WebSocketConfigurer { + + @Override + public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { + registry.addHandler(new SocketHandler(), "/socket") + .setAllowedOrigins("*"); + } +} diff --git a/webrtc/src/main/resources/application.properties b/webrtc/src/main/resources/application.properties new file mode 100644 index 0000000000..e69de29bb2 diff --git a/webrtc/src/main/resources/static/client.js b/webrtc/src/main/resources/static/client.js new file mode 100644 index 0000000000..059dc84bcb --- /dev/null +++ b/webrtc/src/main/resources/static/client.js @@ -0,0 +1,116 @@ +//connecting to our signaling server +var conn = new WebSocket('ws://localhost:8080/socket'); + +conn.onopen = function() { + console.log("Connected to the signaling server"); + initialize(); +}; + +conn.onmessage = function(msg) { + console.log("Got message", msg.data); + var content = JSON.parse(msg.data); + var data = content.data; + switch (content.event) { + // when somebody wants to call us + case "offer": + handleOffer(data); + break; + case "answer": + handleAnswer(data); + break; + // when a remote peer sends an ice candidate to us + case "candidate": + handleCandidate(data); + break; + default: + break; + } +}; + +function send(message) { + conn.send(JSON.stringify(message)); +} + +var peerConnection; +var dataChannel; +var input = document.getElementById("messageInput"); + +function initialize() { + var configuration = null; + + peerConnection = new RTCPeerConnection(configuration, { + optional : [ { + RtpDataChannels : true + } ] + }); + + // Setup ice handling + peerConnection.onicecandidate = function(event) { + if (event.candidate) { + send({ + event : "candidate", + data : event.candidate + }); + } + }; + + // creating data channel + dataChannel = peerConnection.createDataChannel("dataChannel", { + reliable : true + }); + + dataChannel.onerror = function(error) { + console.log("Error occured on datachannel:", error); + }; + + // when we receive a message from the other peer, printing it on the console + dataChannel.onmessage = function(event) { + console.log("message:", event.data); + }; + + dataChannel.onclose = function() { + console.log("data channel is closed"); + }; +} + +function createOffer() { + peerConnection.createOffer(function(offer) { + send({ + event : "offer", + data : offer + }); + peerConnection.setLocalDescription(offer); + }, function(error) { + alert("Error creating an offer"); + }); +} + +function handleOffer(offer) { + peerConnection.setRemoteDescription(new RTCSessionDescription(offer)); + + // create and send an answer to an offer + peerConnection.createAnswer(function(answer) { + peerConnection.setLocalDescription(answer); + send({ + event : "answer", + data : answer + }); + }, function(error) { + alert("Error creating an answer"); + }); + +}; + +function handleCandidate(candidate) { + peerConnection.addIceCandidate(new RTCIceCandidate(candidate)); +}; + +function handleAnswer(answer) { + peerConnection.setRemoteDescription(new RTCSessionDescription(answer)); + console.log("connection established successfully!!"); +}; + +function sendMessage() { + dataChannel.send(input.value); + input.value = ""; +} diff --git a/webrtc/src/main/resources/static/index.html b/webrtc/src/main/resources/static/index.html new file mode 100644 index 0000000000..39a86ec61e --- /dev/null +++ b/webrtc/src/main/resources/static/index.html @@ -0,0 +1,67 @@ +<html> + +<head> +<title>WebRTC demo</title> +<!--Bootstrap only for styling--> +<link rel="stylesheet" + href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css"> +<script + src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> +<script + src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script> +<!--Bootstrap only for styling--> +</head> +<style> +.container { + background: rgb(148, 144, 144); + margin: 50px auto; + max-width: 80%; + text-align: center; + padding: 2%; +} + +button { + margin: 1em; +} + +input { + margin-top: 1em; +} + +.footer { + background: rgb(148, 144, 144); + text-align: center; + padding: 2%; + position: absolute; + bottom: 0; + width: 100%; +} +</style> + +<body> + + <div class="container"> + <h1>A Demo for messaging in WebRTC</h1> + + <h3> + Run two instances of this webpage along with the server to test this + application.<br> Create an offer, and then send the message. <br>Check + the browser console to see the output. + </h3> + + <!--WebRTC related code--> + <button type="button" class="btn btn-primary" onclick='createOffer()'>Create + Offer</button> + <input id="messageInput" type="text" class="form-control" + placeholder="message"> + <button type="button" class="btn btn-primary" onclick='sendMessage()'>SEND</button> + <script src="client.js"></script> + <!--WebRTC related code--> + + </div> + <div class="footer">This application is intentionally made simple + to avoid cluttering with non WebRTC related code.</div> + +</body> + +</html> diff --git a/wicket/pom.xml b/wicket/pom.xml index c7e6bc20de..5175eca59c 100644 --- a/wicket/pom.xml +++ b/wicket/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baeldung.wicket.examples</groupId> <artifactId>wicket</artifactId> @@ -30,7 +30,7 @@ <scope>test</scope> </dependency> </dependencies> - + <build> <resources> <resource> diff --git a/wildfly/pom.xml b/wildfly/pom.xml index d7dd1e835b..e81b609206 100644 --- a/wildfly/pom.xml +++ b/wildfly/pom.xml @@ -1,13 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>org.springframework</groupId> <artifactId>wildfly</artifactId> <version>0.1.0</version> <name>wildfly</name> - <packaging>war</packaging> <parent> @@ -47,10 +45,6 @@ <!-- end::tests[] --> </dependencies> - <properties> - <java.version>1.8</java.version> - </properties> - <build> <plugins> <plugin> @@ -78,4 +72,9 @@ </plugin> </plugins> </build> + + <properties> + <java.version>1.8</java.version> + </properties> + </project> diff --git a/xml/pom.xml b/xml/pom.xml index bbd607f9b5..eb2d567957 100644 --- a/xml/pom.xml +++ b/xml/pom.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> @@ -137,68 +138,68 @@ </dependency> </dependencies> - <build> - <finalName>xml</finalName> - <resources> - <resource> - <directory>src/main/resources</directory> - <filtering>true</filtering> - </resource> - </resources> - <pluginManagement> - <plugins> - <plugin> - <groupId>org.jibx</groupId> - <artifactId>maven-jibx-plugin</artifactId> - </plugin> - </plugins> - </pluginManagement> - <plugins> - <plugin> - <groupId>org.jibx</groupId> - <artifactId>maven-jibx-plugin</artifactId> - <version>${maven-jibx-plugin.version}</version> - <configuration> - <directory>src/main/resources</directory> - <includes> - <includes>*-binding.xml</includes> - </includes> - <excludes> - <exclude>template-binding.xml</exclude> - </excludes> - <schemaBindingDirectory>src/main/resources</schemaBindingDirectory> - <includeSchemaBindings> - <includeSchemaBindings>*-binding.xml</includeSchemaBindings> - </includeSchemaBindings> - <verbose>true</verbose> - </configuration> - <executions> - <execution> - <id>process-classes</id> - <phase>process-classes</phase> - <goals> - <goal>bind</goal> - </goals> - </execution> - <execution> - <id>process-test-classes</id> - <phase>process-test-classes</phase> - <goals> - <goal>test-bind</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <artifactId>maven-compiler-plugin</artifactId> - <version>${maven-compiler-plugin.version}</version> - </plugin> - <plugin> - <artifactId>maven-surefire-plugin</artifactId> - <version>${maven-surefire-plugin.version}</version> - </plugin> - </plugins> - </build> + <build> + <finalName>xml</finalName> + <resources> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + </resource> + </resources> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.jibx</groupId> + <artifactId>maven-jibx-plugin</artifactId> + </plugin> + </plugins> + </pluginManagement> + <plugins> + <plugin> + <groupId>org.jibx</groupId> + <artifactId>maven-jibx-plugin</artifactId> + <version>${maven-jibx-plugin.version}</version> + <configuration> + <directory>src/main/resources</directory> + <includes> + <includes>*-binding.xml</includes> + </includes> + <excludes> + <exclude>template-binding.xml</exclude> + </excludes> + <schemaBindingDirectory>src/main/resources</schemaBindingDirectory> + <includeSchemaBindings> + <includeSchemaBindings>*-binding.xml</includeSchemaBindings> + </includeSchemaBindings> + <verbose>true</verbose> + </configuration> + <executions> + <execution> + <id>process-classes</id> + <phase>process-classes</phase> + <goals> + <goal>bind</goal> + </goals> + </execution> + <execution> + <id>process-test-classes</id> + <phase>process-test-classes</phase> + <goals> + <goal>test-bind</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <version>${maven-compiler-plugin.version}</version> + </plugin> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <version>${maven-surefire-plugin.version}</version> + </plugin> + </plugins> + </build> <profiles> <profile> diff --git a/xstream/pom.xml b/xstream/pom.xml index b98e258599..a703aa3774 100644 --- a/xstream/pom.xml +++ b/xstream/pom.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.baeldung</groupId> <artifactId>xstream</artifactId> @@ -25,7 +26,6 @@ <artifactId>jettison</artifactId> <version>${jettison.version}</version> </dependency> - </dependencies> <properties>